コード例 #1
0
ファイル: WebMapClient.cs プロジェクト: CGX-GROUP/DotSpatial
        public Extent GetMaxExtent()
        {
            Extent extent = new Extent();
            Extent x      = new Extent();

            for (int i = 0; i < Servicies.Count(); i++)
            {
                if (Servicies.ElementAt(i).GetType() == typeof(WMSClient))
                {
                    WMSClient WmsClient = (WMSClient)Servicies.ElementAt(i);
                    x = WmsClient.GetMaxSize();
                }
                else
                {
                    WMTClient WmtClient = (WMTClient)Servicies.ElementAt(i);
                    x = WmtClient.Extent();
                }

                if (i == 0)
                {
                    extent = x;
                }
                else
                {
                    extent.ExpandToInclude(x);
                }
            }

            return(extent);
        }
コード例 #2
0
ファイル: WebMapClient.cs プロジェクト: CGX-GROUP/DotSpatial
        //public void AddService(WebServiceType ServiceType, string WMSserver = "", string XMLCustomFile = "")
        //{

        //    switch (ServiceType)
        //    {
        //        case (WebServiceType.WMS):
        //            {
        //                WMSCapabilities WmsCapabilities = new WMSCapabilities();
        //                WmsCapabilities.ReadCapabilities(WMSserver, XMLCustomFile, Proxy);

        //                Servicies.Add(WmsCapabilities);
        //            }
        //            break;

        //        default:
        //            {
        //                WMTClient WmtClient = new WMTClient();
        //                WmtClient.Create(ServiceType, Proxy);

        //                Servicies.Add(WmtClient);
        //            }
        //            break;
        //    }

        //}

        public string GetHTML(ref GDIMap m, Size size, string ClientID)
        {
            string htm = "";

            Rectangle Rect = m.ProjToPixel(m.ViewExtents);

            htm += "<div id=\"Back_" + ClientID + "\" style=\"position:absolute; left:" + Rect.Left.ToString() + "px; top:" + Rect.Top.ToString() + "px; width:" + Rect.Width.ToString() + "px; height:" + Rect.Height.ToString() + "px; z-index:1; \">";

            for (int i = 0; i < Servicies.Count(); i++)
            {
                if (Servicies.ElementAt(i).GetType() == typeof(WMSClient))
                {
                    WMSClient WmsClient = (WMSClient)Servicies.ElementAt(i);

                    htm += WmsClient.GetHTML(ref m, size, ClientID + "_" + i.ToString());
                }
                else
                {
                    WMTClient WmtClient = (WMTClient)Servicies.ElementAt(i);

                    if (WmtClient.Visible)
                    {
                        htm += WmtClient.GetHTML(ref m, size, ClientID + "_" + i.ToString());
                    }
                }
            }
            htm += "</div>";


            return(htm);
        }
コード例 #3
0
        private void CreateMap()
        {
            string basePath = Server.MapPath(@"~\Shape");

            WebMap1.Projection     = KnownCoordinateSystems.Projected.World.WebMercator;
            WebMap1.MapViewExtents = new Extent(-20037508.342789, -20037508.342789, 20037508.342789, 20037508.342789);


            WebMapClient client = new WebMapClient();


            WMTClient wmt1 = new WMTClient();

            wmt1.Create(WebServiceType.BingHybrid);


            string    WMSServerWMS0 = "http://maps.ngdc.noaa.gov/soap/web_mercator/marine_geology/MapServer/WMSServer";
            WMSClient wms0          = new WMSClient();

            wms0.ReadCapabilities(WMSServerWMS0);
            wms0.CRS        = "EPSG:3857";
            wms0.Projection = KnownCoordinateSystems.Projected.World.WebMercator;


            string WMSServerWMS1 = "http://maps.ngdc.noaa.gov/soap/web_mercator/graticule/MapServer/WMSServer";

            WMSClient wms1 = new WMSClient();

            wms1.ReadCapabilities(WMSServerWMS1);
            wms1.CRS        = "EPSG:3857";
            wms1.Projection = KnownCoordinateSystems.Projected.World.WebMercator;


            client.AddService(wmt1);
            client.AddService(wms0);
            client.AddService(wms1);

            WebMap1.Back = client;


            IMapFeatureLayer  countriesLayer = (IMapFeatureLayer)WebMap1.AddLayer(basePath + @"\10m_admin_0_countries.shp");
            PolygonSymbolizer symbCountries  = new PolygonSymbolizer(Color.FromArgb(0, 191, 0));

            symbCountries.SetFillColor(Color.Transparent);
            symbCountries.OutlineSymbolizer = new LineSymbolizer(Color.Magenta, 1);
            countriesLayer.Symbolizer       = symbCountries;


            IMapFeatureLayer graticules30Layer = (IMapFeatureLayer)WebMap1.AddLayer(basePath + @"\10m_graticules_30.shp");
            LineSymbolizer   symbGratitules30  = new LineSymbolizer(Color.Red, 1);

            graticules30Layer.Symbolizer = symbGratitules30;

            graticules30Layer.IsVisible = false;
        }
コード例 #4
0
ファイル: WebMapClient.cs プロジェクト: CGX-GROUP/DotSpatial
 public void List(WebLegend tree)
 {
     for (int i = Servicies.Count() - 1; i >= 0; i--)
     {
         if (Servicies.ElementAt(i).GetType() == typeof(WMSClient))
         {
             WMSClient WmsClient = (WMSClient)Servicies.ElementAt(i);
             WmsClient.List(tree);
         }
         else
         {
             WMTClient WmtClient = (WMTClient)Servicies.ElementAt(i);
             WmtClient.List(tree);
         }
     }
 }
コード例 #5
0
ファイル: WebMapClient.cs プロジェクト: CGX-GROUP/DotSpatial
        public void Check(string[] keys, bool check)
        {
            for (int i = 0; i < Servicies.Count(); i++)
            {
                if (Servicies.ElementAt(i).GetType() == typeof(WMSClient))
                {
                    WMSClient WmsClient = (WMSClient)Servicies.ElementAt(i);

                    WmsClient.CheckLayer(keys, check);
                }
                else
                {
                    WMTClient WmtClient = (WMTClient)Servicies.ElementAt(i);
                    if (keys[0] == WmtClient.Name)
                    {
                        WmtClient.Visible = check;
                    }
                }
            }
        }