private static Point readPoint(SliceInput input) { Coordinate coordinates = readCoordinate(input); if (isNaN(coordinates.x) || isNaN(coordinates.y)) { return GEOMETRY_FACTORY.createPoint(); } return GEOMETRY_FACTORY.createPoint(coordinates); }
void finish() { Stop stop = gtfsFeed.stops.get(stopTime.stop_id); stops.add(new Trip.Stop(stop.stop_id, stop.stop_name, geometryFactory.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat)), updatedArrival.map(Date::from).orElse(Date.from(arrivalTimeFromHopEdge)), Date.from(arrivalTimeFromHopEdge), updatedArrival.map(Date::from).orElse(null), isArrivalCancelled(stopSequence), null, null, null, isDepartureCancelled(stopSequence))); for (Trip.Stop tripStop : stops) { logger.trace("{}", tripStop); } }
Optional<Instant> updatedDeparture = getDepartureDelay(stopSequence).map(delay -> plannedDeparture.plus(delay, SECONDS)); Stop stop = gtfsFeed.stops.get(stopTime.stop_id); stops.add(new Trip.Stop(stop.stop_id, stop.stop_name, geometryFactory.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat)), null, null, null, isArrivalCancelled(stopSequence), updatedDeparture.map(Date::from).orElse(Date.from(plannedDeparture)), Date.from(plannedDeparture), Optional<Instant> updatedDeparture = getDepartureDelay(stopTime.stop_sequence).map(delay -> plannedDeparture.plus(delay, SECONDS)); Stop stop = gtfsFeed.stops.get(stopTime.stop_id); stops.add(new Trip.Stop(stop.stop_id, stop.stop_name, geometryFactory.createPoint(new Coordinate(stop.stop_lon, stop.stop_lat)), updatedArrival.map(Date::from).orElse(Date.from(arrivalTimeFromHopEdge)), Date.from(arrivalTimeFromHopEdge), updatedArrival.map(Date::from).orElse(null), isArrivalCancelled(stopSequence),
for (Vertex vertex : (Collection<Vertex>) tin.getVertices(true)) { JsonFeature feature = new JsonFeature(); feature.setGeometry(geometryFactory.createPoint(vertex.getCoordinate())); HashMap<String, Object> properties = new HashMap<>(); properties.put("z", vertex.getZ());
Integer.valueOf(1), new Double(1.1), gf.createPoint(new Coordinate(1, 1)) }, "fid.1")); Integer.valueOf(2), new Double(2.2), gf.createPoint(new Coordinate(2, 2)) }, "fid.2")); Integer.valueOf(3), new Double(3.3), gf.createPoint(new Coordinate(3, 3)) }, "fid.3"));
/** * Creates an empty Point * * @return an empty Point */ public Point point() { return geomFact.createPoint(createCS(new double[0], 2)); }
/** * Creates a 2D Point. * * @param x the X ordinate * @param y the Y ordinate * @return a Point */ public Point point(double x, double y) { return geomFact.createPoint(createCS(new double[] {x, y}, 2)); }
/** * Creates a 3D Point. * * @param x the X ordinate * @param y the Y ordinate * @param z the Z ordinate * @return a Point */ public Point pointZ(double x, double y, double z) { return geomFact.createPoint(createCS(new double[] {x, y, z}, 3)); }
/** * Creates a 1D Point. * * @param x the X ordinate * @return a Point */ public Point point(double x) { return geomFact.createPoint(createCS(new double[] {x}, 1)); }
event.setId( 1L); event.setName( "Hibernate ORM presentation"); Point point = geometryFactory.createPoint( new Coordinate( 10, 5 ) ); event.setLocation( point );
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { CoordinateSequence coordinates = (CoordinateSequence) node.getChildValue(KML.coordinates.getLocalPart()); return geometryFactory.createPoint(coordinates.getCoordinate(0)); }
/** * Tests if a specified {@link Point2D}is inside the boundary of the <code>Shape</code>. * * @param p a specified <code>Point2D</code> * @return <code>true</code> if the specified <code>Point2D</code> is inside the boundary of the * <code>Shape</code>; <code>false</code> otherwise. */ public boolean contains(Point2D p) { Coordinate coord = new Coordinate(p.getX(), p.getY()); Geometry point = geometry.getFactory().createPoint(coord); return geometry.contains(point); }
/** * Tests if a specified {@link Point2D} is inside the boundary of the <code>Shape</code>. * * @param p a specified <code>Point2D</code> * @return <code>true</code> if the specified <code>Point2D</code> is inside the boundary of the * <code>Shape</code>; <code>false</code> otherwise. */ public boolean contains(Point2D p) { Coordinate coord = new Coordinate(p.getX(), p.getY()); Geometry point = geometry.getFactory().createPoint(coord); return geometry.contains(point); }
private Point makeSamplePoint(final GeometryFactory geomFac) { Coordinate c = new Coordinate(xCenter - 14.0d, yCenter - 14.0d); Point point = geomFac.createPoint(c); return point; }
protected void setUp() throws Exception { super.setUp(); type = DataUtilities.createType("default", "name:String,*geom:Geometry"); GeometryFactory fac = new GeometryFactory(); geom = fac.createPoint(new Coordinate(10, 10)); SimpleFeature f1 = SimpleFeatureBuilder.build(type, new Object[] {"original", geom}, null); ds = new MemoryDataStore(new SimpleFeature[] {f1}); }
public void testSetNonSequential() throws Exception { GeometryFactory gf = new GeometryFactory(); builder.set("float", new Float(2.0)); builder.set("point", gf.createPoint(new Coordinate(0, 0))); builder.set("integer", Integer.valueOf(1)); SimpleFeature feature = builder.buildFeature("fid"); assertNotNull(feature); assertEquals(3, feature.getAttributeCount()); assertTrue(gf.createPoint(new Coordinate(0, 0)).equals(feature.getAttribute(0))); assertEquals(Integer.valueOf(1), feature.getAttribute(1)); assertEquals(new Float(2.0), feature.getAttribute(2)); }
private LineString circleArcInBounds( double x, double y, double radius, ReferencedEnvelope bounds) { Point center = gf.createPoint(new Coordinate(x, y)); Polygon buffered = (Polygon) center.buffer(radius, 64); Polygon mask = JTS.toGeometry(bounds); Geometry intersection = buffered.getExteriorRing().intersection(mask); return (LineString) intersection; }
@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()); }
/** Tests encoding for X, Y, Z, M ordinates number */ @Test public void testEncodeZM() throws Exception { GeometryFactory gf = new GeometryFactory(); Point pointM = gf.createPoint(new CoordinateXYZM(1, 1, 2, 4)); CoordinateSequence seq = pointM.getCoordinateSequence(); Document doc = encode(seq, GML.pos); checkPosOrdinates(doc, 4); } }
protected void addFeature(SimpleFeatureType featureType, JDBCFeatureStore features) throws Exception { SimpleFeatureBuilder b = new SimpleFeatureBuilder(featureType); b.add("four"); b.add(new GeometryFactory().createPoint(new Coordinate(4, 4))); SimpleFeature f = b.buildFeature(null); features.addFeatures(DataUtilities.collection(f)); // pattern match to handle the multi primary key case assertTrue( ((String) f.getUserData().get("fid")) .matches(tname(featureType.getTypeName()) + ".4(\\..*)?")); }