mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
Friendly text on latitude cell info (#1125)
* Friendly text on latitude cell info - Added function getLatitudeDescription(latitude) - Added the text to infoLat on cell info. * refactored, renamed to getGeozone * v1.103 on commonUtils.js
This commit is contained in:
parent
473b62b3eb
commit
168203f7da
3 changed files with 20 additions and 5 deletions
|
|
@ -259,10 +259,11 @@ function updateCellInfo(point, i, g) {
|
|||
const f = cells.f[i];
|
||||
infoLat.innerHTML = toDMS(getLatitude(y, 4), "lat");
|
||||
infoLon.innerHTML = toDMS(getLongitude(x, 4), "lon");
|
||||
infoGeozone.innerHTML = getGeozone(getLatitude(y, 4));
|
||||
|
||||
infoCell.innerHTML = i;
|
||||
infoArea.innerHTML = cells.area[i] ? si(getArea(cells.area[i])) + " " + getAreaUnit() : "n/a";
|
||||
infoEvelation.innerHTML = getElevation(pack.features[f], pack.cells.h[i]);
|
||||
infoElevation.innerHTML = getElevation(pack.features[f], pack.cells.h[i]);
|
||||
infoDepth.innerHTML = getDepth(pack.features[f], point);
|
||||
infoTemp.innerHTML = convertTemperature(grid.cells.temp[g]);
|
||||
infoPrec.innerHTML = cells.h[i] >= 20 ? getFriendlyPrecipitation(i) : "n/a";
|
||||
|
|
@ -286,6 +287,19 @@ function updateCellInfo(point, i, g) {
|
|||
infoBiome.innerHTML = biomesData.name[cells.biome[i]];
|
||||
}
|
||||
|
||||
function getGeozone(latitude) {
|
||||
|
||||
if (latitude > 66.5) return "Arctic";
|
||||
if (latitude > 35) return "Temperate North";
|
||||
if (latitude > 23.5) return "Subtropical North";
|
||||
if (latitude > 1) return "Tropical North";
|
||||
if (latitude > -1) return "Equatorial";
|
||||
if (latitude > -23.5) return "Tropical South";
|
||||
if (latitude > -35) return "Subtropical South";
|
||||
if (latitude > -66.5) return "Temperate South";
|
||||
return "Antarctic";
|
||||
}
|
||||
|
||||
// convert coordinate to DMS format
|
||||
function toDMS(coord, c) {
|
||||
const degrees = Math.floor(Math.abs(coord));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue