Skip to content

Commit db94a4a

Browse files
committed
Reduce visibility of internal classes in DiscreteHausdorffDistance
1 parent 00943d4 commit db94a4a

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

modules/core/src/main/java/org/locationtech/jts/algorithm/distance/DiscreteHausdorffDistance.java

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ private void computeOrientedDistance(Geometry discreteGeom, Geometry geom, Point
273273
}
274274
}
275275

276-
public static class MaxPointDistanceFilter
276+
private static class MaxPointDistanceFilter
277277
implements CoordinateFilter
278278
{
279279
private PointPairDistance maxPtDist = new PointPairDistance();
@@ -295,52 +295,52 @@ public void filter(Coordinate pt)
295295
public PointPairDistance getMaxPointDistance() { return maxPtDist; }
296296
}
297297

298-
public static class MaxDensifiedByFractionDistanceFilter
298+
private static class MaxDensifiedByFractionDistanceFilter
299299
implements CoordinateSequenceFilter
300300
{
301-
private PointPairDistance maxPtDist = new PointPairDistance();
302-
private PointPairDistance minPtDist = new PointPairDistance();
303-
private Geometry geom;
304-
private int numSubSegs = 0;
305-
306-
public MaxDensifiedByFractionDistanceFilter(Geometry geom, double fraction) {
307-
this.geom = geom;
308-
numSubSegs = (int) Math.rint(1.0/fraction);
309-
}
310-
311-
public void filter(CoordinateSequence seq, int index)
312-
{
313-
/**
314-
* This logic also handles skipping Point geometries
315-
*/
316-
if (index == 0)
317-
return;
318-
319-
Coordinate p0 = seq.getCoordinate(index - 1);
320-
Coordinate p1 = seq.getCoordinate(index);
321-
322-
double delx = (p1.x - p0.x)/numSubSegs;
323-
double dely = (p1.y - p0.y)/numSubSegs;
324-
325-
for (int i = 0; i < numSubSegs; i++) {
326-
double x = p0.x + i*delx;
327-
double y = p0.y + i*dely;
328-
Coordinate pt = new Coordinate(x, y);
329-
minPtDist.initialize();
330-
DistanceToPoint.computeDistance(geom, pt, minPtDist);
331-
maxPtDist.setMaximum(minPtDist);
301+
private PointPairDistance maxPtDist = new PointPairDistance();
302+
private PointPairDistance minPtDist = new PointPairDistance();
303+
private Geometry geom;
304+
private int numSubSegs = 0;
305+
306+
public MaxDensifiedByFractionDistanceFilter(Geometry geom, double fraction) {
307+
this.geom = geom;
308+
numSubSegs = (int) Math.rint(1.0/fraction);
332309
}
333-
334-
335-
}
336-
337-
public boolean isGeometryChanged() { return false; }
338310

339-
public boolean isDone() { return false; }
311+
public void filter(CoordinateSequence seq, int index)
312+
{
313+
/**
314+
* This logic also handles skipping Point geometries
315+
*/
316+
if (index == 0)
317+
return;
318+
319+
Coordinate p0 = seq.getCoordinate(index - 1);
320+
Coordinate p1 = seq.getCoordinate(index);
321+
322+
double delx = (p1.x - p0.x)/numSubSegs;
323+
double dely = (p1.y - p0.y)/numSubSegs;
324+
325+
for (int i = 0; i < numSubSegs; i++) {
326+
double x = p0.x + i*delx;
327+
double y = p0.y + i*dely;
328+
Coordinate pt = new Coordinate(x, y);
329+
minPtDist.initialize();
330+
DistanceToPoint.computeDistance(geom, pt, minPtDist);
331+
maxPtDist.setMaximum(minPtDist);
332+
}
333+
334+
335+
}
340336

341-
public PointPairDistance getMaxPointDistance() {
342-
return maxPtDist;
337+
public boolean isGeometryChanged() { return false; }
338+
339+
public boolean isDone() { return false; }
340+
341+
public PointPairDistance getMaxPointDistance() {
342+
return maxPtDist;
343+
}
343344
}
344-
}
345345

346346
}

0 commit comments

Comments
 (0)