-
-
Notifications
You must be signed in to change notification settings - Fork 394
Add police type quest (Italy only) #2675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 13 commits
3717423
4e3702f
b4f27ad
cefb6f4
8fef66f
3d00c9a
0aff0e6
c4b8715
3219e53
98037e4
13626a6
4ab9328
9926e7d
cec8910
11d6155
cf04ff5
7a1e454
0feb557
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package de.westnordost.streetcomplete.quests.police_type | ||
|
|
||
| import de.westnordost.streetcomplete.R | ||
| import de.westnordost.streetcomplete.data.osm.osmquest.OsmFilterQuestType | ||
| import de.westnordost.streetcomplete.data.osm.changes.StringMapChangesBuilder | ||
| import de.westnordost.streetcomplete.data.quest.NoCountriesExcept | ||
|
|
||
| class AddPoliceType : OsmFilterQuestType<PoliceType>() { | ||
|
|
||
| override val elementFilter = """ | ||
| nodes, ways with | ||
| amenity = police | ||
| and !operator | ||
| """ | ||
| override val commitMessage = "Add police type" | ||
| override val wikiLink = "Tag:amenity=police" | ||
| override val icon = R.drawable.ic_quest_police | ||
| override val enabledInCountries = NoCountriesExcept( | ||
| "IT" | ||
| ) | ||
|
|
||
| override fun getTitle(tags: Map<String, String>) = R.string.quest_policeType_title | ||
|
|
||
| override fun createForm() = AddPoliceTypeForm() | ||
|
|
||
| override fun applyAnswerTo(answer: PoliceType, changes: StringMapChangesBuilder) { | ||
| changes.add("name", answer.policeName); | ||
|
||
| changes.add("operator", answer.operator.operatorName); | ||
| changes.add("operator:wikidata", answer.operator.wikidata); | ||
westnordost marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| changes.add("operator:wikipedia", answer.operator.wikipedia); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package de.westnordost.streetcomplete.quests.police_type | ||
|
|
||
| import android.os.Bundle | ||
| import de.westnordost.streetcomplete.R | ||
| import de.westnordost.streetcomplete.quests.AImageListQuestAnswerFragment | ||
| import de.westnordost.streetcomplete.view.image_select.Item | ||
|
|
||
| class AddPoliceTypeForm : AImageListQuestAnswerFragment<PoliceType, PoliceType>() { | ||
|
|
||
| override val items = listOf( | ||
| Item(PoliceType.CARABINIERI, R.drawable.ic_police_type_carabinieri, R.string.quest_policeType_type_it_carabinieri), | ||
| Item(PoliceType.POLIZIA_DI_STATO, R.drawable.ic_police_type_polizia, R.string.quest_policeType_type_it_polizia_di_stato), | ||
| Item(PoliceType.POLIZIA_MUNICIPALE, R.drawable.ic_police_type_municipale, R.string.quest_policeType_type_it_polizia_municipale), | ||
| Item(PoliceType.POLIZIA_LOCALE, R.drawable.ic_police_type_locale, R.string.quest_policeType_type_it_polizia_locale), | ||
| Item(PoliceType.GUARDIA_DI_FINANZA, R.drawable.ic_police_type_finanza, R.string.quest_policeType_type_it_guardia_di_finanza), | ||
| Item(PoliceType.POLIZIA_STRADALE, R.drawable.ic_police_type_stradale, R.string.quest_policeType_type_it_polizia_stradale), | ||
| Item(PoliceType.GUARDIA_COSTIERA, R.drawable.ic_police_type_costiera, R.string.quest_policeType_type_it_guardia_costiera), | ||
| Item(PoliceType.POLIZIA_FERROVIARIA, R.drawable.ic_police_type_ferroviaria, R.string.quest_policeType_type_it_polizia_ferroviaria) | ||
| ) | ||
|
|
||
| override val itemsPerRow = 3 | ||
|
|
||
| override fun onCreate(savedInstanceState: Bundle?) { | ||
| super.onCreate(savedInstanceState) | ||
| imageSelector.cellLayoutId = R.layout.cell_icon_select_with_label_below | ||
| } | ||
|
|
||
| override fun onClickOk(selectedItems: List<PoliceType>) { | ||
| applyAnswer(selectedItems.single()) | ||
| } | ||
|
|
||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package de.westnordost.streetcomplete.quests.police_type | ||
|
|
||
| enum class PoliceType(val policeName: String, val operator: PoliceOperator) { | ||
| CARABINIERI("Arma dei Carabinieri", PoliceOperator.ARMA_DEI_CARABINIERI), | ||
| GUARDIA_COSTIERA("Guardia Costiera", PoliceOperator.GUARDIA_COSTIERA), | ||
| GUARDIA_DI_FINANZA("Guardia di Finanza", PoliceOperator.GUARDIA_DI_FINANZA), | ||
| POLIZIA_DI_STATO("Polizia di Stato", PoliceOperator.POLIZIA_DI_STATO), | ||
| POLIZIA_MUNICIPALE("Polizia Municipale", PoliceOperator.POLIZIA_MUNICIPALE), | ||
| POLIZIA_LOCALE("Polizia Locale", PoliceOperator.POLIZIA_LOCALE), | ||
| POLIZIA_STRADALE("Polizia Stradale", PoliceOperator.POLIZIA_DI_STATO), | ||
| POLIZIA_FERROVIARIA("Polizia Ferroviaria", PoliceOperator.POLIZIA_DI_STATO) | ||
| } | ||
|
|
||
| enum class PoliceOperator(val operatorName: String, val wikidata: String, val wikipedia: String) { | ||
| ARMA_DEI_CARABINIERI("Arma dei Carabinieri", "Q54852", "en:Carabinieri"), | ||
|
||
| POLIZIA_DI_STATO("Polizia di Stato", "Q897817", "it:Polizia di Stato"), | ||
| GUARDIA_DI_FINANZA("Guardia di Finanza", "Q1552861", "it:Guardia di Finanza"), | ||
| POLIZIA_MUNICIPALE("Polizia Municipale", "Q1431981", "it:Polizia municipale"), | ||
| POLIZIA_LOCALE("Polizia Locale", "Q61634147", "it:Polizia locale (Italia)"), | ||
| GUARDIA_COSTIERA("Guardia Costiera", "Q1552839", "it:Corpo delle capitanerie di porto - Guardia costiera") | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="128dp" | ||
| android:height="128dp" | ||
| android:viewportWidth="128" | ||
| android:viewportHeight="128"> | ||
| <path | ||
| 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" | ||
| android:strokeWidth="1.93905" | ||
| android:fillColor="#ffffff" | ||
| android:strokeColor="#000000"/> | ||
| <path | ||
| 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" | ||
| android:fillColor="#000000"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="miter" | ||
| android:strokeWidth="0.424264" | ||
| android:fillColor="#ff0000" | ||
| android:strokeColor="#ffffff" | ||
| android:strokeLineCap="butt"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="miter" | ||
| android:strokeWidth="0.424264" | ||
| android:fillColor="#0000ff" | ||
| android:strokeColor="#ffffff" | ||
| android:strokeLineCap="butt"/> | ||
| </vector> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="128dp" | ||
| android:height="128dp" | ||
| android:viewportWidth="128" | ||
| android:viewportHeight="128"> | ||
| <path | ||
| 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" | ||
| android:strokeWidth="1.93817" | ||
| android:fillColor="#ffffff" | ||
| android:strokeColor="#000000"/> | ||
| <path | ||
| android:pathData="M13.794,102.591l-9.617,0l38.47,-76.939l9.617,0z" | ||
| android:fillColor="#009246"/> | ||
| <path | ||
| android:pathData="M21.488,102.591l-9.617,0l38.47,-76.939l9.617,0z" | ||
| android:fillColor="#ffffff"/> | ||
| <path | ||
| android:pathData="M84.963,102.591l-65.398,0l38.47,-76.939l65.398,0z" | ||
| android:fillColor="#ce2b37"/> | ||
| <path | ||
| 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" | ||
| android:fillColor="#ffffff"/> | ||
| <path | ||
| android:fillColor="#FF000000" | ||
| 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"/> | ||
| </vector> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| <vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
| android:width="128dp" | ||
| android:height="128dp" | ||
| android:viewportWidth="128" | ||
| android:viewportHeight="128"> | ||
| <path | ||
| 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" | ||
| android:strokeWidth="1.93817" | ||
| android:fillColor="#ffffff" | ||
| android:strokeColor="#000000"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="4.48485" | ||
| android:fillColor="#871a09" | ||
| android:strokeColor="#811401" | ||
| android:fillType="evenOdd" | ||
| android:strokeLineCap="butt"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="4.48485" | ||
| android:fillColor="#871a09" | ||
| android:strokeColor="#811401" | ||
| android:fillType="evenOdd" | ||
| android:strokeLineCap="butt"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="4.48485" | ||
| android:fillColor="#871a09" | ||
| android:strokeColor="#811401" | ||
| android:fillType="evenOdd" | ||
| android:strokeLineCap="butt"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="4.48485" | ||
| android:fillColor="#871a09" | ||
| android:strokeColor="#811401" | ||
| android:fillType="evenOdd" | ||
| android:strokeLineCap="butt"/> | ||
| <path | ||
| 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" | ||
| android:strokeLineJoin="round" | ||
| android:strokeWidth="4.48485" | ||
| android:fillColor="#871a09" | ||
| android:strokeColor="#811401" | ||
| android:fillType="evenOdd" | ||
| android:strokeLineCap="butt"/> | ||
| </vector> |
Uh oh!
There was an error while loading. Please reload this page.