Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryCollection


   * Writes a <code>GeometryCollection</code> object.
   *
   * @param o The <code>LineString</code> to be encoded.
   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    GeometryCollection coll = (GeometryCollection) o;
    document.writeElement("vml:shape", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("path");
    for (int i = 0; i < coll.getNumGeometries(); i++) {
    }
    document.writeAttributeEnd();
  }
View Full Code Here


   * Writes a <code>GeometryCollection</code> object.
   *
   * @param o The <code>LineString</code> to be encoded.
   */
  public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException {
    GeometryCollection coll = (GeometryCollection) o;
    document.writeElement("path", asChild);
    document.writeAttribute("fill-rule", "evenodd");
    document.writeAttributeStart("d");
    for (int i = 0; i < coll.getNumGeometries(); i++) {
      document.writeObject(coll.getGeometryN(i), true); // TODO delegate to appropriate writers, is this correct?
    }
    document.writeAttributeEnd();
  }
View Full Code Here

    String key4 = "key4";
    PipelineContext pipelineContext = new PipelineContextImpl();
    pipelineContext.put(key1, key1);
    pipelineContext.put(key3, key3);
    GeometryFactory geometryFactory = new GeometryFactory();
    pipelineContext.put(key4, new GeometryCollection(new Geometry[] {}, geometryFactory));

    // a context
    CacheContext cacheContext1 = cacheKeyService.getCacheContext(pipelineContext, new String[] {key1, key2, key4});
    Assert.assertEquals(key1, cacheContext1.get(key1));
    Assert.assertNull(cacheContext1.get(key2));
View Full Code Here

    CacheContext context = new MyCacheContext();
    String cacheKey1 = cacheKeyService.getCacheKey(context);
    context.put("bla", "bla");
    String cacheKey2 = cacheKeyService.getCacheKey(context);
    GeometryFactory geometryFactory = new GeometryFactory();
    context.put("geom", new GeometryCollection(new Geometry[] {}, geometryFactory));
    String cacheKey3 = cacheKeyService.getCacheKey(context);
    System.out.println("keys " + cacheKey1 + " " + cacheKey2 + " " + cacheKey3);
    Assert.assertFalse(cacheKey1.equals(cacheKey2));
    Assert.assertFalse(cacheKey2.equals(cacheKey3));
    Assert.assertFalse(cacheKey3.equals(cacheKey1));
View Full Code Here

            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

          //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

     *
     * @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

    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

        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

      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

TOP

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

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.