Exemplo n.º 1
0
 public override string ToString()
 {
     if (Type == SnapType.Point)
     {
         return(Type.ToString() + "/" + Point.UniqueID);
     }
     else if (Type == SnapType.Segment)
     {
         return(Type.ToString() + "/" + Point.UniqueID);
     }
     else
     {
         return(Type.ToString());
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Moves points or vertices to coincide exactly with the vertices, edges, or end points of other features.
        /// Snapping rules can be specified to control whether the input vertices are snapped to the nearest vertex, edge, or
        /// endpoint within a specified distance
        /// </summary>
        /// <param name="source">The input features whose vertices will be snapped to the vertices, edges, or end points of other
        /// features. The input features can be points, multipoints, lines, or polygons.</param>
        /// <param name="snap">The features that the input features' vertices will be snapped to. These features can be points,
        /// multipoints, lines, or polygons.</param>
        /// <param name="snapType">The type of feature part that the input features' vertices can be snapped to (END | VERTEX |
        /// EDGE).</param>
        /// <param name="distance">The distance within which the input features' vertices will be snapped to the nearest vertex,
        /// edge, or end point.</param>
        /// <param name="units">The units.</param>
        /// <param name="trackCancel">The track cancel.</param>
        /// <param name="eventHandler">The events.</param>
        public static void Snap(this IFeatureClass source, IFeatureClass snap, SnapType snapType, double distance, esriUnits units, ITrackCancel trackCancel, IGeoProcessorEvents eventHandler)
        {
            IUnitConverter converter = new UnitConverterClass();
            object         row       = string.Format("{0} {1} '{2} {3}'", snap.GetAbsolutePath(), snapType.ToString().ToUpperInvariant(), distance, converter.EsriUnitsAsString(units, esriCaseAppearance.esriCaseAppearanceUpper, true));

            IGpValueTableObject table = new GpValueTableObjectClass();

            table.SetColumns(3);
            table.AddRow(ref row);

            source.Snap(table, trackCancel, eventHandler);
        }