Package org.geotools.geometry.jts

Examples of org.geotools.geometry.jts.CurvedGeometryFactory


                lines.add((com.vividsolutions.jts.geom.LineString) geomObj.unwrap());
            } else if (obj instanceof LineString) {
                lines.add((com.vividsolutions.jts.geom.LineString) ((Geometry)obj).unwrap());
            }
        }
        CurvedGeometryFactory factory = new CurvedGeometryFactory(tolerance);
        return new org.geotools.geometry.jts.CompoundCurve(lines, factory, tolerance);
    }
View Full Code Here


     * @param coords The Array of Coordinates
     * @param tolerance The tolerance used to linearize the curve
     * @return A CircularString
     */
    private com.vividsolutions.jts.geom.Geometry createCircularString(Coordinate[] coords, double tolerance) {
        CurvedGeometryFactory factory = new CurvedGeometryFactory(tolerance);
        double[] values = new double[coords.length * 2];
        for(int i = 0; i < coords.length; i++) {
            int c = i * 2;
            values[c] = coords[i].x;
            values[c + 1] = coords[i].y;
View Full Code Here

     * @return Geometry as encoded, or null w/ log if it cannot be represented via JTS
     */
    public static Geometry create(GeometryFactory gf, final int GTYPE,
        final int SRID, final int[] elemInfo, final int triplet,
        CoordinateSequence coords, final int N) {
        CurvedGeometryFactory curvedFactory = getCurvedGeometryFactory(gf);

        switch (SDO.TT(GTYPE)) {
        case TT.POINT:
            return createPoint(curvedFactory, GTYPE, SRID, elemInfo, triplet, coords);

View Full Code Here

     *
     * @param gf
     * @return
     */
    private static CurvedGeometryFactory getCurvedGeometryFactory(GeometryFactory gf) {
        CurvedGeometryFactory curvedFactory;
        if (gf instanceof CurvedGeometryFactory) {
            curvedFactory = (CurvedGeometryFactory) gf;
        } else {
            curvedFactory = new CurvedGeometryFactory(gf, Double.MAX_VALUE);
        }
        return curvedFactory;
    }
View Full Code Here

        assertEquals(7, controlPoints[8], 0d);
        assertEquals(3, controlPoints[9], 0d);
    }

    public void testEncodeSimple() throws Exception {
        LineString curve = new CurvedGeometryFactory(0.1)
                .createCurvedGeometry(new LiteCoordinateSequence(new double[] { 1, 1, 2, 2, 3, 1,
                        5, 5, 7, 3 }));
        Document dom = encode(curve, GML.curveProperty);
        // print(dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
View Full Code Here

                xpath.evaluate(basePath + "/gml:posList", dom));
    }

    public void testEncodeCompound() throws Exception {
        // create a compound curve
        CurvedGeometryFactory factory = new CurvedGeometryFactory(0.1);
        LineString curve = factory.createCurvedGeometry(new LiteCoordinateSequence(1, 1, 2, 2, 3,
                1, 5, 5, 7, 3));
        LineString straight = factory.createLineString(new LiteCoordinateSequence(7, 3, 10, 15));
        LineString compound = factory.createCurvedGeometry(curve, straight);

        // encode
        Document dom = encode(compound, GML.curveProperty);
        // print(dom);
        XpathEngine xpath = XMLUnit.newXpathEngine();
View Full Code Here

public class GeometryExamples {

public void createCurve(){
    // createCurve start
    GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    CurvedGeometryFactory curvedFactory = new CurvedGeometryFactory(geometryFactory,Double.MAX_VALUE);
   
    PackedCoordinateSequence coords = new PackedCoordinateSequence.Double(
       new double[]{10,14,6,10,14,10}, 2 );
   
    CircularString arc = (CircularString) curvedFactory.createCurvedGeometry(coords);
    // createCurve end   
}
View Full Code Here

}

public void wktCurve() throws Exception{
    // wktCurve start
    GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory();
    CurvedGeometryFactory curvedfactory = new CurvedGeometryFactory(Double.MAX_VALUE);
   
    WKTReader2 reader = new WKTReader2(curvedfactory);
    CircularString arc = (CircularString) reader.read("CIRCULARSTRING(10 14,6 10,14 10)");
    // wktCurve end   
}
View Full Code Here

            geometryFactory = dataStore.getGeometryFactory();
        }
       
        Double linearizationTolerance = (Double) hints.get(Hints.LINEARIZATION_TOLERANCE);
        if (linearizationTolerance != null) {
            geometryFactory = new CurvedGeometryFactory(geometryFactory, linearizationTolerance);
        }

        // create a feature builder using the factory hinted or the one coming
        // from the datastore
        FeatureFactory ff = (FeatureFactory) hints.get(Hints.FEATURE_FACTORY);
View Full Code Here

            for (LineString ls : segments) {
                if (ls instanceof CurvedGeometry<?>) {
                    curved = ls;
                }
            }
            CurvedGeometryFactory factory = GML3ParsingUtils.getCurvedGeometryFactory(
                    arcParameters, gf, curved != null ? curved.getCoordinateSequence() : null);
            return factory.createCurvedGeometry(Arrays.asList(segments));

        }
    }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.jts.CurvedGeometryFactory

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.