Esempio n. 1
0
        private string redraw(ref GDIMap m)
        {
            //MessageBox.Show(this.ID + " " + Name);

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

            //Rectangle Rect = new Rectangle(0, 0, (int)this.Width.Value, (int)this.Height.Value);

            bool NullMap = (this.DesignMode | m == null);

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

            string MS = Milliseconds();

            if (!NullMap)
            {
                MapOnCache(ref m);
            }

            string htm = "";

            htm += "<div id=\"Container_" + ClientID + "\" style=\"position:absolute; left:0px; top:0px; width:100%; height:100%;  overflow:hidden \">";

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

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

                htm += x;
            }

            htm += "<div id=\"DivCanvas_" + ClientID + "\" style=\"position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:2; overflow:hidden \">";

            if (!NullMap)
            {
                htm += "<img id=\"Buffer_" + ClientID + "\" style=\"position:absolute; left:0px; top:0px; z-index:1; \" src=\"" + "ImageHandler.ashx?ID=" + (string)ViewState[ClientID] + "?" + MS + "\" />";
                htm += "<img id=\"Canvas_" + ClientID + "\" style=\"position:absolute; left:0px; top:0px; z-index:2; \" src=\"" + "ImageHandler.ashx?ID=" + (string)ViewState[ClientID] + "?" + MS + "\" />";
            }

            htm += "</div>";

            htm += "<div id=\"EditCanvas_" + ClientID + "\" style=\"position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:1000; overflow:hidden \">";
            htm += "</div>";


            htm += "<div id=\"Wait_" + ClientID + "\" style=\"position:absolute; visibility:visible; left:0px; top:0px; width:100%; height:100%;background-color:white;filter:alpha(opacity=50);z-index:2000\">";

            htm += "<table style=\"width:100%; height:100%\"><tr><td style=\"vertical-align:middle; text-align:center\">";
            htm += "<img id=\"ImgWait_" + ClientID + "\" alt=\"\" src=\"" + Page.ClientScript.GetWebResourceUrl(this.GetType(), "DotSpatial.WebControls.Images.Wait.gif") + "\" style=\"z-index:2001\" />";
            htm += "</td></tr></table>";

            htm += "</div>";

            int ActiveLayerType = -1;

            if (m.Layers.SelectedLayer != null)
            {
//                    IMapFeatureLayer MFL = (IMapFeatureLayer)m.Layers.SelectedLayer;
// exception if cast MapRasterLayer in previous line, so use IMapLayer:
                IMapLayer MFL = (IMapLayer)m.Layers.SelectedLayer;

                ActiveLayerType = 0;
                if (MFL.GetType() == typeof(MapPointLayer))
                {
                    ActiveLayerType = 1;
                }
                if (MFL.GetType() == typeof(MapLineLayer))
                {
                    ActiveLayerType = 2;
                }
                if (MFL.GetType() == typeof(MapPolygonLayer))
                {
                    ActiveLayerType = 3;
                }
            }

            htm += "<div id=\"LayerType_" + ClientID + "\" style=\"visibility:hidden;\">" + ActiveLayerType.ToString() + "</div>";



            // QQQ
            //if (theTiler != null)
            //{
            //    htm += "<div id=\"Copyright_" + ClientID + "\" style=\"position:absolute; top:auto; left:3px; bottom:3px; right:auto; width:auto; z-index:200000; font-family: Arial, Helvetica, sans-serif; font-size: x-small; font-weight: normal; color: #000000;  border: 1px solid #C0C0C0; background-color: #FFFFFF \">&nbsp;" + theTiler.Copyright + "&nbsp;</div>";
            //}

            //htm += "<div id=\"StatusBar_" + ClientID + "\" style=\"position:absolute; top:auto; left:auto; bottom:3px; right:3px; width:auto; height:24px; border: 1px solid #000000; background-color: #FFFFFF; z-index:1000\"></div>";

            htm += "<div id=\"MinX_" + ClientID + "\" style=\"visibility:hidden;\">" + m.ViewExtents.MinX.ToString(nfi) + "</div>";
            htm += "<div id=\"MinY_" + ClientID + "\" style=\"visibility:hidden;\">" + m.ViewExtents.MinY.ToString(nfi) + "</div>";
            htm += "<div id=\"MaxX_" + ClientID + "\" style=\"visibility:hidden;\">" + m.ViewExtents.MaxX.ToString(nfi) + "</div>";
            htm += "<div id=\"MaxY_" + ClientID + "\" style=\"visibility:hidden;\">" + m.ViewExtents.MaxY.ToString(nfi) + "</div>";


            string islatlon = "0";

            //if (m.Extent.MaxX <= 180 && m.Extent.MinX >= -180.0 & m.Extent.MinY >= -90 & m.Extent.MaxY <= 90.0)
            if (m.Projection.IsLatLon == true)
            {
                islatlon = "1";
            }

            htm += "<div id=\"IsLatLon_" + ClientID + "\" style=\"visibility:hidden;\" >" + islatlon + "</div>";

            htm += "<div id =\"Floater_" + ClientID + "\" style=\"border: 1px solid #000000; background: #FFFF00; position:absolute; width: 0px; height:0px; top:0px; left:0px; visibility:hidden; z-index:11\" onmousedown=\"\" onmousemove=\"\" onmouseup=\"\" ondrag(event)=\"return false\" onSelectStart=\"return false\"></div>";

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

            if (Markers != null)
            {
                htm += "<div id =\"Markers_" + ClientID + "\" style=\"position:absolute; left:0px; top:0px; width:100%; height:100%; z-index:300\">";
                htm += Markers.ToHtml(ref m);
                htm += "</div>";
            }


            htm += "</div>";


            return(htm);
        }