Beispiel #1
0
        private string refresh(ref GDIMap m)
        {
            Rectangle Rect = m.ProjToPixel(m.ViewExtents);

            WebMapClient MapClient = (WebMapClient)System.Web.HttpContext.Current.Session["bck_" + SessionName];

            string htm = "";
            string MS  = Milliseconds();

            NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;

            MapOnCache(ref m);

            htm = htm + "ImageHandler.ashx?ID=" + (string)ViewState[ClientID] + "?" + MS; // + "|";


            if (MapClient != null)
            {
                string h = MapClient.GetHTML(ref m, ControlSize, ClientID);

                htm += "|" + h + "|" + Rect.Left.ToString() + "|" + Rect.Top.ToString() + "|" + Rect.Width.ToString() + "|" + Rect.Height.ToString() + "|" + "copi";
            }
            else
            {
                htm += "|Tile|Tl|Tt|Tw|Th|(C)";
            }

            WebMarkers Markers = (WebMarkers)System.Web.HttpContext.Current.Session["mrk_" + SessionName];

            if (Markers != null)
            {
                htm += "|";
                htm += Markers.ToHtml(ref m);
            }
            else
            {
                htm += "|Markers";
            }

            htm = htm + "|" + m.ViewExtents.MinX.ToString(nfi) + "|";
            htm = htm + m.ViewExtents.MinY.ToString(nfi) + "|";
            htm = htm + m.ViewExtents.MaxX.ToString(nfi) + "|";
            htm = htm + m.ViewExtents.MaxY.ToString(nfi);

            return(htm);
        }
Beispiel #2
0
        public string ToHtml(ref GDIMap m)
        {
            string htm = "";
            int    n   = GetNum();


            for (int i = 0; i < n; i++)
            {
                System.Drawing.Point pt = m.ProjToPixel(_crds[i]);

                pt.X += _dxy[i].X;
                pt.Y += _dxy[i].Y;

                if (_aRef[i] != "" & _aRef[i] != null)
                {
                    htm += "<a href=\"" + _aRef[i] + "\">";
                }

                htm += "<img alt=\"\" src=\"" + _imgs[i] + "\" style=\"border:0px; cursor:pointer; position:absolute; left:" + pt.X.ToString() + "px; top:" + pt.Y.ToString() + "px; z-index:400\"";

                if (_onClick[i] != "" & _onClick[i] != null)
                {
                    htm += " onclick=\"" + _onClick[i] + "\"";
                }
                if (_onMouseOver[i] != "" & _onMouseOver[i] != null)
                {
                    htm += " onmouseover=\"" + _onMouseOver[i] + "\"";
                }
                if (_onMouseOut[i] != "" & _onMouseOut[i] != null)
                {
                    htm += " onmouseout=\"" + _onMouseOut[i] + "\"";
                }

                htm += " />";

                if (_aRef[i] != "" & _aRef[i] != null)
                {
                    htm += "</a>";
                }
            }

            return(htm);
        }
Beispiel #3
0
        public string ToHtml(ref GDIMap m)
        {
            string htm = "";
            int n=GetNum();


            for (int i = 0; i < n; i++)
            {
                System.Drawing.Point pt = m.ProjToPixel(_crds[i]);

                pt.X += _dxy[i].X;
                pt.Y += _dxy[i].Y;

                if (_aRef[i] != "" & _aRef[i] != null)
                {
                    htm += "<a href=\"" + _aRef[i] + "\">";
                }

                htm += "<img alt=\"\" src=\"" + _imgs[i] + "\" style=\"border:0px; cursor:pointer; position:absolute; left:" + pt.X.ToString() + "px; top:" + pt.Y.ToString() + "px; z-index:400\"";

                if (_OnClick[i] != "" & _OnClick[i] != null) htm += " onclick=\"" + _OnClick[i] + "\"";
                if (_OnMouseOver[i] != "" & _OnMouseOver[i] != null) htm += " onmouseover=\"" + _OnMouseOver[i] + "\"";
                if (_OnMouseOut[i] != "" & _OnMouseOut[i] != null) htm += " onmouseout=\"" + _OnMouseOut[i] + "\"";

                htm+=" />";
                
                if (_aRef[i] != "" & _aRef[i] != null)
                {
                    htm += "</a>";
                }


            }

            return htm;
        }
Beispiel #4
0
        public string GetHTML(ref GDIMap m, Size size, string DivID)
        {
            string htm = "";

            int w = size.Width;
            int h = size.Height;

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

            Extent WmsEx = m.ViewExtents;

            if(Projection != m.Projection)
            {

                double[] xy = new double[4];

                xy[0] = m.ViewExtents.MinX;
                xy[1] = m.ViewExtents.MinY;
                xy[2] = m.ViewExtents.MaxX;
                xy[3] = m.ViewExtents.MaxY;

                double[] z = { };


                Projections.Reproject.ReprojectPoints(xy, z, m.Projection, Projection, 0, 2);

                WmsEx.MinX = Math.Min(xy[0], xy[2]);
                WmsEx.MinY = Math.Min(xy[1], xy[3]);

                WmsEx.MaxX = Math.Max(xy[0], xy[2]);
                WmsEx.MaxY = Math.Max(xy[1], xy[3]);

                if (double.IsNaN(WmsEx.MinX) | double.IsNaN(WmsEx.MinY) | double.IsNaN(WmsEx.MaxX) | double.IsNaN(WmsEx.MaxY))
                {
                    htm += "<div id=\"Back_" + DivID + "\" style=\"position:absolute; left:" + Rect.Left.ToString() + "px; top:" + Rect.Top.ToString() + "px; width:" + Rect.Width.ToString() + "px; height:" + Rect.Height.ToString() + "px; \">";
                    htm += "<p>Out of WMS zone</p>";
                    htm += "</div>";

                    return htm;
                }
            }

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

            double Hint = Math.Sqrt(Math.Pow(m.ViewExtents.Width / size.Width, 2) + Math.Pow(m.ViewExtents.Height / size.Height, 2));

            List<ServerLayer> list = GetVisibleLayer();

            if (list == null)
            {
                htm += "<p>NO WMS LAYERS</p>";
            }
            else if (list != null & list.Count > 0)
            {


                int num = list.Count;

                string Lays = "";
                for (int i = 0; i < num - 1; i++)
                {
                    Lays += list[i].Name + ",";
                }
                Lays += list[num - 1].Name;


                string svr = Server;

                if (svr == null)
                {
                    throw new ApplicationException("WMS server must not be null");
                }

                if (svr.Contains('?'))
                    svr += "&";
                else
                    svr += "?";


                string f = svr;
                f += "Version=" + Version;
                f += "&REQUEST=GetMap";
                f += "&Layers=" + Lays;

                if (Version=="1.3.0")
                {
                    f += "&crs=" + CRS;
                }
                else
                {
                    f += "&srs=" + CRS;
                }
                
                f += "&format=image/png";

                f += "&styles=";

                f += "&bbox={0},{1},{2},{3}&width={4}&height={5}";

                f += "&TRANSPARENT=TRUE";

                //string t = string.Format(CultureInfo.InvariantCulture, f, m.ViewExtents.MinX, m.ViewExtents.MinY, m.ViewExtents.MaxX, m.ViewExtents.MaxY, size.Width, size.Height);
                string t = string.Format(CultureInfo.InvariantCulture, f, WmsEx.MinX, WmsEx.MinY, WmsEx.MaxX, WmsEx.MaxY, size.Width, size.Height);

                string o = "";
                if (Opacity != 100)
                {
                    //o = "filter:alpha(opacity=30);opacity: 0.3;";
                    o = "filter:alpha(opacity=" + Opacity.ToString() + "); opacity: " + (Opacity / 100).ToString(CultureInfo.InvariantCulture) + "; ";
                }

                htm += "<img alt=\"\" style=\"position:absolute; " + o + "left:0px; top:0px; width:" + size.Width.ToString() + "px; height:" + size.Height.ToString() + "px; \" src=\"" + t + "\" />";

            }
            
            htm += "</div>";

            return htm;

        }
Beispiel #5
0
        //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;
        }
Beispiel #6
0
        private string refresh(ref GDIMap m)
        {
            Rectangle Rect = m.ProjToPixel(m.ViewExtents); 

            WebMapClient MapClient = (WebMapClient)System.Web.HttpContext.Current.Session["bck_" + SessionName];

            string htm = "";
            string MS = Milliseconds();

            NumberFormatInfo nfi = new CultureInfo("en-US", false).NumberFormat;
            MapOnCache(ref m);

            htm = htm + "ImageHandler.ashx?ID=" + (string)ViewState[ClientID] + "?" + MS; // + "|";


            if (MapClient != null)
            {

                string h = MapClient.GetHTML(ref m, ControlSize, ClientID);

                htm += "|" + h + "|" + Rect.Left.ToString() + "|" + Rect.Top.ToString() + "|" + Rect.Width.ToString() + "|" + Rect.Height.ToString() + "|" + "copi";

            }
            else
            {
                htm += "|Tile|Tl|Tt|Tw|Th|(C)";
            }

            WebMarkers Markers = (WebMarkers)System.Web.HttpContext.Current.Session["mrk_" + SessionName];

            if (Markers != null)
            {
                htm += "|";
                htm += Markers.ToHtml(ref m);
            }
            else
            {
                htm += "|Markers";
            }

            htm = htm + "|" + m.ViewExtents.MinX.ToString(nfi) + "|";
            htm = htm + m.ViewExtents.MinY.ToString(nfi) + "|";
            htm = htm + m.ViewExtents.MaxX.ToString(nfi) + "|";
            htm = htm + m.ViewExtents.MaxY.ToString(nfi) ;

            return htm;
        }
Beispiel #7
0
        public string GetHTML(ref GDIMap m, Size size, string DivID)
        {

            TileInfoSet[] Ts = GetTile(m.ViewExtents, size);

            string htm = "";

            int numSet = Ts.GetLength(0);

            for (int set = 0; set < numSet; set++)
            {

                if (set == 0)
                {
                    TilesExtent = Ts[set].Extent;
                }
                else
                {
                    TilesExtent.ExpandToInclude(Ts[set].Extent);
                }
            }




            Rectangle Rect = m.ProjToPixel(TilesExtent);

            int w = (int)((double)(Rect.Width + 1) / (double)Ts[0].cols);
            int h = (int)((double)(Rect.Height + 1) / (double)Ts[0].rows);

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

            for (int r = 0; r < Ts[0].rows; r++)
            {
                for (int c = 0; c < Ts[0].cols; c++)
                {
                    int l = c * w;
                    int t = r * h;

                    for (int set = 0; set < numSet; set++)
                    {
                        htm += "<img alt=\"\" style=\"position:absolute; left: " + l.ToString() + "px; top:" + t.ToString() + "px; width:" + w.ToString() + "px; height:" + h.ToString() + "px; \" src=\"" + Ts[set].Tiles[r][c].url + "\" />";
                    }
                }

            }

            htm += "</div>";

            return htm;

            //Extent WmtEx;

            //{

            //    double[] xy = new double[4];

            //    xy[0] = m.ViewExtents.MinX;
            //    xy[1] = m.ViewExtents.MinY;
            //    xy[2] = m.ViewExtents.MaxX;
            //    xy[3] = m.ViewExtents.MaxY;

            //    double[] z = { };


            //    Projections.Reproject.ReprojectPoints(xy, z, m.Projection, Projection, 0, 2);

            //    WmtEx = new Extent(xy);

            //}


            //TileInfoSet[] Ts = GetTile(WmtEx, size);

            //string htm = "";

            //int numSet = Ts.GetLength(0);

            //for (int set = 0; set < numSet; set++)
            //{

            //    if (set == 0)
            //    {
            //        TilesExtent = Ts[set].Extent;
            //    }
            //    else
            //    {
            //        TilesExtent.ExpandToInclude(Ts[set].Extent);
            //    }
            //}

            //Extent MapEx;

            //{

            //    double[] xy = new double[4];

            //    xy[0] = WmtEx.MinX;
            //    xy[1] = WmtEx.MinY;
            //    xy[2] = WmtEx.MaxX;
            //    xy[3] = WmtEx.MaxY;

            //    double[] z = { };


            //    Projections.Reproject.ReprojectPoints(xy, z, m.Projection, Projection, 0, 2);

            //    MapEx = new Extent(xy);

            //}



            //Rectangle Rect = m.ProjToPixel(MapEx);

            //int w = (int)((double)(Rect.Width + 1) / (double)Ts[0].cols);
            //int h = (int)((double)(Rect.Height + 1) / (double)Ts[0].rows);

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

            //for (int r = 0; r < Ts[0].rows; r++)
            //{
            //    for (int c = 0; c < Ts[0].cols; c++)
            //    {
            //        int l = c * w;
            //        int t = r * h;

            //        for (int set = 0; set < numSet; set++)
            //        {
            //            htm += "<img alt=\"\" style=\"position:absolute; left: " + l.ToString() + "px; top:" + t.ToString() + "px; width:" + w.ToString() + "px; height:" + h.ToString() + "px; \" src=\"" + Ts[set].Tiles[r][c].url + "\" />";
            //        }
            //    }

            //}

            //htm += "</div>";

            //return htm;
        }