using System.Collections.Generic; using GeoAPI.Extensions.Feature; using GeoAPI.Geometries; using SharpMap.Api.Layers; namespace SharpMap.Api.Editors { public class SnapResult { public SnapResult(ICoordinate location, IFeature snappedFeature, ILayer layer, IGeometry nearestTarget, int snapIndexPrevious, int snapIndexNext) { Location = location; SnapIndexPrevious = snapIndexPrevious; SnapIndexNext = snapIndexNext; NearestTarget = nearestTarget; SnappedFeature = snappedFeature; NewFeatureLayer = layer; VisibleSnaps = new List(); //log.DebugFormat("New snap result created, location:{0}, snapIndexPrevious:{1}, snapIndexNext {2}, nearestTarget:{3}, snappedFeature{4}", // location, snapIndexPrevious, snapIndexNext, nearestTarget, snappedFeature); } /// /// index of the curve point that precedes Location. If snapping was successful at a curve point /// SnapIndexPrevious == SnapIndexNext /// public int SnapIndexPrevious { get; private set; } /// /// index of the curve point that follows Location. If snapping was successful at a curve point /// SnapIndexPrevious == SnapIndexNext /// public int SnapIndexNext { get; private set; } /// /// The geometry that is closest to the snapping Location. SnapIndexPrevious and SnapIndexNext /// refer to this IGeometry object. /// public IGeometry NearestTarget { get; private set; } /// /// The feature that is snapped to /// todo replace NearestTarget with SnappedFeature /// public IFeature SnappedFeature { get; private set; } /// /// Layer which can be used to create new features. /// public ILayer NewFeatureLayer { get; set; } /// /// coordinate of the successful snap position /// public ICoordinate Location { get; private set; } /// /// Additional geometries to visualize the snapping result. Used for snapping to structures and /// structure features. /// public IList VisibleSnaps { get; set; } public ISnapRule Rule { get; set; } } }