Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory


        Polygon tri = fact.createPolygon(ring, null);
        return tri;
    }

    public String toString() {
        return getGeometry(new GeometryFactory()).toString();
    }
View Full Code Here


    computeAreaEnv = new Envelope(allPointsEnv);
    computeAreaEnv.expandBy(delta);
  }

  private void computeConvexHull() {
    GeometryFactory fact = new GeometryFactory();
    Coordinate[] coords = getPointArray();
    ConvexHull hull = new ConvexHull(coords, fact);
    convexHull = hull.getConvexHull();
  }
View Full Code Here

            }
           
            if(tripPattern.shape != null) {
             
              MathTransform mt = GeoUtils.getTransform(new Coordinate(tripPattern.shape.shape.getCoordinateN(0).y, tripPattern.shape.shape.getCoordinateN(0).x));
              GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);
             
              Coordinate[] mCoords =  tripPattern.shape.shape.getCoordinates();
              ArrayList<Coordinate> coords = new ArrayList<Coordinate>();
             
              for(Coordinate mCoord : mCoords) {
                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

      mergedStop.delete();
     
    }

    public void setLocation(Hashtable<String, Double> loc) {
        GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);
        this.location = geometryFactory.createPoint(new Coordinate(loc.get("lng"), loc.get("lat")));;
    }
View Full Code Here

    }
      
    public Point locationPoint() {
  
      Hashtable<String, Double> loc = this.getLocation();
      GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);
        return geometryFactory.createPoint(new Coordinate(loc.get("lng"), loc.get("lat")));
    }
View Full Code Here

        this.stopName = stopName;
        this.stopDesc = stopDesc;
        this.stopUrl = stopUrl;
        this.locationType = LocationType.STOP;

        GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);

        this.location = geometryFactory.createPoint(new Coordinate(lon, lat));;
    }
View Full Code Here

      List<Object[]> result = Stop.em().createNativeQuery("SELECT st_x(calc.center), st_y(calc.center) from (SELECT ST_Centroid(ST_Extent(location)) as center FROM stop WHERE agency_id = ?) calc ;")
          .setParameter(1,  agencyId)
          .getResultList();

      Object[] cols = result.get(0);
        GeometryFactory geometryFactory = new GeometryFactory(new PrecisionModel(), 4326);
       
        return geometryFactory.createPoint(new Coordinate((Double)cols[0], (Double)cols[1]));
    }
View Full Code Here

        {
          coords.add(ps.controlPoint.controlPoint.getCoordinate());
        }
      }
     
      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

   
    public void processSegments()
    { 
      clear();
     
      GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
     
      int geomCount = this.originalShape.getNumGeometries();
      int i = 0;
     
      Integer sequenceId = 1;
     
      while(i < geomCount)
      {
        LineString lineSegment = (LineString)this.originalShape.getGeometryN(i);
       
        GisRouteControlPoint fromPoint = findControlPoint(geometryFactory.createPoint(lineSegment.getCoordinateN(0)), sequenceId);
       
        sequenceId = fromPoint.originalSequence + 1;
       
         GisRouteControlPoint toPoint = findControlPoint(geometryFactory.createPoint((lineSegment.getCoordinateN(lineSegment.getNumPoints() - 1))), sequenceId);
        
         sequenceId = toPoint.originalSequence + 1;
        
         if(GisRouteSegment.count("fromPoint = ? AND toPoint = ?", fromPoint, toPoint) == 0)
         {
View Full Code Here

      Coordinate c = new Coordinate(v.getLng(), v.getLat());
      coords[i] = c;
    }
   
    // now create a line string from the coordinates array where null = no holes in the polygon
    LinearRing ring = new GeometryFactory().createLinearRing(coords);
    Geometry geometry = new GeometryFactory().createPolygon(ring, null);
   
    // Note: the centroid for the ZoneDetail vertices is never
    // stored in the database. It was just as easy to calculate
    // it on the fly in ZoneDAO.getZoneDetails()
   
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.GeometryFactory

Copyright © 2018 www.massapicom. 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.