facilmap/frontend/src/lib/components/overpass-form/overpass-form.vue

60 wiersze
2.1 KiB
Vue
Czysty Zwykły widok Historia

2021-05-18 02:54:11 +00:00
<div class="fm-overpass-form">
<template v-if="!mapContext.overpassIsCustom">
<b-form-input type="search" v-model="searchTerm" placeholder="Filter…" autofocus></b-form-input>
2021-05-15 20:05:07 +00:00
<hr />
<div v-if="searchTerm" class="checkbox-grid">
<b-form-checkbox
v-for="preset in filteredPresets"
:checked="preset.isChecked"
2021-05-18 00:52:55 +00:00
@input="togglePreset(preset.key, $event)"
2021-05-15 20:05:07 +00:00
>{{preset.label}}</b-form-checkbox>
</div>
<b-tabs v-else pills lazy v-model="activeTab">
<b-tab v-for="(category, idx) in categories" :title="category.label">
<template #title>
{{category.label}}
<b-badge v-if="category.checked > 0" :variant="activeTab == idx ? 'secondary' : 'primary'">{{category.checked}}</b-badge>
</template>
<template v-for="presets in category.presets">
<hr />
<div class="checkbox-grid">
<b-form-checkbox
v-for="preset in presets"
:checked="preset.isChecked"
2021-05-18 00:52:55 +00:00
@input="togglePreset(preset.key, $event)"
>{{preset.label}}</b-form-checkbox>
</div>
</template>
</b-tab>
</b-tabs>
</template>
<template v-else>
2021-05-18 02:54:11 +00:00
<b-form-group :state="customQueryValidationState">
<b-textarea v-model="customQuery" rows="5" :state="customQueryValidationState" class="text-monospace" @input="handleCustomQueryInput"></b-textarea>
<template #invalid-feedback><pre>{{customQueryValidationError}}</pre></template>
</b-form-group>
<hr />
<p>
Enter an <a href="https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#The_Query_Statement" target="_blank">Overpass query statement</a>
here. Settings and an <code>out</code> statement are added automatically in the background. For ways and relations, a marker will be shown at
the geometric centre, no lines or polygons are drawn.
</p>
<p>
Example queries are <code>nwr[amenity=parking]</code> to get parking places or
<code>(nwr[amenity=atm];nwr[amenity=bank][atm][atm!=no];)</code> for ATMs.
</p>
</template>
2021-05-18 02:54:11 +00:00
<hr />
<b-button-toolbar>
<b-button
@click="toggleIsCustom()"
:pressed="mapContext.overpassIsCustom"
>Custom query</b-button>
</b-button-toolbar>
</div>