Esempio n. 1
0
        public static mapcontent createnewmapcontentofnolayer(string mapname, string server, string port, string username, string password, string database)
        {
            GeoDatabase  gdb       = PGGeoDatabase.GetGeoDatabase(server, port, username, password, database, new List <string>());
            List <Layer> layerlist = new List <Layer>();
            mapcontent   map       = new mapcontent(mapname, gdb, layerlist);

            return(map);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="gdb"></param>
        /// <param name="mapname"></param>
        /// <param name="stylepath">mapproject必须给相同数量的stylepath,如果没有value应该为null,key为layername</param>
        /// <returns></returns>
        public static mapcontent LoadMapContent(string mapname, Dictionary <string, string> datasourcepath, Dictionary <string, string> stylepath, string server, string port, string username, string password, string database)
        {
            List <Layer> layerlist = new List <Layer>();
            GeoDatabase  gdb       = PGGeoDatabase.GetGeoDatabase(server, port, username, password, database, datasourcepath.Values.ToList());

            //Dictionary<String, FeatureSource> dic = gdb.featureSources;
            foreach (string layername in datasourcepath.Keys)
            {
                //获取featuresoucre
                FeatureSource featuresource = null;
                if (!gdb.featureSources.TryGetValue(datasourcepath[layername], out featuresource))
                {
                    continue;
                }

                Layer layer = Layer.LoadLayer(featuresource, layername, stylepath[layername]);
                layerlist.Add(layer);
            }
            mapcontent map = new mapcontent(mapname, gdb, layerlist);

            return(map);
        }