Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.GeometryFactory.createLineString()


                Coordinate[] c = new Coordinate[value.length];

                for (int i = 0; i < c.length; i++)
                    c[i] = (Coordinate) value[i].getValue();

                p = gf.createLineString(c);
            } else {
                if (value.length > 1) {
                    throw new SAXException(
                        "Cannot have more than one coordinate sequence per "
                        + getName());
View Full Code Here


                CoordinateSequence c = (CoordinateSequence) t;
                // TODO -- be forgiving
                if(c.size() == 1){
                    c = DefaultCoordinateSequenceFactory.instance().create(new Coordinate[]{c.getCoordinate(0),c.getCoordinate(0)});
                }
                p = gf.createLineString(c);
            }

            ElementValue[] ev = new ElementValue[1];
            ev[0] = new DefaultElementValue(element, p);
View Full Code Here

        coords[1] = new Coordinate(3, 4);
        coords[2] = new Coordinate(5, 6);

        // Builds the test feature
        Object[] attributes = new Object[10];
        attributes[0] = geomFac.createLineString(coords);
        attributes[1] = new Boolean(true);
        attributes[2] = new Character('t');
        attributes[3] = new Byte("10");
        attributes[4] = new Short("101");
        attributes[5] = new Integer(1002);
View Full Code Here

            GeometryFactory geomFactory = new GeometryFactory();
            Coordinate[] points = new Coordinate[2];
            points[0] = new Coordinate(dblOne, Coordinate.NULL_ORDINATE, Coordinate.NULL_ORDINATE);
            points[1] = new Coordinate(dblTwo, Coordinate.NULL_ORDINATE, Coordinate.NULL_ORDINATE);

            linestring = geomFactory.createLineString(points);
            linestring.setUserData(crs);
        } catch (NumberFormatException e) {
            throw new IllegalArgumentException(
                    "Error converting the parameters for toLineString function: "
                            + parameters.toString() + ". " + USAGE, e);
View Full Code Here

                 
          int SRID = 4326;
          GeometryFactory gf = new GeometryFactory(precisionModel, SRID);
          Coordinate[] points = { new Coordinate(30, 40), new Coordinate(50, 60) };
          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);
         
          // TODO, DB2 does not support instantiating a geometry collection from wkb,
          // wkb type 7, replace GeometryCollection with MultiLineString         
View Full Code Here

          GeometryFactory gf = new GeometryFactory(precisionModel, SRID);
          Coordinate[] points = { new Coordinate(30, 40), new Coordinate(50, 60) };
          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);
         
          // TODO, DB2 does not support instantiating a geometry collection from wkb,
          // wkb type 7, replace GeometryCollection with MultiLineString         
          // code in superclass: GeometryCollection geometry = new GeometryCollection(geometries, factory );
          // For DB2, we must use the following line of code
View Full Code Here

   
    public void testEncodeMultiLineString() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        MultiLineString ml = gf.createMultiLineString(
            new LineString[]{
                gf.createLineString( new Coordinate[] { new Coordinate( 0, 0), new Coordinate( 1, 1) } ),
                gf.createLineString( new Coordinate[] { new Coordinate( 2, 2), new Coordinate( 3, 3) } )
            }
        );
        Document dom = encode( ml, KML.MultiGeometry );
        assertEquals( 2, getElementsByQName(dom, KML.LineString ).getLength() );
View Full Code Here

    public void testEncodeMultiLineString() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        MultiLineString ml = gf.createMultiLineString(
            new LineString[]{
                gf.createLineString( new Coordinate[] { new Coordinate( 0, 0), new Coordinate( 1, 1) } ),
                gf.createLineString( new Coordinate[] { new Coordinate( 2, 2), new Coordinate( 3, 3) } )
            }
        );
        Document dom = encode( ml, KML.MultiGeometry );
        assertEquals( 2, getElementsByQName(dom, KML.LineString ).getLength() );
    }
View Full Code Here

    public void testEncodeMultiGeometry() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        GeometryCollection gc = gf.createGeometryCollection(
            new Geometry[]{
                gf.createPoint( new Coordinate(0,0)),
                gf.createLineString( new Coordinate[]{new Coordinate(0,0), new Coordinate(1,1)}),
                gf.createPolygon(
                    gf.createLinearRing( new Coordinate[] {
                        new Coordinate(0,0), new Coordinate(1,1), new Coordinate(2,2),
                        new Coordinate(0,0)
                    }), null
View Full Code Here

  LineString[] lines() {
    GeometryFactory gf = new GeometryFactory();
    LineString[] lines = new LineString[5];
   
    for ( int i = 0; i < lines.length; i++ ) {
      lines[i] = gf.createLineString(
        new Coordinate[]{
          new Coordinate( i, i+1), new Coordinate( i+2, i+3 )
        }
      );
    }
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.