Compare commits
No commits in common. "b2f543f49bbef659bf62293d12f0720227dcb53f" and "76570e5369a54e80bceb0868974da9456d6f725e" have entirely different histories.
b2f543f49b
...
76570e5369
@ -13,14 +13,13 @@ var streetLabelsRenderer = new L.StreetLabels({
|
|||||||
collisionFlg: true,
|
collisionFlg: true,
|
||||||
propertyName: 'name',
|
propertyName: 'name',
|
||||||
showLabelIf: function (layer) {
|
showLabelIf: function (layer) {
|
||||||
switch (layer.feature.geometry.type) {
|
switch (layer.geometry.type) {
|
||||||
case "LineString":
|
case "LineString":
|
||||||
if (mymap.getZoom() <= polyconf_show_street_names)
|
if (mymap.getZoom() <= polyconf_show_street_names)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
case "Polygon":
|
case "Polygon":
|
||||||
if ((mymap.getZoom() > polyconf_show_street_names) &&
|
if (mymap.getZoom() > polyconf_show_street_names)
|
||||||
(layer.myName != "Oceans"))
|
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -35,7 +34,7 @@ var streetLabelsRenderer = new L.StreetLabels({
|
|||||||
fontSizeUnit: "px",
|
fontSizeUnit: "px",
|
||||||
lineWidth: 3.0,
|
lineWidth: 3.0,
|
||||||
fillStyle: "black",
|
fillStyle: "black",
|
||||||
strokeStyle: "white"
|
strokeStyle: "white",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -49,12 +48,7 @@ streetLabelsRenderer._getCollisionFlag = function (layer) {
|
|||||||
streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
||||||
zoom = mymap.getZoom();
|
zoom = mymap.getZoom();
|
||||||
|
|
||||||
switch (layer.myName) {
|
switch (layer.geometry.type) {
|
||||||
case "Oceans":
|
|
||||||
return size *= 2.0/3;;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
switch (layer.feature.geometry.type) {
|
|
||||||
case "LineString":
|
case "LineString":
|
||||||
if (zoom <= 8)
|
if (zoom <= 8)
|
||||||
return 11;
|
return 11;
|
||||||
@ -67,7 +61,7 @@ streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
|||||||
size = 30;
|
size = 30;
|
||||||
else
|
else
|
||||||
size = 20;
|
size = 20;
|
||||||
switch (layer.feature.properties.type) {
|
switch (layer.properties.type) {
|
||||||
case "city":
|
case "city":
|
||||||
break;
|
break;
|
||||||
case "town":
|
case "town":
|
||||||
@ -87,7 +81,6 @@ streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,10 +103,6 @@ var style_tech = {
|
|||||||
color: "red"
|
color: "red"
|
||||||
};
|
};
|
||||||
|
|
||||||
var style_rivers = {
|
|
||||||
color: "blue"
|
|
||||||
};
|
|
||||||
|
|
||||||
var style_route = {
|
var style_route = {
|
||||||
radius: 8,
|
radius: 8,
|
||||||
fillColor: "#00ff00",
|
fillColor: "#00ff00",
|
||||||
@ -195,7 +184,7 @@ function load_tiles(name, id) {
|
|||||||
if (name != "") {
|
if (name != "") {
|
||||||
url = tiles_base + '{id}/{z}/{y}/{x}.png';
|
url = tiles_base + '{id}/{z}/{y}/{x}.png';
|
||||||
}
|
}
|
||||||
var satellite = new L.TileLayer(url, {
|
var satellite = L.tileLayer(url, {
|
||||||
maxZoom: 14 /*8*/,
|
maxZoom: 14 /*8*/,
|
||||||
maxNativeZoom: 6,
|
maxNativeZoom: 6,
|
||||||
minNativeZoom: 0,
|
minNativeZoom: 0,
|
||||||
@ -214,7 +203,6 @@ function load_tiles(name, id) {
|
|||||||
|
|
||||||
var current_location = "";
|
var current_location = "";
|
||||||
var current_feature = null;
|
var current_feature = null;
|
||||||
var current_layer = null;
|
|
||||||
function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
||||||
var xhttp_ps = new XMLHttpRequest();
|
var xhttp_ps = new XMLHttpRequest();
|
||||||
xhttp_ps.onreadystatechange = function() {
|
xhttp_ps.onreadystatechange = function() {
|
||||||
@ -233,7 +221,6 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
|||||||
if (geotype == "train")
|
if (geotype == "train")
|
||||||
layer.no_search = true
|
layer.no_search = true
|
||||||
layer.on("click", function (e) {
|
layer.on("click", function (e) {
|
||||||
current_layer = layer;
|
|
||||||
current_feature = feature;
|
current_feature = feature;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -249,7 +236,6 @@ function load_geojson(name, url, geotype, iconcolor, active=1, style={}) {
|
|||||||
break;
|
break;
|
||||||
default: /* else it is a marker with the specified icon */
|
default: /* else it is a marker with the specified icon */
|
||||||
onEachFeature = function(feature, layer) {
|
onEachFeature = function(feature, layer) {
|
||||||
layer.myName = name;
|
|
||||||
label = String(feature.properties.name)
|
label = String(feature.properties.name)
|
||||||
layer.bindPopup('<h1><a target="_blank" href="' + wikiurl_base + feature.properties.name + '">' + feature.properties.name + '</a> (' + feature.geometry.coordinates + ')</h1>' + '<p><img style="width:100%" src="' + feature.properties.image + '"></p>' + '<p>' + feature.properties.description + '</p>');
|
layer.bindPopup('<h1><a target="_blank" href="' + wikiurl_base + feature.properties.name + '">' + feature.properties.name + '</a> (' + feature.geometry.coordinates + ')</h1>' + '<p><img style="width:100%" src="' + feature.properties.image + '"></p>' + '<p>' + feature.properties.description + '</p>');
|
||||||
layer.bindTooltip(label, {
|
layer.bindTooltip(label, {
|
||||||
@ -362,8 +348,6 @@ load_geojson("Trainlines (beta)", "./geojson/trainlines.json", "train", "auto",
|
|||||||
load_geojson("TL Access (tech layer)", "./geojson/trainlines_access.json", "train", "auto", 0, style_tech);
|
load_geojson("TL Access (tech layer)", "./geojson/trainlines_access.json", "train", "auto", 0, style_tech);
|
||||||
load_geojson("Railroad Tracks", "./geojson/trains.json", "train", "auto", 0, style_trains);
|
load_geojson("Railroad Tracks", "./geojson/trains.json", "train", "auto", 0, style_trains);
|
||||||
load_geojson("Cities", "./geojson/city_outlines.json", "outline", "auto", 1, style_outlines);
|
load_geojson("Cities", "./geojson/city_outlines.json", "outline", "auto", 1, style_outlines);
|
||||||
load_geojson("Rivers", "./geojson/rivers.json", "street", "auto", 1, style_rivers);
|
|
||||||
load_geojson("Oceans", "./geojson/oceans.json", "outline", "auto", 1, style_rivers);
|
|
||||||
|
|
||||||
function update_geojson() {
|
function update_geojson() {
|
||||||
var xhttp_ps = new XMLHttpRequest();
|
var xhttp_ps = new XMLHttpRequest();
|
||||||
@ -686,29 +670,19 @@ var baseballIcon = L.AwesomeMarkers.icon({
|
|||||||
markerColor: 'red'
|
markerColor: 'red'
|
||||||
});
|
});
|
||||||
|
|
||||||
function escapeHtml(text) {
|
|
||||||
return text
|
|
||||||
.replace(/&/g, "&")
|
|
||||||
.replace(/</g, "<")
|
|
||||||
.replace(/>/g, ">")
|
|
||||||
.replace(/"/g, """)
|
|
||||||
.replace(/'/g, "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
function onMapClick(e) {
|
function onMapClick(e) {
|
||||||
var addinfo = "";
|
var addinfo = "";
|
||||||
pos = resolve_latlng(e.latlng);
|
pos = resolve_latlng(e.latlng);
|
||||||
route_links = '<br><a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_start(latLng2); return false;">[route from here]</a>';
|
route_links = '<br><a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_start(latLng2); return false;">[route from here]</a>';
|
||||||
route_links += ' <a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_destination(latLng2); return false;">[route to here]</a>';
|
route_links += ' <a href="#" onclick="latLng2 = L.latLng(' + pos.lng + ',' + pos.lat + '); set_route_destination(latLng2); return false;">[route to here]</a>';
|
||||||
if (current_location != "")
|
if (current_location != "")
|
||||||
addinfo = " (part of <a target=\"_blank\" href=\"" + wikiurl_base + encodeURIComponent(current_location) + "\">" + escapeHtml(current_location) + "</a>)";
|
addinfo = " (part of <a target=\"_blank\" href='" + wikiurl_base + current_location + "'>" + current_location + "</a>)";
|
||||||
if (current_feature) {
|
if (current_feature) {
|
||||||
popup.setLatLng(e.latlng).setContent("This is <a target=\"_blank\" href=\"" + wikiurl_base + current_layer.myName + ":" + encodeURIComponent(current_feature.properties.name) + "\">" + escapeHtml(current_feature.properties.name) + "</a>" + addinfo + route_links).openOn(mymap);
|
popup.setLatLng(e.latlng).setContent("This is " + current_feature.properties.name + addinfo + route_links).openOn(mymap);
|
||||||
} else {
|
} else {
|
||||||
popup.setLatLng(e.latlng).setContent("You clicked the map at " + pos.lng + "," + pos.lat + addinfo + route_links).openOn(mymap);
|
popup.setLatLng(e.latlng).setContent("You clicked the map at " + pos.lng + "," + pos.lat + addinfo + route_links).openOn(mymap);
|
||||||
}
|
}
|
||||||
current_feature = null;
|
current_feature = null;
|
||||||
current_layer = null;
|
|
||||||
current_location = "";
|
current_location = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user