use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class AddRoadNameForm method getRoadnameSuggestions.
private List<Map<String, String>> getRoadnameSuggestions() {
ElementGeometry geometry = getElementGeometry();
if (geometry == null || geometry.polylines == null || geometry.polylines.isEmpty()) {
return new ArrayList<>();
}
List<LatLon> points = geometry.polylines.get(0);
List<LatLon> onlyFirstAndLast = Arrays.asList(points.get(0), points.get(points.size() - 1));
return roadNameSuggestionsDao.getNames(onlyFirstAndLast, AddRoadName.MAX_DIST_FOR_ROAD_NAME_SUGGESTION);
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class ElementCreatorTestGeometry method testCreateForMultipolygonRelation.
public void testCreateForMultipolygonRelation() {
ElementGeometry geom = createCreator().create(R0);
assertNotNull(geom.polygons);
assertEquals(1, geom.polygons.size());
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class ElementCreatorTestGeometry method testCreateForNode.
public void testCreateForNode() {
ElementGeometry geom = createCreator().create(N0);
assertEquals(P0, geom.center);
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class ElementCreatorTestGeometry method testCreateForSimpleNonAreaWay.
public void testCreateForSimpleNonAreaWay() {
ElementGeometry geom = createCreator().create(W0);
assertNotNull(geom.polylines);
assertEquals(1, geom.polylines.size());
assertEquals(W0.getNodeIds().size(), geom.polylines.get(0).size());
List<LatLon> polyline = geom.polylines.get(0);
for (int i = 0; i < W0.getNodeIds().size(); ++i) {
LatLon shouldBe = nodes.get(W0.getNodeIds().get(i).intValue()).getPosition();
assertEquals(shouldBe, polyline.get(i));
}
}
use of de.westnordost.streetcomplete.data.osm.ElementGeometry in project StreetComplete by westnordost.
the class ElementCreatorTestGeometry method testCreateForEmptyWay.
public void testCreateForEmptyWay() {
ElementGeometry geom = createCreator().create(W5);
assertNull(geom);
}
Aggregations