Index: src/Common/NetTopologySuite/Noding/Snapround/MCIndexPointSnapper.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/NetTopologySuite/Noding/Snapround/MCIndexPointSnapper.cs (.../MCIndexPointSnapper.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/NetTopologySuite/Noding/Snapround/MCIndexPointSnapper.cs (.../MCIndexPointSnapper.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -16,10 +16,10 @@ /// /// // Public in java code... temporary modified for "safe assembly" in Sql2005 - internal static readonly int numberSnaps = 0; + internal static readonly int numberSnaps = 0; private IList monoChains = null; - private STRtree index = null; + private readonly STRtree index = null; /// /// Initializes a new instance of the class. @@ -33,35 +33,6 @@ } /// - /// - /// - private class QueryVisitor : IItemVisitor - { - IEnvelope env = null; - HotPixelSnapAction action = null; - - /// - /// - /// - /// - /// - public QueryVisitor(IEnvelope env, HotPixelSnapAction action) - { - this.env = env; - this.action = action; - } - - /// - /// - /// - public void VisitItem(object item) - { - MonotoneChain testChain = (MonotoneChain) item; - testChain.Select(env, action); - } - } - - /// /// Snaps (nodes) all interacting segments to this hot pixel. /// The hot pixel may represent a vertex of an edge, /// in which case this routine uses the optimization @@ -94,10 +65,9 @@ /// public class HotPixelSnapAction : MonotoneChainSelectAction { - private HotPixel hotPixel = null; - private SegmentString parentEdge = null; - private int vertexIndex; - private bool isNodeAdded = false; + private readonly HotPixel hotPixel = null; + private readonly SegmentString parentEdge = null; + private readonly int vertexIndex; /// /// Initializes a new instance of the class. @@ -107,6 +77,7 @@ /// public HotPixelSnapAction(HotPixel hotPixel, SegmentString parentEdge, int vertexIndex) { + IsNodeAdded = false; this.hotPixel = hotPixel; this.parentEdge = parentEdge; this.vertexIndex = vertexIndex; @@ -115,13 +86,7 @@ /// /// /// - public bool IsNodeAdded - { - get - { - return isNodeAdded; - } - } + public bool IsNodeAdded { get; private set; } /// /// @@ -132,11 +97,44 @@ { SegmentString ss = (SegmentString) mc.Context; // don't snap a vertex to itself - if (parentEdge != null) + if (parentEdge != null) + { if (ss == parentEdge && startIndex == vertexIndex) + { return; - isNodeAdded = SimpleSnapRounder.AddSnappedNode(hotPixel, ss, startIndex); + } + } + IsNodeAdded = SimpleSnapRounder.AddSnappedNode(hotPixel, ss, startIndex); } } + + /// + /// + /// + private class QueryVisitor : IItemVisitor + { + private readonly IEnvelope env = null; + private readonly HotPixelSnapAction action = null; + + /// + /// + /// + /// + /// + public QueryVisitor(IEnvelope env, HotPixelSnapAction action) + { + this.env = env; + this.action = action; + } + + /// + /// + /// + public void VisitItem(object item) + { + MonotoneChain testChain = (MonotoneChain) item; + testChain.Select(env, action); + } + } } -} +} \ No newline at end of file