Hi,
I'm having a very frustrating problem and i was wondering if you could help?
What i want to do is select an outline area on the tracking layer and then check if within that area on a seperate layer features exist. If they do i then want to remove the equivilent space in the drawn polygon on the tracking layer.
The best way i could figure to do this was by using inner rings on the polygonshape.
i've tried to recreate functionality from the inner ring container example project to do this but it's not having the desired effect.
when the map draws the items it adds the area style to all of the elements of the polygonshape and not just the main outer ring?
I have the function remove tanks which is run
Friend Function RemoveTanks(ByVal Dike As AreaBaseShape) As AreaBaseShape
Dim layerOverLay As LayerOverlay = Me.UiEmergencyManagerMap1.Overlays(Overlays.TanksOverlay)
Dim GhostTanksLayer As InMemoryFeatureLayer
Dim DikeExtent As RectangleShape
Dim selectedFeatures As System.Collections.ObjectModel.Collection(Of Feature)
Dim Polygonshape As New PolygonShape(Dike.GetWellKnownBinary)
GhostTanksLayer = layerOverLay.Layers.Item("Layer_GhostTanks")
GhostTanksLayer.Open()
DikeExtent = Dike.GetBoundingBox
selectedFeatures = GhostTanksLayer.QueryTools.GetFeaturesInsideBoundingBox(DikeExtent, ReturningColumnsType.AllColumns)
GhostTanksLayer.Close()
Polygonshape.OuterRing = New RingShape(Dike.GetWellKnownBinary)
If selectedFeatures.Count > 0 Then
For Each feature As Feature In selectedFeatures
Dim bShape As BaseShape = feature.GetShape
If TypeOf bShape Is AreaBaseShape Then
Dim ringShape As New RingShape(bShape.GetWellKnownBinary)
Polygonshape.InnerRings.Add(ringShape)
End If
Next
End If
_LastDrawn = Polygonshape
Return Polygonshape
End Function
and then the commit tracking method is called
Friend Sub CommitTracking(ByVal ShapeId As String)
Dim ShapeFeatureLayer As New InMemoryFeatureLayer
Dim ShapesOverLay As LayerOverlay
'add the hose to the hose layer and the shapes to the shapes layer
ShapesOverLay = GetOverlayForType(_mapMode)
'add the layer to the overlay
ShapesOverLay.Layers.Add("Layer_" & _LastDrawn.Id, ShapeFeatureLayer)
ShapeFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = _CurrentAreaStyle
ShapeFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
ShapeFeatureLayer.Open()
'add it to the circle feature layer
ShapeFeatureLayer.EditTools.BeginTransaction()
ShapeFeatureLayer.EditTools.Add(New Feature(_LastDrawn))
ShapeFeatureLayer.EditTools.CommitTransaction()
ShapeFeatureLayer.Close()
'delete off the track layer
If Me.UiEmergencyManagerMap1.TrackOverlay.TrackShapeLayer.IsOpen Then
Me.UiEmergencyManagerMap1.TrackOverlay.TrackShapeLayer.EditTools.BeginTransaction()
Me.UiEmergencyManagerMap1.TrackOverlay.TrackShapeLayer.EditTools.Delete(ShapeId)
Me.UiEmergencyManagerMap1.TrackOverlay.TrackShapeLayer.EditTools.CommitTransaction()
End If
End Sub
Could you please tell me why the style is being applied to the inner rings aswell as the outer and how i can avoid this?
Also is this the best way for me to perform this task or is there an easier way to remove sections of space from a polygon.
thanks
Aaron