Private Sub GeometryService_BufferCompleted(ByVal sender As Object, ByVal e As GraphicsEventArgs)
Try
Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyUserDrawnGraphicsLayer"), GraphicsLayer)
graphicsLayer.Graphics.Clear()
Dim iZIndex As Integer = 0
Dim comboBufferGraphic As New Graphic
For Each bufferGraphic As Graphic In e.Results
comboBufferGraphic.Geometry = bufferGraphic.Geometry
bufferGraphic.Symbol = TryCast(LayoutRoot.Resources("BufferSymbol"), Symbol)
bufferGraphic.SetZIndex(iZIndex)
graphicsLayer.Graphics.Add(bufferGraphic)
iZIndex = iZIndex + 1
Next
Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
query.ReturnGeometry = True
query.Geometry = comboBufferGraphic.Geometry
query.OutSpatialReference = MyMap.SpatialReference
query.OutFields.Add("SUE")
query.OutFields.Add("LEGAL")
_queryTask.ExecuteAsync(query)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub GeometryService_BufferCompleted(ByVal sender As Object, ByVal e As GraphicsEventArgs)
Try
Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyUserDrawnGraphicsLayer"), GraphicsLayer)
graphicsLayer.Graphics.Clear()
Dim comboBufferGraphic As New Graphic
Dim myComboPoly As New ESRI.ArcGIS.Client.Geometry.Polygon
For Each bufferGraphic As Graphic In e.Results
comboBufferGraphic.Geometry = bufferGraphic.Geometry
Dim myPoly As ESRI.ArcGIS.Client.Geometry.Polygon = TryCast(bufferGraphic.Geometry, ESRI.ArcGIS.Client.Geometry.Polygon)
For Each pointColl As ESRI.ArcGIS.Client.Geometry.PointCollection In myPoly.Rings
myComboPoly.Rings.Add(pointColl)
Next
bufferGraphic.Symbol = TryCast(LayoutRoot.Resources("BufferSymbol"), Symbol)
bufferGraphic.SetZIndex(1)
graphicsLayer.Graphics.Add(bufferGraphic)
Next
Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
query.ReturnGeometry = True
query.Geometry = myComboPoly
query.OutSpatialReference = MyMap.SpatialReference
query.OutFields.Add("SUE")
query.OutFields.Add("LEGAL")
_queryTask.ExecuteAsync(query)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Hi to all
The code below shows hows to combine the separate graphic geometries into one to be used in the query task. Amazing how the act of posting a message will prompt inspiration!!
There may be other ways but it is what I am doing for now.
Regards
Ralph Price
Application Developer and GIS AnalystPrivate Sub GeometryService_BufferCompleted(ByVal sender As Object, ByVal e As GraphicsEventArgs) Try Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyUserDrawnGraphicsLayer"), GraphicsLayer) graphicsLayer.Graphics.Clear() Dim comboBufferGraphic As New Graphic Dim myComboPoly As New ESRI.ArcGIS.Client.Geometry.Polygon For Each bufferGraphic As Graphic In e.Results comboBufferGraphic.Geometry = bufferGraphic.Geometry Dim myPoly As ESRI.ArcGIS.Client.Geometry.Polygon = TryCast(bufferGraphic.Geometry, ESRI.ArcGIS.Client.Geometry.Polygon) For Each pointColl As ESRI.ArcGIS.Client.Geometry.PointCollection In myPoly.Rings myComboPoly.Rings.Add(pointColl) Next bufferGraphic.Symbol = TryCast(LayoutRoot.Resources("BufferSymbol"), Symbol) bufferGraphic.SetZIndex(1) graphicsLayer.Graphics.Add(bufferGraphic) Next Dim query As New ESRI.ArcGIS.Client.Tasks.Query() query.ReturnGeometry = True query.Geometry = myComboPoly query.OutSpatialReference = MyMap.SpatialReference query.OutFields.Add("SUE") query.OutFields.Add("LEGAL") _queryTask.ExecuteAsync(query) Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub