zoukankan      html  css  js  c++  java
  • 合并要素how to use "ConstructUnion"

    合并要素--how to use "ConstructUnion"

     参考:http://forums.esri.com/Thread.asp?c=93&f=1170&t=80838

     The following VBA macro creates a graphic element that is the union of all selected polygons in the map. The union is constructed using a geometry bag.

    Sub UnionFeatures()

    Dim pMxDoc As IMxDocument

    Dim pEnumFeature As IEnumFeature

    Dim pFeature As IFeature

    Dim pGeoBag As IGeometryBag

    Dim pGeoCollection As IGeometryCollection

    Dim pTopoOp As ITopologicalOperator2

    Dim pPolygon As IPolygon

    Dim pPolygonElement As IPolygonElement

    Dim pElement As IElement

    Dim pGC As IGraphicsContainer



    Set pMxDoc = ThisDocument

    Set pEnumFeature = pMxDoc.FocusMap.FeatureSelection

    pEnumFeature.Reset

    Set pGeoBag = New GeometryBag

    Set pGeoCollection = pGeoBag



    Set pFeature = pEnumFeature.Next

    Do While Not pFeature Is Nothing

    If pFeature.Shape.GeometryType = esriGeometryPolygon Then

    Set pTopoOp = pFeature.ShapeCopy

    pTopoOp.IsKnownSimple = False

    pTopoOp.Simplify

    pGeoCollection.AddGeometry pTopoOp

    End If



    Set pFeature = pEnumFeature.Next

    Loop



    Set pTopoOp = New Polygon

    pTopoOp.ConstructUnion pGeoBag

    Set pPolygon = pTopoOp

    Set pGC = pMxDoc.FocusMap

    Set pPolygonElement = New PolygonElement

    Set pElement = pPolygonElement

    pElement.Geometry = pPolygon

    pGC.AddElement pElement, 0

    pMxDoc.ActiveView.Refresh

    End Sub



  • 相关阅读:
    STM32F746G-DISCO官方例程烧写
    zedboard学习第一篇
    itop4412开发板添加开机启动程序
    dsp6657的串口学习
    开源SLAM
    非线性滤波(信号处理)
    图形学领域的关键算法及源码链接
    基于倾斜影像的城市三维场景重建
    基于RFID恢复信号场
    对“自然语言处理”的理解
  • 原文地址:https://www.cnblogs.com/lauer0246/p/1287401.html
Copyright © 2011-2022 走看看