/// <summary> /// Creates line sections along this face. /// </summary> /// <param name="parentLine">The line that is being subdivided</param> /// <param name="ff">Factory for producing new features (the important thing /// is the editing operation that's involved).</param> /// <param name="isTopological">Should the sections be tagged as polygon boundaries?</param> internal void CreateSections(LineFeature parentLine, FeatureFactory ff, bool isTopological) { // Must have at least two distances if (m_Distances == null) { throw new ArgumentNullException(); } if (m_Distances.Length < 2) { throw new ArgumentException(); } m_Sections = new List <LineFeature>(m_Distances.Length); PointFeature start = parentLine.StartPoint; InternalIdValue item = new InternalIdValue(ff.Creator.EditSequence); for (int i = 0; i < m_Distances.Length; i++) { PointFeature end; if (i == m_Distances.Length - 1) { end = parentLine.EndPoint; } else { item.ItemSequence++; end = ff.CreatePointFeature(item.ToString()); } item.ItemSequence++; LineFeature line = ff.CreateSection(item.ToString(), parentLine, start, end); line.ObservedLength = m_Distances[i]; if (!isTopological) { line.SetTopology(false); } m_Sections.Add(line); start = end; } }
/// <summary> /// Creates spatial features (points and lines) for this face. The created /// features don't have any geometry. /// </summary> /// <param name="ff">The factory for creating new spatial features</param> /// <param name="startPoint">The point (if any) at the start of this leg. May be /// null in a situation where the preceding leg ended with an "omit point" directive.</param> /// <param name="lastPoint">The point that should be used for the very end /// of the leg (specify null if a point should be created at the end of the leg).</param> internal void CreateFeatures(FeatureFactory ff, PointFeature startPoint, PointFeature lastPoint) { PointFeature from = startPoint; PointFeature to = null; // The initial item sequence relates to the face itself. The first feature along the face will // have a sequence number one higher. uint maxSequence = this.Sequence.ItemSequence; int nSpan = m_Spans.Length; for (int i = 0; i < nSpan; i++, from = to) { SpanInfo span = GetSpanData(i); // If we have an end point, add it (so long as this span is not // at the very end of the connection path). to = null; maxSequence++; if (span.HasEndPoint) { if (i == (nSpan - 1)) { to = lastPoint; } if (to == null) { to = ff.CreatePointFeature(maxSequence.ToString()); } Debug.Assert(to != null); } // A line can only exist if both end points are defined (the "omit point" // directive may well be used to finish a leg without a point, so the first // span in the next leg can't have a line). maxSequence++; if (span.HasLine && from != null) { LineFeature line = this.Leg.CreateLine(ff, maxSequence.ToString(), from, to); line.ObservedLength = span.ObservedDistance; // Alternate faces should by non-topological. And mark as "void" so that it can be // skipped on export to AutoCad. if (FaceNumber == 2) { line.SetTopology(false); // should probably be false already line.IsVoid = true; } span.CreatedFeature = line; } else { span.CreatedFeature = to; } } }