app_mapbuilder/svgmap/drawers/well-head.js
2022-04-22 18:34:31 +05:00

78 lines
2.0 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const SvgNode = require("./../svg-node.js");
const SvgNodes = require("./svg-nodes.js");
function name(text, ppu, styles) {
return SvgNodes.text(text)
.move(styles["wellhead-name"].dx * ppu, styles["wellhead-name"].dy * ppu)
.add_style(styles["wellhead-name"]);
}
function wlp(wlf, ppu, styles) {
return SvgNodes.text(`${Math.round(wlf * 1000) / 10 || ""}%`)
.move(styles.wlf.dx * ppu, styles.wlf.dy * ppu)
.add_style(styles.wlf);
}
/**
* Добывающая скважина
* @param {*} ppu
* @param {*} styles
* @returns
*/
function prod(ppu, styles) {
return SvgNodes.circle(1.5 * ppu).add_style(styles["wellhead-black"]);
}
/**
* Нагнетательная
* @param {*} ppu
* @param {*} styles
* @returns
*/
function inj(ppu, styles) {
const style_spike = {
"stroke-width": "0",
fill: "#000",
};
const style_blue = {
"stroke-width": Math.round(styles._units["1pt"]),
stroke: "#000",
fill: "#00f",
};
return SvgNodes.group([
SvgNodes.group([
SvgNodes.spike1(1.8 * ppu, 1.7 * ppu, 0).move(2 * ppu, 0),
SvgNodes.spike1(1.8 * ppu, 1.7 * ppu, 90).move(0, -2 * ppu),
SvgNodes.spike1(1.8 * ppu, 1.7 * ppu, 180).move(-2 * ppu, 0),
SvgNodes.spike1(1.8 * ppu, 1.7 * ppu, 270).move(0, 2 * ppu),
]).add_style(style_spike),
new SvgNode("line", { x1: -2 * ppu, x2: 2 * ppu, y1: 0, y2: 0 }),
new SvgNode("line", { y1: -2 * ppu, y2: 2 * ppu, x1: 0, x2: 0 }),
SvgNodes.circle(1.5 * ppu).add_style(style_blue),
]).add_style(style_blue);
}
/**
* Серая с треугольником с малым дебитом/нагнетанием
* @param {*} ppu
* @param {*} styles
* @returns
*/
function gray(ppu, styles) {
return SvgNodes.group([
SvgNodes.circle(1.5 * ppu).add_style(styles["wellhead-gray"]),
SvgNodes.ngon(1.5 * ppu, 3, 0).add_style(styles["wellhead-black"]),
]);
}
module.exports = {
name,
wlp,
prod,
inj,
gray
};
module.exports.default = module.exports;