public NetworkAttribute(NetworkAttribute prototype) : base(prototype)
 {
     this._id        = prototype.Id;
     this._name      = prototype.Name;
     this._units     = prototype.Units;
     this._dataType  = prototype.DataType;
     this._usageType = prototype.UsageType;
     this._userData  = new List <Property>();
     foreach (Property property in prototype.UserDataCollection)
     {
         Property propertyClone = (Property)property.Clone();
         this._userData.Add(propertyClone);
     }
     this._useByDefault        = prototype.UseByDefault;
     this._attributeParameters = new List <NetworkAttributeParameter>();
     foreach (NetworkAttributeParameter networkAttributeParameter in prototype.AttributeParameterCollection)
     {
         NetworkAttributeParameter networkAttributeParameterClone = (NetworkAttributeParameter)networkAttributeParameter.Clone();
         this._attributeParameters.Add(networkAttributeParameterClone);
     }
 }
 public NetworkAttribute(NetworkAttribute prototype) : base(prototype) {
     this._id = prototype.Id;
     this._name = prototype.Name;
     this._units = prototype.Units;
     this._dataType = prototype.DataType;
     this._usageType = prototype.UsageType;
     this._userData = new List<Property>();
     foreach (Property property in prototype.UserDataCollection) {
         Property propertyClone = (Property)property.Clone();
         this._userData.Add(propertyClone);
     }
     this._useByDefault = prototype.UseByDefault;
     this._attributeParameters = new List<NetworkAttributeParameter>();
     foreach (NetworkAttributeParameter networkAttributeParameter in prototype.AttributeParameterCollection) {
         NetworkAttributeParameter networkAttributeParameterClone = (NetworkAttributeParameter)networkAttributeParameter.Clone();
         this._attributeParameters.Add(networkAttributeParameterClone);
     }
 }
示例#3
0
        //
        // CONSTRUCTOR
        //
        public Network(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

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

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

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

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

            // <LogicalNetworkName>
            XPathNavigator navigatorLogicalNetworkName = navigator.SelectSingleNode("LogicalNetworkName");

            if (navigatorLogicalNetworkName != null)
            {
                this._logicalNetworkName = navigatorLogicalNetworkName.Value;
            }

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

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

            // <Buildable>
            XPathNavigator navigatorBuildable = navigator.SelectSingleNode("Buildable");

            if (navigatorBuildable != null)
            {
                this._buildable = navigatorBuildable.ValueAsBoolean;
            }

            // <SupportsTurns>
            XPathNavigator navigatorSupportsTurns = navigator.SelectSingleNode("SupportsTurns");

            if (navigatorSupportsTurns != null)
            {
                this._supportsTurns = navigatorSupportsTurns.ValueAsBoolean;
            }

            // <NetworkDirections>
            XPathNavigator navigatorNetworkDirections = navigator.SelectSingleNode("NetworkDirections");

            if (navigatorNetworkDirections != null)
            {
                this._networkDirections = new NetworkDirections(navigatorNetworkDirections);
            }
            else
            {
                this._networkDirections = new NetworkDirections();
            }

            // <Properties><PropertyArray><PropertySetProperty>
            this._properties = new List <Property>();
            XPathNodeIterator interatorProperty = navigator.Select("Properties/PropertyArray/PropertySetProperty");

            while (interatorProperty.MoveNext())
            {
                // Get <Property>
                XPathNavigator navigatorProperty = interatorProperty.Current;

                // Add Property
                Property property = new Property(navigatorProperty);
                this._properties.Add(property);
            }

            // <UserData><PropertyArray><PropertySetProperty>
            this._userData = new List <Property>();
            XPathNodeIterator interatorProperty2 = navigator.Select("UserData/PropertyArray/PropertySetProperty");

            while (interatorProperty2.MoveNext())
            {
                // Get <Property>
                XPathNavigator navigatorProperty = interatorProperty2.Current;

                // Add Property
                Property property = new Property(navigatorProperty);
                this._userData.Add(property);
            }

            // <EdgeFeatureSources><EdgeFeatureSource>
            // <JunctionFeatureSources><JunctionFeatureSource>
            // <SystemJunctionSources><SystemJunctionSource>
            // <TurnFeatureSources><TurnFeatureSource>
            this._networkSources = new List <NetworkSource>();
            XPathNodeIterator interatorNetworkSource = navigator.Select(
                "EdgeFeatureSources/EdgeFeatureSource" + " | " +
                "JunctionFeatureSources/JunctionFeatureSource" + " | " +
                "SystemJunctionSources/SystemJunctionSource" + " | " +
                "TurnFeatureSources/TurnFeatureSource");

            while (interatorNetworkSource.MoveNext())
            {
                //
                XPathNavigator navigatorNetworkSource = interatorNetworkSource.Current;

                NetworkSource networkSource = null;
                switch (navigatorNetworkSource.Name)
                {
                case "EdgeFeatureSource":
                    networkSource = new EdgeFeatureSource(navigatorNetworkSource);
                    break;

                case "JunctionFeatureSource":
                    networkSource = new JunctionFeatureSource(navigatorNetworkSource);
                    break;

                case "SystemJunctionSource":
                    networkSource = new SystemJunctionSource(navigatorNetworkSource);
                    break;

                case "TurnFeatureSource":
                    networkSource = new TurnFeatureSource(navigatorNetworkSource);
                    break;
                }
                // Add EdgeFeatureSource
                if (networkSource != null)
                {
                    this._networkSources.Add(networkSource);
                }
            }

            // <EvaluatedNetworkAttributes><EvaluatedNetworkAttribute>
            // <NetworkAttributes><NetworkAttribute>
            this._networkAttributes = new List <NetworkAttribute>();
            XPathNodeIterator interatorNetworkAttribute = navigator.Select(
                "EvaluatedNetworkAttributes/EvaluatedNetworkAttribute" + " | " +
                "NetworkAttributes/NetworkAttribute");

            while (interatorNetworkAttribute.MoveNext())
            {
                //
                XPathNavigator navigatorNetworkAttribute = interatorNetworkAttribute.Current;

                NetworkAttribute networkAttribute = null;
                switch (navigatorNetworkAttribute.Name)
                {
                case "EvaluatedNetworkAttribute":
                    networkAttribute = new EvaluatedNetworkAttribute(navigatorNetworkAttribute);
                    break;

                case "NetworkAttribute":
                    networkAttribute = new NetworkAttribute(navigatorNetworkAttribute);
                    break;
                }
                // Add EdgeFeatureSource
                if (networkAttribute != null)
                {
                    this._networkAttributes.Add(networkAttribute);
                }
            }

            // <NetworkAssignments><NetworkAssignment>
            this._networkAssignments = new List <NetworkAssignment>();
            XPathNodeIterator interatorNetworkAssignment = navigator.Select("NetworkAssignments/NetworkAssignment");

            while (interatorNetworkAssignment.MoveNext())
            {
                // Get <NetworkAssignment>
                XPathNavigator navigatorNetworkAssignment = interatorNetworkAssignment.Current;

                // Add NetworkAssignment
                NetworkAssignment networkAssignment = new NetworkAssignment(navigatorNetworkAssignment);
                this._networkAssignments.Add(networkAssignment);
            }

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

            if (navigatorConfigurationKeyword != null)
            {
                this._configurationKeyword = navigatorConfigurationKeyword.Value;
            }
        }
示例#4
0
        //
        // CONSTRUCTOR
        //
        public Network(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

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

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

            // <LogicalNetworkName>
            XPathNavigator navigatorLogicalNetworkName = navigator.SelectSingleNode("LogicalNetworkName");
            if (navigatorLogicalNetworkName != null) {
                this._logicalNetworkName = navigatorLogicalNetworkName.Value;
            }

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

            // <Buildable>
            XPathNavigator navigatorBuildable = navigator.SelectSingleNode("Buildable");
            if (navigatorBuildable != null) {
                this._buildable = navigatorBuildable.ValueAsBoolean;
            }

            // <SupportsTurns>
            XPathNavigator navigatorSupportsTurns = navigator.SelectSingleNode("SupportsTurns");
            if (navigatorSupportsTurns != null) {
                this._supportsTurns = navigatorSupportsTurns.ValueAsBoolean;
            }

            // <NetworkDirections>
            XPathNavigator navigatorNetworkDirections = navigator.SelectSingleNode("NetworkDirections");
            if (navigatorNetworkDirections != null) {
                this._networkDirections = new NetworkDirections(navigatorNetworkDirections);
            }
            else {
                this._networkDirections = new NetworkDirections();
            }

            // <Properties><PropertyArray><PropertySetProperty>
            this._properties = new List<Property>();
            XPathNodeIterator interatorProperty = navigator.Select("Properties/PropertyArray/PropertySetProperty");
            while (interatorProperty.MoveNext()) {
                // Get <Property>
                XPathNavigator navigatorProperty = interatorProperty.Current;

                // Add Property
                Property property = new Property(navigatorProperty);
                this._properties.Add(property);
            }

            // <UserData><PropertyArray><PropertySetProperty>
            this._userData = new List<Property>();
            XPathNodeIterator interatorProperty2 = navigator.Select("UserData/PropertyArray/PropertySetProperty");
            while (interatorProperty2.MoveNext()) {
                // Get <Property>
                XPathNavigator navigatorProperty = interatorProperty2.Current;

                // Add Property
                Property property = new Property(navigatorProperty);
                this._userData.Add(property);
            }

            // <EdgeFeatureSources><EdgeFeatureSource>
            // <JunctionFeatureSources><JunctionFeatureSource>
            // <SystemJunctionSources><SystemJunctionSource>
            // <TurnFeatureSources><TurnFeatureSource>
            this._networkSources = new List<NetworkSource>();
            XPathNodeIterator interatorNetworkSource = navigator.Select(
                "EdgeFeatureSources/EdgeFeatureSource" + " | " + 
                "JunctionFeatureSources/JunctionFeatureSource" + " | " + 
                "SystemJunctionSources/SystemJunctionSource" + " | " + 
                "TurnFeatureSources/TurnFeatureSource");
            while (interatorNetworkSource.MoveNext()) {
                // 
                XPathNavigator navigatorNetworkSource = interatorNetworkSource.Current;

                NetworkSource networkSource = null;
                switch (navigatorNetworkSource.Name) {
                    case "EdgeFeatureSource":
                        networkSource = new EdgeFeatureSource(navigatorNetworkSource);
                        break;
                    case "JunctionFeatureSource":
                        networkSource = new JunctionFeatureSource(navigatorNetworkSource);
                        break;
                    case "SystemJunctionSource":
                        networkSource = new SystemJunctionSource(navigatorNetworkSource);
                        break;
                    case "TurnFeatureSource":
                        networkSource = new TurnFeatureSource(navigatorNetworkSource);
                        break;
                }
                // Add EdgeFeatureSource
                if (networkSource != null) {
                    this._networkSources.Add(networkSource);
                }
            }

            // <EvaluatedNetworkAttributes><EvaluatedNetworkAttribute>
            // <NetworkAttributes><NetworkAttribute>
            this._networkAttributes = new List<NetworkAttribute>();
            XPathNodeIterator interatorNetworkAttribute = navigator.Select(
                "EvaluatedNetworkAttributes/EvaluatedNetworkAttribute" + " | " +
                "NetworkAttributes/NetworkAttribute");
            while (interatorNetworkAttribute.MoveNext()) {
                // 
                XPathNavigator navigatorNetworkAttribute = interatorNetworkAttribute.Current;

                NetworkAttribute networkAttribute = null;
                switch (navigatorNetworkAttribute.Name) {
                    case "EvaluatedNetworkAttribute":
                        networkAttribute = new EvaluatedNetworkAttribute(navigatorNetworkAttribute);
                        break;
                    case "NetworkAttribute":
                        networkAttribute = new NetworkAttribute(navigatorNetworkAttribute);
                        break;
                }
                // Add EdgeFeatureSource
                if (networkAttribute != null) {
                    this._networkAttributes.Add(networkAttribute);
                }
            }

            // <NetworkAssignments><NetworkAssignment>
            this._networkAssignments = new List<NetworkAssignment>();
            XPathNodeIterator interatorNetworkAssignment = navigator.Select("NetworkAssignments/NetworkAssignment");
            while (interatorNetworkAssignment.MoveNext()) {
                // Get <NetworkAssignment>
                XPathNavigator navigatorNetworkAssignment = interatorNetworkAssignment.Current;

                // Add NetworkAssignment
                NetworkAssignment networkAssignment = new NetworkAssignment(navigatorNetworkAssignment);
                this._networkAssignments.Add(networkAssignment);
            }

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