| [2fa2ef8] | 1 | /*
|
|---|
| 2 |
|
|---|
| 3 | Copyright (C) 2018 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved.
|
|---|
| 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 | {
|
|---|
| 36 | GnuBoat.Webserver.private.map = L.map('mapViewport').setView([51.505, -0.09], 13);
|
|---|
| 37 |
|
|---|
| 38 | var layer_openstreetmap = L.tileLayer(
|
|---|
| 39 | 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|---|
| 40 | { attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'}
|
|---|
| 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 |
|
|---|
| 47 |
|
|---|
| 48 | // add layer control
|
|---|
| 49 | GnuBoat.Webserver.private.mapControl = L.control.layers(
|
|---|
| 50 | {"Map": layer_openstreetmap},
|
|---|
| 51 | {"Seamarks": layer_openseamap},
|
|---|
| 52 | {hideSingleBase: true, sortLayers: true, }
|
|---|
| 53 | ).addTo(GnuBoat.Webserver.private.map);
|
|---|
| 54 |
|
|---|
| 55 | // add scale
|
|---|
| 56 | L.control.scale().addTo(GnuBoat.Webserver.private.map);
|
|---|
| 57 | }
|
|---|
| 58 | }
|
|---|