/** * Transform into GeometryCollection. * * @param geom * input geometry * @return * a geometry collection */ private static GeometryCollection transformIntoPointGeometryCollection(GeometryCollection gc) { UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter(); gc.apply(filter); Coordinate[] coord = filter.getCoordinates(); Geometry[] geometries = new Geometry[coord.length]; for (int i = 0 ; i < coord.length ; i++) { Coordinate[] c = new Coordinate[] { coord[i] }; CoordinateArraySequence cs = new CoordinateArraySequence(c); geometries[i] = new Point(cs, gc.getFactory()); } return new GeometryCollection(geometries, gc.getFactory()); }
public static void println(Object obj) { if (!debugOn) { return; } debug.instancePrint(obj); debug.println(); }
public long stop() { if (isRunning) { updateTotalTime(); isRunning = false; } return totalTime; }
/** * Always throws an <code>AssertionFailedException</code>. * *@throws AssertionFailedException thrown always */ public static void shouldNeverReachHere() { shouldNeverReachHere(null); }
/** * Throws an <code>AssertionFailedException</code> if the given objects are * not equal, according to the <code>equals</code> method. * *@param expectedValue the correct value *@param actualValue the value being checked *@throws AssertionFailedException if the two objects are not equal */ public static void equals(Object expectedValue, Object actualValue) { equals(expectedValue, actualValue, null); }
public Interval(double min, double max) { Assert.isTrue(min <= max); this.min = min; this.max = max; }
/** * Creates a circular or elliptical {@link Polygon}. * * @return a circle or ellipse */ public Polygon createCircle() { return createEllipse(); }
private Collection scale(Collection segStrings) { // System.out.println("Scaled: scaleFactor = " + scaleFactor); return CollectionUtil.transform(segStrings, new CollectionUtil.Function() { public Object execute(Object obj) { SegmentString ss = (SegmentString) obj; return new NodedSegmentString(scale(ss.getCoordinates()), ss.getData()); } } ); }
/** * Sets the width of the shape. * * @param width the width of the shape */ public void setWidth(double width) { dim.setWidth(width); }
/** * Sets the location of the shape by specifying the centre of * the shape's bounding box * * @param centre the centre coordinate of the shape */ public void setCentre(Coordinate centre) { dim.setCentre(centre); }
public String getTimeString() { long totalTime = getTime(); String totalTimeStr = totalTime < 10000 ? totalTime + " ms" : (double) totalTime / 1000.0 + " s"; return totalTimeStr; } }
public static void print(String str) { if (!debugOn) { return; } debug.instancePrint(str); } /*
/** * Adds an object to be watched. * A watched object can be printed out at any time. * * Currently only supports one watched object at a time. * @param obj */ public static void addWatch(Object obj) { debug.instanceAddWatch(obj); }
/** * Sets the location of the shape by specifying the base coordinate * (which in most cases is the * lower left point of the envelope containing the shape). * * @param base the base coordinate of the shape */ public void setBase(Coordinate base) { dim.setBase(base); } /**
/** * Sets the height of the shape. * * @param height the height of the shape */ public void setHeight(double height) { dim.setHeight(height); }
/** * Transform into GeometryCollection. * * @param geom * input geometry * @return * a geometry collection */ private static GeometryCollection transformIntoPointGeometryCollection(Geometry geom) { UniqueCoordinateArrayFilter filter = new UniqueCoordinateArrayFilter(); geom.apply(filter); Coordinate[] coord = filter.getCoordinates(); Geometry[] geometries = new Geometry[coord.length]; for (int i = 0 ; i < coord.length ; i++) { Coordinate[] c = new Coordinate[] { coord[i] }; CoordinateArraySequence cs = new CoordinateArraySequence(c); geometries[i] = new Point(cs, geom.getFactory()); } return new GeometryCollection(geometries, geom.getFactory()); }
/** * Constructs an AbstractSTRtree with the specified maximum number of child * nodes that a node may have * * @param nodeCapacity the maximum number of child nodes in a node */ public AbstractSTRtree(int nodeCapacity) { Assert.isTrue(nodeCapacity > 1, "Node capacity must be greater than 1"); this.nodeCapacity = nodeCapacity; }
public long getTime() { updateTotalTime(); return totalTime; }
public long split() { if (isRunning) updateTotalTime(); return totalTime; }