/ Published in: C#
URL: http://blog.davidrenz.com/?p=109
This function will zoom to a specific point on the map control. If the addToMap switch is set, the point will be added to the map.
Expand |
Embed | Plain Text
public static void zoomMapToPoint(ESRI.ArcGIS.ADF.Web.UI.WebControls.Map map, ESRI.ArcGIS.ADF.Web.Geometry.Point pPoint, string zoomfactor, string graphicsLayerName, bool addToMap) { ESRI.ArcGIS.ADF.Web.UI.WebControls.MapResourceManager mapman = (ESRI.ArcGIS.ADF.Web.UI.WebControls.MapResourceManager)map.MapResourceManagerInstance; // convert the point to an adf point ESRI.ArcGIS.ADF.Web.Geometry.Point adf_point = new ESRI.ArcGIS.ADF.Web.Geometry.Point(pPoint.X, pPoint.Y); //// Get graphics layer from Map ESRI.ArcGIS.ADF.Web.Display.Graphics.ElementGraphicsLayer glayer = MapSubs.GetGraphicsLayer(graphicsLayerName, mapman); //glayer.Clear(); // add the point if (addToMap) { AddPointToMap(adf_point, glayer); } double mapZoomFactor = map.Scale / double.Parse(zoomfactor); map.Zoom(mapZoomFactor); map.CenterAt(pPoint); map.Refresh(); }
You need to login to post a comment.
