Example #1
0
        /// <summary>
        /// Obtains the control points that need to be imported
        /// </summary>
        /// <returns>The points to save</returns>
        ControlPoint[] GetSavePoints()
        {
            List <ControlPoint> result = new List <ControlPoint>();
            ISpatialIndex       index  = CadastralMapModel.Current.EditingIndex;

            foreach (ControlRange r in m_Ranges)
            {
                ControlPoint[] cps = r.GetDefinedPoints();

                foreach (ControlPoint p in cps)
                {
                    if (p.IsDefined)
                    {
                        // Ignore the point if it already exists as part of the map (same position, same foreign ID).
                        PointFeature xp         = (index.QueryClosest(p, Length.Zero, SpatialType.Point) as PointFeature);
                        bool         isExisting = (xp != null && xp.IsForeignId && xp.FormattedKey == p.ControlId.ToString());
                        if (!isExisting)
                        {
                            result.Add(p);
                        }
                    }
                }
            }

            return(result.ToArray());
        }
Example #2
0
        internal override void MouseMove(IPosition p)
        {
            // The following is pretty much the same as what the controller would do to
            // cover auto-select...

            // The ground tolerance is 1mm at the draw scale.
            ISpatialDisplay draw = ActiveDisplay;
            ILength         tol  = new Length(0.001 * draw.MapScale);

            // Just return if we previously selected something, and the
            // search point lies within tolerance.
            if (m_Line != null)
            {
                ILength dist = m_Line.Distance(p);
                if (dist.Meters < tol.Meters)
                {
                    return;
                }

                // Ensure the previously select line gets un-highlighted
                m_Line = null;
                ErasePainting();
            }

            // Ask the map to find the closest line (if any)
            ISpatialIndex index = CadastralMapModel.Current.Index;

            m_Line = (index.QueryClosest(p, tol, SpatialType.Line) as LineFeature);
            Highlight(m_Line);
        }
Example #3
0
        /// <summary>
        /// Sees whether the orientation of the new text should be altered. This
        /// occurs if the auto-orient capability is enabled, and the specified
        /// position is close to any visible lne.
        /// </summary>
        /// <param name="posn">The position to use for making the check.</param>
        /// <returns></returns>
        LineFeature GetOrientation(IPointGeometry posn)
        {
            // The ground tolerance is 2mm at the draw scale.
            ISpatialDisplay display = ActiveDisplay;
            double          tol     = 0.002 * display.MapScale;

            // If we previously selected something, see if the search point
            // lies within tolerance. If so, there's no change.
            if (m_Orient != null)
            {
                double dist = m_Orient.Distance(posn).Meters;
                if (dist < tol)
                {
                    return(m_Orient);
                }
            }

            // Get the map to find the closest line
            CadastralMapModel map   = CadastralMapModel.Current;
            ISpatialIndex     index = map.Index;

            return(index.QueryClosest(posn, new Length(tol), SpatialType.Line) as LineFeature);
        }
Example #4
0
 public ISpatialObject QueryClosest(IPosition p, ILength radius, SpatialType types)
 {
     return(m_Index.QueryClosest(p, radius, types));
 }