forked from streetcomplete/StreetComplete
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ask about detailing surface=paved/unpaved
fixes streetcomplete#279
- Loading branch information
1 parent
22599d3
commit 7f8f07e
Showing
9 changed files
with
256 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...c/main/java/de/westnordost/streetcomplete/quests/road_surface/DetailPavedRoadSurface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package de.westnordost.streetcomplete.quests.road_surface; | ||
|
||
import android.os.Bundle; | ||
import android.text.TextUtils; | ||
|
||
import javax.inject.Inject; | ||
|
||
import de.westnordost.streetcomplete.data.QuestImportance; | ||
import de.westnordost.streetcomplete.data.osm.SimpleOverpassQuestType; | ||
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder; | ||
import de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao; | ||
import de.westnordost.streetcomplete.quests.AbstractQuestAnswerFragment; | ||
|
||
public class DetailPavedRoadSurface extends SimpleOverpassQuestType { | ||
@Inject | ||
public DetailPavedRoadSurface(OverpassMapDataDao overpassServer) { | ||
super(overpassServer); | ||
} | ||
|
||
@Override | ||
protected String getTagFilters() { | ||
return " ways with ( highway ~ " + TextUtils.join("|", RoadSurfaceConfig.ROADS_WITH_SURFACES) + " and" + | ||
" surface=paved)"; | ||
} | ||
|
||
@Override | ||
public int importance() { | ||
return QuestImportance.MINOR; | ||
} | ||
|
||
public AbstractQuestAnswerFragment createForm() { | ||
return new DetailPavedRoadSurfaceForm(); | ||
} | ||
|
||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) { | ||
changes.modify("surface", answer.getString(DetailPavedRoadSurfaceForm.SURFACE)); | ||
} | ||
|
||
@Override | ||
public String getCommitMessage() { | ||
return "Detail road surfaces"; | ||
} | ||
|
||
@Override | ||
public String getIconName() { | ||
return "street_surface"; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...in/java/de/westnordost/streetcomplete/quests/road_surface/DetailPavedRoadSurfaceForm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.westnordost.streetcomplete.quests.road_surface; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
|
||
public class DetailPavedRoadSurfaceForm extends RoadSurfaceForm { | ||
RoadSurfaceForm.Surface[] GetSurfaceMenuStructure() { | ||
return new RoadSurfaceForm.Surface[]{ | ||
new RoadSurfaceForm.Surface("asphalt", R.drawable.surface_asphalt, R.string.quest_surface_value_asphalt), | ||
new RoadSurfaceForm.Surface("concrete", R.drawable.surface_concrete, R.string.quest_surface_value_concrete), | ||
new RoadSurfaceForm.Surface("sett", R.drawable.surface_sett, R.string.quest_surface_value_sett), | ||
new RoadSurfaceForm.Surface("paving_stones", R.drawable.surface_paving_stones, R.string.quest_surface_value_paving_stones), | ||
new RoadSurfaceForm.Surface("cobblestone", R.drawable.surface_cobblestone, R.string.quest_surface_value_cobblestone), | ||
new RoadSurfaceForm.Surface("wood", R.drawable.surface_wood, R.string.quest_surface_value_wood), | ||
}; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...main/java/de/westnordost/streetcomplete/quests/road_surface/DetailUnpavedRoadSurface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package de.westnordost.streetcomplete.quests.road_surface; | ||
|
||
import android.os.Bundle; | ||
import android.text.TextUtils; | ||
|
||
import javax.inject.Inject; | ||
|
||
import de.westnordost.streetcomplete.data.QuestImportance; | ||
import de.westnordost.streetcomplete.data.osm.SimpleOverpassQuestType; | ||
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder; | ||
import de.westnordost.streetcomplete.data.osm.download.OverpassMapDataDao; | ||
import de.westnordost.streetcomplete.quests.AbstractQuestAnswerFragment; | ||
|
||
public class DetailUnpavedRoadSurface extends SimpleOverpassQuestType { | ||
@Inject | ||
public DetailUnpavedRoadSurface(OverpassMapDataDao overpassServer) { | ||
super(overpassServer); | ||
} | ||
|
||
@Override | ||
protected String getTagFilters() { | ||
return " ways with ( highway ~ " + TextUtils.join("|", RoadSurfaceConfig.ROADS_WITH_SURFACES) + " and" + | ||
" surface=unpaved)"; | ||
} | ||
|
||
@Override | ||
public int importance() { | ||
return QuestImportance.MINOR; | ||
} | ||
|
||
public AbstractQuestAnswerFragment createForm() { | ||
return new DetailUnpavedRoadSurfaceForm(); | ||
} | ||
|
||
public void applyAnswerTo(Bundle answer, StringMapChangesBuilder changes) { | ||
changes.modify("surface", answer.getString(DetailUnpavedRoadSurfaceForm.SURFACE)); | ||
} | ||
|
||
@Override | ||
public String getCommitMessage() { | ||
return "Detail road surfaces"; | ||
} | ||
|
||
@Override | ||
public String getIconName() { | ||
return "street_surface"; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../java/de/westnordost/streetcomplete/quests/road_surface/DetailUnpavedRoadSurfaceForm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package de.westnordost.streetcomplete.quests.road_surface; | ||
|
||
import de.westnordost.streetcomplete.R; | ||
|
||
public class DetailUnpavedRoadSurfaceForm extends RoadSurfaceForm { | ||
Surface[] GetSurfaceMenuStructure() { | ||
return new Surface[]{ | ||
new RoadSurfaceForm.Surface("compacted", R.drawable.surface_compacted, R.string.quest_surface_value_compacted), | ||
new RoadSurfaceForm.Surface("gravel", R.drawable.surface_gravel, R.string.quest_surface_value_gravel), | ||
new RoadSurfaceForm.Surface("fine_gravel", R.drawable.surface_fine_gravel, R.string.quest_surface_value_fine_gravel), | ||
new RoadSurfaceForm.Surface("pebblestone", R.drawable.surface_pebblestone, R.string.quest_surface_value_pebblestone), | ||
new RoadSurfaceForm.Surface("grass_paver", R.drawable.surface_grass_paver, R.string.quest_surface_value_grass_paver), | ||
new RoadSurfaceForm.Surface("dirt", R.drawable.surface_dirt, R.string.quest_surface_value_dirt), | ||
new RoadSurfaceForm.Surface("grass", R.drawable.surface_grass, R.string.quest_surface_value_grass), | ||
new RoadSurfaceForm.Surface("sand", R.drawable.surface_sand, R.string.quest_surface_value_sand), | ||
}; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/src/main/java/de/westnordost/streetcomplete/quests/road_surface/RoadSurfaceConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package de.westnordost.streetcomplete.quests.road_surface; | ||
|
||
public class RoadSurfaceConfig { | ||
// well, all roads have surfaces, what I mean is that not all ways with highway key are | ||
// "something with a surface" | ||
static final String[] ROADS_WITH_SURFACES = { | ||
// "trunk","trunk_link","motorway","motorway_link", // too much, motorways are almost by definition asphalt (or concrete) | ||
"primary", "primary_link", "secondary", "secondary_link", "tertiary", "tertiary_link", | ||
"unclassified", "residential", "bicycle_road", "living_street", "pedestrian", | ||
"track", "road", | ||
/*"service", */ // this is too much, and the information value is very low | ||
}; | ||
} |
Oops, something went wrong.