private void Model_ElementRemoved(object sender, ElementsEventArgs e)
        {
            // Check Terrain
            if (this._terrain == null)
            {
                return;
            }

            // Get Element
            Element element = e.Value;

            if (element == null)
            {
                return;
            }
            EsriLine <TerrainDataSource> line = element as EsriLine <TerrainDataSource>;

            if (line == null)
            {
                return;
            }

            // Get Rule
            TerrainDataSource terrainDataSource = line.Parent;

            //
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel           schemaModel           = diagrammerEnvironment.SchemaModel;
            Terrain terrain = schemaModel.FindParent(terrainDataSource);

            if (terrain != null)
            {
                terrain.TerrainDataSources.Remove(terrainDataSource);
            }
        }
        private void Model_ElementInvalid(object sender, ElementEventArgs e)
        {
            // Exit if GeometricNetwork Does not Exist
            if (this._terrain == null)
            {
                return;
            }

            // Get Element
            Element element = e.Value;

            if (element == null)
            {
                return;
            }
            EsriLine <TerrainDataSource> line = element as EsriLine <TerrainDataSource>;

            if (line == null)
            {
                return;
            }

            // Get Controller
            TerrainDataSource terrainDataSource = line.Parent;

            // Suspend Rule Events
            terrainDataSource.Suspend();

            // Get Start and End Elements
            Element elementStart = line.Start.Shape;
            Element elementEnd   = line.End.Shape;

            // Update FeatureClass Name Property
            if (elementEnd == null)
            {
                terrainDataSource.FeatureClassName = string.Empty;
            }
            else if (elementEnd is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape        = (EsriShape <FeatureClass>)elementEnd;
                FeatureClass             featureClass = shape.Parent;
                terrainDataSource.FeatureClassName = featureClass.Name;
            }

            // Add if missing
            if (!this._terrain.TerrainDataSources.Contains(terrainDataSource))
            {
                this._terrain.TerrainDataSources.Add(terrainDataSource);
            }

            // Resume Controller Events
            terrainDataSource.Resume();
        }
Esempio n. 3
0
 public TerrainDataSource(TerrainDataSource prototype) : base(prototype)
 {
     this._featureClassID       = prototype.FeatureClassID;
     this._featureClassName     = prototype.FeatureClassName;
     this._groupID              = prototype.GroupID;
     this._sourceStatus         = prototype.SourceStatus;
     this._sourceType           = prototype.SourceType;
     this._surfaceFeatureType   = prototype.SurfaceFeatureType;
     this._isBase               = prototype.IsBase;
     this._anchored             = prototype.Anchored;
     this._applyToOverview      = prototype.ApplyToOverview;
     this._autoGeneralize       = prototype.AutoGeneralize;
     this._resolutionLowerBound = prototype.ResolutionLowerBound;
     this._resolutionUpperBound = prototype.ResolutionUpperBound;
     this._sourceName           = prototype.SourceName;
     this._heightField          = prototype.HeightField;
     this._tagValueField        = prototype.TagValueField;
     this._reservedFields       = new List <string>();
     foreach (string reservedField in prototype.ReservedFields)
     {
         this._reservedFields.Add(reservedField);
     }
 }
Esempio n. 4
0
 public Terrain FindParent(TerrainDataSource terrainDataSource) {
     foreach (Element element in this.Shapes.Values) {
         if (element is Terrain) {
             Terrain terrain = (Terrain)element;
             if (terrain.TerrainDataSources.Contains(terrainDataSource)) {
                 return terrain;
             }
         }
     }
     return null;
 }
        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);
        }
Esempio n. 6
0
        //
        // CONSTRUCTOR
        //
        public Terrain(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <ConfigurationKeyword></ConfigurationKeyword>
            XPathNavigator navigatorConfigurationKeyword = navigator.SelectSingleNode("ConfigurationKeyword");
            if (navigatorConfigurationKeyword != null) {
                this._configurationKeyword = navigatorConfigurationKeyword.Value;
            }

            // <Extent></Extent>
            XPathNavigator navigatorExtent = navigator.SelectSingleNode("Extent");
            if (navigatorExtent != null && !string.IsNullOrEmpty(navigatorExtent.InnerXml)) {
                this._extent = new Extent(navigatorExtent);
            }

            // <SpatialReference></SpatialReference>
            XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference");
            if (navigatorSpatialReference != null && !string.IsNullOrEmpty(navigatorSpatialReference.InnerXml)) {
                this._spatialReference = new SpatialReference(navigatorSpatialReference);
            }

            // <FeatureDatasetName></FeatureDatasetName> 
            // Do not load. This can be inferred.

            // <PyramidType></PyramidType>
            XPathNavigator navigatorPyramidType = navigator.SelectSingleNode("PyramidType");
            if (navigatorPyramidType != null) {
                this._pyramidType = (esriTerrainPyramidType)Enum.Parse(typeof(esriTerrainPyramidType), navigatorPyramidType.Value, true);
            }

            // <WindowSizeMethod></WindowSizeMethod>
            XPathNavigator navigatorWindowSizeMethod = navigator.SelectSingleNode("WindowSizeMethod");
            if (navigatorWindowSizeMethod != null) {
                this._windowSizeMethod = (esriTerrainWindowSizeMethod)Enum.Parse(typeof(esriTerrainWindowSizeMethod), navigatorWindowSizeMethod.Value, true);
            }

            // <WindowSizeZThreshold></WindowSizeZThreshold>
            XPathNavigator navigatorWindowSizeZThreshold = navigator.SelectSingleNode("WindowSizeZThreshold");
            if (navigatorWindowSizeZThreshold != null) {
                this._windowSizeZThreshold = navigatorWindowSizeZThreshold.ValueAsDouble;
            }

            // <WindowSizeZThresholdStrategy></WindowSizeZThresholdStrategy>
            XPathNavigator navigatorWindowSizeZThresholdStrategy = navigator.SelectSingleNode("WindowSizeZThresholdStrategy");
            if (navigatorWindowSizeZThresholdStrategy != null) {
                this._windowSizeZThresholdStrategy = (esriTerrainZThresholdStrategy)Enum.Parse(typeof(esriTerrainZThresholdStrategy), navigatorWindowSizeZThresholdStrategy.Value, true);
            }

            // <TileSize></TileSize>
            XPathNavigator navigatorTileSize = navigator.SelectSingleNode("TileSize");
            if (navigatorTileSize != null) {
                this._tileSize = navigatorTileSize.ValueAsDouble;
            }

            // <MaxShapeSize></MaxShapeSize>
            XPathNavigator navigatorMaxShapeSize = navigator.SelectSingleNode("MaxShapeSize");
            if (navigatorMaxShapeSize != null) {
                this._maxShapeSize = navigatorMaxShapeSize.ValueAsInt;
            }

            // <MaxOverviewSize></MaxOverviewSize>
            XPathNavigator navigatorMaxOverviewSize = navigator.SelectSingleNode("MaxOverviewSize");
            if (navigatorMaxOverviewSize != null) {
                this._maxOverviewSize = navigatorMaxOverviewSize.ValueAsInt;
            }

            // <ExtentDomain></ExtentDomain>
            XPathNavigator navigatorExtentDomain = navigator.SelectSingleNode("ExtentDomain");
            if (navigatorExtentDomain != null && !string.IsNullOrEmpty(navigatorExtentDomain.InnerXml)) {
                this._extentDomain = new Extent(navigatorExtentDomain);
            }

            // <ExtentAOI></ExtentAOI>
            XPathNavigator navigatorExtentAOI = navigator.SelectSingleNode("ExtentAOI");
            if (navigatorExtentAOI != null && !string.IsNullOrEmpty(navigatorExtentAOI.InnerXml)) {
                this._extentAOI = new Extent(navigatorExtentAOI);
            }

            // <TerrainDataSources>
            //     <TerrainDataSource>
            //     </TerrainDataSource>
            // </TerrainDataSources>
            this._terrainDataSources = new List<TerrainDataSource>();
            XPathNodeIterator interatorTerrainDataSource = navigator.Select("TerrainDataSources/TerrainDataSource");
            while (interatorTerrainDataSource.MoveNext()) {
                // Get <ConnectivityRule>
                XPathNavigator navigatorTerrainDataSource = interatorTerrainDataSource.Current;
                TerrainDataSource terrainDataSource = new TerrainDataSource(navigatorTerrainDataSource);
                this._terrainDataSources.Add(terrainDataSource);
            }

            // TerrainPyramids
            this._terrainPyramids = new List<TerrainPyramid>();
            string pyramidPath = null;
            switch(this._pyramidType){
                case esriTerrainPyramidType.esriTerrainPyramidWindowSize:
                    // <TerrainPyramidLevelWindowSizes>
                    //    <TerrainPyramidLevelWindowSize>
                    //    </TerrainPyramidLevelWindowSize>
                    // </TerrainPyramidLevelWindowSizes>
                    pyramidPath = "TerrainPyramidLevelWindowSizes/TerrainPyramidLevelWindowSize";
                    break;
                case esriTerrainPyramidType.esriTerrainPyramidZTolerance:
                    // <TerrainPyramidLevelZTols>
                    //    <TerrainPyramidLevelZTol>
                    //    </TerrainPyramidLevelZTol>
                    // </TerrainPyramidLevelZTols>
                    pyramidPath = "TerrainPyramidLevelZTols/TerrainPyramidLevelZTol";
                    break;
            }
            XPathNodeIterator interatorTerrainPyramid = navigator.Select(pyramidPath);
            while (interatorTerrainPyramid.MoveNext()) {
                // Get <ConnectivityRule>
                XPathNavigator navigatorTerrainPyramid = interatorTerrainPyramid.Current;
                TerrainPyramid terrainPyramid = new TerrainPyramid(navigatorTerrainPyramid);
                this._terrainPyramids.Add(terrainPyramid);
            }
            
            // <TerrainID></TerrainID>
            XPathNavigator navigatorTerrainID = navigator.SelectSingleNode("TerrainID");
            if (navigatorTerrainID != null) {
                this._terrainID = navigatorTerrainID.ValueAsInt;
            }

            // <Version></Version>
            XPathNavigator navigatorVersion = navigator.SelectSingleNode("Version");
            if (navigatorVersion != null) {
                this._version = navigatorVersion.ValueAsInt;
            }
        }
 public TerrainDataSource(TerrainDataSource prototype) : base(prototype) {
     this._featureClassID = prototype.FeatureClassID;
     this._featureClassName = prototype.FeatureClassName;
     this._groupID = prototype.GroupID;
     this._sourceStatus = prototype.SourceStatus;
     this._sourceType = prototype.SourceType;
     this._surfaceFeatureType = prototype.SurfaceFeatureType;
     this._isBase = prototype.IsBase;
     this._anchored = prototype.Anchored;
     this._applyToOverview = prototype.ApplyToOverview;
     this._autoGeneralize = prototype.AutoGeneralize;
     this._resolutionLowerBound = prototype.ResolutionLowerBound;
     this._resolutionUpperBound = prototype.ResolutionUpperBound;
     this._sourceName = prototype.SourceName;
     this._heightField = prototype.HeightField;
     this._tagValueField = prototype.TagValueField;
     this._reservedFields = new List<string>();
     foreach (string reservedField in prototype.ReservedFields) {
         this._reservedFields.Add(reservedField);
     }
 }
Esempio n. 8
0
        //
        // CONSTRUCTOR
        //
        public Terrain(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <ConfigurationKeyword></ConfigurationKeyword>
            XPathNavigator navigatorConfigurationKeyword = navigator.SelectSingleNode("ConfigurationKeyword");

            if (navigatorConfigurationKeyword != null)
            {
                this._configurationKeyword = navigatorConfigurationKeyword.Value;
            }

            // <Extent></Extent>
            XPathNavigator navigatorExtent = navigator.SelectSingleNode("Extent");

            if (navigatorExtent != null && !string.IsNullOrEmpty(navigatorExtent.InnerXml))
            {
                this._extent = new Extent(navigatorExtent);
            }

            // <SpatialReference></SpatialReference>
            XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference");

            if (navigatorSpatialReference != null && !string.IsNullOrEmpty(navigatorSpatialReference.InnerXml))
            {
                this._spatialReference = new SpatialReference(navigatorSpatialReference);
            }

            // <FeatureDatasetName></FeatureDatasetName>
            // Do not load. This can be inferred.

            // <PyramidType></PyramidType>
            XPathNavigator navigatorPyramidType = navigator.SelectSingleNode("PyramidType");

            if (navigatorPyramidType != null)
            {
                this._pyramidType = (esriTerrainPyramidType)Enum.Parse(typeof(esriTerrainPyramidType), navigatorPyramidType.Value, true);
            }

            // <WindowSizeMethod></WindowSizeMethod>
            XPathNavigator navigatorWindowSizeMethod = navigator.SelectSingleNode("WindowSizeMethod");

            if (navigatorWindowSizeMethod != null)
            {
                this._windowSizeMethod = (esriTerrainWindowSizeMethod)Enum.Parse(typeof(esriTerrainWindowSizeMethod), navigatorWindowSizeMethod.Value, true);
            }

            // <WindowSizeZThreshold></WindowSizeZThreshold>
            XPathNavigator navigatorWindowSizeZThreshold = navigator.SelectSingleNode("WindowSizeZThreshold");

            if (navigatorWindowSizeZThreshold != null)
            {
                this._windowSizeZThreshold = navigatorWindowSizeZThreshold.ValueAsDouble;
            }

            // <WindowSizeZThresholdStrategy></WindowSizeZThresholdStrategy>
            XPathNavigator navigatorWindowSizeZThresholdStrategy = navigator.SelectSingleNode("WindowSizeZThresholdStrategy");

            if (navigatorWindowSizeZThresholdStrategy != null)
            {
                this._windowSizeZThresholdStrategy = (esriTerrainZThresholdStrategy)Enum.Parse(typeof(esriTerrainZThresholdStrategy), navigatorWindowSizeZThresholdStrategy.Value, true);
            }

            // <TileSize></TileSize>
            XPathNavigator navigatorTileSize = navigator.SelectSingleNode("TileSize");

            if (navigatorTileSize != null)
            {
                this._tileSize = navigatorTileSize.ValueAsDouble;
            }

            // <MaxShapeSize></MaxShapeSize>
            XPathNavigator navigatorMaxShapeSize = navigator.SelectSingleNode("MaxShapeSize");

            if (navigatorMaxShapeSize != null)
            {
                this._maxShapeSize = navigatorMaxShapeSize.ValueAsInt;
            }

            // <MaxOverviewSize></MaxOverviewSize>
            XPathNavigator navigatorMaxOverviewSize = navigator.SelectSingleNode("MaxOverviewSize");

            if (navigatorMaxOverviewSize != null)
            {
                this._maxOverviewSize = navigatorMaxOverviewSize.ValueAsInt;
            }

            // <ExtentDomain></ExtentDomain>
            XPathNavigator navigatorExtentDomain = navigator.SelectSingleNode("ExtentDomain");

            if (navigatorExtentDomain != null && !string.IsNullOrEmpty(navigatorExtentDomain.InnerXml))
            {
                this._extentDomain = new Extent(navigatorExtentDomain);
            }

            // <ExtentAOI></ExtentAOI>
            XPathNavigator navigatorExtentAOI = navigator.SelectSingleNode("ExtentAOI");

            if (navigatorExtentAOI != null && !string.IsNullOrEmpty(navigatorExtentAOI.InnerXml))
            {
                this._extentAOI = new Extent(navigatorExtentAOI);
            }

            // <TerrainDataSources>
            //     <TerrainDataSource>
            //     </TerrainDataSource>
            // </TerrainDataSources>
            this._terrainDataSources = new List <TerrainDataSource>();
            XPathNodeIterator interatorTerrainDataSource = navigator.Select("TerrainDataSources/TerrainDataSource");

            while (interatorTerrainDataSource.MoveNext())
            {
                // Get <ConnectivityRule>
                XPathNavigator    navigatorTerrainDataSource = interatorTerrainDataSource.Current;
                TerrainDataSource terrainDataSource          = new TerrainDataSource(navigatorTerrainDataSource);
                this._terrainDataSources.Add(terrainDataSource);
            }

            // TerrainPyramids
            this._terrainPyramids = new List <TerrainPyramid>();
            string pyramidPath = null;

            switch (this._pyramidType)
            {
            case esriTerrainPyramidType.esriTerrainPyramidWindowSize:
                // <TerrainPyramidLevelWindowSizes>
                //    <TerrainPyramidLevelWindowSize>
                //    </TerrainPyramidLevelWindowSize>
                // </TerrainPyramidLevelWindowSizes>
                pyramidPath = "TerrainPyramidLevelWindowSizes/TerrainPyramidLevelWindowSize";
                break;

            case esriTerrainPyramidType.esriTerrainPyramidZTolerance:
                // <TerrainPyramidLevelZTols>
                //    <TerrainPyramidLevelZTol>
                //    </TerrainPyramidLevelZTol>
                // </TerrainPyramidLevelZTols>
                pyramidPath = "TerrainPyramidLevelZTols/TerrainPyramidLevelZTol";
                break;
            }
            XPathNodeIterator interatorTerrainPyramid = navigator.Select(pyramidPath);

            while (interatorTerrainPyramid.MoveNext())
            {
                // Get <ConnectivityRule>
                XPathNavigator navigatorTerrainPyramid = interatorTerrainPyramid.Current;
                TerrainPyramid terrainPyramid          = new TerrainPyramid(navigatorTerrainPyramid);
                this._terrainPyramids.Add(terrainPyramid);
            }

            // <TerrainID></TerrainID>
            XPathNavigator navigatorTerrainID = navigator.SelectSingleNode("TerrainID");

            if (navigatorTerrainID != null)
            {
                this._terrainID = navigatorTerrainID.ValueAsInt;
            }

            // <Version></Version>
            XPathNavigator navigatorVersion = navigator.SelectSingleNode("Version");

            if (navigatorVersion != null)
            {
                this._version = navigatorVersion.ValueAsInt;
            }
        }
        public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            if (context == null)
            {
                return(null);
            }
            if (context.Instance == null)
            {
                return(null);
            }

            // RelationshipClass:        OriginClassName, DestinationClassName
            // EdgeConnectivityRule:     DefaultJunctionID, FromClassID, ToClassID
            // JunctionSubtype:          ClassID
            // RelationshipRule:         OriginClass, DestinationClass
            // JunctionConnectivityRule: EdgeClassID, JunctionClassID
            // TopologyRule:             OriginClassId, DestinationClassId
            // NetWeightAssociation:     TableName
            // TerrainDataSource:        FeatureClassName

            // Get Model
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;

            if (diagrammerEnvironment == null)
            {
                return(null);
            }
            SchemaModel schemaModel = diagrammerEnvironment.SchemaModel;

            if (schemaModel == null)
            {
                return(null);
            }

            // Get ObjectClasses
            List <ObjectClass> objectClasses = schemaModel.GetObjectClasses();

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

            if (context.PropertyDescriptor.ComponentType == typeof(RelationshipClass))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "OriginClassName":
                case "DestinationClassName":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        if (objectClass.GetType() == typeof(ObjectClass) ||
                            objectClass.GetType() == typeof(FeatureClass) ||
                            objectClass.GetType() == typeof(RasterCatalog))
                        {
                            list.Add(objectClass.Name);
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(EdgeConnectivityRule))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "DefaultJunctionID":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        FeatureClass featureClass = objectClass as FeatureClass;
                        if (featureClass == null)
                        {
                            continue;
                        }
                        switch (featureClass.FeatureType)                  //  (objectClass.CLSID) {
                        {
                        case esriFeatureType.esriFTSimpleJunction:         // EsriRegistry.CLASS_SIMPLEJUNCTION:
                            list.Add(objectClass.Name);
                            break;
                        }
                    }
                    break;

                case "FromClassID":
                case "ToClassID":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        FeatureClass featureClass = objectClass as FeatureClass;
                        if (featureClass == null)
                        {
                            continue;
                        }
                        switch (featureClass.FeatureType)               // (objectClass.CLSID) {
                        {
                        case esriFeatureType.esriFTComplexEdge:         // EsriRegistry.CLASS_COMPLEXEDGE:
                        case esriFeatureType.esriFTSimpleEdge:          // EsriRegistry.CLASS_SIMPLEEDGE:
                            list.Add(objectClass.Name);
                            break;
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(JunctionSubtype))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "ClassID":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        FeatureClass featureClass = objectClass as FeatureClass;
                        if (featureClass == null)
                        {
                            continue;
                        }
                        switch (featureClass.FeatureType)                  // (objectClass.CLSID) {
                        {
                        case esriFeatureType.esriFTSimpleJunction:         // EsriRegistry.CLASS_SIMPLEJUNCTION:
                            list.Add(objectClass.Name);
                            break;
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(RelationshipRule))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "OriginClass":
                case "DestinationClass":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        if (objectClass.GetType() == typeof(ObjectClass) ||
                            objectClass.GetType() == typeof(FeatureClass))
                        {
                            list.Add(objectClass.Name);
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(JunctionConnectivityRule))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "EdgeClassID":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        FeatureClass featureClass = objectClass as FeatureClass;
                        if (featureClass == null)
                        {
                            continue;
                        }
                        switch (featureClass.FeatureType)               // (objectClass.CLSID) {
                        {
                        case esriFeatureType.esriFTComplexEdge:         // EsriRegistry.CLASS_COMPLEXEDGE:
                        case esriFeatureType.esriFTSimpleEdge:          // EsriRegistry.CLASS_SIMPLEEDGE:
                            list.Add(objectClass.Name);
                            break;
                        }
                    }
                    break;

                case "JunctionClassID":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        FeatureClass featureClass = objectClass as FeatureClass;
                        if (featureClass == null)
                        {
                            continue;
                        }
                        switch (featureClass.FeatureType)                  // (objectClass.CLSID) {
                        {
                        case esriFeatureType.esriFTSimpleJunction:         // EsriRegistry.CLASS_SIMPLEJUNCTION:
                            list.Add(objectClass.Name);
                            break;
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(TopologyRule))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "OriginClassId":
                case "DestinationClassId":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        if (objectClass.GetType() == typeof(FeatureClass))
                        {
                            list.Add(objectClass.Name);
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(NetWeightAssociation))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "TableName":
                    foreach (ObjectClass objectClass in objectClasses)
                    {
                        FeatureClass featureClass = objectClass as FeatureClass;
                        if (featureClass == null)
                        {
                            continue;
                        }
                        switch (featureClass.FeatureType)                  // (objectClass.CLSID) {
                        {
                        case esriFeatureType.esriFTComplexEdge:            // EsriRegistry.CLASS_COMPLEXEDGE:
                        case esriFeatureType.esriFTSimpleEdge:             // EsriRegistry.CLASS_SIMPLEEDGE:
                        case esriFeatureType.esriFTSimpleJunction:         // EsriRegistry.CLASS_SIMPLEJUNCTION:
                            list.Add(objectClass.Name);
                            break;
                        }
                    }
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(TerrainDataSource))
            {
                switch (context.PropertyDescriptor.Name)
                {
                case "FeatureClassName":
                    TerrainDataSource terrainDataSource = (TerrainDataSource)context.Instance;
                    SchemaModel       model             = DiagrammerEnvironment.Default.SchemaModel;
                    if (model == null)
                    {
                        break;
                    }
                    Terrain        terrain        = model.FindParent(terrainDataSource);
                    FeatureDataset featureDataset = terrain.GetParent() as FeatureDataset;
                    if (featureDataset == null)
                    {
                        break;
                    }
                    foreach (Dataset dataset in featureDataset.GetChildren())
                    {
                        if (dataset.DatasetType == esriDatasetType.esriDTFeatureClass)
                        {
                            list.Add(dataset.Name);
                        }
                    }
                    break;
                }
            }

            // Sort List
            list.Sort();
            list.Insert(0, Resources.TEXT_NONE_BR);

            // Return List
            StandardValuesCollection svc = new StandardValuesCollection(list);

            return(svc);
        }