Package com.vividsolutions.jts.geom

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


    if (Geometry.POINT.equals(geometryType)) {
      jts = factory.createPoint(convertCoordinates(geometry)[0]);
    } else if (Geometry.LINEAR_RING.equals(geometryType)) {
      jts = factory.createLinearRing(convertCoordinates(geometry));
    } else if (Geometry.LINE_STRING.equals(geometryType)) {
      jts = factory.createLineString(convertCoordinates(geometry));
    } else if (Geometry.POLYGON.equals(geometryType)) {
      LinearRing exteriorRing = (LinearRing) toInternal(geometry.getGeometries()[0]);
      LinearRing[] interiorRings = new LinearRing[geometry.getGeometries().length - 1];
      for (int i = 0; i < interiorRings.length; i++) {
        interiorRings[i] = (LinearRing) toInternal(geometry.getGeometries()[i + 1]);
View Full Code Here


  }
 
  @Test
  public void testGetBoundsIntersectsFiltered() throws Exception {
    GeometryFactory factory = new GeometryFactory();
    LineString equator = factory.createLineString(new Coordinate[] { new Coordinate(0, 0),
        new Coordinate(-180, 180) });
    Filter filter = filterService.createIntersectsFilter(equator,beanLayer.getLayerInfo().getFeatureInfo().getGeometryType().getName());
    Envelope bounds = layerService.getBounds(LAYER_ID,
        geoService.getCrs2(beanLayer.getLayerInfo().getCrs()), filter);
    Assert.assertEquals(0, bounds.getMinX(), ALLOWANCE);
View Full Code Here

        transformCache.put(key, getCrsTransform(key, crsTransformInfo));
      }
    }
    GeometryFactory factory = new GeometryFactory();
    EMPTY_GEOMETRIES.put(Point.class, factory.createPoint((Coordinate) null));
    EMPTY_GEOMETRIES.put(LineString.class, factory.createLineString((Coordinate[]) null));
    EMPTY_GEOMETRIES.put(Polygon.class, factory.createPolygon(null, null));
    EMPTY_GEOMETRIES.put(MultiPoint.class, factory.createMultiPoint((Coordinate[]) null));
    EMPTY_GEOMETRIES.put(MultiLineString.class, factory.createMultiLineString((LineString[]) null)); // cast needed!
    EMPTY_GEOMETRIES.put(MultiPolygon.class, factory.createMultiPolygon((Polygon[]) null)); // cast needed!
    EMPTY_GEOMETRIES.put(Geometry.class, factory.createGeometryCollection(null));
View Full Code Here

                coords.add(new Coordinate(mCoord.x, mCoord.y));
              }
             
              Coordinate[] coordArray = coords.toArray(new Coordinate[coords.size()]);
             
              LineString ls = (LineString) JTS.transform(geometryFactory.createLineString(coordArray), mt);
              LocationIndexedLine indexLine = new LocationIndexedLine(ls);
             
              Logger.info("length: " + ls.getLength());
             
              patternStops = TripPatternStop.find("pattern = ?", tripPattern).fetch();
View Full Code Here

     
      GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
     
      if(coords.size() > 1)
      {
        LineString geom = geometryFactory.createLineString(coords.toArray(new Coordinate[coords.size()]));
       
        if(reverseAlignment)
          geom = (LineString)geom.reverse();
       
        return geom;
View Full Code Here

    shellCoordinates = addIntersection(boundaryCoordinates, line, fc, line);

    Coordinate[] shellClosed = shellCoordinates.toArray(new Coordinate[shellCoordinates.size()]);
    shellClosed = GeometryUtil.closeGeometry(shellClosed);

    result = fc.createLineString(shellClosed);

    return result;
  }

  /**
 
View Full Code Here

    type2=DataUtilities.createType("type2", "geom2:Point,name:String"); //$NON-NLS-1$ //$NON-NLS-2$
   
    GeometryFactory fac=new GeometryFactory();
    point=fac.createPoint(new Coordinate(10,10));
   
    line=fac.createLineString(new Coordinate[]{
      new Coordinate(20,20), new Coordinate(30,30
    });
   
    name="Name"; //$NON-NLS-1$
    id=1;
View Full Code Here

       
        double maxx = -120;
        double maxy = 59.9;
        double minx = -125;
        double miny = 50;
        LineString linestring = gfac.createLineString(new Coordinate[]{
                new Coordinate(minx,miny),
                new Coordinate(maxx,maxy)
        });
       
        linestring=(LineString) JTS.transform(linestring, CRS.findMathTransform(DefaultGeographicCRS.WGS84, crs, true));
View Full Code Here

    public void testOverlapsOp() throws Exception {
        //create features suitable for the test
        GeometryFactory factory = new GeometryFactory();
        LineString[] line = new LineString[4];
        // first test: 2 overlapping lines, overlap test fails?
        line[0] = factory.createLineString(new Coordinate[]{new Coordinate(10, 10),
                new Coordinate(20, 20),});
        line[1] = factory.createLineString(new Coordinate[]{new Coordinate(15, 15),
                new Coordinate(25, 25),});
        assertTrue(line[0].overlaps(line[1])); // just checking :)
        // second test: does this validation test for self-overlaps? (it shouldn't)
View Full Code Here

        GeometryFactory factory = new GeometryFactory();
        LineString[] line = new LineString[4];
        // first test: 2 overlapping lines, overlap test fails?
        line[0] = factory.createLineString(new Coordinate[]{new Coordinate(10, 10),
                new Coordinate(20, 20),});
        line[1] = factory.createLineString(new Coordinate[]{new Coordinate(15, 15),
                new Coordinate(25, 25),});
        assertTrue(line[0].overlaps(line[1])); // just checking :)
        // second test: does this validation test for self-overlaps? (it shouldn't)
        line[2] = factory.createLineString(new Coordinate[]{new Coordinate(50, 50),
                new Coordinate(60, 50), new Coordinate(55, 50),});
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.