zoukankan      html  css  js  c++  java
  • 判断多边形是否为环或者是眼睛的方法

    Private Sub UIButtonControl2_Click()

    Dim app As IApplication
    Set app = Application

    Dim pMxDocument As IMxDocument
    Set pMxDocument = Application.Document

    Dim pMap As IMap
    Set pMap = pMxDocument.FocusMap

    Dim pFeatureLayer As IFeatureLayer
    Set pFeatureLayer = pMap.Layer(0)

    Dim pFeatureCursor As IFeatureCursor
    Set pFeatureCursor = pFeatureLayer.FeatureClass.Search(Nothing, False)

    Dim pFeature As IFeature
    Set pFeature = pFeatureCursor.NextFeature

    Dim pPolygon As IPolygon
    Dim geocollection As IGeometryCollection
    Dim pRing As IRing
    Dim inringcount As Integer

    While Not pFeature Is Nothing
    Set pPolygon = pFeature.Shape
    Set geocollection = pPolygon

      If geocollection.GeometryCount > 1 Then
      inringcount = inringcount + 1
      pMap.SelectFeature pFeatureLayer, pFeature
      End If

     ' If pPolygon.ExteriorRingCount > 1 Then
      'pMap.SelectFeature pFeatureLayer, pFeature
     ' End If
     
     ' If pPolygon.ExteriorRingCount = 1 Then
     ' Set pPointCollection = pPolygon
     ' Set pRing = pPointCollection
     ' inringcount = pPolygon.InteriorRingCount(pRing)
     ' If inringcount > 0 Then
     ' pMap.SelectFeature pFeatureLayer, pFeature
     ' End If
     ' End If

    Set pFeature = pFeatureCursor.NextFeature
    Wend

    Dim pActiveview As iactiveview
    Set pActiveview = pMap
    pActiveview.Refresh
    MsgBox "一共有" & inringcount & "个不规则多边形"

    End Sub
  • 相关阅读:
    JDBC事务
    JDBC连接池和DBUtils
    原生JDBC
    基本的查询语句
    多表查询
    mysql单表
    基础加强_XML
    基础加强_注解_类加载器_动态代理
    页面加载loading动画
    移动端手动控制页面高度
  • 原文地址:https://www.cnblogs.com/zhangjun1130/p/1629166.html
Copyright © 2011-2022 走看看