| [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
|
|---|
| [c5b13e1] | 48 | var layer_gnuboat_accuracy_low = L.tileLayer(
|
|---|
| 49 | './tiles/gnuboat_10_100/{z}/{x}/{y}.png',
|
|---|
| 50 | {tms: true, opacity: 0.5, zIndex: 98, attribute: '© <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
|
|---|
| [883b4a5] | 51 | );
|
|---|
| [c5b13e1] | 52 | var layer_gnuboat_accuracy_high = L.tileLayer(
|
|---|
| 53 | './tiles/gnuboat_100_100/{z}/{x}/{y}.png',
|
|---|
| 54 | {tms: true, opacity: 0.5, zIndex: 98, attribute: '© <a href="http://gnuboat.engsas.de">GNUBoat</a> contributors'}
|
|---|
| 55 | ).addTo(GnuBoat.Webserver.private.map);
|
|---|
| [2fa2ef8] | 56 |
|
|---|
| 57 | // add layer control
|
|---|
| [883b4a5] | 58 | var baselayers = {
|
|---|
| 59 | "Map": layer_openstreetmap,
|
|---|
| 60 | };
|
|---|
| 61 | // overlays
|
|---|
| 62 | var overlays = {"Seamarks": layer_openseamap,
|
|---|
| [c5b13e1] | 63 | "GNUBoat Low Accuracy": layer_gnuboat_accuracy_low,
|
|---|
| 64 | "GNUBoat High Accuracy": layer_gnuboat_accuracy_high,
|
|---|
| [883b4a5] | 65 | };
|
|---|
| [2fa2ef8] | 66 | GnuBoat.Webserver.private.mapControl = L.control.layers(
|
|---|
| [883b4a5] | 67 | baselayers, overlays,
|
|---|
| [2fa2ef8] | 68 | {hideSingleBase: true, sortLayers: true, }
|
|---|
| 69 | ).addTo(GnuBoat.Webserver.private.map);
|
|---|
| 70 |
|
|---|
| 71 | // add scale
|
|---|
| 72 | L.control.scale().addTo(GnuBoat.Webserver.private.map);
|
|---|
| 73 | }
|
|---|
| 74 | }
|
|---|