Пример #1
0
        /// <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);
        }
Пример #2
0
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="cps">The points to save (none of these should correspond to previously created
        /// features in the map model, otherwise an exception will be raised).</param>
        /// <param name="ent">The entity type to assign to control points</param>
        internal void Execute(ControlPoint[] cps, IEntity ent)
        {
            CadastralMapModel mapModel = CadastralMapModel.Current;

            foreach (ControlPoint cp in cps)
            {
                // Add a new point to the map & define it's ID
                PointFeature p = mapModel.AddPoint(cp, ent, this);

                // Create the new ID (and point the ID and feature to each other).
                string    keystr = cp.ControlId.ToString();
                ForeignId fid    = new ForeignId(keystr);
                fid.Add(p);

                m_Features.Add(p);
            }

            Complete();
        }