Engine中如何截取线上指定两点间的线段?
2024-08-26 03:22:16
//调用
IPolyline newLine = GetSubCurve(polyline, p1, p2); ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = axMapControl1.ActiveView.ScreenDisplay;
screenDisplay.StartDrawing(screenDisplay.hDC, System.Convert.ToInt16(ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache));
IRgbColor rgbColor = new RgbColorClass();
rgbColor.Red = 255;
ESRI.ArcGIS.Display.IColor color = rgbColor; // Implicit Cast
ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
simpleLineSymbol.Color = color;
ESRI.ArcGIS.Display.ISymbol symbol = (ESRI.ArcGIS.Display.ISymbol)simpleLineSymbol; // Explicit Cast
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolyline(newLine);
screenDisplay.FinishDrawing(); private IPolyline GetSubCurve(IPolyline inpolyLine, IPoint pnt1, IPoint pnt2)
{
double d1 = GetDistAlong(inpolyLine, pnt1);
double d2 = GetDistAlong(inpolyLine, pnt2); var c = inpolyLine as ICurve;
ICurve outCurve;
c.GetSubcurve(d1, d2, false, out outCurve);
if (c == null || c.IsEmpty)
throw new Exception(fail);
var outPolyline = outCurve as IPolyline;
if (outPolyline == null)
{
outPolyline = new PolylineClass() as IPolyline;
var sc = outPolyline as ISegmentCollection;
sc.AddSegment((ISegment)outCurve);
((IGeometry)sc).SpatialReference = outCurve.SpatialReference;
}
return outPolyline;
} private double GetDistAlong(IPolyline polyLine, IPoint pnt)
{
var outPnt = new PointClass() as IPoint;
double distAlong = double.NaN;
double distFrom = double.NaN;
bool bRight = false;
polyLine.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pnt, false, outPnt,
ref distAlong, ref distFrom, ref bRight);
return distAlong;
}
最新文章
- Java 使用线程方式Thread和Runnable,以及Thread与Runnable的区别
- nginx 与 tomcat 集群 一二事 (0) - 简单介绍
- 分析器错误消息: 类型“test.test.testx”不明确: 它可能来自程序集“F:\testProject\bin\test.test.DLL”或程序集“F:\testProject\bin \testProject.DLL”。请在类型名称中显式指定程序集。
- hdf第二周,每天加班,周末加班,周日健身
- 第十篇、微信小程序-view组件
- OGRE1.8.1源码编译(VS2008)
- RHEL6彻底禁用ip6的方法
- NotePad++ 快捷键中文说明
- UNIX网络编程——心跳包
- 总结:当静态路由和BGP同时存在时路由优选BGP的两种方法
- 解题(Solution -4Sum)
- nginx的rewrite ,如何在flask项目中获取重写前的url
- 用dbexpress连接sqlserver数据库
- bzoj1014 火星人 (hash+splay+二分答案)
- 华为交换机有关BGP的相关配置
- UML和模式应用4:初始阶段(6)--迭代方法中如何使用用例
- iOS - DNS劫持
- remote staging type or host is not specified
- JavaWeb项目学习教程(1) 准备阶段
- Daily Scrum7 11.11