本文整理汇总了C#中Geometry.SetPolygon方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.SetPolygon方法的具体用法?C# Geometry.SetPolygon怎么用?C# Geometry.SetPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.SetPolygon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawPolygon
/**
* 绘制多边形,该多边形随地图状态变化
* @return 多边形对象
*/
public Graphic DrawPolygon()
{
double mLat = 39.93923;
double mLon = 116.357428;
int lat = (int)(mLat * 1E6);
int lon = (int)(mLon * 1E6);
GeoPoint pt1 = new GeoPoint(lat, lon);
mLat = 39.91923;
mLon = 116.327428;
lat = (int)(mLat * 1E6);
lon = (int)(mLon * 1E6);
GeoPoint pt2 = new GeoPoint(lat, lon);
mLat = 39.89923;
mLon = 116.347428;
lat = (int)(mLat * 1E6);
lon = (int)(mLon * 1E6);
GeoPoint pt3 = new GeoPoint(lat, lon);
mLat = 39.89923;
mLon = 116.367428;
lat = (int)(mLat * 1E6);
lon = (int)(mLon * 1E6);
GeoPoint pt4 = new GeoPoint(lat, lon);
mLat = 39.91923;
mLon = 116.387428;
lat = (int)(mLat * 1E6);
lon = (int)(mLon * 1E6);
GeoPoint pt5 = new GeoPoint(lat, lon);
//构建多边形
Geometry polygonGeometry = new Geometry();
//设置多边形坐标
GeoPoint[] polygonPoints = new GeoPoint[5];
polygonPoints[0] = pt1;
polygonPoints[1] = pt2;
polygonPoints[2] = pt3;
polygonPoints[3] = pt4;
polygonPoints[4] = pt5;
polygonGeometry.SetPolygon(polygonPoints);
//设置多边形样式
Symbol polygonSymbol = new Symbol();
Symbol.Color polygonColor = new Com.Baidu.Mapapi.Map.Symbol.Color(polygonSymbol);
polygonColor.Red = 0;
polygonColor.Green = 0;
polygonColor.Blue = 255;
polygonColor.Alpha = 126;
polygonSymbol.SetSurface(polygonColor, 1, 5);
//生成Graphic对象
Graphic polygonGraphic = new Graphic(polygonGeometry, polygonSymbol);
return polygonGraphic;
}