如何实现几何要素的剪切

如何实现几何要素的剪切

 

 IFeatureEdit Example

‘Assume pSet (ISet) and pMoveVector (ILine) already exist.
Dim pUnknown As IUnknown, pFeatureEdit As IFeatureEdit
Set pUnknown = pSet.Next

Do While pUnknown Is Not Nothing
  Set pFeatureEdit = pUnknown
  pFeatureEdit.MoveSet pSet, pMoveVector
  Set pUnknown = pSet.Next
Loop

The following code is an example of one way you could split a selected polygon features by a polyline.

Public Sub SplitFeatures(pSelectionSet As ISelectionSet, pPolyLine As IPolyline)

‘ open a feature cursor on the selected features that
‘ intersect the splitting geometry
Dim pFeatCursor As IFeatureCursor
Dim pSpatialFilter As ISpatialFilter
Set pSpatialFilter = New SpatialFilter
Set pSpatialFilter.Geometry = pPolyLine
pSelectionSet.Search pSpatialFilter, True, pFeatCursor

‘ Clean up the splitting geometry
‘ This is necessary because, for polygons, IFeatureEdit::Split
‘ relies internally on ITopologicalOperator::Cut
Dim pTopoOpo As ITopologicalOperator
Set pTopoOpo = pPolyLine
pTopoOpo.Simplify

‘ Loop through the features and split them
Dim pFeature As IFeature
Set pFeature = pFeatCursor.NextFeature

Do Until pFeature Is Nothing
  Dim pFeatureEdit As IFeatureEdit
  Set pFeatureEdit = pFeature
  pFeatureEdit.Split pPolyLine
  Set pFeature = pFeatCursor.NextFeature
Loop

End Sub

 

 

 

 

 

 

转载于:https://www.cnblogs.com/lauer0246/archive/2008/09/09/1287393.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值