hi every one
Can any one guide me that how i can draw a polygon shape using a collection of vertex on a layer
Thanks
Atif
hi every one
Can any one guide me that how i can draw a polygon shape using a collection of vertex on a layer
Thanks
Atif
Hi Atif,
Polygon shape consists of an required OuterRing and optional multi-InnerRings. Both outerring and innerring consists of an ordered vertexes and the first vertex should be the same as the last one. After creating the polygon shape, then we can add it into InMemoryFeatureLayer or other Feature Layer to draw it out. For example:
RingShape outerRing = new RingShape();
outerRing.Vertices.Add(new Vertex(-133, 64));
outerRing.Vertices.Add(new Vertex(-77, 65));
outerRing.Vertices.Add(new Vertex(-80, 26));
outerRing.Vertices.Add(new Vertex(-105, 14));
outerRing.Vertices.Add(new Vertex(-139, 39));
outerRing.Vertices.Add(new Vertex(-133, 64));
PolygonShape singlePolygon = new PolygonShape(outerRing);
InMemoryFeatureLayer inMemoryLayer = new InMemoryFeatureLayer();
inMemoryLayer.InternalFeatures.Add("Polygon", new Feature(singlePolygon));
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue);
inMemoryLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Blue;
inMemoryLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Map1.StaticOverlay.Layers.Add(inMemoryLayer);
Thanks Troy
Atif,
You are welcome. Don’t hesitate to let us know if any other questions.
Thanks,
Troy