htdocs: Add basic support for the wet stuff
This commit is contained in:
parent
76570e5369
commit
b5fd6aab1f
@ -13,13 +13,14 @@ var streetLabelsRenderer = new L.StreetLabels({
|
|||||||
collisionFlg: true,
|
collisionFlg: true,
|
||||||
propertyName: 'name',
|
propertyName: 'name',
|
||||||
showLabelIf: function (layer) {
|
showLabelIf: function (layer) {
|
||||||
switch (layer.geometry.type) {
|
switch (layer.feature.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:
|
||||||
@ -48,38 +49,44 @@ streetLabelsRenderer._getCollisionFlag = function (layer) {
|
|||||||
streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
streetLabelsRenderer._getDynamicFontSize = function (layer) {
|
||||||
zoom = mymap.getZoom();
|
zoom = mymap.getZoom();
|
||||||
|
|
||||||
switch (layer.geometry.type) {
|
switch (layer.myName) {
|
||||||
case "LineString":
|
case "Oceans":
|
||||||
if (zoom <= 8)
|
return size *= 2.0/3;;
|
||||||
return 11;
|
|
||||||
else
|
|
||||||
return 2**(zoom - 9) * 11;
|
|
||||||
break;
|
break;
|
||||||
case "Polygon":
|
default:
|
||||||
var size;
|
switch (layer.feature.geometry.type) {
|
||||||
if (zoom >= 4)
|
case "LineString":
|
||||||
size = 30;
|
if (zoom <= 8)
|
||||||
else
|
return 11;
|
||||||
size = 20;
|
else
|
||||||
switch (layer.properties.type) {
|
return 2**(zoom - 9) * 11;
|
||||||
case "city":
|
|
||||||
break;
|
|
||||||
case "town":
|
|
||||||
size *= 2.0/3.0;
|
|
||||||
break;
|
|
||||||
case "village":
|
|
||||||
size *= 1.5/3;
|
|
||||||
break;
|
|
||||||
case "district":
|
|
||||||
size *= 2.0/3;
|
|
||||||
break;
|
break;
|
||||||
|
case "Polygon":
|
||||||
|
var size;
|
||||||
|
if (zoom >= 4)
|
||||||
|
size = 30;
|
||||||
|
else
|
||||||
|
size = 20;
|
||||||
|
switch (layer.feature.properties.type) {
|
||||||
|
case "city":
|
||||||
|
break;
|
||||||
|
case "town":
|
||||||
|
size *= 2.0/3.0;
|
||||||
|
break;
|
||||||
|
case "village":
|
||||||
|
size *= 1.5/3;
|
||||||
|
break;
|
||||||
|
case "district":
|
||||||
|
size *= 2.0/3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
size *= 0.5/3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return size;
|
||||||
default:
|
default:
|
||||||
size *= 0.5/3;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return size;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
@ -103,6 +110,10 @@ 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",
|
||||||
@ -236,6 +247,7 @@ 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, {
|
||||||
@ -348,6 +360,8 @@ 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();
|
||||||
|
Loading…
Reference in New Issue
Block a user