自写地图全图功能

public static void ShowFullEextent(Map map)
    {
        ESRI.ArcGIS.ADF.Web.Geometry.Envelope fullExtent = null;
        foreach (IMapFunctionality imf in map.GetFunctionalities())
        {
            MapFunctionality mf = imf as MapFunctionality;
            ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapDescription = mf.MapDescription;
            ESRI.ArcGIS.ADF.ArcGISServer.Envelope envServer = mapDescription.MapArea.Extent;
            ESRI.ArcGIS.ADF.Web.Geometry.Envelope env = null;
            env = ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.Converter.ToAdfGeometry(
                envServer) as ESRI.ArcGIS.ADF.Web.Geometry.Envelope;
            if (fullExtent == null)
            {
                fullExtent = env;
            }
            else
            {
                fullExtent.Union(env);
            }
        }

        map.Extent = fullExtent;
        map.Refresh();
    }
posted @ 2009-06-21 13:59  周文  阅读(493)  评论(1编辑  收藏  举报