Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryCollection


        Point gg[] = new Point[1];
        gg[0] = (Point)g;
        g = g.getFactory().createMultiPoint( (Point[]) gg );
      }
    }
    GeometryCollection gc = (GeometryCollection) g;
    ArrayList subs = new ArrayList();
    for (int t=0;t<gc.getNumGeometries();t++)
    {
      //replace each sub component with a simpler version or null
      Geometry gsub = gc.getGeometryN(t);
      if (gsub instanceof Point)
      {
        subs.add( gsub ); //always keep
      }
      else if (gsub instanceof LineString)
View Full Code Here


        return _this.equalsExact(arg1);
    }

    static public int numGeometries(Geometry arg0) {
        GeometryCollection _this = (GeometryCollection) arg0;

        return _this.getNumGeometries();
    }
View Full Code Here

        return _this.getNumGeometries();
    }

    static public Geometry getGeometryN(Geometry arg0, int arg1) {
        GeometryCollection _this = (GeometryCollection) arg0;

        return _this.getGeometryN(arg1);
    }
View Full Code Here

       
        List<Geometry> geometryList = popGeometryLiteral(jjtgeometryliteral);

        Geometry[] geometries = geometryList.toArray(new Geometry[geometryList.size()]) ;
       
        GeometryCollection geometryCollection= getGeometryFactory().createGeometryCollection(geometries);
       
        return geometryCollection;

    }
View Full Code Here

                return (LineString) lines.getGeometryN(0);
            }
            throw new ClassCastException("MultiLineString does not contain a single LineString");
        }
        else if( geom instanceof GeometryCollection ){
            GeometryCollection geoms = (GeometryCollection) geom;
            if( geoms.getNumGeometries() == 1 &&
                geoms.getGeometryN( 0 ) instanceof LineString ){
                return (LineString) geoms.getGeometryN(0);
            }
            throw new ClassCastException("GeometryCollection does not contain a single LineString");           
        }
        else {
            throw new ClassCastException("Cannot convert to LineString");
View Full Code Here

            final int jjtgeometryliteral) throws CQLException {

        GeometryCollectionBuilder builder = new GeometryCollectionBuilder(
                getStatement(), getResultStack());

        GeometryCollection gc = (GeometryCollection) builder
                .build(jjtgeometryliteral);

        return gc;

    }
View Full Code Here

                Polygon offseted = (Polygon) geom.clone();
                offseted.apply(new OffsetOrdinateFilter(0, extrusion));
                faces.add(0, (Polygon) geom);
                faces.add(offseted);
            } else if(geom instanceof GeometryCollection){
                GeometryCollection gc = (GeometryCollection) geom;
                for (int i = 0; i < gc.getNumGeometries(); i++) {
                    Geometry g = gc.getGeometryN(i);
                    if(g instanceof Polygon) {
                        Polygon offseted = (Polygon) g.clone();
                        offseted.apply(new OffsetOrdinateFilter(0, extrusion));
                        faces.add(0, (Polygon) g);
                        faces.add(offseted);
View Full Code Here

      LineString[] geometries = new LineString[2];
      geometries [0] = gf.createLineString(points);
      Coordinate[] points2 = { new Coordinate(40, 30), new Coordinate(70, 40) };
      geometries[1] = gf.createLineString(points2);
      GeometryFactory factory = new GeometryFactory();
      GeometryCollection geometry = new GeometryCollection(geometries, factory );
     
      FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
     
      PropertyName p = ff.property(aname("geom"));       
      Literal collect = ff.literal(geometry);
View Full Code Here

   

    public void testParse() throws Exception {
        GML3MockData.multiGeometry(document, document);
   
        GeometryCollection multiGeom = (GeometryCollection) parse();
        assertNotNull(multiGeom);
   
        assertEquals(3, multiGeom.getNumGeometries());
    }
View Full Code Here

        parser = new Parser(configuration, getClass().getResourceAsStream("geometry.xml"));
    }

    public void test() throws Exception {
        GeometryCollection gc = (GeometryCollection) parser.parse();

        assertEquals(gc.getNumGeometries(), 3);

        Object o = gc.getGeometryN(0);
        assertNotNull(o);
        assertTrue(o instanceof Point);

        o = gc.getGeometryN(1);
        assertNotNull(o);
        assertTrue(o instanceof LineString);

        o = gc.getGeometryN(2);
        assertNotNull(o);
        assertTrue(o instanceof Polygon);
    }
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.