public GeometricNetworkControllerMembership(GeometricNetworkControllerMembership prototype) : base(prototype)
 {
     this._geometricNetworkName      = prototype.GeometricNetworkName;
     this._enabledFieldName          = prototype.EnabledFieldName;
     this._ancillaryRoleFieldName    = prototype.AncillaryRoleFieldName;
     this._networkClassAncillaryRole = prototype.NetworkClassAncillaryRole;
 }
コード例 #2
0
        private void Model_ElementRemoved(object sender, ElementsEventArgs e)
        {
            // Check Relationship
            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 Rule
            GeometricNetworkControllerMembership controller = line.Parent;

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

            if (objectClass != null)
            {
                objectClass.ControllerMemberships.Remove(controller);
            }
        }
コード例 #3
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();
        }
コード例 #4
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();
        }
コード例 #5
0
        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);
        }
コード例 #6
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 GeometricNetworkControllerMembership(GeometricNetworkControllerMembership prototype) : base(prototype) {
     this._geometricNetworkName = prototype.GeometricNetworkName;
     this._enabledFieldName = prototype.EnabledFieldName;
     this._ancillaryRoleFieldName = prototype.AncillaryRoleFieldName;
     this._networkClassAncillaryRole = prototype.NetworkClassAncillaryRole;
 }
コード例 #8
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();
        }
コード例 #9
0
        //
        // CONSTRUCTOR
        //
        public ObjectClass(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <OIDFieldName></OIDFieldName>
            XPathNavigator navigatorOIDFieldName = navigator.SelectSingleNode("OIDFieldName");
            if (navigatorOIDFieldName != null) {
                this._oidFieldName = navigatorOIDFieldName.Value;
            }

            // <CLSID></CLSID>
            XPathNavigator navigatorCLSID = navigator.SelectSingleNode("CLSID");
            if (navigatorCLSID != null) {
                if (!string.IsNullOrEmpty(navigatorCLSID.Value)) {
                    this._clsid = navigatorCLSID.Value;
                }
            }

            // <EXTCLSID></EXTCLSID>
            XPathNavigator navigatorEXTCLSID = navigator.SelectSingleNode("EXTCLSID");
            if (navigatorEXTCLSID != null) {
                if (!string.IsNullOrEmpty(navigatorEXTCLSID.Value)) {
                    this._extClsid = navigatorEXTCLSID.Value;
                }
            }

            // <AliasName></AliasName>
            XPathNavigator navigatorAliasName = navigator.SelectSingleNode("AliasName");
            if (navigatorAliasName != null) {
                this._aliasName = navigatorAliasName.Value;
            }

            // <ModelName></ModelName>
            XPathNavigator navigatorModelName = navigator.SelectSingleNode("ModelName");
            if (navigatorModelName != null) {
                this._modelName = navigatorModelName.Value;
            }

            // <GlobalIDFieldName></GlobalIDFieldName>
            XPathNavigator navigatorGlobalIDFieldName = navigator.SelectSingleNode("GlobalIDFieldName");
            if (navigatorGlobalIDFieldName != null) {
                this._globalIDFieldName = navigatorGlobalIDFieldName.Value;
            }

            // <RasterFieldName></RasterFieldName>
            XPathNavigator navigatorRasterFieldName = navigator.SelectSingleNode("RasterFieldName");
            if (navigatorRasterFieldName != null) {
                this._rasterFieldName = navigatorRasterFieldName.Value;
            }

            // <PropertySetProperty></PropertySetProperty>
            this._extensionProperties = new List<Property>();
            XPathNodeIterator interatorPropertySetProperty = navigator.Select("ExtensionProperties/PropertyArray/PropertySetProperty");
            while (interatorPropertySetProperty.MoveNext()) {
                // Get Property Note
                XPathNavigator navigatorPropertySetProperty = interatorPropertySetProperty.Current;

                // Create Property Object
                Property property = new Property(navigatorPropertySetProperty);

                // Store Property Object in List
                this._extensionProperties.Add(property);
            }

            // <SubtypeFieldName></SubtypeFieldName>
            XPathNavigator navigatorSubtypeFieldName = navigator.SelectSingleNode("SubtypeFieldName");
            if (navigatorSubtypeFieldName != null) {
                this._subtypeFieldName = navigatorSubtypeFieldName.Value;
            }

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

            // <ControllerMemberships><ControllerMembership></ControllerMembership></ControllerMemberships>
            this._controllerMemberships = new List<ControllerMembership>();
            XPathNodeIterator interatorControllerMembership = navigator.Select("ControllerMemberships/ControllerMembership");
            while (interatorControllerMembership.MoveNext()) {
                // Get ControllerMembership
                XPathNavigator navigatorControllerMembership = interatorControllerMembership.Current;

                // Get Type
                XPathNavigator type = navigatorControllerMembership.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value) {
                    case Xml._GEOMETRICNETWORKMEMBERSHIP:
                        GeometricNetworkControllerMembership geometricNetworkControllerMembership = new GeometricNetworkControllerMembership(navigatorControllerMembership);
                        this._controllerMemberships.Add(geometricNetworkControllerMembership);
                        break;
                    case Xml._TOPOLOGYMEMBERSHIP:
                        TopologyControllerMembership topologyControllerMembership = new TopologyControllerMembership(navigatorControllerMembership);
                        this._controllerMemberships.Add(topologyControllerMembership);
                        break;
                    case Xml._TERRAINMEMBERSHIP:
                        break;
                    case Xml._NETWORKDATASETMEMBERSHIP:
                        NetworkControllerMembership networkControllerMembership = new NetworkControllerMembership(navigatorControllerMembership);
                        this._controllerMemberships.Add(networkControllerMembership);
                        break;
                }
            }

            // Create Fields Group
            TableGroup tableGroupFields = new TableGroup();
            tableGroupFields.Expanded = true;
            tableGroupFields.Text = "Fields";
            this.Groups.Add(tableGroupFields);

            XPathNodeIterator interatorField = navigator.Select("Fields/FieldArray/Field");
            while (interatorField.MoveNext()) {
                // Create Field
                XPathNavigator navigatorField = interatorField.Current;
                Field field = new Field(navigatorField, this);

                // Add Field To Group
                tableGroupFields.Rows.Add(field);
            }

            // Create Indexes Group
            TableGroup tableGroupIndexes = new TableGroup();
            tableGroupIndexes.Expanded = true;
            tableGroupIndexes.Text = "Indexes";
            this.Groups.Add(tableGroupIndexes);

            XPathNodeIterator interatorIndex = navigator.Select("Indexes/IndexArray/Index");
            while (interatorIndex.MoveNext()) {
                // Add Index
                XPathNavigator navigatorIndex = interatorIndex.Current;
                Index index = new Index(navigatorIndex);
                tableGroupIndexes.Groups.Add(index);
                
                // Add Field Index
                XPathNodeIterator interatorIndexField = navigatorIndex.Select("Fields/FieldArray/Field");
                while (interatorIndexField.MoveNext()) {
                    XPathNavigator navigatorIndexField = interatorIndexField.Current;

                    IndexField indexField = new IndexField(navigatorIndexField);
                    index.Rows.Add(indexField);
                }
            }
        }
コード例 #10
0
        //
        // CONSTRUCTOR
        //
        public ObjectClass(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <OIDFieldName></OIDFieldName>
            XPathNavigator navigatorOIDFieldName = navigator.SelectSingleNode("OIDFieldName");

            if (navigatorOIDFieldName != null)
            {
                this._oidFieldName = navigatorOIDFieldName.Value;
            }

            // <CLSID></CLSID>
            XPathNavigator navigatorCLSID = navigator.SelectSingleNode("CLSID");

            if (navigatorCLSID != null)
            {
                if (!string.IsNullOrEmpty(navigatorCLSID.Value))
                {
                    this._clsid = navigatorCLSID.Value;
                }
            }

            // <EXTCLSID></EXTCLSID>
            XPathNavigator navigatorEXTCLSID = navigator.SelectSingleNode("EXTCLSID");

            if (navigatorEXTCLSID != null)
            {
                if (!string.IsNullOrEmpty(navigatorEXTCLSID.Value))
                {
                    this._extClsid = navigatorEXTCLSID.Value;
                }
            }

            // <AliasName></AliasName>
            XPathNavigator navigatorAliasName = navigator.SelectSingleNode("AliasName");

            if (navigatorAliasName != null)
            {
                this._aliasName = navigatorAliasName.Value;
            }

            // <ModelName></ModelName>
            XPathNavigator navigatorModelName = navigator.SelectSingleNode("ModelName");

            if (navigatorModelName != null)
            {
                this._modelName = navigatorModelName.Value;
            }

            // <GlobalIDFieldName></GlobalIDFieldName>
            XPathNavigator navigatorGlobalIDFieldName = navigator.SelectSingleNode("GlobalIDFieldName");

            if (navigatorGlobalIDFieldName != null)
            {
                this._globalIDFieldName = navigatorGlobalIDFieldName.Value;
            }

            // <RasterFieldName></RasterFieldName>
            XPathNavigator navigatorRasterFieldName = navigator.SelectSingleNode("RasterFieldName");

            if (navigatorRasterFieldName != null)
            {
                this._rasterFieldName = navigatorRasterFieldName.Value;
            }

            // <PropertySetProperty></PropertySetProperty>
            this._extensionProperties = new List <Property>();
            XPathNodeIterator interatorPropertySetProperty = navigator.Select("ExtensionProperties/PropertyArray/PropertySetProperty");

            while (interatorPropertySetProperty.MoveNext())
            {
                // Get Property Note
                XPathNavigator navigatorPropertySetProperty = interatorPropertySetProperty.Current;

                // Create Property Object
                Property property = new Property(navigatorPropertySetProperty);

                // Store Property Object in List
                this._extensionProperties.Add(property);
            }

            // <SubtypeFieldName></SubtypeFieldName>
            XPathNavigator navigatorSubtypeFieldName = navigator.SelectSingleNode("SubtypeFieldName");

            if (navigatorSubtypeFieldName != null)
            {
                this._subtypeFieldName = navigatorSubtypeFieldName.Value;
            }

            // Create ESRI Namespace Manager
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(navigator.NameTable);

            namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE);

            // <ControllerMemberships><ControllerMembership></ControllerMembership></ControllerMemberships>
            this._controllerMemberships = new List <ControllerMembership>();
            XPathNodeIterator interatorControllerMembership = navigator.Select("ControllerMemberships/ControllerMembership");

            while (interatorControllerMembership.MoveNext())
            {
                // Get ControllerMembership
                XPathNavigator navigatorControllerMembership = interatorControllerMembership.Current;

                // Get Type
                XPathNavigator type = navigatorControllerMembership.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value)
                {
                case Xml._GEOMETRICNETWORKMEMBERSHIP:
                    GeometricNetworkControllerMembership geometricNetworkControllerMembership = new GeometricNetworkControllerMembership(navigatorControllerMembership);
                    this._controllerMemberships.Add(geometricNetworkControllerMembership);
                    break;

                case Xml._TOPOLOGYMEMBERSHIP:
                    TopologyControllerMembership topologyControllerMembership = new TopologyControllerMembership(navigatorControllerMembership);
                    this._controllerMemberships.Add(topologyControllerMembership);
                    break;

                case Xml._TERRAINMEMBERSHIP:
                    break;

                case Xml._NETWORKDATASETMEMBERSHIP:
                    NetworkControllerMembership networkControllerMembership = new NetworkControllerMembership(navigatorControllerMembership);
                    this._controllerMemberships.Add(networkControllerMembership);
                    break;
                }
            }

            // Create Fields Group
            TableGroup tableGroupFields = new TableGroup();

            tableGroupFields.Expanded = true;
            tableGroupFields.Text     = "Fields";
            this.Groups.Add(tableGroupFields);

            XPathNodeIterator interatorField = navigator.Select("Fields/FieldArray/Field");

            while (interatorField.MoveNext())
            {
                // Create Field
                XPathNavigator navigatorField = interatorField.Current;
                Field          field          = new Field(navigatorField, this);

                // Add Field To Group
                tableGroupFields.Rows.Add(field);
            }

            // Create Indexes Group
            TableGroup tableGroupIndexes = new TableGroup();

            tableGroupIndexes.Expanded = true;
            tableGroupIndexes.Text     = "Indexes";
            this.Groups.Add(tableGroupIndexes);

            XPathNodeIterator interatorIndex = navigator.Select("Indexes/IndexArray/Index");

            while (interatorIndex.MoveNext())
            {
                // Add Index
                XPathNavigator navigatorIndex = interatorIndex.Current;
                Index          index          = new Index(navigatorIndex);
                tableGroupIndexes.Groups.Add(index);

                // Add Field Index
                XPathNodeIterator interatorIndexField = navigatorIndex.Select("Fields/FieldArray/Field");
                while (interatorIndexField.MoveNext())
                {
                    XPathNavigator navigatorIndexField = interatorIndexField.Current;

                    IndexField indexField = new IndexField(navigatorIndexField);
                    index.Rows.Add(indexField);
                }
            }
        }