Solved! Go to Solution.
if ( graphic.Geometry is Polygon ) { ..... }
Joe, how to get coordinates for each side of polygon? I am drawing only a polygon. I want to get all coordinates of polygon.
private void ShowPolyCoords(Graphic graphic) { var polygon = graphic.Geometry as Polygon; if ( polygon == null ) return; PointCollection points = polygon.Rings[0]; foreach (var point in points) { Debug.WriteLine("X: {0}, Y: {1}", point.X, point.Y); } }
Hi All,
I want to know how to get polygon all coordinates? I have a situation to save all coordinates. If I draw a multi-line, I have to capture all coordinates for it. When I use Client.Graphic.Extent.toString(), I am getting only 4 coordinates (If I am not wrong it might be minx,miny, maxx,maxy) when I draw rectangle and point. But I want to capture all coordinates for polygon and multiline.
thanks in Advance.
if the graphic's geometry is a polygon then For each ring in the polygon's rings for each mappoint in the ring's pointcollection do something with the mappoint (like get mappoint.X and mappoint.Y) next mappoint next ring End if
if the graphic's geometry is a polygon then For each ring in the polygon's rings for each mappoint in the ring's pointcollection do something with the mappoint (like get mappoint.X and mappoint.Y) next mappoint next ring End if
if ( graphic.Geometry is Polygon ) { ..... }
Thanks for prompt response.
I am new to this Silverlight viewer. I didn't find any rings or mappoint or pointcollections in graphics.
if ( graphic.Geometry is Polygon ) { ..... }
if ( graphic.Geometry is Polygon ) { ..... }
Joe, how to get coordinates for each side of polygon? I am drawing only a polygon. I want to get all coordinates of polygon.
private void ShowPolyCoords(Graphic graphic) { var polygon = graphic.Geometry as Polygon; if ( polygon == null ) return; PointCollection points = polygon.Rings[0]; foreach (var point in points) { Debug.WriteLine("X: {0}, Y: {1}", point.X, point.Y); } }