Commit c2e38076 authored by juminet's avatar juminet

[client/geothermie] carotte: add piezo information

parent 7a1afe09
......@@ -410,13 +410,18 @@ const withContext = (ctx: CanvasRenderingContext2D) => {
const start = newVertex(v1.x, v1.y, distStart, -angle);
const end = newVertex(v1.x, v1.y, distEnd, -angle);
console.log(start);
console.log(end);
getPiezoValue(pizeoName).fold(
null,
(piezoValue) => {
if(piezoValue > noPizeoValue) {
console.log(piezoValue);
// draw white
ctx.beginPath();
ctx.moveTo(start.x, start.y - piezoMaxValue);
ctx.moveTo(start.x, start.y);
ctx.lineTo(end.x, end.y - piezoMaxValue);
ctx.lineTo(end.x, end.y + (piezoLayerBottom / depthPixelRatio));
ctx.lineTo(start.x, start.y + (piezoLayerBottom / depthPixelRatio));
......@@ -426,8 +431,8 @@ const withContext = (ctx: CanvasRenderingContext2D) => {
// draw water
ctx.beginPath();
ctx.moveTo(start.x, start.y - piezoValue);
ctx.lineTo(end.x, end.y - piezoValue);
ctx.moveTo(start.x, start.y - piezoValue / depthPixelRatio);
ctx.lineTo(end.x, end.y - piezoValue / depthPixelRatio);
ctx.lineTo(end.x, end.y + (piezoLayerBottom / depthPixelRatio));
ctx.lineTo(start.x, start.y + (piezoLayerBottom / depthPixelRatio));
ctx.closePath();
......@@ -436,13 +441,20 @@ const withContext = (ctx: CanvasRenderingContext2D) => {
// draw border
ctx.beginPath();
ctx.moveTo(start.x, start.y - piezoMaxValue);
ctx.moveTo(start.x, start.y);
ctx.lineTo(start.x, start.y + (piezoLayerBottom / depthPixelRatio));
ctx.lineTo(end.x, end.y + (piezoLayerBottom / depthPixelRatio));
ctx.lineTo(end.x, end.y - piezoMaxValue);
ctx.lineTo(end.x, end.y);
ctx.strokeStyle = color.black;
ctx.stroke();
// write piezo value here
ctx.fillStyle = color.blue;
ctx.font = "Bold 12px";
ctx.textAlign = "right";
ctx.textBaseline = "middle";
ctx.fillText(piezoValue.toFixed(0), start.x, end.y - piezoValue / depthPixelRatio);
it = it + 1;
}
});
......@@ -483,7 +495,7 @@ const withContext = (ctx: CanvasRenderingContext2D) => {
ctx.font = "Bold 12px";
ctx.textAlign = "right";
ctx.textBaseline = "middle";
ctx.fillText(`-${getPhreaticHeadDepth().toFixed(0)} m`, x0 + 30, y0);
ctx.fillText(`${getPhreaticHeadDepth().toFixed(0)} m`, x0 + 30, y0);
}
......@@ -612,7 +624,7 @@ const withContext = (ctx: CanvasRenderingContext2D) => {
// Write altitude and add phreatic head
writeElevation(newGraphXY(x0 + distanceV0V1, refPoint.y));
const depthPixelRatio = getDepthPixelRatio(canvasHeight, refPoint.y);
drawPhreaticHead(newGraphXY(width * 0.88, refPoint.y + getPhreaticHeadDepth() / depthPixelRatio));
drawPhreaticHead(newGraphXY(width * 0.88, refPoint.y - getPhreaticHeadDepth() / depthPixelRatio));
}
......
......@@ -127,7 +127,7 @@ export const getPhreaticHead =
() => getDataPoint().map(d => d.phreatic_head).fold(0, p => p[0]);
export const getPhreaticHeadDepth =
() => getElevation() - getPhreaticHead();
() => -getElevation() + getPhreaticHead();
export const getLayersThicknesses =
......@@ -301,7 +301,7 @@ export const getHydroLayerDepth =
export const getPiezo = // order : UH/RBC1b, UH/RBC2, UH/RBC4, UH/RBC6, UH/RBC7b, UH/RBC8a
() => getDataPoint().map(d => d.piezo).fold(
[0, 0, 0, 0, 0, 0],
p => p,
arr => arr.map(p => -getElevation() + p),
);
export const hasPiezo =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment