Esempio n. 1
0
 public NetworkAttributeParameter(NetworkAttributeParameter prototype) : base(prototype)
 {
     this._name         = prototype.Name;
     this._varType      = prototype.VarType;
     this._value        = prototype.Value;
     this._defaultValue = prototype.DefaultValue;
 }
 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 NetworkAttributeParameter(NetworkAttributeParameter prototype) : base(prototype) {
     this._name = prototype.Name;
     this._varType = prototype.VarType;
     this._value = prototype.Value;
     this._defaultValue = prototype.DefaultValue;
 }
        //
        // CONSTRUCTOR
        //
        public NetworkAttribute(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <ID>
            XPathNavigator navigatorID = navigator.SelectSingleNode("ID");

            if (navigatorID != null)
            {
                this._id = navigatorID.ValueAsInt;
            }

            // <Name>
            XPathNavigator navigatorName = navigator.SelectSingleNode("Name");

            if (navigatorName != null)
            {
                this._name = navigatorName.Value;
            }

            // <Units>
            XPathNavigator navigatorUnits = navigator.SelectSingleNode("Units");

            if (navigatorUnits != null)
            {
                this._units = GeodatabaseUtility.GetNetworkAttributeUnits(navigatorUnits.Value);
            }

            // <DataType>
            XPathNavigator navigatorDataType = navigator.SelectSingleNode("DataType");

            if (navigatorDataType != null)
            {
                this._dataType = (esriNetworkAttributeDataType)Enum.Parse(typeof(esriNetworkAttributeDataType), navigatorDataType.Value, true);
            }

            // <UsageType>
            XPathNavigator navigatorUsageType = navigator.SelectSingleNode("UsageType");

            if (navigatorUsageType != null)
            {
                this._usageType = (esriNetworkAttributeUsageType)Enum.Parse(typeof(esriNetworkAttributeUsageType), navigatorUsageType.Value, true);
            }

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

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

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

            // <UseByDefault>
            XPathNavigator navigatorUseByDefault = navigator.SelectSingleNode("UseByDefault");

            if (navigatorUseByDefault != null)
            {
                this._useByDefault = navigatorUseByDefault.ValueAsBoolean;
            }

            // <AttributedParameters><AttributedParameter>
            this._attributeParameters = new List <NetworkAttributeParameter>();
            XPathNodeIterator interatorAttributedParameter = navigator.Select("AttributedParameters/AttributedParameter");

            while (interatorAttributedParameter.MoveNext())
            {
                // Get <AttributedParameter>
                XPathNavigator navigatorAttributedParameter = interatorAttributedParameter.Current;

                // Add AttributedParameter
                NetworkAttributeParameter networkAttributeParameter = new NetworkAttributeParameter(navigatorAttributedParameter);
                this._attributeParameters.Add(networkAttributeParameter);
            }
        }
        //
        // CONSTRUCTOR
        //
        public NetworkAttribute(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <ID>
            XPathNavigator navigatorID = navigator.SelectSingleNode("ID");
            if (navigatorID != null) {
                this._id = navigatorID.ValueAsInt;
            }

            // <Name>
            XPathNavigator navigatorName = navigator.SelectSingleNode("Name");
            if (navigatorName != null) {
                this._name = navigatorName.Value;
            }

            // <Units>
            XPathNavigator navigatorUnits = navigator.SelectSingleNode("Units");
            if (navigatorUnits != null) {
                this._units = GeodatabaseUtility.GetNetworkAttributeUnits(navigatorUnits.Value);
            }

            // <DataType>
            XPathNavigator navigatorDataType = navigator.SelectSingleNode("DataType");
            if (navigatorDataType != null) {
                this._dataType = (esriNetworkAttributeDataType)Enum.Parse(typeof(esriNetworkAttributeDataType), navigatorDataType.Value, true);
            }

            // <UsageType>
            XPathNavigator navigatorUsageType = navigator.SelectSingleNode("UsageType");
            if (navigatorUsageType != null) {
                this._usageType = (esriNetworkAttributeUsageType)Enum.Parse(typeof(esriNetworkAttributeUsageType), navigatorUsageType.Value, true);
            }

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

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

            // <UseByDefault>
            XPathNavigator navigatorUseByDefault = navigator.SelectSingleNode("UseByDefault");
            if (navigatorUseByDefault != null) {
                this._useByDefault = navigatorUseByDefault.ValueAsBoolean;
            }

            // <AttributedParameters><AttributedParameter>
            this._attributeParameters = new List<NetworkAttributeParameter>();
            XPathNodeIterator interatorAttributedParameter = navigator.Select("AttributedParameters/AttributedParameter");
            while (interatorAttributedParameter.MoveNext()) {
                // Get <AttributedParameter>
                XPathNavigator navigatorAttributedParameter = interatorAttributedParameter.Current;

                // Add AttributedParameter
                NetworkAttributeParameter networkAttributeParameter = new NetworkAttributeParameter(navigatorAttributedParameter);
                this._attributeParameters.Add(networkAttributeParameter);
            }
        }