if (mapMode == MapMode.Distance) //如果是测量距离
{
if (Pins != null && Pins.Length > 0)
{
DPoint dPoint1 = positionTransform.ToMapLocation(Pins[Pins.Length - 1].Longitude, Pins[Pins.Length - 1].Latitude);
DPoint dPoint2;
//将显示坐标转为地图坐标
transForm.FromDisplay(mouseCurrentPosition, out dPoint2);
distance = mainCs.Distance(DistanceType.Cartesian, DistanceUnit.Mile, dPoint1, dPoint2);
//System.Drawing.Graphics graphics;
//System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);
//graphics.DrawLine(pen,Pins[Pins.Length - 1].DisplayPosition,mouseCurrentPosition);
DPoint[] points = new DPoint[2];
points[0] = dPoint1;
points[1] = dPoint2;
if (distanceKey != null)
{
this.Invoke(new DeleteFeatureDelegate(pinTable.DeleteFeature), new object[] { distanceKey });
distanceKey = null;
}
Feature f = new Feature(new MultiCurve(mainCs, CurveSegmentType.Linear, points), lineStyle);
distanceKey = (Key)this.Invoke(new InsertFeatureDelegate(pinTable.InsertFeature), new object[] { f });
label_distance.Text = "总距离:" + aDistance.ToString() + "米 " + "当前距离:" + distance.ToString() + "米";
} }问题已经搞定 希望对来看的兄弟有用 多多指点
{
if (Pins != null && Pins.Length > 0)
{
DPoint dPoint1 = positionTransform.ToMapLocation(Pins[Pins.Length - 1].Longitude, Pins[Pins.Length - 1].Latitude);
DPoint dPoint2;
//将显示坐标转为地图坐标
transForm.FromDisplay(mouseCurrentPosition, out dPoint2);
distance = mainCs.Distance(DistanceType.Cartesian, DistanceUnit.Mile, dPoint1, dPoint2);
//System.Drawing.Graphics graphics;
//System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Black, 2);
//graphics.DrawLine(pen,Pins[Pins.Length - 1].DisplayPosition,mouseCurrentPosition);
DPoint[] points = new DPoint[2];
points[0] = dPoint1;
points[1] = dPoint2;
if (distanceKey != null)
{
this.Invoke(new DeleteFeatureDelegate(pinTable.DeleteFeature), new object[] { distanceKey });
distanceKey = null;
}
Feature f = new Feature(new MultiCurve(mainCs, CurveSegmentType.Linear, points), lineStyle);
distanceKey = (Key)this.Invoke(new InsertFeatureDelegate(pinTable.InsertFeature), new object[] { f });
label_distance.Text = "总距离:" + aDistance.ToString() + "米 " + "当前距离:" + distance.ToString() + "米";
} }问题已经搞定 希望对来看的兄弟有用 多多指点
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货