Skip to content

Commit

Permalink
do not immediately show address street quest after housenumber quest (f…
Browse files Browse the repository at this point in the history
…ixes #1856)
  • Loading branch information
westnordost committed Jun 1, 2020
1 parent 385b8d4 commit 6d76fbc
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ class AddAddressStreet(

override fun createForm() = AddAddressStreetForm()

override fun isApplicableTo(element: Element): Boolean? =
ADDRESSES_WITHOUT_STREETS_TFE.matches(element)
/* cannot be determined offline because the quest kinda needs the street name suggestions
to work conveniently (see #1856) */
override fun isApplicableTo(element: Element): Boolean? = null

override fun download(bbox: BoundingBox, handler: (element: Element, geometry: ElementGeometry?) -> Unit): Boolean {
if (!overpassApi.query(getOverpassQuery(bbox), handler)) return false
if (!overpassApi.query(getStreetNameSuggestionsOverpassQuery(bbox), roadNameSuggestionsDao::putRoadNameSuggestion)) return false
if (!overpassApi.query(getOverpassQuery(bbox), handler)) return false
return true
}

Expand Down Expand Up @@ -76,13 +77,6 @@ class AddAddressStreet(
nwr["addr:housenumber"][!"addr:street"][!"addr:place"][!"addr:block_number"];
nwr["addr:streetnumber"][!"addr:street"];
)""".trimIndent()
// this must be the same as above but in tag filter expression syntax
private val ADDRESSES_WITHOUT_STREETS_TFE by lazy { FiltersParser().parse("""
nodes, ways, relations with
addr:housenumber and !addr:street and !addr:place and !addr:block_number
or addr:streetnumber and !addr:street
""")}

private val ROADS_WITH_NAMES =
"way[highway ~ \"^(${ALL_ROADS.joinToString("|")})$\"][name]"
}
Expand Down

0 comments on commit 6d76fbc

Please sign in to comment.