/** * Creates a {@code Point} * * @param crs the {@code CoordinateReferenceSystem} for the {@code Point} * @param p the {@code Position} for the {@code Point} * @param <P> the {@code Position} type * @return a {@code Point} having the specified {@code Position} and {@code CoordinateReferenceSystem} */ public static <P extends Position> Point<P> point(CoordinateReferenceSystem<P> crs, P p) { return new Point<>(p, crs); }
private static double[] getCoordinates(Point geometry) { double[] value = new double[geometry.getCoordinateDimension()]; int offset = 0; value[offset++] = geometry.getX(); value[offset++] = geometry.getY(); if (geometry.is3D()) { value[offset++] = geometry.getZ(); } if (geometry.isMeasured()) { value[offset++] = geometry.getM(); } return value; }
private static org.postgis.Point convert(Point point) { org.postgis.Point pgPoint = new org.postgis.Point(); pgPoint.srid = point.getSRID(); pgPoint.dimension = point.is3D() ? 3 : 2; pgPoint.haveMeasure = false; pgPoint.x = point.getX(); pgPoint.y = point.getY(); if (point.is3D()) { pgPoint.z = point.getZ(); } if (point.isMeasured()) { pgPoint.m = point.getM(); pgPoint.haveMeasure = true; } return pgPoint; }
@Override public void visit(Point<P> geom) { writeByteOrder(output); writeTypeCodeAndSrid(geom, output); if (geom.isEmpty()) { output.putUInt(0); } else { writePoints(geom.getPositions(), geom.getCoordinateDimension(), output); } }
@Test @ExcludeIn(H2) public void point_x_y() { PointPath<Point> point = shapes.geometry.asPoint(); List<Tuple> results = withPoints().select(point, point.x(), point.y()).fetch(); assertFalse(results.isEmpty()); for (Tuple row : results) { assertEquals(Double.valueOf(row.get(point).getX()), row.get(point.x())); assertEquals(Double.valueOf(row.get(point).getY()), row.get(point.y())); } }
private static JGeometry convert(Point geometry) { double[] value = getCoordinates(geometry); int srid = geometry.getSRID(); if (geometry.isMeasured()) { return JGeometry.createLRSPoint(value, value.length - 1, srid); } else { return JGeometry.createPoint(value, value.length, srid); } }
private static JGeometry convert(Point geometry) { double[] value = getCoordinates(geometry); int srid = geometry.getSRID(); if (geometry.isMeasured()) { return JGeometry.createLRSPoint(value, value.length - 1, srid); } else { return JGeometry.createPoint(value, value.length, srid); } }
private static double[] getCoordinates(Point geometry) { double[] value = new double[geometry.getCoordinateDimension()]; int offset = 0; value[offset++] = geometry.getX(); value[offset++] = geometry.getY(); if (geometry.is3D()) { value[offset++] = geometry.getZ(); } if (geometry.isMeasured()) { value[offset++] = geometry.getM(); } return value; }
private static org.postgis.Point convert(Point point) { org.postgis.Point pgPoint = new org.postgis.Point(); pgPoint.srid = point.getSRID(); pgPoint.dimension = point.is3D() ? 3 : 2; pgPoint.haveMeasure = false; pgPoint.x = point.getX(); pgPoint.y = point.getY(); if (point.is3D()) { pgPoint.z = point.getZ(); } if (point.isMeasured()) { pgPoint.m = point.getM(); pgPoint.haveMeasure = true; } return pgPoint; }
/** * Creates an empty {@code Point} for a coordinate reference system * * @param crs the coordinate reference system for the created {@code Point} * @param <P> the type of {@code Position} * @return an empty {@code Point} with the specified coordinate reference system */ public static <P extends Position> Point<P> mkEmptyPoint(CoordinateReferenceSystem<P> crs) { return new Point<P>(crs); }
@Override Point<P> toGeometry(CoordinateReferenceSystem<P> crs) { return new Point<P>(p, crs); } }
/** * Creates a {@code Point} from a Position and coordinate reference system * * @param pos the position for the created {@code Point} * @param crs the coordinate reference system for the created {@code Point} * @param <P> the type of {@code Position} * @return a {@code Point} with the specified position and coordinate reference system */ public static <P extends Position> Point<P> mkPoint(P pos, CoordinateReferenceSystem<P> crs) { return new Point<P>(pos, crs); }
protected Point<?> createNullGeometry(CoordinateReferenceSystem<?> crs) { return new Point(crs); }
private <P extends Position> Point<P> decodePoint(ByteBuffer byteBuffer, CoordinateReferenceSystem<P> crs) { PositionSequence<P> points = readPositions(1, byteBuffer, crs); return new Point<P>(points, crs); }
@SuppressWarnings("unchecked") public static <P extends Position> Geometry<P> mkGeometry(Class<? extends Simple> geometryClass, PositionSequence<P> positions, CoordinateReferenceSystem<P> crs) { if (geometryClass == null) { throw new IllegalArgumentException("Null argument not allowed"); } if (Point.class.isAssignableFrom(geometryClass)) { return new Point<P>(positions, crs); } if (LinearRing.class.isAssignableFrom(geometryClass)) { return new LinearRing<P>(positions, crs); } if (LineString.class.isAssignableFrom(geometryClass)) { return new LineString<P>(positions, crs); } throw new IllegalStateException("Unknown Geometry class"); }
@Override public Point<P> generate() { return new Point(positionWithin(bbox, rnd), bbox.getCoordinateReferenceSystem()); }
private static <P extends Position> org.geolatte.geom.Point<P> from(org.locationtech.jts.geom.Point jtsPoint, CoordinateReferenceSystem<P> crs) { CoordinateSequence cs = jtsPoint.getCoordinateSequence(); return new org.geolatte.geom.Point<P>(pscsFactory.toPositionSequence(cs, crs.getPositionClass(), crs), crs); }
private Point<?> createPoint(SqlServerGeometry nativeGeom, int pntOffset) { PositionSequence<?> positionSequence = nativeGeom.coordinateRange(new IndexRange(pntOffset, pntOffset + 1)); return new Point(positionSequence, nativeGeom.getCoordinateReferenceSystem()); }