ArcGIS Pro SDK (九)几何 8 线段

ArcGIS Pro SDK (九)几何 8 线段

文章目录

  • [ArcGIS Pro SDK (九)几何 8 线段](#ArcGIS Pro SDK (九)几何 8 线段)
    • [1 使用两个地图点构造线段](#1 使用两个地图点构造线段)
    • [2 更改线段坐标](#2 更改线段坐标)

环境:Visual Studio 2022 + .NET6 + ArcGIS Pro SDK 3.0

1 使用两个地图点构造线段

csharp 复制代码
// 使用 builderEx 的便捷方法或使用 builderEx 构造函数。

MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0);
MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 1.0);

// BuilderEx 的便捷方法不需要在 MCT 上运行。
LineSegment lineFromMapPoint = LineBuilderEx.CreateLineSegment(startPt, endPt);

// coordinate2D
Coordinate2D start2d = (Coordinate2D)startPt;
Coordinate2D end2d = (Coordinate2D)endPt;

LineSegment lineFromCoordinate2D = LineBuilderEx.CreateLineSegment(start2d, end2d);

// coordinate3D
Coordinate3D start3d = (Coordinate3D)startPt;
Coordinate3D end3d = (Coordinate3D)endPt;

LineSegment lineFromCoordinate3D = LineBuilderEx.CreateLineSegment(start3d, end3d);

// lineSegment
LineSegment anotherLineFromLineSegment = LineBuilderEx.CreateLineSegment(lineFromCoordinate3D);


// builderEx 的构造函数不需要在 MCT 上运行
LineBuilderEx lbEx = new LineBuilderEx(startPt, endPt);
lineFromMapPoint = lbEx.ToSegment() as LineSegment;

lbEx = new LineBuilderEx(start2d, end2d);
lineFromCoordinate2D = lbEx.ToSegment() as LineSegment;

lbEx = new LineBuilderEx(start3d, end3d);
lineFromCoordinate3D = lbEx.ToSegment() as LineSegment;

lbEx = new LineBuilderEx(startPt, endPt);
lineFromMapPoint = lbEx.ToSegment() as LineSegment;

lbEx = new LineBuilderEx(lineFromCoordinate3D);
anotherLineFromLineSegment = lbEx.ToSegment() as LineSegment;

2 更改线段坐标

csharp 复制代码
// builderEx 的构造函数不需要在 MCT 上运行
LineBuilderEx lbuilderEx = new LineBuilderEx(lineSegment);
// 查找现有的坐标
lbuilderEx.QueryCoords(out startPt, out endPt);

// 或者使用
//startPt = lbuilderEx.StartPoint;
//endPt = lbuilderEx.EndPoint;

// 更新坐标
lbuilderEx.SetCoords(GeometryEngine.Instance.Move(startPt, 10, 10) as MapPoint, GeometryEngine.Instance.Move(endPt, -10, -10) as MapPoint);

// 或者使用
//lbuilderEx.StartPoint = GeometryEngine.Instance.Move(startPt, 10, 10) as MapPoint;
//lbuilderEx.EndPoint = GeometryEngine.Instance.Move(endPt, -10, -10) as MapPoint;

LineSegment segment2 = lbuilderEx.ToSegment() as LineSegment;
相关推荐
勘察加熊人1 小时前
forms实现俄罗斯方块
c#
supermapsupport3 小时前
SuperMap GIS基础产品FAQ集锦(20250402)
gis·supermap·webgis·idesktopx·iclient3d
艾妮艾妮5 小时前
C语言常见3种排序
java·c语言·开发语言·c++·算法·c#·排序算法
小码编匠5 小时前
.NET 验证码生成神器基于 SkiaSharp 的高性能方案
后端·c#·.net
专注VB编程开发20年5 小时前
Aspose.words,Aspose.cells,vb.net,c#加载许可证,生成操作选择:嵌入的资源
c#·word·.net·vb.net
andy55206 小时前
.NET 使用 WMQ 连接Queue 发送 message 实例
xml·c#·wmq·c# 连接wmq·发送消息到wmq
破罐子不摔6 小时前
【C#使用S7.NET库读取和写入西门子PLC变量】
java·c#·.net
杰尼杰尼丶6 小时前
Winform MQTT客户端连接方式
c#·winform
weixin_307779137 小时前
C#实现HiveQL建表语句中特殊数据类型的包裹
开发语言·数据仓库·hive·c#
lixy5797 小时前
C# WPF 命令机制(关闭CanExecute自动触发,改手动)
c#·wpf