public Object getProperty(Object object, QName name) throws Exception { Point point = (Point) object; if (GML.coord.equals(name)) { return point.getCoordinate(); } return null; } }
public CoordinateSequence getCoordinateSequence() { return point.getCoordinateSequence(); }
private static void writePoint(Point point, SliceOutput output) { output.writeByte(GeometrySerializationType.POINT.code()); if (!point.isEmpty()) { writeCoordinate(point.getCoordinate(), output); } else { output.writeDouble(NaN); output.writeDouble(NaN); } }
/** * @param point * @throws TransformException */ public Point transformPoint(Point point, GeometryFactory gf) throws TransformException { // if required, init csTransformer using geometry's CSFactory init(gf); CoordinateSequence cs = projectCoordinateSequence(point.getCoordinateSequence()); Point transformed = gf.createPoint(cs); transformed.setUserData(point.getUserData()); return transformed; }
public static double getX(Geometry arg0) { if (!(arg0 instanceof Point)) return 0d; Point _this = (Point) arg0; return _this.getX(); }
if (point.getY() >= 0) { fb.add("N"); } else { if (wgs84Point.getCoordinate().getOrdinate(fc.northDimension) >= 0) { fb.add("N"); } else {
public void write(ByteBuffer buffer, Object geometry) { Point point = (Point) geometry; Coordinate c = point.getCoordinate(); buffer.putDouble(c.x); buffer.putDouble(c.y); if (shapeType == ShapeType.POINTZ) { if (Double.isNaN(c.z)) { // nan means not defined buffer.putDouble(0.0); } else { buffer.putDouble(c.z); } } if ((shapeType == ShapeType.POINTZ) || (shapeType == ShapeType.POINTM)) { double m = point.getCoordinateSequence().getM(0); buffer.putDouble(!Double.isNaN(m) ? m : 0.0); // M } } }
public static double getY(Geometry arg0) { if (!(arg0 instanceof Point)) return 0d; Point _this = (Point) arg0; return _this.getY(); }
public void testPos() throws Exception { GML3MockData.point(document, document); Point p = (Point) parse(); assertNotNull(p); assertEquals(new Coordinate(1d, 2d), p.getCoordinate()); assertTrue(p.getUserData() instanceof CoordinateReferenceSystem); }
public boolean equalsExact(Geometry other, double tolerance) { if (!isEquivalentClass(other)) { return false; } if (isEmpty() && other.isEmpty()) { return true; } if (isEmpty() != other.isEmpty()) { return false; } return equal(((Point) other).getCoordinate(), this.getCoordinate(), tolerance); }
/** * Return a testsuite-suite point (filter, ...) * * @return a testsuite-suite point */ public Point getTestPoint() { WKTReader reader = new WKTReader(); try { Point point = (Point) reader.read( TEST_POINT_WKT ); point.setSRID( getTestSrid() ); return point; } catch (ParseException e) { throw new RuntimeException( e ); } }
@Test public void testDecimate3DPoint() throws Exception { Point p = gf.createPoint(csf.create(new double[] {0, 1, 2}, 3)); Decimator d = new Decimator(identity, new Rectangle(0, 0, 5, 5), 0.8); d.decimateTransformGeneralize(p, identity); assertEquals(1, p.getNumPoints()); assertEquals(2, p.getCoordinateSequence().getDimension()); }
/** * Generates the point. * * @param geometryFactory Geometry factory to be used to create the point. * @return Created Point. */ public Geometry create(GeometryFactory geometryFactory) { Point point = geometryFactory.createPoint(coordinate); point.setUserData(getSRS()); point.setSRID(getSRID()); return point; } }
/** A simple constructor without normalization / validation. */ public JtsPoint(org.locationtech.jts.geom.Point pointGeom, JtsSpatialContext ctx) { super(ctx); this.pointGeom = pointGeom; this.empty = pointGeom.isEmpty(); }
public Object parse(Handler arg, GeometryFactory gf) throws SAXException { // one child, either a coord // or a coordinate sequence if(arg.children.size()!=1) throw new SAXException("Cannot create a point without exactly one coordinate"); int srid = getSrid(arg.attrs,gf.getSRID()); Object c = arg.children.get(0); Point p = null; if(c instanceof Coordinate){ p = gf.createPoint((Coordinate)c); }else{ p = gf.createPoint((CoordinateSequence)c); } if(p.getSRID()!=srid) p.setSRID(srid); return p; } });
public void apply(CoordinateSequenceFilter filter) { if (isEmpty()) return; filter.filter(coordinates, 0); if (filter.isGeometryChanged()) geometryChanged(); }
public Coordinate[] getCoordinates() { return isEmpty() ? new Coordinate[]{} : new Coordinate[]{ getCoordinate() }; }
public double getX() { return point.getX(); }
public double getY() { return point.getY(); }