/// <summary>
        /// 
        /// </summary>
        private void AddFeatrueTypeAndLayer(string storepath,string Filename,Store store)
        {
            string[] filenames = Filename.Split('\\');
            string tempFileName = filenames[filenames.Length-1].Substring(0,filenames[filenames.Length-1].LastIndexOf('.'));
            if (!Directory.Exists(storepath + "\\" + tempFileName))
            {
                Directory.CreateDirectory(storepath + "\\" + tempFileName);
            }
            File.Copy(Application.StartupPath + "\\XmlTemplet\\Layer\\featuretype.xml", storepath + "\\" + tempFileName + "\\featuretype.xml");
               FeatureType feature = new FeatureType();
               feature.ID = "FeatureTypeInfoImpl--" + Guid.NewGuid().ToString();
               string[] tempfiles = txt_shapepath.Text.Split('\\');
               feature.Name = tempfiles[tempfiles.Length-1].Substring(0,tempfiles[tempfiles.Length-1].LastIndexOf('.'));
               feature.NativeName = feature.Name;
               feature.NamespaceID = SysParam.WordsSpaceSelected.ID.Replace("WorkspaceInfoImpl", "NamespaceInfoImpl");
               feature.Title = feature.Name;
               feature.Srs = "EPSG:4326";
               feature.NativeBoundingBox_MinX = SysParam.MinX;
               feature.NativeBoundingBox_MinY = SysParam.MinY;
               feature.NativeBoundingBox_MaxX = SysParam.MaxX;
               feature.NativeBoundingBox_MaxY = SysParam.MaxY;

               feature.LatLonBoundingBox_MinX = SysParam.MinX;
               feature.LatLonBoundingBox_MinY = SysParam.MinY;
               feature.LatLonBoundingBox_MaxX = SysParam.MaxX;
               feature.LatLonBoundingBox_MaxY = SysParam.MaxY;

               feature.ProjectionPolicy = "FORCE_DECLARED";
               feature.IsEnabled = "true";
               feature.StoreID = store.ID;
               feature.maxFeatures = "0";
               feature.numDecimals = "0";
               feature.overridingServiceSRS = "false";
               feature.circularArcPresent = "false";

               feature.SetAttribut(SysParam.WordsSpaceSelected, store, feature, storepath + "\\" + tempFileName + "\\featuretype.xml");

               File.Copy(Application.StartupPath + "\\XmlTemplet\\Layer\\layer.xml", storepath + "\\" + tempFileName + "\\layer.xml");

               layer _layer = new layer();
               _layer.Name = feature.Name;
               _layer.ID = "LayerInfoImpl--" + Guid.NewGuid().ToString();
               _layer.Type = "VECTOR";
               _layer.DefaultStyle_ID = "StyleInfoImpl--570ae188:124761b8d78:-7fe3";
               _layer.resource_ID = feature.ID;
               _layer.Attribution_LogoWidth = "0";
               _layer.Attribution_LogoHeight = "0";
               _layer.SetAttribut(feature, storepath + "\\" + tempFileName + "\\layer.xml");
        }
Exemple #2
0
        public void SetAttribut(FeatureType featuretype, string xmlpath)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlpath); //加载XML文档
            XmlNode Node = xmlDoc.SelectSingleNode("layer");
            XMLHelper.SetAttributeValue(Node, "id", this.ID);
            XMLHelper.SetAttributeValue(Node, "name", this.Name);
            XMLHelper.SetAttributeValue(Node, "type", this.Type);
            XMLHelper.SetAttributeValue(Node, "defaultStyle","id", this.DefaultStyle_ID);
            XMLHelper.SetAttributeValue(Node, "resource", "id", featuretype.ID);

            XMLHelper.SetAttributeValue(Node, "attribution", "logoWidth", this.Attribution_LogoWidth);
            XMLHelper.SetAttributeValue(Node, "attribution", "logoWidth", this.Attribution_LogoHeight);

            xmlDoc.Save(xmlpath);
        }
        public void SetAttribut(Workspace wp, Store store, FeatureType featuretype, string xmlpath)
        {
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlpath); //加载XML文档
            XmlNode Node = xmlDoc.SelectSingleNode("featureType");
            XMLHelper.SetAttributeValue(Node, "id", featuretype.ID);
            XMLHelper.SetAttributeValue(Node, "name", featuretype.Name);
            XMLHelper.SetAttributeValue(Node, "nativeName", featuretype.NativeName);
            XMLHelper.SetAttributeValue(Node, "namespace","id", featuretype.NamespaceID);
            XMLHelper.SetAttributeValue(Node, "title", featuretype.Title);
            XMLHelper.SetAttributeValue(Node, "srs", featuretype.Srs);

            XMLHelper.SetAttributeValue(Node, "nativeBoundingBox","minx", featuretype.NativeBoundingBox_MinX);
            XMLHelper.SetAttributeValue(Node, "nativeBoundingBox", "miny", featuretype.NativeBoundingBox_MinY);
            XMLHelper.SetAttributeValue(Node, "nativeBoundingBox", "maxx", featuretype.NativeBoundingBox_MaxX);
            XMLHelper.SetAttributeValue(Node, "nativeBoundingBox", "maxy", featuretype.NativeBoundingBox_MaxY);

            XMLHelper.SetAttributeValue(Node, "latLonBoundingBox", "minx", featuretype.LatLonBoundingBox_MinX);
            XMLHelper.SetAttributeValue(Node, "latLonBoundingBox", "miny", featuretype.LatLonBoundingBox_MinY);
            XMLHelper.SetAttributeValue(Node, "latLonBoundingBox", "maxx", featuretype.LatLonBoundingBox_MaxX);
            XMLHelper.SetAttributeValue(Node, "latLonBoundingBox", "maxy", featuretype.LatLonBoundingBox_MaxY);
            XMLHelper.SetAttributeValue(Node, "latLonBoundingBox", "crs", featuretype.LatLonBoundingBox_Crs);

            XMLHelper.SetAttributeValue(Node, "projectionPolicy",  featuretype.ProjectionPolicy);
            XMLHelper.SetAttributeValue(Node, "enabled", featuretype.IsEnabled);

            XMLHelper.SetAttributeValue(Node, "store","id", store.ID);

            XMLHelper.SetAttributeValue(Node, "maxFeatures", featuretype.maxFeatures);
            XMLHelper.SetAttributeValue(Node, "numDecimals", featuretype.numDecimals);
            XMLHelper.SetAttributeValue(Node, "overridingServiceSRS", featuretype.overridingServiceSRS);
            XMLHelper.SetAttributeValue(Node, "circularArcPresent", featuretype.circularArcPresent);

            xmlDoc.Save(xmlpath);
        }