/// <summary> /// Creates a new <see cref="LineFeature"/> using the session sequence number /// that was previously recorded via a call to <see cref="AddFeatureDescription"/>. /// <para/> /// Only the session sequence number will be used when creating the section (any /// entity type and feature ID that may have been presented through <see cref="AddFeatureDescription"/> /// will be ignored - the values from the parent line will be applied instead). /// </summary> /// <param name="field">The name for the item involved (must refer to information /// previously attached via a call to <see cref="AddFeatureDescription"/>)</param> /// <param name="baseLine">The line that's being subdivided</param> /// <param name="from">The point at the start of the section (not null).</param> /// <param name="to">The point at the end of the section (not null).</param> /// <returns>The created feature (null if a feature description was not previously added)</returns> /// <exception cref="InvalidOperationException">If information for the item has not been /// attached to this factory.</exception> LineFeature MakeSection(DataField field, LineFeature baseLine, PointFeature from, PointFeature to) { IFeature f = FindFeatureDescription(field.ToString()); if (f == null) { throw new InvalidOperationException(); } SectionGeometry section = new SectionGeometry(baseLine, from, to); return(baseLine.MakeSubSection(m_Operation, f.InternalId, section)); }
IRing GetRing(Ring r) { CurveSegmentCollection csc = new CurveSegmentCollection(); foreach (IDivider d in r.Edge) { LineGeometry line = d.LineGeometry; ICurveSegmentAbstract cseg = null; if (line is SectionGeometry) { SectionGeometry section = (line as SectionGeometry); line = section.Make(); } if (line is MultiSegmentGeometry) { MultiSegmentGeometry mseg = (line as MultiSegmentGeometry); DirectPositionCollection dpc = GetDirectPositions(mseg.Data); cseg = m_Factory.CreateLineStringSegment(dpc); } else if (line is SegmentGeometry) { SegmentGeometry segment = (line as SegmentGeometry); DirectPositionCollection dpc = GetDirectPositions(new IPosition[] { segment.Start, segment.End }); cseg = m_Factory.CreateLineStringSegment(dpc); } else if (line is ArcGeometry) { ArcGeometry arc = (line as ArcGeometry); IPosition mp = arc.GetMidPosition(); IDirectPosition bc = m_Factory.CreatePositionXY(arc.BC.X, arc.BC.Y); IDirectPosition mid = m_Factory.CreatePositionXY(mp.X, mp.Y); IDirectPosition ec = m_Factory.CreatePositionXY(arc.EC.X, arc.EC.Y); cseg = m_Factory.CreateCircularArcSegment(bc, mid, ec); } else { throw new NotSupportedException("Unknown line type: " + line.GetType().Name); } csc.Add(cseg); } return(m_Factory.CreateRing(csc)); }
/// <summary> /// Mark this line as inactive. /// </summary> /// <param name="op">The operation that is doing this</param> /* internal void SetInactive(Operation op) { throw new NotImplementedException(); } */ /* // @mfunc Mark this arc as inactive. When you do this, any // system-defined split sections will be eliminated. // // @parm The operation that is doing this. This operation will // hold any sub-features that get created as a result of // de-activating this arc. Only SetDeleted is expected to // pass in a null value. // @parm Is the arc being de-activated in order to trim a // dangling system-generated arc section? If so, DON'T // undo any splits that are incident on this arc. A // TRUE value should be specified ONLY by <mf CeSplit:: // Trim>. Default=FALSE. // // @rdesc Any sub-feature that was created to represent the // layers that this feature was NOT de-activated on. CeFeature* CeArc::SetInactive ( CeOperation* pop , const LOGICAL isTrim ) { // Return if this arc is already inactive (or marked for deletion). if ( this->IsInactive() ) return 0; // De-activate the base class. CeFeature* pSub = CeFeature::SetInactive(pop); // Ensure polygons on the left and right have been marked // for deletion. SetPolDeleted(); // Get any split operation listing arc sections (only returns // something if FFL_SYSTOPOL is set). CeSplit* pSplit = GetpSplit(); if ( pSplit ) { // Return if the splits have been revealed. if ( pSplit->IsRevealed() ) return pSub; // Mark all splits for deletion. RemoveSplits(); // If we created a sub-arc to represent layers that are // not being de-activated, mark it as moved, to force // re-intersection. if ( pSub ) pSub->SetMoved(); } // Check for overlaps with the line's end locations. if ( !isTrim ) m_pLine->UndoEndOverlaps(*this); return pSub; } // end of SetInactive */ /// <summary> /// Make a new line that corresponds to a sub-section of this line. /// </summary> /// <param name="creator">The operation that should be noted as the creator of the new line.</param> /// <param name="id">The internal ID to assign to the sub-section.</param> /// <param name="section">The geometry for the new line.</param> /// <returns>The new line</returns> internal LineFeature MakeSubSection(Operation creator, InternalIdValue id, SectionGeometry section) { LineFeature result = new LineFeature(creator, id, section); //PointFeature start = (PointFeature)section.Start; //PointFeature end = (PointFeature)section.End; //LineFeature result = new LineFeature(this.EntityType, op, start, end, section); DefineFeature(result); // The resultant sub-section should always have the same topological status //if (result.IsTopological) // result.m_Topology = Topology.CreateTopology(result); result.SetTopology(this.IsTopological); return result; }
internal LineFeature(Operation creator, InternalIdValue id, SectionGeometry section) : this(creator, id, section.BaseLine.EntityType, (PointFeature)section.Start, (PointFeature)section.End, section) { }
void WriteSection(SectionGeometry line) { WriteLineGeometry(line.Make()); }