예제 #1
0
        public FontStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource)
            : this()
        {
            m_editor = editor;
            m_schema = schema;

            var fs = (IFeatureSource)editor.ResourceService.GetResource(featureSource);

            _factory = (ILayerElementFactory)editor.GetEditedResource();

            m_providername = fs.Provider;
            m_featureSource = featureSource;

            propertyCombo.Items.Clear();
            foreach (var col in m_schema.Properties)
            {
                if (col.Type == PropertyDefinitionType.Data)
                    propertyCombo.Items.Add(col.Name);
            }
            propertyCombo.Items.Add(Strings.ExpressionItem);

            fontCombo.Items.Clear();
            foreach (FontFamily f in new System.Drawing.Text.InstalledFontCollection().Families)
                fontCombo.Items.Add(f.Name);
        }
예제 #2
0
파일: PreviewPane.cs 프로젝트: kanbang/Colt
        public PreviewPane(string fsId, QueryMode mode, ClassDefinition cls, IFeatureService featSvc, FdoProviderCapabilities caps)
            : this()
        {
            _fsId = fsId;
            _mode = mode;
            _cls = cls;
            _featSvc = featSvc;

            IQueryControl ctrl = null;
            switch (_mode)
            {
                case QueryMode.SQL:
                    ctrl = new SqlQueryCtrl(fsId, featSvc);
                    _inner = ctrl;
                    break;
                case QueryMode.Standard:
                    ctrl = new StandardQueryCtrl(fsId, featSvc, cls, caps);
                    _inner = ctrl;
                    break;
            }

            if (ctrl == null)
            {
                throw new ArgumentException(Strings.UnknownQueryMode);
            }

            ctrl.Content.Dock = DockStyle.Fill;
            queryPane.Controls.Add(ctrl.Content);
        }
예제 #3
0
        public ElevationDialog(IEditorService edSvc, IVectorScaleRange2 vsr2, string featureSourceId, ClassDefinition clsDef, string provider)
        {
            InitializeComponent();

            _edSvc = edSvc;
            _vsr2 = vsr2;
            _clsDef = clsDef;
            _provider = provider;
            _featureSourceId = featureSourceId;

            cmbUnits.DataSource = Enum.GetValues(typeof(LengthUnitType));
            cmbZOffsetType.DataSource = Enum.GetValues(typeof(ElevationTypeType));

            _elSettings = vsr2.ElevationSettings;
            grpSettings.Enabled = (_elSettings != null);
            chkEnabled.Checked = (_elSettings != null);

            if (_elSettings == null)
                _elSettings = vsr2.Create("0", "0", ElevationTypeType.RelativeToGround, LengthUnitType.Meters); //NOXLATE

            try
            {
                _init = true;

                txtZExtrusion.Text = _elSettings.ZExtrusion;
                txtZOffset.Text = _elSettings.ZOffset;
                cmbUnits.SelectedItem = _elSettings.Unit;
                cmbZOffsetType.SelectedItem = _elSettings.ZOffsetType;
            }
            finally
            {
                _init = false;
            }
        }
예제 #4
0
 public CalculationSettings(IEditorService edSvc, ClassDefinition cls, IFeatureSource parent, ICalculatedProperty calc)
     : this()
 {
     _edSvc = edSvc;
     _cls = cls;
     _parent = parent;
     TextBoxBinder.BindText(txtExpression, calc, "Expression"); //NOXLATE
     TextBoxBinder.BindText(txtName, calc, "Name"); //NOXLATE
 }
        public SymbolInstancePropertiesDialog(ISymbolInstance inst, IEditorService edSvc, ClassDefinition cls, string featureSourceId, string providerName)
            : this()
        {
            _edSvc = edSvc;
            _cls = cls;
            _featureSourceId = featureSourceId;
            _providerName = providerName;

            symAddToExclusionRegion.SetBooleanMode();
            symAddToExclusionRegion.Bind(inst, "AddToExclusionRegion");

            symCheckExclusionRegion.SetBooleanMode();
            symCheckExclusionRegion.Bind(inst, "CheckExclusionRegion");

            symDrawLast.SetBooleanMode();
            symDrawLast.Bind(inst, "DrawLast");

            symSizeContext.SetEnumMode<SizeContextType>();
            symSizeContext.Bind(inst, "SizeContext");

            symInsertOffsetX.Bind(inst, "InsertionOffsetX");
            symInsertOffsetY.Bind(inst, "InsertionOffsetY");

            symPositioningAlgorithm.Items = new string[]
            {
                "'Default'",
                "'EightSurrounding'",
                "'PathLabels'"
            };
            symPositioningAlgorithm.Bind(inst, "PositioningAlgorithm");

            symScaleX.Bind(inst, "ScaleX");
            symScaleY.Bind(inst, "ScaleY");

            var inst2 = inst as ISymbolInstance2;
            if (inst2 != null)
            {
                symGeometryContext.SetEnumMode<GeometryContextType>();
                symUsageContext.SetEnumMode<UsageContextType>();

                symRenderingPass.Bind(inst2, "RenderingPass");
                symGeometryContext.Bind(inst2, "GeometryContext");
                symUsageContext.Bind(inst2, "UsageContext");
            }
            else
            {
                symRenderingPass.Visible =
                symGeometryContext.Visible =
                symUsageContext.Visible =
                lblRenderingPass.Visible =
                lblGeometryContext.Visible =
                lblUsageContext.Visible = false;
            }
        }
 public FdoExpressionCompletionDataProvider(ClassDefinition cls, FdoProviderCapabilities caps)
 {
     _klass = cls;
     _caps = caps;
     this.DefaultIndex = 0;
     this.PreSelection = null;
     this.ImageList = new System.Windows.Forms.ImageList();
     this.ImageList.Images.Add(Properties.Resources.block);
     this.ImageList.Images.Add(Properties.Resources.property);
     this.ImageList.Images.Add(Properties.Resources.funnel);
 }
예제 #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StandardQueryCtrl"/> class.
 /// </summary>
 /// <param name="fsId">The fs id.</param>
 /// <param name="featSvc">The feat SVC.</param>
 /// <param name="cls">The CLS.</param>
 /// <param name="caps">The caps.</param>
 public StandardQueryCtrl(string fsId, IFeatureService featSvc, ClassDefinition cls, FdoProviderCapabilities caps)
     : this()
 {
     _fsId = fsId;
     _featSvc = featSvc;
     _cls = cls;
     _caps = caps;
     foreach (var prop in cls.Properties)
     {
         chkProperties.Items.Add(prop.Name, true);
     }
 }
예제 #8
0
        public ThemeCreator(IEditorService editor, ILayerDefinition layer, ClassDefinition schema, object ruleCollection)
            : this()
        {
            m_editor = editor;
            m_layer = layer;
            m_featureClass = schema;
            m_ruleCollection = ruleCollection;

            _factory = (ILayerElementFactory2)editor.GetEditedResource();

            ColorBrewerColorSet.SetCustomRender(new CustomCombo.RenderCustomItem(DrawColorSetPreview));
        }
예제 #9
0
        public SelectJoinKeyDialog(ClassDefinition primary, ClassDefinition secondary)
            : this()
        {
            lblPrimary.Text = primary.QualifiedName;
            lblSecondary.Text = secondary.QualifiedName;

            cmbPrimary.DisplayMember = "Name"; //NOXLATE
            cmbSecondary.DisplayMember = "Name"; //NOXLATE

            cmbPrimary.DataSource = primary.Properties;
            cmbSecondary.DataSource = secondary.Properties;

            cmbPrimary.SelectedIndex = 0;
            cmbSecondary.SelectedIndex = 0;
        }
        private void RemoveInvalidMappings(OSGeo.MapGuide.MaestroAPI.Schema.ClassDefinition cls)
        {
            var remove = new List <INameStringPair>();

            foreach (var mp in _vl.PropertyMapping)
            {
                if (cls.FindProperty(mp.Name) == null)
                {
                    remove.Add(mp);
                }
            }

            foreach (var mp in remove)
            {
                _vl.RemovePropertyMapping(mp);
            }
        }
예제 #11
0
파일: Utility.cs 프로젝트: kanbang/Colt
        public static ClassDefinition ConvertClassDefinition(MgClassDefinition mgClass)
        {
            var cls = new ClassDefinition(mgClass.Name, mgClass.Description);
            //foreach (var prop in mgClass.GetProperties())
            var props = mgClass.GetProperties();
            int pcount = props.GetCount();
            for (int i = 0; i < pcount; i++)
            {
                var prop = props.GetItem(i);
                if (prop.PropertyType == MgFeaturePropertyType.DataProperty)
                {
                    MgDataPropertyDefinition mgData = (MgDataPropertyDefinition)prop;
                    var dp = ConvertDataProperty(mgData);

                    //API Bug? passing object reference gives incorrect result for identity
                    //properties
                    bool identity = (mgClass.GetIdentityProperties().Contains(prop.Name));
                    cls.AddProperty(dp, identity);
                }
                else if (prop.PropertyType == MgFeaturePropertyType.GeometricProperty)
                {
                    MgGeometricPropertyDefinition mgGeom = (MgGeometricPropertyDefinition)prop;
                    var geom = ConvertGeometricProperty(mgGeom);

                    cls.AddProperty(geom);
                }
                else if (prop.PropertyType == MgFeaturePropertyType.RasterProperty)
                {
                    MgRasterPropertyDefinition mgRaster = (MgRasterPropertyDefinition)prop;
                    var raster = ConvertRasterProperty(mgRaster);

                    cls.AddProperty(raster);
                }
                else if (prop.PropertyType == MgFeaturePropertyType.ObjectProperty)
                {

                }
                else if (prop.PropertyType == MgFeaturePropertyType.AssociationProperty)
                {
                }
            }

            cls.DefaultGeometryPropertyName = mgClass.DefaultGeometryPropertyName;

            return cls;
        }
예제 #12
0
        public SymbolInstancesDialog(IEditorService edSvc, ICompositeSymbolization comp, ClassDefinition cls, string provider, string featureSourceId, ILayerStylePreviewable prev)
        {
            InitializeComponent();
            _edSvc = edSvc;
            _comp = comp;

            _cls = cls;
            _provider = provider;
            _featureSourceId = featureSourceId;

            _preview = prev;
            var conn = edSvc.GetEditedResource().CurrentConnection;
            if (Array.IndexOf(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
            {
                _mappingSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
            }

            foreach (var inst in _comp.SymbolInstance)
                AddInstance(inst, false);
        }
예제 #13
0
        internal AreaFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, ILayerStylePreviewable prev)
            : this()
        {
            m_editor = editor;
            m_schema = schema;

            _factory = (ILayerElementFactory)editor.GetEditedResource();
            var fs = (IFeatureSource)m_editor.ResourceService.GetResource(featureSource);

            m_providername = fs.Provider;
            m_featureSource = featureSource;

            _preview = prev;
            var conn = editor.GetEditedResource().CurrentConnection;
            if (Array.IndexOf(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
            {
                _mappingSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
            }
            lnkRefresh.Visible = this.UseLayerIconPreview;
        }
예제 #14
0
        public void SetContent(ISymbolInstance symRef, IEditorService edSvc, ClassDefinition cls, string provider, string featureSourceId)
        {
            _symRef = symRef;
            _edSvc = edSvc;

            _cls = cls;
            _provider = provider;
            _featureSourceId = featureSourceId;

            _params.Clear();
            //Add existing overrides
            foreach (var p in symRef.ParameterOverrides.Override)
            {
                _params.Add(p);
            }
            //Now add available parameters
            PopulateAvailableParameters();
            grpSettings.Controls.Clear();
            Control c = CreateEditor(symRef, edSvc.ResourceService);
            c.Dock = DockStyle.Fill;
            grpSettings.Controls.Add(c);
        }
예제 #15
0
파일: Form1.cs 프로젝트: kanbang/Colt
        private TreeNode CreateClassNode(ClassDefinition cls)
        {
            var node = new TreeNode();
            node.Name = cls.Name;
            node.Text = cls.Name;

            foreach (PropertyDefinition prop in cls.Properties)
            {
                var pNode = new TreeNode();
                pNode.Name = prop.Name;
                pNode.Text = prop.Name;

                pNode.Tag = prop;

                node.Nodes.Add(pNode);
            }

            node.Tag = cls;
            return node;
        }
예제 #16
0
 /// <summary>
 /// Gets the index of the specified class definition
 /// </summary>
 /// <param name="cls"></param>
 /// <returns></returns>
 public int IndexOf(ClassDefinition cls) => _classes.IndexOf(cls);
예제 #17
0
        private void SetFeatureClass(ClassDefinition item)
        {
            txtFeatureClass.Text = item.QualifiedName;
            _selectedClass = item;

            //See if geometry needs invalidation
            bool invalidate = true;
            foreach (var col in item.Properties)
            {
                if (col.Type == PropertyDefinitionType.Raster && col.Name.Equals(txtGeometry.Text))
                {
                    invalidate = false;
                    break;
                }
            }
            if (invalidate)
            {
                txtGeometry.Text = string.Empty;
            }

            //See if we can auto-assign geometry
            List<PropertyDefinition> geoms = new List<PropertyDefinition>();
            foreach (var col in _selectedClass.Properties)
            {
                if (col.Type == PropertyDefinitionType.Raster)
                    geoms.Add(col);
            }

            if (geoms.Count == 1)
                txtGeometry.Text = geoms[0].Name;

            //OnFeatureClassChanged();
        }
예제 #18
0
파일: FeatureBase.cs 프로젝트: kanbang/Colt
        /// <summary>
        /// Initializes a new instance of the <see cref="FeatureBase"/> class.
        /// </summary>
        /// <param name="clsDef">The class definition.</param>
        public FeatureBase(ClassDefinition clsDef)
            : base()
        {
            _clsDef = clsDef;

            for (int i = 0; i < clsDef.Properties.Count; i++)
            {
                var prop = clsDef[i];
                _ordinalMap[i] = prop.Name;
                switch (prop.Type)
                {
                    case PropertyDefinitionType.Data:
                        {
                            DataPropertyDefinition dp = (DataPropertyDefinition)prop;
                            switch (dp.DataType)
                            {
                                case DataPropertyType.Blob:
                                    _values[prop.Name] = new BlobValue();
                                    break;
                                case DataPropertyType.Boolean:
                                    _values[prop.Name] = new BooleanValue();
                                    break;
                                case DataPropertyType.Byte:
                                    _values[prop.Name] = new ByteValue();
                                    break;
                                case DataPropertyType.Clob:
                                    _values[prop.Name] = new ClobValue();
                                    break;
                                case DataPropertyType.DateTime:
                                    _values[prop.Name] = new DateTimeValue();
                                    break;
                                case DataPropertyType.Double:
                                    _values[prop.Name] = new DoubleValue();
                                    break;
                                case DataPropertyType.Int16:
                                    _values[prop.Name] = new Int16Value();
                                    break;
                                case DataPropertyType.Int32:
                                    _values[prop.Name] = new Int32Value();
                                    break;
                                case DataPropertyType.Int64:
                                    _values[prop.Name] = new Int64Value();
                                    break;
                                case DataPropertyType.Single:
                                    _values[prop.Name] = new SingleValue();
                                    break;
                                case DataPropertyType.String:
                                    _values[prop.Name] = new StringValue();
                                    break;
                            }
                        }
                        break;
                    case PropertyDefinitionType.Geometry:
                        _values[prop.Name] = new GeometryValue();
                        break;
                    case PropertyDefinitionType.Object:
                        _values[prop.Name] = new FeatureValue();
                        break;
                    case PropertyDefinitionType.Raster:
                        _values[prop.Name] = new RasterValue();
                        break;
                }
            }
        }
예제 #19
0
        private static void UpdateClassNode(TreeNode classNode, ClassDefinition cls)
        {
            //var classNode = new TreeNode(cls.Name);
            classNode.Nodes.Clear();
            classNode.Name = cls.Name;
            classNode.Text = cls.Name;
            var clsTag = classNode.Tag as ClassNodeTag;
            if (clsTag == null)
            {
                classNode.Tag = new ClassNodeTag(cls.Parent.Name, cls.Name) { Loaded = true, Class = cls };
            }
            else
            {
                clsTag.Loaded = true;
                clsTag.Class = cls;
            }
            classNode.ImageIndex = classNode.SelectedImageIndex = IDX_CLASS;

            classNode.ToolTipText = string.Format(Strings.FsPreview_ClassNodeTooltip,
                cls.Name,
                cls.Description,
                cls.DefaultGeometryPropertyName,
                Environment.NewLine);

            foreach (var prop in cls.Properties)
            {
                var propNode = new TreeNode(prop.Name);
                propNode.Text = prop.Name;
                propNode.Tag = prop;

                if (prop.Type == PropertyDefinitionType.Geometry)
                {
                    var g = (GeometricPropertyDefinition)prop;
                    propNode.ImageIndex = propNode.SelectedImageIndex = IDX_GEOMETRY;
                    propNode.ToolTipText = string.Format(Strings.FsPreview_GeometryPropertyNodeTooltip,
                        g.Name,
                        g.Description,
                        g.GeometryTypesToString(),
                        g.IsReadOnly,
                        g.HasElevation,
                        g.HasMeasure,
                        g.SpatialContextAssociation,
                        Environment.NewLine);
                }
                else if (prop.Type == PropertyDefinitionType.Data)
                {
                    var d = (DataPropertyDefinition)prop;
                    if (cls.IdentityProperties.Contains((DataPropertyDefinition)prop))
                        propNode.ImageIndex = propNode.SelectedImageIndex = IDX_IDENTITY;
                    else
                        propNode.ImageIndex = propNode.SelectedImageIndex = IDX_PROP;

                    propNode.ToolTipText = string.Format(Strings.FsPreview_DataPropertyNodeTooltip,
                        d.Name,
                        d.Description,
                        d.DataType.ToString(),
                        d.IsNullable,
                        d.IsReadOnly,
                        d.Length,
                        d.Precision,
                        d.Scale,
                        Environment.NewLine);
                }
                else if (prop.Type == PropertyDefinitionType.Raster)
                {
                    var r = (RasterPropertyDefinition)prop;
                    propNode.ImageIndex = propNode.SelectedImageIndex = IDX_RASTER;

                    propNode.ToolTipText = string.Format(Strings.FsPreview_RasterPropertyNodeTooltip,
                        r.Name,
                        r.Description,
                        r.IsNullable,
                        r.DefaultImageXSize,
                        r.DefaultImageYSize,
                        r.SpatialContextAssociation,
                        Environment.NewLine);
                }
                else
                {
                    propNode.ImageIndex = propNode.SelectedImageIndex = IDX_PROP;
                }

                classNode.Nodes.Add(propNode);
            }
        }
예제 #20
0
        protected override void OnLoad(EventArgs e)
        {
            if (_cachedDesc == null)
                _cachedDesc = _edsvc.FeatureService.DescribeFeatureSource(txtFeatureSource.Text);

            //Init cached schemas and selected class
            if (!string.IsNullOrEmpty(txtFeatureClass.Text))
            {
                var cls = _cachedDesc.GetClass(txtFeatureClass.Text);
                if (cls != null)
                {
                    _selectedClass = cls;
                }
            }
            else
            {
                SetFeatureClass(_cachedDesc.Schemas[0].Classes[0]);
            }
        }
예제 #21
0
 internal PointFeatureStyleEditor(IEditorService editor, ClassDefinition schema, string featureSource, Image currentW2D, ILayerStylePreviewable prev)
     : this(editor, schema, featureSource, prev)
 {
     grpW2DStyle.Tag = currentW2D;
 }
예제 #22
0
 /// <summary>
 /// Edits the expression.
 /// </summary>
 /// <param name="currentExpr">The current expr.</param>
 /// <param name="classDef">The class def.</param>
 /// <param name="providerName">Name of the provider.</param>
 /// <param name="featureSourceId">The feature source id.</param>
 /// <param name="attachStylizationFunctions">If true, FDO stylization functions are also included in the function list</param>
 /// <returns></returns>
 public string EditExpression(string currentExpr, ClassDefinition classDef, string providerName, string featureSourceId, bool attachStylizationFunctions)
 {
     var ed = FdoExpressionEditorFactory.Create(); new ExpressionEditor();
     var caps = this.FeatureService.GetProviderCapabilities(providerName);
     ed.Initialize(this.FeatureService, caps, classDef, featureSourceId, attachStylizationFunctions);
     ed.Expression = currentExpr;
     if (ed.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         return ed.Expression;
     }
     return null;
 }
예제 #23
0
        private WmsConfigurationDocument BuildDefaultWmsDocument()
        {
            var doc = new WmsConfigurationDocument();
            var contexts = _fs.GetSpatialInfo(false);
            var schemaName = _fs.GetSchemaNames()[0];
            var clsNames = _fs.GetClassNames(schemaName);
            var schema = new FeatureSchema(schemaName, string.Empty);
            doc.AddSchema(schema);

            foreach (var sc in contexts.SpatialContext)
            {
                doc.AddSpatialContext(sc);
            }

            var defaultSc = contexts.SpatialContext[0];

            foreach (var clsName in clsNames)
            {
                var className = clsName.Split(':')[1]; //NOXLATE
                var cls = new ClassDefinition(className, string.Empty);
                cls.AddProperty(new DataPropertyDefinition("Id", string.Empty) //NOXLATE
                {
                    DataType = DataPropertyType.String,
                    Length = 256,
                    IsNullable = false
                }, true);
                cls.AddProperty(new RasterPropertyDefinition("Image", string.Empty) //NOXLATE
                {
                    DefaultImageXSize = 1024,
                    DefaultImageYSize = 1024,
                    SpatialContextAssociation = defaultSc.Name
                });

                schema.AddClass(cls);

                var item = CreateDefaultItem(schema.Name, cls.Name, "Image", defaultSc); //NOXLATE
                doc.AddRasterItem(item);
            }

            return doc;
        }
예제 #24
0
        private void lstFeatureClasses_SelectedIndexChanged(object sender, EventArgs e)
        {
            var item = (RasterWmsItem)lstFeatureClasses.SelectedItem;
            grpRaster.Controls.Clear();
            _updatingLogicalClassUI = true;
            try
            {
                if (item != null)
                {
                    var ctrl = new RasterDefinitionCtrl(_config, item, _service);
                    ctrl.Dock = DockStyle.Fill;
                    grpRaster.Controls.Add(ctrl);

                    btnRemove.Enabled = true;

                    //Get logical class
                    string schemaName = item.SchemaName;
                    string className = item.FeatureClass;

                    if (!string.IsNullOrEmpty(schemaName) && !string.IsNullOrEmpty(className))
                    {
                        _logicalClass = _config.GetClass(schemaName, className);
                        if (_logicalClass != null)
                        {
                            txtClassName.Text = _logicalClass.Name;
                            txtClassDescription.Text = _logicalClass.Description;
                        }
                        else
                        {
                            txtClassName.Text = string.Empty;
                            txtClassDescription.Text = string.Empty;
                        }
                    }
                    else
                    {
                        _logicalClass = null;
                        txtClassName.Text = string.Empty;
                        txtClassDescription.Text = string.Empty;
                    }
                }
                else
                {
                    _logicalClass = null;
                    txtClassName.Text = string.Empty;
                    txtClassDescription.Text = string.Empty;
                }
            }
            finally
            {
                _updatingLogicalClassUI = false;
            }
            grpLogicalClass.Enabled = (_logicalClass != null);
        }
예제 #25
0
        private void btnSwapAll_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Strings.ConfirmWmsLogicalClassSwap, string.Empty, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
            {
                using (new WaitCursor(this))
                {
                    _logicalClass = null;
                    lstFeatureClasses.SelectedItem = null;
                    foreach (var item in _config.RasterOverrides)
                    {
                        var cls = _config.GetClass(item.SchemaName, item.FeatureClass);
                        if (cls == null)
                            continue;

                        var tmp = cls.Name;
                        cls.Name = cls.Description;
                        cls.Description = tmp;

                        item.FeatureClass = cls.Name;
                    }
                    lstFeatureClasses.DataSource = _config.RasterOverrides; //rebind
                }
            }
        }
예제 #26
0
 private static RasterPropertyDefinition GetRasterProperty(ClassDefinition cls)
 {
     foreach (var prop in cls.Properties)
     {
         if (prop.Type == OSGeo.MapGuide.MaestroAPI.Schema.PropertyDefinitionType.Raster)
             return (RasterPropertyDefinition)prop;
     }
     return null;
 }
예제 #27
0
 /// <summary>
 /// Adds the specified class definition
 /// </summary>
 /// <param name="cls"></param>
 public void AddClass(ClassDefinition cls)
 {
     _classes.Add(cls);
     cls.Parent = this;
 }
예제 #28
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 /// <param name="feature"></param>
 /// <param name="source"></param>
 protected MutableFeatureBase(IRecordInitialize feature, ClassDefinition source)
     : base(feature)
 {
     _clsDef = ClassDefinition.Clone(source);
 }
예제 #29
0
 /// <summary>
 /// Creates a clone of the specified instance
 /// </summary>
 /// <param name="source">The instance to clone.</param>
 /// <returns></returns>
 public static ClassDefinition Clone(ClassDefinition source)
 {
     var clone = new ClassDefinition(source.Name, source.Description);
     foreach (var prop in source.Properties)
     {
         var clonedProp = PropertyDefinition.Clone(prop);
         if (clonedProp.Type == PropertyDefinitionType.Data &&
             source.IdentityProperties.Contains((DataPropertyDefinition)prop))
         {
             clone.AddProperty((DataPropertyDefinition)clonedProp, true);
         }
         else
         {
             clone.AddProperty(clonedProp);
         }
     }
     clone.DefaultGeometryPropertyName = source.DefaultGeometryPropertyName;
     clone.IsAbstract = source.IsAbstract;
     clone.IsComputed = source.IsComputed;
     if (source.Parent != null)
         clone.Parent = new FeatureSchema(source.Parent.Name, source.Parent.Description);
     //TODO: Base Class
     return clone;
 }
예제 #30
0
        protected override void OnLoad(EventArgs e)
        {
            if (this.DesignMode)
                return;

            //Init cached schemas and selected class
            if (!string.IsNullOrEmpty(txtFeatureClass.Text))
            {
                var cls = _edsvc.FeatureService.GetClassDefinition(txtFeatureSource.Text, txtFeatureClass.Text);
                if (cls != null)
                {
                    _selectedClass = cls;
                    OnFeatureClassChanged();
                }
            }
        }
예제 #31
0
        /// <summary>
        /// Initializes the dialog.
        /// </summary>
        /// <param name="featSvc">The feature service.</param>
        /// <param name="caps">The provider capabilities.</param>
        /// <param name="cls">The class definition.</param>
        /// <param name="featuresSourceId">The features source id.</param>
        /// <param name="attachStylizationFunctions">if set to <c>true</c> stylization functions are also attached</param>
        public void Initialize(IFeatureService featSvc, FdoProviderCapabilities caps, ClassDefinition cls, string featuresSourceId, bool attachStylizationFunctions)
        {
            try
            {
                _cls = cls;
                _featSvc = featSvc;
                m_featureSource = featuresSourceId;
                _caps = caps;

                SortedList<string, PropertyDefinition> sortedCols = new SortedList<string, PropertyDefinition>();
                foreach (var col in _cls.Properties)
                {
                    sortedCols.Add(col.Name, col);
                }

                ColumnName.Items.Clear();
                ColumnName.Tag = sortedCols;

                foreach (var col in sortedCols.Values)
                {
                    string name = col.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.Click += delegate
                    {
                        InsertText(name);
                    };
                    btnProperties.DropDown.Items.Add(btn);

                    ColumnName.Items.Add(name);
                }

                if (ColumnName.Items.Count > 0)
                    ColumnName.SelectedIndex = 0;

                //Functions
                SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition> sortedFuncs = new SortedList<string, FdoProviderCapabilitiesExpressionFunctionDefinition>();
                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in caps.Expression.FunctionDefinitionList)
                {
                    sortedFuncs.Add(func.Name, func);
                }

                if (attachStylizationFunctions)
                {
                    foreach (var func in Utility.GetStylizationFunctions())
                    {
                        sortedFuncs.Add(func.Name, func);
                    }
                }

                foreach (FdoProviderCapabilitiesExpressionFunctionDefinition func in sortedFuncs.Values)
                {
                    string name = func.Name;
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = name;
                    btn.Text = name;
                    btn.ToolTipText = func.Description;

                    string fmt = "{0}({1})"; //NOXLATE
                    List<string> args = new List<string>();
                    foreach (FdoProviderCapabilitiesExpressionFunctionDefinitionArgumentDefinition argDef in func.ArgumentDefinitionList)
                    {
                        args.Add(argDef.Name.Trim());
                    }
                    string expr = string.Format(fmt, name, FdoExpressionCompletionDataProvider.StringifyFunctionArgs(args));
                    btn.Click += delegate
                    {
                        InsertText(expr);
                    };
                    btnFunctions.DropDown.Items.Add(btn);
                }

                //Spatial Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Spatial)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnSpatial.DropDown.Items.Add(btn);
                }

                //Distance Operators
                foreach (FdoProviderCapabilitiesFilterOperation1 op in caps.Filter.Distance)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnDistance.DropDown.Items.Add(btn);
                }

                //Conditional Operators
                foreach (FdoProviderCapabilitiesFilterOperation op in caps.Filter.Condition)
                {
                    string name = op.ToString().ToUpper();
                    ToolStripButton btn = new ToolStripButton();
                    btn.Name = btn.Text = btn.ToolTipText = op.ToString();
                    btn.Click += delegate
                    {
                        InsertSpatialFilter(name);
                    };
                    btnCondition.DropDown.Items.Add(btn);
                }
            }
            catch
            {
            }
        }
예제 #32
0
        private void UpdateColumns()
        {
            if (txtLayer.Tag != null)
            {
                _columns.Clear();

                var ldf = (ILayerDefinition)_edsvc.ResourceService.GetResource(txtLayer.Tag.ToString());
                var vl = (IVectorLayerDefinition)ldf.SubLayer;

                _cls = _edsvc.FeatureService.GetClassDefinition(vl.ResourceId, vl.FeatureName);

                COL_PROPERTY.DisplayMember = "Name";
                COL_PROPERTY.DataSource = _cls.Properties;
            }
        }
예제 #33
0
        void AddPreviewPane(ClassDefinition cls, QueryMode mode)
        {
            if (mode == QueryMode.SQL)
            {
                if (!hasSql)
                {
                    var pane = new PreviewPane(currentFsId, mode, cls, _fsvc, _caps);
                    var page = new TabPage();
                    page.Text = Strings.SQLQuery;
                    page.Tag = mode;
                    pane.Dock = DockStyle.Fill;
                    page.Controls.Add(pane);
                    tabPreviews.TabPages.Add(page);
                    tabPreviews.SelectedIndex = tabPreviews.TabPages.IndexOf(page);
                    hasSql = true;
                }
            }
            else
            {
                var pane = new PreviewPane(currentFsId, mode, cls, _fsvc, _caps);
                var page = new TabPage();
                page.Text = Strings.StandardQuery + " - " + cls.QualifiedName; //NOXLATE
                page.Tag = mode;
                pane.Dock = DockStyle.Fill;
                page.Controls.Add(pane);
                tabPreviews.TabPages.Add(page);
                tabPreviews.SelectedIndex = tabPreviews.TabPages.IndexOf(page);
            }

            btnClose.Enabled = (tabPreviews.TabPages.Count > 0);
        }