Search in sources :

Example 1 with ElementGeometry

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);
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) ArrayList(java.util.ArrayList) ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry)

Example 2 with ElementGeometry

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());
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry)

Example 3 with ElementGeometry

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);
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry)

Example 4 with ElementGeometry

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));
    }
}
Also used : LatLon(de.westnordost.osmapi.map.data.LatLon) OsmLatLon(de.westnordost.osmapi.map.data.OsmLatLon) ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry)

Example 5 with ElementGeometry

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);
}
Also used : ElementGeometry(de.westnordost.streetcomplete.data.osm.ElementGeometry)

Aggregations

ElementGeometry (de.westnordost.streetcomplete.data.osm.ElementGeometry)28 OsmLatLon (de.westnordost.osmapi.map.data.OsmLatLon)11 OsmQuest (de.westnordost.streetcomplete.data.osm.OsmQuest)9 ArrayList (java.util.ArrayList)9 LatLon (de.westnordost.osmapi.map.data.LatLon)7 List (java.util.List)6 TestQuestType (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType)5 TestQuestType2 (de.westnordost.streetcomplete.data.osm.persist.test.TestQuestType2)4 BoundingBox (de.westnordost.osmapi.map.data.BoundingBox)3 Element (de.westnordost.osmapi.map.data.Element)3 OsmElementQuestType (de.westnordost.streetcomplete.data.osm.OsmElementQuestType)3 OsmNode (de.westnordost.osmapi.map.data.OsmNode)2 QuestGroup (de.westnordost.streetcomplete.data.QuestGroup)2 QuestStatus (de.westnordost.streetcomplete.data.QuestStatus)2 VisibleQuestListener (de.westnordost.streetcomplete.data.VisibleQuestListener)2 Collection (java.util.Collection)2 Date (java.util.Date)2 Node (de.westnordost.osmapi.map.data.Node)1 Relation (de.westnordost.osmapi.map.data.Relation)1 Way (de.westnordost.osmapi.map.data.Way)1