Revision 5261 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/snapping/SnappingVisitor.java
SnappingVisitor.java | ||
---|---|---|
17 | 17 |
ISnapper snapper; |
18 | 18 |
Point2D snapPoint = null; |
19 | 19 |
Point2D queryPoint = null; |
20 |
Point2D lastPointEntered = null; |
|
21 |
|
|
20 | 22 |
double minDist = Double.MAX_VALUE; |
21 | 23 |
double distActual; |
22 | 24 |
double tolerance; |
23 | 25 |
|
24 |
public SnappingVisitor(ISnapper snapper, Point2D queryPoint, double tolerance) |
|
26 |
public SnappingVisitor(ISnapper snapper, Point2D queryPoint, double tolerance, Point2D lastPointEntered)
|
|
25 | 27 |
{ |
26 | 28 |
this.snapper = snapper; |
27 | 29 |
this.tolerance = tolerance; |
28 | 30 |
this.queryPoint = queryPoint; |
31 |
this.lastPointEntered = lastPointEntered; |
|
29 | 32 |
distActual = tolerance; |
33 |
snapper.setSnapPoint(null); |
|
30 | 34 |
} |
31 | 35 |
|
32 | 36 |
public void visitItem(Object item) { |
33 | 37 |
IGeometry geom = (IGeometry) item; |
34 |
Point2D aux = snapper.getSnapPoint(queryPoint, geom, distActual); |
|
38 |
Point2D aux = snapper.getSnapPoint(queryPoint, geom, distActual, lastPointEntered);
|
|
35 | 39 |
if (aux != null) |
36 | 40 |
{ |
37 | 41 |
snapPoint = aux; |
38 | 42 |
minDist = snapPoint.distance(queryPoint); |
39 | 43 |
distActual = minDist; |
44 |
snapper.setSnapPoint(snapPoint); |
|
40 | 45 |
} |
41 | 46 |
|
42 | 47 |
} |
Also available in: Unified diff