各区画セグメントは、区画セグメント要素の集まりです。これらの要素は、基本クラス AeccParcelSegmentElement から派生したオブジェクトによって表されます。 セグメント要素は、セグメントの分割されていない部分で、区画を作成するために使用できます。要素が別の区画セグメントと交差している場合、その要素は 2 つの連続する要素に分割されます。
Dim oSegments as AeccParcelSegments Set oSegments = oSite.ParcelSegments Dim oSegment1 as AeccParcelSegment ' Segment1 consists of 1 element, a line with endpoints ' at 500,100 to 600,100 Set oSegment1 = oSegments.AddLine(500, 100, 600, 100) ' We can tell this by looking at the number of elements: Debug.Print oSegment1.Count ' returns 1 ' If we cross the segment element with another segment, ' then the elements get split. Call oSegments.AddLine(550, 150, 550, 50) Debug.Print oSegment1.Count ' returns 2
AeccParcelSegment.Item メソッドは、AeccParcelSegmentElement 型のオブジェクトとして各要素を返します。このオブジェクトは Type プロパティを備えていないため、それが表す要素のタイプを知るには、TypeOf 演算子を使用してオブジェクト タイプを直接チェックする必要があります。
' Loop through all elements of the parcel segment "oSegment" Dim i as Integer For i = 0 to oSegment.Count - 1 Dim oElement As AeccParcelSegmentElement Set oElement = oSegment.Item(i) Debug.Print "Element " & i & ": " _ & oElement.StartX & "," & oElement.StartY & " to " _ & oElement.EndX & ", " & oElement.EndY If (TypeOf oElement Is AeccParcelSegmentLine) Then Dim oSegmentLine As AeccParcelSegmentLine Set oSegmentLine = oElement Debug.Print " is a line. " ElseIf (TypeOf oElement Is AeccParcelSegmentCurve) Then Dim oSegmentCurve As AeccParcelSegmentCurve Set oSegmentCurve = oElement Debug.Print " is a curve with a radius of:" _ & oSegmentCurve.Radius End If Next i