MapSpecification.Polygons Property
MapSpecification.Polygons Property
An array of Polygon objects to render. Optional.
Public Polygons As Polygon[]
[C#]
public Polygon[] Polygons;
Example
[Visual Basic]
'Create an array of Polygon objects. For each Polygon object,
'set the DataSourceName, EntityID, BorderColor, and FillColor properties.
Dim fillColor As New ElementColor
fillColor.A = Convert.ToByte(txtFillAlpha.Text)
fillColor.B = Convert.ToByte(txtFillBlue.Text)
fillColor.G = Convert.ToByte(txtFillGreen.Text)
fillColor.R = Convert.ToByte(txtFillRed.Text)
Dim lineColor As New ElementColor
lineColor.A = Convert.ToByte(txtLineAlpha.Text)
lineColor.B = Convert.ToByte(txtLineBlue.Text)
lineColor.G = Convert.ToByte(txtLineGreen.Text)
lineColor.R = Convert.ToByte(txtLineRed.Text)
Dim poly As New Polygon
poly.DataSourceName = "MyDataSource"
poly.EntityID = "MyEntityID"
poly.BorderColor = lineColor
poly.FillColor = fillColor
' Set the MapSpecification.Polygons property to the polygon array.
spec.Polygons(1) = New Polygon
spec.Polygons(0) = poly
'Call the RenderServiceSoap.GetMap method.
Dim mi() As New MapImage
mi = render.GetMap(spec)
pictMap.Image = New Bitmap(New System.IO.MemoryStream(mi(0).MimeData.Bits))
[C#]
//Display a polygon on a map
MapSpecification spec = new MapSpecification();
spec.DataSourceName = "MapPoint.NA";
spec.Views = views;
spec.Options = mo;
//Create an array of Polygon objects. For each Polygon object,
//set the DataSourceName, EntityID, BorderColor, and FillColor properties.
MapPointColor fillColor = new ElementColor();
fillColor.A=Convert.ToByte(txtFillAlpha.Text);
fillColor.B=Convert.ToByte(txtFillBlue.Text);
fillColor.G=Convert.ToByte(txtFillGreen.Text);
fillColor.R=Convert.ToByte(txtFillRed.Text);
MapPointColor lineColor = new ElementColor();
lineColor.A=Convert.ToByte(txtLineAlpha.Text);
lineColor.B=Convert.ToByte(txtLineBlue.Text);
lineColor.G=Convert.ToByte(txtLineGreen.Text);
lineColor.R=Convert.ToByte(txtLineRed.Text);
Polygon poly = new Polygon();
poly.DataSourceName = "MyDataSource";
poly.EntityID = "MyEntityID";
poly.BorderColor=lineColor;
poly.FillColor=fillColor;
// Set the MapSpecification.Polygons property to the polygon array.
spec.Polygons = new Polygon[1];
spec.Polygons[0] = poly;
//Call the RenderServiceSoap.GetMap method.
MapImage[] mi = render.GetMap(spec);
pictMap.Image = new Bitmap(new System.IO.MemoryStream(mi[0].MimeData.Bits));
See Also
MapSpecification Class | Polygon Class | Working With Polygons