예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="dataSourcePath"></param>
        /// <param name="port"></param>
        /// <param name="strType">DataSourceType enum + custom online maps</param>
        /// <param name="disableClientCache"></param>
        /// <param name="displayNodataTile"></param>
        /// <param name="tilingSchemePath">Set this parameter only when type is ArcGISDynamicMapService||RasterDataset and do not use Google Maps's tiling scheme</param>
        public GISServiceEntity(string serviceName, string dataSourcePath, int port, string strType, bool allowmemcache, bool disableClientCache, bool displayNodataTile, VisualStyle style, string tilingSchemePath)
        {
            ServiceName = serviceName;
            if (!DataSourceBase.IsOnlineMaps(strType))
            {
                DataSourceTypePredefined type = (DataSourceTypePredefined)Enum.Parse(typeof(DataSourceTypePredefined), strType);
                switch (type)
                {
                case DataSourceTypePredefined.MobileAtlasCreator:
                    DataSource = new DataSourceMAC(dataSourcePath);
                    break;

                case DataSourceTypePredefined.MBTiles:
                    DataSource = new DataSourceMBTiles(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISCache:
                    DataSource = new DataSourceArcGISCache(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISTilePackage:
                    DataSource = new DataSourceArcGISTilePackage(dataSourcePath);
                    break;

                case DataSourceTypePredefined.RasterImage:
                    DataSource = new DataSourceRasterImage(dataSourcePath, tilingSchemePath, ServiceName);
                    break;

                case DataSourceTypePredefined.ArcGISDynamicMapService:
                    DataSource = new DataSourceArcGISDynamicMapService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.ArcGISTiledMapService:
                    DataSource = new DataSourceArcGISTiledMapService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.ArcGISImageService:
                    DataSource = new DataSourceArcGISImageService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.AutoNaviCache:
                    DataSource = new DataSourceAutoNaviCache(dataSourcePath);
                    break;

                case DataSourceTypePredefined.OGCWMSService:
                    DataSource = new DataSourceWMSService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.TianDiTuAnnotation:
                    DataSource = new DataSourceTianDiTuAnno();
                    break;

                case DataSourceTypePredefined.TianDiTuMap:
                    DataSource = new DataSourceTianDiTuMap();
                    break;

                default:
                    throw new Exception();
                }
                DataSource.IsOnlineMap = false;
            }
            else
            {
                bool known = false;
                foreach (var map in DataSourceCustomOnlineMaps.CustomOnlineMaps)
                {
                    if (map.Name == strType)
                    {
                        known = true;
                        break;
                    }
                }
                if (!known)
                {
                    throw new Exception("GIS类型【" + strType + "】不是已知的数据类型");
                }

                DataSource = new DataSourceCustomOnlineMaps(strType)
                {
                    IsOnlineMap = true
                };
            }


            Port               = port;
            AllowMemCache      = allowmemcache;
            DisableClientCache = disableClientCache;
            DisplayNoDataTile  = displayNodataTile;
            Style              = style;
            TitleLog           = new TileLogEntity();
            if (string.IsNullOrEmpty(sara.gisserver.console.gis.Global.IPAddress))
            {
                throw new Exception("创建GIS服务时IP地址不能为空!");
            }

            UrlArcGIS = "http://" + sara.gisserver.console.gis.Global.IPAddress + ":" + port.ToString() + "/" + sara.gisserver.console.gis.Global.ServerName + "/rest/services/" + ServiceName + "/MapServer";
        }
예제 #2
0
        //public List<??> PendingTiles { get; set; }//arcgis silverlight api using this for only calculate progress
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="dataSourcePath"></param>
        /// <param name="port"></param>
        /// <param name="strType">DataSourceType enum + custom online maps</param>
        /// <param name="disableClientCache"></param>
        /// <param name="displayNodataTile"></param>
        /// <param name="tilingSchemePath">Set this parameter only when type is ArcGISDynamicMapService||RasterDataset and do not use Google Maps's tiling scheme</param>
        public PBSService(string serviceName, string dataSourcePath, int port, string strType, bool allowmemcache, bool disableClientCache, bool displayNodataTile, VisualStyle style, string tilingSchemePath)
        {
            ServiceName = serviceName;
            if (!DataSourceBase.IsOnlineMaps(strType))
            {
                DataSourceTypePredefined type = (DataSourceTypePredefined)Enum.Parse(typeof(DataSourceTypePredefined), strType);
                switch (type)
                {
                case DataSourceTypePredefined.MobileAtlasCreator:
                    DataSource = new DataSourceMAC(dataSourcePath);
                    break;

                case DataSourceTypePredefined.MBTiles:
                    DataSource = new DataSourceMBTiles(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISCacheV2:
                    DataSource = new DataSourceArcGISCacheV2(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISCache:
                    DataSource = new DataSourceArcGISCache(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISTilePackage:
                    DataSource = new DataSourceArcGISTilePackage(dataSourcePath);
                    break;

                case DataSourceTypePredefined.RasterImage:
                    DataSource = new DataSourceRasterImage(dataSourcePath, tilingSchemePath, ServiceName);
                    break;

                case DataSourceTypePredefined.ArcGISDynamicMapService:
                    DataSource = new DataSourceArcGISDynamicMapService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.ArcGISTiledMapService:
                    DataSource = new DataSourceArcGISTiledMapService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.ArcGISImageService:
                    DataSource = new DataSourceArcGISImageService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.AutoNaviCache:
                    DataSource = new DataSourceAutoNaviCache(dataSourcePath);
                    break;

                case DataSourceTypePredefined.OGCWMSService:
                    DataSource = new DataSourceWMSService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.TianDiTuAnnotation:
                    DataSource = new DataSourceTianDiTuAnno();
                    break;

                case DataSourceTypePredefined.TianDiTuMap:
                    DataSource = new DataSourceTianDiTuMap();
                    break;

                default:
                    throw new Exception();
                }
                DataSource.IsOnlineMap = false;
            }
            else
            {
                bool known = false;
                foreach (var map in DataSourceCustomOnlineMaps.CustomOnlineMaps)
                {
                    if (map.Name == strType)
                    {
                        known = true;
                        break;
                    }
                }
                if (!known)
                {
                    throw new Exception(strType + " is not a known data source type.");
                }
                DataSource = new DataSourceCustomOnlineMaps(strType)
                {
                    IsOnlineMap = true
                };
            }


            Port               = port;
            AllowMemCache      = allowmemcache;
            DisableClientCache = disableClientCache;
            DisplayNoDataTile  = displayNodataTile;
            Style              = style;
            LogInfo            = new Log();
            if (string.IsNullOrEmpty(ServiceManager.IPAddress))
            {
                throw new Exception("IPAddress is null or empty when creating PBS service!");
            }
            UrlArcGIS = "http://" + ServiceManager.IPAddress + ":" + Port + "/PBS/rest/services/" + ServiceName + "/MapServer";
        }
예제 #3
0
파일: PBSService.cs 프로젝트: mingkof/pbs
        //public List<??> PendingTiles { get; set; }//arcgis silverlight api using this for only calculate progress
        /// <summary>
        ///
        /// </summary>
        /// <param name="serviceName"></param>
        /// <param name="dataSourcePath"></param>
        /// <param name="port"></param>
        /// <param name="strType">DataSourceType enum + custom online maps</param>
        /// <param name="disableClientCache"></param>
        /// <param name="displayNodataTile"></param>
        /// <param name="tilingSchemePath">Set this parameter only when type is ArcGISDynamicMapService||RasterDataset and do not use Google Maps's tiling scheme</param>
        public PBSService(string serviceName, string dataSourcePath, int port, string strType, string strSubType, bool allowmemcache, bool disableClientCache, bool displayNodataTile, VisualStyle style, string tilingSchemePath)
        {
            ServiceName = serviceName;
            string prefixName = "KGIS";

            if (!DataSourceBase.IsOnlineMaps(strType))
            {
                DataSourceTypePredefined type = (DataSourceTypePredefined)Enum.Parse(typeof(DataSourceTypePredefined), strType);
                switch (type)
                {
                case DataSourceTypePredefined.MobileAtlasCreator:
                    DataSource = new DataSourceMAC(dataSourcePath);
                    break;

                case DataSourceTypePredefined.BaiduMBTiles:
                    DataSource = new DataSourceBaiDuMBTiles(dataSourcePath);
                    break;

                case DataSourceTypePredefined.GoogleMBTiles:
                    DataSource = new DataSourceGoogleMBTiles(dataSourcePath);
                    break;

                case DataSourceTypePredefined.OtherMap:
                    if (String.IsNullOrEmpty(strSubType))
                    {
                        DataSource = new DataSourceOtherMap(dataSourcePath, false)
                        {
                            Path = dataSourcePath
                        };
                    }
                    else if (String.Equals("PGISRoad", strSubType))
                    {
                        DataSource = new DataSourceOtherMapProxy("PGISRoad")
                        {
                            Type    = strType,
                            subType = strSubType
                        };
                    }
                    else if (String.Equals("PGISRoadMark", strSubType))
                    {
                        DataSource = new DataSourceOtherMapProxy("PGISRoadMark")
                        {
                            Type    = strType,
                            subType = strSubType
                        };
                    }
                    else if (String.Equals("PGISImagery", strSubType))
                    {
                        DataSource = new DataSourceOtherMapProxy("PGISImagery")
                        {
                            Type    = strType,
                            subType = strSubType
                        };
                    }
                    else if (String.Equals("TaiZhou", strSubType))
                    {
                        DataSource = new DataSourceOtherMapProxy("TaiZhou")
                        {
                            Type    = strType,
                            subType = strSubType
                        };
                    }
                    else if (String.Equals("GanSu", strSubType))
                    {
                        DataSource = new DataSourceMultiMBTiles(strType, strSubType);
                    }
                    break;

                case DataSourceTypePredefined.MBTiles:
                    DataSource = new DataSourceMBTiles(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISCache:
                    DataSource = new DataSourceArcGISCache(dataSourcePath);
                    break;

                case DataSourceTypePredefined.ArcGISTilePackage:
                    DataSource = new DataSourceArcGISTilePackage(dataSourcePath);
                    break;

                case DataSourceTypePredefined.RasterImage:
                    DataSource = new DataSourceRasterImage(dataSourcePath, tilingSchemePath, ServiceName);
                    break;

                case DataSourceTypePredefined.ArcGISDynamicMapService:
                    DataSource = new DataSourceArcGISDynamicMapService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.ArcGISTiledMapService:
                    DataSource = new DataSourceArcGISTiledMapService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.ArcGISImageService:
                    DataSource = new DataSourceArcGISImageService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.AutoNaviCache:
                    DataSource = new DataSourceAutoNaviCache(dataSourcePath);
                    break;

                case DataSourceTypePredefined.OGCWMSService:
                    DataSource = new DataSourceWMSService(dataSourcePath, tilingSchemePath);
                    break;

                case DataSourceTypePredefined.TianDiTuAnnotation:
                    DataSource = new DataSourceTianDiTuAnno();
                    break;

                case DataSourceTypePredefined.TianDiTuMap:
                    DataSource = new DataSourceTianDiTuMap();
                    break;

                case DataSourceTypePredefined.BaiDuOnline:
                    if (BaiDuMapManager.inst.RunMode == "ONLINE")
                    {
                        DataSource = new DataSourceBaiDuTileProxy(strType);
                    }
                    else
                    {
                        DataSource = new DataSourceBaiDuMBTiles(null);
                    }
                    break;

                default:
                    throw new Exception();
                }
                DataSource.IsOnlineMap = false;
            }
            else
            {
                bool known = false;
                foreach (var map in DataSourceCustomOnlineMaps.CustomOnlineMaps)
                {
                    if (map.Name == strType)
                    {
                        known = true;
                        break;
                    }
                }
                foreach (var map in DataSourceBaiduOnlineMap.CustomOnlineMaps)
                {
                    if (map.Name == strType)
                    {
                        known = true;
                        break;
                    }
                }
                if (!known)
                {
                    throw new Exception(strType + " is not a known data source type.");
                }
                switch (strType)
                {
                //this options is a list of preview of baidu map download window, except BaiduPanoMark
                case "BaiduTrafficHis":
                case "BaiduBase":
                case "BaiduHot":
                case "BaiduSate":
                case "BaiduTraffic":
                case "BaiduPanoMark":
                    DataSource = new DataSourceBaiDuTileProxy("BaiDuOnline")
                    {
                        IsOnlineMap = true,
                        SubType     = strType
                    };
                    break;

                default:
                    DataSource = new DataSourceCustomOnlineMaps(strType)
                    {
                        IsOnlineMap = true
                    };
                    break;
                }
            }


            Port               = port;
            AllowMemCache      = allowmemcache;
            DisableClientCache = disableClientCache;
            DisplayNoDataTile  = displayNodataTile;
            Style              = style;
            LogInfo            = new Log();
            if (string.IsNullOrEmpty(ServiceManager.IPAddress))
            {
                throw new Exception("IPAddress is null or empty when creating PBS service!");
            }
            UrlArcGIS = "http://" + ServiceManager.IPAddress + ":" + Port + "/" + prefixName + "/rest/services/" + ServiceName + "/MapServer";
        }