public Object getUserData() { return lineString.getUserData(); }
public Object getUserData() { return super.getUserData(); }
public Object getUserData() { return super.getUserData(); }
private LineString transformStraightLineString(LineString ls, GeometryFactory gf) throws TransformException { // if required, init csTransformer using geometry's CSFactory init(gf); CoordinateSequence cs = projectCoordinateSequence(ls.getCoordinateSequence()); LineString transformed = null; if (ls instanceof LinearRing) { transformed = gf.createLinearRing(cs); } else { transformed = gf.createLineString(cs); } transformed.setUserData(ls.getUserData()); return transformed; }
public void testIntersectsFilterFunctionReferencedGeometry() throws Exception { GeometryFactory gf = new GeometryFactory(); LineString ls = gf.createLineString( new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)}); ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326")); Function intersects = ff.function("intersects", ff.property("geom"), ff.literal(ls)); Function clone = (Function) intersects.accept(reprojector, null); assertNotSame(intersects, clone); assertEquals(clone.getParameters().get(0), intersects.getParameters().get(0)); assertFalse(clone.getParameters().get(1).equals(intersects.getParameters().get(1))); LineString clonedLs = (LineString) ((Literal) clone.getParameters().get(1)).getValue(); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
Double value = (Double) line.getUserData(); line.setUserData(null);
public void testPropertyEqualWithFunction() throws Exception { Function function = new GeometryFunction(); // see if coordinates gets flipped, urn forces lat/lon interpretation PropertyIsEqualTo original = ff.equals(ff.property("geom"), function); PropertyIsEqualTo clone = (PropertyIsEqualTo) original.accept(reprojector, null); assertNotSame(original, clone); assertEquals(clone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) clone.getExpression2().evaluate(null); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
public void testIntersectsWithFunction() throws Exception { Function function = new GeometryFunction(); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(ff.property("geom"), function); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); Intersects isClone = (Intersects) clone; assertEquals(isClone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
public void testIntersectsReferencedGeometry() throws Exception { GeometryFactory gf = new GeometryFactory(); LineString ls = gf.createLineString( new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)}); ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326")); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(ff.property("line"), ff.literal(ls)); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); Intersects isClone = (Intersects) clone; assertEquals(isClone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
public void testIntersectsReproject(Expression geom) throws FactoryException { GeometryFactory gf = new GeometryFactory(); LineString ls = gf.createLineString( new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)}); ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326")); // see if coordinates gets flipped, urn forces lat/lon interpretation Intersects original = ff.intersects(geom, ff.literal(ls)); Filter clone = (Filter) original.accept(reprojector, null); assertNotSame(original, clone); Intersects isClone = (Intersects) clone; assertEquals(isClone.getExpression1(), original.getExpression1()); LineString clonedLs = (LineString) ((Literal) isClone.getExpression2()).getValue(); assertTrue(15 == clonedLs.getCoordinateN(0).x); assertTrue(10 == clonedLs.getCoordinateN(0).y); assertTrue(25 == clonedLs.getCoordinateN(1).x); assertTrue(20 == clonedLs.getCoordinateN(1).y); assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData()); }
@Test /** Test ToLineString with non EPSG SRS. */ public void testToLineStringCustomSRS() { String customSRS = "#borehole.GA.1"; Function function = ff.function("toLineString", ff.literal(customSRS), pointOne, pointTwo); Object value = function.evaluate(feature); assertTrue(value instanceof LineString); LineString linestring = (LineString) value; assertEquals(linestring.getDimension(), 1); // 1D SRS should be created CoordinateReferenceSystem crs = (CoordinateReferenceSystem) linestring.getUserData(); assertEquals(1, crs.getCoordinateSystem().getDimension()); assertEquals(customSRS, crs.getName().getCode()); assertEquals(linestring.getCoordinateN(0).x, 5.0, 0); assertEquals(linestring.getCoordinateN(0).y, Coordinate.NULL_ORDINATE, 0); assertEquals(linestring.getCoordinateN(0).z, Coordinate.NULL_ORDINATE, 0); assertEquals(linestring.getCoordinateN(1).x, 2.5, 0); assertEquals(linestring.getCoordinateN(1).y, Coordinate.NULL_ORDINATE, 0); assertEquals(linestring.getCoordinateN(1).z, Coordinate.NULL_ORDINATE, 0); }
@Override public MultiLineString apply(LineString object) throws UnconvertibleObjectException { final MultiLineString geom = object.getFactory().createMultiLineString(new LineString[]{object}); geom.setSRID(object.getSRID()); geom.setUserData(object.getUserData()); return geom; }
@Test /** Test ToLineString with EPSG SRS. */ public void testToLineStringEPSG() { Function function = ff.function("toLineString", ff.literal("EPSG:9902"), pointOne, pointTwo); Object value = function.evaluate(feature); assertTrue(value instanceof LineString); LineString linestring = (LineString) value; assertEquals(linestring.getDimension(), 1); // 1D SRS should be created CoordinateReferenceSystem crs = (CoordinateReferenceSystem) linestring.getUserData(); assertEquals(1, crs.getCoordinateSystem().getDimension()); assertEquals("EPSG:9902", crs.getName().getCode()); assertEquals(linestring.getCoordinateN(0).x, 5.0, 0); assertEquals(linestring.getCoordinateN(0).y, Coordinate.NULL_ORDINATE, 0); assertEquals(linestring.getCoordinateN(0).z, Coordinate.NULL_ORDINATE, 0); assertEquals(linestring.getCoordinateN(1).x, 2.5, 0); assertEquals(linestring.getCoordinateN(1).y, Coordinate.NULL_ORDINATE, 0); assertEquals(linestring.getCoordinateN(1).z, Coordinate.NULL_ORDINATE, 0); }
smoothedLine.setUserData(ls.getUserData());
/** * * @throws TransformException */ public LineString transformLineString(final LineString ls, final GeometryFactory gf) throws TransformException { CoordinateSequence cs = projectCoordinateSequence(ls.getCoordinateSequence()); final LineString transformed; if (ls instanceof LinearRing) { cs = ensureClosed(cs); transformed = gf.createLinearRing(cs); } else { transformed = gf.createLineString(cs); } transformed.setUserData( ls.getUserData() ); return transformed; }
ls.setUserData(line.getUserData()); return ls;