Skip to content

Commit f3fe620

Browse files
committed
新增绘制时吸附到最近的结点的功能
1 parent e8310dd commit f3fe620

File tree

7 files changed

+336
-91
lines changed

7 files changed

+336
-91
lines changed

MapBoard.Core/Util/GeometryUtility.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,5 +405,37 @@ public static MapPoint CalculateEndingGlobalCoordinates(MapPoint start, Angle st
405405
//endBearing.Radians = alpha2;
406406
return new MapPoint(longitude.Degrees, latitude.Degrees, SpatialReferences.Wgs84);
407407
}
408+
/// <summary>
409+
/// 获取一个图形的所有结点
410+
/// </summary>
411+
/// <param name="geometry"></param>
412+
/// <returns></returns>
413+
/// <exception cref="ArgumentException"></exception>
414+
public static IEnumerable<MapPoint> GetPoints(this Geometry geometry)
415+
{
416+
switch (geometry)
417+
{
418+
case MapPoint point:
419+
yield return point;
420+
break;
421+
case Multipoint multipoint:
422+
foreach (var point in multipoint.Points)
423+
{
424+
yield return point;
425+
}
426+
break;
427+
case Multipart multipart:
428+
foreach (var part in multipart.Parts)
429+
{
430+
foreach (var point in part.Points)
431+
{
432+
yield return point;
433+
}
434+
}
435+
break;
436+
default:
437+
throw new ArgumentException("不支持的Geometry类型");
438+
}
439+
}
408440
}
409441
}

MapBoard.UI/Mapping/EditMode.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace MapBoard.Mapping
2+
{
3+
public enum EditMode
4+
{
5+
None,
6+
Creat,
7+
Edit,
8+
GetGeometry,
9+
MeasureLength,
10+
MeasureArea
11+
}
12+
}

0 commit comments

Comments
 (0)