Examples of GeometryCollection


Examples of com.vividsolutions.jts.geom.GeometryCollection

            vectorXZToJTSCoordinate(p)});
      jtsPoints.add(new Point(coordinateSequence, GF));
    }
   
    triangulationBuilder.setSites(
        new GeometryCollection(jtsPoints.toArray(EMPTY_GEOM_ARRAY), GF));
    triangulationBuilder.setConstraints(
        new GeometryCollection(constraints.toArray(EMPTY_GEOM_ARRAY), GF));
    triangulationBuilder.setTolerance(0.01);
   
    /* run triangulation */
   
    Geometry triangulationResult = triangulationBuilder.getTriangles(GF);
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

          //don't add the broken polygon
        }
       
      }
    } else if (geometry instanceof GeometryCollection) {
      GeometryCollection collection = (GeometryCollection)geometry;
      for (int i = 0; i < collection.getNumGeometries(); i++) {
        result.addAll(polygonsXZFromJTSGeometry(collection.getGeometryN(i)));
      }
    } else {
      System.err.println("unhandled geometry type: " + geometry.getClass());
    }
   
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

     *
     * @return The resultant geometries.
     */
    public final List<Geometry> split(final Geometry geomToSplit) {

      final GeometryCollection coll = (GeometryCollection) geomToSplit;
      final int numParts = coll.getNumGeometries();

      List<Geometry> result = new ArrayList<Geometry>();

      for (int partN = 0; partN < numParts; partN++) {

        Geometry simplePartN = coll.getGeometryN(partN);

        // for multiGeometry, the geometry that is intersected, split
        // it, the one that isn't, add without changes.
        if (this.splitter.canSplit(simplePartN)) {
          List<Geometry> splittedPart = this.splitter.split(simplePartN);
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

    public boolean canSplit(Geometry geomToSplit) {

        if( !((geomToSplit instanceof MultiPolygon) || (geomToSplit instanceof MultiLineString)) ){
      throw new IllegalArgumentException("MultiPolygon or MultiLineString geometry is expected" ); //$NON-NLS-1$
        }
        final GeometryCollection coll = (GeometryCollection) geomToSplit;
        final int numParts = coll.getNumGeometries();

        for (int partN = 0; partN < numParts; partN++) {

      Geometry currentGeometry = coll.getGeometryN(partN);

      if (this.splitter.canSplit(currentGeometry)) {
          return true;
      }
        }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

        Geometry geometry = (Geometry) feature.getDefaultGeometry();
        if (geometry == null) {
          continue;
        } else if (geometry instanceof GeometryCollection) {

          GeometryCollection geomSet = (GeometryCollection) geometry;
          final int size = geomSet.getNumGeometries();
          for (int j = 0; j < size; j++) {
            geometries.add(geomSet.getGeometryN(j));
          }
          finalSize += size;

        } else {
          geometries.add(geometry);
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

      return GeometryUtil.getNullGeometryCollection();
    }

    final GeometryFactory geomFactory = simpleGeometries.get(0).getFactory();
    GeometryCollection geomResult = null;
    if (MultiPolygon.class.equals(expectedClass)) {
      geomResult = geomFactory.createMultiPolygon(simpleGeometries.toArray(new Polygon[simpleGeometries.size()]));
    } else if (MultiLineString.class.equals(expectedClass)) {
      geomResult = geomFactory.createMultiLineString(simpleGeometries.toArray(new LineString[simpleGeometries
            .size()]));
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

         */
        Coordinate geometryCentroid(Geometry g) {
            // TODO: should the collection case return the centroid of the
            // multi point?
            if (g instanceof GeometryCollection) {
                GeometryCollection gc = (GeometryCollection) g;

                // check for case of single geometry
                if (gc.getNumGeometries() == 1) {
                    g = gc.getGeometryN(0);
                } else {
                    double maxAreaSoFar = gc.getGeometryN(0).getArea();
                    Coordinate centroidToReturn = gc.getGeometryN(0).getCentroid().getCoordinate();

                    for (int t = 0; t < gc.getNumGeometries(); t++) {
                        double area = gc.getGeometryN(t).getArea();
                        if (area > maxAreaSoFar) {
                            maxAreaSoFar = area;
                            centroidToReturn = gc.getGeometryN(t).getCentroid().getCoordinate();
                        }
                    }

                    return centroidToReturn;
                }
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

         * @param styles
         */
        protected void encodeGeometry(Geometry geometry, List<Symbolizer> symbolizers) {
            if (geometry instanceof GeometryCollection) {
                // unwrap the collection
                GeometryCollection collection = (GeometryCollection) geometry;

                for (int i = 0; i < collection.getNumGeometries(); i++) {
                    encodeGeometry(collection.getGeometryN(i), symbolizers);
                }
            } else if(geometry instanceof Point) {
                Coordinate centroid = ((Point) geometry).getCoordinate();
                start("Point");
               
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

  }

  public final void decimateTransformGeneralize(Geometry geometry,
      MathTransform transform) throws TransformException {
    if (geometry instanceof GeometryCollection) {
      GeometryCollection collection = (GeometryCollection) geometry;
      final int length = collection.getNumGeometries();
      for (int i = 0; i < length; i++) {
        decimateTransformGeneralize(collection.getGeometryN(i),
            transform);
      }
    } else if (geometry instanceof Point) {
      LiteCoordinateSequence seq = (LiteCoordinateSequence) ((Point) geometry)
          .getCoordinateSequence();
View Full Code Here

Examples of com.vividsolutions.jts.geom.GeometryCollection

    if (geom instanceof GeometryCollection) {
      // TODO check geometry and if its bbox is too small turn it into a
      // 1-2 point geom
      // takes a bit of work because the geometry will need to be
      // recreated.
      GeometryCollection collection = (GeometryCollection) geom;
      Geometry[] result=new Geometry[collection.getDimension()];
      final int numGeometries = collection.getNumGeometries();
      for (int i = 0; i < numGeometries; i++) {
        result[i]=decimate(collection.getGeometryN(i));
      }
      return gFac.createGeometryCollection(result);
     
    } else if (geom instanceof LineString) {
      LineString line = (LineString) geom;
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.