Package com.vividsolutions.jts.geom

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


                Coordinate B = getCoordinate(e.B.index);
                Coordinate C = interpolate(A, B, e.A.z, e.B.z, z0);
                Coordinate C1 = new Coordinate(C.x + (B.y - A.y) * 0.1, C.y + (B.x - A.x) * 0.1);
                Coordinate C2 = new Coordinate(C.x - (B.y - A.y) * 0.1, C.y - (B.x - A.x) * 0.1);
                debugGeom
                        .add(geomFactory.createLineString(new Coordinate[] { A, C, C1, C2, C, B }));
            }
        }

        List<Geometry> retval = new ArrayList<Geometry>();
        List<LinearRing> rings = new ArrayList<LinearRing>();
View Full Code Here


            Geometry midLineGeom = context.transform.transform(edgeGeom);
            OffsetCurveBuilder offsetBuilder = new OffsetCurveBuilder(new PrecisionModel(),
                    bufParams);
            Coordinate[] coords = offsetBuilder.getOffsetCurve(midLineGeom.getCoordinates(),
                    lineWidth * 0.4);
            LineString offsetLine = geomFactory.createLineString(coords);
            Shape midLineShape = shapeWriter.toShape(midLineGeom);
            Shape offsetShape = shapeWriter.toShape(offsetLine);

            context.graphics.setStroke(hasGeom ? halfStroke : halfDashedStroke);
            context.graphics.setColor(evAttrs.color);
View Full Code Here

    public void testIntersectionVertex() {

        GeometryFactory gf = new GeometryFactory();

        LineString geometry = gf.createLineString(new Coordinate[] {
                new Coordinate(-0.10, 0),
                new Coordinate(0, 0)
                });

        IntersectionVertex v1 = new IntersectionVertex(null, "v1", -0.10, 0);
View Full Code Here

        IntersectionVertex v1 = new IntersectionVertex(null, "v1", -0.10, 0);
        IntersectionVertex v2 = new IntersectionVertex(null, "v2", 0, 0);
       
        StreetEdge leftEdge = new StreetEdge(v1, v2, geometry, "morx", 10.0, StreetTraversalPermission.ALL, true);

        LineString geometry2 = gf.createLineString(new Coordinate[] {
                new Coordinate(0, 0),
                new Coordinate(-0.10, 0)
                });

        StreetEdge rightEdge = new StreetEdge(v1, v2, geometry2, "fleem", 10.0, StreetTraversalPermission.ALL, false);
View Full Code Here

        double y0 = 0.123456789;
        double x1 = 2.0;
        double y1 = 0.0;
        c.add(new Coordinate(x0, y0));
        c.add(new Coordinate(x1, y1));
        LineString ls = gf.createLineString(c.toArray(new Coordinate[0]));
        int[] coords = CompactLineString.compactLineString(x0, y0, x1, y1, ls, false);
        assertTrue(coords == CompactLineString.STRAIGHT_LINE); // ==, not equals
        LineString ls2 = CompactLineString.uncompactLineString(x0, y0, x1, y1, coords, false);
        assertTrue(ls.equalsExact(ls2, 0.00000015));
        byte[] packedCoords = CompactLineString.compackLineString(x0, y0, x1, y1, ls, false);
View Full Code Here

        c.clear();
        c.add(new Coordinate(x0, y0));
        c.add(new Coordinate(-179.99, 1.12345));
        c.add(new Coordinate(179.99, 1.12345));
        c.add(new Coordinate(x1, y1));
        ls = gf.createLineString(c.toArray(new Coordinate[0]));
        coords = CompactLineString.compactLineString(x0, y0, x1, y1, ls, false);
        assertTrue(coords != CompactLineString.STRAIGHT_LINE);
        ls2 = CompactLineString.uncompactLineString(x0, y0, x1, y1, coords, false);
        assertTrue(ls.equalsExact(ls2, 0.00000015));
        packedCoords = CompactLineString.compackLineString(x0, y0, x1, y1, ls, false);
View Full Code Here

        StreetVertex v1 = new IntersectionVertex(null, "v1", c1.x, c1.y, null);
        StreetVertex v2 = new IntersectionVertex(null, "v2", c2.x, c2.y, null);

        GeometryFactory factory = new GeometryFactory();
        LineString geometry = factory.createLineString(new Coordinate[] { c1, c2 });

        double length = 650.0;

        StreetWithElevationEdge testStreet = new StreetWithElevationEdge(v1, v2, geometry, "Test Lane", length,
                StreetTraversalPermission.ALL, false);
View Full Code Here

    public LineString createGeometry(Vertex a, Vertex b) {
        GeometryFactory factory = new GeometryFactory();
        Coordinate[] cs = new Coordinate[2];
        cs[0] = a.getCoordinate();
        cs[1] = b.getCoordinate();
        return factory.createLineString(cs);
    }

    public void setUp() {
        graph = new Graph();
        // a 0.1 degree x 0.1 degree square
View Full Code Here

    public LineString createGeometry(Vertex a, Vertex b) {
        GeometryFactory factory = new GeometryFactory();
        Coordinate[] cs = new Coordinate[2];
        cs[0] = a.getCoordinate();
        cs[1] = b.getCoordinate();
        return factory.createLineString(cs);
    }

    @Before
    public void before() {
        graph = new Graph();
View Full Code Here

        }

        @SuppressWarnings("unchecked")
        HashSet<IntersectionVertex> verticesCopy = (HashSet<IntersectionVertex>) vertices.clone();
        VERTEX: for (IntersectionVertex v : verticesCopy) {
            LineString newGeometry = geometryFactory.createLineString(new Coordinate[] {
                    newVertex.getCoordinate(), v.getCoordinate() });

            // ensure that new edge does not leave the bounds of the original area, or
            // fall into any holes
            if (!originalEdges.union(originalEdges.getBoundary()).contains(newGeometry)) {
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.