예제 #1
0
        public GeometricNetwork(GeometricNetwork prototype) : base(prototype)
        {
            if (prototype.Extent != null)
            {
                this._extent = prototype.Extent.Clone() as Extent;
            }
            if (prototype.SpatialReference != null)
            {
                this._spatialReference = prototype.SpatialReference.Clone() as SpatialReference;
            }
            this._networkType = prototype.NetworkType;
            this._orphanJunctionFeatureClassName = prototype.OrphanJunctionFeatureClassName;

            // Add Cloned Rules
            this._connectivityRules = new List <ConnectivityRule>();
            foreach (ConnectivityRule connnectivityRule in prototype.ConnectivityRules)
            {
                this._connectivityRules.Add((ConnectivityRule)connnectivityRule.Clone());
            }

            // Add Cloned Network Weights
            this._netWeights = new List <NetWeight>();
            foreach (NetWeight netWeight in prototype.NetworkWeights)
            {
                this._netWeights.Add((NetWeight)netWeight.Clone());
            }

            // Add Cloned Network Weight Associations
            this._netWeightAssociations = new List <NetWeightAssociation>();
            foreach (NetWeightAssociation netWeightAssociation in prototype.NetworkWeightAssociations)
            {
                this._netWeightAssociations.Add((NetWeightAssociation)netWeightAssociation.Clone());
            }
        }
예제 #2
0
 public GeometricNetwork(SerializationInfo info, StreamingContext context) : base(info, context)
 {
     this._extent           = (Extent)info.GetValue(GeometricNetwork.EXTENT_, typeof(Extent));
     this._spatialReference = (SpatialReference)info.GetValue(GeometricNetwork.SPATIALREFERENCE_, typeof(SpatialReference));
     this._networkType      = (esriNetworkType)Enum.Parse(typeof(esriNetworkType), info.GetString(GeometricNetwork.NETWORKTYPE_), true);
     this._orphanJunctionFeatureClassName = info.GetString(GeometricNetwork.ORPHANJUNCTIONFEATURECLASSNAME_);
     this._connectivityRules     = (List <ConnectivityRule>)info.GetValue(GeometricNetwork.CONNECTIVITYRULES_, typeof(List <ConnectivityRule>));
     this._netWeights            = (List <NetWeight>)info.GetValue(GeometricNetwork.NETWEIGHTS_, typeof(List <NetWeight>));
     this._netWeightAssociations = (List <NetWeightAssociation>)info.GetValue(GeometricNetwork.NETWEIGHTASSOCIATIONS_, typeof(List <NetWeightAssociation>));
 }
예제 #3
0
        //
        // CONSTRUCTOR
        //
        public GeometricNetwork(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

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

            if (navigatorExtent != null)
            {
                this._extent = new Extent(navigatorExtent);
            }

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

            if (navigatorSpatialReference != null)
            {
                this._spatialReference = new SpatialReference(navigatorSpatialReference);
            }

            // <NetworkType></NetworkType>
            XPathNavigator navigatorNetworkType = navigator.SelectSingleNode("NetworkType");

            if (navigatorNetworkType != null)
            {
                this._networkType = (esriNetworkType)Enum.Parse(typeof(esriNetworkType), navigatorNetworkType.Value, true);
            }

            // <OrphanJunctionFeatureClassName></OrphanJunctionFeatureClassName>
            XPathNavigator navigatorOrphanJunctionFeatureClassName = navigator.SelectSingleNode("OrphanJunctionFeatureClassName");

            if (navigatorOrphanJunctionFeatureClassName != null)
            {
                this._orphanJunctionFeatureClassName = navigatorOrphanJunctionFeatureClassName.Value;
            }

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

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

            // <ConnectivityRules><ConnectivityRule></ConnectivityRule></ConnectivityRules>
            this._connectivityRules = new List <ConnectivityRule>();
            XPathNodeIterator interatorConnectivityRule = navigator.Select("ConnectivityRules/ConnectivityRule");

            while (interatorConnectivityRule.MoveNext())
            {
                // Get <ConnectivityRule>
                XPathNavigator navigatorConnectivityRule = interatorConnectivityRule.Current;
                XPathNavigator type = navigatorConnectivityRule.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value)
                {
                case "esri:EdgeConnectivityRule":
                    this._connectivityRules.Add(new EdgeConnectivityRule(navigatorConnectivityRule));
                    break;

                case "esri:JunctionConnectivityRule":
                    this._connectivityRules.Add(new JunctionConnectivityRule(navigatorConnectivityRule));
                    break;
                }
            }

            // <NetworkWeights><NetWeight></NetWeight></NetworkWeights>
            this._netWeights = new List <NetWeight>();
            XPathNodeIterator interatorNetWeight = navigator.Select("NetworkWeights/NetWeight");

            while (interatorNetWeight.MoveNext())
            {
                // Get <NetWeight>
                XPathNavigator navigatorNetWeight = interatorNetWeight.Current;
                if (navigatorNetWeight != null)
                {
                    this._netWeights.Add(new NetWeight(navigatorNetWeight));
                }
            }

            // <WeightAssociations><NetWeightAssociation></NetWeightAssociation></WeightAssociations>
            this._netWeightAssociations = new List <NetWeightAssociation>();
            XPathNodeIterator interatorNetWeightAssociation = navigator.Select("WeightAssociations/NetWeightAssociation");

            while (interatorNetWeightAssociation.MoveNext())
            {
                // Get <NetWeightAssociation>
                XPathNavigator navigatorNetWeightAssociation = interatorNetWeightAssociation.Current;
                if (navigatorNetWeightAssociation != null)
                {
                    this._netWeightAssociations.Add(new NetWeightAssociation(navigatorNetWeightAssociation));
                }
            }
        }
        //
        // CONSTRUCTOR
        //
        public GeometricNetwork(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

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

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

            // <NetworkType></NetworkType>
            XPathNavigator navigatorNetworkType = navigator.SelectSingleNode("NetworkType");
            if (navigatorNetworkType != null) {
                this._networkType = (esriNetworkType)Enum.Parse(typeof(esriNetworkType), navigatorNetworkType.Value, true);
            }

            // <OrphanJunctionFeatureClassName></OrphanJunctionFeatureClassName>
            XPathNavigator navigatorOrphanJunctionFeatureClassName = navigator.SelectSingleNode("OrphanJunctionFeatureClassName");
            if (navigatorOrphanJunctionFeatureClassName != null) {
                this._orphanJunctionFeatureClassName = navigatorOrphanJunctionFeatureClassName.Value;
            }

            // Create ESRI Namespace Manager
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(navigator.NameTable);
            namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE);
            
            // <ConnectivityRules><ConnectivityRule></ConnectivityRule></ConnectivityRules>
            this._connectivityRules = new List<ConnectivityRule>();
            XPathNodeIterator interatorConnectivityRule = navigator.Select("ConnectivityRules/ConnectivityRule");
            while (interatorConnectivityRule.MoveNext()) {
                // Get <ConnectivityRule>
                XPathNavigator navigatorConnectivityRule = interatorConnectivityRule.Current;
                XPathNavigator type = navigatorConnectivityRule.SelectSingleNode(Xml._XSITYPE, namespaceManager);
                switch (type.Value) {
                    case "esri:EdgeConnectivityRule":
                        this._connectivityRules.Add(new EdgeConnectivityRule(navigatorConnectivityRule));
                        break;
                    case "esri:JunctionConnectivityRule":
                        this._connectivityRules.Add(new JunctionConnectivityRule(navigatorConnectivityRule));
                        break;
                }
            }

            // <NetworkWeights><NetWeight></NetWeight></NetworkWeights>
            this._netWeights = new List<NetWeight>();
            XPathNodeIterator interatorNetWeight = navigator.Select("NetworkWeights/NetWeight");
            while (interatorNetWeight.MoveNext()) {
                // Get <NetWeight>
                XPathNavigator navigatorNetWeight = interatorNetWeight.Current;
                if (navigatorNetWeight != null) {
                    this._netWeights.Add(new NetWeight(navigatorNetWeight));
                }
            }

            // <WeightAssociations><NetWeightAssociation></NetWeightAssociation></WeightAssociations>
            this._netWeightAssociations = new List<NetWeightAssociation>();
            XPathNodeIterator interatorNetWeightAssociation = navigator.Select("WeightAssociations/NetWeightAssociation");
            while (interatorNetWeightAssociation.MoveNext()) {
                // Get <NetWeightAssociation>
                XPathNavigator navigatorNetWeightAssociation = interatorNetWeightAssociation.Current;
                if (navigatorNetWeightAssociation != null) {
                    this._netWeightAssociations.Add(new NetWeightAssociation(navigatorNetWeightAssociation));
                }
            }
        }
        public GeometricNetwork(GeometricNetwork prototype) : base(prototype) {
            if (prototype.Extent != null) {
                this._extent = prototype.Extent.Clone() as Extent;
            }
            if (prototype.SpatialReference != null) {
                this._spatialReference = prototype.SpatialReference.Clone() as SpatialReference;
            }
            this._networkType = prototype.NetworkType;
            this._orphanJunctionFeatureClassName = prototype.OrphanJunctionFeatureClassName;

            // Add Cloned Rules
            this._connectivityRules = new List<ConnectivityRule>();
            foreach (ConnectivityRule connnectivityRule in prototype.ConnectivityRules) {
                this._connectivityRules.Add((ConnectivityRule)connnectivityRule.Clone());
            }

            // Add Cloned Network Weights
            this._netWeights = new List<NetWeight>();
            foreach (NetWeight netWeight in prototype.NetworkWeights) {
                this._netWeights.Add((NetWeight)netWeight.Clone());
            }

            // Add Cloned Network Weight Associations
            this._netWeightAssociations = new List<NetWeightAssociation>();
            foreach(NetWeightAssociation netWeightAssociation in prototype.NetworkWeightAssociations){
                this._netWeightAssociations.Add((NetWeightAssociation)netWeightAssociation.Clone());
            }
        }
 public GeometricNetwork(SerializationInfo info, StreamingContext context): base(info, context) {
     this._extent = (Extent)info.GetValue(GeometricNetwork.EXTENT_, typeof(Extent));
     this._spatialReference = (SpatialReference)info.GetValue(GeometricNetwork.SPATIALREFERENCE_, typeof(SpatialReference));
     this._networkType = (esriNetworkType)Enum.Parse(typeof(esriNetworkType), info.GetString(GeometricNetwork.NETWORKTYPE_), true);
     this._orphanJunctionFeatureClassName = info.GetString(GeometricNetwork.ORPHANJUNCTIONFEATURECLASSNAME_);
     this._connectivityRules = (List<ConnectivityRule>)info.GetValue(GeometricNetwork.CONNECTIVITYRULES_, typeof(List<ConnectivityRule>));
     this._netWeights = (List<NetWeight>)info.GetValue(GeometricNetwork.NETWEIGHTS_, typeof(List<NetWeight>));
     this._netWeightAssociations = (List<NetWeightAssociation>)info.GetValue(GeometricNetwork.NETWEIGHTASSOCIATIONS_, typeof(List<NetWeightAssociation>));
 }