/// <summary> /// Adds a termination point (or re-use a point if it happens to be the offset point). /// </summary> /// <param name="loc">The location for the termination point.</param> /// <returns>The point feature at the termination point (may be the position that was /// used to define the offset to the parallel line).</returns> PointFeature AddPoint(IPosition loc) { CadastralMapModel map = CadastralMapModel.Current; // Add the split point (with default entity type). If a // point already exists at the location, you'll get back // that point instead. // We do this in case the user has decided to // terminate on a line connected to the offset point // that defines the offset to the parallel (which the // UI lets the user do). PointFeature p = this.OffsetPoint; if (p != null) { IPointGeometry pg = PointGeometry.Create(loc); if (p.IsCoincident(pg)) { return(p); } } p = map.AddPoint(p, map.DefaultPointType, this); p.SetNextId(); return(p); }
/// <summary> /// Does a position coincide with a point feature that was used to define the /// offset to the parallel line? /// </summary> /// <param name="loc">The test position</param> /// <returns>True if the offset was defined using a point feature (as opposed to an /// explicit distance), and the supplied position is exactly coincident.</returns> bool IsPositionAtOffsetPoint(IPosition loc) { PointFeature p = this.OffsetPoint; if (p == null) { return(false); } IPointGeometry pg = PointGeometry.Create(loc); return(p.IsCoincident(pg)); }
/// <summary> /// Appends a point to the new line. If it's the second point, the new line /// will be added to the map. /// </summary> /// <param name="p"></param> /// <returns></returns> internal virtual bool AppendToLine(PointFeature p) { // If the start point is not defined, just remember it. if (m_Start == null) { m_Start = p; return(true); } // Confirm the point is different from the start. if (p.IsCoincident(m_Start)) { MessageBox.Show("End point cannot match the start point."); return(false); } // Add the new line. AddNewLine(p); DialFinish(null); return(true); }
/// <summary> /// Appends a point to the new line. If it's the second point, the new line /// will be added to the map. /// </summary> /// <param name="p"></param> /// <returns></returns> internal virtual bool AppendToLine(PointFeature p) { // If the start point is not defined, just remember it. if (m_Start==null) { m_Start = p; return true; } // Confirm the point is different from the start. if (p.IsCoincident(m_Start)) { MessageBox.Show("End point cannot match the start point."); return false; } // Add the new line. AddNewLine(p); DialFinish(null); return true; }