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();
        }
Example #2
0
        public static List <Domain> RequiredDomains(FeatureClass featureClass)
        {
            List <Domain> domains = new List <Domain>();

            switch (featureClass.FeatureType)
            {
            case esriFeatureType.esriFTSimple:
                switch (featureClass.ShapeType)
                {
                case esriGeometryType.esriGeometryMultiPatch:
                case esriGeometryType.esriGeometryPoint:
                case esriGeometryType.esriGeometryPolygon:
                case esriGeometryType.esriGeometryPolyline:
                    break;
                }
                break;

            case esriFeatureType.esriFTAnnotation:
                XPathNodeIterator iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_ANNOTATION, "WorkspaceDefinition/Domains/Domain");

                // Add Domains
                while (iterator.MoveNext())
                {
                    // Get Domain
                    XPathNavigator domain = iterator.Current;

                    // Create Namespace
                    XmlNamespaceManager namespaceManager = new XmlNamespaceManager(domain.NameTable);
                    namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE);

                    // Create Domain
                    XPathNavigator type = domain.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                    switch (type.Value)
                    {
                    case Xml._RANGEDOMAIN:
                        domains.Add(new DomainRange(domain));
                        break;

                    case Xml._CODEDVALUEDOMAIN:
                        domains.Add(new DomainCodedValue(domain));
                        break;
                    }
                }
                break;

            case esriFeatureType.esriFTDimension:
                break;
            }
            return(domains);
        }
Example #3
0
        public static FeatureClass CreateFeatureClass(esriFeatureType featureType, esriGeometryType geometryType)
        {
            XPathNodeIterator iterator = null;

            switch (featureType)
            {
            case esriFeatureType.esriFTSimple:
                switch (geometryType)
                {
                case esriGeometryType.esriGeometryMultiPatch:
                    iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_MULTIPATCH, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                    break;

                case esriGeometryType.esriGeometryPoint:
                    iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_POINT, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_POLYGON, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_POLYLINE, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                    break;
                }
                break;

            case esriFeatureType.esriFTAnnotation:
                iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_ANNOTATION, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                break;

            case esriFeatureType.esriFTDimension:
                iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_DIMENSION, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                break;
            }
            if (iterator == null)
            {
                return(null);
            }
            if (!iterator.MoveNext())
            {
                return(null);
            }

            XPathNavigator navigator    = iterator.Current;
            FeatureClass   featureClass = new FeatureClass(navigator);;

            return(featureClass);
        }
 public FeatureClass(FeatureClass prototype) : base(prototype)
 {
     this._featureType     = prototype.FeatureType;
     this._shapeType       = prototype.ShapeType;
     this._shapeFieldName  = prototype.ShapeFieldName;
     this._hasM            = prototype.HasM;
     this._hasZ            = prototype.HasZ;
     this._areaFieldName   = prototype.AreaFieldName;
     this._lengthFieldName = prototype.LengthFieldName;
     if (prototype.Extent != null)
     {
         this._extent = prototype.Extent.Clone() as Extent;
     }
     if (prototype.SpatialReference != null)
     {
         this._spatialReference = prototype.SpatialReference.Clone() as SpatialReference;
     }
 }
Example #5
0
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Write Base Errors
            base.Errors(list, table);

            // Get Topology
            Topology topology = (Topology)table;

            // Check for duplicate rules
            bool duplicate = false;

            foreach (TopologyRule topologyRule in topology.TopologyRules)
            {
                if (topologyRule == this)
                {
                    continue;
                }
                if (this._allOriginSubtypes == topologyRule.AllOriginSubtypes &&
                    this._originClassId == topologyRule.OriginClassId &&
                    this._originSubtype == topologyRule.OriginSubtype &&
                    this._allDestinationSubtypes == topologyRule.AllDestinationSubtypes &&
                    this._destinationClassId == topologyRule.DestinationClassId &&
                    this._destinationSubtype == topologyRule.DestinationSubtype &&
                    this._topologyRuleType == topologyRule.TopologyRuleType)
                {
                    duplicate = true;
                    break;
                }
            }
            if (duplicate)
            {
                string message = string.Format("Duplicate topology rules found");
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Duplicate Guids
            bool duplicateGuid = false;

            foreach (TopologyRule topologyRule in topology.TopologyRules)
            {
                if (topologyRule == this)
                {
                    continue;
                }
                if (this._guid == topologyRule.Guid)
                {
                    duplicateGuid = true;
                    break;
                }
            }
            if (duplicateGuid)
            {
                string message = string.Format("Topology Rule Guid [{0}] is not unique", this._guid);
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Check if rule conflict with rules using "All Subtypes" - Origin
            if (this._allOriginSubtypes)
            {
                bool originSubtypeConflict = false;
                foreach (TopologyRule topologyRule in topology.TopologyRules)
                {
                    if (topologyRule == this)
                    {
                        continue;
                    }
                    if (topologyRule.AllOriginSubtypes == false &&
                        this._originClassId == topologyRule.OriginClassId &&
                        this._allDestinationSubtypes == topologyRule.AllDestinationSubtypes &&
                        this._destinationClassId == topologyRule.DestinationClassId &&
                        this._destinationSubtype == topologyRule.DestinationSubtype &&
                        this._topologyRuleType == topologyRule.TopologyRuleType)
                    {
                        originSubtypeConflict = true;
                        break;
                    }
                }
                if (originSubtypeConflict)
                {
                    string message = string.Format("The Topology Rule [{0}] with an Origin 'AllSubtypes' setting conflicts another rule", this._guid);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Check if rule conflict with rules using "All Subtypes" - Destination
            if (this._allDestinationSubtypes)
            {
                bool destinationSubtypeConflict = false;
                foreach (TopologyRule topologyRule in topology.TopologyRules)
                {
                    if (topologyRule == this)
                    {
                        continue;
                    }
                    if (topologyRule.AllDestinationSubtypes == false &&
                        this._destinationClassId == topologyRule.DestinationClassId &&
                        this._allOriginSubtypes == topologyRule.AllOriginSubtypes &&
                        this._originClassId == topologyRule.OriginClassId &&
                        this._originSubtype == topologyRule.OriginSubtype &&
                        this._topologyRuleType == topologyRule.TopologyRuleType)
                    {
                        destinationSubtypeConflict = true;
                        break;
                    }
                }
                if (destinationSubtypeConflict)
                {
                    string message = string.Format("The Topology Rule [{0}] with an Destination 'AllSubtypes' setting conflicts another rule", this._guid);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Valid rules for Origin/Destination Shape Types
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel           schemaModel           = diagrammerEnvironment.SchemaModel;

            // Get Origin and Destination FeatureClasses
            ObjectClass objectClassOrig = schemaModel.FindObjectClass(this._originClassId);
            ObjectClass objectClassDest = schemaModel.FindObjectClass(this._destinationClassId);

            // Check if Origin and Destination ObjectClasses Exist
            if (objectClassOrig == null)
            {
                list.Add(new ErrorObject(this, table, "Origin FeatureClass Does Not Exist", ErrorType.Error));
            }
            if (objectClassDest == null)
            {
                list.Add(new ErrorObject(this, table, "Destination FeatureClass Does Not Exist", ErrorType.Error));
            }

            // Check if Origin and Destination Subypes Exist
            EsriTable tableOrig = schemaModel.FindObjectClassOrSubtype(this._originClassId, this._originSubtype);
            EsriTable tableDest = schemaModel.FindObjectClassOrSubtype(this._destinationClassId, this._destinationSubtype);

            if (tableOrig == null)
            {
                list.Add(new ErrorObject(this, table, "Origin FeatureClass and/or Subtype Does Not Exist", ErrorType.Error));
            }
            if (tableDest == null)
            {
                list.Add(new ErrorObject(this, table, "Destination FeatureClass and/or Subtype Does Not Exist", ErrorType.Error));
            }

            // Get Origin and Destination FeatureClasses
            FeatureClass featureClassOrig = objectClassOrig as FeatureClass;
            FeatureClass featureClassDest = objectClassDest as FeatureClass;

            // These rules MUST have the same origin and destination class/subtype
            if (featureClassOrig != null && featureClassDest != null && tableOrig != null && tableDest != null)
            {
                switch (this._topologyRuleType)
                {
                case esriTopologyRuleType.esriTRTLineNoOverlap:
                case esriTopologyRuleType.esriTRTLineNoIntersection:
                case esriTopologyRuleType.esriTRTLineNoDangles:
                case esriTopologyRuleType.esriTRTLineNoPseudos:
                case esriTopologyRuleType.esriTRTLineNoSelfOverlap:
                case esriTopologyRuleType.esriTRTLineNoSelfIntersect:
                case esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch:
                case esriTopologyRuleType.esriTRTLineNoMultipart:
                case esriTopologyRuleType.esriTRTAreaNoGaps:
                case esriTopologyRuleType.esriTRTAreaNoOverlap:
                    if (this._originClassId != this._destinationClassId ||
                        this._originSubtype != this._destinationSubtype)
                    {
                        list.Add(new ErrorObject(this, table, "This rule must have the same origin and destination FeatureClass and Subtype", ErrorType.Error));
                    }
                    break;

                default:
                    break;
                }
            }

            // Examine Rule Based on Origin and Destination GeometryType
            bool ok = false;

            if (featureClassOrig != null && featureClassDest != null)
            {
                switch (featureClassOrig.ShapeType)
                {
                case esriGeometryType.esriGeometryPoint:
                    switch (featureClassDest.ShapeType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        // POINT > POINT
                        switch (this._topologyRuleType)
                        {
                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolyline:
                        // POINT > POLYLINE
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTPointCoveredByLine:
                        case esriTopologyRuleType.esriTRTPointCoveredByLineEndpoint:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolygon:
                        // POINT > POLYGON
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTPointCoveredByAreaBoundary:
                        case esriTopologyRuleType.esriTRTPointProperlyInsideArea:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;
                    }
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    switch (featureClassDest.ShapeType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        // POLYLINE > POINT
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTLineEndpointCoveredByPoint:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolyline:
                        // POLYLINE > POLYLINE
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTLineNoOverlap:
                        case esriTopologyRuleType.esriTRTLineNoIntersection:
                        case esriTopologyRuleType.esriTRTLineNoDangles:
                        case esriTopologyRuleType.esriTRTLineNoPseudos:
                        case esriTopologyRuleType.esriTRTLineCoveredByLineClass:
                        case esriTopologyRuleType.esriTRTLineNoOverlapLine:
                        case esriTopologyRuleType.esriTRTLineNoSelfOverlap:
                        case esriTopologyRuleType.esriTRTLineNoSelfIntersect:
                        case esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch:
                        case esriTopologyRuleType.esriTRTLineNoMultipart:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolygon:
                        // POLYLINE > POLYGON
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTLineCoveredByAreaBoundary:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    switch (featureClassDest.ShapeType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        // POLYGON > POINT
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTAreaContainPoint:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolyline:
                        // POLYGON > POLYLINE
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTAreaBoundaryCoveredByLine:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolygon:
                        // POLYGON > POLYGON
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTAreaNoGaps:
                        case esriTopologyRuleType.esriTRTAreaNoOverlap:
                        case esriTopologyRuleType.esriTRTAreaCoveredByAreaClass:
                        case esriTopologyRuleType.esriTRTAreaAreaCoverEachOther:
                        case esriTopologyRuleType.esriTRTAreaCoveredByArea:
                        case esriTopologyRuleType.esriTRTAreaNoOverlapArea:
                        case esriTopologyRuleType.esriTRTAreaBoundaryCoveredByAreaBoundary:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;
                    }
                    break;
                }
            }
            if (!ok)
            {
                list.Add(new ErrorObject(this, table, "This rule cannot be added between these FeatureClass geometric types", ErrorType.Error));
            }
        }
Example #6
0
        //
        // PROTECTED
        //
        protected override void WriteInnerXml(XmlWriter writer)
        {
            // Write Base Xml
            base.WriteInnerXml(writer);

            // <Extent></Extent>
            if (this._extent != null)
            {
                this._extent.WriteXml(writer);
            }

            // <SpatialReference></SpatialReference>
            if (this._spatialReference != null)
            {
                this._spatialReference.WriteXml(writer);
            }

            // <ClusterTolerance></ClusterTolerance>
            writer.WriteStartElement(Xml.CLUSTERTOLERANCE);
            writer.WriteValue(this._clusterTolerance);
            writer.WriteEndElement();

            // <ZClusterTolerance></ZClusterTolerance>
            writer.WriteStartElement(Xml.ZCLUSTERTOLERANCE);
            writer.WriteValue(this._zClusterTolerance);
            writer.WriteEndElement();

            // <MaxGeneratedErrorCount></MaxGeneratedErrorCount>
            writer.WriteStartElement(Xml.MAXGENERATEDERRORCOUNT);
            writer.WriteValue(this._maxGeneratedErrorCount);
            writer.WriteEndElement();

            // <FeatureClassNames>
            writer.WriteStartElement(Xml.FEATURECLASSNAMES);
            writer.WriteAttributeString(Xml._XSI, Xml._TYPE, null, Xml._NAMES);

            Dataset dataset = this.GetParent();

            if (dataset != null)
            {
                if (dataset.GetType() == typeof(FeatureDataset))
                {
                    FeatureDataset featureDataset = (FeatureDataset)dataset;
                    List <Dataset> datasets       = featureDataset.GetChildren();
                    foreach (Dataset dataset2 in datasets)
                    {
                        if (dataset2.GetType() == typeof(FeatureClass))
                        {
                            FeatureClass featureClass = (FeatureClass)dataset2;
                            List <ControllerMembership> controllers = featureClass.ControllerMemberships;
                            foreach (ControllerMembership controller in controllers)
                            {
                                if (controller is TopologyControllerMembership)
                                {
                                    TopologyControllerMembership topologyControllerMembership = (TopologyControllerMembership)controller;
                                    if (topologyControllerMembership.TopologyName == this.Name)
                                    {
                                        // <Name></Name>
                                        writer.WriteStartElement(Xml.NAME);
                                        writer.WriteValue(featureClass.Name);
                                        writer.WriteEndElement();
                                    }
                                }
                            }
                        }
                    }
                }
            }

            // </FeatureClassNames>
            writer.WriteEndElement();

            // <TopologyRules>
            writer.WriteStartElement(Xml.TOPOLOGYRULES);
            writer.WriteAttributeString(Xml._XSI, Xml._TYPE, null, Xml._ARRAYOFTOPOLOGYRULE);

            // <TopologyRule></TopologyRule>
            foreach (TopologyRule topologyRule in this._topologyRules)
            {
                topologyRule.WriteXml(writer);
            }

            // </TopologyRules>
            writer.WriteEndElement();
        }
Example #7
0
        public static FeatureClass CreateFeatureClass(esriFeatureType featureType, esriGeometryType geometryType) {
            XPathNodeIterator iterator = null;
            switch (featureType) {
                case esriFeatureType.esriFTSimple:
                    switch (geometryType) {
                        case esriGeometryType.esriGeometryMultiPatch:
                            iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_MULTIPATCH, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                            break;
                        case esriGeometryType.esriGeometryPoint:
                            iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_POINT, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                            break;
                        case esriGeometryType.esriGeometryPolygon:
                            iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_POLYGON, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                            break;
                        case esriGeometryType.esriGeometryPolyline:
                            iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_POLYLINE, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                            break;
                    }
                    break;
                case esriFeatureType.esriFTAnnotation:
                    iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_ANNOTATION, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                    break;
                case esriFeatureType.esriFTDimension:
                    iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_DIMENSION, "WorkspaceDefinition/DatasetDefinitions/DataElement");
                    break;
            }
            if (iterator == null) { return null; }
            if (!iterator.MoveNext()) { return null; }

            XPathNavigator navigator = iterator.Current;
            FeatureClass featureClass = new FeatureClass(navigator); ;
            return featureClass;
        }
Example #8
0
        public static List<Domain> RequiredDomains(FeatureClass featureClass) {
            List<Domain> domains = new List<Domain>();
            switch (featureClass.FeatureType) {
                case esriFeatureType.esriFTSimple:
                    switch (featureClass.ShapeType) {
                        case esriGeometryType.esriGeometryMultiPatch:
                        case esriGeometryType.esriGeometryPoint:
                        case esriGeometryType.esriGeometryPolygon:
                        case esriGeometryType.esriGeometryPolyline:
                            break;
                    }
                    break;
                case esriFeatureType.esriFTAnnotation:
                    XPathNodeIterator iterator = Factory.LoadXml(Resources.FILE_FEATURECLASS_ANNOTATION, "WorkspaceDefinition/Domains/Domain");

                    // Add Domains
                    while (iterator.MoveNext()) {
                        // Get Domain
                        XPathNavigator domain = iterator.Current;

                        // Create Namespace
                        XmlNamespaceManager namespaceManager = new XmlNamespaceManager(domain.NameTable);
                        namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE);

                        // Create Domain
                        XPathNavigator type = domain.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                        switch (type.Value) {
                            case Xml._RANGEDOMAIN:
                                domains.Add(new DomainRange(domain));
                                break;
                            case Xml._CODEDVALUEDOMAIN:
                                domains.Add(new DomainCodedValue(domain));
                                break;
                        }
                    }
                    break;
                case esriFeatureType.esriFTDimension:
                    break;
            }
            return domains;
        }
        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);
        }
        private void Model_ElementInvalid(object sender, ElementEventArgs e)
        {
            // Check Relationship
            if (this._relationshipClass == null)
            {
                return;
            }

            // Get Element
            Element element = e.Value;

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

            if (line == null)
            {
                return;
            }

            // Get Rule
            RelationshipRule rule = line.Parent;

            // Suspend Rule Events
            rule.Suspend();

            //
            Element elementStart = line.Start.Shape;
            Element elementEnd   = line.End.Shape;

            // Update Origin Class/Subtype
            if (elementStart == null)
            {
                rule.OriginClass   = -1;
                rule.OriginSubtype = -1;
            }
            else if (elementStart is EsriShape <ObjectClass> )
            {
                EsriShape <ObjectClass> shape       = (EsriShape <ObjectClass>)elementStart;
                ObjectClass             objectClass = shape.Parent;
                rule.OriginClass   = objectClass.DSID;
                rule.OriginSubtype = 0;
            }
            else if (elementStart is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape        = (EsriShape <FeatureClass>)elementStart;
                FeatureClass             featureClass = shape.Parent;
                rule.OriginClass   = featureClass.DSID;
                rule.OriginSubtype = 0;
            }
            else if (elementStart is EsriShape <Subtype> )
            {
                EsriShape <Subtype> shape       = (EsriShape <Subtype>)elementStart;
                Subtype             subtype     = shape.Parent;
                ObjectClass         objectClass = subtype.GetParent();
                if (objectClass != null)
                {
                    rule.OriginClass   = objectClass.DSID;
                    rule.OriginSubtype = subtype.SubtypeCode;
                }
            }

            // Update Destination Class/Subtype
            if (elementEnd == null)
            {
                rule.DestinationClass   = -1;
                rule.DestinationSubtype = -1;
            }
            else if (elementEnd is EsriShape <ObjectClass> )
            {
                EsriShape <ObjectClass> shape       = (EsriShape <ObjectClass>)elementEnd;
                ObjectClass             objectClass = shape.Parent;
                rule.DestinationClass   = objectClass.DSID;
                rule.DestinationSubtype = 0;
            }
            else if (elementEnd is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape        = (EsriShape <FeatureClass>)elementEnd;
                FeatureClass             featureClass = shape.Parent;
                rule.DestinationClass   = featureClass.DSID;
                rule.DestinationSubtype = 0;
            }
            else if (elementEnd is EsriShape <Subtype> )
            {
                EsriShape <Subtype> shape       = (EsriShape <Subtype>)elementEnd;
                Subtype             subtype     = shape.Parent;
                ObjectClass         objectClass = subtype.GetParent();
                if (objectClass != null)
                {
                    rule.DestinationClass   = objectClass.DSID;
                    rule.DestinationSubtype = subtype.SubtypeCode;
                }
            }

            // Resume Rule Events
            rule.Resume();
        }
        public override void Errors(List <Error> list, EsriTable table)
        {
            // This controller must be assigned to a FeatureClass
            FeatureClass featureClass = table as FeatureClass;

            if (table.GetType() != typeof(FeatureClass))
            {
                list.Add(new ErrorObject(this, table, "A geometric network controller is ONLY supported in FeatureClasses", ErrorType.Error));
            }

            // GeometricNetwork Name
            if (string.IsNullOrEmpty(this._geometricNetworkName))
            {
                list.Add(new ErrorObject(this, table, "The controller property 'GeometricNetworkName' can not be empty", ErrorType.Error));
            }
            else
            {
                GeometricNetwork geometricNetwork = DiagrammerEnvironment.Default.SchemaModel.FindGeometricNetwork(this._geometricNetworkName);
                if (geometricNetwork == null)
                {
                    string message = string.Format("The geometric network [{0}] referenced in the controller does not exist", this._geometricNetworkName);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Enabled Field Cannot be NULL/Empty
            if (string.IsNullOrEmpty(this._enabledFieldName))
            {
                list.Add(new ErrorObject(this, table, "The controller property 'EnabledFieldName' can not be empty", ErrorType.Error));
            }
            else
            {
                if (featureClass != null)
                {
                    Field field = featureClass.FindField(this._enabledFieldName);
                    if (field == null)
                    {
                        string message = string.Format("The geometric network controller cannot find 'enabled field' [{0}] in the featureclass [{1}]", this._enabledFieldName, featureClass.Name);
                        list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                    }
                    else
                    {
                        if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger)
                        {
                            string message = string.Format("The geometric network controller references an 'enabled field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._enabledFieldName, featureClass.Name);
                            list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                        }
                    }
                }
            }

            // Ancillary Role / Ancillary Role Field
            switch (this._networkClassAncillaryRole)
            {
            case esriNetworkClassAncillaryRole.esriNCARNone:
                if (!string.IsNullOrEmpty(this._ancillaryRoleFieldName))
                {
                    string message = string.Format("The ancillary role field name should be empty if the role (in a geometric network controller) is set to none.");
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
                break;

            case esriNetworkClassAncillaryRole.esriNCARSourceSink:
                if (string.IsNullOrEmpty(this._ancillaryRoleFieldName))
                {
                    string message = string.Format("The ancillary role field name can not be empty for this role in a geometric network controller");
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
                else
                {
                    if (featureClass != null)
                    {
                        Field field = featureClass.FindField(this._ancillaryRoleFieldName);
                        if (field == null)
                        {
                            string message = string.Format("The geometric network controller cannot find 'ancillary role field' [{0}] in the featureclass [{1}]", this._ancillaryRoleFieldName, featureClass.Name);
                            list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                        }
                        else
                        {
                            if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger)
                            {
                                string message = string.Format("The geometric network controller references an 'ancillary role field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._ancillaryRoleFieldName, featureClass.Name);
                                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                            }
                        }
                    }
                }
                break;
            }
        }
Example #12
0
        private TreeNode CreateCatalogNode(TreeNode node, EsriTable table)
        {
            if (table.GetType() == typeof(DomainCodedValue))
            {
                // Get Coded Value Domain
                DomainCodedValue domainCodedValue = (DomainCodedValue)table;

                // Add Coded Value Domain
                TreeNodeTable treeNode = new TreeNodeTable(domainCodedValue);
                treeNode.ImageKey         = Catalog.CODED_VALUE_DOMAIN;
                treeNode.SelectedImageKey = Catalog.CODED_VALUE_DOMAIN;
                treeNode.Text             = domainCodedValue.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(DomainRange))
            {
                // Get Range Domain
                DomainRange domainRange = (DomainRange)table;

                // Add Range Domain
                TreeNodeTable treeNode = new TreeNodeTable(domainRange);
                treeNode.ImageKey         = Catalog.RANGE_DOMAIN;
                treeNode.SelectedImageKey = Catalog.RANGE_DOMAIN;
                treeNode.Text             = domainRange.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(FeatureClass))
            {
                // Get FeatureClass
                FeatureClass featureClass = (FeatureClass)table;

                // Add FeatureClass Node
                string imageKey = null;
                switch (featureClass.FeatureType)
                {
                case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTAnnotation:
                    imageKey = Catalog.ANNOTATION_FEATURE_CLASS;
                    break;

                case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTDimension:
                    imageKey = Catalog.DIMENSION_FEATURE_CLASS;
                    break;

                case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple:
                    switch (featureClass.ShapeType)
                    {
                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
                        imageKey = Catalog.POINT_FEATURE_CLASS;
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
                        imageKey = Catalog.POLYGON_FEATURE_CLASS;
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
                        imageKey = Catalog.POLYLINE_FEATURE_CLASS;
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch:
                        imageKey = Catalog.MULTIPATCH_FEATURE_CLASS;
                        break;

                    default:
                        imageKey = Catalog.POINT_FEATURE_CLASS;
                        break;
                    }
                    break;

                default:
                    imageKey = POINT_FEATURE_CLASS;
                    break;
                }
                TreeNodeTable treeNode = new TreeNodeTable(featureClass);
                treeNode.ImageKey         = imageKey;
                treeNode.SelectedImageKey = imageKey;
                treeNode.Text             = featureClass.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(FeatureDataset))
            {
                // Get FeatureDataset
                FeatureDataset featureDataset = (FeatureDataset)table;

                // Add FeatureDataset Node
                TreeNodeTable treeNode = new TreeNodeTable(featureDataset);
                treeNode.ImageKey         = Catalog.FEATURE_DATASET;
                treeNode.SelectedImageKey = Catalog.FEATURE_DATASET;
                treeNode.Text             = featureDataset.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(GeometricNetwork))
            {
                // Get GeometricNetwork
                GeometricNetwork geometricNetwork = (GeometricNetwork)table;

                // Add GeometricNetwork Node
                TreeNodeTable treeNode = new TreeNodeTable(geometricNetwork);
                treeNode.ImageKey         = Catalog.GEOMETRIC_NETWORK;
                treeNode.SelectedImageKey = Catalog.GEOMETRIC_NETWORK;
                treeNode.Text             = geometricNetwork.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Network))
            {
                // Get Network
                Network network = (Network)table;

                // Add Network TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(network);
                treeNode.ImageKey         = Catalog.NETWORK_DATASET;
                treeNode.SelectedImageKey = Catalog.NETWORK_DATASET;
                treeNode.Text             = network.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(ObjectClass))
            {
                // Get ObjectClass
                ObjectClass objectClass = (ObjectClass)table;

                // Add ObjectClass TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(objectClass);
                treeNode.ImageKey         = Catalog.TABLE;
                treeNode.SelectedImageKey = Catalog.TABLE;
                treeNode.Text             = objectClass.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RasterBand))
            {
                // Get RasterBand
                RasterBand rasterBand = (RasterBand)table;

                // Add RasterBand TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterBand);
                treeNode.ImageKey         = Catalog.RASTER_BAND;
                treeNode.SelectedImageKey = Catalog.RASTER_BAND;
                treeNode.Text             = rasterBand.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RasterCatalog))
            {
                // Get RasterCatalog
                RasterCatalog rasterCatalog = (RasterCatalog)table;

                // Add RasterCatalog TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterCatalog);
                treeNode.ImageKey         = Catalog.RASTER_CATALOG;
                treeNode.SelectedImageKey = Catalog.RASTER_CATALOG;
                treeNode.Text             = rasterCatalog.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RasterDataset))
            {
                // Get RasterDataset
                RasterDataset rasterDataset = (RasterDataset)table;

                // Add RasterDataset TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterDataset);
                treeNode.ImageKey         = Catalog.RASTER_DATASET;
                treeNode.SelectedImageKey = Catalog.RASTER_DATASET;
                treeNode.Text             = rasterDataset.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RelationshipClass))
            {
                // Get RelationshipClass
                RelationshipClass relationshipClass = (RelationshipClass)table;

                // Add RelationshipClass TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(relationshipClass);
                treeNode.ImageKey         = Catalog.RELATIONSHIP_CLASS;
                treeNode.SelectedImageKey = Catalog.RELATIONSHIP_CLASS;
                treeNode.Text             = relationshipClass.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Subtype))
            {
                // Get Subtype
                Subtype subtype = (Subtype)table;

                // Add Subtype TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(subtype);
                treeNode.ImageKey         = Catalog.SUBTYPE;
                treeNode.SelectedImageKey = Catalog.SUBTYPE;
                treeNode.Text             = subtype.SubtypeName;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Terrain))
            {
                // Get Terrain
                Terrain terrain = (Terrain)table;

                // Add Terrain TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(terrain);
                treeNode.ImageKey         = Catalog.TERRAIN;
                treeNode.SelectedImageKey = Catalog.TERRAIN;
                treeNode.Text             = terrain.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Topology))
            {
                // Get Topology
                Topology topology = (Topology)table;

                // Add Topology TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(topology);
                treeNode.ImageKey         = Catalog.TOPOLOGY;
                treeNode.SelectedImageKey = Catalog.TOPOLOGY;
                treeNode.Text             = topology.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            return(null);
        }
        //
        // PUBLIC METHODS
        //
        public override void OpenModel()
        {
            // Create Origin and Destination Lists
            List <EsriShape <FeatureClass> > listFeatureClassFrom = new List <EsriShape <FeatureClass> >();
            List <EsriShape <FeatureClass> > listFeatureClassTo   = new List <EsriShape <FeatureClass> >();
            List <EsriShape <Subtype> >      listSubtypeFrom      = new List <EsriShape <Subtype> >();
            List <EsriShape <Subtype> >      listSubtypeTo        = new List <EsriShape <Subtype> >();

            // Exit if invalid
            if (this._topology == null)
            {
                return;
            }

            // Suspend Model
            if (ModelSettings.Default.EnableUndoRedo)
            {
                this.UndoList.Suspend();
            }
            this.Suspend();
            this.SuspendEvents = true;

            // Get SchemaModel
            SchemaModel schemaModel = (SchemaModel)this._topology.Container;

            // Get Parent FeatureDataset
            Dataset parent = this._topology.GetParent();

            if (parent == null)
            {
                return;
            }
            FeatureDataset featureDataset = parent as FeatureDataset;

            if (featureDataset == null)
            {
                return;
            }

            // Add From and To FeatureDatasets
            EsriShape <FeatureDataset> featureDataset1 = new EsriShape <FeatureDataset>(featureDataset);
            EsriShape <FeatureDataset> featureDataset2 = new EsriShape <FeatureDataset>(featureDataset);

            this.Shapes.Add(this.Shapes.CreateKey(), featureDataset1);
            this.Shapes.Add(this.Shapes.CreateKey(), featureDataset2);

            // Add all Child FeatureClasses
            foreach (Dataset dataset in featureDataset.GetChildren())
            {
                if (dataset.GetType() != typeof(FeatureClass))
                {
                    continue;
                }

                // Get FeatureClass
                FeatureClass featureClass = (FeatureClass)dataset;

                // Only continue if FeatureClass belongs to the Topology
                bool participate = false;
                foreach (ControllerMembership controller in featureClass.ControllerMemberships)
                {
                    if (controller is TopologyControllerMembership)
                    {
                        TopologyControllerMembership topologyControllerMembership = (TopologyControllerMembership)controller;
                        if (topologyControllerMembership.TopologyName == this._topology.Name)
                        {
                            participate = true;
                            break;
                        }
                    }
                }
                if (!participate)
                {
                    continue;
                }

                // Get Subtypes
                List <Subtype> subtypes = featureClass.GetSubtypes();

                // Add From FetaureClasses and Subtypes
                EsriShape <FeatureClass> featureClass1 = new EsriShape <FeatureClass>(featureClass);
                this.Shapes.Add(this.Shapes.CreateKey(), featureClass1);
                listFeatureClassFrom.Add(featureClass1);

                // Add Line from FeatureDataset to FeatureClass
                Arrow arrow1 = new Arrow();
                arrow1.BorderColor    = ModelSettings.Default.DisabledLined;
                arrow1.DrawBackground = false;
                Line line1 = new Line(featureDataset1, featureClass1);
                line1.End.AllowMove   = false;
                line1.End.Marker      = arrow1;
                line1.Start.AllowMove = false;
                line1.BorderColor     = ModelSettings.Default.DisabledLined;
                this.Lines.Add(this.Lines.CreateKey(), line1);

                // Add Subtypes and Link to FeatureClass
                foreach (Subtype subtype in subtypes)
                {
                    EsriShape <Subtype> sub = new EsriShape <Subtype>(subtype);
                    this.Shapes.Add(this.Shapes.CreateKey(), sub);
                    listSubtypeFrom.Add(sub);
                    Arrow arrow3 = new Arrow();
                    arrow3.BorderColor    = ModelSettings.Default.DisabledLined;
                    arrow3.DrawBackground = false;
                    Line line = new Line(featureClass1, sub);
                    line.End.AllowMove   = false;
                    line.End.Marker      = arrow3;
                    line.Start.AllowMove = false;
                    line.BorderColor     = ModelSettings.Default.DisabledLined;
                    this.Lines.Add(this.Lines.CreateKey(), line);
                }

                // Add To FetaureClasses and Subtypes
                EsriShape <FeatureClass> featureClass2 = new EsriShape <FeatureClass>(featureClass);
                this.Shapes.Add(this.Shapes.CreateKey(), featureClass2);
                listFeatureClassTo.Add(featureClass2);

                // Add Line from FeatureDataset to FeatureClass
                Arrow arrow2 = new Arrow();
                arrow2.BorderColor    = ModelSettings.Default.DisabledLined;
                arrow2.DrawBackground = false;
                Line line2 = new Line(featureClass2, featureDataset2);
                line2.End.AllowMove   = false;
                line2.Start.AllowMove = false;
                line2.Start.Marker    = arrow2;
                line2.BorderColor     = ModelSettings.Default.DisabledLined;
                this.Lines.Add(this.Lines.CreateKey(), line2);

                // Add Subtyes and Link to FeatureClasses
                foreach (Subtype subtype in subtypes)
                {
                    EsriShape <Subtype> sub = new EsriShape <Subtype>(subtype);
                    this.Shapes.Add(this.Shapes.CreateKey(), sub);
                    listSubtypeTo.Add(sub);
                    Arrow arrow4 = new Arrow();
                    arrow4.BorderColor    = ModelSettings.Default.DisabledLined;
                    arrow4.DrawBackground = false;
                    Line line = new Line(sub, featureClass2);
                    line.End.AllowMove   = false;
                    line.Start.Marker    = arrow4;
                    line.Start.AllowMove = false;
                    line.BorderColor     = ModelSettings.Default.DisabledLined;
                    this.Lines.Add(this.Lines.CreateKey(), line);
                }
            }

            // Loop Through All Connectivity Rules
            foreach (TopologyRule topologyRule in this._topology.TopologyRules)
            {
                // Origin Table
                EsriTable origin = null;
                if (topologyRule.AllOriginSubtypes)
                {
                    origin = schemaModel.FindObjectClass(topologyRule.OriginClassId);
                }
                else
                {
                    origin = schemaModel.FindObjectClassOrSubtype(
                        topologyRule.OriginClassId,
                        topologyRule.OriginSubtype);
                }

                // Destination Table
                EsriTable destination = null;
                if (topologyRule.AllDestinationSubtypes)
                {
                    destination = schemaModel.FindObjectClass(topologyRule.DestinationClassId);
                }
                else
                {
                    destination = schemaModel.FindObjectClassOrSubtype(
                        topologyRule.DestinationClassId,
                        topologyRule.DestinationSubtype);
                }

                // Origin and Destination Shapes
                Shape shapeOrigin      = null;
                Shape shapeDestiantion = null;

                // Find Origin Shape in Diagram
                foreach (EsriShape <FeatureClass> f in listFeatureClassFrom)
                {
                    if (f.Parent == origin)
                    {
                        shapeOrigin = f;
                        break;
                    }
                }
                if (shapeOrigin == null)
                {
                    foreach (EsriShape <Subtype> s in listSubtypeFrom)
                    {
                        if (s.Parent == origin)
                        {
                            shapeOrigin = s;
                            break;
                        }
                    }
                }

                // Find Destination Shape in Diagram
                foreach (EsriShape <FeatureClass> f in listFeatureClassTo)
                {
                    if (f.Parent == destination)
                    {
                        shapeDestiantion = f;
                        break;
                    }
                }
                if (shapeDestiantion == null)
                {
                    foreach (EsriShape <Subtype> s in listSubtypeTo)
                    {
                        if (s.Parent == destination)
                        {
                            shapeDestiantion = s;
                            break;
                        }
                    }
                }

                // Skip if Origin and Destination Shapes not found
                if (shapeOrigin == null || shapeDestiantion == null)
                {
                    continue;
                }

                EsriLine <TopologyRule> line2 = new EsriLine <TopologyRule>(topologyRule, shapeOrigin, shapeDestiantion);
                this.Lines.Add(this.Lines.CreateKey(), line2);
            }

            // Perform Layout
            this.ExecuteLayout(typeof(HierarchicalLayout), true);

            // Resume and Refresh Model
            this.SuspendEvents = false;
            this.Resume();
            if (ModelSettings.Default.EnableUndoRedo)
            {
                this.UndoList.Resume();
            }
            this.Refresh();
        }
        //
        // PUBLIC METHODS
        //
        public override void OpenModel()
        {
            List <EsriShape <FeatureClass> > listFeatureClassFrom = new List <EsriShape <FeatureClass> >();
            List <EsriShape <FeatureClass> > listFeatureClassTo   = new List <EsriShape <FeatureClass> >();
            List <EsriShape <Subtype> >      listSubtypeFrom      = new List <EsriShape <Subtype> >();
            List <EsriShape <Subtype> >      listSubtypeTo        = new List <EsriShape <Subtype> >();

            // Exit if invalid
            if (this._geometricNetwork == null)
            {
                return;
            }

            // Suspend Model
            if (ModelSettings.Default.EnableUndoRedo)
            {
                this.UndoList.Suspend();
            }
            this.Suspend();
            this.SuspendEvents = true;

            // Get SchemaModel
            SchemaModel schemaModel = (SchemaModel)this._geometricNetwork.Container;

            // Get Parent FeatureDataset
            Dataset parent = this._geometricNetwork.GetParent();

            if (parent == null)
            {
                return;
            }
            FeatureDataset featureDataset = parent as FeatureDataset;

            if (featureDataset == null)
            {
                return;
            }

            // Add From and To FeatureDatasets
            EsriShape <FeatureDataset> featureDataset1 = new EsriShape <FeatureDataset>(featureDataset);
            EsriShape <FeatureDataset> featureDataset2 = new EsriShape <FeatureDataset>(featureDataset);

            this.Shapes.Add(this.Shapes.CreateKey(), featureDataset1);
            this.Shapes.Add(this.Shapes.CreateKey(), featureDataset2);

            // Add all Child FeatureClasses
            foreach (Dataset dataset in featureDataset.GetChildren())
            {
                if (dataset.GetType() != typeof(FeatureClass))
                {
                    continue;
                }

                // Get FeatureClass
                FeatureClass featureClass = (FeatureClass)dataset;

                // Only allow Simle and Complex Edges
                switch (featureClass.FeatureType)
                {
                case esriFeatureType.esriFTSimpleEdge:
                case esriFeatureType.esriFTComplexEdge:
                case esriFeatureType.esriFTSimpleJunction:
                    break;

                default:
                    continue;
                }

                // Only continue if FeatureClass belongs to the GeometricNetwork
                bool participate = false;
                foreach (ControllerMembership controller in featureClass.ControllerMemberships)
                {
                    if (controller is GeometricNetworkControllerMembership)
                    {
                        GeometricNetworkControllerMembership geometricNetworkControllerMembership = (GeometricNetworkControllerMembership)controller;
                        if (geometricNetworkControllerMembership.GeometricNetworkName == this._geometricNetwork.Name)
                        {
                            participate = true;
                            break;
                        }
                    }
                }
                if (!participate)
                {
                    continue;
                }

                // Get Subtypes
                List <Subtype> subtypes = featureClass.GetSubtypes();

                switch (featureClass.FeatureType)       //  (featureClass.CLSID) {
                {
                case esriFeatureType.esriFTSimpleEdge:  //  EsriRegistry.CLASS_SIMPLEEDGE:
                case esriFeatureType.esriFTComplexEdge: //  EsriRegistry.CLASS_COMPLEXEDGE:
                    // Add From FetaureClasses and Subtypes
                    EsriShape <FeatureClass> featureClass1 = new EsriShape <FeatureClass>(featureClass);
                    this.Shapes.Add(this.Shapes.CreateKey(), featureClass1);
                    listFeatureClassFrom.Add(featureClass1);

                    // Add Line from FeatureDataset to FeatureClass
                    Arrow arrow1 = new Arrow();
                    arrow1.BorderColor    = ModelSettings.Default.DisabledLined;
                    arrow1.DrawBackground = false;
                    Line line1 = new Line(featureDataset1, featureClass1);
                    line1.End.AllowMove   = false;
                    line1.End.Marker      = arrow1;
                    line1.Start.AllowMove = false;
                    line1.BorderColor     = ModelSettings.Default.DisabledLined;
                    this.Lines.Add(this.Lines.CreateKey(), line1);

                    // Add Subtypes and Link to FeatureClass
                    foreach (Subtype subtype in subtypes)
                    {
                        EsriShape <Subtype> sub = new EsriShape <Subtype>(subtype);
                        this.Shapes.Add(this.Shapes.CreateKey(), sub);
                        listSubtypeFrom.Add(sub);
                        Arrow arrow3 = new Arrow();
                        arrow3.BorderColor    = ModelSettings.Default.DisabledLined;
                        arrow3.DrawBackground = false;
                        Line line = new Line(featureClass1, sub);
                        line.End.AllowMove   = false;
                        line.End.Marker      = arrow3;
                        line.Start.AllowMove = false;
                        line.BorderColor     = ModelSettings.Default.DisabledLined;
                        this.Lines.Add(this.Lines.CreateKey(), line);
                    }
                    break;

                case esriFeatureType.esriFTSimpleJunction:     // EsriRegistry.CLASS_SIMPLEJUNCTION:
                    // Add To FetaureClasses and Subtypes
                    EsriShape <FeatureClass> featureClass2 = new EsriShape <FeatureClass>(featureClass);
                    this.Shapes.Add(this.Shapes.CreateKey(), featureClass2);
                    listFeatureClassTo.Add(featureClass2);

                    // Add Line from FeatureDataset to FeatureClass
                    Arrow arrow2 = new Arrow();
                    arrow2.BorderColor    = ModelSettings.Default.DisabledLined;
                    arrow2.DrawBackground = false;
                    Line line2 = new Line(featureClass2, featureDataset2);
                    line2.End.AllowMove   = false;
                    line2.Start.AllowMove = false;
                    line2.Start.Marker    = arrow2;
                    line2.BorderColor     = ModelSettings.Default.DisabledLined;
                    this.Lines.Add(this.Lines.CreateKey(), line2);

                    // Add Subtyes and Link to FeatureClasses
                    foreach (Subtype subtype in subtypes)
                    {
                        EsriShape <Subtype> sub = new EsriShape <Subtype>(subtype);
                        this.Shapes.Add(this.Shapes.CreateKey(), sub);
                        listSubtypeTo.Add(sub);
                        Arrow arrow4 = new Arrow();
                        arrow4.BorderColor    = ModelSettings.Default.DisabledLined;
                        arrow4.DrawBackground = false;
                        Line line = new Line(sub, featureClass2);
                        line.End.AllowMove   = false;
                        line.Start.Marker    = arrow4;
                        line.Start.AllowMove = false;
                        line.BorderColor     = ModelSettings.Default.DisabledLined;
                        this.Lines.Add(this.Lines.CreateKey(), line);
                    }
                    break;
                }
            }

            // Loop Through All Connectivity Rules
            foreach (ConnectivityRule connectivityRule in this._geometricNetwork.ConnectivityRules)
            {
                // Continue only if Edge Connectivity Rule
                if (!(connectivityRule is JunctionConnectivityRule))
                {
                    continue;
                }

                // Get Edge Connectivity Rule
                JunctionConnectivityRule junctionConnectivityRule = (JunctionConnectivityRule)connectivityRule;

                // Origin Table
                EsriTable origin = schemaModel.FindObjectClassOrSubtype(
                    junctionConnectivityRule.EdgeClassID,
                    junctionConnectivityRule.EdgeSubtypeCode);

                // Destination Table
                EsriTable destination = schemaModel.FindObjectClassOrSubtype(
                    junctionConnectivityRule.JunctionClassID,
                    junctionConnectivityRule.SubtypeCode);

                // Origin and Destination Shapes
                Shape shapeOrigin      = null;
                Shape shapeDestiantion = null;

                // Find Origin Shape in Diagram
                foreach (EsriShape <FeatureClass> f in listFeatureClassFrom)
                {
                    if (f.Parent == origin)
                    {
                        shapeOrigin = f;
                        break;
                    }
                }
                if (shapeOrigin == null)
                {
                    foreach (EsriShape <Subtype> s in listSubtypeFrom)
                    {
                        if (s.Parent == origin)
                        {
                            shapeOrigin = s;
                            break;
                        }
                    }
                }

                // Find Destination Shape in Diagram
                foreach (EsriShape <FeatureClass> f in listFeatureClassTo)
                {
                    if (f.Parent == destination)
                    {
                        shapeDestiantion = f;
                        break;
                    }
                }
                if (shapeDestiantion == null)
                {
                    foreach (EsriShape <Subtype> s in listSubtypeTo)
                    {
                        if (s.Parent == destination)
                        {
                            shapeDestiantion = s;
                            break;
                        }
                    }
                }

                // Skip if Origin and Destination Shapes not found
                if (shapeOrigin == null || shapeDestiantion == null)
                {
                    continue;
                }

                EsriLine <JunctionConnectivityRule> line2 = new EsriLine <JunctionConnectivityRule>(junctionConnectivityRule, shapeOrigin, shapeDestiantion);
                this.Lines.Add(this.Lines.CreateKey(), line2);
            }

            // Perform Layout
            this.ExecuteLayout(typeof(HierarchicalLayout), true);

            // Resume and Refresh Model
            this.SuspendEvents = false;
            this.Resume();
            if (ModelSettings.Default.EnableUndoRedo)
            {
                this.UndoList.Resume();
            }
            this.Refresh();
        }
        private void Model_ElementInvalid(object sender, ElementEventArgs e)
        {
            // Exit if GeometricNetwork Does not Exist
            if (this._geometricNetwork == null)
            {
                return;
            }

            // Get Element
            Element element = e.Value;

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

            if (line == null)
            {
                return;
            }

            // Get Controller
            GeometricNetworkControllerMembership controller = line.Parent;

            // Suspend Rule Events
            controller.Suspend();

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

            // Update GeometricNetwork Name Property
            if (elementStart == null)
            {
                controller.GeometricNetworkName = string.Empty;
            }
            else if (elementStart is EsriShape <GeometricNetwork> )
            {
                EsriShape <GeometricNetwork> shape            = (EsriShape <GeometricNetwork>)elementStart;
                GeometricNetwork             geometricNetwork = shape.Parent;
                controller.GeometricNetworkName = geometricNetwork.Name;
            }

            //
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel           schemaModel           = diagrammerEnvironment.SchemaModel;
            ObjectClass           objectClass           = schemaModel.FindParent(controller);

            if (objectClass != null)
            {
                objectClass.ControllerMemberships.Remove(controller);
            }

            if (elementEnd == null)
            {
                controller.AncillaryRoleFieldName = string.Empty;
                controller.EnabledFieldName       = string.Empty;
            }
            else if (elementEnd is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> es           = (EsriShape <FeatureClass>)elementEnd;
                FeatureClass             featureClass = es.Parent;
                featureClass.ControllerMemberships.Add(controller);
            }

            // Resume Controller Events
            controller.Resume();
        }
Example #16
0
        //
        // PROTECTED METHDOS
        //
        protected override void WriteInnerXml(XmlWriter writer)
        {
            // Write Base Xml
            base.WriteInnerXml(writer);

            // Get Model
            SchemaModel model = (SchemaModel)base.Container;

            // <Extent></Extent>
            if (this._extent != null)
            {
                this._extent.WriteXml(writer);
            }

            // <SpatialReference></SpatialReference>
            if (this._spatialReference != null)
            {
                this._spatialReference.WriteXml(writer);
            }

            // <NetworkType></NetworkType>
            writer.WriteStartElement(Xml.NETWORKTYPE);
            writer.WriteValue(this._networkType.ToString());
            writer.WriteEndElement();

            // <OrphanJunctionFeatureClassName></OrphanJunctionFeatureClassName>
            writer.WriteStartElement(Xml.ORPHANJUNCTIONFEATURECLASSNAME);
            writer.WriteValue(this._orphanJunctionFeatureClassName);
            writer.WriteEndElement();

            // <FeatureClassNames>
            writer.WriteStartElement(Xml.FEATURECLASSNAMES);
            writer.WriteAttributeString(Xml._XSI, Xml._TYPE, null, Xml._NAMES);

            Dataset dataset = base.GetParent();

            if (dataset.GetType() == typeof(FeatureDataset))
            {
                FeatureDataset featureDataset = (FeatureDataset)dataset;
                List <Dataset> datasets       = featureDataset.GetChildren();
                foreach (Dataset dataset2 in datasets)
                {
                    if (dataset2.GetType() == typeof(FeatureClass))
                    {
                        FeatureClass featureClass = (FeatureClass)dataset2;
                        List <ControllerMembership> controllers = featureClass.ControllerMemberships;
                        foreach (ControllerMembership controller in controllers)
                        {
                            if (controller is GeometricNetworkControllerMembership)
                            {
                                GeometricNetworkControllerMembership geometricNetworkControllerMembership = (GeometricNetworkControllerMembership)controller;
                                if (geometricNetworkControllerMembership.GeometricNetworkName == base.Name)
                                {
                                    // <Name></Name>
                                    writer.WriteStartElement(Xml.NAME);
                                    writer.WriteValue(featureClass.Name);
                                    writer.WriteEndElement();
                                }
                            }
                        }
                    }
                }
            }

            // </FeatureClassNames>
            writer.WriteEndElement();

            // <ConnectivityRules>
            writer.WriteStartElement(Xml.CONNECTIVITYRULES);
            writer.WriteAttributeString(Xml._XSI, Xml._TYPE, null, Xml._ARRAYOFCONNECTIVITYRULE);

            // <ConnectivityRule></ConnectivityRule>
            foreach (ConnectivityRule connectivityRule in this._connectivityRules)
            {
                connectivityRule.WriteXml(writer);
            }

            // </ConnectivityRules>
            writer.WriteEndElement();

            // <NetworkWeights>
            writer.WriteStartElement(Xml.NETWORKWEIGHTS);
            writer.WriteAttributeString(Xml._XSI, Xml._TYPE, null, Xml._ARRAYOFNETWEIGHT);

            // <NetWeight></NetWeight>
            foreach (NetWeight netWeight in this._netWeights)
            {
                netWeight.WriteXml(writer);
            }

            // </NetworkWeights>
            writer.WriteEndElement();

            // <WeightAssociations>
            writer.WriteStartElement(Xml.WEIGHTASSOCIATIONS);
            writer.WriteAttributeString(Xml._XSI, Xml._TYPE, null, Xml._ARRAYOFNETWEIGHTASSOCIATION);

            // <NetWeightAssociation></NetWeightAssociation>
            foreach (NetWeightAssociation netWeightAssociation in this._netWeightAssociations)
            {
                netWeightAssociation.WriteXml(writer);
            }

            // </WeightAssociations>
            writer.WriteEndElement();
        }
        //
        // PUBLIC METHODS
        //
        public override void OpenModel()
        {
            // Exit if invalid
            if (this._geometricNetwork == null)
            {
                return;
            }

            // Suspend Model
            if (ModelSettings.Default.EnableUndoRedo)
            {
                base.UndoList.Suspend();
            }
            base.Suspend();
            base.SuspendEvents = true;

            // Add GeometricNetwork Shape
            EsriShape <GeometricNetwork> shapeGN = new EsriShape <GeometricNetwork>(this._geometricNetwork);

            base.Shapes.Add(base.Shapes.CreateKey(), shapeGN);

            // Get Parent FeatureDataset
            Dataset parent = this._geometricNetwork.GetParent();

            if (parent == null)
            {
                return;
            }
            FeatureDataset featureDataset = parent as FeatureDataset;

            if (featureDataset == null)
            {
                return;
            }

            // Add FeatureDataset Shape
            EsriShape <FeatureDataset> shapeFD = new EsriShape <FeatureDataset>(featureDataset);

            base.Shapes.Add(base.Shapes.CreateKey(), shapeFD);

            // Add all Child FeatureClasses
            foreach (Dataset dataset in featureDataset.GetChildren())
            {
                if (dataset.GetType() == typeof(FeatureClass))
                {
                    // Add FetaureClass Shape
                    FeatureClass             featureClass = (FeatureClass)dataset;
                    EsriShape <FeatureClass> shapeFC      = new EsriShape <FeatureClass>(featureClass);
                    base.Shapes.Add(base.Shapes.CreateKey(), shapeFC);

                    // Add Link
                    Arrow arrow = new Arrow();
                    arrow.BorderColor    = ModelSettings.Default.DisabledLined;
                    arrow.DrawBackground = false;
                    Line line = new Line(shapeFC, shapeFD);
                    line.BorderColor     = ModelSettings.Default.DisabledLined;
                    line.End.AllowMove   = false;
                    line.Start.Marker    = arrow;
                    line.Start.AllowMove = false;
                    base.Lines.Add(base.Lines.CreateKey(), line);

                    foreach (ControllerMembership controllerMembership in featureClass.ControllerMemberships)
                    {
                        if (controllerMembership is GeometricNetworkControllerMembership)
                        {
                            GeometricNetworkControllerMembership geometricNetworkControllerMembership = (GeometricNetworkControllerMembership)controllerMembership;
                            if (geometricNetworkControllerMembership.GeometricNetworkName == this._geometricNetwork.Name)
                            {
                                EsriLine <GeometricNetworkControllerMembership> line2 = new EsriLine <GeometricNetworkControllerMembership>(geometricNetworkControllerMembership, shapeGN, shapeFC);
                                base.Lines.Add(base.Lines.CreateKey(), line2);
                            }
                        }
                    }
                }
            }

            // Perform Layout
            base.ExecuteLayout(typeof(HierarchicalLayout), true);

            // Resume and Refresh Model
            base.SuspendEvents = false;
            base.Resume();
            if (ModelSettings.Default.EnableUndoRedo)
            {
                base.UndoList.Resume();
            }
            base.Refresh();
        }
Example #18
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 METHODS
        //
        public override void OpenModel()
        {
            // Exit if invalid
            if (this._terrain == null)
            {
                return;
            }

            // Suspend Model
            if (ModelSettings.Default.EnableUndoRedo)
            {
                this.UndoList.Suspend();
            }
            this.Suspend();
            this.SuspendEvents = true;

            // Add GeometricNetwork Shape
            EsriShape <Terrain> shapeTerrain = new EsriShape <Terrain>(this._terrain);

            this.Shapes.Add(this.Shapes.CreateKey(), shapeTerrain);

            // Get Parent FeatureDataset
            Dataset parent = this._terrain.GetParent();

            if (parent != null)
            {
                FeatureDataset featureDataset = parent as FeatureDataset;
                if (featureDataset != null)
                {
                    // Add FeatureDataset Shape
                    EsriShape <FeatureDataset> shapeFeatureDataset = new EsriShape <FeatureDataset>(featureDataset);
                    this.Shapes.Add(this.Shapes.CreateKey(), shapeFeatureDataset);

                    // Add all Child FeatureClasses
                    foreach (Dataset dataset in featureDataset.GetChildren())
                    {
                        if (dataset.GetType() == typeof(FeatureClass))
                        {
                            // Add FetaureClass Shape
                            FeatureClass             featureClass      = (FeatureClass)dataset;
                            EsriShape <FeatureClass> shapeFeatureClass = new EsriShape <FeatureClass>(featureClass);
                            this.Shapes.Add(this.Shapes.CreateKey(), shapeFeatureClass);

                            // Add Link
                            Arrow arrow = new Arrow();
                            arrow.BorderColor    = ModelSettings.Default.DisabledLined;
                            arrow.DrawBackground = false;
                            Line line = new Line(shapeFeatureClass, shapeFeatureDataset);
                            line.BorderColor     = ModelSettings.Default.DisabledLined;
                            line.End.AllowMove   = false;
                            line.Start.Marker    = arrow;
                            line.Start.AllowMove = false;
                            this.Lines.Add(this.Lines.CreateKey(), line);

                            foreach (TerrainDataSource terrainDataSource in this._terrain.TerrainDataSources)
                            {
                                if (terrainDataSource.FeatureClassName == dataset.Name)
                                {
                                    EsriLine <TerrainDataSource> line2 = new EsriLine <TerrainDataSource>(terrainDataSource, shapeTerrain, shapeFeatureClass);
                                    this.Lines.Add(this.Lines.CreateKey(), line2);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            // Perform Layout
            this.ExecuteLayout(typeof(HierarchicalLayout), true);

            // Resume and Refresh Model
            this.SuspendEvents = false;
            this.Resume();
            if (ModelSettings.Default.EnableUndoRedo)
            {
                this.UndoList.Resume();
            }
            this.Refresh();
        }
        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);
        }
        //
        // PUBLIC METHODS
        //
        public override void OpenModel(string filename) {
            // Exit if FileName is invalid
            if (string.IsNullOrEmpty(filename)) { return; }

            // Exit if File does not exist
            if (!File.Exists(filename)) { return; }

            // Open XML Workspace
            XPathDocument document = null;
            try {
                document = new XPathDocument(filename, XmlSpace.None);
            }
            catch (XmlException ex) {
                MessageBox.Show(
                    "The XML file failed to load. Please select 'View > Exceptions' to view a detailed explanation.",
                    Resources.TEXT_APPLICATION,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1,
                    MessageBoxOptions.DefaultDesktopOnly);

                // Add Exception
                ExceptionDialog.HandleException(ex);
            }
            if (document == null) { return; }

            // Get XPathNavigator (IXPathNavigable::CreateNavigator)
            XPathNavigator navigator = document.CreateNavigator();

            // Get <esri:Workspace>
            if (!navigator.MoveToFirstChild()) {
                MessageBox.Show(
                    "This file is not a valid ESRI xml workspace document",
                    Resources.TEXT_APPLICATION,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1,
                    MessageBoxOptions.DefaultDesktopOnly);
                return;
            }

            // Check Node Name
            if (navigator.Name != "esri:Workspace") {
                MessageBox.Show(
                    "This file is not a valid ESRI xml workspace document",
                    Resources.TEXT_APPLICATION,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error,
                    MessageBoxDefaultButton.Button1,
                    MessageBoxOptions.DefaultDesktopOnly);
                return;
            }

            // Create Xml Namespace Manager
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(navigator.NameTable);
            namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE);

            // Suspend Model
            this.Suspend();
            this.SuspendEvents = true;
            if (ModelSettings.Default.EnableUndoRedo) {
                this.UndoList.Suspend();
            }

            // Select Domains
            XPathNodeIterator iteratorDomain = navigator.Select("WorkspaceDefinition/Domains/Domain");

            // Add Domains
            while (iteratorDomain.MoveNext()) {
                XPathNavigator domain = iteratorDomain.Current;
                XPathNavigator type = domain.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value) {
                    case Xml._RANGEDOMAIN:
                        DomainRange domainRange = new DomainRange(domain);
                        this.Shapes.Add(this.Shapes.CreateKey(), domainRange);
                        break;
                    case Xml._CODEDVALUEDOMAIN:
                        DomainCodedValue domainCodedValue = new DomainCodedValue(domain);
                        this.Shapes.Add(this.Shapes.CreateKey(), domainCodedValue);
                        break;
                }
            }

            // Select Root DataElements
            XPathNodeIterator iteratorDataElement = navigator.Select("WorkspaceDefinition/DatasetDefinitions/DataElement");
            while (iteratorDataElement.MoveNext()) {
                XPathNavigator dataElement = iteratorDataElement.Current;
                XPathNavigator type = dataElement.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value) {
                    case Xml._DEFEATUREDATASET:
                        // Create FeatureDataset
                        FeatureDataset featureDataset = new FeatureDataset(dataElement);
                        this.Shapes.Add(this.Shapes.CreateKey(), featureDataset);

                        // Loop for Child DataElements
                        XPathNodeIterator iteratorDataElement2 = dataElement.Select("Children/DataElement");
                        while (iteratorDataElement2.MoveNext()) {
                            XPathNavigator dataElement2 = iteratorDataElement2.Current;
                            XPathNavigator type2 = dataElement2.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                            switch (type2.Value) {
                                case Xml._DEFEATURECLASS:
                                    // Create FeatureClass
                                    FeatureClass featureClass2 = new FeatureClass(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), featureClass2);

                                    // Create Link to FeatureDataset
                                    Link link1 = new Link(featureDataset, featureClass2);
                                    link1.BorderColor = ModelSettings.Default.EnabledLines;
                                    link1.BorderStyle = DashStyle.Solid;
                                    link1.BorderWidth = 1f;
                                    link1.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link1);

                                    // Add Subtypes
                                    this.AddSubtypes(featureClass2, dataElement2);

                                    break;
                                case Xml._DEGEOMETRICNETWORK:
                                    // Create GeometricNetwork
                                    GeometricNetwork geometricNetwork = new GeometricNetwork(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), geometricNetwork);

                                    // Create Link to FeatureDataset
                                    Link link2 = new Link(featureDataset, geometricNetwork);
                                    link2.BorderColor = ModelSettings.Default.EnabledLines;
                                    link2.BorderStyle = DashStyle.Solid;
                                    link2.BorderWidth = 1f;
                                    link2.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link2);

                                    break;
                                case Xml._DERELATIONSHIPCLASS:
                                    // Create Relationship
                                    RelationshipClass relationshipClass = new RelationshipClass(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), relationshipClass);

                                    // Create Link to FeatureDataset
                                    Link link3 = new Link(featureDataset, relationshipClass);
                                    link3.BorderColor = ModelSettings.Default.EnabledLines;
                                    link3.BorderStyle = DashStyle.Solid;
                                    link3.BorderWidth = 1f;
                                    link3.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link3);

                                    break;
                                case Xml._DETOPOLOGY:
                                    // Create Topology
                                    Topology topology = new Topology(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), topology);

                                    // Create Link to FeatureDataset
                                    Link link4 = new Link(featureDataset, topology);
                                    link4.BorderColor = ModelSettings.Default.EnabledLines;
                                    link4.BorderStyle = DashStyle.Solid;
                                    link4.BorderWidth = 1f;
                                    link4.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link4);

                                    break;
                                case Xml._DENETWORKDATASET:
                                    // Create Network Dataset
                                    Network network = new Network(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), network);

                                    // Create Link to FeatureDataset
                                    Link link5 = new Link(featureDataset, network);
                                    link5.BorderColor = ModelSettings.Default.EnabledLines;
                                    link5.BorderStyle = DashStyle.Solid;
                                    link5.BorderWidth = 1f;
                                    link5.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link5);

                                    break;
                                case Xml._DETERRAIN:
                                    // Create Network Dataset
                                    Terrain terrain = new Terrain(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), terrain);

                                    // Create Link to FeatureDataset
                                    Link link6 = new Link(featureDataset, terrain);
                                    link6.BorderColor = ModelSettings.Default.EnabledLines;
                                    link6.BorderStyle = DashStyle.Solid;
                                    link6.BorderWidth = 1f;
                                    link6.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link6);

                                    break;
                            }
                        }

                        break;
                    case Xml._DEFEATURECLASS:
                        // Create FeatureClass
                        FeatureClass featureClass = new FeatureClass(dataElement);
                        this.Shapes.Add(this.Shapes.CreateKey(), featureClass);

                        // Add Subtypes
                        this.AddSubtypes(featureClass, dataElement);

                        break;
                    case Xml._DETABLE:
                        // Create Table
                        ObjectClass objectClass = new ObjectClass(dataElement);
                        this.Shapes.Add(this.Shapes.CreateKey(), objectClass);

                        // Add Subtypes
                        this.AddSubtypes(objectClass, dataElement);

                        break;
                    case Xml._DERASTERCATALOG:
                        // Create Table
                        RasterCatalog rasterCatalog = new RasterCatalog(dataElement);
                        this.Shapes.Add(this.Shapes.CreateKey(), rasterCatalog);

                        break;
                    case Xml._DERELATIONSHIPCLASS:
                        // Create Relationship
                        RelationshipClass relationshipClass2 = new RelationshipClass(dataElement);
                        this.Shapes.Add(this.Shapes.CreateKey(), relationshipClass2);

                        break;
                    case Xml._DERASTERDATASET:
                        // Create RasterDataset
                        RasterDataset rasterDataset = new RasterDataset(dataElement);
                        this.Shapes.Add(this.Shapes.CreateKey(), rasterDataset);

                        // Loop for Child DataElements
                        XPathNodeIterator iteratorDataElement3 = dataElement.Select("Children/DataElement");
                        while (iteratorDataElement3.MoveNext()) {
                            XPathNavigator dataElement2 = iteratorDataElement3.Current;
                            XPathNavigator type2 = dataElement2.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                            switch (type2.Value) {
                                case Xml._DERASTERBAND:
                                    // Create FeatureClass
                                    RasterBand rasterBand = new RasterBand(dataElement2);
                                    this.Shapes.Add(this.Shapes.CreateKey(), rasterBand);

                                    // Create Link to FeatureDataset
                                    Link link = new Link(rasterDataset, rasterBand);
                                    link.BorderColor = ModelSettings.Default.EnabledLines;
                                    link.BorderStyle = DashStyle.Solid;
                                    link.BorderWidth = 1f;
                                    link.End.Marker.BorderColor = ModelSettings.Default.EnabledLines;
                                    this.Lines.Add(this.Lines.CreateKey(), link);

                                    break;
                            }
                        }

                        break;
                }
            }

            // <esri:Workspace><WorkspaceDefinition><Metadata><XmlDoc>
            XPathNavigator navigatorMetadata = navigator.SelectSingleNode("WorkspaceDefinition/Metadata/XmlDoc");
            if (navigatorMetadata != null) {
                this._metadata = navigatorMetadata.Value;
            }

            // <WorkspaceType>
            XPathNavigator navigatorWorkspaceType = navigator.SelectSingleNode("WorkspaceDefinition/WorkspaceType");
            if (navigatorWorkspaceType != null) {
                this._workspaceType = (esriWorkspaceType)Enum.Parse(typeof(esriWorkspaceType), navigatorWorkspaceType.Value, true);
            }

            // <Version>
            XPathNavigator navigatorVersion = navigator.SelectSingleNode("WorkspaceDefinition/Version");
            if (navigatorVersion != null) {
                this._version = navigatorVersion.Value;
            }

            // Close XML Document
            document = null;

            // Perform Layout
            this.ExecuteLayout(typeof(HierarchicalLayout), true);

            // Resume and Refresh Model
            if (ModelSettings.Default.EnableUndoRedo) {
                this.UndoList.Resume();
            }
            this.SuspendEvents = false;
            this.Resume();
            this.Refresh();

            // Make Dirty
            this._dirty = true;
        }
 public FeatureClass(FeatureClass prototype) : base(prototype) {
     this._featureType = prototype.FeatureType;
     this._shapeType = prototype.ShapeType;
     this._shapeFieldName = prototype.ShapeFieldName;
     this._hasM = prototype.HasM;
     this._hasZ = prototype.HasZ;
     this._areaFieldName = prototype.AreaFieldName;
     this._lengthFieldName = prototype.LengthFieldName;
     if (prototype.Extent != null) {
         this._extent = prototype.Extent.Clone() as Extent;
     }
     if (prototype.SpatialReference != null) {
         this._spatialReference = prototype.SpatialReference.Clone() as SpatialReference;
     }
 }