import React from "react"; import Map from "pigeon-maps"; import Marker from "pigeon-marker"; import Overlay from "pigeon-overlay"; import {longitude, latitude, mapWidth, mapHeight} from "./config/variables"; import {Button} from "reactstrap"; export default class Pigeon extends React.Component{ providers = { osm: (x, y, z) => { // use 3 urls to download the tiles faster const s = String.fromCharCode(97 + ((x + y + z) % 3)) return `https://${s}.tile.openstreetmap.org/${z}/${x}/${y}.png` }, stamenTerrain: (x, y, z, dpr) => { return `https://stamen-tiles.a.ssl.fastly.net/terrain/${z}/${x}/${y}${dpr >= 2 ? '@2x' : ''}.jpg` } } zoomIn = () => { let newZoom = Math.min(this.props.mapConfig.zoom + 1, 22) this.props.updateMapState("zoom", newZoom) } zoomOut = () => { let newZoom = Math.max(this.props.mapConfig.zoom - 1, 0) this.props.updateMapState("zoom", newZoom) } removeMarkers = () => { this.props.updateMapState("path", []) } addMarker = (event) => { const lat = event.latLng[0] const lng = event.latLng[1] console.log("Clicked at", lat, "/", lng, event) let pathCopy = this.props.mapConfig.path.slice(); pathCopy.push([lat, lng]); this.props.updateMapState("path", pathCopy) this.props.getDistance() } render(){ const mapConfig = this.props.mapConfig; return (
this.addMarker(event)} > {mapConfig.path.map((pos, idx) => )} {/*pigeon*/}

Distanz: {Math.round(mapConfig.distance*100)/100} km

); } }