Package com.vividsolutions.jts.geom

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


   
    public void testRenderEmptyLine() throws SchemaException, IllegalAttributeException {
        GeometryFactory gf = new GeometryFactory();
        StyleBuilder sb = new StyleBuilder();
        SimpleFeatureType pointType = DataUtilities.createType("emptyLines", "geom:LineString,name:String");
        SimpleFeature f = SimpleFeatureBuilder.build(pointType, new Object[] {gf.createLineString((Coordinate[]) null), "name" }, null);
        Style style = sb.createStyle(sb.createLineSymbolizer());
       
        renderEmptyGeometry(f, style);
    }
   
View Full Code Here


   
    public void testMixedEmptyMultiLine() throws SchemaException, IllegalAttributeException {
        GeometryFactory gf = new GeometryFactory();
        StyleBuilder sb = new StyleBuilder();
        SimpleFeatureType pointType = DataUtilities.createType("emptyRings", "geom:MultiLineString,name:String");
        LineString emptyLine = gf.createLineString((Coordinate[]) null);
        LineString realLine = gf.createLineString(new Coordinate[] {new Coordinate(0,0),
                        new Coordinate(1, 1)});
        MultiLineString mls = gf.createMultiLineString(new LineString[] {emptyLine, realLine});
        SimpleFeature f = SimpleFeatureBuilder.build(pointType, new Object[] {mls, "name" }, null);
        Style style = sb.createStyle(sb.createPolygonSymbolizer());
View Full Code Here

    public void testMixedEmptyMultiLine() throws SchemaException, IllegalAttributeException {
        GeometryFactory gf = new GeometryFactory();
        StyleBuilder sb = new StyleBuilder();
        SimpleFeatureType pointType = DataUtilities.createType("emptyRings", "geom:MultiLineString,name:String");
        LineString emptyLine = gf.createLineString((Coordinate[]) null);
        LineString realLine = gf.createLineString(new Coordinate[] {new Coordinate(0,0),
                        new Coordinate(1, 1)});
        MultiLineString mls = gf.createMultiLineString(new LineString[] {emptyLine, realLine});
        SimpleFeature f = SimpleFeatureBuilder.build(pointType, new Object[] {mls, "name" }, null);
        Style style = sb.createStyle(sb.createPolygonSymbolizer());
       
View Full Code Here

    }

    public void testWriteLine() throws Exception {
        // build a 3d line
        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] { new Coordinate(0, 0, 0),
                new Coordinate(1, 1, 1) });

        // build a feature around it
        SimpleFeature newFeature = SimpleFeatureBuilder.build(line3DType, new Object[] { 2, ls,
                "l3" }, null);
View Full Code Here

            // we have to build a set of lines connecting the two points that are smaller to
            // get a value that makes any sense rendering wise by crossing the original line with
            // a set of quadrants that are 180x180
            double distance = 0;
            GeometryFactory gf = new GeometryFactory();
            LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(env.getMinX(), env.getMinY()),
                    new Coordinate(env.getMaxX(), env.getMaxY())});
            int qMinX = (int) (Math.signum(env.getMinX()) * Math.ceil(Math.abs(env.getMinX() / 180.0)));
            int qMaxX = (int) (Math.signum(env.getMaxX()) * Math.ceil(Math.abs(env.getMaxX() / 180.0)));
            int qMinY = (int) (Math.signum(env.getMinY()) * Math.ceil(Math.abs((env.getMinY() + 90) / 180.0)));
            int qMaxY = (int) (Math.signum(env.getMaxY()) * Math.ceil(Math.abs((env.getMaxY() + 90) / 180.0)));
View Full Code Here

                            CoordinateSequence cs = csf.create(2, 2);
                            cs.setOrdinate(0, 0, clippedSegment[0]);
                            cs.setOrdinate(0, 1, clippedSegment[1]);
                            cs.setOrdinate(1, 0, clippedSegment[2]);
                            cs.setOrdinate(1, 1, clippedSegment[3]);
                            clipped.add(gf.createLineString(cs));
                        }
                    }
                }
            } else {
                // one inside, the other outside, a clip must occurr
View Full Code Here

                    if (prevInside) {
                        // if(closed) {
                        // addClosingPoints(ordinates, shell);
                        // clipped.add(gf.createLinearRing(ordinates.toCoordinateSequence(csf)));
                        // } else {
                        clipped.add(gf.createLineString(ordinates.toCoordinateSequence(csf)));
                        // }
                        ordinates.clear();
                    }
                } else {
                    prevInside = false;
View Full Code Here

            x0 = x1;
            y0 = y1;
        }
        // don't forget the last linestring
        if (ordinates.size() > 1) {
            clipped.add(gf.createLineString(ordinates.toCoordinateSequence(csf)));
        }

        if (line.isClosed() && clipped.size() > 1) {
            // the first and last strings might be adjacent, in that case fuse them
            CoordinateSequence cs0 = clipped.get(0).getCoordinateSequence();
View Full Code Here

                    cs.setOrdinate(i + cs1.size() - 1, 0, cs0.getOrdinate(i, 0));
                    cs.setOrdinate(i + cs1.size() - 1, 1, cs0.getOrdinate(i, 1));
                }
                clipped.remove(0);
                clipped.remove(clipped.size() - 1);
                clipped.add(gf.createLineString(cs));
            }
        }

        // return the results
        if (clipped.size() > 1) {
View Full Code Here

            int j = 0;
            for (int i = 0 + numFeatures; i < 4 + numFeatures; i++) {
                array[j] = new Coordinate(i, i);
                j++;
            }
            b.add(gf.createLineString(array));
            b.add(0);
            features.add(b.buildFeature(numFeatures + ""));
        }
        Double distance = new Double(500);
        BufferFeatureCollection process = new BufferFeatureCollection();
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.