Skip to content

Commit 3717423

Browse files
committed
Added quest PoliceType
Added files for the quest PoliceType, useful for adding amenity:police operators in Italy
1 parent 391e201 commit 3717423

26 files changed

+1398
-2
lines changed

app/src/main/java/de/westnordost/streetcomplete/data/user/achievements/AchievementsModule.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ object AchievementsModule {
412412
"AddFerryAccessMotorVehicle", // 103
413413
"AddInformationToTourism", // 137
414414
"AddBoardType", // 188
415-
"AddPostBoxRoyalCypher"
415+
"AddPostBoxRoyalCypher",
416+
"AddPoliceType"
416417
)),
417418
// levels: 3, 9, 18, 30, 45, 63, ...
418419
{ lvl -> (lvl + 1)*3 },
@@ -667,6 +668,7 @@ object AchievementsModule {
667668
"AddVegetarian",
668669
"AddVegan",
669670
"AddKosher",
671+
"AddPoliceType",
670672
// tourist related
671673
"AddInformationToTourism",
672674
"AddBoardType",

app/src/main/java/de/westnordost/streetcomplete/quests/QuestModule.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ import de.westnordost.streetcomplete.quests.playground_access.AddPlaygroundAcces
7373
import de.westnordost.streetcomplete.quests.postbox_collection_times.AddPostboxCollectionTimes
7474
import de.westnordost.streetcomplete.quests.postbox_ref.AddPostboxRef
7575
import de.westnordost.streetcomplete.quests.postbox_royal_cypher.AddPostboxRoyalCypher
76+
import de.westnordost.streetcomplete.quests.police_type.AddPoliceType
7677
import de.westnordost.streetcomplete.quests.powerpoles_material.AddPowerPolesMaterial
7778
import de.westnordost.streetcomplete.quests.railway_crossing.AddRailwayCrossingBarrier
7879
import de.westnordost.streetcomplete.quests.summit_register.AddSummitRegister
@@ -236,7 +237,8 @@ import javax.inject.Singleton
236237
AddBenchStatusOnBusStop(),
237238
AddBenchBackrest(),
238239
AddTrafficSignalsButton(),
239-
AddPostboxRoyalCypher()
240+
AddPostboxRoyalCypher(),
241+
AddPoliceType()
240242
))
241243

242244
@Provides @Singleton fun osmNoteQuestType(): OsmNoteQuestType = OsmNoteQuestType()
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package de.westnordost.streetcomplete.quests.police_type
2+
3+
import de.westnordost.streetcomplete.R
4+
import de.westnordost.streetcomplete.data.osm.osmquest.OsmFilterQuestType
5+
import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder
6+
import de.westnordost.streetcomplete.data.quest.NoCountriesExcept
7+
import de.westnordost.streetcomplete.quests.police_type.AddPostboxRoyalCypherForm
8+
import de.westnordost.streetcomplete.quests.police_type.PostboxRoyalCypher
9+
10+
class AddPoliceType : OsmFilterQuestType<PostboxRoyalCypher>() {
11+
12+
override val elementFilter = """
13+
nodes, ways, relations with
14+
amenity = police
15+
and !operator
16+
"""
17+
override val commitMessage = "Add police type"
18+
override val wikiLink = "Tag:amenity=police"
19+
override val icon = R.drawable.ic_quest_crown
20+
override val enabledInCountries = NoCountriesExcept(
21+
"IT"
22+
)
23+
24+
override fun getTitle(tags: Map<String, String>) = R.string.quest_postboxRoyalCypher_title
25+
26+
override fun createForm() = AddPostboxRoyalCypherForm()
27+
28+
override fun applyAnswerTo(answer: PostboxRoyalCypher, changes: StringMapChangesBuilder) {
29+
changes.add("royal_cypher", answer.osmValue)
30+
}
31+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package de.westnordost.streetcomplete.quests.police_type
2+
3+
import android.os.Bundle
4+
import de.westnordost.streetcomplete.R
5+
import de.westnordost.streetcomplete.quests.AImageListQuestAnswerFragment
6+
import de.westnordost.streetcomplete.view.image_select.Item
7+
8+
class AddPoliceTypeForm : AImageListQuestAnswerFragment<PoliceType, PoliceType>() {
9+
10+
override val items = listOf(
11+
Item(PoliceType.CARABINIERI, R.drawable.ic_police_type_carabinieri, R.string.quest_policeType_type_carabinieri),
12+
Item(PoliceType.POLIZIA_DI_STATO, R.drawable.ic_police_type_polizia, R.string.quest_policeType_type_polizia_di_stato),
13+
Item(PoliceType.POLIZIA_MUNICIPALE, R.drawable.ic_police_type_municipale, R.string.quest_policeType_type_polizia_municipale),
14+
Item(PoliceType.POLIZIA_LOCALE, R.drawable.ic_police_type_locale, R.string.quest_policeType_type_polizia_locale),
15+
Item(PoliceType.GUARDIA_DI_FINANZA, R.drawable.ic_police_type_finanza, R.string.quest_policeType_type_guardia_di_finanza),
16+
Item(PoliceType.POLIZIA_STRADALE, R.drawable.ic_police_type_stradale, R.string.quest_policeType_type_polizia_stradale),
17+
Item(PoliceType.GUARDIA_COSTIERA, R.drawable.ic_police_type_costiera, R.string.quest_policeType_type_guardia_costiera),
18+
Item(PoliceType.POLIZIA_FERROVIARIA, R.drawable.ic_police_type_ferroviaria, R.string.quest_policeType_type_polizia_ferroviaria)
19+
)
20+
21+
override val itemsPerRow = 3
22+
23+
override fun onCreate(savedInstanceState: Bundle?) {
24+
super.onCreate(savedInstanceState)
25+
imageSelector.cellLayoutId = R.layout.cell_icon_select_with_label_below
26+
}
27+
28+
override fun onClickOk(selectedItems: List<PoliceType>) {
29+
applyAnswer(selectedItems.single())
30+
}
31+
32+
33+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package de.westnordost.streetcomplete.quests.police_type
2+
3+
enum class PoliceType(val policeName: String, val operator: PoliceOperator) {
4+
CARABINIERI("Arma dei Carabinieri",PoliceOperator.ARMA_DEI_CARABINIERI),
5+
GUARDIA_COSTIERA("Guardia Costiera",PoliceOperator.GUARDIA_COSTIERA),
6+
GUARDIA_DI_FINANZA("Guardia di Finanza",PoliceOperator.GUARDIA_DI_FINANZA),
7+
POLIZIA_DI_STATO("Polizia di Stato",PoliceOperator.POLIZIA_DI_STATO),
8+
POLIZIA_MUNICIPALE("Polizia Municipale",PoliceOperator.POLIZIA_MUNICIPALE),
9+
POLIZIA_LOCALE("Polizia Locale",PoliceOperator.POLIZIA_LOCALE),
10+
POLIZIA_STRADALE("Polizia Stradale",PoliceOperator.POLIZIA_DI_STATO),
11+
POLIZIA_FERROVIARIA("Polizia Ferroviaria",PoliceOperator.POLIZIA_DI_STATO)
12+
}
13+
14+
enum class PoliceOperator(val operatorName: String, val wikidata: String, val wikipedia: String) {
15+
ARMA_DEI_CARABINIERI("Arma dei Carabinieri", "Q54852", "en:Carabinieri"),
16+
POLIZIA_DI_STATO("Polizia di Stato", "Q897817", "it:Polizia di Stato"),
17+
GUARDIA_DI_FINANZA("Guardia di Finanza", "Q1552861", "it:Guardia di Finanza"),
18+
POLIZIA_MUNICIPALE("Polizia Municipale", "Q1431981", "it:Polizia municipale"),
19+
POLIZIA_LOCALE("Polizia Locale", "", "it:Polizia locale (Italia)"),
20+
GUARDIA_COSTIERA("Guardia Costiera","Q1552839", "it:Corpo delle capitanerie di porto - Guardia costiera")
21+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="128dp"
3+
android:height="128dp"
4+
android:viewportWidth="128"
5+
android:viewportHeight="128">
6+
<path
7+
android:pathData="M13.195,1.149L115.089,1.149A12.009,12.009 0,0 1,127.098 13.158L127.098,115.052A12.009,12.009 0,0 1,115.089 127.061L13.195,127.061A12.009,12.009 0,0 1,1.185 115.052L1.185,13.158A12.009,12.009 0,0 1,13.195 1.149z"
8+
android:strokeWidth="1.93905"
9+
android:fillColor="#ffffff"
10+
android:strokeColor="#000000"/>
11+
<path
12+
android:pathData="m59.21,107.27c-3.341,-0.962 -6.734,-2.93 -9.416,-5.462 -3.938,-3.718 -6.416,-8.684 -6.893,-13.812l-0.239,-2.573l22.591,0 22.591,0l-0.005,1.57c-0.024,6.85 -5.206,14.919 -11.779,18.339 -1.587,0.826 -3.86,1.755 -5.05,2.065 -2.929,0.763 -8.932,0.698 -11.799,-0.127zM15.797,82.169c0,-1.652 0.678,-2.143 4.862,-3.528 9.465,-3.132 16.478,-8.106 23.049,-16.347 1.475,-1.849 3.404,-3.946 4.288,-4.658 1.719,-1.386 4.779,-3.248 5.334,-3.247 0.185,0 0.818,0.921 1.406,2.046 0.637,1.22 2.088,2.989 3.594,4.383 2.467,2.284 2.509,2.353 1.808,2.987 -1.145,1.036 -1.974,3.651 -1.761,5.549 0.707,6.272 9.244,8.359 12.719,3.109 1.821,-2.752 1.545,-6.26 -0.686,-8.704l-0.721,-0.79 1.655,-1.188c1.707,-1.226 4.258,-4.368 5.111,-6.295 0.267,-0.603 0.653,-1.095 0.857,-1.093 0.702,0.007 4.068,2.132 5.802,3.664 0.954,0.843 2.802,2.898 4.106,4.567 6.016,7.698 13.436,12.93 22.729,16.026 2.169,0.722 4.151,1.482 4.405,1.688 0.254,0.206 0.462,0.936 0.462,1.622l0,1.248l-49.509,0 -49.509,0zM63.162,72.613c-1.516,-0.747 -2.29,-2.19 -2.29,-4.269 0,-2.669 1.838,-4.349 4.756,-4.349 4.606,0 5.932,6.654 1.724,8.651 -1.556,0.738 -2.644,0.73 -4.191,-0.032zM62.431,59.347C61.379,58.823 60.038,57.784 59.451,57.038 57.09,54.04 55.133,48.798 54.721,44.369l-0.236,-2.543l10.768,0 10.768,0l-0.003,1.57c-0.004,2.326 -1.331,7.443 -2.644,10.194 -1.42,2.976 -4.012,5.644 -6.079,6.258 -2.139,0.635 -2.7,0.578 -4.864,-0.501zM54.591,37.61c0,-0.693 0.235,-2.481 0.522,-3.972 1.821,-9.465 6.94,-14.985 12.266,-13.227 1.95,0.644 4.635,3.477 5.995,6.327 1.353,2.835 2.64,7.887 2.644,10.378l0.003,1.755L65.306,38.87 54.591,38.87Z"
13+
android:fillColor="#000000"/>
14+
<path
15+
android:pathData="m54.732,37.264c0.076,-1.732 0.377,-3.571 0.938,-5.728 2.048,-7.872 6.602,-12.389 11.263,-11.173 1.111,0.29 1.955,0.849 3.305,2.19 1.964,1.951 3.114,3.867 4.113,6.855 1.003,3.001 1.6,6.043 1.6,8.157l0,1.214L65.308,38.778 54.666,38.778Z"
16+
android:strokeLineJoin="miter"
17+
android:strokeWidth="0.424264"
18+
android:fillColor="#ff0000"
19+
android:strokeColor="#ffffff"
20+
android:strokeLineCap="butt"/>
21+
<path
22+
android:pathData="M63.263,59.652C60.121,58.235 58.43,56.227 56.654,51.803 55.501,48.931 54.916,46.336 54.637,42.863l-0.08,-1l10.713,0 10.713,0l-0.065,1.628c-0.075,1.88 -0.375,3.443 -1.179,6.141 -0.876,2.94 -1.577,4.495 -2.794,6.203 -0.889,1.247 -2.607,2.906 -3.56,3.437 -0.944,0.526 -2.225,0.872 -3.229,0.871 -0.699,-0 -0.942,-0.063 -1.892,-0.492z"
23+
android:strokeLineJoin="miter"
24+
android:strokeWidth="0.424264"
25+
android:fillColor="#0000ff"
26+
android:strokeColor="#ffffff"
27+
android:strokeLineCap="butt"/>
28+
</vector>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="128dp"
3+
android:height="128dp"
4+
android:viewportWidth="128"
5+
android:viewportHeight="128">
6+
<path
7+
android:pathData="M13.138,1.014L114.986,1.014A12.004,12.004 0,0 1,126.99 13.018L126.99,114.865A12.004,12.004 0,0 1,114.986 126.869L13.138,126.869A12.004,12.004 0,0 1,1.134 114.865L1.134,13.018A12.004,12.004 0,0 1,13.138 1.014z"
8+
android:strokeWidth="1.93817"
9+
android:fillColor="#ffffff"
10+
android:strokeColor="#000000"/>
11+
<path
12+
android:pathData="M13.794,102.591l-9.617,0l38.47,-76.939l9.617,0z"
13+
android:fillColor="#009246"/>
14+
<path
15+
android:pathData="M21.488,102.591l-9.617,0l38.47,-76.939l9.617,0z"
16+
android:fillColor="#ffffff"/>
17+
<path
18+
android:pathData="M84.963,102.591l-65.398,0l38.47,-76.939l65.398,0z"
19+
android:fillColor="#ce2b37"/>
20+
<path
21+
android:pathData="M71.499,64.122m-23.082,0a23.082,23.082 0,1 1,46.164 0a23.082,23.082 0,1 1,-46.164 0"
22+
android:fillColor="#ffffff"/>
23+
<path
24+
android:fillColor="#FF000000"
25+
android:pathData="m71.499,45.541c-1.577,0 -2.885,1.269 -2.885,2.847 0,1.308 0.885,2.424 2.077,2.731l0,1.962l-5.77,0c-0.308,-0.423 -0.885,-0.692 -1.5,-0.692 -1,0 -1.77,0.654 -1.77,1.5 0,0.808 0.808,1.5 1.77,1.5 0.654,0 1.231,-0.308 1.539,-0.731l5.77,0l0,21.62c0,1.077 -0.692,1.847 -1.577,1.847 -2.424,0 -5.001,-1.077 -7.001,-2.693 -2.154,-1.693 -3.655,-3.924 -3.655,-6.001 0,-1.039 1.116,-1.385 1.847,-1.577 -1.808,-0.462 -4.347,-1.193 -5.963,-2.539 0.423,2.154 -0.038,4.462 -0.577,6.617 0.5,-0.539 0.962,-1.269 2,-1.269 1.039,0 2.462,3.808 5.578,6.155 3.231,2.462 7.001,2.616 8.694,3.808 0.616,0.423 1.462,2.039 1.462,2.039 0,0 0.846,-1.616 1.462,-2.039 1.654,-1.193 5.424,-1.346 8.694,-3.808 3.078,-2.347 4.539,-6.155 5.578,-6.155 1.039,0 1.5,0.769 2,1.269 -0.539,-2.154 -0.962,-4.462 -0.577,-6.617 -1.616,1.346 -4.116,2.077 -5.963,2.539 0.731,0.192 1.847,0.539 1.847,1.577 0,2.077 -1.5,4.309 -3.655,6.001 -2,1.577 -4.616,2.693 -7.001,2.693 -0.885,0 -1.577,-0.769 -1.577,-1.847L72.345,54.697l5.732,0c0.308,0.462 0.885,0.731 1.539,0.731 1,0 1.77,-0.654 1.77,-1.5 0,-0.808 -0.808,-1.5 -1.77,-1.5 -0.616,0 -1.193,0.269 -1.5,0.692l-5.77,0l0,-1.962c1.193,-0.346 2.077,-1.423 2.077,-2.731 -0.077,-1.577 -1.346,-2.885 -2.924,-2.885zM71.499,47.003c0.769,0 1.385,0.616 1.385,1.423 0,0.769 -0.616,1.385 -1.423,1.385 -0.769,0 -1.423,-0.616 -1.423,-1.385 0.038,-0.769 0.692,-1.423 1.462,-1.423z"/>
26+
</vector>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="128dp"
3+
android:height="128dp"
4+
android:viewportWidth="128"
5+
android:viewportHeight="128">
6+
<path
7+
android:pathData="M13.138,1.014L114.986,1.014A12.004,12.004 0,0 1,126.99 13.018L126.99,114.865A12.004,12.004 0,0 1,114.986 126.869L13.138,126.869A12.004,12.004 0,0 1,1.134 114.865L1.134,13.018A12.004,12.004 0,0 1,13.138 1.014z"
8+
android:strokeWidth="1.93817"
9+
android:fillColor="#ffffff"
10+
android:strokeColor="#000000"/>
11+
<path
12+
android:pathData="M71.201,56.866 L47.416,79.039 22.018,70.573c-3.218,1.841 -7.044,3.277 -4.031,9.272l33.057,12.9 15.722,-11.691 0.403,16.932 34.382,-41.236z"
13+
android:strokeLineJoin="round"
14+
android:strokeWidth="4.48485"
15+
android:fillColor="#871a09"
16+
android:strokeColor="#811401"
17+
android:fillType="evenOdd"
18+
android:strokeLineCap="butt"/>
19+
<path
20+
android:pathData="m110.306,57.673 l0,57.246 -43.136,-0.001c-2.688,-2.15 -2.688,-6.065 0,-8.753l38.701,-0.116c2.778,-1.747 0.722,-3.494 0,-5.241l-32.251,0z"
21+
android:strokeLineJoin="round"
22+
android:strokeWidth="4.48485"
23+
android:fillColor="#871a09"
24+
android:strokeColor="#811401"
25+
android:fillType="evenOdd"
26+
android:strokeLineCap="butt"/>
27+
<path
28+
android:pathData="m72.612,39.733c1.008,-0.202 29.228,-3.628 29.228,-3.628 0.165,8.629 -1.803,15.764 -12.296,16.932 -7.656,-0.611 -14.583,-2.608 -16.932,-13.304z"
29+
android:strokeLineJoin="round"
30+
android:strokeWidth="4.48485"
31+
android:fillColor="#871a09"
32+
android:strokeColor="#811401"
33+
android:fillType="evenOdd"
34+
android:strokeLineCap="butt"/>
35+
<path
36+
android:pathData="m60.115,36.105 l40.755,-5.129c0.363,0.678 -29.767,-4.962 -29.86,-5.074 0.124,0.413 -9.562,9.505 -10.895,10.203z"
37+
android:strokeLineJoin="round"
38+
android:strokeWidth="4.48485"
39+
android:fillColor="#871a09"
40+
android:strokeColor="#811401"
41+
android:fillType="evenOdd"
42+
android:strokeLineCap="butt"/>
43+
<path
44+
android:pathData="m64.574,12.361c-0.137,0.002 38.716,10.067 38.471,10.28 0.258,0.014 -2.001,5.507 -2.17,5.422 0.193,-0.12 -27.246,-6.946 -27.054,-6.672 -5.171,-4.827 -4.021,-3.089 -9.248,-9.03z"
45+
android:strokeLineJoin="round"
46+
android:strokeWidth="4.48485"
47+
android:fillColor="#871a09"
48+
android:strokeColor="#811401"
49+
android:fillType="evenOdd"
50+
android:strokeLineCap="butt"/>
51+
</vector>

0 commit comments

Comments
 (0)