自写地图全图功能

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();
    }

你可能感兴趣的:(地图)