sub testfill()
Public SectorLayer As InMemoryFeatureLayer = New InMemoryFeatureLayer() '
Public MainOverlay As LayerOverlay = New LayerOverlay()
SectorLayer.FeatureSource.Open()
SectorLayer.Columns.Add(New FeatureSourceColumn("Name")) 'Each Sector has a name
SectorLayer.Close()
MainOverlay.Layers.Add(SectorLayer.Name,SectorLayer)
Form1.WinformsMap1.Overlays.Add("MainOverlay", MainOverlay)
Dim Points(5) as string
points(0)= "-75.123 45.123" ' Create the Points for a square
points(1) = "-75.223,45.123"
points(2) = "-75.223 45.223"
points(3) = "-75.123 45.223"
points(4) = "-75.123 45.123"
dim fill as geocolor
for i=1 to 100
thread.sleep(1000) ' wait one second
fill = geocolor.fromargb(25,255,0,0) ' Mostly transparent red
drawpolygon("Test",Sectorlayer,points,geocolor.simplecolors.yellow,fill,2)
next i
end sub
Public Sub DrawPolygon(ByVal name As String, ByRef lyr As InMemoryFeatureLayer, ByVal pts() As String, ByVal lcolor As GeoColor, ByVal fcolor As GeoColor, ByVal lwidth As Integer)
'create a polygon
'' Dim poly As PolygonShape
Try
lyr.InternalFeatures.Remove(name) 'Attempt to remove the feature if it exists.
Catch ex As Exception
End Try
Dim columnValuesForLine As New Dictionary(Of String, String)
columnValuesForLine.Add("Name", name)
Dim ValueStyle As ValueStyle = New ValueStyle()
ValueStyle.ColumnName = "Name"
ValueStyle.ValueItems.Add(New ValueItem(name, AreaStyles.CreateSimpleAreaStyle(fcolor, lcolor, lwidth, LineDashStyle.Solid)))
lyr.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(ValueStyle)
lyr.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim lstring As String = "POLYGON(("
For p As Integer = 0 To pts.Count - 1
lstring &= pts(p)
If p < pts.Count - 1 Then lstring &= ","
Next
lstring &= "))"
'' poly = New PolygonShape(lstring)
Try
lyr.InternalFeatures.Add(name, New Feature(BaseShape.CreateShapeFromWellKnownData(lstring), columnValuesForLine))
Catch ex As Exception
End Try
End Sub