Skip to content

Commit

Permalink
Ultramafisk berggrunn - magler i kartet #1667 (#1668)
Browse files Browse the repository at this point in the history
* Ultramafisk berggrunn - fra punkter til polygon, en mulig forbedring?

Relatert til #1667

* Fix   Line 113:15:  'farge' is assigned a value but never used  no-unused-vars
  • Loading branch information
bjornreppen authored Feb 13, 2020
1 parent 6924319 commit 576ed43
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 42 deletions.
5 changes: 3 additions & 2 deletions src/Funksjoner/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ class config {
static hack(kode) {
// TODO: Erstatt denne med kode.split("-").pop()
if (
kode.indexOf("AO") === 0 ||
kode.indexOf("AO-TO-FL") === 0 ||
kode.indexOf("VV") === 0 ||
kode.indexOf("NN-NA-BS-3EL") === 0
kode.indexOf("NN-NA-BS-3EL") === 0 ||
kode.indexOf("NN-NA-LKM-BK") === 0
)
return kode.split("-").pop();
if (kode.indexOf("NN-") !== 0) return kode;
Expand Down
125 changes: 85 additions & 40 deletions src/Kart/LeafletTangram/scene/visualisering/polygon.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,59 @@ function drawAll(drawArgs) {
let barnkode = dac.kode;
if (dac.hasOwnProperty("erSynlig") && !dac.erSynlig) return;
const visEtiketter = barnkode === opplystKode;
layer[barnkode] = draw({
layer[barnkode] = drawLines({
kode: barnkode,
forelderkode: kode,
farge: dac.farge,
opplystKode: opplystKode,
visEtiketter: visEtiketter
});
if (true) {
const points = drawPoints({
kode: barnkode,
forelderkode: kode,
farge: dac.farge,
opplystKode: opplystKode,
visEtiketter: false
});
// points.filter["$zoom"] = { min: 0, max: 6 }
layer[barnkode + "_points"] = points;
}
});
} else
layer[sysconfig.hack(kode)] = drawLines({
kode: kode,
forelderkode: kode,
farge: farge,
opplystKode: opplystKode,
visEtiketter: visEtiketter
});
}
layer[sysconfig.hack(kode)] = draw({
// layer[sysconfig.hack(kode)] = draw({
kode: kode,
forelderkode: kode,
farge: farge,
opplystKode: opplystKode,
visEtiketter: visEtiketter
});

return {
[kode]: { layer, data: { source: kode, layer: "polygons" } }
};
}

function draw(args) {
function drawLines(args) {
let { kode, farge, opplystKode, visEtiketter } = args;
farge = opplyst(kode, opplystKode, farge);
const layer = {
draw: {
mu_polygons: {
order: 800,
color: tinycolor(farge)
// .darken(30)
// .saturate(60)
.toHexString()
},
lines: {
order: 800,
color: tinycolor(farge)
.darken(50)
.toHexString(),
width: "1.0px"
},
points: {
order: 850,
size: 10,
collide: false,
color: farge,
interactive: true,
outline: {
width: 2,
color: "rgba(0,0,0,30%)"
}
}
}
const layer = drawBase(args);
layer.draw.lines = {
order: 800,
color: tinycolor(farge)
.darken(50)
.toHexString(),
width: "1.0px"
};
layer.filter = { kode: sysconfig.hack(kode) };
layer.draw.mu_polygons = {
order: 800,
blend: "multiply",
color: tinycolor(farge)
// .darken(30)
// .saturate(60)
.toHexString()
};

if (kode === opplystKode) {
const lines = layer.draw.lines;
lines.width = "2px";
Expand All @@ -84,6 +81,54 @@ function draw(args) {
return layer;
}

function drawPoints(args) {
let { kode, farge, opplystKode } = args;
farge = opplyst(kode, opplystKode, farge);
const layer = drawBase(args);
layer.draw.translucent_points = {
order: 850,
size: [
[0, 7],
[5, 10],
[10, 0]
],
collide: false,
color: farge,
// color: [[0,farge], [8,"#f00"],[10, "#ffffff"]],
interactive: true
/* outline: {
width: [[0,2],[10,0]],
color: "rgba(0,0,0,30%)"
// color: [[0,"rgba(0,0,0,60%)"],[10, "rgba(0,0,0,0%)"]]
// color: [[0,"rgba(0,0,0,30%)"], [10, "#ffffff"]]
}
// filter: { $geometry: "point" }
*/
};

return layer;
}

function drawBase(args) {
let { kode, visEtiketter } = args;
const layer = {
draw: {}
};
layer.filter = { kode: sysconfig.hack(kode) };
if (visEtiketter) {
layer.draw.text = {
text_source: ["name", "title"],
font: {
family: "Roboto",
fill: "hsla(0, 0%, 100%, 1.0)",
stroke: { color: "hsla(0, 0%, 0%, 0.7)", width: 2 },
size: "13px"
}
};
}
return layer;
}

function lagSource({ url, zoom }, { bbox }) {
return sysconfig.createTileSource(url, "MVT", zoom, bbox);
}
Expand Down

0 comments on commit 576ed43

Please sign in to comment.