Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createLineString()


    public void testNullZeroOp() throws Exception {
        //create features suitable for the test
        GeometryFactory factory=new GeometryFactory();
        // test with 2 arbitrary features, with the second having a null attribute
        LineString[] line = new LineString[3];
        line[0] = factory.createLineString(new Coordinate[]{new Coordinate(10, 10),
                new Coordinate(10, 20),});
        line[1] = factory.createLineString(new Coordinate[]{new Coordinate(20, 10),
                new Coordinate(20, 20), new Coordinate(30, 15), new Coordinate(20, 15),
                new Coordinate(20, 30)});
       
View Full Code Here


        GeometryFactory factory=new GeometryFactory();
        // test with 2 arbitrary features, with the second having a null attribute
        LineString[] line = new LineString[3];
        line[0] = factory.createLineString(new Coordinate[]{new Coordinate(10, 10),
                new Coordinate(10, 20),});
        line[1] = factory.createLineString(new Coordinate[]{new Coordinate(20, 10),
                new Coordinate(20, 20), new Coordinate(30, 15), new Coordinate(20, 15),
                new Coordinate(20, 30)});
       
        String[] attrValues = new String[2];
        attrValues[0] = "value0"; attrValues[1] = null; //$NON-NLS-1$
View Full Code Here

          .getCoordinateSequence();
      LiteCoordinateSequence lseq=new LiteCoordinateSequence(seq.toCoordinateArray());
     
      if (decimateOnEnvelope(line, lseq)) {
        if(lseq.size()>=2)
          return gFac.createLineString(lseq);
      }
      if(lseq.size()>=2)
        return gFac.createLineString(decimate(lseq));
      return null;
    } else if (geom instanceof Polygon) {
View Full Code Here

      if (decimateOnEnvelope(line, lseq)) {
        if(lseq.size()>=2)
          return gFac.createLineString(lseq);
      }
      if(lseq.size()>=2)
        return gFac.createLineString(decimate(lseq));
      return null;
    } else if (geom instanceof Polygon) {
      Polygon line = (Polygon) geom;
      Coordinate[] exterior=decimate(line.getExteriorRing()).getCoordinates();
      forceClosed(exterior);
View Full Code Here

    }
   
    public void testHeterogeneousGeometry() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        Point point = gf.createPoint(new Coordinate(10, 10));
        LineString line = gf.createLineString(new Coordinate[] {
                new Coordinate(50, 50), new Coordinate(100, 100) });
        Polygon polygon = gf.createPolygon(gf
                .createLinearRing(new Coordinate[] { new Coordinate(0, 0),
                        new Coordinate(0, 200), new Coordinate(200, 200),
                        new Coordinate(200, 0), new Coordinate(0, 0) }), null);
View Full Code Here

        assertEquals(bbox, clone);
    }
   
    public void testIntersectsReproject() 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("geom"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
View Full Code Here

        assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData());
    }
   
    public void testIntersectsUnreferencedGeometry() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
View Full Code Here

        assertEquals(original, clone);
    }
   
    public void testIntersectsUnreferencedProperty() 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);
View Full Code Here

        assertEquals(original, clone);
    }
   
    public void testPropertyEqualsFirstArgumentNotPropertyName() 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"));
       
        // make sure a class cast does not occur, see: http://jira.codehaus.org/browse/GEOS-1860
        Function function = ff.function("geometryType", ff.property("geom"));
        PropertyIsEqualTo original = ff.equals(ff.literal("Point"), function);
View Full Code Here

        final LineString ls;
       
       
        public GeometryFunction() throws Exception {
            GeometryFactory gf = new GeometryFactory();
            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"));
        }

        public String getName() {
            return "function";
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.