获取断面线的范围

 

参考代码

   1: //获取绘制要素的整体范围
   2: IEnumElement pEnumElem;
   3: IGraphicsContainer graphicsContainer = pMap as IGraphicsContainer;
   4: IGraphicsContainerSelect pGraphicsContainerSelect = pMap as IGraphicsContainerSelect;
   5: pGraphicsContainerSelect.SelectAllElements();
   6: pEnumElem = pGraphicsContainerSelect.SelectedElements;
   7: IElement ele = pEnumElem.Next();
   8: IEnvelope env = new EnvelopeClass();
   9: while (ele != null)
  10: {
  11:     IGeometry geo = ele.Geometry;
  12:     ele = pEnumElem.Next();
  13:     env.Union(geo.Envelope);
  14: }
  15: pActiveView.Extent = env;
  16: pGraphicsContainerSelect.UnselectAllElements();

最后获取的env就是所需要的公共外接矩形。

 

 

 

 

参考文章:

获取IMap上绘制的Element的区域范围

posted @ 2017-04-12 15:53  wenglabs  阅读(247)  评论(0编辑  收藏  举报