| [2fa2ef8] | 1 | /*
|
|---|
| 2 |
|
|---|
| [883b4a5] | 3 | Copyright (C) 2018 - 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| [2fa2ef8] | 4 |
|
|---|
| 5 | This library is free software; you can redistribute it and/or
|
|---|
| 6 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 7 | License as published by the Free Software Foundation; either
|
|---|
| 8 | version 2.1 of the License, or (at your option) any later version.
|
|---|
| 9 |
|
|---|
| 10 | This library is distributed in the hope that it will be useful,
|
|---|
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 13 | Lesser General Public License for more details.
|
|---|
| 14 |
|
|---|
| 15 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 16 | License along with this library; if not, write to the Free Software
|
|---|
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|---|
| 18 | MA 02110-1301 USA.
|
|---|
| 19 |
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | /** @namespace GnuBoat JavaScript namespace */
|
|---|
| 23 | var GnuBoat = GnuBoat || {};
|
|---|
| 24 | /** @namespace GnuBoat Webserver JavaScript namespace */
|
|---|
| 25 | GnuBoat.Webserver = GnuBoat.Webserver || {};
|
|---|
| 26 |
|
|---|
| 27 | GnuBoat.Webserver.initialize = function()
|
|---|
| 28 | {
|
|---|
| 29 | GnuBoat.Webserver.private.mapSetup();
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | GnuBoat.Webserver.private = {
|
|---|
| 33 | map: null,
|
|---|
| 34 | mapSetup: function ()
|
|---|
| 35 | {
|
|---|
| [883b4a5] | 36 | GnuBoat.Webserver.private.map = L.map('mapViewport').setView([48.43, 10.04], 17);
|
|---|
| [2fa2ef8] | 37 |
|
|---|
| 38 | var layer_openstreetmap = L.tileLayer(
|
|---|
| 39 | 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|---|
| [46f871f] | 40 | { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>, <a href="http://www.openseamap.org">OpenSeaMap</a>, <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
|
|---|
| [2fa2ef8] | 41 | ).addTo(GnuBoat.Webserver.private.map);
|
|---|
| 42 | var layer_openseamap = L.tileLayer(
|
|---|
| 43 | 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png',
|
|---|
| 44 | {attribute: '© <a href="http://www.openseamap.org">OpenSeaMap</a> contributors'}
|
|---|
| 45 | ).addTo(GnuBoat.Webserver.private.map);
|
|---|
| 46 |
|
|---|
| [883b4a5] | 47 | // add GNUBoat layers
|
|---|
| 48 | var layer_gnuboat_hillshade = L.tileLayer(
|
|---|
| 49 | './tiles/hillshade/{z}/{x}/{y}.png',
|
|---|
| 50 | {tms: true, opacity: 0.2, zIndex: 98, attribute: '© <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
|
|---|
| 51 | );
|
|---|
| 52 | var layer_gnuboat_color_relief= L.tileLayer(
|
|---|
| 53 | 'tiles/color_relief/{z}/{x}/{y}.png',
|
|---|
| 54 | {tms: true, opacity: 0.4, zIndex: 99, attribute: '© <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
|
|---|
| 55 | );
|
|---|
| 56 | var layer_gnuboat_slopeshade = L.tileLayer(
|
|---|
| 57 | 'tiles/slopeshade/{z}/{x}/{y}.png',
|
|---|
| 58 | {tms: true, opacity: 0.2, zIndex: 97, attribute: '© <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
|
|---|
| 59 | );
|
|---|
| 60 | var layer_gnuboat_group = L.layerGroup([layer_gnuboat_color_relief, layer_gnuboat_hillshade, layer_gnuboat_slopeshade]).addTo(GnuBoat.Webserver.private.map);
|
|---|
| [2fa2ef8] | 61 |
|
|---|
| 62 | // add layer control
|
|---|
| [883b4a5] | 63 | var baselayers = {
|
|---|
| 64 | "Map": layer_openstreetmap,
|
|---|
| 65 | };
|
|---|
| 66 | // overlays
|
|---|
| 67 | var overlays = {"Seamarks": layer_openseamap,
|
|---|
| 68 | "GNUBoat": layer_gnuboat_group,
|
|---|
| 69 | // "GNUBoat Hillshade": layer_gnuboat_hillshade,
|
|---|
| 70 | // "GNUBoat Color Relief": layer_gnuboat_color_relief,
|
|---|
| 71 | // "GNUBoat Slopeshade": layer_gnuboat_slopeshade,
|
|---|
| 72 | };
|
|---|
| [2fa2ef8] | 73 | GnuBoat.Webserver.private.mapControl = L.control.layers(
|
|---|
| [883b4a5] | 74 | baselayers, overlays,
|
|---|
| [2fa2ef8] | 75 | {hideSingleBase: true, sortLayers: true, }
|
|---|
| 76 | ).addTo(GnuBoat.Webserver.private.map);
|
|---|
| 77 |
|
|---|
| 78 | // add scale
|
|---|
| 79 | L.control.scale().addTo(GnuBoat.Webserver.private.map);
|
|---|
| 80 | }
|
|---|
| 81 | }
|
|---|