Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyGraphicsLayerSearch"), GraphicsLayer)
' Zoom to selected feature (define expand percentage)
Dim ZoomTographicslayer As ESRI.ArcGIS.Client.Geometry.Envelope = graphicsLayer
Dim expandPercentage As Double = 230
Dim widthExpand As Double = ZoomTographicslayer.Width * (expandPercentage / 4)
Dim heightExpand As Double = ZoomTographicslayer.Height * (expandPercentage / 4)
Dim displayExtent As New ESRI.ArcGIS.Client.Geometry.Envelope(ZoomTographicslayer.XMin - (widthExpand / 2), ZoomTographicslayer.YMin - (heightExpand / 2), ZoomTographicslayer.XMax + (widthExpand / 2), ZoomTographicslayer.YMax + (heightExpand / 2))
MyMap.ZoomTo(ZoomTographicslayer)
Dim l_Parks As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerParks"), GraphicsLayer)
l_Parks.Visible = True
' Zoom to feature (define expand percentage)
Dim ZoomTographicslayer As ESRI.ArcGIS.Client.Geometry.Envelope = l_Parks.FullExtent
Dim expandPercentage As Double = 230
Dim widthExpand As Double = ZoomTographicslayer.Width * (expandPercentage / 4)
Dim heightExpand As Double = ZoomTographicslayer.Height * (expandPercentage / 4)
Dim displayExtent As New ESRI.ArcGIS.Client.Geometry.Envelope(ZoomTographicslayer.XMin - (widthExpand / 2), ZoomTographicslayer.YMin - (heightExpand / 2), ZoomTographicslayer.XMax + (widthExpand / 2), ZoomTographicslayer.YMax + (heightExpand / 2))
MyMap.ZoomTo(ZoomTographicslayer)
//zoom to all features returned by the query task
Envelope extent = fs.Features[0].Geometry.Extent;
foreach (Graphic g in fs.Features)
{
extent.Union(g.Geometry.Extent);
}
Map.ZoomTo(extent);
Dim l_PointOne As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPoint"), GraphicsLayer)
Dim l_polygon1 As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPoly"), GraphicsLayer)
'Then do some sort of Union and get the extent??????????????
Dim l_PointOne As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPoint"), GraphicsLayer)
Dim l_polygon1 As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPoly"), GraphicsLayer)
'make sure the extent from the point graphics layer is valid otherwise create one here
Dim NewExtent as Envelope = l_polygon1.fullextent.union(l_pointone.fullextent)
MyMap.ZoomTo(NewExtent)
' Turn On Layer
Dim l_PoliceHQBuffer As GraphicsLayer = TryCast(Me.MyMap.Layers("MyGraphicsLayerPoliceHeadQuaters"), GraphicsLayer)
l_PoliceHQBuffer.Visible = True
' Zoom to feature (define expand percentage)
Dim ZoomTographicslayer As ESRI.ArcGIS.Client.Geometry.Envelope = l_PoliceHQBuffer.FullExtent
Dim Width As Double = 1
Dim Height As Double = 1
Dim expandPercentage As Double = 5
Dim widthExpand As Double = ZoomTographicslayer.Width * (expandPercentage / 4)
Dim heightExpand As Double = ZoomTographicslayer.Height * (expandPercentage / 4)
Dim displayExtent As New ESRI.ArcGIS.Client.Geometry.Envelope(ZoomTographicslayer.XMin - (widthExpand / 2), ZoomTographicslayer.YMin - (heightExpand / 2), ZoomTographicslayer.XMax + (widthExpand / 2), ZoomTographicslayer.YMax + (heightExpand / 2))
MyMap.ZoomTo(displayExtent)
' Turn On Layer
Dim l_Precinct As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPrecincts"), GraphicsLayer)
l_Precinct.Visible = True
Dim l_PrecinctPt As GraphicsLayer = TryCast(Me.MyMap.Layers("MySelectionGraphicsLayerPrecinctsPts"), GraphicsLayer)
l_PrecinctPt.Visible = True
' SET EXTENT AND BACK OUT ZOOM OF THE PRECINCT PARCEL
Dim ZoomTographicslayer As ESRI.ArcGIS.Client.Geometry.Envelope = l_Precinct.FullExtent
Dim expandPercentage As Double = 5
Dim widthExpand As Double = ZoomTographicslayer.Width * (expandPercentage / 4)
Dim heightExpand As Double = ZoomTographicslayer.Height * (expandPercentage / 4)
Dim displayExtentPrecinct As New ESRI.ArcGIS.Client.Geometry.Envelope(ZoomTographicslayer.XMin - (widthExpand / 2), ZoomTographicslayer.YMin - (heightExpand / 2), ZoomTographicslayer.XMax + (widthExpand / 2), ZoomTographicslayer.YMax + (heightExpand / 2))
'MyMap.ZoomTo(displayExtent)
' REDEFINE THE EXTENT OF THE SINGLE POINT
Dim ZoomTographicslayer1 As ESRI.ArcGIS.Client.Geometry.Envelope = l_PrecinctPt.FullExtent
Dim Width As Double = 15
Dim Height As Double = 15
Dim displayExtentPrecinctPt As New ESRI.ArcGIS.Client.Geometry.Envelope(ZoomTographicslayer1.XMin - Width, ZoomTographicslayer1.YMin - Height, ZoomTographicslayer1.XMax + Width, ZoomTographicslayer1.YMax + Height)
'MyMap.ZoomTo(displayExtent1)
' CREATE NEW ENVELOPE AND UNION THE TWO LAYERS
Dim NewExtent As Envelope = displayExtentPrecinct.Union(displayExtentPrecinctPt)
' ZOOM TO THE NEW EXTENT
MyMap.ZoomTo(NewExtent)