use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.
the class CoordinateTest method testConstructor3D.
public void testConstructor3D() {
final Point c = new PointDouble(350.2, 4566.8, 5266.3);
assertEquals(c, 350.2, 4566.8, 5266.3);
}
use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.
the class CoordinateTest method testToString.
public void testToString() {
final String expectedResult = "POINT Z(100 200 50)";
final String actualResult = new PointDouble(100.0, 200.0, 50.0).toString();
assertEquals(expectedResult, actualResult);
}
use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.
the class LineStringTest method constructLineString.
@Test
public void constructLineString() {
for (int axisCount = 2; axisCount < 4; axisCount++) {
int axisCountLess = axisCount;
if (axisCountLess > 2) {
axisCountLess--;
}
final GeometryFactory geometryFactory = GeometryFactory.fixed(26910, axisCount, GeometryFactory.newScalesFixed(axisCount, 1000.0));
final GeometryFactory geometryFactoryExtra = GeometryFactory.floating(26910, axisCount + 1);
final GeometryFactory geometryFactoryLess = GeometryFactory.floating(26910, axisCountLess);
final double[] coordinatesExtra = new double[axisCount + 1];
final double[] coordinates = new double[axisCount];
final double[] coordinatesLess = new double[axisCountLess];
final double[] coordinatesLessNaN = new double[axisCount];
for (int i = 0; i < axisCount; i++) {
double value;
switch(i) {
case 0:
value = START_X;
break;
case 1:
value = START_Y;
break;
default:
value = i * 10 + i;
}
coordinates[i] = value;
coordinatesExtra[i] = value;
coordinatesLessNaN[i] = value;
if (i < axisCountLess) {
coordinatesLess[i] = value;
} else {
coordinatesLessNaN[i] = Double.NaN;
}
}
coordinatesExtra[coordinatesExtra.length - 1] = 6;
// double[]
final Point pointDoubleAllAxis = geometryFactory.point(coordinates);
final Point pointDoubleExtraAxis = geometryFactory.point(coordinatesExtra);
final Point pointDoubleLessAxis = geometryFactory.point(coordinatesLess);
assertEquals(coordinates, coordinatesLessNaN, pointDoubleAllAxis, pointDoubleExtraAxis, pointDoubleLessAxis);
assertObjectContsructor(geometryFactory, coordinates, coordinatesLessNaN, pointDoubleAllAxis, pointDoubleExtraAxis, pointDoubleLessAxis);
// Coordinates
final Point pointCoordinatesAllAxis = geometryFactory.point(new PointDouble(coordinates));
final Point pointCoordinatesExtraAxis = geometryFactory.point(new PointDouble(coordinatesExtra));
final Point pointCoordinatesLessAxis = geometryFactory.point(new PointDouble(coordinatesLess));
assertEquals(coordinates, coordinatesLessNaN, pointCoordinatesAllAxis, pointCoordinatesExtraAxis, pointCoordinatesLessAxis);
assertObjectContsructor(geometryFactory, coordinates, coordinatesLessNaN, pointCoordinatesAllAxis, pointCoordinatesExtraAxis, pointCoordinatesLessAxis);
// Object Point
final Point pointAll = pointDoubleAllAxis;
final Point pointExtra = geometryFactoryExtra.point(coordinatesExtra);
final Point pointLess = geometryFactoryLess.point(coordinatesLess);
assertObjectContsructor(geometryFactory, coordinates, coordinatesLessNaN, pointAll, pointExtra, pointLess);
}
}
use of com.revolsys.geometry.model.impl.PointDouble in project com.revolsys.open by revolsys.
the class PointTest method constructPoint.
@Test
public void constructPoint() {
for (int axisCount = 2; axisCount < 4; axisCount++) {
int axisCountLess = axisCount;
if (axisCountLess > 2) {
axisCountLess--;
}
final GeometryFactory geometryFactory = GeometryFactory.fixed(26910, axisCount, GeometryFactory.newScalesFixed(axisCount, 1000.0));
final GeometryFactory geometryFactoryExtra = GeometryFactory.floating(26910, axisCount + 1);
final GeometryFactory geometryFactoryLess = GeometryFactory.floating(26910, axisCountLess);
final double[] coordinatesExtra = new double[axisCount + 1];
final double[] coordinates = new double[axisCount];
final double[] coordinatesLess = new double[axisCountLess];
final double[] coordinatesLessNaN = new double[axisCount];
for (int i = 0; i < axisCount; i++) {
double value;
switch(i) {
case 0:
value = UTM10_X_START;
break;
case 1:
value = UTM10_Y_START;
break;
default:
value = i * 10 + i;
}
coordinates[i] = value;
coordinatesExtra[i] = value;
coordinatesLessNaN[i] = value;
if (i < axisCountLess) {
coordinatesLess[i] = value;
} else {
coordinatesLessNaN[i] = Double.NaN;
}
}
coordinatesExtra[coordinatesExtra.length - 1] = 6;
// double[]
final Point pointDoubleAllAxis = geometryFactory.point(coordinates);
final Point pointDoubleExtraAxis = geometryFactory.point(coordinatesExtra);
final Point pointDoubleLessAxis = geometryFactory.point(coordinatesLess);
assertEquals(coordinates, coordinatesLessNaN, pointDoubleAllAxis, pointDoubleExtraAxis, pointDoubleLessAxis);
assertObjectContsructor(geometryFactory, coordinates, coordinatesLessNaN, pointDoubleAllAxis, pointDoubleExtraAxis, pointDoubleLessAxis);
// Coordinates
final Point pointCoordinatesAllAxis = geometryFactory.point(new PointDouble(coordinates));
final Point pointCoordinatesExtraAxis = geometryFactory.point(new PointDouble(coordinatesExtra));
final Point pointCoordinatesLessAxis = geometryFactory.point(new PointDouble(coordinatesLess));
assertEquals(coordinates, coordinatesLessNaN, pointCoordinatesAllAxis, pointCoordinatesExtraAxis, pointCoordinatesLessAxis);
assertObjectContsructor(geometryFactory, coordinates, coordinatesLessNaN, pointCoordinatesAllAxis, pointCoordinatesExtraAxis, pointCoordinatesLessAxis);
// Object Point
final Point pointAll = pointDoubleAllAxis;
final Point pointExtra = geometryFactoryExtra.point(coordinatesExtra);
final Point pointLess = geometryFactoryLess.point(coordinatesLess);
assertObjectContsructor(geometryFactory, coordinates, coordinatesLessNaN, pointAll, pointExtra, pointLess);
}
}
Aggregations