//调用 
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; 

最新文章

  1. Java 使用线程方式Thread和Runnable,以及Thread与Runnable的区别
  2. nginx 与 tomcat 集群 一二事 (0) - 简单介绍
  3. 分析器错误消息: 类型“test.test.testx”不明确: 它可能来自程序集“F:\testProject\bin\test.test.DLL”或程序集“F:\testProject\bin \testProject.DLL”。请在类型名称中显式指定程序集。
  4. hdf第二周,每天加班,周末加班,周日健身
  5. 第十篇、微信小程序-view组件
  6. OGRE1.8.1源码编译(VS2008)
  7. RHEL6彻底禁用ip6的方法
  8. NotePad++ 快捷键中文说明
  9. UNIX网络编程——心跳包
  10. 总结:当静态路由和BGP同时存在时路由优选BGP的两种方法
  11. 解题(Solution -4Sum)
  12. nginx的rewrite ,如何在flask项目中获取重写前的url
  13. 用dbexpress连接sqlserver数据库
  14. bzoj1014 火星人 (hash+splay+二分答案)
  15. 华为交换机有关BGP的相关配置
  16. UML和模式应用4:初始阶段(6)--迭代方法中如何使用用例
  17. iOS - DNS劫持
  18. remote staging type or host is not specified
  19. JavaWeb项目学习教程(1) 准备阶段
  20. Daily Scrum7 11.11

热门文章

  1. 【转载】美国人教你这样用Google
  2. luogu2293 [JSOI2008]Blue Mary开公司
  3. 24、AES RSA加密处理记录
  4. 0014.Linux环境搭建 Python环境搭建
  5. HTTP LVS
  6. XDEBUG 远程调试
  7. Bootstrap-table custome-ajax用法
  8. Stack&Vector源码分析 jdk1.6
  9. 如何使用Python的logging模块
  10. BZOJ3991 [SDOI2015]寻宝游戏 【dfs序 + lca + STL】