Package org.geotools.geometry.jts

Examples of org.geotools.geometry.jts.CurvedGeometryFactory


     * @param cs
     * @return
     */
    public static CurvedGeometryFactory getCurvedGeometryFactory(ArcParameters arcParameters,
            GeometryFactory gFactory, CoordinateSequence cs) {
        CurvedGeometryFactory factory;
        if (arcParameters != null && arcParameters.getLinearizationTolerance() != null) {
            double tolerance = Double.MAX_VALUE;
            if (cs != null) {
                CircularArc arc = CurvedGeometries.getArc(cs, 0);
                Circle c = new Circle(arc.getCenter(), arc.getRadius());
                tolerance = arcParameters.getLinearizationTolerance().getTolerance(c);
            }
            factory = new CurvedGeometryFactory(gFactory, tolerance);
        } else if (gFactory instanceof CurvedGeometryFactory) {
            factory = (CurvedGeometryFactory) gFactory;
        } else {
            factory = new CurvedGeometryFactory(gFactory, Double.MAX_VALUE);
        }
        return factory;
    }
View Full Code Here


    public static MultiLineString multiLineString() {
        return gf.createMultiLineString(new LineString[] { lineString(), lineString() });
    }

    public static LineString compoundCurve() {
        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);
        return compound;
    }
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

            throw new RuntimeException(
                    "Number of coordinates in an arc string must be at least 3, " + cs.size()
                            + " were specified: " + arcLineString);
        }

        CurvedGeometryFactory factory = GML3ParsingUtils.getCurvedGeometryFactory(arcParameters,
                gFactory, cs);

        return factory.createCurvedGeometry(cs);
    }
View Full Code Here

            // maybe log this instead and return null
            throw new RuntimeException("Number of coordinates in an arc string must be at least 3, "
                    + cs.size()+ " were specified: " + arcLineString);
        }

        CurvedGeometryFactory factory = GML3ParsingUtils.getCurvedGeometryFactory(arcParameters, gFactory, cs);
       
        return factory.createCurvedGeometry(cs);
    }
View Full Code Here

        Document dom = encode(GML3MockData.point(), GML.geometryMember);
        assertEquals(1, dom.getElementsByTagNameNS(GML.NAMESPACE, "Point").getLength());
    }

    public void testEncodeCurve() 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.geometryMember);
        print(dom);
View Full Code Here

                if (ls instanceof CurvedGeometry<?>) {
                    curved = ls;
                }
                components.add(ls);
            }
            CurvedGeometryFactory factory = GML3ParsingUtils.getCurvedGeometryFactory(
                    arcParameters, gf, curved != null ? curved.getCoordinateSequence() : null);
            return factory.createCurvedGeometry(components);
        }
    }
View Full Code Here

        if (components.isEmpty()) {
            return gFactory.createLineString(new Coordinate[0]);
        } else {
            CoordinateSequence cs = components.get(0).getCoordinateSequence();
            CurvedGeometryFactory factory = GML3ParsingUtils.getCurvedGeometryFactory(
                    arcParameters, gFactory, cs);
            return factory.createCurvedGeometry(components);
        }
    }
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.