Package com.vividsolutions.jts.geom

Examples of com.vividsolutions.jts.geom.CoordinateSequenceFactory


    throws OperationNotFoundException {

    assert geomCrs != null;
    assert reprojectCrs != null;

    CoordinateSequenceFactory csFactory;
    CoordinateSequenceTransformer csTransformer;
    GeometryCoordinateSequenceTransformer transformer;

    csFactory = gFactory.getCoordinateSequenceFactory();
    csTransformer = new CoordSeqFactoryPreservingCoordinateSequenceTransformer(csFactory);
View Full Code Here


        @SuppressWarnings({ "rawtypes", "unchecked" })
        @Override
        public Integer call() throws Exception {

            final Query query = new Query();
            CoordinateSequenceFactory coordSeq = new PackedCoordinateSequenceFactory();
            query.getHints().add(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, coordSeq));
            query.setStartIndex(offset);
            if (limit != null && limit.intValue() > 0) {
                query.setMaxFeatures(limit);
            }
View Full Code Here

    private void insert(final WorkingTree workTree, final String path,
            @SuppressWarnings("rawtypes") final FeatureSource featureSource,
            final ProgressListener taskProgress) {

        final Query query = new Query();
        CoordinateSequenceFactory coordSeq = new PackedCoordinateSequenceFactory();
        query.getHints().add(new Hints(Hints.JTS_COORDINATE_SEQUENCE_FACTORY, coordSeq));
        workTree.insert(path, featureSource, query, taskProgress);

    }
View Full Code Here

        referenceCoordinates[7][1][1] = coordinates[3];

        referenceCoordinates[8][0] = coordinates;

        GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory();
        CoordinateSequenceFactory coordinateSequenceFactory =
                geometryFactory.getCoordinateSequenceFactory();
        CoordinateSequence sequence = coordinateSequenceFactory.create(coordinates);
        LineString geometry = new LineString(sequence, geometryFactory);

        P2<LineString> result;
        LineString[][] results = new LineString[9][2];

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0);
        results[0][0] = result.first;
        results[0][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.125);
        results[1][0] = result.first;
        results[1][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.25);
        results[2][0] = result.first;
        results[2][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.375);
        results[3][0] = result.first;
        results[3][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.5);
        results[4][0] = result.first;
        results[4][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.625);
        results[5][0] = result.first;
        results[5][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.75);
        results[6][0] = result.first;
        results[6][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 0.875);
        results[7][0] = result.first;
        results[7][1] = result.second;

        result = GeometryUtils.splitGeometryAtFraction(geometry, 1);
        results[8][0] = result.first;
        results[8][1] = result.second;

        sequence = coordinateSequenceFactory.create(referenceCoordinates[0][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[0][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[0][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[0][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[1][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[1][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[1][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[1][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[2][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[2][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[2][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[2][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[3][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[3][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[3][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[3][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[4][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[4][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[4][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[4][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[5][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[5][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[5][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[5][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[6][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[6][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[6][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[6][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[7][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[7][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[7][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[7][1]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[8][0]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[8][0]);

        sequence = coordinateSequenceFactory.create(referenceCoordinates[8][1]);
        geometry = new LineString(sequence, geometryFactory);
        assertEquals(geometry, results[8][1]);
    }
View Full Code Here

        ServiceDay serviceDay = mock(ServiceDay.class);

        when(graph.getTimeZone()).thenReturn(TimeZone.getTimeZone("GMT"));

        GeometryFactory geometryFactory = GeometryUtils.getGeometryFactory();
        CoordinateSequenceFactory coordinateSequenceFactory =
                geometryFactory.getCoordinateSequenceFactory();
        CoordinateSequence coordinateSequence = coordinateSequenceFactory.create(coordinates);
        LineString geometry = new LineString(coordinateSequence, geometryFactory);
        ArrayList<Edge> hops = new ArrayList<Edge>(2);
        RoutingContext routingContext = new RoutingContext(routingRequest, graph, null, arrive);
        AgencyAndId agencyAndId = new AgencyAndId("Agency", "ID");
        Route route = new Route();
        ArrayList<StopTime> stopTimes = new ArrayList<StopTime>(3);
        StopTime stopDepartTime = new StopTime();
        StopTime stopDwellTime = new StopTime();
        StopTime stopArriveTime = new StopTime();
        Stop stopDepart = new Stop();
        Stop stopDwell = new Stop();
        Stop stopArrive = new Stop();
        Trip trip = new Trip();

        routingContext.serviceDays =
                new ArrayList<ServiceDay>(Collections.singletonList(serviceDay));
        route.setId(agencyAndId);
        stopDepart.setId(agencyAndId);
        stopDwell.setId(agencyAndId);
        stopArrive.setId(agencyAndId);
        stopDepartTime.setStop(stopDepart);
        stopDepartTime.setDepartureTime(0);
        stopDwellTime.setArrivalTime(20);
        stopDwellTime.setStop(stopDwell);
        stopDwellTime.setDepartureTime(40);
        stopArriveTime.setArrivalTime(60);
        stopArriveTime.setStop(stopArrive);
        stopTimes.add(stopDepartTime);
        stopTimes.add(stopDwellTime);
        stopTimes.add(stopArriveTime);
        trip.setId(agencyAndId);
        trip.setTripHeadsign("The right");

        TripTimes tripTimes = new TripTimes(trip, stopTimes, new Deduplicator());
        StopPattern stopPattern = new StopPattern(stopTimes);
        TripPattern tripPattern = new TripPattern(route, stopPattern);

        when(depart.getTripPattern()).thenReturn(tripPattern);
        when(dwell.getTripPattern()).thenReturn(tripPattern);

        PatternHop patternHop0 = new PatternHop(depart, dwell, stopDepart, stopDwell, 0);
        PatternHop patternHop1 = new PatternHop(dwell, arrive, stopDwell, stopArrive, 1);

        hops.add(patternHop0);
        hops.add(patternHop1);

        when(graph.getEdges()).thenReturn(hops);
        when(depart.getCoordinate()).thenReturn(new Coordinate(0, 0));
        when(dwell.getCoordinate()).thenReturn(new Coordinate(0, 0));
        when(arrive.getCoordinate()).thenReturn(new Coordinate(0, 0));
        routingRequest.from = new GenericLocation();
        routingRequest.startingTransitTripId = agencyAndId;
        when(serviceDay.secondsSinceMidnight(anyInt())).thenReturn(9);

        patternHop0.setGeometry(geometry);
        tripPattern.add(tripTimes);
        graph.index = new GraphIndex(graph);

        coordinates = new Coordinate[3];
        coordinates[0] = new Coordinate(3.5, 1.0);
        coordinates[1] = new Coordinate(5.0, 1.0);
        coordinates[2] = new Coordinate(5.0, 5.0);

        coordinateSequence = coordinateSequenceFactory.create(coordinates);
        geometry = new LineString(coordinateSequence, geometryFactory);

        Vertex vertex = onBoardDepartServiceImpl.setupDepartOnBoard(routingContext);
        Edge edge = vertex.getOutgoing().toArray(new Edge[1])[0];
View Full Code Here

      // don't reinit if gf is the same (the usual case)
      if (currGeometryFactory == gf)
        return;
     
      currGeometryFactory = gf;
      CoordinateSequenceFactory csf = gf.getCoordinateSequenceFactory();
      csTransformer = new DefaultCoordinateSequenceTransformer(csf);
    }
View Full Code Here

                pm = new PrecisionModel();
            }
            Integer SRID = (Integer) hints.get(Hints.JTS_SRID);
            int srid = SRID == null ? 0 : SRID.intValue();
            Integer dimension = (Integer) hints.get(Hints.COORDINATE_DIMENSION);
            CoordinateSequenceFactory csFactory = (CoordinateSequenceFactory) hints
                    .get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY);
            if (csFactory == null) {
                if (dimension == null || dimension <= 3) {
                    csFactory = CoordinateArraySequenceFactory.instance();
                } else {
View Full Code Here

        protected final Polygon buildPolygon(final double[] shellCoords, final double[][] holes,
                final GeometryFactory geometryFactory) {
            Polygon p = null;

            final CoordinateSequenceFactory sequenceFactory = geometryFactory
                    .getCoordinateSequenceFactory();
            final CoordinateSequence coords = toCoords(shellCoords, sequenceFactory);
            final LinearRing shell = geometryFactory.createLinearRing(coords);
            final int nHoles = holes.length;
View Full Code Here

            double[] linearCoordArray = parts[0];

            int nHoles = parts.length - 1;

            final CoordinateSequenceFactory coordinateSequenceFactory = geometryFactory
                    .getCoordinateSequenceFactory();
            LinearRing shell = geometryFactory.createLinearRing(toCoords(linearCoordArray,
                    coordinateSequenceFactory));

            LinearRing[] holes = new LinearRing[nHoles];
View Full Code Here

        GeometryFactory gf = null;
        if (hints != null) {
            gf = (GeometryFactory) hints.get(Hints.JTS_GEOMETRY_FACTORY);
            if (gf == null) {
                // look for a coordinate sequence factory
                CoordinateSequenceFactory csFactory = (CoordinateSequenceFactory) hints
                        .get(Hints.JTS_COORDINATE_SEQUENCE_FACTORY);

                if (csFactory != null) {
                    gf = new GeometryFactory(csFactory);
                }
View Full Code Here

TOP

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

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.