/* Copyright (C) 2018 - 2019 EngSaS - Engineering Solutions and Services Langenbach. All rights reserved. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /** @namespace GnuBoat JavaScript namespace */ var GnuBoat = GnuBoat || {}; /** @namespace GnuBoat Webserver JavaScript namespace */ GnuBoat.Webserver = GnuBoat.Webserver || {}; GnuBoat.Webserver.initialize = function() { GnuBoat.Webserver.private.mapSetup(); } GnuBoat.Webserver.private = { map: null, mapSetup: function () { GnuBoat.Webserver.private.map = L.map('mapViewport').setView([48.43, 10.04], 17); var layer_openstreetmap = L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap, OpenSeaMap, GNUBoat contributors'} ).addTo(GnuBoat.Webserver.private.map); var layer_openseamap = L.tileLayer( 'http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {attribute: '© OpenSeaMap contributors'} ).addTo(GnuBoat.Webserver.private.map); // add GNUBoat layers var layer_gnuboat_accuracy_low = L.tileLayer( './tiles/gnuboat_10_100/{z}/{x}/{y}.png', {tms: true, opacity: 0.5, zIndex: 98, attribute: '© GNUBoat contributors'} ); var layer_gnuboat_accuracy_high = L.tileLayer( './tiles/gnuboat_100_100/{z}/{x}/{y}.png', {tms: true, opacity: 0.5, zIndex: 98, attribute: '© GNUBoat contributors'} ).addTo(GnuBoat.Webserver.private.map); // add layer control var baselayers = { "Map": layer_openstreetmap, }; // overlays var overlays = {"Seamarks": layer_openseamap, "GNUBoat Low Accuracy": layer_gnuboat_accuracy_low, "GNUBoat High Accuracy": layer_gnuboat_accuracy_high, }; GnuBoat.Webserver.private.mapControl = L.control.layers( baselayers, overlays, {hideSingleBase: true, sortLayers: true, } ).addTo(GnuBoat.Webserver.private.map); // add scale L.control.scale().addTo(GnuBoat.Webserver.private.map); } }