コード例 #1
0
        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();
        }
コード例 #2
0
        //
        // PUBLIC METHODS
        //
        public override void OpenModel()
        {
            EsriShape <ObjectClass>     orig                = null;
            EsriShape <ObjectClass>     dest                = null;
            List <EsriShape <Subtype> > originSubtypes      = new List <EsriShape <Subtype> >();
            List <EsriShape <Subtype> > destinationSubtypes = new List <EsriShape <Subtype> >();

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

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

            // Get Schema Model
            SchemaModel schemaModel = (SchemaModel)this._relationshipClass.Container;

            // Get Origin and Destination ObjectClasses
            ObjectClass objectClassOrig = schemaModel.FindObjectClass(this._relationshipClass.OriginClassName);
            ObjectClass objectClassDest = schemaModel.FindObjectClass(this._relationshipClass.DestinationClassName);

            // Add ObjectClasses
            orig = new EsriShape <ObjectClass>(objectClassOrig);
            dest = new EsriShape <ObjectClass>(objectClassDest);
            this.Shapes.Add(this.Shapes.CreateKey(), orig);
            this.Shapes.Add(this.Shapes.CreateKey(), dest);

            // Get Subtypes
            List <Subtype> subtypesOrig = objectClassOrig.GetSubtypes();
            List <Subtype> subtypesDest = objectClassDest.GetSubtypes();

            // Add Subtypes
            foreach (Subtype subtype in subtypesOrig)
            {
                EsriShape <Subtype> sub = new EsriShape <Subtype>(subtype);
                this.Shapes.Add(this.Shapes.CreateKey(), sub);

                Arrow arrow = new Arrow();
                arrow.BorderColor    = ModelSettings.Default.DisabledLined;
                arrow.DrawBackground = false;

                Line line = new Line(orig, sub);
                line.BorderColor     = ModelSettings.Default.DisabledLined;
                line.End.AllowMove   = false;
                line.End.Marker      = arrow;
                line.Start.AllowMove = false;
                this.Lines.Add(this.Lines.CreateKey(), line);

                originSubtypes.Add(sub);
            }
            foreach (Subtype subtype in subtypesDest)
            {
                EsriShape <Subtype> sub = new EsriShape <Subtype>(subtype);
                this.Shapes.Add(this.Shapes.CreateKey(), sub);

                Arrow arrow = new Arrow();
                arrow.BorderColor    = ModelSettings.Default.DisabledLined;
                arrow.DrawBackground = false;

                Line line = new Line(sub, dest);
                line.BorderColor     = ModelSettings.Default.DisabledLined;
                line.End.AllowMove   = false;
                line.Start.AllowMove = false;
                line.Start.Marker    = arrow;
                this.Lines.Add(this.Lines.CreateKey(), line);

                destinationSubtypes.Add(sub);
            }

            // Get Rules
            List <RelationshipRule> rules = this._relationshipClass.RelationshipRules;

            foreach (RelationshipRule rule in rules)
            {
                Shape shapeOrign = null;
                if (subtypesOrig.Count == 0)
                {
                    shapeOrign = orig;
                }
                else
                {
                    foreach (EsriShape <Subtype> subtype in originSubtypes)
                    {
                        if (subtype.Parent.SubtypeCode == rule.OriginSubtype)
                        {
                            shapeOrign = subtype;
                            break;
                        }
                    }
                }

                Shape shapeDestination = null;
                if (subtypesDest.Count == 0)
                {
                    shapeDestination = dest;
                }
                else
                {
                    foreach (EsriShape <Subtype> subtype in destinationSubtypes)
                    {
                        if (subtype.Parent.SubtypeCode == rule.DestinationSubtype)
                        {
                            shapeDestination = subtype;
                            break;
                        }
                    }
                }
                if (shapeOrign == null || shapeDestination == null)
                {
                    continue;
                }
                //
                EsriLine <RelationshipRule> line = new EsriLine <RelationshipRule>(rule, shapeOrign, shapeDestination);
                this.Lines.Add(this.Lines.CreateKey(), line);
            }

            // 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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        //
        // 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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        //
        // 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();
        }
コード例 #7
0
        //
        // PRIVATE METHODS
        //
        public override void OpenModel()
        {
            // Exit if invalid
            if (this.m_domain == null)
            {
                return;
            }

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

            // Get Schema Model
            SchemaModel model = (SchemaModel)this.m_domain.Container;

            // Add ObjectClasses that use the Domain
            List <ObjectClass> objectClasses = model.GetObjectClasses();

            foreach (ObjectClass objectClass in objectClasses)
            {
                // Add Fields
                List <Field>   fields   = objectClass.GetFields();
                List <Subtype> subtypes = objectClass.GetSubtypes();

                // Check if Domain Used
                bool domainUsed = false;
                foreach (Field field in fields)
                {
                    if (field.Domain == this.m_domain.Name)
                    {
                        domainUsed = true;
                        break;
                    }
                }

                if (!domainUsed)
                {
                    foreach (Subtype subtype in subtypes)
                    {
                        // Loop for each subtype field
                        List <SubtypeField> subtypeFields = subtype.GetSubtypeFields();
                        foreach (SubtypeField subtypeField in subtypeFields)
                        {
                            if (subtypeField.DomainName == this.m_domain.Name)
                            {
                                domainUsed = true;
                                break;
                            }
                        }
                    }
                }

                // Skip this ObjectClass if Domain not used
                if (!domainUsed)
                {
                    continue;
                }

                // Add ObjectClass
                Shape shapeObjectClass = null;
                if (objectClass.GetType() == typeof(ObjectClass))
                {
                    shapeObjectClass = new EsriShape <ObjectClass>(objectClass);
                }
                else if (objectClass.GetType() == typeof(FeatureClass))
                {
                    shapeObjectClass = new EsriShape <FeatureClass>((FeatureClass)objectClass);
                }
                this.Shapes.Add(this.Shapes.CreateKey(), shapeObjectClass);

                // Add Fields
                foreach (Field field in fields)
                {
                    if (field.Domain == this.m_domain.Name)
                    {
                        // Create Field
                        EsriShape <Field> shapeField = new EsriShape <Field>(field);
                        this.Shapes.Add(this.Shapes.CreateKey(), shapeField);

                        // Create ObjectClass Link
                        Arrow arrow = new Arrow();
                        arrow.BorderColor    = ModelSettings.Default.DisabledLined;
                        arrow.BorderStyle    = DashStyle.Solid;
                        arrow.BorderWidth    = 1f;
                        arrow.DrawBackground = false;

                        Line line = new Line(shapeObjectClass, shapeField);
                        line.BorderColor     = ModelSettings.Default.DisabledLined;
                        line.BorderStyle     = DashStyle.Solid;
                        line.BorderWidth     = 1f;
                        line.Start.AllowMove = false;
                        line.End.AllowMove   = false;
                        line.End.Marker      = arrow;
                        this.Lines.Add(this.Lines.CreateKey(), line);
                    }
                }

                // Add Subtypes
                foreach (Subtype subtype in subtypes)
                {
                    //
                    EsriShape <Subtype> shapeSubtype = null;

                    List <SubtypeField> subtypeFields = subtype.GetSubtypeFields();
                    foreach (SubtypeField subtypeField in subtypeFields)
                    {
                        if (subtypeField.DomainName == this.m_domain.Name)
                        {
                            // Add Subtype
                            if (shapeSubtype == null)
                            {
                                // Add Subtype Table
                                shapeSubtype = new EsriShape <Subtype>(subtype);
                                this.Shapes.Add(this.Shapes.CreateKey(), shapeSubtype);

                                // Add ObjectClass to Subtype Line
                                Arrow arrow = new Arrow();
                                arrow.BorderColor    = ModelSettings.Default.DisabledLined;
                                arrow.BorderStyle    = DashStyle.Solid;
                                arrow.BorderWidth    = 1f;
                                arrow.DrawBackground = false;

                                Line line = new Line(shapeObjectClass, shapeSubtype);
                                line.BorderColor     = ModelSettings.Default.DisabledLined;
                                line.BorderStyle     = DashStyle.Solid;
                                line.BorderWidth     = 1f;
                                line.Start.AllowMove = false;
                                line.End.AllowMove   = false;
                                line.End.Marker      = arrow;
                                this.Lines.Add(this.Lines.CreateKey(), line);
                            }

                            // Create SubtypeField
                            EsriShape <SubtypeField> shapeSubtypeField = new EsriShape <SubtypeField>(subtypeField);
                            this.Shapes.Add(this.Shapes.CreateKey(), shapeSubtypeField);

                            // Create SubtypeField Link
                            Arrow arrow2 = new Arrow();
                            arrow2.BorderColor    = ModelSettings.Default.DisabledLined;
                            arrow2.BorderStyle    = DashStyle.Solid;
                            arrow2.BorderWidth    = 1f;
                            arrow2.DrawBackground = false;

                            Line line2 = new Line(shapeSubtype, shapeSubtypeField);
                            line2.BorderColor     = ModelSettings.Default.DisabledLined;
                            line2.BorderStyle     = DashStyle.Solid;
                            line2.BorderWidth     = 1f;
                            line2.Start.AllowMove = false;
                            line2.End.AllowMove   = false;
                            line2.End.Marker      = arrow2;
                            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();
        }
コード例 #8
0
 public EsriShape(EsriShape <T> prototype) : base(prototype)
 {
     this._parent = prototype.Parent;
 }
コード例 #9
0
        private void Model_ElementInvalid(object sender, ElementEventArgs e)
        {
            // Exit if Topology Does not Exist
            if (this._topology == null)
            {
                return;
            }

            // Get Element
            Element element = e.Value;

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

            if (line == null)
            {
                return;
            }

            // Get TopologyRule
            TopologyRule rule = line.Parent;

            // Suspend Rule Events
            rule.Suspend();

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

            // Update Start Class/Subtype
            if (elementStart == null)
            {
                rule.AllOriginSubtypes = false;
                rule.OriginClassId     = -1;
                rule.OriginSubtype     = -1;
            }
            else if (elementStart is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)elementStart;
                ObjectClass objectClass        = shape.Parent;
                rule.AllOriginSubtypes = true;
                rule.OriginClassId     = objectClass.DSID;
                rule.OriginSubtype     = 0;
            }
            else if (elementStart is EsriShape <Subtype> )
            {
                EsriShape <Subtype> shape       = (EsriShape <Subtype>)elementStart;
                Subtype             subtype     = shape.Parent;
                ObjectClass         objectClass = subtype.GetParent();
                rule.AllOriginSubtypes = false;
                if (objectClass == null)
                {
                    rule.OriginClassId = -1;
                    rule.OriginSubtype = -1;
                }
                else
                {
                    rule.OriginClassId = objectClass.DSID;
                    rule.OriginSubtype = subtype.SubtypeCode;
                }
            }

            // Update End Class/Subtype
            if (elementEnd == null)
            {
                rule.AllDestinationSubtypes = false;
                rule.DestinationClassId     = -1;
                rule.DestinationSubtype     = -1;
            }
            else if (elementEnd is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)elementEnd;
                ObjectClass objectClass        = shape.Parent;
                rule.AllDestinationSubtypes = true;
                rule.DestinationClassId     = objectClass.DSID;
                rule.DestinationSubtype     = 0;
            }
            else if (elementEnd is EsriShape <Subtype> )
            {
                EsriShape <Subtype> shape       = (EsriShape <Subtype>)elementEnd;
                Subtype             subtype     = shape.Parent;
                ObjectClass         objectClass = subtype.GetParent();
                rule.AllDestinationSubtypes = false;
                if (objectClass == null)
                {
                    rule.DestinationClassId = -1;
                    rule.DestinationSubtype = -1;
                }
                else
                {
                    rule.DestinationClassId = objectClass.DSID;
                    rule.DestinationSubtype = subtype.SubtypeCode;
                }
            }

            // Resume Rule Events
            rule.Resume();
        }
コード例 #10
0
        //
        // 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();
        }
コード例 #11
0
        //
        // 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();
        }
コード例 #12
0
        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 <JunctionConnectivityRule> line = element as EsriLine <JunctionConnectivityRule>;

            if (line == null)
            {
                return;
            }

            // Get EdgeConnectivityRule
            JunctionConnectivityRule rule = line.Parent;

            // Suspend Rule Events
            rule.Suspend();

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

            // Update Start Class/Subtype
            if (elementStart == null)
            {
                rule.EdgeClassID     = -1;
                rule.EdgeSubtypeCode = -1;
            }
            else if (elementStart is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)elementStart;
                ObjectClass objectClass        = shape.Parent;
                rule.EdgeClassID     = objectClass.DSID;
                rule.EdgeSubtypeCode = 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.EdgeClassID     = -1;
                    rule.EdgeSubtypeCode = -1;
                }
                else
                {
                    rule.EdgeClassID     = objectClass.DSID;
                    rule.EdgeSubtypeCode = subtype.SubtypeCode;
                }
            }

            // Update End Class/Subtype
            if (elementEnd == null)
            {
                rule.JunctionClassID = -1;
                rule.SubtypeCode     = -1;
            }
            else if (elementEnd is EsriShape <FeatureClass> )
            {
                EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)elementEnd;
                ObjectClass objectClass        = shape.Parent;
                rule.JunctionClassID = objectClass.DSID;
                rule.SubtypeCode     = 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.JunctionClassID = -1;
                    rule.SubtypeCode     = -1;
                }
                else
                {
                    rule.JunctionClassID = objectClass.DSID;
                    rule.SubtypeCode     = subtype.SubtypeCode;
                }
            }

            // Resume Rule Events
            rule.Resume();
        }
コード例 #13
0
        //
        // PROTECTED EVENTS
        //
        private void DiagramColorsChanged(object sender, CancelEventArgs e)
        {
            // Suspend Model
            this.Suspend();

            // Get All Elements from Model
            foreach (Element element in base.Shapes.Values)
            {
                if (element is EsriTable)
                {
                    EsriTable table = (EsriTable)element;
                    table.RefreshColor();
                }
                else if (element is EsriShape <FeatureClass> )
                {
                    EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)element;
                    shape.BorderColor   = ColorSettings.Default.FeatureClassColor;
                    shape.GradientColor = ColorSettings.Default.FeatureClassColor;
                }
                else if (element is EsriShape <GeometricNetwork> )
                {
                    EsriShape <GeometricNetwork> shape = (EsriShape <GeometricNetwork>)element;
                    shape.BorderColor   = ColorSettings.Default.GeometricNetworkColor;
                    shape.GradientColor = ColorSettings.Default.GeometricNetworkColor;
                }
                else if (element is EsriShape <FeatureDataset> )
                {
                    EsriShape <FeatureDataset> shape = (EsriShape <FeatureDataset>)element;
                    shape.BorderColor   = ColorSettings.Default.FeatureDatasetColor;
                    shape.GradientColor = ColorSettings.Default.FeatureDatasetColor;
                }
                else if (element.GetType() == typeof(EsriShape <DomainCodedValue>))
                {
                    EsriShape <DomainCodedValue> shape = (EsriShape <DomainCodedValue>)element;
                    shape.BorderColor   = ColorSettings.Default.CodedValueDomainColor;
                    shape.GradientColor = ColorSettings.Default.CodedValueDomainColor;
                }
                else if (element.GetType() == typeof(EsriShape <DomainRange>))
                {
                    EsriShape <DomainRange> shape = (EsriShape <DomainRange>)element;
                    shape.BorderColor   = ColorSettings.Default.RangeDomainColor;
                    shape.GradientColor = ColorSettings.Default.RangeDomainColor;
                }
                else if (element.GetType() == typeof(EsriShape <FeatureClass>))
                {
                    EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)element;
                    shape.BorderColor   = ColorSettings.Default.FeatureClassColor;
                    shape.GradientColor = ColorSettings.Default.FeatureClassColor;
                }
                else if (element.GetType() == typeof(EsriShape <ObjectClass>))
                {
                    EsriShape <ObjectClass> shape = (EsriShape <ObjectClass>)element;
                    shape.BorderColor   = ColorSettings.Default.ObjectClassColor;
                    shape.GradientColor = ColorSettings.Default.ObjectClassColor;
                }
                else if (element.GetType() == typeof(EsriShape <Subtype>))
                {
                    EsriShape <Subtype> shape = (EsriShape <Subtype>)element;
                    shape.BorderColor   = ColorSettings.Default.SubtypeColor;
                    shape.GradientColor = ColorSettings.Default.SubtypeColor;
                }
                else if (element.GetType() == typeof(EsriShape <Field>))
                {
                    EsriShape <Field> shape = (EsriShape <Field>)element;
                    shape.BorderColor   = ColorSettings.Default.FieldColor;
                    shape.GradientColor = ColorSettings.Default.FieldColor;
                }
                else if (element.GetType() == typeof(EsriShape <SubtypeField>))
                {
                    EsriShape <SubtypeField> shape = (EsriShape <SubtypeField>)element;
                    shape.BorderColor   = ColorSettings.Default.SubtypeFieldColor;
                    shape.GradientColor = ColorSettings.Default.SubtypeFieldColor;
                }
                else if (element is EsriShape <FeatureClass> )
                {
                    EsriShape <FeatureClass> shape = (EsriShape <FeatureClass>)element;
                    shape.BorderColor   = ColorSettings.Default.FeatureClassColor;
                    shape.GradientColor = ColorSettings.Default.FeatureClassColor;
                }
                else if (element is EsriShape <GeometricNetwork> )
                {
                    EsriShape <GeometricNetwork> shape = (EsriShape <GeometricNetwork>)element;
                    shape.BorderColor   = ColorSettings.Default.GeometricNetworkColor;
                    shape.GradientColor = ColorSettings.Default.GeometricNetworkColor;
                }
                else if (element is EsriShape <FeatureDataset> )
                {
                    EsriShape <FeatureDataset> shape = (EsriShape <FeatureDataset>)element;
                    shape.BorderColor   = ColorSettings.Default.FeatureDatasetColor;
                    shape.GradientColor = ColorSettings.Default.FeatureDatasetColor;
                }
            }

            // Resume and Refresh Model
            this.Resume();
            this.Refresh();
        }