use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testProjectExtractPoint.
/**
* From GEOS Ticket #323
*/
public void testProjectExtractPoint() {
final Geometry linearGeom = read("MULTILINESTRING ((0 2, 0 0), (-1 1, 1 1))");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double index = indexedLine.project(new PointDoubleXY(1, 0));
final Point pt = indexedLine.extractPoint(index);
assertTrue(pt.equals(new PointDoubleXY(0, 0)));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testComputeZ.
/**
* Tests that z values are interpolated
*/
public void testComputeZ() {
final Geometry linearGeom = read("LINESTRINGZ(0 0 0, 10 10 10)");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final double projIndex = indexedLine.project(new PointDoubleXY(5, 5));
final Point projPt = indexedLine.extractPoint(projIndex);
// System.out.println(projPt);
assertTrue(projPt.equals(3, new PointDoubleXYZ(5.0, 5, 5)));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class LengthIndexedLineTest method testExtractPointBeyondRange.
public void testExtractPointBeyondRange() {
final Geometry linearGeom = read("LINESTRING (0 0, 10 10)");
final LengthIndexedLine indexedLine = new LengthIndexedLine(linearGeom);
final Point pt = indexedLine.extractPoint(100);
assertTrue(pt.equals(new PointDoubleXY(10, 10)));
final Point pt2 = indexedLine.extractPoint(0);
assertTrue(pt2.equals(new PointDoubleXY(0, 0)));
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RecordWriterPerformanceTest method newRecord.
private static Record newRecord(final RecordDefinition recordDefinition, final int index) {
final Record record = new ArrayRecord(recordDefinition);
record.setValue("boolean", index % 2 == 0);
record.setValue("byte", index % 256 + Byte.MIN_VALUE);
record.setValue("short", index % 65536 + Short.MIN_VALUE);
record.setValue("int", index);
record.setValue("long", index);
record.setValue("float", index + index % 1000 / 1000.0);
record.setValue("double", index + index % 1000 / 1000.0);
record.setValue("string", "String with some special characters " + index + "\\/\"'\t\n\r");
final Calendar calendar = new GregorianCalendar();
calendar.set(2016, 11, index % 28 + 1, 0, 0);
final Date date = new Date(calendar.getTimeInMillis());
record.setValue("date", date);
calendar.set(Calendar.MINUTE, index % 60);
final java.util.Date dateTime = new java.util.Date(calendar.getTimeInMillis());
record.setValue("dateTime", dateTime);
calendar.set(Calendar.MILLISECOND, index % 1000);
final Timestamp timestamp = new Timestamp(calendar.getTimeInMillis());
record.setValue("timestamp", timestamp);
record.setValue("geometry", new PointDoubleXY(index, index * 2));
return record;
}
use of com.revolsys.geometry.model.impl.PointDoubleXY in project com.revolsys.open by revolsys.
the class RectangleIntersectsPerfTest method test.
void test(final int nPts) {
final double size = 100;
final Point origin = new PointDoubleXY(0, 0);
final Geometry sinePoly = newSineStar(origin, size, nPts).getBoundary();
GeometryFactory geometryFactory = sinePoly.getGeometryFactory();
geometryFactory = GeometryFactory.fixed(geometryFactory.getCoordinateSystemId(), geometryFactory.getAxisCount(), size / 10, size / 10, geometryFactory.getScaleZ());
final Geometry newGeometry = sinePoly.convertGeometry(geometryFactory);
/**
* Make the geometry "crinkly" by rounding off the points.
* This defeats the MonotoneChain optimization in the full relate
* algorithm, and provides a more realistic test.
*/
final Geometry sinePolyCrinkly = newGeometry;
final Geometry target = sinePolyCrinkly;
final Geometry rect = newRectangle(origin, 5);
// System.out.println(target);
// System.out.println("Running with " + nPts + " points");
testRectangles(target, 100, 5);
}
Aggregations