Mercurial > gemma
annotate client/src/layers/Layerselect.vue @ 1207:70116d392387
close bottleneck list: made searchbar collapse only if it was collapsed before
opening the bottleneck list will expand the searchbar, closing the bottleneck list
was always collapsing the searchbar too. Now it stays open if it was open beforeopening the bottleneck list
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Mon, 19 Nov 2018 13:02:48 +0100 |
parents | b23622905a3f |
children | d1114305a311 |
rev | line source |
---|---|
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
982 | 2 <div> |
3 <div class="form-check d-flex flex-row flex-start selection"> | |
4 <input class="form-check-input" @change="visibilityToggled" :id="layername" type="checkbox" :checked="isVisible"> | |
5 <LegendElement :layername="layername" :layerindex="layerindex"></LegendElement> | |
6 <label class="layername form-check-label">{{layername}}</label> | |
7 </div> | |
8 <div v-if="isVisible && (layername == 'Bottleneck isolines')" class="card"> | |
9 <img class="rounded mx-auto d-block" :src="isolinesLegendImgUrl"> | |
10 </div> | |
626
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
11 </div> |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 </template> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 |
1191
b23622905a3f
switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents:
1139
diff
changeset
|
14 <style lang="sass" scoped> |
b23622905a3f
switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents:
1139
diff
changeset
|
15 .selection |
b23622905a3f
switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents:
1139
diff
changeset
|
16 text-align: left |
b23622905a3f
switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents:
1139
diff
changeset
|
17 |
b23622905a3f
switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents:
1139
diff
changeset
|
18 .layername |
b23622905a3f
switched entirely to sass instead of scss
Markus Kottlaender <markus@intevation.de>
parents:
1139
diff
changeset
|
19 margin-left: $small-offset |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 </style> |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
22 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
24 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
25 * This is Free Software under GNU Affero General Public License v >= 3.0 |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
26 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
27 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
28 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
29 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
30 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
31 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
32 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
33 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
34 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
35 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
36 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
37 */ |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
38 import { HTTP } from "../application/lib/http"; |
799
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
39 import LegendElement from "./LegendElement.vue"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
40 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
41 props: ["layername", "layerindex", "isVisible"], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
42 name: "layerselect", |
982 | 43 data() { |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
44 return { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
45 isolinesLegendImgUrl: "" |
982 | 46 }; |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
47 }, |
799
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
48 components: { |
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
49 LegendElement |
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
50 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 methods: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 visibilityToggled() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 this.$emit("visibilityToggled", this.layerindex); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 } |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
55 }, |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
56 created() { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
57 // fetch legend image for bottleneck isolines |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
58 // TODO: move to store |
982 | 59 if (this.layername == "Bottleneck isolines") { |
60 const src = | |
61 "/internal/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=sounding_results_contour_lines_geoserver&legend_options=columns:4;fontAntiAliasing:true"; | |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
62 HTTP.get(src, { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
63 headers: { |
982 | 64 Accept: "image/png", |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
65 "X-Gemma-Auth": localStorage.getItem("token") |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
66 }, |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
67 responseType: "blob" |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
68 }).then(response => { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
69 var urlCreator = window.URL || window.webkitURL; |
982 | 70 this.isolinesLegendImgUrl = urlCreator.createObjectURL(response.data); |
71 }); | |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
72 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
73 } |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
74 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
75 </script> |