Densify の利用

投稿日:2016/9/1 (木) 更新日:

'That sub demonstrates how to use the ISegment::Densify method
Private Sub Densify()
  On Error GoTo ErrorHandler
    Dim ptCenter As IPoint, ptcfromto As IPoint
    Dim psegment As ISegment, pseg() As ILine
    Dim lout As Long, i As Long, pcarc As ICircularArc
    Dim ii As Long
    'Create a new closed Circular Arc segment
    Set ptCenter = New esriGeometry.Point
    ptCenter.PutCoords 0, 0
    Set ptcfromto = New esriGeometry.Point
    ptcfromto.PutCoords 10, 10
    Set pcarc = New CircularArc
    pcarc.PutCoords ptCenter, ptcfromto, ptcfromto, esriArcClockwise
    Set psegment = pcarc 'QI to ISegment
        If TypeOf psegment Is ICircularArc Then
        Debug.Print "CircularArc"
    ElseIf TypeOf psegment Is ILine Then
        Debug.Print "Line"
    End If
    'Call densify
    'cInSlots: 100, tells the method the number of input segments
    'maxDeviation: 0.1, tells the method that the segment must not further
    '                    a part from that distance from the curve
    'pcOutSegments: lout, Output parameter returning the the number of segments created
    'segments: pseg, pass in the first element of the array, that array
    '               will contain the output segments
    psegment.Densify 100, 0.1, lout, pseg(0)
    Debug.Print "The pseg array contains : " & lout & " segments"
    For ii = 0 To lout - 1
      Debug.Print pseg(ii).Length
    If TypeOf pseg(0) Is ICircularArc Then
        Debug.Print "CircularArc"
    ElseIf TypeOf pseg(0) Is ILine Then
        Debug.Print "Line"
    End If
  Exit Sub
  MsgBox Err.Description
End Sub


-プログラミング, ArcGIS
-, ,

Copyright© WINGFIELD since1981 , 2019 All Rights Reserved.