Arcengine中IEnvelope为IPolygon

IEnvelope为IPolygon//by yl 2003.05.10

function EnvToPoly(pEnv: IEnvelope): IPolygon;

var

    pPointsColl                         : IPointCollection;

    P1, P2, p3, p4                      : IPoint;

    pTopo                               : ITopologicalOperator;

begin

    pPointsColl := CoPolygon.Create as IPointCollection;

 

    pEnv.Get_LowerLeft(P1);

    pEnv.Get_UpperLeft(P2);

    pEnv.Get_UpperRight(p3);

    pEnv.Get_LowerRight(p4);

    pPointsColl.AddPoints(1, P1);

    pPointsColl.AddPoints(1, P2);

    pPointsColl.AddPoints(1, p3);

    pPointsColl.AddPoints(1, p4);

    pTopo := pPointsColl as ITopologicalOperator;

    pTopo.Simplify();

 

    result := pPointsColl as IPolygon;

 

end;

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ArcEngine使用Select Elements选择布局的元素的步骤如下: 1. 获取PageLayoutControl对象。 2. 创建一个新的SelectionEnvironment对象,并设置选择条件、符号等属性。 3. 调用PageLayoutControl的ClearSelection方法,清空当前选择集。 4. 调用PageLayoutControl的SelectByPoint或SelectByRectangle等方法,根据指定的位置或范围选择元素。 5. 遍历PageLayoutControl的Selection集合,获取所选元素的ID号和类型。 6. 根据ID号和类型获取元素对象,执行相应操作。 以下是一个示例代码: ```C# // 获取PageLayoutControl对象 ESRI.ArcGIS.Controls.AxPageLayoutControl pageLayoutControl = this.axPageLayoutControl1; // 创建SelectionEnvironment对象 ESRI.ArcGIS.Carto.ISelectionEnvironment selectionEnv = new ESRI.ArcGIS.Carto.SelectionEnvironmentClass(); selectionEnv.CombinationMethod = ESRI.ArcGIS.Carto.esriSelectionResultEnum.esriSelectionResultNew; selectionEnv.SelectionColor = GetRGBColor(255, 0, 0); // 设置选择符号颜色 // 清空当前选择集 pageLayoutControl.ActiveView.GraphicsContainer.DeleteAllElements(); pageLayoutControl.ActiveView.PartialRefresh(ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGraphics, null, null); // 创建选择范围并进行选择 ESRI.ArcGIS.Geometry.IEnvelope env = new ESRI.ArcGIS.Geometry.EnvelopeClass(); env.PutCoords(x1, y1, x2, y2); // 设置选择范围 pageLayoutControl.ActiveView.GraphicsContainer.SelectElementsWithinBox(env, false, selectionEnv); // 遍历选择集合并获取元素对象 ESRI.ArcGIS.Carto.IEnumElement enumElement = pageLayoutControl.ActiveView.GraphicsContainer.SelectedElements; ESRI.ArcGIS.Carto.IElement element; enumElement.Reset(); while ((element = enumElement.Next()) != null) { // 根据ID号和类型获取元素对象并执行操作 int elementID = element.ID; Type elementType = element.GetType(); // 执行操作 // ... } ``` 在上述代码,首先获取PageLayoutControl对象,并创建SelectionEnvironment对象,设置选择条件。然后调用PageLayoutControl的ClearSelection方法,清空当前选择集。接着创建选择范围,使用PageLayoutControl的SelectElementsWithinBox方法进行选择。最后遍历选择集合,根据ID号和类型获取元素对象,并执行相应操作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值