Mercurial > gemma
annotate client/src/layers/Layerselect.vue @ 1075:c1989ebe1d8a
feat: invert fairwayprofile scale
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 26 Oct 2018 13:21:17 +0200 |
parents | ca628dce90dd |
children | 2fda33d55d81 |
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 |
626
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
14 <style lang="scss"> |
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
15 .selection { |
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
16 text-align: left; |
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
17 } |
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
18 .layername { |
638
c2f040dba57f
feat: collapsible layer selection
Thomas Junk <thomas.junk@intevation.de>
parents:
626
diff
changeset
|
19 margin-left: $small-offset; |
626
d4fa28bfa6ec
fix: layout minor fixes of buttons and menu
Thomas Junk <thomas.junk@intevation.de>
parents:
585
diff
changeset
|
20 } |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 </style> |
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 |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 <script> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
25 /* |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
26 * 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
|
27 * without warranty, see README.md and license for details. |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
28 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
29 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
30 * License-Filename: LICENSES/AGPL-3.0.txt |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
31 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
32 * Copyright (C) 2018 by via donau |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
33 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
34 * Software engineering by Intevation GmbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
35 * |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
36 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
37 * Thomas Junk <thomas.junk@intevation.de> |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
982
diff
changeset
|
38 */ |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
39 import { HTTP } from "../application/lib/http"; |
799
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
40 import LegendElement from "./LegendElement.vue"; |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
41 export default { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
42 props: ["layername", "layerindex", "isVisible"], |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
43 name: "layerselect", |
982 | 44 data() { |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
45 return { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
46 isolinesLegendImgUrl: "" |
982 | 47 }; |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
48 }, |
799
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
49 components: { |
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
50 LegendElement |
959892ffd72c
client: add new LegendElement to layerselection box
Bernhard Reiter <bernhard@intevation.de>
parents:
638
diff
changeset
|
51 }, |
585
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 methods: { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 visibilityToggled() { |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 this.$emit("visibilityToggled", this.layerindex); |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
55 } |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
56 }, |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
57 created() { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
58 // fetch legend image for bottleneck isolines |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
59 // TODO: move to store |
982 | 60 if (this.layername == "Bottleneck isolines") { |
61 const src = | |
62 "/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
|
63 HTTP.get(src, { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
64 headers: { |
982 | 65 Accept: "image/png", |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
66 "X-Gemma-Auth": localStorage.getItem("token") |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
67 }, |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
68 responseType: "blob" |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
69 }).then(response => { |
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
70 var urlCreator = window.URL || window.webkitURL; |
982 | 71 this.isolinesLegendImgUrl = urlCreator.createObjectURL(response.data); |
72 }); | |
980
e833617d1314
fetch legend image for bottleneck isolines from server
Markus Kottlaender <markus@intevation.de>
parents:
938
diff
changeset
|
73 } |
585
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 }; |
ef307bd6b5d8
refac: restructured client application
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 </script> |