示例#1
0
        /// <summary>
        /// 将XmlNode转换成Feature集合
        /// </summary>
        /// <param name="nodeGF"></param>
        /// <returns></returns>
        private static List <GeoFeature> ConvertToFeatureByNode(XmlNode nodeGF)
        {
            List <GeoFeature> ftList = new List <GeoFeature>();
            //对象
            GeoFeature ft = new GeoFeature();

            ft.BOID = null;
            ft.BOT  = null;
            ft.NAME = xmlHelp.GetXmlNodeByXpath(nodeGF, "x:Title").InnerText;
            ft.FT   = nodeGF.Attributes["type"].Value;

            //对象别名
            List <AliasName> aliasNameList = new List <AliasName>();

            foreach (XmlNode nodeAlisaName in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:Name"))
            {
                if (nodeAlisaName.Attributes["codeSpace"] == null)
                {
                    continue;
                }
                AliasName aliasNameM = new AliasName();
                aliasNameM.BOID      = ft.BOID;
                aliasNameM.NAME      = nodeAlisaName.InnerText;
                aliasNameM.APPDOMAIN = nodeAlisaName.Attributes["codeSpace"].Value;
                aliasNameList.Add(aliasNameM);
            }
            ft.AliasNameList = aliasNameList;

            //对象参数
            List <Property> propertyList = new List <Property>();

            foreach (XmlNode nodePropertySet in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:PropertySets/x:PropertySet"))
            {
                if (nodePropertySet.ChildNodes.Count > 0)
                {
                    if (nodePropertySet.Attributes["name"] == null)
                    {
                        continue;
                    }
                    Property propertyM = new Property();
                    propertyM.BOID = ft.BOID;
                    propertyM.NS   = nodePropertySet.Attributes["name"].Value;
                    propertyM.MD   = XMLHelper.RemoveAllNamespaces(nodePropertySet.OuterXml);
                    propertyList.Add(propertyM);
                }
            }
            ft.PropertyList = propertyList;

            //对象坐标
            List <Geometry> geometryList = new List <Geometry>();

            foreach (XmlNode nodeShape in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:Shapes/x:Shape"))
            {
                Geometry geometryM = new Geometry();
                geometryM.BOID     = ft.BOID;
                geometryM.NAME     = nodeShape.Attributes["name"] != null ? nodeShape.Attributes["name"].Value : null;
                geometryM.GEOMETRY = DbGeography.FromGml(nodeShape.InnerXml).AsText();
                geometryList.Add(geometryM);
            }
            ft.GeometryList = geometryList;
            ftList.Add(ft);

            //子对象
            foreach (XmlNode node in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:SubFeatures/x:GF"))
            {
                ConvertToFeatureByNode(node).ForEach(e => ftList.Add(e));
            }
            return(ftList);
        }
示例#2
0
        /// <summary>
        /// 将XmlNode转换成Feature集合
        /// </summary>
        /// <param name="nodeGF"></param>
        /// <returns></returns>
        private static List <GeoFeature> ConvertToFeatureByNode(XmlNode nodeGF)
        {
            List <GeoFeature> ftList = new List <GeoFeature>();
            //对象
            GeoFeature ft = new GeoFeature();

            ft.BOID = null;
            ft.BOT  = null;
            ft.NAME = xmlHelp.GetXmlNodeByXpath(nodeGF, "x:Title").InnerText;
            ft.FT   = nodeGF.Attributes["type"].Value;

            //对象别名
            List <AliasName> aliasNameList = new List <AliasName>();

            foreach (XmlNode nodeAlisaName in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:Name"))
            {
                if (nodeAlisaName.Attributes["codeSpace"] == null)
                {
                    continue;
                }
                AliasName aliasNameM = new AliasName();
                aliasNameM.BOID      = ft.BOID;
                aliasNameM.NAME      = nodeAlisaName.InnerText;
                aliasNameM.APPDOMAIN = nodeAlisaName.Attributes["codeSpace"].Value;
                aliasNameList.Add(aliasNameM);
            }
            ft.AliasNameList = aliasNameList;

            //对象参数
            List <Property> propertyList = new List <Property>();

            foreach (XmlNode nodePropertySet in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:PropertySets/x:PropertySet"))
            {
                if (nodePropertySet.ChildNodes.Count > 0)
                {
                    if (nodePropertySet.Attributes["name"] == null)
                    {
                        continue;
                    }
                    Property propertyM = new Property();
                    propertyM.BOID = ft.BOID;
                    propertyM.NS   = nodePropertySet.Attributes["name"].Value;
                    propertyM.MD   = nodePropertySet.OuterXml;
                    propertyList.Add(propertyM);
                }
                else if (!string.IsNullOrEmpty(nodeGF.Attributes["class"].Value) && ft.FT == "井位")
                {
                    Property propertyM = new Property();
                    propertyM.BOID     = ft.BOID;
                    propertyM.NS       = "基础参数";
                    propertyM.MD       = " <PropertySet name=\"基础数据\" codeSpace=\"http://www.Petrochina.com/IS/PCEDM\" xmlns=\"http://www.jurassic.com.cn/3gx\"><P n=\"井别\" t=\"String\" r=\"eq\">" + nodeGF.Attributes["class"].Value + "</P></PropertySet>";
                    propertyM.MdSource = "3GX数据";
                    if (!propertyList.Exists(p => p.MD == propertyM.MD))
                    {
                        propertyList.Add(propertyM);
                    }
                }
            }
            ft.PropertyList = propertyList;

            //对象坐标
            List <Geometry> geometryList = new List <Geometry>();

            foreach (XmlNode nodeShape in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:Shapes/x:Shape"))
            {
                Geometry geometryM = new Geometry();
                geometryM.BOID     = ft.BOID;
                geometryM.NAME     = nodeShape.Attributes["name"] != null ? nodeShape.Attributes["name"].Value : null;
                geometryM.GEOMETRY = DbGeography.FromGml(nodeShape.InnerXml).AsText();
                geometryList.Add(geometryM);
            }
            ft.GeometryList = geometryList;
            ftList.Add(ft);

            //子对象
            foreach (XmlNode node in xmlHelp.GetXmlNodeListByXpath(nodeGF, "x:SubFeatures/x:GF"))
            {
                ConvertToFeatureByNode(node).ForEach(e => ftList.Add(e));
            }
            return(ftList);
        }