Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.Geometry.toText()


        Optional<?> merged = diff2.applyOn(Optional.of(newGeom));
        assertTrue(merged.isPresent());
        Geometry mergedGeom = (Geometry) merged.get();
        assertEquals(
                "MULTILINESTRING ((40 40, 20 45, 45 35, 30 30), (20 35, 45 10, 31 6, 10 30, 20 35))",
                mergedGeom.toText());
    }

    @Test
    public void testNoConflictAddingPoints() throws Exception {
        Geometry oldGeom = new WKTReader()
View Full Code Here


        Optional<?> merged = diff2.applyOn(Optional.of(newGeom));
        assertTrue(merged.isPresent());
        Geometry mergedGeom = (Geometry) merged.get();
        assertEquals(
                "MULTILINESTRING ((40 40, 10 10, 20 45, 45 30, 30 30), (20 35, 45 10, 31 6, 10 30, 20 35))",
                mergedGeom.toText());
    }

    @Test
    public void testNoConflictRemovingPoints() throws Exception {
        Geometry oldGeom = new WKTReader()
View Full Code Here

        assertFalse(diff.conflicts(diff2));
        Optional<?> merged = diff2.applyOn(Optional.of(newGeom));
        assertTrue(merged.isPresent());
        Geometry mergedGeom = (Geometry) merged.get();
        assertEquals("MULTILINESTRING ((40 40, 45 30, 40 40), (20 35, 45 10, 31 6, 10 30, 20 35))",
                mergedGeom.toText());
    }

    @Test
    public void testNoConflictIfSameDiff() throws Exception {
        Geometry oldGeom = new WKTReader()
View Full Code Here

        Geometry g = (Geometry) evaluateLiteral(expression, Geometry.class);
        if (g instanceof LinearRing) {
            //WKT does not support linear rings
            g = g.getFactory().createLineString(((LinearRing) g).getCoordinateSequence());
        }
        out.write( "GeomFromText('"+g.toText()+"', "+currentSRID+")");
    }
   
    @Override
    protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
        PropertyName property, Literal geometry, boolean swapped, Object extraData) {
View Full Code Here

        Geometry g = (Geometry) evaluateLiteral(expression, Geometry.class);
        if (g instanceof LinearRing) {
            //WKT does not support linear rings
            g = g.getFactory().createLineString(((LinearRing) g).getCoordinateSequence());
        }
        out.write( "geometry::STGeomFromText('"+g.toText()+"', "+currentSRID+")");
    }
   
    @Override
    protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
            PropertyName property, Literal geometry, boolean swapped, Object extraData) {
View Full Code Here

        Geometry g = (Geometry) evaluateLiteral(expression, Geometry.class);
        if (g instanceof LinearRing) {
            //WKT does not support linear rings
            g = g.getFactory().createLineString(((LinearRing) g).getCoordinateSequence());
        }
        out.write( "ST_GeomFromText('"+g.toText()+"', "+currentSRID+")");
    }
   
   
    @Override
    protected Object visitBinarySpatialOperator(BinarySpatialOperator filter,
View Full Code Here

    }

    @Override
    public Comparable getSeriesKey(int series) {
        Geometry g = geometries.get(series);
        String wkt = g.toText();
        if (g instanceof Point) {
            return wkt;
        }
        else {
            int i = wkt.indexOf(',');
View Full Code Here

        Object compositeCurve = p.parse(getClass().getResourceAsStream("gml_compositecurve_1.xml"));
        assertFalse(compositeCurve instanceof String);
        System.out.println(compositeCurve);
        assertTrue("wrong element type", compositeCurve instanceof Geometry);
        Geometry geom =(Geometry)compositeCurve;
        assertEquals("LINESTRING (353148.991 5530600.811, 353151.478 5530602.263)", geom.toText());
        //assertNotNull(l);
    }
}
View Full Code Here

     
      Geometry source=wktReader.read(parts[0]);           
      Class<?> target=Class.forName("com.vividsolutions.jts.geom."+parts[1]);
      String expected=parts[2];
      Geometry converted=convert(source, target);
      assertEquals(expected,converted.toText());     
//      System.out.println(parts[3]+": OK");
    }
 
  }
View Full Code Here

      //Geometry to String
      if ( String.class.equals( target ) ) {
        return new Converter() {
          public Object convert(Object source, Class target) throws Exception {
            Geometry geometry = (Geometry) source;
            return geometry.toText();
          }
        };
      }
    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.