01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | '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 Next If TypeOf pseg(0) Is ICircularArc Then Debug.Print "CircularArc" ElseIf TypeOf pseg(0) Is ILine Then Debug.Print "Line" End If Exit Sub ErrorHandler: MsgBox Err.Description End Sub |
Densify の利用
2016/9/1 (木)