v 0.8.05b

This commit is contained in:
Azgaar 2019-04-25 21:47:08 +03:00
parent 9aa369b6df
commit 6cb21bbead
6 changed files with 66 additions and 44 deletions

View file

@ -629,10 +629,19 @@
</tbody>
<tbody id="styleCoastline">
<tr data-tip="">
<tr data-tip="Allow system to apply filter automatically based on zoom level">
<td colspan=2>
<input id="styleCoastlineAuto" class="checkbox" type="checkbox" checked onchange="$('#styleFilter').toggle();">
<label for="styleCoastlineAuto" data-tip="Allow system to apply filter automatically based on zoom level" class="checkbox-label">Automatically change filter on zoom</label>
<label for="styleCoastlineAuto" class="checkbox-label">Automatically change filter on zoom</label>
</td>
</tr>
</tbody>
<tbody id="styleMarkers">
<tr data-tip="Rescale Markers on zoom change">
<td colspan=2>
<input id="styleRescaleMarkers" class="checkbox" type="checkbox" checked onchange="invokeActiveZooming()">
<label for="styleRescaleMarkers" class="checkbox-label">Rescale on zoom change</label>
</td>
</tr>
</tbody>

View file

@ -272,6 +272,7 @@ function applyDefaultStyle() {
icons.selectAll("g").attr("opacity", null).attr("fill", "#ffffff").attr("stroke", "#3e3e4b").attr("filter", null).attr("mask", null);
landmass.attr("opacity", 1).attr("fill", "#eef6fb").attr("filter", null);
markers.attr("opacity", null).attr("filter", "url(#dropShadow01)");
styleRescaleMarkers.checked = true;
prec.attr("opacity", null).attr("stroke", "#000000").attr("stroke-width", .1).attr("fill", "#003dff").attr("filter", null);
population.attr("opacity", null).attr("stroke-width", 1.6).attr("stroke-dasharray", null).attr("stroke-linecap", "butt").attr("filter", null);
population.select("#rural").attr("stroke", "#0000ff");
@ -331,6 +332,7 @@ function applyDefaultStyle() {
const stateLabelSize = Math.max(rn(24 - regionsInput.value / 6), 6);
labels.select("#states").attr("fill", "#3e3e4b").attr("opacity", 1).attr("stroke", "#3a3a3a").attr("stroke-width", 0).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", stateLabelSize).attr("data-size", stateLabelSize).attr("filter", null);
labels.select("#addedLabels").attr("fill", "#3e3e4b").attr("opacity", 1).attr("stroke", "#3a3a3a").attr("stroke-width", 0).attr("font-family", "Almendra SC").attr("data-font", "Almendra+SC").attr("font-size", 18).attr("data-size", 18).attr("filter", null);
invokeActiveZooming();
}
// focus on coordinates, cell or burg provided in searchParams
@ -480,7 +482,7 @@ function invokeActiveZooming() {
}
// rescale map markers
if (markers.style("display") !== "none") {
if (styleRescaleMarkers.checked && markers.style("display") !== "none") {
markers.selectAll("use").each(function(d) {
const x = +this.dataset.x, y = +this.dataset.y, desired = +this.dataset.size;
const size = Math.max(desired * 5 + 25 / scale, 1);

View file

@ -38,7 +38,7 @@
}
}
pack.cultures = d3.shuffle(getDefault()).slice(0, count);
pack.cultures = getRandomCultures(count);
const centers = d3.quadtree();
const colors = getColors(count);
@ -60,6 +60,17 @@
const invalidBase = pack.cultures.some(c => !nameBase[c.base]);
if (invalidBase) applyDefaultNamesData();
function getRandomCultures(c) {
const d = getDefault();
const cultures = [];
while (cultures.length < c) {
let culture = d[0];
do {culture = d[rand(d.length-1)];} while (Math.random() > culture.odd || cultures.find(c => c.name === culture.name))
cultures.push(culture);
}
return cultures;
}
// culture center tends to be placed in a density populated cell
function placeCultureCenter() {
let center, spacing = (graphWidth + graphHeight) / count;
@ -99,36 +110,38 @@
const getDefault = function() {
return [
{name:"Shwazen", base:0},
{name:"Angshire", base:1},
{name:"Luari", base:2},
{name:"Tallian", base:3},
{name:"Astellian", base:4},
{name:"Slovan", base:5},
{name:"Norse", base:6},
{name:"Elladan", base:7},
{name:"Romian", base:8},
{name:"Soumi", base:9},
{name:"Koryo", base:10},
{name:"Hantzu", base:11},
{name:"Yamoto", base:12},
{name:"Portuzian", base:13},
{name:"Nawatli", base:14},
{name:"Vengrian", base: 15},
{name:"Turchian", base: 16},
{name:"Berberan", base: 17},
{name:"Eurabic", base: 18},
{name:"Inuk", base: 19},
{name:"Euskati", base: 20},
{name:"Negarian", base: 21},
{name:"Keltan", base: 22},
{name:"Efratic", base: 23},
{name:"Tehrani", base: 24},
{name:"Maui", base: 25},
{name:"Carnatic", base: 26},
{name:"Inqan", base: 27},
{name:"Kiswaili", base: 28},
{name:"Vietic", base: 29}
{name:"Shwazen", base:0, odd: .7},
{name:"Angshire", base:1, odd: 1},
{name:"Luari", base:2, odd: .6},
{name:"Tallian", base:3, odd: .6},
{name:"Astellian", base:4, odd: .6},
{name:"Slovan", base:5, odd: .7},
{name:"Norse", base:6, odd: .7},
{name:"Elladan", base:7, odd: .7},
{name:"Romian", base:8, odd: .7},
{name:"Soumi", base:9, odd: .4},
{name:"Koryo", base:10, odd: .5},
{name:"Hantzu", base:11, odd: .5},
{name:"Yamoto", base:12, odd: .5},
{name:"Portuzian", base:13, odd: .4},
{name:"Nawatli", base:14, odd: .2},
{name:"Vengrian", base: 15, odd: .2},
{name:"Turchian", base: 16, odd: .2},
{name:"Berberan", base: 17, odd: .2},
{name:"Eurabic", base: 18, odd: .2},
{name:"Inuk", base: 19, odd: .1},
{name:"Euskati", base: 20, odd: .1},
{name:"Negarian", base: 21, odd: .05},
{name:"Keltan", base: 22, odd: .1},
{name:"Efratic", base: 23, odd: .1},
{name:"Tehrani", base: 24, odd: .1},
{name:"Maui", base: 25, odd: .05},
{name:"Carnatic", base: 26, odd: .1},
{name:"Inqan", base: 27, odd: .1},
{name:"Kiswaili", base: 28, odd: .1},
{name:"Vietic", base: 29, odd: .1}//,
//{name:"Guantzu", base:30, odd: 1},
//{name:"Ulus", base:31, odd: .1}
];
}

View file

@ -337,9 +337,6 @@ function togglePopulation() {
function drawPopulation() {
population.selectAll("line").remove();
const cells = pack.cells, p = cells.p, burgs = pack.burgs;
// pack.cells.pop.reduce((s=0,v) => s+v)
// pack.burgs.map(b => b.population).reduce((s=0,v) => s+v)
const show = d3.transition().duration(2000).ease(d3.easeSinIn);
const rural = Array.from(cells.i.filter(i => cells.pop[i] > 0), i => [p[i][0], p[i][1], p[i][1] - cells.pop[i] / 8]);
@ -348,7 +345,7 @@ function drawPopulation() {
.attr("x2", d => d[0]).attr("y2", d => d[1])
.transition(show).attr("y2", d => d[2]);
const urban = burgs.filter(b => b.i).map(b => [b.x, b.y, b.y - b.population / 8 * urbanization.value]);
const urban = burgs.filter(b => b.i && !b.removed).map(b => [b.x, b.y, b.y - b.population / 8 * urbanization.value]);
population.select("#urban").selectAll("line").data(urban).enter().append("line")
.attr("x1", d => d[0]).attr("y1", d => d[1])
.attr("x2", d => d[0]).attr("y2", d => d[1])

View file

@ -167,7 +167,8 @@ function selectStyleElement() {
if (sel === "gridOverlay") styleGrid.style.display = "block";
if (sel === "terrain") styleRelief.style.display = "block";
if (sel === "texture") styleTexture.style.display = "block";
if (sel === "routes" || sel === "labels" || sel == "anchors" || sel == "burgIcons" || sel === "lakes") {styleGroup.style.display = "block";}
if (sel === "routes" || sel === "labels" || sel == "anchors" || sel == "burgIcons" || sel === "lakes") styleGroup.style.display = "block";
if (sel === "markers") styleMarkers.style.display = "block";
if (sel === "population") {
stylePopulation.style.display = "block";