Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.PrecisionModel


            Coordinate firstArray[] = new Coordinate[5];
            for (int j = 0; j < 4; j++) {
                firstArray[j] = new Coordinate(j + numFeatures, j + numFeatures);
            }
            firstArray[4] = new Coordinate(0 + numFeatures, 0 + numFeatures);
            LinearRing shell = new LinearRing(firstArray, new PrecisionModel(), 0);
            b.add(gf.createPolygon(shell, null));
            b.add(0);
            firstArrayGeometry[numFeatures] = gf.createPolygon(shell, null);
            features.add(b.buildFeature(numFeatures + ""));

        }
        for (int numFeatures = 0; numFeatures < 5; numFeatures++) {
            Coordinate array[] = new Coordinate[5];
            for (int j = 0; j < 4; j++) {
                array[j] = new Coordinate(j + numFeatures + 50, j + numFeatures + 50);
            }
            array[4] = new Coordinate(0 + numFeatures + 50, 0 + numFeatures + 50);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            b.add(gf.createPolygon(shell, null));
            b.add(0);
            secondArrayGeometry[numFeatures] = gf.createPolygon(shell, null);
            secondFeatures.add(b.buildFeature(numFeatures + ""));
View Full Code Here


            for (int i = 0 + numFeatures; i < 3 + numFeatures; i++) {
                array[j] = new Coordinate(i, i);
                j++;
            }
            array[3] = new Coordinate(numFeatures, numFeatures);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            b.add(gf.createPolygon(shell, null));
            b.add(0);
            features.add(b.buildFeature(numFeatures + ""));
        }
        Double distance = new Double(500);
        BufferFeatureCollection process = new BufferFeatureCollection();
        SimpleFeatureCollection output = process.execute(features, distance, null);
        assertEquals(5, output.size());
        SimpleFeatureIterator iterator = output.features();
        for (int numFeatures = 0; numFeatures < 5; numFeatures++) {
            Coordinate[] array = new Coordinate[4];
            int j = 0;
            for (int i = 0 + numFeatures; i < 3 + numFeatures; i++) {
                array[j] = new Coordinate(i, i);
                j++;
            }
            array[3] = new Coordinate(numFeatures, numFeatures);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            Geometry expected = gf.createPolygon(shell, null).buffer(distance);

            SimpleFeature sf = iterator.next();
            assertTrue(expected.equals((Geometry) sf.getDefaultGeometry()));
        }
View Full Code Here

            for (int i = 0 + numFeatures; i < 3 + numFeatures; i++) {
                array[j] = new Coordinate(i, i);
                j++;
            }
            array[3] = new Coordinate(numFeatures, numFeatures);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            b.add(gf.createPolygon(shell, null));
            b.add(0);
            b.add(numFeatures + 1);
            features.add(b.buildFeature(numFeatures + ""));
        }

        BufferFeatureCollection process = new BufferFeatureCollection();
        SimpleFeatureCollection output = process.execute(features, null, "buffer");
        assertEquals(5, output.size());
        SimpleFeatureIterator iterator = output.features();
        ReferencedEnvelope expectedBounds = new ReferencedEnvelope(output.getSchema().getCoordinateReferenceSystem());
        for (int numFeatures = 0; numFeatures < 5; numFeatures++) {
            Coordinate[] array = new Coordinate[4];
            int j = 0;
            for (int i = 0 + numFeatures; i < 3 + numFeatures; i++) {
                array[j] = new Coordinate(i, i);
                j++;
            }
            array[3] = new Coordinate(numFeatures, numFeatures);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            Geometry expected = gf.createPolygon(shell, null).buffer(numFeatures + 1);
            expectedBounds.expandToInclude(expected.getEnvelopeInternal());

            SimpleFeature sf = iterator.next();
            assertTrue(expected.equals((Geometry) sf.getDefaultGeometry()));
View Full Code Here

            array[0] = new Coordinate(0, 0);
            array[1] = new Coordinate(1, 0);
            array[2] = new Coordinate(1, 1);
            array[3] = new Coordinate(0, 1);
            array[4] = new Coordinate(0, 0);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            b.add(gf.createPolygon(shell, null));
            b.add(0);
            firstArrayGeometry[0] = gf.createPolygon(shell, null);
            features.add(b.buildFeature(numFeatures + ""));
        }
        for (int numFeatures = 0; numFeatures < 1; numFeatures++) {
            Coordinate array[] = new Coordinate[5];
            Coordinate centre = ((Polygon) features.features().next().getDefaultGeometry())
                    .getCentroid().getCoordinate();
            array[0] = new Coordinate(centre.x, centre.y);
            array[1] = new Coordinate(centre.x + 1, centre.y);
            array[2] = new Coordinate(centre.x + 1, centre.y + 1);
            array[3] = new Coordinate(centre.x, centre.y + 1);
            array[4] = new Coordinate(centre.x, centre.y);
            LinearRing shell = new LinearRing(array, new PrecisionModel(), 0);
            b.add(gf.createPolygon(shell, null));
            b.add(0);
            secondArrayGeometry[0] = gf.createPolygon(shell, null);
            secondFeatures.add(b.buildFeature(numFeatures + ""));
        }
View Full Code Here

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

        // Test Equals
        PropertyName att = fac.property("testGeometry");
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
        Literal geom = fac.literal(gf.createLineString(coords));
       
        Equals filter = fac.equal(att, geom);
        assertAttributeName(filter, "testGeometry");
View Full Code Here

        coords2[1] = new Coordinate(15, 10);
        coords2[2] = new Coordinate(15, 15);
        coords2[3] = new Coordinate(10, 15);
        coords2[4] = new Coordinate(10, 10);

        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
        Literal right = fac.literal(gf.createPolygon(
                    gf.createLinearRing(coords2), null));
        DWithin filter = fac.dwithin(fac.property("testGeometry"), right, 10, "m");

        assertAttributeName(filter, "testGeometry");
View Full Code Here

   
    public void testValidConstruction() throws Exception {
        Literal a = new LiteralExpressionImpl(new Double(10));
        Literal b = new LiteralExpressionImpl("Label");
        Literal c = new LiteralExpressionImpl(new Integer(10));
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
        Literal d = new LiteralExpressionImpl(gf.createGeometryCollection(null));
    }
View Full Code Here

        // create a feature collection ----------------------------------------
        final MemoryFeatureCollection fc = new MemoryFeatureCollection(schema);

        // populate the collection --------------------------------------------
        final PrecisionModel pm = new PrecisionModel(PrecisionModel.FLOATING);
        final GeometryFactory jtsFactory = new GeometryFactory(pm, SRID);

        // create 1st point
        final Point g1 = jtsFactory.createPoint(new Coordinate(X_1, Y_1));
        fc.add(SimpleFeatureBuilder.build(schema, new Object[] { new Integer(1), g1, LABEL_1 }, ID_1));
View Full Code Here

    }
   
    @Test
    public void testGeometries_Any() {
        Filter filter;
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
      
        Coordinate[] coords1 = {
                new Coordinate(0, 0),
                new Coordinate(6, 0),
                new Coordinate(6, 7),
View Full Code Here

    }
   
    @Test
    public void testGeometries_One() {
        Filter filter;
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
      
        Coordinate[] coords1 = {
                new Coordinate(0, 0),
                new Coordinate(6, 0),
                new Coordinate(6, 7),
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.geom.PrecisionModel

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.