protected Geometry createSubGeomInstance(String token, boolean haveM) throws SQLException { return new Point(token, haveM); }
private org.deegree.geometry.primitive.Point buildPoint( org.postgis.Point p, ICRS crs ) { double[] coords = new double[p.getDimension()]; coords[0] = p.getX(); coords[1] = p.getY(); if ( p.getDimension() > 2 ) { coords[2] = p.getZ(); } return new DefaultPoint( null, crs, null, coords ); }
private Point[] toPoints(Coordinate[] coordinates) { Point[] points = new Point[coordinates.length]; for (int i = 0; i < coordinates.length; i++) { Coordinate c = coordinates[i]; Point pt; if (Double.isNaN(c.z)) { pt = new Point(c.x, c.y); } else { pt = new Point(c.x, c.y, c.z); } if (c instanceof MCoordinate) { MCoordinate mc = (MCoordinate) c; if (!Double.isNaN(mc.m)) { pt.setM(mc.m); } } points[i] = pt; } return points; }
private MCoordinate toJTSCoordinate(Point pt) { MCoordinate mc; if (pt.dimension == 2) { mc = pt.haveMeasure ? MCoordinate.create2dWithMeasure(pt.getX(), pt .getY(), pt.getM()) : MCoordinate.create2d(pt.getX(), pt .getY()); } else { mc = pt.haveMeasure ? MCoordinate.create3dWithMeasure(pt.getX(), pt .getY(), pt.getZ(), pt.getM()) : MCoordinate.create3d(pt .getX(), pt.getY(), pt.getZ()); } return mc; }
public void setValue(String value) throws SQLException { int srid = Geometry.UNKNOWN_SRID; value = value.trim(); if (value.startsWith("SRID=")) { String[] temp = PGgeometry.splitSRID(value); value = temp[1].trim(); srid = Geometry.parseSRID(Integer.parseInt(temp[0].substring(5))); } String myPrefix = getPrefix(); if (value.startsWith(myPrefix)) { value = value.substring(myPrefix.length()).trim(); } String valueNoParans = GeometryTokenizer.removeLeadingAndTrailingStrings(value.trim(), "(", ")"); List<String> tokens = GeometryTokenizer.tokenize(valueNoParans, ','); llb = new Point(tokens.get(0)); urt = new Point(tokens.get(1)); if (srid != Geometry.UNKNOWN_SRID) { llb.setSrid(srid); urt.setSrid(srid); } }
mi = new double[] { translationVector[0] + min.getX(), translationVector[1] + min.getY() }; ma = new double[] { translationVector[0] + max.getX(), translationVector[1] + max.getY() }; mi = new double[] { translationVector[0] + min.getX(), translationVector[1] + min.getY(), min.getZ() }; ma = new double[] { translationVector[0] + max.getX(), translationVector[1] + max.getY(), max.getZ() };
public void setValue(String value) throws SQLException { int srid = Geometry.UNKNOWN_SRID; value = value.trim(); if (value.startsWith("SRID=")) { String[] temp = PGgeometry.splitSRID(value); value = temp[1].trim(); srid = Geometry.parseSRID(Integer.parseInt(temp[0].substring(5))); } String myPrefix = getPrefix(); if (value.startsWith(myPrefix)) { value = value.substring(myPrefix.length()).trim(); } String valueNoParans = GeometryTokenizer.removeLeadingAndTrailingStrings(value.trim(), "(", ")"); List<String> tokens = GeometryTokenizer.tokenize(valueNoParans, ','); llb = new Point(tokens.get(0)); urt = new Point(tokens.get(1)); if (srid != Geometry.UNKNOWN_SRID) { llb.setSrid(srid); urt.setSrid(srid); } }
/** * Creates a PostGIS Point object corresponding to the provided coordinates. * * @param latitude * The latitude measured in degrees. * @param longitude * The longitude measured in degrees. * @return The Point object. */ public Point createPoint(double latitude, double longitude) { Point result; result = new Point(longitude, latitude); result.srid = 4326; return result; } }
private Point parsePoint(ValueGetter data, boolean haveZ, boolean haveM) { double X = data.getDouble(); double Y = data.getDouble(); Point result; if (haveZ) { double Z = data.getDouble(); result = new Point(X, Y, Z); } else { result = new Point(X, Y); } if (haveM) { result.setM(data.getDouble()); } return result; }
protected Geometry createSubGeomInstance(String token, boolean haveM) throws SQLException { return new Point(token, haveM); }
private Point parsePoint(ValueGetter data, boolean haveZ, boolean haveM) { double X = data.getDouble(); double Y = data.getDouble(); Point result; if (haveZ) { double Z = data.getDouble(); result = new Point(X, Y, Z); } else { result = new Point(X, Y); } if (haveM) { result.setM(data.getDouble()); } return result; }
/** * Creates a PostGIS Point object corresponding to the provided coordinates. * * @param latitude * The latitude measured in degrees. * @param longitude * The longitude measured in degrees. * @return The Point object. */ public Point createPoint(double latitude, double longitude) { Point result; result = new Point(longitude, latitude); result.srid = 4326; return result; } }
private Polygon createWayBbox(double left, double right, double bottom, double top) { Point[] points; LinearRing ring; Polygon bbox; points = new Point[5]; points[0] = new Point(left, bottom); points[1] = new Point(left, top); points[2] = new Point(right, top); points[3] = new Point(right, bottom); points[4] = new Point(left, bottom); ring = new LinearRing(points); bbox = new Polygon(new LinearRing[] {ring}); bbox.srid = 4326; return bbox; }
private Polygon createWayBbox(double left, double right, double bottom, double top) { Point[] points; LinearRing ring; Polygon bbox; points = new Point[5]; points[0] = new Point(left, bottom); points[1] = new Point(left, top); points[2] = new Point(right, top); points[3] = new Point(right, bottom); points[4] = new Point(left, bottom); ring = new LinearRing(points); bbox = new Polygon(new LinearRing[] {ring}); bbox.srid = 4326; return bbox; }
/** * @param value The text representation of this LinearRing * @param haveM Hint whether we have a measure. This is given to us by other * "parent" Polygon, and is passed further to our parent. * @throws SQLException when a SQLException occurs */ protected LinearRing(String value, boolean haveM) throws SQLException { super(LINEARRING); String valueNoParans = GeometryTokenizer.removeLeadingAndTrailingStrings(value.trim(), "(", ")"); List<String> tokens = GeometryTokenizer.tokenize(valueNoParans, ','); int npoints = tokens.size(); Point[] points = new Point[npoints]; for (int p = 0; p < npoints; p++) { points[p] = new Point(tokens.get(p), haveM); } this.dimension = points[0].dimension; // fetch haveMeasure from subpoint because haveM does only work with // 2d+M, not with 3d+M geometries this.haveMeasure = points[0].haveMeasure; this.subgeoms = points; }
/** * @param value The text representation of this LinearRing * @param haveM Hint whether we have a measure. This is given to us by other * "parent" Polygon, and is passed further to our parent. * @throws SQLException when a SQLException occurs */ protected LinearRing(String value, boolean haveM) throws SQLException { super(LINEARRING); String valueNoParans = GeometryTokenizer.removeLeadingAndTrailingStrings(value.trim(), "(", ")"); List<String> tokens = GeometryTokenizer.tokenize(valueNoParans, ','); int npoints = tokens.size(); Point[] points = new Point[npoints]; for (int p = 0; p < npoints; p++) { points[p] = new Point(tokens.get(p), haveM); } this.dimension = points[0].dimension; // fetch haveMeasure from subpoint because haveM does only work with // 2d+M, not with 3d+M geometries this.haveMeasure = points[0].haveMeasure; this.subgeoms = points; }
maxD[1] -= translationVector[1]; if ( dimension == 2 ) { points[0] = new Point( minD[0], minD[1] ); points[1] = new Point( maxD[0], minD[1] ); points[2] = new Point( maxD[0], maxD[1] ); points[3] = new Point( minD[0], maxD[1] ); points[4] = new Point( minD[0], minD[1] ); points[0] = new Point( minD[0], minD[1], minD[2] ); points[1] = new Point( maxD[0], minD[1], minD[2] ); points[2] = new Point( maxD[0], maxD[1], maxD[2] ); points[3] = new Point( minD[0], maxD[1], minD[2] ); points[4] = new Point( minD[0], minD[1], minD[2] );
/** * @param nodeId * Id of the node. * @return Point object */ public Point createPoint(long nodeId) { NodeLocation nodeLocation = locationStore.getNodeLocation(nodeId); Point point = new Point(nodeLocation.getLongitude(), nodeLocation.getLatitude()); point.srid = 4326; return point; }
/** * @param nodeId * Id of the node. * @return Point object */ public Point createPoint(long nodeId) { NodeLocation nodeLocation = locationStore.getNodeLocation(nodeId); Point point = new Point(nodeLocation.getLongitude(), nodeLocation.getLatitude()); point.srid = 4326; return point; }
org.postgis.Point pointToAdd = new org.postgis.Point(); pointToAdd.setX(p.getLongitude()); pointToAdd.setY(p.getLatitude());