本文整理汇总了C#中Geometry.SetPolyLine方法的典型用法代码示例。如果您正苦于以下问题:C# Geometry.SetPolyLine方法的具体用法?C# Geometry.SetPolyLine怎么用?C# Geometry.SetPolyLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry.SetPolyLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawLine
/**
* 绘制折线,该折线状态随地图状态变化
* @return 折线对象
*/
public Graphic DrawLine()
{
double mLat = 39.97923;
double mLon = 116.357428;
int lat = (int)(mLat * 1E6);
int lon = (int)(mLon * 1E6);
GeoPoint pt1 = new GeoPoint(lat, lon);
mLat = 39.94923;
mLon = 116.397428;
lat = (int)(mLat * 1E6);
lon = (int)(mLon * 1E6);
GeoPoint pt2 = new GeoPoint(lat, lon);
mLat = 39.97923;
mLon = 116.437428;
lat = (int)(mLat * 1E6);
lon = (int)(mLon * 1E6);
GeoPoint pt3 = new GeoPoint(lat, lon);
//构建线
Geometry lineGeometry = new Geometry();
//设定折线点坐标
GeoPoint[] linePoints = new GeoPoint[3];
linePoints[0] = pt1;
linePoints[1] = pt2;
linePoints[2] = pt3;
lineGeometry.SetPolyLine(linePoints);
//设定样式
Symbol lineSymbol = new Symbol();
Symbol.Color lineColor = new Com.Baidu.Mapapi.Map.Symbol.Color(lineSymbol);
lineColor.Red = 255;
lineColor.Green = 0;
lineColor.Blue = 0;
lineColor.Alpha = 255;
lineSymbol.SetLineSymbol(lineColor, 10);
//生成Graphic对象
Graphic lineGraphic = new Graphic(lineGeometry, lineSymbol);
return lineGraphic;
}