Exemplo n.º 1
0
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId"></param>
        /// <param name="lineType"></param>
        internal void Execute(IdHandle pointId, IEntity lineType)
        {
            // Calculate the position of the sideshot point.
            IPosition to = Calculate(m_Direction, m_Length);

            if (to == null)
            {
                throw new Exception("Cannot calculate position of sideshot point.");
            }

            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature  x   = new FeatureStub(this, pointId.Entity, fid);

            ff.AddFeatureDescription(DataField.To, x);

            if (lineType != null)
            {
                IFeature f = new FeatureStub(this, lineType, null);
                ff.AddFeatureDescription(DataField.Line, f);
            }

            base.Execute(ff);
        }
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The ID and entity type for the intersect point</param>
        /// <param name="ent1">The entity type for 1st line (null for no line)</param>
        /// <param name="ent2">The entity type for 2nd line (null for no line)</param>
        internal void Execute(IdHandle pointId, IEntity ent1, IEntity ent2)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature  x   = new FeatureStub(this, pointId.Entity, fid);

            ff.AddFeatureDescription(DataField.To, x);

            if (ent1 != null)
            {
                // Lines are not allowed if the direction line is associated with an offset
                // distance (since we would then need to add a point at the start of the
                // direction line). This should have been trapped by the UI. Note that an
                // offset specified using an OffsetPoint is valid.

                if (m_Direction.Offset is OffsetDistance)
                {
                    throw new ApplicationException("Cannot add direction line because a distance offset is involved");
                }

                IFeature f = new FeatureStub(this, ent1, null);
                ff.AddFeatureDescription(DataField.DirLine, f);
            }

            if (ent2 != null)
            {
                IFeature f = new FeatureStub(this, ent2, null);
                ff.AddFeatureDescription(DataField.DistLine, f);
            }

            base.Execute(ff);

            /*
             * // Calculate the position of the point of intersection.
             * IPosition xsect = Calculate(m_Direction, m_Distance, m_From, m_Default);
             * if (xsect==null)
             *  throw new Exception("Cannot calculate intersection point");
             *
             * // Add the intersection point
             * m_To = AddIntersection(xsect, pointId);
             *
             * // If we have a defined entity types for lines, add them too.
             * CadastralMapModel map = MapModel;
             *
             * if (ent1!=null)
             * {
             *  IPosition start = m_Direction.StartPosition;
             *  PointFeature ps = map.EnsurePointExists(start, this);
             *  m_DirLine = map.AddLine(ps, m_To, ent1, this);
             * }
             *
             * if (ent2!=null)
             *  m_DistLine = map.AddLine(m_From, m_To, ent2, this);
             *
             * // Peform standard completion steps
             * Complete();
             */
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates basic information for a new feature that will be created by this edit.
        /// </summary>
        /// <param name="e">The entity type for the feature</param>
        /// <returns>Information for the new feature</returns>
        IFeature CreateFeatureDescription(IEntity e)
        {
            FeatureId fid = null;
            IdHandle  h   = new IdHandle();

            if (h.ReserveId(e, 0))
            {
                fid = h.CreateId();
            }

            return(new FeatureStub(this, e, fid));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The key and entity type to assign to the intersection point.</param>
        internal void Execute(IdHandle pointId)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature  x   = new FeatureStub(this, pointId.Entity, fid);

            ff.AddFeatureDescription(DataField.To, x);

            if (m_IsSplit1)
            {
                // See FeatureFactory.MakeSection - the only thing that really matters is the
                // session sequence number that will get picked up by the FeatureStub constructor.
                ff.AddFeatureDescription(DataField.SplitBefore1, new FeatureStub(this, m_Line1.EntityType, null));
                ff.AddFeatureDescription(DataField.SplitAfter1, new FeatureStub(this, m_Line1.EntityType, null));
            }

            if (m_IsSplit2)
            {
                ff.AddFeatureDescription(DataField.SplitBefore2, new FeatureStub(this, m_Line2.EntityType, null));
                ff.AddFeatureDescription(DataField.SplitAfter2, new FeatureStub(this, m_Line2.EntityType, null));
            }

            base.Execute(ff);

            //////////

            /*
             * // Calculate the position of the point of intersection.
             * IPosition xsect;
             * PointFeature closest;
             * if (!m_Line1.Intersect(m_Line2, m_CloseTo, out xsect, out closest))
             *  throw new Exception("Cannot calculate intersection point");
             *
             * // Add the intersection point
             * m_Intersection = AddIntersection(xsect, pointId);
             *
             * // Are we splitting the input lines? If so, do it.
             * m_IsSplit1 = wantsplit1;
             * if (m_IsSplit1)
             *  SplitLine(m_Intersection, m_Line1, out m_Line1a, out m_Line1b);
             *
             * m_IsSplit2 = wantsplit2;
             * if (m_IsSplit2)
             *  SplitLine(m_Intersection, m_Line2, out m_Line2a, out m_Line2b);
             *
             * // Peform standard completion steps
             * Complete();
             */
        }
Exemplo n.º 5
0
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The ID and entity type for the intersect point</param>
        /// <param name="ent1">The entity type for 1st line (null for no line)</param>
        /// <param name="ent2">The entity type for 2nd line (null for no line)</param>
        internal void Execute(IdHandle pointId, IEntity ent1, IEntity ent2)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature  x   = new FeatureStub(this, pointId.Entity, fid);

            ff.AddFeatureDescription(DataField.To, x);

            if (ent1 != null)
            {
                IFeature f = new FeatureStub(this, ent1, null);
                ff.AddFeatureDescription(DataField.Line1, f);
            }

            if (ent2 != null)
            {
                IFeature f = new FeatureStub(this, ent2, null);
                ff.AddFeatureDescription(DataField.Line2, f);
            }

            base.Execute(ff);

            /*
             * // Calculate the position of the point of intersection.
             * IPosition xsect = Calculate(m_Distance1, m_From1, m_Distance2, m_From2, m_Default);
             * if (xsect==null)
             *  throw new Exception("Cannot calculate intersection point");
             *
             * // Add the intersection point
             * m_To = AddIntersection(xsect, pointId);
             *
             * // If we have a defined entity types for lines, add them too.
             * CadastralMapModel map = MapModel;
             *
             * if (ent1!=null)
             *  m_Line1 = map.AddLine(m_From1, m_To, ent1, this);
             *
             * if (ent2!=null)
             *  m_Line2 = map.AddLine(m_From2, m_To, ent2, this);
             *
             * // Peform standard completion steps
             * Complete();
             */
        }
Exemplo n.º 6
0
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The ID (and entity type) for the extension point.</param>
        /// <param name="lineEnt">The entity type for the extension line (null for no line).</param>
        internal void Execute(IdHandle pointId, IEntity lineEnt)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature  xp  = new FeatureStub(this, pointId.Entity, fid);

            ff.AddFeatureDescription(DataField.NewPoint, xp);

            if (lineEnt != null)
            {
                IFeature f = new FeatureStub(this, lineEnt, null);
                ff.AddFeatureDescription(DataField.NewLine, f);
            }

            base.Execute(ff);

            /*
             * IPosition start;    // Start of the extension
             * IPosition end;      // End of the extension
             *
             * // See if the extension is a straight line.
             * bool isStraight = LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end);
             *
             * // If it's not straight, it should be a circular arc.
             * bool isCurve = false;
             * IPosition center;   // The centre of the circle
             * bool iscw = true;   // Is the curve clockwise?
             *
             * if (!isStraight)
             *  isCurve = LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end, out center, out iscw);
             *
             * // Return if it's neither straight or a circular arc.
             *  if ( !(isStraight || isCurve) )
             *  throw new Exception("Cannot calculate line extension point.");
             *
             * // Add the extension point to the map.
             * CadastralMapModel map = MapModel;
             * m_NewPoint = map.AddPoint(end, pointId.Entity, this);
             *
             * // Associate the new point with the specified ID (if any).
             * pointId.CreateId(m_NewPoint);
             *
             * // If a line entity has been supplied, add a line too.
             * if (lineEnt==null)
             *  m_NewLine = null;
             * else
             * {
             *  // Get the point at the end of the extension line
             *  PointFeature s = (m_IsExtendFromEnd ? m_ExtendLine.EndPoint : m_ExtendLine.StartPoint);
             *
             *  if (isStraight)
             *      m_NewLine = map.AddLine(s, m_NewPoint, lineEnt, this);
             *  else
             *  {
             *      // We need the circle that the arc lies on.
             *      Circle circle = m_ExtendLine.Circle;
             *      Debug.Assert(circle!=null);
             *
             *      // Add the arc to the map.
             *      m_NewLine = map.AddCircularArc(circle, s, m_NewPoint, iscw, lineEnt, this);
             *  }
             * }
             *
             * // Peform standard completion steps
             * Complete();
             */
        }
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The key and entity type to assign to the intersection point.</param>
        /// <param name="dirEnt">The entity type for any line that should be added along the direction
        /// line. Specify null if you don't want a line.</param>
        internal void Execute(IdHandle pointId, IEntity dirEnt)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature  x   = new FeatureStub(this, pointId.Entity, fid);

            ff.AddFeatureDescription(DataField.To, x);

            if (m_IsSplit)
            {
                // See FeatureFactory.MakeSection - the only thing that really matters is the
                // session sequence number that will get picked up by the FeatureStub constructor.
                ff.AddFeatureDescription(DataField.SplitBefore, new FeatureStub(this, m_Line.EntityType, null));
                ff.AddFeatureDescription(DataField.SplitAfter, new FeatureStub(this, m_Line.EntityType, null));
            }

            if (dirEnt != null)
            {
                // Lines are not allowed if the direction line is associated with an offset
                // distance (since we would then need to add a point at the start of the
                // direction line). This should have been trapped by the UI. Note that an
                // offset specified using an OffsetPoint is valid.

                if (m_Direction.Offset is OffsetDistance)
                {
                    throw new ApplicationException("Cannot add direction line because a distance offset is involved");
                }

                IFeature f = new FeatureStub(this, dirEnt, null);
                ff.AddFeatureDescription(DataField.DirLine, f);
            }

            base.Execute(ff);

            //////////

            /*
             * // Calculate the position of the point of intersection.
             * IPosition xsect;
             * PointFeature closest;
             * if (!m_Direction.Intersect(m_Line, m_CloseTo, out xsect, out closest))
             *  throw new Exception("Cannot calculate intersection point");
             *
             * // Add the intersection point
             * m_Intersection = AddIntersection(xsect, pointId);
             *
             * // Are we splitting the input line? If so, do it.
             * m_IsSplit = wantsplit;
             * if (m_IsSplit)
             *  SplitLine(m_Intersection, m_Line, out m_LineA, out m_LineB);
             *
             * // If we have a defined entity type for the direction line, add a line too.
             * CadastralMapModel map = MapModel;
             * if (dirEnt!=null)
             *  m_DirLine = map.AddLine(m_Direction.From, m_Intersection, dirEnt, this);
             *
             * // Peform standard completion steps
             * Complete();
             */
        }
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The ID (and entity type) for the extension point.</param>
        /// <param name="lineEnt">The entity type for the extension line (null for no line).</param>
        internal void Execute(IdHandle pointId, IEntity lineEnt)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature xp = new FeatureStub(this, pointId.Entity, fid);
            ff.AddFeatureDescription(DataField.NewPoint, xp);

            if (lineEnt != null)
            {
                IFeature f = new FeatureStub(this, lineEnt, null);
                ff.AddFeatureDescription(DataField.NewLine, f);
            }

            base.Execute(ff);

            /*
            IPosition start;    // Start of the extension
            IPosition end;      // End of the extension

            // See if the extension is a straight line.
            bool isStraight = LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end);

            // If it's not straight, it should be a circular arc.
            bool isCurve = false;
            IPosition center;   // The centre of the circle
            bool iscw = true;   // Is the curve clockwise?

            if (!isStraight)
                isCurve = LineExtensionUI.Calculate(m_ExtendLine, m_IsExtendFromEnd, m_Length, out start, out end, out center, out iscw);

            // Return if it's neither straight or a circular arc.
            if ( !(isStraight || isCurve) )
                throw new Exception("Cannot calculate line extension point.");

            // Add the extension point to the map.
            CadastralMapModel map = MapModel;
            m_NewPoint = map.AddPoint(end, pointId.Entity, this);

            // Associate the new point with the specified ID (if any).
            pointId.CreateId(m_NewPoint);

            // If a line entity has been supplied, add a line too.
            if (lineEnt==null)
                m_NewLine = null;
            else
            {
                // Get the point at the end of the extension line
                PointFeature s = (m_IsExtendFromEnd ? m_ExtendLine.EndPoint : m_ExtendLine.StartPoint);

                if (isStraight)
                    m_NewLine = map.AddLine(s, m_NewPoint, lineEnt, this);
                else
                {
                    // We need the circle that the arc lies on.
                    Circle circle = m_ExtendLine.Circle;
                    Debug.Assert(circle!=null);

                    // Add the arc to the map.
                    m_NewLine = map.AddCircularArc(circle, s, m_NewPoint, iscw, lineEnt, this);
                }
            }

            // Peform standard completion steps
            Complete();
             */
        }
        /// <summary>
        /// Executes this operation. 
        /// </summary>
        /// <param name="pointId">The ID and entity type for the intersect point
        /// If null, the default entity type for point features will be used.</param>
        /// <param name="lineEnt1">The entity type for a line connecting the 1st direction to the
        /// intersection (null for no line)</param>
        /// <param name="lineEnt2">The entity type for a line connecting the 2nd direction to the
        /// intersection (null for no line)</param>
        internal void Execute(IdHandle pointId, IEntity lineEnt1, IEntity lineEnt2)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature x = new FeatureStub(this, pointId.Entity, fid);
            ff.AddFeatureDescription(DataField.To, x);

            if (lineEnt1 != null)
            {
                // Lines are not allowed if the direction line is associated with an offset
                // distance (since we would then need to add a point at the start of the
                // direction line). This should have been trapped by the UI. Note that an
                // offset specified using an OffsetPoint is valid.

                if (m_Direction1.Offset is OffsetDistance)
                    throw new ApplicationException("Cannot add direction line because a distance offset is involved");

                IFeature f = new FeatureStub(this, lineEnt1, null);
                ff.AddFeatureDescription(DataField.Line1, f);
            }

            if (lineEnt2 != null)
            {
                if (m_Direction2.Offset is OffsetDistance)
                    throw new ApplicationException("Cannot add direction line because a distance offset is involved");

                IFeature f = new FeatureStub(this, lineEnt2, null);
                ff.AddFeatureDescription(DataField.Line2, f);
            }

            base.Execute(ff);

            /*
            // Calculate the position of the point of intersection.
            IPosition xsect = m_Direction1.Intersect(m_Direction2);
            if (xsect==null)
                throw new Exception("Cannot calculate intersection point");

            // Add the intersection point
            m_To = AddIntersection(xsect, pointId);

            // If we have a defined entity types for lines, add them too.
            CadastralMapModel map = MapModel;

            if (lineEnt1!=null)
            {
                IPosition start = m_Direction1.StartPosition;
                PointFeature ps = map.EnsurePointExists(start, this);
                m_Line1 = map.AddLine(ps, m_To, lineEnt1, this);
            }

            if (lineEnt2!=null)
            {
                IPosition start = m_Direction2.StartPosition;
                PointFeature ps = map.EnsurePointExists(start, this);
                m_Line2 = map.AddLine(ps, m_To, lineEnt2, this);
            }

            // Peform standard completion steps
            Complete();
             */
        }
Exemplo n.º 10
0
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId"></param>
        /// <param name="lineType"></param>
        internal void Execute(IdHandle pointId, IEntity lineType)
        {
            // Calculate the position of the sideshot point.
            IPosition to = Calculate(m_Direction, m_Length);
            if (to==null)
                throw new Exception("Cannot calculate position of sideshot point.");

            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature x = new FeatureStub(this, pointId.Entity, fid);
            ff.AddFeatureDescription(DataField.To, x);

            if (lineType != null)
            {
                IFeature f = new FeatureStub(this, lineType, null);
                ff.AddFeatureDescription(DataField.Line, f);
            }

            base.Execute(ff);
        }
        /// <summary>
        /// Executes this operation. 
        /// </summary>
        /// <param name="pointId">The ID and entity type for the intersect point</param>
        /// <param name="ent1">The entity type for 1st line (null for no line)</param>
        /// <param name="ent2">The entity type for 2nd line (null for no line)</param>
        internal void Execute(IdHandle pointId, IEntity ent1, IEntity ent2)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature x = new FeatureStub(this, pointId.Entity, fid);
            ff.AddFeatureDescription(DataField.To, x);

            if (ent1 != null)
            {
                IFeature f = new FeatureStub(this, ent1, null);
                ff.AddFeatureDescription(DataField.Line1, f);
            }

            if (ent2 != null)
            {
                IFeature f = new FeatureStub(this, ent2, null);
                ff.AddFeatureDescription(DataField.Line2, f);
            }

            base.Execute(ff);

            /*
            // Calculate the position of the point of intersection.
            IPosition xsect = Calculate(m_Distance1, m_From1, m_Distance2, m_From2, m_Default);
            if (xsect==null)
                throw new Exception("Cannot calculate intersection point");

            // Add the intersection point
            m_To = AddIntersection(xsect, pointId);

            // If we have a defined entity types for lines, add them too.
            CadastralMapModel map = MapModel;

            if (ent1!=null)
                m_Line1 = map.AddLine(m_From1, m_To, ent1, this);

            if (ent2!=null)
                m_Line2 = map.AddLine(m_From2, m_To, ent2, this);

            // Peform standard completion steps
            Complete();
             */
        }
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The key and entity type to assign to the intersection point.</param>
        internal void Execute(IdHandle pointId)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature x = new FeatureStub(this, pointId.Entity, fid);
            ff.AddFeatureDescription(DataField.To, x);

            if (m_IsSplit1)
            {
                // See FeatureFactory.MakeSection - the only thing that really matters is the
                // session sequence number that will get picked up by the FeatureStub constructor.
                ff.AddFeatureDescription(DataField.SplitBefore1, new FeatureStub(this, m_Line1.EntityType, null));
                ff.AddFeatureDescription(DataField.SplitAfter1, new FeatureStub(this, m_Line1.EntityType, null));
            }

            if (m_IsSplit2)
            {
                ff.AddFeatureDescription(DataField.SplitBefore2, new FeatureStub(this, m_Line2.EntityType, null));
                ff.AddFeatureDescription(DataField.SplitAfter2, new FeatureStub(this, m_Line2.EntityType, null));
            }

            base.Execute(ff);

            //////////
            /*
            // Calculate the position of the point of intersection.
            IPosition xsect;
            PointFeature closest;
            if (!m_Line1.Intersect(m_Line2, m_CloseTo, out xsect, out closest))
                throw new Exception("Cannot calculate intersection point");

            // Add the intersection point
            m_Intersection = AddIntersection(xsect, pointId);

            // Are we splitting the input lines? If so, do it.
            m_IsSplit1 = wantsplit1;
            if (m_IsSplit1)
                SplitLine(m_Intersection, m_Line1, out m_Line1a, out m_Line1b);

            m_IsSplit2 = wantsplit2;
            if (m_IsSplit2)
                SplitLine(m_Intersection, m_Line2, out m_Line2a, out m_Line2b);

            // Peform standard completion steps
            Complete();
             */
        }
        /// <summary>
        /// Executes this operation.
        /// </summary>
        /// <param name="pointId">The key and entity type to assign to the intersection point.</param>
        /// <param name="dirEnt">The entity type for any line that should be added along the direction
        /// line. Specify null if you don't want a line.</param>
        internal void Execute(IdHandle pointId, IEntity dirEnt)
        {
            FeatureFactory ff = new FeatureFactory(this);

            FeatureId fid = pointId.CreateId();
            IFeature x = new FeatureStub(this, pointId.Entity, fid);
            ff.AddFeatureDescription(DataField.To, x);

            if (m_IsSplit)
            {
                // See FeatureFactory.MakeSection - the only thing that really matters is the
                // session sequence number that will get picked up by the FeatureStub constructor.
                ff.AddFeatureDescription(DataField.SplitBefore, new FeatureStub(this, m_Line.EntityType, null));
                ff.AddFeatureDescription(DataField.SplitAfter, new FeatureStub(this, m_Line.EntityType, null));
            }

            if (dirEnt != null)
            {
                // Lines are not allowed if the direction line is associated with an offset
                // distance (since we would then need to add a point at the start of the
                // direction line). This should have been trapped by the UI. Note that an
                // offset specified using an OffsetPoint is valid.

                if (m_Direction.Offset is OffsetDistance)
                    throw new ApplicationException("Cannot add direction line because a distance offset is involved");

                IFeature f = new FeatureStub(this, dirEnt, null);
                ff.AddFeatureDescription(DataField.DirLine, f);
            }

            base.Execute(ff);

            //////////
            /*
            // Calculate the position of the point of intersection.
            IPosition xsect;
            PointFeature closest;
            if (!m_Direction.Intersect(m_Line, m_CloseTo, out xsect, out closest))
                throw new Exception("Cannot calculate intersection point");

            // Add the intersection point
            m_Intersection = AddIntersection(xsect, pointId);

            // Are we splitting the input line? If so, do it.
            m_IsSplit = wantsplit;
            if (m_IsSplit)
                SplitLine(m_Intersection, m_Line, out m_LineA, out m_LineB);

            // If we have a defined entity type for the direction line, add a line too.
            CadastralMapModel map = MapModel;
            if (dirEnt!=null)
                m_DirLine = map.AddLine(m_Direction.From, m_Intersection, dirEnt, this);

            // Peform standard completion steps
            Complete();
             */
        }