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



  • 相关阅读:
    windows下安装rabbitmq
    selectors
    修改Docker默认镜像和容器的存储位置
    eclipse配置jdk的src.zip源代码步骤
    Zookeeper WINDOWS 安装配置
    zookeeper windows 入门安装和测试
    zookeeper集群搭建(windows环境下)
    ant使用指南详细入门教程
    linux查看系统版本和系统位数
    suse linux 命令
  • 原文地址:https://www.cnblogs.com/lauer0246/p/1287401.html
Copyright © 2011-2022 走看看