Search in sources :

Example 1 with WgsCoordinate

use of org.opentripplanner.model.WgsCoordinate in project OpenTripPlanner by opentripplanner.

the class StopMapper method mapQuayToStop.

/**
 * Map Netex Quay to OTP Stop
 */
Stop mapQuayToStop(Quay quay, Station parentStation, List<FareZone> fareZones) {
    WgsCoordinate coordinate = WgsCoordinateMapper.mapToDomain(quay.getCentroid());
    if (coordinate == null) {
        issueStore.add(new QuayWithoutCoordinates(quay.getId()));
        return null;
    }
    Stop stop = new Stop(idFactory.createId(quay.getId()), parentStation.getName(), quay.getPublicCode(), null, WgsCoordinateMapper.mapToDomain(quay.getCentroid()), null, null, null, fareZones, null, null, null);
    stop.setParentStation(parentStation);
    return stop;
}
Also used : WgsCoordinate(org.opentripplanner.model.WgsCoordinate) Stop(org.opentripplanner.model.Stop) QuayWithoutCoordinates(org.opentripplanner.graph_builder.issues.QuayWithoutCoordinates)

Example 2 with WgsCoordinate

use of org.opentripplanner.model.WgsCoordinate in project OpenTripPlanner by opentripplanner.

the class GraphPathToItineraryMapper method createWalkStep.

private static WalkStep createWalkStep(Graph graph, State s, Locale wantedLocale) {
    Edge en = s.getBackEdge();
    WalkStep step;
    step = new WalkStep();
    step.streetName = en.getName(wantedLocale);
    step.startLocation = new WgsCoordinate(en.getFromVertex().getLat(), en.getFromVertex().getLon());
    step.elevation = encodeElevationProfile(s.getBackEdge(), 0, s.getOptions().geoidElevation ? -graph.ellipsoidToGeoidDifference : 0);
    step.bogusName = en.hasBogusName();
    step.addStreetNotes(graph.streetNotesService.getNotes(s));
    step.angle = DirectionUtils.getFirstAngle(s.getBackEdge().getGeometry());
    if (s.getBackEdge() instanceof AreaEdge) {
        step.area = true;
    }
    return step;
}
Also used : WgsCoordinate(org.opentripplanner.model.WgsCoordinate) WalkStep(org.opentripplanner.model.plan.WalkStep) PathwayEdge(org.opentripplanner.routing.edgetype.PathwayEdge) ElevatorAlightEdge(org.opentripplanner.routing.edgetype.ElevatorAlightEdge) FreeEdge(org.opentripplanner.routing.edgetype.FreeEdge) RentABikeOnEdge(org.opentripplanner.routing.edgetype.RentABikeOnEdge) AreaEdge(org.opentripplanner.routing.edgetype.AreaEdge) RentABikeOffEdge(org.opentripplanner.routing.edgetype.RentABikeOffEdge) StreetEdge(org.opentripplanner.routing.edgetype.StreetEdge) Edge(org.opentripplanner.routing.graph.Edge) AreaEdge(org.opentripplanner.routing.edgetype.AreaEdge)

Example 3 with WgsCoordinate

use of org.opentripplanner.model.WgsCoordinate in project OpenTripPlanner by opentripplanner.

the class MultiModalStationMapper method map.

MultiModalStation map(StopPlace stopPlace, Collection<Station> childStations) {
    MultiModalStation multiModalStation = new MultiModalStation(idFactory.createId(stopPlace.getId()), childStations);
    if (stopPlace.getName() != null) {
        multiModalStation.setName(stopPlace.getName().getValue());
    } else {
        multiModalStation.setName("N/A");
    }
    WgsCoordinate coordinate = WgsCoordinateMapper.mapToDomain(stopPlace.getCentroid());
    if (coordinate == null) {
        LOG.warn("MultiModal station {} does not contain any coordinates.", multiModalStation.getId());
    } else {
        multiModalStation.setCoordinate(coordinate);
    }
    return multiModalStation;
}
Also used : WgsCoordinate(org.opentripplanner.model.WgsCoordinate) MultiModalStation(org.opentripplanner.model.MultiModalStation)

Example 4 with WgsCoordinate

use of org.opentripplanner.model.WgsCoordinate in project OpenTripPlanner by opentripplanner.

the class WgsCoordinateMapperTest method handleCoordinatesWithValuesSet.

@Test
public void handleCoordinatesWithValuesSet() {
    // Given a valid point
    final SimplePoint_VersionStructure point = new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLongitude(LONGITUDE).withLatitude(LATITUDE));
    // When map coordinates
    WgsCoordinate c = WgsCoordinateMapper.mapToDomain(point);
    // Then verify coordinate
    assertEquals(LONGITUDE_VALUE, c.longitude(), DELTA);
    assertEquals(LATITUDE_VALUE, c.latitude(), DELTA);
}
Also used : WgsCoordinate(org.opentripplanner.model.WgsCoordinate) SimplePoint_VersionStructure(org.rutebanken.netex.model.SimplePoint_VersionStructure) LocationStructure(org.rutebanken.netex.model.LocationStructure) Test(org.junit.Test)

Example 5 with WgsCoordinate

use of org.opentripplanner.model.WgsCoordinate in project OpenTripPlanner by opentripplanner.

the class GroupOfStationsMapper method map.

GroupOfStations map(GroupOfStopPlaces groupOfStopPlaces) {
    GroupOfStations groupOfStations = new GroupOfStations();
    groupOfStations.setId(idFactory.createId(groupOfStopPlaces.getId()));
    groupOfStations.setName(groupOfStopPlaces.getName().getValue());
    WgsCoordinate coordinate = WgsCoordinateMapper.mapToDomain(groupOfStopPlaces.getCentroid());
    if (coordinate == null) {
        // TODO OTP2 - This should be an data import issue
        LOG.warn("MultiModal station {} does not contain any coordinates.", groupOfStations.getId());
    } else {
        groupOfStations.setCoordinate(coordinate);
    }
    connectChildStation(groupOfStopPlaces, groupOfStations);
    return groupOfStations;
}
Also used : WgsCoordinate(org.opentripplanner.model.WgsCoordinate) GroupOfStations(org.opentripplanner.model.GroupOfStations)

Aggregations

WgsCoordinate (org.opentripplanner.model.WgsCoordinate)5 Test (org.junit.Test)1 QuayWithoutCoordinates (org.opentripplanner.graph_builder.issues.QuayWithoutCoordinates)1 GroupOfStations (org.opentripplanner.model.GroupOfStations)1 MultiModalStation (org.opentripplanner.model.MultiModalStation)1 Stop (org.opentripplanner.model.Stop)1 WalkStep (org.opentripplanner.model.plan.WalkStep)1 AreaEdge (org.opentripplanner.routing.edgetype.AreaEdge)1 ElevatorAlightEdge (org.opentripplanner.routing.edgetype.ElevatorAlightEdge)1 FreeEdge (org.opentripplanner.routing.edgetype.FreeEdge)1 PathwayEdge (org.opentripplanner.routing.edgetype.PathwayEdge)1 RentABikeOffEdge (org.opentripplanner.routing.edgetype.RentABikeOffEdge)1 RentABikeOnEdge (org.opentripplanner.routing.edgetype.RentABikeOnEdge)1 StreetEdge (org.opentripplanner.routing.edgetype.StreetEdge)1 Edge (org.opentripplanner.routing.graph.Edge)1 LocationStructure (org.rutebanken.netex.model.LocationStructure)1 SimplePoint_VersionStructure (org.rutebanken.netex.model.SimplePoint_VersionStructure)1