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



  • 相关阅读:
    各系统添加根证书
    Nginx浏览目录配置及美化
    django-图形验证码(django-simple-captcha)
    django-manage.py参数
    js — 对象
    js — 数组Array
    js — 字符串
    js — 基础知识
    css — 定位、背景图、水平垂直居中
    css — 权重、继承性、排版、float
  • 原文地址:https://www.cnblogs.com/lauer0246/p/1287401.html
Copyright © 2011-2022 走看看