view client/src/identify/Identify.vue @ 1213:9d93968db2cd

replaced custom css with bootstrap classes
author Markus Kottlaender <markus@intevation.de>
date Mon, 19 Nov 2018 14:13:01 +0100
parents 4f666dbb9abd
children ba8cd80d68b6
line wrap: on
line source

<template>
    <div class="identifymenu">
        <div
            @click="$store.commit('application/showIdentify', !showIdentify)"
            class="d-flex flex-column ui-element minimizer"
        >
            <div :class="infoStyle">
                <i class="fa fa-info"></i>
            </div>
        </div>
        <div :class="identifyStyle">
            <div v-if="showIdentify" class="card-body">
                <div class="headline">
                    <h4>Identified</h4>
                </div>
                <hr>
                <div class="d-flex flex-column features">
                    <small v-if="currentMeasurement">
                        <b>
                          {{ currentMeasurement.quantity }}
                          ({{ currentMeasurement.unitSymbol }}):
                        </b><br>
                        {{ currentMeasurement.value }}
                    </small>
                    <div v-for="feature of identifiedFeatures" :key="feature.getId()" class="mt-2">
                        <div v-if="feature.getId()">
                            <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>
                <div class="versioninfo">
                    <hr>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>
    </div>
</template>

<style lang="sass" scoped>
.features
  max-height: $identify-height
  overflow-y: auto

.versioninfo
  font-size: 60%

.identifymenu
  position: relative
  margin-left: $offset

.identify
  background-color: white
  opacity: $slight-transparent
  text-align: left

.identifycollapsed
  min-height: $icon-height
  width: $icon-width
  transition: $transition-fast

.identifyexpanded
  width: $identify-width

.minimizer
  position: absolute
  z-index: 2
  right: 0
  margin-top: $x-small-offset
  height: $icon-width
  width: $icon-height
</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>
 */
import { mapState, mapGetters } from "vuex";

export default {
  name: "identify",
  computed: {
    ...mapGetters("application", ["versionStr"]),
    ...mapState("application", ["showIdentify"]),
    ...mapState("map", ["identifiedFeatures", "currentMeasurement"]),
    identifyStyle() {
      return {
        "ui-element": true,
        rounded: true,
        identify: true,
        shadow: true,
        identifyexpanded: this.showIdentify,
        identifycollapsed: !this.showIdentify
      };
    },
    infoStyle() {
      return {
        info: true,
        "text-info":
          this.identifiedFeatures && this.identifiedFeatures.length > 0
      };
    }
  },
  methods: {
    prepareProperties(feature) {
      // return dict object with propertyname:plainvalue prepared for display
      var properties = feature.getProperties();
      delete properties[feature.getGeometryName()];
      return properties;
    }
  }
};
</script>