Beispiel #1
0
        public EdgeConnectivityRule(IXPathNavigable path) : base(path)
        {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <FromClassID></FromClassID>
            XPathNavigator navigatorFromClassID = navigator.SelectSingleNode("FromClassID");

            if (navigatorFromClassID != null)
            {
                this._fromClassID = navigatorFromClassID.ValueAsInt;
            }

            // <FromEdgeSubtypeCode></FromEdgeSubtypeCode>
            XPathNavigator navigatorFromEdgeSubtypeCode = navigator.SelectSingleNode("FromEdgeSubtypeCode");

            if (navigatorFromEdgeSubtypeCode != null)
            {
                this._fromEdgeSubtypeCode = navigatorFromEdgeSubtypeCode.ValueAsInt;
            }

            // <ToClassID></ToClassID>
            XPathNavigator navigatorToClassID = navigator.SelectSingleNode("ToClassID");

            if (navigatorToClassID != null)
            {
                this._toClassID = navigatorToClassID.ValueAsInt;
            }

            // <ToEdgeSubtypeCode></ToEdgeSubtypeCode>
            XPathNavigator navigatorToEdgeSubtypeCode = navigator.SelectSingleNode("ToEdgeSubtypeCode");

            if (navigatorToEdgeSubtypeCode != null)
            {
                this._toEdgeSubtypeCode = navigatorToEdgeSubtypeCode.ValueAsInt;
            }

            // <DefaultJunctionID></DefaultJunctionID>
            XPathNavigator navigatorDefaultJunctionID = navigator.SelectSingleNode("DefaultJunctionID");

            if (navigatorDefaultJunctionID != null)
            {
                this._defaultJunctionID = navigatorDefaultJunctionID.ValueAsInt;
            }

            // <DefaultJunctionSubtypeCode></DefaultJunctionSubtypeCode>
            XPathNavigator navigatorDefaultJunctionSubtypeCode = navigator.SelectSingleNode("DefaultJunctionSubtypeCode");

            if (navigatorDefaultJunctionSubtypeCode != null)
            {
                this._defaultJunctionSubtypeCode = navigatorDefaultJunctionSubtypeCode.ValueAsInt;
            }

            // <JunctionSubtypes xsi:type="esri:ArrayOfJunctionSubtype">
            //    <JunctionSubtype xsi:type="esri:JunctionSubtype">
            //       <ClassID></ClassID>
            //       <SubtypeCode></SubtypeCode>
            //    </JunctionSubtype>
            // </JunctionSubtypes>

            //
            this._junctionSubtypes = new List <JunctionSubtype>();

            XPathNodeIterator interatorJunctionSubtype = navigator.Select("JunctionSubtypes/JunctionSubtype");

            while (interatorJunctionSubtype.MoveNext())
            {
                // Get <JunctionSubtype>
                XPathNavigator navigatorJunctionSubtype = interatorJunctionSubtype.Current;

                // Create JunctionSubtype
                JunctionSubtype junctionSubtype = new JunctionSubtype(navigatorJunctionSubtype);

                // Add Rule to Collection
                this._junctionSubtypes.Add(junctionSubtype);
            }
        }
 public JunctionSubtype(JunctionSubtype prototype) : base(prototype) {
     this._classID = prototype.ClassID;
     this._subtypeCode = prototype.SubtypeCode;
 }
 public JunctionSubtype(JunctionSubtype prototype) : base(prototype)
 {
     this._classID     = prototype.ClassID;
     this._subtypeCode = prototype.SubtypeCode;
 }
        private ObjectClass GetObjectClass(ITypeDescriptorContext context)
        {
            DiagrammerEnvironment de          = DiagrammerEnvironment.Default;
            SchemaModel           model       = de.SchemaModel;
            ObjectClass           objectClass = null;

            if (context.PropertyDescriptor.ComponentType == typeof(EdgeConnectivityRule))
            {
                EdgeConnectivityRule edgeConnectivityRule = (EdgeConnectivityRule)context.Instance;
                switch (context.PropertyDescriptor.Name)
                {
                case "FromEdgeSubtypeCode":
                    objectClass = model.FindObjectClass(edgeConnectivityRule.FromClassID);
                    break;

                case "ToEdgeSubtypeCode":
                    objectClass = model.FindObjectClass(edgeConnectivityRule.ToClassID);
                    break;

                case "DefaultJunctionSubtypeCode":
                    objectClass = model.FindObjectClass(edgeConnectivityRule.DefaultJunctionID);
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(JunctionSubtype))
            {
                JunctionSubtype junctionSubtype = (JunctionSubtype)context.Instance;
                switch (context.PropertyDescriptor.Name)
                {
                case "SubtypeCode":
                    objectClass = model.FindObjectClass(junctionSubtype.ClassID);
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(RelationshipRule))
            {
                RelationshipRule relationshipRule = (RelationshipRule)context.Instance;
                switch (context.PropertyDescriptor.Name)
                {
                case "OriginSubtype":
                    objectClass = model.FindObjectClass(relationshipRule.OriginClass);
                    break;

                case "DestinationSubtype":
                    objectClass = model.FindObjectClass(relationshipRule.DestinationClass);
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(JunctionConnectivityRule))
            {
                JunctionConnectivityRule junctionConnectivityRule = (JunctionConnectivityRule)context.Instance;
                switch (context.PropertyDescriptor.Name)
                {
                case "EdgeSubtypeCode":
                    objectClass = model.FindObjectClass(junctionConnectivityRule.EdgeClassID);
                    break;

                case "SubtypeCode":
                    objectClass = model.FindObjectClass(junctionConnectivityRule.JunctionClassID);
                    break;
                }
            }
            else if (context.PropertyDescriptor.ComponentType == typeof(TopologyRule))
            {
                TopologyRule topologyRule = (TopologyRule)context.Instance;
                switch (context.PropertyDescriptor.Name)
                {
                case "OriginSubtype":
                    objectClass = model.FindObjectClass(topologyRule.OriginClassId);
                    break;

                case "DestinationSubtype":
                    objectClass = model.FindObjectClass(topologyRule.DestinationClassId);
                    break;
                }
            }
            return(objectClass);
        }
        public EdgeConnectivityRule(IXPathNavigable path) : base(path) {
            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <FromClassID></FromClassID>
            XPathNavigator navigatorFromClassID = navigator.SelectSingleNode("FromClassID");
            if (navigatorFromClassID != null) {
                this._fromClassID = navigatorFromClassID.ValueAsInt;
            }

            // <FromEdgeSubtypeCode></FromEdgeSubtypeCode> 
            XPathNavigator navigatorFromEdgeSubtypeCode = navigator.SelectSingleNode("FromEdgeSubtypeCode");
            if (navigatorFromEdgeSubtypeCode != null) {
                this._fromEdgeSubtypeCode = navigatorFromEdgeSubtypeCode.ValueAsInt;
            }

            // <ToClassID></ToClassID> 
            XPathNavigator navigatorToClassID = navigator.SelectSingleNode("ToClassID");
            if (navigatorToClassID != null) {
                this._toClassID = navigatorToClassID.ValueAsInt;
            }

            // <ToEdgeSubtypeCode></ToEdgeSubtypeCode> 
            XPathNavigator navigatorToEdgeSubtypeCode = navigator.SelectSingleNode("ToEdgeSubtypeCode");
            if (navigatorToEdgeSubtypeCode != null) {
                this._toEdgeSubtypeCode = navigatorToEdgeSubtypeCode.ValueAsInt;
            }

            // <DefaultJunctionID></DefaultJunctionID> 
            XPathNavigator navigatorDefaultJunctionID = navigator.SelectSingleNode("DefaultJunctionID");
            if (navigatorDefaultJunctionID != null) {
                this._defaultJunctionID = navigatorDefaultJunctionID.ValueAsInt;
            }

            // <DefaultJunctionSubtypeCode></DefaultJunctionSubtypeCode> 
            XPathNavigator navigatorDefaultJunctionSubtypeCode = navigator.SelectSingleNode("DefaultJunctionSubtypeCode");
            if (navigatorDefaultJunctionSubtypeCode != null) {
                this._defaultJunctionSubtypeCode = navigatorDefaultJunctionSubtypeCode.ValueAsInt;
            }

            // <JunctionSubtypes xsi:type="esri:ArrayOfJunctionSubtype">
            //    <JunctionSubtype xsi:type="esri:JunctionSubtype">
            //       <ClassID></ClassID> 
            //       <SubtypeCode></SubtypeCode> 
            //    </JunctionSubtype>
            // </JunctionSubtypes>

            //
            this._junctionSubtypes = new List<JunctionSubtype>();

            XPathNodeIterator interatorJunctionSubtype = navigator.Select("JunctionSubtypes/JunctionSubtype");
            while (interatorJunctionSubtype.MoveNext()) {
                // Get <JunctionSubtype>
                XPathNavigator navigatorJunctionSubtype = interatorJunctionSubtype.Current;

                // Create JunctionSubtype
                JunctionSubtype junctionSubtype = new JunctionSubtype(navigatorJunctionSubtype);

                // Add Rule to Collection
                this._junctionSubtypes.Add(junctionSubtype);
            }
        }