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;
}
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;
}
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;
}
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);
}
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;
}
Aggregations