public void RemoveSubtypeField(SubtypeField subtypeField)
        {
            // Get Field
            int i = this.Rows.IndexOf(subtypeField);

            if (i == -1)
            {
                return;
            }

            // Remove Field
            this.Rows.RemoveAt(i);

            // Select Next Coded Value
            if (this.Rows.Count == 0)
            {
                return;
            }
            if (i != this.Rows.Count)
            {
                this.SelectedItem = this.Rows[i];
            }
            else
            {
                this.SelectedItem = this.Rows[this.Rows.Count - 1];
            }
        }
        //
        // CONSTRUCTOR
        //
        public Subtype(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <SubtypeName>
            XPathNavigator navigatorSubtypeName = navigator.SelectSingleNode("SubtypeName");
            if (navigatorSubtypeName != null) {
                this._subtypeName = navigatorSubtypeName.Value;
            }

            // <SubtypeCode>
            XPathNavigator navigatorSubtypeCode = navigator.SelectSingleNode("SubtypeCode");
            if (navigatorSubtypeCode != null) {
                this._subtypeCode = navigatorSubtypeCode.ValueAsInt;
            }

            // <FieldInfos><SubtypeFieldInfo>
            XPathNodeIterator interatorSubtypeFieldInfo = navigator.Select("FieldInfos/SubtypeFieldInfo");
            while (interatorSubtypeFieldInfo.MoveNext()) {
                // Create Field
                XPathNavigator navigatorSubtypeFieldInfo = interatorSubtypeFieldInfo.Current;
                SubtypeField subtypeField = new SubtypeField(navigatorSubtypeFieldInfo);

                // Add Field To Group
                this.Rows.Add(subtypeField);
            }

            // Refresh
            this.Refresh();
        }
Exemple #3
0
        protected override object CreateInstance(Type itemType)
        {
            SubtypeField subtypeField = (SubtypeField)base.CreateInstance(itemType);
            Table        table        = (Table)this.Context.Instance;

            subtypeField.SetTable2(table);
            return(subtypeField);
        }
        public SubtypeField(SubtypeField prototype) : base(prototype)
        {
            this._fieldName    = prototype.FieldName;
            this._domainName   = prototype.DomainName;
            this._defaultValue = prototype.DefaultValue;

            // Initialize
            this.UpdateText();
        }
        public List <SubtypeField> GetSubtypeFields()
        {
            List <SubtypeField> subtypeFields = new List <SubtypeField>();

            foreach (TableItem tableItem in this.Rows)
            {
                if (tableItem is SubtypeField)
                {
                    SubtypeField subtypeField = (SubtypeField)tableItem;
                    subtypeFields.Add(subtypeField);
                }
            }
            return(subtypeFields);
        }
Exemple #6
0
        protected override string GetDisplayText(object value)
        {
            SubtypeField subtypeField = value as SubtypeField;

            if (value == null)
            {
                return(string.Empty);
            }
            if (string.IsNullOrEmpty(subtypeField.FieldName))
            {
                return("New Subtype Field");
            }
            return(subtypeField.FieldName);
        }
        //
        // CONSTRUCTOR
        //
        public Subtype(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <SubtypeName>
            XPathNavigator navigatorSubtypeName = navigator.SelectSingleNode("SubtypeName");

            if (navigatorSubtypeName != null)
            {
                this._subtypeName = navigatorSubtypeName.Value;
            }

            // <SubtypeCode>
            XPathNavigator navigatorSubtypeCode = navigator.SelectSingleNode("SubtypeCode");

            if (navigatorSubtypeCode != null)
            {
                this._subtypeCode = navigatorSubtypeCode.ValueAsInt;
            }

            // <FieldInfos><SubtypeFieldInfo>
            XPathNodeIterator interatorSubtypeFieldInfo = navigator.Select("FieldInfos/SubtypeFieldInfo");

            while (interatorSubtypeFieldInfo.MoveNext())
            {
                // Create Field
                XPathNavigator navigatorSubtypeFieldInfo = interatorSubtypeFieldInfo.Current;
                SubtypeField   subtypeField = new SubtypeField(navigatorSubtypeFieldInfo);

                // Add Field To Group
                this.Rows.Add(subtypeField);
            }

            // Refresh
            this.Refresh();
        }
        public void RemoveSubtypeField(SubtypeField subtypeField) {
            // Get Field
            int i = this.Rows.IndexOf(subtypeField);
            if (i == -1) { return; }

            // Remove Field
            this.Rows.RemoveAt(i);

            // Select Next Coded Value
            if (this.Rows.Count == 0) { return; }
            if (i != this.Rows.Count) {
                this.SelectedItem = this.Rows[i];
            }
            else {
                this.SelectedItem = this.Rows[this.Rows.Count - 1];
            }
        }
 public void AddSubtypeField(SubtypeField subtypeField) {
     this.Rows.Add(subtypeField);
     this.SelectedItem = subtypeField;
 }
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(null);
            }
            if (context.Instance == null)
            {
                return(null);
            }

            // FeatureClass::ShapeFieldName, AreaFieldName, LengthFieldName, ShapeFieldName
            // GeometricNetworkControllerMembership::EnabledFieldName, AncillaryRoleFieldName
            // IndexField::Name
            // ObjectClass::OIDFieldName, GlobalIDFieldName, RasterFieldName, SubtypeFieldName, OIDFieldName, GlobalIDFieldName
            // RelationshipClass::OriginPrimary, OriginForeign, DestinationPrimary, DestinationForeign
            // SubtypeField::FieldName
            // NetWeightAssociation::FieldName
            // TerrainDataSource::HeightField, TagValueField

            // Create List
            List <string> list = new List <string>();

            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel           schemaModel           = diagrammerEnvironment.SchemaModel;

            if (context.PropertyDescriptor.ComponentType == typeof(IndexField))
            {
                IndexField  indexField  = (IndexField)context.Instance;
                ObjectClass objectClass = (ObjectClass)indexField.Table;
                foreach (Field field in objectClass.GetFields())
                {
                    list.Add(field.Name);
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(GeometricNetworkControllerMembership))
            {
                GeometricNetworkControllerMembership geometricNetworkControllerMembership = (GeometricNetworkControllerMembership)context.Instance;
                ObjectClass objectClass = schemaModel.FindParent(geometricNetworkControllerMembership);
                foreach (Field field in objectClass.GetFields())
                {
                    list.Add(field.Name);
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(SubtypeField))
            {
                SubtypeField subtypeField = (SubtypeField)context.Instance;
                Subtype      subtype      = (Subtype)subtypeField.Table;
                ObjectClass  objectClass  = subtype.GetParent();
                foreach (Field field in objectClass.GetFields())
                {
                    list.Add(field.Name);
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(ObjectClass))
            {
                ObjectClass objectClass = (ObjectClass)context.Instance;
                foreach (Field field in objectClass.GetFields())
                {
                    list.Add(field.Name);
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(RelationshipClass))
            {
                RelationshipClass relationshipClass = (RelationshipClass)context.Instance;
                if (relationshipClass.IsAttributed)
                {
                    switch (context.PropertyDescriptor.Name)
                    {
                    case "OIDFieldName":
                    case "GlobalIDFieldName":
                    case "RasterFieldName":
                    case "SubtypeFieldName":
                        foreach (Field field in relationshipClass.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;

                    case "OriginPrimary":
                        ObjectClass objectClass1 = schemaModel.FindObjectClass(relationshipClass.OriginClassName);
                        foreach (Field field in objectClass1.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;

                    case "OriginForeign":
                    case "DestinationForeign":
                        foreach (Field field in relationshipClass.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;

                    case "DestinationPrimary":
                        ObjectClass objectClass2 = schemaModel.FindObjectClass(relationshipClass.DestinationClassName);
                        foreach (Field field in objectClass2.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;
                    }
                }
                else
                {
                    switch (context.PropertyDescriptor.Name)
                    {
                    case "OIDFieldName":
                    case "GlobalIDFieldName":
                    case "RasterFieldName":
                    case "SubtypeFieldName":
                        foreach (Field field in relationshipClass.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;

                    case "OriginPrimary":
                        ObjectClass objectClass1 = schemaModel.FindObjectClass(relationshipClass.OriginClassName);
                        foreach (Field field in objectClass1.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;

                    case "OriginForeign":
                        ObjectClass objectClass2 = schemaModel.FindObjectClass(relationshipClass.DestinationClassName);
                        foreach (Field field in objectClass2.GetFields())
                        {
                            list.Add(field.Name);
                        }
                        break;

                    case "DestinationPrimary":
                    case "DestinationForeign":
                        break;
                    }
                }
            }
            else if (
                context.PropertyDescriptor.ComponentType == typeof(FeatureClass) ||
                context.PropertyDescriptor.ComponentType == typeof(RasterCatalog))
            {
                FeatureClass featureClass = (FeatureClass)context.Instance;
                foreach (Field field in featureClass.GetFields())
                {
                    list.Add(field.Name);
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(NetWeightAssociation))
            {
                NetWeightAssociation netWeightAssociation = (NetWeightAssociation)context.Instance;
                if (netWeightAssociation != null)
                {
                    if (!string.IsNullOrEmpty(netWeightAssociation.TableName))
                    {
                        ObjectClass objectClass = schemaModel.FindObjectClass(netWeightAssociation.TableName);
                        if (objectClass != null)
                        {
                            foreach (Field field in objectClass.GetFields())
                            {
                                list.Add(field.Name);
                            }
                        }
                    }
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(TerrainDataSource))
            {
                TerrainDataSource terrainDataSource = (TerrainDataSource)context.Instance;
                if (terrainDataSource != null)
                {
                    if (!string.IsNullOrEmpty(terrainDataSource.FeatureClassName))
                    {
                        ObjectClass objectClass = schemaModel.FindObjectClass(terrainDataSource.FeatureClassName);
                        if (objectClass != null)
                        {
                            foreach (Field field in objectClass.GetFields())
                            {
                                list.Add(field.Name);
                            }
                        }
                    }
                }
            }

            // Sort field name list and insert "None" item
            list.Sort();
            list.Insert(0, Resources.TEXT_NONE_BR);

            // Return sort field name list
            StandardValuesCollection svc = new StandardValuesCollection(list);

            return(svc);
        }
Exemple #11
0
        //
        // CONSTRUCTOR
        //
        public EsriShape(T parent) : base()
        {
            this._parent = parent;

            //
            this.SuspendEvents = true;

            // Get a stencil containing some basic shapes
            BasicStencil stencil = (BasicStencil)Crainiate.ERM4.Component.Instance.GetStencil(typeof(BasicStencil));

            this.BorderWidth   = 2f;
            this.Size          = new Size(100, 40);
            this.SmoothingMode = SmoothingMode.HighQuality;
            this.StencilItem   = stencil[BasicStencilType.RoundedRectangle];
            this.Label         = new TextLabel();
            this.Label.Color   = ModelSettings.Default.TextColor;

            if (typeof(T) == typeof(DomainCodedValue))
            {
                DomainCodedValue domainCodedValue = this._parent as DomainCodedValue;
                this.BorderColor   = ColorSettings.Default.CodedValueDomainColor;
                this.GradientColor = ColorSettings.Default.CodedValueDomainColor;
                this.Label.Text    = domainCodedValue.Name;
                this.Tooltip       = domainCodedValue.Name;
            }
            else if (typeof(T) == typeof(DomainRange))
            {
                DomainRange domainRange = this._parent as DomainRange;
                this.BorderColor   = ColorSettings.Default.RangeDomainColor;
                this.GradientColor = ColorSettings.Default.RangeDomainColor;
                this.Label.Text    = domainRange.Name;
                this.Tooltip       = domainRange.Name;
            }
            else if (typeof(T) == typeof(FeatureClass))
            {
                FeatureClass featureClass = this._parent as FeatureClass;
                this.BorderColor   = ColorSettings.Default.FeatureClassColor;
                this.GradientColor = ColorSettings.Default.FeatureClassColor;
                this.Label.Text    = featureClass.Name;
                this.Tooltip       = featureClass.Name;
            }
            else if (typeof(T) == typeof(ObjectClass))
            {
                ObjectClass objectClass = this._parent as ObjectClass;
                this.BorderColor   = ColorSettings.Default.ObjectClassColor;
                this.GradientColor = ColorSettings.Default.ObjectClassColor;
                this.Label.Text    = objectClass.Name;
                this.Tooltip       = objectClass.Name;
            }
            else if (typeof(T) == typeof(RelationshipClass))
            {
                RelationshipClass relationship = this._parent as RelationshipClass;
                this.BorderColor   = ColorSettings.Default.RelationshipColor;
                this.GradientColor = ColorSettings.Default.RelationshipColor;
                this.Label.Text    = relationship.Name;
                this.Tooltip       = relationship.Name;
            }
            else if (typeof(T) == typeof(Subtype))
            {
                Subtype subtype = this._parent as Subtype;
                this.BorderColor   = ColorSettings.Default.SubtypeColor;
                this.GradientColor = ColorSettings.Default.SubtypeColor;
                this.Label.Text    = subtype.SubtypeName;
                this.Tooltip       = subtype.SubtypeName;
            }
            else if (typeof(T) == typeof(Field))
            {
                Field field = this._parent as Field;
                this.BorderColor   = ColorSettings.Default.FieldColor;
                this.GradientColor = ColorSettings.Default.FieldColor;
                this.Label.Text    = field.Name;
                this.Tooltip       = field.Name;
            }
            else if (typeof(T) == typeof(SubtypeField))
            {
                SubtypeField subtypeField = this._parent as SubtypeField;
                this.BorderColor   = ColorSettings.Default.SubtypeFieldColor;
                this.GradientColor = ColorSettings.Default.SubtypeFieldColor;
                this.Label.Text    = subtypeField.FieldName;
                this.Tooltip       = subtypeField.FieldName;
            }
            else if (typeof(T) == typeof(FeatureDataset))
            {
                FeatureDataset featureDataset = this._parent as FeatureDataset;
                this.BorderColor   = ColorSettings.Default.FeatureDatasetColor;
                this.GradientColor = ColorSettings.Default.FeatureDatasetColor;
                this.Label.Text    = featureDataset.Name;
                this.Tooltip       = featureDataset.Name;
            }
            else if (typeof(T) == typeof(GeometricNetwork))
            {
                GeometricNetwork geometricNetwork = this._parent as GeometricNetwork;
                this.BorderColor   = ColorSettings.Default.GeometricNetworkColor;
                this.GradientColor = ColorSettings.Default.GeometricNetworkColor;
                this.Label.Text    = geometricNetwork.Name;
                this.Tooltip       = geometricNetwork.Name;
            }
            else if (typeof(T) == typeof(Network))
            {
                Network network = this._parent as Network;
                this.BorderColor   = ColorSettings.Default.NetworkColor;
                this.GradientColor = ColorSettings.Default.NetworkColor;
                this.Label.Text    = network.Name;
                this.Tooltip       = network.Name;
            }
            else if (typeof(T) == typeof(Topology))
            {
                Topology topology = this._parent as Topology;
                this.BorderColor   = ColorSettings.Default.TopologyColor;
                this.GradientColor = ColorSettings.Default.TopologyColor;
                this.Label.Text    = topology.Name;
                this.Tooltip       = topology.Name;
            }
            else if (typeof(T) == typeof(Terrain))
            {
                Terrain terrain = this._parent as Terrain;
                this.BorderColor   = ColorSettings.Default.TerrainColor;
                this.GradientColor = ColorSettings.Default.TerrainColor;
                this.Label.Text    = terrain.Name;
                this.Tooltip       = terrain.Name;
            }

            //
            this.SuspendEvents = false;
        }
 public void AddSubtypeField(SubtypeField subtypeField)
 {
     this.Rows.Add(subtypeField);
     this.SelectedItem = subtypeField;
 }
        public SubtypeField(SubtypeField prototype): base(prototype) {
            this._fieldName = prototype.FieldName;
            this._domainName = prototype.DomainName;
            this._defaultValue = prototype.DefaultValue;

            // Initialize
            this.UpdateText();
        }