use of org.rutebanken.netex.model.SimplePoint_VersionStructure in project OpenTripPlanner by opentripplanner.
the class WgsCoordinateMapperTest method handleCoordinatesWithMissingLocation.
@Test
public void handleCoordinatesWithMissingLocation() {
SimplePoint_VersionStructure p = new SimplePoint_VersionStructure();
assertNull(WgsCoordinateMapper.mapToDomain(p));
}
use of org.rutebanken.netex.model.SimplePoint_VersionStructure in project OpenTripPlanner by opentripplanner.
the class WgsCoordinateMapperTest method handleCoordinatesWithMissingLatitude.
@Test(expected = IllegalArgumentException.class)
public void handleCoordinatesWithMissingLatitude() {
SimplePoint_VersionStructure p;
p = new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLongitude(LONGITUDE));
WgsCoordinateMapper.mapToDomain(p);
}
use of org.rutebanken.netex.model.SimplePoint_VersionStructure in project tiamat by entur.
the class SimplePointVersionStructureConverter method convertTo.
@Override
public SimplePoint_VersionStructure convertTo(Point point, Type<SimplePoint_VersionStructure> type, MappingContext mappingContext) {
if (point == null) {
return null;
}
BigDecimal longitude = round(BigDecimal.valueOf(point.getX()));
BigDecimal latitude = round(BigDecimal.valueOf(point.getY()));
return new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLongitude(longitude).withLatitude(latitude));
}
use of org.rutebanken.netex.model.SimplePoint_VersionStructure in project tiamat by entur.
the class ExportResourceTest method exportStopPlacesWithEffectiveChangedInPeriod.
@Test
public void exportStopPlacesWithEffectiveChangedInPeriod() throws Exception {
LocalDateTime validFrom = LocalDateTime.now().minusDays(3);
StopPlace stopPlace1 = new StopPlace().withId("XYZ:Stopplace:1").withVersion("1").withName(new MultilingualString().withValue("Changed stop1")).withValidBetween(new ValidBetween().withFromDate(validFrom)).withCentroid(new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLatitude(new BigDecimal("59.914353")).withLongitude(new BigDecimal("10.806387"))));
StopPlace stopPlace2 = new StopPlace().withId("XYZ:Stopplace:2").withVersion("1").withName(new MultilingualString().withValue("Changed stop2")).withValidBetween(new ValidBetween().withFromDate(validFrom.plusDays(1))).withCentroid(new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLatitude(new BigDecimal("22.914353")).withLongitude(new BigDecimal("11.806387"))));
PublicationDeliveryStructure publicationDelivery = publicationDeliveryTestHelper.createPublicationDeliveryWithStopPlace(stopPlace1, stopPlace2);
publicationDeliveryTestHelper.postAndReturnPublicationDelivery(publicationDelivery);
UriInfo uriInfoMock = Mockito.mock(UriInfo.class);
Mockito.when(uriInfoMock.getAbsolutePathBuilder()).thenReturn(JerseyUriBuilder.fromPath("http://test"));
ChangedStopPlaceSearchDto search = new ChangedStopPlaceSearchDto(null, null, 0, 1);
Response response = exportResource.exportStopPlacesWithEffectiveChangedInPeriod(search, newExportParamsBuilder().build(), uriInfoMock);
List<StopPlace> changedStopPlaces = publicationDeliveryTestHelper.extractStopPlaces(response);
Assert.assertEquals(1, changedStopPlaces.size());
Assert.assertEquals(stopPlace1.getName().getValue(), changedStopPlaces.get(0).getName().getValue());
Link link = response.getLink("next");
Assert.assertNotNull(link);
}
use of org.rutebanken.netex.model.SimplePoint_VersionStructure in project tiamat by entur.
the class ExportResourceTest method insertTestStopsWithTopographicPlace.
private void insertTestStopsWithTopographicPlace() throws JAXBException, IOException, SAXException {
if (testStopInserted) {
return;
}
testStopInserted = true;
StopPlace stopPlace = new StopPlace().withId("XYZ:Stopplace:1").withVersion("1").withName(new MultilingualString().withValue("Ă˜stre gravlund")).withCentroid(new SimplePoint_VersionStructure().withLocation(new LocationStructure().withLatitude(new BigDecimal("59.914353")).withLongitude(new BigDecimal("10.806387"))));
PublicationDeliveryStructure publicationDelivery = publicationDeliveryTestHelper.createPublicationDeliveryWithStopPlace(stopPlace);
publicationDeliveryTestHelper.postAndReturnPublicationDelivery(publicationDelivery);
}
Aggregations