diff client/src/components/map/Identify.vue @ 1272:bc55ffaeb639

cleaned up client/src directory better organization of files and directories, better naming, separation of admin and map context
author Markus Kottlaender <markus@intevation.de>
date Thu, 22 Nov 2018 07:07:12 +0100
parents
children dc3fb8ad8f86
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/src/components/map/Identify.vue	Thu Nov 22 07:07:12 2018 +0100
@@ -0,0 +1,86 @@
+<template>
+    <div :class="['box ui-element rounded bg-white mb-auto text-nowrap', { expanded: showIdentify }]">
+        <div style="width: 20rem">
+            <h6 class="mb-0 py-2 px-3 border-bottom d-flex align-items-center bg-info text-white">
+              <i class="fa fa-info mr-2"></i>
+              Identified
+              <i class="fa fa-times ml-auto" @click="$store.commit('application/showIdentify', false)"></i>
+            </h6>
+            <div class="d-flex flex-column features p-3 flex-grow-1 text-left">
+                <div v-if="currentMeasurement">
+                    <b>
+                      {{ currentMeasurement.quantity }}
+                      ({{ currentMeasurement.unitSymbol }}):
+                    </b><br>
+                    <small>{{ currentMeasurement.value }}</small>
+                </div>
+                <div v-for="(feature, i) of identifiedFeatures" :key="feature.getId()" >
+                    <div v-if="feature.getId()" :class="{ 'mt-2': i }">
+                        <b>{{ feature.getId().replace(/[.][^.]*$/,"") /* cut away everything from the last . to the end */}}:</b>
+                        <small
+                            v-for="(value, key) in prepareProperties(feature)"
+                            :key="key"
+                        >
+                            <div v-if="value">{{key}}:{{value}}</div>
+                        </small>
+                    </div>
+                </div>
+                <div v-if="!currentMeasurement && !identifiedFeatures.length" class="text-muted small text-center my-auto">
+                    No features identified.
+                </div>
+            </div>
+            <div class="versioninfo border-top p-3 text-left">
+                gemma
+                <a href="https://hg.intevation.de/gemma/file/tip">source-code</a>
+                {{ versionStr }}
+                <br>Some data ©
+                <a href="https://www.openstreetmap.org/copyright">OpenSteetMap</a>contributors
+            </div>
+        </div>
+    </div>
+</template>
+
+<style lang="sass" scoped>
+.features
+  max-height: 19rem
+  overflow-y: auto
+
+.versioninfo
+  font-size: 60%
+</style>
+
+<script>
+/* This is Free Software under GNU Affero General Public License v >= 3.0
+ * without warranty, see README.md and license for details.
+ *
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ * License-Filename: LICENSES/AGPL-3.0.txt
+ *
+ * Copyright (C) 2018 by via donau 
+ *   – Österreichische Wasserstraßen-Gesellschaft mbH
+ * Software engineering by Intevation GmbH
+ *
+ * Author(s):
+ * Thomas Junk <thomas.junk@intevation.de>
+ * Bernhard E. Reiter <bernhard.reiter@intevation.de>
+ * Markus Kottländer <markus.kottlaender@intevation.de>
+ */
+import { mapState, mapGetters } from "vuex";
+
+export default {
+  name: "identify",
+  computed: {
+    ...mapGetters("application", ["versionStr"]),
+    ...mapState("application", ["showIdentify"]),
+    ...mapState("map", ["identifiedFeatures", "currentMeasurement"])
+  },
+  methods: {
+    prepareProperties(feature) {
+      // return dict object with propertyname:plainvalue prepared for display
+      var properties = feature.getProperties();
+      delete properties[feature.getGeometryName()];
+      return properties;
+    }
+  }
+};
+</script>