mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-23 20:41:23 +01:00
submapper gui updates, remove feature mapping on/off
This commit is contained in:
parent
5db436d627
commit
3827f878e7
4 changed files with 61 additions and 63 deletions
65
index.html
65
index.html
|
|
@ -1368,8 +1368,9 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>Click to create a new map:</p>
|
<p>Click to create a new map:</p>
|
||||||
<div id="reSample">
|
<div id="resamplers">
|
||||||
<button id="openSubmapOptions" data-tip="Click to generate new (sub)map from the current viewport" onclick="openSubmapOptions()">Submap</button>
|
<button data-tip="Click to generate new (sub)map from the current viewport" onclick="openSubmapOptions()">Submap</button>
|
||||||
|
<button data-tip="Click to resample (transform) your map to different cellcount" onclick="openRemapOptions()">Resample</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -3666,36 +3667,18 @@
|
||||||
|
|
||||||
<div id="submapOptionsDialog" style="display: none; max-width:300px;" class="dialog">
|
<div id="submapOptionsDialog" style="display: none; max-width:300px;" class="dialog">
|
||||||
<p style="font-style: italic; color: red; font-weight:bold;">Warning! This operation is destructive and irreversible. Don't forget to save your original map!</p>
|
<p style="font-style: italic; color: red; font-weight:bold;">Warning! This operation is destructive and irreversible. Don't forget to save your original map!</p>
|
||||||
<p>Population rate (Units editor -> population) and map pixel size will
|
<p>
|
||||||
be automatically updated according to the current scale factor. If you'd like
|
<em>Settings to be changed:</em> Population rate, map pixel size.
|
||||||
to generate a new parent-map, <b>don't forget to reset them!</b> Options are interpreted as usual.</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<em>Data to be copied:</em> Heightmap, Biome, Religion, Population, Precipitation, Cultures, States, Provinces, Regiments (military).
|
<em>Data to be copied:</em> Heightmap, Biome, Religion, Population, Precipitation, Cultures, States, Provinces, Regiments (military), Markers.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<em>Data to be destroyed (regenerated):</em> Markers, Zones, Rivers (mostly regenerate at the same place).
|
<em>Data to be destroyed (regenerated):</em> Zones, Roads, Rivers (mostly regenerate at the same place).
|
||||||
Remapping Burgs (cities) is not 100% guaranteed, you may need to fix missing or wrongly mapped burgs manually.
|
</p>
|
||||||
</p>
|
<p>
|
||||||
<hr />
|
Remapping Burgs (cities) may be imprecise, you will need to fix missing or wrongly mapped burgs manually.
|
||||||
<p>Remap (copy) the following features to the new map:</p>
|
</p>
|
||||||
<div data-tip="Copy burgs from old map. Regenerate burgs if not checked." >
|
|
||||||
<input id="submapCopyBurgs" class="checkbox" type="checkbox" checked>
|
|
||||||
<label for="submapCopyBurgs" class="checkbox-label">Burgs (cities)</label>
|
|
||||||
</div>
|
|
||||||
<div data-tip="Copy Rivers from the original map, regenerate otherwise (see errode riverbeds)." >
|
|
||||||
<input id="submapCopyRivers" class="checkbox" type="checkbox">
|
|
||||||
<label for="submapCopyRivers" class="checkbox-label">Rivers</label>
|
|
||||||
</div>
|
|
||||||
<div data-tip="Copy Zones from the original map. Regenerate Zones if not checked." class="disabled">
|
|
||||||
<input id="submapCopyZones" class="checkbox" type="checkbox" disabled>
|
|
||||||
<label for="submapCopyZones" class="checkbox-label">Zones</label>
|
|
||||||
</div>
|
|
||||||
<div data-tip="Copy road network of the original map. Regenerate if not checked." class="disabled">
|
|
||||||
<input id="submapCopyRoads" class="checkbox" type="checkbox" disabled>
|
|
||||||
<label for="submapCopyRoads" class="checkbox-label">Roads</label>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<p>Lock remapped items for:</p>
|
<p>Lock remapped items for:</p>
|
||||||
<div data-tip="Lock all markers copied from the original map." >
|
<div data-tip="Lock all markers copied from the original map." >
|
||||||
<input id="submapLockMarkers" class="checkbox" type="checkbox" checked>
|
<input id="submapLockMarkers" class="checkbox" type="checkbox" checked>
|
||||||
|
|
@ -3711,18 +3694,30 @@
|
||||||
<input id="submapDepressRivers" class="checkbox" type="checkbox">
|
<input id="submapDepressRivers" class="checkbox" type="checkbox">
|
||||||
<label for="submapDepressRivers" class="checkbox-label">Errode riverbeds.</label>
|
<label for="submapDepressRivers" class="checkbox-label">Errode riverbeds.</label>
|
||||||
</div>
|
</div>
|
||||||
<div data-tip="All small cities of the parent map will be promoted to Capitals." >
|
<div data-tip="All small cities of the parent map will be promoted to Capitals" >
|
||||||
<input id="submapPromoteTown" class="checkbox" type="checkbox">
|
<input id="submapPromoteTown" class="checkbox" type="checkbox">
|
||||||
<label for="submapPromoteTown" class="checkbox-label">Promote towns to cities.</label>
|
<label for="submapPromoteTown" class="checkbox-label">Promote towns to cities</label>
|
||||||
</div>
|
</div>
|
||||||
<div data-tip="Add lakes in depressions. (Can be very slow on big landmasses!)" >
|
<div data-tip="Add lakes in depressions. (Can be very slow on big landmasses!)" >
|
||||||
<input id="submapAddLakeInDepression" class="checkbox" type="checkbox">
|
<input id="submapAddLakeInDepression" class="checkbox" type="checkbox">
|
||||||
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions.</label>
|
<label for="submapAddLakeInDepression" class="checkbox-label">Add lakes in depressions (slow)</label>
|
||||||
</div>
|
</div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<button id="start" data-tip="Start submap resampling" class="options" onclick="generateSubmap()">Generate</button>
|
<button id="start" data-tip="Start submap resampling" class="options" onclick="generateSubmap()">Generate</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="remapOptionsDialog" style="display: none; max-width:300px;" class="dialog">
|
||||||
|
WIP (not working yet)
|
||||||
|
<table>
|
||||||
|
<td>Points number</td>
|
||||||
|
<td>
|
||||||
|
<input id="submapPointsInput" type="range" min=1 max=13 value=4 data-cells=10000 oninput="event => {document.getElementById('submapPointsOutput').value=cellsDensityConstants[+this.value]/1000 + 'K'; event.stopPropagation()}">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<output id="submapPointsOutput" style="color: #053305">10K</output>
|
||||||
|
</td>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
<div id="alert" style="display: none" class="dialog">
|
<div id="alert" style="display: none" class="dialog">
|
||||||
<p id="alertMessage">Warning!</p>
|
<p id="alertMessage">Warning!</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ window.Submap = (function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
stage("Porting and locking burgs.");
|
stage("Porting and locking burgs.");
|
||||||
if (options.copyBurgs) copyBurgs(parentMap, projection, options);
|
copyBurgs(parentMap, projection, options);
|
||||||
|
|
||||||
// transfer states, mark states without land as removed.
|
// transfer states, mark states without land as removed.
|
||||||
stage("Porting states.");
|
stage("Porting states.");
|
||||||
|
|
@ -242,7 +242,7 @@ window.Submap = (function () {
|
||||||
s.neighbors = s.neighbors.filter(n => validStates.has(n));
|
s.neighbors = s.neighbors.filter(n => validStates.has(n));
|
||||||
|
|
||||||
// find center
|
// find center
|
||||||
s.center = (options.copyBurgs && pack.burgs[s.capital].cell)
|
s.center = pack.burgs[s.capital].cell
|
||||||
? pack.burgs[s.capital].cell // capital is the best bet
|
? pack.burgs[s.capital].cell // capital is the best bet
|
||||||
: pack.cells.state.findIndex(x => x===i); // otherwise use the first valid cell
|
: pack.cells.state.findIndex(x => x===i); // otherwise use the first valid cell
|
||||||
});
|
});
|
||||||
|
|
@ -264,12 +264,10 @@ window.Submap = (function () {
|
||||||
: pack.cells.province.findIndex(x => x===i);
|
: pack.cells.province.findIndex(x => x===i);
|
||||||
});
|
});
|
||||||
|
|
||||||
// regenerate (if not copied) and display burgs
|
|
||||||
if (!options.copyBurgs) BurgsAndStates.regenerateBurgs();
|
|
||||||
BurgsAndStates.drawBurgs();
|
BurgsAndStates.drawBurgs();
|
||||||
|
|
||||||
stage("Regenerating road network.");
|
stage("Regenerating road network.");
|
||||||
if (!options.copyRoads) Routes.regenerate();
|
Routes.regenerate();
|
||||||
|
|
||||||
drawStates();
|
drawStates();
|
||||||
drawBorders();
|
drawBorders();
|
||||||
|
|
@ -306,7 +304,7 @@ window.Submap = (function () {
|
||||||
drawMarkers();
|
drawMarkers();
|
||||||
|
|
||||||
stage("Regenerating Zones.");
|
stage("Regenerating Zones.");
|
||||||
if (!options.copyZones) addZones();
|
addZones();
|
||||||
Names.getMapName();
|
Names.getMapName();
|
||||||
stage("Submap done.");
|
stage("Submap done.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -335,24 +335,24 @@ function copyMapURL() {
|
||||||
.catch(err => tip("Could not copy URL: " + err, false, "error", 5000));
|
.catch(err => tip("Could not copy URL: " + err, false, "error", 5000));
|
||||||
}
|
}
|
||||||
|
|
||||||
function changeCellsDensity(value) {
|
const cellsDensityConstants = {
|
||||||
const convert = v => {
|
1: 1000,
|
||||||
if (v == 1) return 1000;
|
2: 2000,
|
||||||
if (v == 2) return 2000;
|
3: 5000,
|
||||||
if (v == 3) return 5000;
|
4: 10000,
|
||||||
if (v == 4) return 10000;
|
5: 20000,
|
||||||
if (v == 5) return 20000;
|
6: 30000,
|
||||||
if (v == 6) return 30000;
|
7: 40000,
|
||||||
if (v == 7) return 40000;
|
8: 50000,
|
||||||
if (v == 8) return 50000;
|
9: 60000,
|
||||||
if (v == 9) return 60000;
|
10: 70000,
|
||||||
if (v == 10) return 70000;
|
11: 80000,
|
||||||
if (v == 11) return 80000;
|
12: 90000,
|
||||||
if (v == 12) return 90000;
|
13: 100000,
|
||||||
if (v == 13) return 100000;
|
};
|
||||||
};
|
|
||||||
const cells = convert(value);
|
|
||||||
|
|
||||||
|
function changeCellsDensity(value) {
|
||||||
|
const cells = value in cellsDensityConstants? cellsDensityConstants[value]: 1000;
|
||||||
pointsInput.setAttribute("data-cells", cells);
|
pointsInput.setAttribute("data-cells", cells);
|
||||||
pointsOutput_formatted.value = cells / 1000 + "K";
|
pointsOutput_formatted.value = cells / 1000 + "K";
|
||||||
pointsOutput_formatted.style.color = cells > 50000 ? "#b12117" : cells !== 10000 ? "#dfdf12" : "#053305";
|
pointsOutput_formatted.style.color = cells > 50000 ? "#b12117" : cells !== 10000 ? "#dfdf12" : "#053305";
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,15 @@ function openSubmapOptions() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openRemapOptions() {
|
||||||
|
$("#remapOptionsDialog").dialog({
|
||||||
|
title: "Resampler options",
|
||||||
|
resizable: false,
|
||||||
|
width: fitContent(),
|
||||||
|
position: {my: "right top", at: "right-10 top+10", of: "svg", collision: "fit"}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const generateSubmap = debounce(async function () {
|
const generateSubmap = debounce(async function () {
|
||||||
// Create submap from the current map
|
// Create submap from the current map
|
||||||
// submap limits defined by the current window size (canvas viewport)
|
// submap limits defined by the current window size (canvas viewport)
|
||||||
|
|
@ -21,11 +30,6 @@ const generateSubmap = debounce(async function () {
|
||||||
closeDialogs("#worldConfigurator, #options3d");
|
closeDialogs("#worldConfigurator, #options3d");
|
||||||
const checked = id => Boolean(document.getElementById(id).checked)
|
const checked = id => Boolean(document.getElementById(id).checked)
|
||||||
const options = {
|
const options = {
|
||||||
copyBurgs: checked("submapCopyBurgs"),
|
|
||||||
copyZones: checked("submapCopyZones"),
|
|
||||||
copyRivers: checked("submapCopyRivers"),
|
|
||||||
copyRoads: checked("submapCopyRoads"),
|
|
||||||
|
|
||||||
lockMarkers: checked("submapLockMarkers"),
|
lockMarkers: checked("submapLockMarkers"),
|
||||||
lockBurgs: checked("submapLockBurgs"),
|
lockBurgs: checked("submapLockBurgs"),
|
||||||
|
|
||||||
|
|
@ -77,6 +81,7 @@ const generateSubmap = debounce(async function () {
|
||||||
oldstate = null; // destroy old state to free memory
|
oldstate = null; // destroy old state to free memory
|
||||||
|
|
||||||
restoreLayers();
|
restoreLayers();
|
||||||
|
turnButtonOn('toggleMarkers');
|
||||||
if (ThreeD.options.isOn) ThreeD.redraw();
|
if (ThreeD.options.isOn) ThreeD.redraw();
|
||||||
if ($("#worldConfigurator").is(":visible")) editWorld();
|
if ($("#worldConfigurator").is(":visible")) editWorld();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue