I have create multiple ring on a particular LAT LONG. Number of ring, distance from center and ring Border Color is depend on user. I have created ring with specified diatance, but not able to change the boder color.
Please help, and I also want to add layer for controling the layer, so that user can select layer. Following are the code
Dim
winformsMap1 As WinformsMap = DirectCast(WinformsMap1, WinformsMap)
Dim no As Integer = Val(drpNoOfRings.Text)
Dim RingBufferShape(no - 1) As EllipseShape
Dim RingName As String = ""
Dim ringLayer As InMemoryFeatureLayer = New InMemoryFeatureLayer()
Are you setting the tile cache for the ring feature overlay(ringFeatureLayer), I think you have coded it rightly by setting the outline color of the area style.
I tried the following code by setting the outline color to red and it works fine, am I misunderstanding something?
winformsMap1.CurrentExtent = New RectangleShape(0, 100, 100, 0) winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.StandardColors.White)
Dim inMemoryLayer As New InMemoryFeatureLayer() inMemoryLayer.InternalFeatures.Add("Polygon", New Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))"))) inMemoryLayer.InternalFeatures.Add("Multipoint", New Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(10 20, 30 20,40 20, 10 30, 30 30, 40 30)"))) inMemoryLayer.InternalFeatures.Add("Line", New Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)"))) inMemoryLayer.InternalFeatures.Add("Rectangle", New Feature(New RectangleShape(65, 30, 95, 15))) inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue)
'Here set the color for the outline pen to Red. inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen = New GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5) inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = New GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8) inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim inMemoryOverlay As New LayerOverlay() inMemoryOverlay.Layers.Add("InMemoryFeatureLayer", inMemoryLayer) winformsMap1.Overlays.Add("InMemoryOverlay", inMemoryOverlay)
winformsMap1.Refresh()
Any more questions please feel free to let me know.
Thanks for reply. Actually I am not much aware of Tile cache. Please brief, how to use it for ring future layer.
I think rigarding color there is some communication gap. I have also plotted ring with red color, but my reqiurement is multi color ring. Suppose at particular lat long (77.4556, 27.6576), I have plotted a ring on 1 km distance (red color) and second on 2 km distance (red color). But requirement is for 1st ring color should be green and for 2nd ring color should be red. Basically color is selected by the user.
Second, Can I show the all ring as layer to user, so that they will able to move layer Up and down and show and hide.
I think this time I may be able to brief my problem.
You can try to set the tile cache in the following way:
Dim ringFeatureLayer As New LayerOverlay() ringFeatureLayer.TileCache = New FileBitmapTileCache("C:\TileCache", "CacheId")
Second, I think it is impossible to set different colors for different rings in one polygon; one polygon should be rendered in the same specified color in the area style. So I think following solutions should work, please consider: 1) Create your own AreaStyle, in the customized areastyle, try to override the DrawCore in which the different color drawing logic is implemented. 2) Split the polygon into several polygons, in which each polygon only one ring is contained. After this, we can use ValueStyle or ClassBreakStyle etc to render them in different colors.
Any more questions please feel free to let me know.
winformsMap1.CurrentExtent = New RectangleShape(0, 100, 100, 0) winformsMap1.BackgroundOverlay.BackgroundBrush = New GeoSolidBrush(GeoColor.StandardColors.White)
Dim inMemoryLayer1 As New InMemoryFeatureLayer() inMemoryLayer1.InternalFeatures.Add("Polygon", New Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))")))
Dim inMemoryLayer2 As New InMemoryFeatureLayer() inMemoryLayer2.InternalFeatures.Add("Multipoint", New Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(10 20, 30 20,40 20, 10 30, 30 30, 40 30)")))
Dim inMemoryLayer3 As New InMemoryFeatureLayer() inMemoryLayer3.InternalFeatures.Add("Line", New Feature(BaseShape.CreateShapeFromWellKnownData("LINESTRING(60 60, 70 70,75 60, 80 70, 85 60,95 80)")))
Dim inMemoryLayer4 As New InMemoryFeatureLayer() inMemoryLayer4.InternalFeatures.Add("Rectangle", New Feature(New RectangleShape(65, 30, 95, 15)))
'Here set the color for the outline pen to Red. inMemoryLayer1.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red inMemoryLayer3.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen = New GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5) inMemoryLayer2.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = New GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8) inMemoryLayer4.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Red inMemoryLayer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 inMemoryLayer2.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 inMemoryLayer3.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20 inMemoryLayer4.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Dim inMemoryOverlay As New LayerOverlay() inMemoryOverlay.Layers.Add("InMemoryFeatureLayer1", inMemoryLayer1) inMemoryOverlay.Layers.Add("InMemoryFeatureLayer2", inMemoryLayer2) inMemoryOverlay.Layers.Add("InMemoryFeatureLayer3", inMemoryLayer3) inMemoryOverlay.Layers.Add("InMemoryFeatureLayer4", inMemoryLayer4) winformsMap1.Overlays.Add("InMemoryOverlay", inMemoryOverlay)
inMemoryOverlay.Layers(0).IsVisible = False
winformsMap1.Refresh()
According to the code above, you can see we create the InMemoryFeatureLayer for each feature and added them to a LayerOverlay so you can set the IsVisible property value to control the appearance for each feature, does that meet your requirements? If you still have any questions please let us know,
I had worked with as per your code and its looking it will work for me but one thing more required (as per your last line to hide the overlay), I had maked ellipselayer (as InMenoryFeatureLayer) and pieLayer (as InMemoryFeatureLayer).
Now I want to setup themeItem, so that user has complete contorl like, Show/Hide and Up/Down layers. But For setup ThemeItem a layer required, and as per my scenerio I have layeroverlay, So is there any way to made a layer which is combination of multiple layers, or can we convert a layeroverlay into layer or anything else....,
Sub themeItem_ItemCheckedChanged(ByVal sender As Object, ByVal e As ShapeEventArgs)If DirectCast(WinformsMap1.Overlays(0), LayerOverlay).Layers.Contains(e.ShapeName) Then
I would like to add a little piece of information regarding buffering. In your post on 02-25-2011 01:17 AM, you are asking about multi color ring, we have a Code Community sample on that subject, Multi Ring Buffering, that shows the technique for creating multiple rings from buffering. I just wanted to make sure that you are not missing this as it could be usefull for your case. wiki.thinkgeo.com/wiki/Map_Suite_De..._Buffering