Package com.vividsolutions.jts.algorithm

Examples of com.vividsolutions.jts.algorithm.ConvexHull


  }

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


    public Object evaluate(Object[] args) throws TypeErrorException
    {
        if(args.length==1)
        {
            Geometry geo = GeoHelper.getGeoSPARQLGeometry(args[0]);
            ConvexHull hull = new ConvexHull(geo);
            Geometry convexHullGeo = hull.getConvexHull();
            return new GeoSPARQLWktSerializer().toLiteral(convexHullGeo);
        }
        else
        {
            throw new TypeErrorException("ConvexHull Function expects exactly 1 arguments: A geometry.");
View Full Code Here

  }

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

   *
   * @param geometry
   * @return
   */
  private LinearRing getConvexHull(Geometry geometry) {
    return getOuterLinearRingFromGeometry((new ConvexHull(geometry)).getConvexHull());
  }
View Full Code Here

        int mainComponentIndex = -1;
        int component = 0;
        for (Integer key : componentCoordinates.keySet()) {
            List<Coordinate> coords = componentCoordinates.get(key);
            Coordinate[] coordArray = new Coordinate[coords.size()];
            ConvexHull hull = new ConvexHull(coords.toArray(coordArray), GeometryUtils.getGeometryFactory());
            Geometry geom = hull.getConvexHull();
            // buffer components which are mere lines so that they do not disappear.
            if (geom instanceof LineString) {
                geom = geom.buffer(0.01); // ~10 meters
            } else if (geom instanceof Point) {
                geom = geom.buffer(0.05); // ~50 meters, so that it shows up
View Full Code Here

        GeometryCollection geometries = new GeometryCollection(points, gf);
        return geometries;
    }

    public static Geometry makeConvexHull(Graph graph) {
        return new ConvexHull(geometryCollectionFromVertices(graph)).getConvexHull();
    }
View Full Code Here

  public void testManyIdenticalPoints() throws Exception {
    Coordinate[] pts = new Coordinate[100];
    for (int i = 0; i < 99; i++)
      pts[i] = new Coordinate(0,0);
    pts[99] = new Coordinate(1,1);
    ConvexHull ch = new ConvexHull(pts, geometryFactory);
    Geometry actualGeometry = ch.getConvexHull();
    Geometry expectedGeometry = reader.read("LINESTRING (0 0, 1 1)");
    assertEquals(expectedGeometry.toString(), actualGeometry.toString());
  }
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.algorithm.ConvexHull

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.