diff --git a/index.html b/index.html
index b302b35..5746c59 100644
--- a/index.html
+++ b/index.html
@@ -111,7 +111,7 @@
return this
}
- set_style(style) {
+ add_style(style) {
this.style = { ...this.style || {}, ...style }
return this
}
@@ -385,13 +385,13 @@
axios.post('http://localhost:4000/proxy/sqlite', { query }).then(x => x.data)
.then(wells => {
- let layer_wells = wells.map(w => circle(15).set_style(style_wellhead).move(w.whx, w.why).render())
- let layer_wells_wpr = wells.map(w => svg_sector(70, 0, 70).set_style(style_wir).move(w.whx, w.why).render())
+ let layer_wells = wells.map(w => circle(15).add_style(style_wellhead).move(w.whx, w.why).render())
+ let layer_wells_wpr = wells.map(w => svg_sector(70, 0, 70).add_style(style_wir).move(w.whx, w.why).render())
- let layer_wells_gpr = wells.map(w => svg_sector(70, 70, 130).set_style(style_gpr).move(w.whx, w.why).render())
- let layer_wells_opr = wells.map(w => svg_sector(70, 130, 360).set_style(style_opr).move(w.whx, w.why).render())
+ let layer_wells_gpr = wells.map(w => svg_sector(70, 70, 130).add_style(style_gpr).move(w.whx, w.why).render())
+ let layer_wells_opr = wells.map(w => svg_sector(70, 130, 360).add_style(style_opr).move(w.whx, w.why).render())
- let layer_well_names = wells.map(w => svg_text(w.well).set_style(style_wellhead_text).move(w.whx + 10, w.why - 10).render())
+ let layer_well_names = wells.map(w => svg_text(w.well).add_style(style_wellhead_text).move(w.whx + 10, w.why - 10).render())
// let layers = [...layer_wells, ...layer_wells_wpr, ...layer_well_names]
// let layers = layer_wells_wpr
let layers = [...layer_wells_wpr, ...layer_wells_gpr, ...layer_wells_opr, ...layer_wells, ...layer_well_names,
diff --git a/src/App.svelte b/src/App.svelte
index 0b85160..fdaa209 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -30,21 +30,21 @@
let WellsRenderer = {
// [{x,y}]
heads(wells, r, style) {
- return wells.map((w) => SvgNodes.circle(r).set_style(style).move(w.x, w.y));
+ return wells.map((w) => SvgNodes.circle(r).add_style(style).move(w.x, w.y));
},
// [{x,y,name}]
names(wells, style, shift) {
return wells.map((w) =>
SvgNodes.text(w.name)
- .set_style(style)
+ .add_style(style)
.move(w.x + shift.x, w.y + shift.y)
);
},
// {x,y,ring[1,2,3,4,5]}
ring(x, y, r0, r1, a0, a1, style) {
- return SvgNodes.ring_sector(r0, r1, a0, a1).move(x, y).set_style(style);
+ return SvgNodes.ring_sector(r0, r1, a0, a1).move(x, y).add_style(style);
},
};
@@ -238,17 +238,17 @@
let a0 = 0;
let a1 = 130;
let layer_gpt = scaled_wells.map((w) =>
- SvgNodes.ring_sector(r0, r1, a0, a1).move(w.whx, w.why).set_style(styles.gpt)
+ SvgNodes.ring_sector(r0, r1, a0, a1).move(w.whx, w.why).add_style(styles.gpt)
);
let layer_wells = scaled_wells.map((w) =>
- SvgNodes.circle(whr).set_attrs({ cx: w.whx, cy: w.why }).set_style(styles.wellhead)
+ SvgNodes.circle(whr).set_attrs({ cx: w.whx, cy: w.why }).add_style(styles.wellhead)
);
let layer_wellnames = scaled_wells.map((w) =>
SvgNodes.text(w.well)
- .set_style(styles.style_wellhead)
+ .add_style(styles.style_wellhead)
.move(w.whx + shift.x, w.why + shift.y)
);
@@ -256,18 +256,18 @@
sectored_ring(0, 50, [{v: 10, style: styles.gpt}, {v: 20, style: styles.opt}, {v: 30, style: styles.wopt}]).move(w.whx, w.why)
);
- // let layer_wells_wpr = wells.map((w) => svg_sector(70, 0, 70).set_style(style_wir).move(w.whx, w.why).render());
+ // let layer_wells_wpr = wells.map((w) => svg_sector(70, 0, 70).add_style(style_wir).move(w.whx, w.why).render());
// let layer_wells_gpr = wells.map((w) =>
- // svg_sector(70, 70, 130).set_style(style_gpr).move(w.whx, w.why).render()
+ // svg_sector(70, 70, 130).add_style(style_gpr).move(w.whx, w.why).render()
// );
// let layer_wells_opr = wells.map((w) =>
- // svg_sector(70, 130, 360).set_style(style_opr).move(w.whx, w.why).render()
+ // svg_sector(70, 130, 360).add_style(style_opr).move(w.whx, w.why).render()
// );
// let layer_well_names = wells.map((w) =>
// svg_text(w.well)
- // .set_style(style_wellhead_text)
+ // .add_style(style_wellhead_text)
// .move(w.whx + 10, w.why - 10)
// .render()
// );
diff --git a/src/back_.js b/src/back_.js
index a6bca57..5e6f9ff 100644
--- a/src/back_.js
+++ b/src/back_.js
@@ -1,4 +1,4 @@
-import fs, { symlinkSync } from "fs";
+import fs from "fs";
import axios from "axios";
import SvgMap from "./svgmap/SvgMap.js";
@@ -9,6 +9,8 @@ import SvgNodes from "./svgmap/SvgNodes.js";
import Transfrom from "./libs/Transform.js";
import BBox from "./libs/bbox.js";
+import sql_pi from "./services/sql/prod_inj.js";
+
// import SvgNodes from "./svgmap/SvgNodes.js";
// import math_lib from './libs/math.js'
@@ -25,8 +27,46 @@ const path = "../../data/prodmaps";
// let file = fs.readFileSync('../data/2022-03-16/49_Кар тек и сум отб 7 об_вост-px.svg')
+const query = (sql) => axios.post(`${back_url}/proxy/sqlite`, { query: sql }).then((x) => x.data.data);
+
let styles = JSON.parse(fs.readFileSync("./moc/styles.json").toString());
+const all_settings = {
+ pt: {
+ tons_in_cm2: 10000,
+ ppu: 100, // 100
+ styles,
+ // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
+ map_scale: (1 / 10000) * 1000,
+ },
+
+ it: {
+ tons_in_cm2: 100000,
+ ppu: 100, // 100
+ styles,
+ // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
+ map_scale: (1 / 10000) * 1000,
+ },
+
+ pr: {
+ tons_in_cm2: 5,
+ ppu: 100,
+ styles,
+ // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
+ map_scale: (1 / 10000) * 1000,
+ },
+
+ ir: {
+ tons_in_cm2: 50,
+ ppu: 100,
+ styles,
+ // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
+ map_scale: (1 / 10000) * 1000,
+ },
+};
+
+// all_settings.styles = SvgMapBuilder.update_styles(all_settings.styles, all_settings.ppu)
+
let parser = new SvgMap();
async function start() {
@@ -61,15 +101,15 @@ async function start() {
// }
// function build_tr(cs1, cs2) {
- // let dx1 = cs1.x1 - cs1.x0
- // let dy1 = cs1.y1 - cs1.y0
- // let dx2 = cs2.x1 - cs2.x0
- // let dy2 = cs2.y1 - cs2.y0
+ // let dx1 = cs1.x1 - cs1.x0
+ // let dy1 = cs1.y1 - cs1.y0
+ // let dx2 = cs2.x1 - cs2.x0
+ // let dy2 = cs2.y1 - cs2.y0
// const kx12 = dx2 / dx1
- // const ky12 = dy2 / dy1;
+ // const ky12 = dy2 / dy1;
// const kx21 = dx1 / dx2
- // const ky21 = dy1 / dy2;
+ // const ky21 = dy1 / dy2;
// let tr = {
// tr12: {
@@ -93,9 +133,6 @@ async function start() {
// return tr;
// }
-
-
-
// Функция перевода координат из глобальных в локальные.
const cs1 = new CoordSystem(anchor.w1.x, anchor.w1.y, anchor.w2.x, anchor.w2.y);
const cs2 = new CoordSystem(ww1.whx, ww1.why, ww2.whx, ww2.why);
@@ -105,11 +142,9 @@ async function start() {
// console.log('tr is:', tr);
-
-
// console.log(wells)
- const DATE = '2023-01-01'
+ const DATE = "2023-01-01";
const query_all = `SELECT
wells.well, wells.whx, wells.why,
@@ -128,21 +163,17 @@ async function start() {
GROUP BY
wells.well
- `// WHERE well='${anchor.w1.name}'`;
-
+ `; // WHERE well='${anchor.w1.name}'`;
// Получим максимально удаленные скважины не лежащие вдоль оси.
let all_wells = await axios.post(`${back_url}/proxy/sqlite`, { query: query_all }).then((x) => x.data.data);
- let bbox = BBox.from_array(all_wells.map(w => ({x: w.whx, y: w.why})))
- console.log('BBOX', bbox)
- console.log('BBOX', bbox.toLTWH())
- console.log('BBOX', bbox.toLTRB())
-
-
-
- tr = Transfrom.fromCoordSyses()
+ let bbox = BBox.from_array(all_wells.map((w) => ({ x: w.whx, y: w.why })));
+ console.log("BBOX", bbox);
+ console.log("BBOX", bbox.toLTWH());
+ console.log("BBOX", bbox.toLTRB());
+ tr = Transfrom.fromCoordSyses();
let mapped_wells = all_wells.map((x) => ({ ...x, lx: tr.trx(x.whx), ly: tr.try(x.why) }));
@@ -157,359 +188,179 @@ async function start() {
// console.log(math_lib.make_ranges(vals))
- // svg.append(mapped_wells.map((x) => SvgNodes.ring_sector(1.5 * sc.k, 6 * sc.k, 0, 120).move(x.lx, x.ly).set_style(styles.gpt)));
-
-
+ // svg.append(mapped_wells.map((x) => SvgNodes.ring_sector(1.5 * sc.k, 6 * sc.k, 0, 120).move(x.lx, x.ly).add_style(styles.gpt)));
const settings = {
tons_in_cm2: 10000,
- styles
- }
+ styles,
+ };
- {
- let ti_layer = parser.build_tp_layer(mapped_wells, settings)
- let svg = SvgNodes.svg().set_attr("width", "1000px").set_attr("height", "1000px").set_attr("viewBox", "0 0 1000 1000")
+ {
+ let ti_layer = parser.build_tp_layer(mapped_wells, settings);
+ let svg = SvgNodes.svg()
+ .set_attr("width", "1000px")
+ .set_attr("height", "1000px")
+ .set_attr("viewBox", "0 0 1000 1000");
// let defs = new SvgNode('defs')
// defs.append(ti_layer.defs)
// console.log(ti_layer.defs.tag)
- svg.append(ti_layer.defs)
- svg.append(ti_layer.svg)
+ svg.append(ti_layer.defs);
+ svg.append(ti_layer.svg);
fs.writeFileSync(`${path}/out.svg`, svg.render());
}
-
// let ti_layer = parser.build_tp_layer(mapped_wells, settings)
// let data = file.toString()
// .replace('', ti_layer.defs.render() + '')
// .replace('', ti_layer.svg.render() + '')
// fs.writeFileSync("../tmp/out_prod.svg", data) //svg.render());
-
// let ti_layer_inj = parser.build_ti_layer(mapped_wells, settings)
// let data2 = file.toString()
// .replace('', ti_layer_inj.defs.render() + '')
// .replace('', ti_layer_inj.svg.render() + '')
// fs.writeFileSync("../tmp/out_inj.svg", data2) //svg.render());
-
}
+class SvgSaver {
+ constructor(settings, bbox) {
+ // Функция перевода координат из глобальных в локальные.
+ const cs1 = new CoordSystem(bbox.l, bbox.t, bbox.r, bbox.b);
+ const cs_mm = cs1.clone().flipy().moveto(0, 0).scale(settings.map_scale);
+ const cs_ppu = cs_mm.clone().scale(settings.ppu);
+ const csw = Math.abs(cs_mm.x1 - cs_mm.x0);
+ const csh = Math.abs(cs_mm.y1 - cs_mm.y0);
+ const bbox_ppu = BBox.fromLTRB(cs_ppu.x0, cs_ppu.y0, cs_ppu.x1, cs_ppu.y1);
+
+ this.svg = SvgNodes.svg()
+ .set_attr("width", csw + "mm")
+ .set_attr("height", csh + "mm")
+ .set_attr("viewBox", `${bbox_ppu.l} ${bbox_ppu.t} ${bbox_ppu.w()} ${bbox_ppu.h()}`);
+
+ this.tr = Transfrom.fromCoordSyses(cs1, cs_ppu);
+
+ settings.styles = SvgMapBuilder.update_styles(settings.styles, settings.ppu);
+ }
+
+ append_defs(defs) {
+ this.svg.append(defs);
+ }
+
+ append_svg(svg) {
+ this.svg.append(svg);
+ }
+
+ append_layer(layer) {
+ this.append_defs(layer.defs);
+ this.append_svg(layer.svg);
+ }
+
+ save(filename) {
+ fs.writeFileSync(filename, this.svg.render());
+ }
+}
+
+function build_bbox(data){
+ let bbox = BBox.from_array(data);
+ if (bbox.w() == 0 || bbox.h() == 0) {
+ bbox.r += 1000;
+ bbox.b += 1000;
+ }
+
+ return bbox
+}
async function build_map_pt(devobj) {
- // const DATE = '2023-01-01'
+ let wells = await query(sql_pi.totals(devobj));
+ wells = wells.filter((x) => x.wopt > 0);
+ if (!wells.length) return
- const query_all = `SELECT
- wells.well, wells.whx, wells.why
- ,SUM(production_injections.woptm) as wopt
- ,SUM(production_injections.wwptm) as wwpt
- ,SUM(production_injections.wsgptv) as wgpt
- ,SUM(production_injections.wwitv) as wwit
- ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
- ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
- FROM
- wells, production_injections
- WHERE
- wells.well=production_injections.well
+ let bbox = build_bbox(wells.map(w => ({ x: w.whx, y: w.why })));
+ const saver = new SvgSaver(all_settings.pt, bbox);
- AND object='${devobj}'
- GROUP BY
- wells.well
+ let mapped_wells = wells.map((x) => ({ ...x, lx: saver.tr.trx(x.whx), ly: saver.tr.try(x.why) }));
+ let tp_layer = SvgMapBuilder.build_tp_layer(mapped_wells, all_settings.pt);
- `
-
- let all_wells = await axios.post(`${back_url}/proxy/sqlite`, { query: query_all }).then((x) => x.data.data);
- if (all_wells.length == 0){
- // fs.writeFileSync(`${path}/out_devobj-${devobj}.svg`, "");
- return
- }
-
- let bbox = BBox.from_array(all_wells.map(w => ({x: w.whx, y: w.why})))
-
- {
- const builder = new SvgMapBuilder()
-
- const settings = {
- tons_in_cm2: 10000,
- ppu: 100, // 100
- styles: builder.update_styles(styles, 100),
- // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
- map_scale: 1 / 10000 * 1000
- }
-
- // Функция перевода координат из глобальных в локальные.
- const cs1 = new CoordSystem(bbox.l, bbox.t, bbox.r, bbox.b)
- const cs_mm = cs1.clone().flipy().moveto(0, 0).scale(settings.map_scale)
- const cs_ppu = cs_mm.clone().scale(settings.ppu)
- let tr = Transfrom.fromCoordSyses(cs1, cs_ppu);
-
- let mapped_wells = all_wells.map((x) => ({ ...x, lx: tr.trx(x.whx), ly: tr.try(x.why) }));
-
- let ti_layer = builder.build_tp_layer(mapped_wells, settings)
- const csw = Math.abs(cs_mm.x1 - cs_mm.x0)
- const csh = Math.abs(cs_mm.y1 - cs_mm.y0)
- const bbox_ppu = BBox.fromLTRB(cs_ppu.x0, cs_ppu.y0, cs_ppu.x1, cs_ppu.y1)
-
- let svg = SvgNodes.svg()
- .set_attr("width", csw + "mm").set_attr("height", csh + "mm")
- .set_attr("viewBox", `${bbox_ppu.l} ${bbox_ppu.t} ${bbox_ppu.w()} ${bbox_ppu.h()}`)
- svg.append(ti_layer.defs)
- svg.append(ti_layer.svg)
- fs.writeFileSync(`${path}/out_devobj-${devobj}-PT.svg`, svg.render());
- }
+ saver.append_layer(tp_layer);
+ saver.save(`${path}/out_devobj-${devobj}-PT.svg`);
}
async function build_map_it(devobj) {
- // const DATE = '2023-01-01'
+ let wells = await query(sql_pi.totals(devobj));
+ wells = wells.filter((x) => x.wwit > 0);
+ if (!wells.length) return
- const query_all = `SELECT
- wells.well, wells.whx, wells.why
- ,SUM(production_injections.woptm) as wopt
- ,SUM(production_injections.wwptm) as wwpt
- ,SUM(production_injections.wsgptv) as wgpt
- ,SUM(production_injections.wwitv) as wwit
- ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
- ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
- FROM
- wells, production_injections
- WHERE
- wells.well=production_injections.well
- AND object='${devobj}'
- GROUP BY
- wells.well
- HAVING
- wwit>0
+ let bbox = build_bbox(wells.map(w => ({ x: w.whx, y: w.why })));
+ const saver = new SvgSaver(all_settings.it, bbox);
- `
+ let mapped_wells = wells.map((x) => ({ ...x, lx: saver.tr.trx(x.whx), ly: saver.tr.try(x.why) }));
+ let tp_layer = SvgMapBuilder.build_ti_layer(mapped_wells, all_settings.it);
- let all_wells = await axios.post(`${back_url}/proxy/sqlite`, { query: query_all }).then((x) => x.data.data);
-
- if (all_wells.length == 0){
- // fs.writeFileSync(`${path}/out_devobj-${devobj}.svg`, "");
- return
- }
-
- let bbox = BBox.from_array(all_wells.map(w => ({x: w.whx, y: w.why})))
- if (bbox.w() == 0 || bbox.h() == 0){
- bbox.r += 1000
- bbox.b += 1000
- }
-
- {
- const builder = new SvgMapBuilder()
-
- const settings = {
- tons_in_cm2: 20000,
- ppu: 100, // 100
- styles: builder.update_styles(styles, 100),
- // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
- map_scale: 1 / 10000 * 1000
- }
-
- // Функция перевода координат из глобальных в локальные.
- const cs1 = new CoordSystem(bbox.l, bbox.t, bbox.r, bbox.b)
- const cs_mm = cs1.clone().flipy().moveto(0, 0).scale(settings.map_scale)
- const cs_ppu = cs_mm.clone().scale(settings.ppu)
- let tr = Transfrom.fromCoordSyses(cs1, cs_ppu);
-
- let mapped_wells = all_wells.map((x) => ({ ...x, lx: tr.trx(x.whx), ly: tr.try(x.why) }));
-
- // console.log(mapped_wells)
-
- let ti_layer = builder.build_ti_layer(mapped_wells, settings)
- const csw = Math.abs(cs_mm.x1 - cs_mm.x0)
- const csh = Math.abs(cs_mm.y1 - cs_mm.y0)
- const bbox_ppu = BBox.fromLTRB(cs_ppu.x0, cs_ppu.y0, cs_ppu.x1, cs_ppu.y1)
-
- let svg = SvgNodes.svg()
- .set_attr("width", csw + "mm").set_attr("height", csh + "mm")
- .set_attr("viewBox", `${bbox_ppu.l} ${bbox_ppu.t} ${bbox_ppu.w()} ${bbox_ppu.h()}`)
- svg.append(ti_layer.defs)
- svg.append(ti_layer.svg)
- fs.writeFileSync(`${path}/out_devobj-${devobj}-IT.svg`, svg.render());
- }
-
-
- // let ti_layer = parser.build_tp_layer(mapped_wells, settings)
- // let data = file.toString()
- // .replace('', ti_layer.defs.render() + '')
- // .replace('', ti_layer.svg.render() + '')
- // fs.writeFileSync("../tmp/out_prod.svg", data) //svg.render());
-
-
- // let ti_layer_inj = parser.build_ti_layer(mapped_wells, settings)
- // let data2 = file.toString()
- // .replace('', ti_layer_inj.defs.render() + '')
- // .replace('', ti_layer_inj.svg.render() + '')
- // fs.writeFileSync("../tmp/out_inj.svg", data2) //svg.render());
+ saver.append_layer(tp_layer);
+ saver.save(`${path}/out_devobj-${devobj}-IT.svg`);
}
-async function build_map_pty(devobj) {
- console.log('build_map_pty', devobj)
-
- let sql_max_year = `SELECT max(year) as max_year FROM production_injections`
- const max_year = await axios.post(`${back_url}/proxy/sqlite`, { query: sql_max_year }).then((x) => x.data.data[0].max_year);
-
- // const DATE = '2023-01-01'
-
- // console.log(max_year)
-
- const query_all = `SELECT
- wells.well, wells.whx, wells.why
- ,MAX(production_injections.year) as year
- ,SUM(production_injections.woptm) as wopt
- ,SUM(production_injections.wwptm) as wwpt
- ,SUM(production_injections.wsgptv) as wgpt
- ,SUM(production_injections.wwitv) as wwit
- ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
- ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
- FROM
- wells, production_injections
- WHERE
- wells.well=production_injections.well
- AND object='${devobj}'
- AND year=${max_year}
- GROUP BY
- wells.well
-
- `
-
- let all_wells = await axios.post(`${back_url}/proxy/sqlite`, { query: query_all }).then((x) => x.data.data);
- if (all_wells.length == 0){
- console.log('NO wells found')
- // fs.writeFileSync(`${path}/out_devobj-${devobj}-CP.svg`, "");
- return
- }
-
- let bbox = BBox.from_array(all_wells.map(w => ({x: w.whx, y: w.why})))
-
- {
- const builder = new SvgMapBuilder()
-
- const settings = {
- tons_in_cm2: 10000,
- ppu: 100, // 100
- styles: builder.update_styles(styles, 100),
- // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
- map_scale: 1 / 10000 * 1000
- }
-
- // Функция перевода координат из глобальных в локальные.
- const cs1 = new CoordSystem(bbox.l, bbox.t, bbox.r, bbox.b)
- const cs_mm = cs1.clone().flipy().moveto(0, 0).scale(settings.map_scale)
- const cs_ppu = cs_mm.clone().scale(settings.ppu)
- let tr = Transfrom.fromCoordSyses(cs1, cs_ppu);
-
- let mapped_wells = all_wells.map((x) => ({ ...x, lx: tr.trx(x.whx), ly: tr.try(x.why) }));
-
- let ti_layer = builder.build_tp_layer(mapped_wells, settings)
- const csw = Math.abs(cs_mm.x1 - cs_mm.x0)
- const csh = Math.abs(cs_mm.y1 - cs_mm.y0)
- const bbox_ppu = BBox.fromLTRB(cs_ppu.x0, cs_ppu.y0, cs_ppu.x1, cs_ppu.y1)
-
- let svg = SvgNodes.svg()
- .set_attr("width", csw + "mm").set_attr("height", csh + "mm")
- .set_attr("viewBox", `${bbox_ppu.l} ${bbox_ppu.t} ${bbox_ppu.w()} ${bbox_ppu.h()}`)
- svg.append(ti_layer.defs)
- svg.append(ti_layer.svg)
-
- fs.writeFileSync(`${path}/out_devobj-${devobj}-PC.svg`, svg.render());
- }
-}
async function build_map_pr(devobj) {
- console.log('build_map_pty', devobj)
+ console.log("build_map_pr", devobj);
- let sql_max_year = `SELECT MAX(year*1000+month) as max_year FROM production_injections`
- const max_year_month = await axios.post(`${back_url}/proxy/sqlite`, { query: sql_max_year }).then((x) => x.data.data[0].max_year);
-// console.log(max_year_month)
- // const DATE = '2023-01-01'
+ const md = await query(sql_pi.max_date(devobj)).then((x) => x[0].date);
+ let wells = await query(sql_pi.totals(devobj, md))
+ wells = wells.filter((x) => x.wopt > 0);
+ if (!wells.length) return
- // console.log(max_year)
+ let bbox = build_bbox(wells.map(w => ({ x: w.whx, y: w.why })));
+ const saver = new SvgSaver(all_settings.pr, bbox);
- const query_all = `SELECT
- wells.well, wells.whx, wells.why
- ,(year*1000+month) as aaa
- ,production_injections.horizon
- ,production_injections.segment
- ,production_injections.object
- ,SUM(production_injections.days) as days
- ,SUM(production_injections.woptm) as wopt
- ,SUM(production_injections.wwptm) as wwpt
- FROM
- wells, production_injections
- WHERE
- production_injections.woptm > 0
- AND wells.well=production_injections.well
- AND production_injections.object='${devobj}'
- AND (year*1000+month)=${max_year_month}
- GROUP BY
- wells.well
- `
+ let mapped_wells = wells.map((x) => ({
+ ...x,
+ wopt: x.wopt / x.days,
+ wwpt: x.wwpt / x.days,
+ wlpt: (x.wopt + x.wwpt) / x.days,
+ wlf: x.wwpt / (x.wopt + x.wwpt),
+ lx: saver.tr.trx(x.whx),
+ ly: saver.tr.try(x.why),
+ }));
- let all_wells = await axios.post(`${back_url}/proxy/sqlite`, { query: query_all }).then((x) => x.data.data);
+ // let mapped_wells = wells.map((x) => ({ ...x, lx: saver.tr.trx(x.whx), ly: saver.tr.try(x.why) }));
+ let tp_layer = SvgMapBuilder.build_tp_layer(mapped_wells, all_settings.pr);
- console.log(all_wells)
-
- if (all_wells.length == 0){
- console.log('NO wells found')
- // fs.writeFileSync(`${path}/out_devobj-${devobj}-CP.svg`, "");
- return
- }
-
- let bbox = BBox.from_array(all_wells.map(w => ({x: w.whx, y: w.why})))
-
- {
- const builder = new SvgMapBuilder()
-
- const settings = {
- tons_in_cm2: 5,
- ppu: 100, // 100
- styles: builder.update_styles(styles, 100),
- // Масштаб 1мм карты / 1мм реальный (1000мм в 1м)
- map_scale: 1 / 10000 * 1000
- }
-
- // Функция перевода координат из глобальных в локальные.
- const cs1 = new CoordSystem(bbox.l, bbox.t, bbox.r, bbox.b)
- const cs_mm = cs1.clone().flipy().moveto(0, 0).scale(settings.map_scale)
- const cs_ppu = cs_mm.clone().scale(settings.ppu)
- let tr = Transfrom.fromCoordSyses(cs1, cs_ppu);
-
- let mapped_wells = all_wells.map((x) => ({ ...x,
- wopt: x.wopt / x.days,
- wwpt: x.wwpt / x.days,
- wlpt: (x.wopt + x.wwpt) / x.days,
- wlf: x.wwpt / (x.wopt + x.wwpt),
- lx: tr.trx(x.whx), ly: tr.try(x.why)
- }));
-
- let ti_layer = builder.build_tp_layer(mapped_wells, settings)
- const csw = Math.abs(cs_mm.x1 - cs_mm.x0)
- const csh = Math.abs(cs_mm.y1 - cs_mm.y0)
- const bbox_ppu = BBox.fromLTRB(cs_ppu.x0, cs_ppu.y0, cs_ppu.x1, cs_ppu.y1)
-
- let svg = SvgNodes.svg()
- .set_attr("width", csw + "mm").set_attr("height", csh + "mm")
- .set_attr("viewBox", `${bbox_ppu.l} ${bbox_ppu.t} ${bbox_ppu.w()} ${bbox_ppu.h()}`)
- svg.append(ti_layer.defs)
- svg.append(ti_layer.svg)
-
- fs.writeFileSync(`${path}/out_devobj-${devobj}-PR.svg`, svg.render());
- }
+ saver.append_layer(tp_layer);
+ saver.save(`${path}/out_devobj-${devobj}-PR.svg`);
}
+async function build_map_ir(devobj) {
+ // const DATE = '2023-01-01'
+
+ const md = await query(sql_pi.max_date(devobj)).then((x) => x[0].date);
+ let wells = await query(sql_pi.totals(devobj, md))
+ wells = wells.filter((x) => x.wwit > 0);
+ if (!wells.length) return
+
+ let bbox = build_bbox(wells.map(w => ({ x: w.whx, y: w.why })));
+ const saver = new SvgSaver(all_settings.ir, bbox);
+
+ let mapped_wells = wells.map((x) => ({
+ ...x,
+ wwit: x.wwit / x.days,
+ lx: saver.tr.trx(x.whx),
+ ly: saver.tr.try(x.why),
+ }));
+
+ let tp_layer = SvgMapBuilder.build_ti_layer(mapped_wells, all_settings.ir);
+
+ saver.append_layer(tp_layer);
+ saver.save(`${path}/out_devobj-${devobj}-IR.svg`);
+}
async function start2() {
- const DATE = '2023-01-01'
+ const objects = await query(sql_pi.devobjs()).then((r) => r.map((x) => x.devobj));
- const sql_objects = `SELECT distinct(object) as devobj FROM production_injections` // where devobj=1` //x.wopt
-
- let objects = await axios.post(`${back_url}/proxy/sqlite`, { query: sql_objects }).then((x) => x.data.data.map(y => y.devobj));
-
- objects.map(build_map_pt)
+ objects.map(build_map_pt);
objects.map(build_map_it)
- objects.map(build_map_pr)
+ objects.map(build_map_pr)
+ objects.map(build_map_ir)
}
-
start2();
diff --git a/src/moc/styles.json b/src/moc/styles.json
index 45adfca..b03be67 100644
--- a/src/moc/styles.json
+++ b/src/moc/styles.json
@@ -1,13 +1,39 @@
{
- "wellhead": {
+ "black-line": {
+ "stroke-width": "1pt",
+ "stroke": "#000",
+ "fill": "none"
+ },
+
+ "white-body": {
+ "fill": "#fff"
+ },
+
+ "wellhead-name": {
"font-family": "Times New Roman",
"font-weight": "bold",
- "font-size": "10pt",
- "stroke-width": "0.1pt",
- "stroke": "#fff",
+ "font-size": "12pt",
"fill": "#000",
"dx":1.7,
- "dy":"0"
+ "dy":"-1"
+ },
+
+ "wellhead-black": {
+ "stroke-width": "0.1mm",
+ "stroke": "#fff",
+ "fill": "#000"
+ },
+
+ "wellhead-gray": {
+ "stroke-width": "0.1mm",
+ "stroke": "#000",
+ "fill": "#ddd"
+ },
+
+ "wellhead-tri": {
+ "stroke-width": "0.1pt",
+ "stroke": "#fff",
+ "fill": "#000"
},
"wlf": {
diff --git a/src/services/sql/prod_inj.js b/src/services/sql/prod_inj.js
new file mode 100644
index 0000000..f37dad9
--- /dev/null
+++ b/src/services/sql/prod_inj.js
@@ -0,0 +1,116 @@
+export default {
+ max_date(){
+ return `SELECT MAX(date(year||'-01-01', (month - 1)||' month')) as date FROM production_injections`
+ },
+
+ devobjs(){
+ return `SELECT distinct(object) as devobj FROM production_injections`
+ },
+
+ totals(devobj){
+ return `SELECT
+ wells.well, wells.whx, wells.why
+ ,SUM(production_injections.woptm) as wopt
+ ,SUM(production_injections.wwptm) as wwpt
+ ,SUM(production_injections.wsgptv) as wgpt
+ ,SUM(production_injections.wwitv) as wwit
+ ,SUM(production_injections.days) as days
+ ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
+ ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
+ FROM
+ wells, production_injections
+ WHERE
+ wells.well=production_injections.well
+ AND production_injections.object='${devobj}'
+ GROUP BY
+ wells.well
+ ORDER BY
+ wlpt DESC, wwit DESC`
+ },
+
+ rates(devobj, date){
+ date = new Date(date)
+ const year_month = date.getFullYear()*100 + date.getMonth()
+ return `SELECT
+ wells.well, wells.whx, wells.why
+ ,SUM(production_injections.woptm)/SUM(production_injections.days) as wopr
+ ,SUM(production_injections.wwptm)/SUM(production_injections.days) as wwpr
+ ,SUM(production_injections.wsgptv)/SUM(production_injections.days) as wgpr
+ ,SUM(production_injections.wwitv)/SUM(production_injections.days) as wwir
+ ,SUM(production_injections.days) as days
+ ,(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) / SUM(production_injections.days) as wlpr
+ ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
+ FROM
+ wells, production_injections
+ WHERE
+ wells.well=production_injections.well
+ AND production_injections.object='${devobj}'
+ AND (year*100+month)=${year_month}
+ GROUP BY
+ wells.well`
+ },
+
+
+ production_injection(field, devobj, date){
+ const f_date = date ? `AND year*1000+month=${date.getFullYear()*1000+date.getMonth()}` : ''
+ console.log(f_date)
+
+ return `SELECT
+ wells.well, wells.whx, wells.why
+ ,SUM(production_injections.woptm) as wopt
+ ,SUM(production_injections.wwptm) as wwpt
+ ,SUM(production_injections.wsgptv) as wgpt
+ ,SUM(production_injections.wwitv) as wwit
+ ,SUM(production_injections.days) as days
+ ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
+ ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
+ FROM
+ wells, production_injections
+ WHERE
+ AND wells.well=production_injections.well
+ AND production_injections.object='${devobj}'
+ AND (year*1000+month)=${max_year_month}
+ GROUP BY
+ wells.well`
+ },
+
+ production_total(field, devobj){
+ return `SELECT
+ wells.well, wells.whx, wells.why
+ ,SUM(production_injections.woptm) as wopt
+ ,SUM(production_injections.wwptm) as wwpt
+ ,SUM(production_injections.wsgptv) as wgpt
+ ,SUM(production_injections.wwitv) as wwit
+ ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
+ ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
+ FROM
+ wells, production_injections
+ WHERE
+ wells.well=production_injections.well
+ AND object='${devobj}'
+ GROUP BY
+ wells.well`
+ },
+
+ injection_total(){
+ const query_all = `SELECT
+ wells.well, wells.whx, wells.why
+ ,SUM(production_injections.woptm) as wopt
+ ,SUM(production_injections.wwptm) as wwpt
+ ,SUM(production_injections.wsgptv) as wgpt
+ ,SUM(production_injections.wwitv) as wwit
+ ,SUM(production_injections.wwptm)+SUM(production_injections.woptm) as wlpt
+ ,SUM(production_injections.wwptm)/(SUM(production_injections.wwptm)+SUM(production_injections.woptm)) as wlf
+ FROM
+ wells, production_injections
+ WHERE
+ wells.well=production_injections.well
+ AND object='${devobj}'
+ GROUP BY
+ wells.well
+ HAVING
+ wwit>0
+
+ `
+ }
+}
\ No newline at end of file
diff --git a/src/svgmap/SvgMap.js b/src/svgmap/SvgMap.js
index 2401e04..e10fc1b 100644
--- a/src/svgmap/SvgMap.js
+++ b/src/svgmap/SvgMap.js
@@ -100,11 +100,11 @@ export default class {
// Круги
svg.append(wells.map((x) => SvgNodes.ring_sectors(1.5 * sc.k, t2r(x.wlpt) * sc.k, [{v: x.wopt, style: styles.opt}, {v: x.wwpt, style: styles.wpt}]).move(x.lx, x.ly)));
// Знак скважины
- svg.append(wells.map((x) => SvgNodes.circle(1.5 * sc.k).move(x.lx, x.ly).set_style(styles.wellhead)));
+ svg.append(wells.map((x) => SvgNodes.circle(1.5 * sc.k).move(x.lx, x.ly).add_style(styles.wellhead)));
// Имя скважины
- svg.append(wells.map((x) => SvgNodes.text(x.well).move(x.lx + styles.wellhead.dx * sc.k, x.ly + styles.wellhead.dy * sc.k).set_style(styles.wellhead)));
+ svg.append(wells.map((x) => SvgNodes.text(x.well).move(x.lx + styles.wellhead.dx * sc.k, x.ly + styles.wellhead.dy * sc.k).add_style(styles.wellhead)));
// Обводненность
- svg.append(wells.map((x) => SvgNodes.text(`${Math.round(x.wlf * 1000)/10 || ''}%`).move(x.lx + styles.wlf.dx * sc.k, x.ly + styles.wlf.dy * sc.k).set_style(styles.wlf)));
+ svg.append(wells.map((x) => SvgNodes.text(`${Math.round(x.wlf * 1000)/10 || ''}%`).move(x.lx + styles.wlf.dx * sc.k, x.ly + styles.wlf.dy * sc.k).add_style(styles.wlf)));
return {defs, svg}
}
@@ -126,13 +126,13 @@ export default class {
// Круги
// let g_rings = SvgNodes.group(['']).set_attr("id", "Круги")
// svg.append(g_rings)
- svg.append(wells.map((x) => SvgNodes.circle(t2r(x.wwit) * sc.k).set_style(styles.wit).move(x.lx, x.ly)));
+ svg.append(wells.map((x) => SvgNodes.circle(t2r(x.wwit) * sc.k).add_style(styles.wit).move(x.lx, x.ly)));
// Знак скважины
- svg.append(wells.map((x) => SvgNodes.circle(1.5 * sc.k).move(x.lx, x.ly).set_style(styles.wellhead)));
+ svg.append(wells.map((x) => SvgNodes.circle(1.5 * sc.k).move(x.lx, x.ly).add_style(styles.wellhead)));
// Имя скважины
- svg.append(wells.map((x) => SvgNodes.text(x.well).move(x.lx + styles.wellhead.dx * sc.k, x.ly + styles.wellhead.dy * sc.k).set_style(styles.wellhead)));
+ svg.append(wells.map((x) => SvgNodes.text(x.well).move(x.lx + styles.wellhead.dx * sc.k, x.ly + styles.wellhead.dy * sc.k).add_style(styles.wellhead)));
// Обводненность
- svg.append(wells.map((x) => SvgNodes.text(`${Math.round(x.wlf * 1000)/10 || ''}%`).move(x.lx + styles.wlf.dx * sc.k, x.ly + styles.wlf.dy * sc.k).set_style(styles.wlf)));
+ svg.append(wells.map((x) => SvgNodes.text(`${Math.round(x.wlf * 1000)/10 || ''}%`).move(x.lx + styles.wlf.dx * sc.k, x.ly + styles.wlf.dy * sc.k).add_style(styles.wlf)));
return {defs, svg}
}
diff --git a/src/svgmap/SvgMapBuilder.js b/src/svgmap/SvgMapBuilder.js
index f86405d..c10280b 100644
--- a/src/svgmap/SvgMapBuilder.js
+++ b/src/svgmap/SvgMapBuilder.js
@@ -1,7 +1,8 @@
import SvgNode from "./SvgNode.js";
import SvgNodes from "./SvgNodes.js";
+import SvgWellNodes from "./SvgWellNodes.js";
-export default class {
+export default {
/**
* Преобразовать размер шрифта в единицы карты
* @param { string | Number } v Значение для перевода "10mm", "22pt"
@@ -17,7 +18,7 @@ export default class {
if (v.endsWith("pt")) {
return (parseFloat(v.slice(0, v.length - 2)) * ppu * 100) / 283.46;
}
- }
+ },
/**
* Перегоняет стиль в единицы карты (возвращает новый объект)
@@ -31,7 +32,7 @@ export default class {
if (convertable.includes(k)) s[k] = this.fontsize2ppu(s[k], ppu);
});
return s;
- }
+ },
/**
* Перегоняет все стили в единицы карты (возвращает новый объект)
@@ -40,7 +41,7 @@ export default class {
*/
update_styles(styles, ppu) {
return Object.keys(styles).reduce((s, c) => ({ ...s, [c]: this.update_style(styles[c], ppu) }), {});
- }
+ },
build_tp_layer(wells, settings) {
function t2r(tons) {
@@ -56,41 +57,20 @@ export default class {
let svg = SvgNodes.group(['']).set_attr("id", "WWPT");
// Круги
- svg.append(
- wells.map((x) =>
- SvgNodes.ring_sectors(1.5 * ppu, t2r(x.wlpt) * ppu, [
- { v: x.wopt, style: styles.opt },
- { v: x.wwpt, style: styles.wpt },
- ]).move(x.lx, x.ly)
- )
- );
+ svg.append(wells.map((x) => SvgWellNodes.ring.pt(x.wopt, x.wwpt, t2r(x.wlpt), ppu, styles).move(x.lx, x.ly)));
+
// Знак скважины
svg.append(
- wells.map((x) =>
- SvgNodes.circle(1.5 * ppu)
- .move(x.lx, x.ly)
- .set_style(styles.wellhead)
- )
- );
- // Имя скважины
- svg.append(
- wells.map((x) =>
- SvgNodes.text(x.well)
- .move(x.lx + styles.wellhead.dx * ppu, x.ly + styles.wellhead.dy * ppu)
- .set_style(styles.wellhead)
- )
- );
- // Обводненность
- svg.append(
- wells.map((x) =>
- SvgNodes.text(`${Math.round(x.wlf * 1000) / 10 || ""}%`)
- .move(x.lx + styles.wlf.dx * ppu, x.ly + styles.wlf.dy * ppu)
- .set_style(styles.wlf)
- )
+ wells.map((x) => SvgWellNodes.wellhead[t2r(x.wlpt) > 1.6 ? "prod" : "gray"](ppu, styles).move(x.lx, x.ly))
);
+ // Имя скважины
+ svg.append(wells.map((x) => SvgWellNodes.wellhead.name(x.well, ppu, styles).move(x.lx, x.ly)));
+ // Обводненность
+ svg.append(wells.map((x) => SvgWellNodes.wellhead.wlp(x.wlf, ppu, styles).move(x.lx, x.ly)));
+
return { defs, svg };
- }
+ },
build_ti_layer(wells, settings) {
function t2r(tons) {
@@ -104,41 +84,18 @@ export default class {
defs.append(SvgNodes.defs.simple.radialGradient("rg1", "#fff", "#c1ff5e"));
let svg = SvgNodes.group(['']).set_attr("id", "WWIT");
+
// Круги
- // let g_rings = SvgNodes.group(['']).set_attr("id", "Круги")
- // svg.append(g_rings)
- svg.append(
- wells.map((x) =>
- SvgNodes.circle(t2r(x.wwit) * ppu)
- .set_style(styles.wit)
- .move(x.lx, x.ly)
- )
- );
+ svg.append(wells.map((x) => SvgWellNodes.ring.it(t2r(x.wwit), ppu, styles).move(x.lx, x.ly)));
+
// Знак скважины
svg.append(
- wells.map((x) =>
- SvgNodes.circle(1.5 * ppu)
- .move(x.lx, x.ly)
- .set_style(styles.wellhead)
- )
+ wells.map((x) => SvgWellNodes.wellhead[t2r(x.wwit) > 1.6 ? "inj" : "gray"](ppu, styles).move(x.lx, x.ly))
);
+
// Имя скважины
- svg.append(
- wells.map((x) =>
- SvgNodes.text(x.well)
- .move(x.lx + styles.wellhead.dx * ppu, x.ly + styles.wellhead.dy * ppu)
- .set_style(styles.wellhead)
- )
- );
- // Обводненность
- // svg.append(
- // wells.map((x) =>
- // SvgNodes.text(`${Math.round(x.wlf * 1000) / 10 || ""}%`)
- // .move(x.lx + styles.wlf.dx * ppu, x.ly + styles.wlf.dy * ppu)
- // .set_style(styles.wlf)
- // )
- // );
+ svg.append(wells.map((x) => SvgWellNodes.wellhead.name(x.well, ppu, styles).move(x.lx, x.ly)));
return { defs, svg };
- }
-}
+ },
+};
diff --git a/src/svgmap/SvgNode.js b/src/svgmap/SvgNode.js
index be12bbf..8a40fde 100644
--- a/src/svgmap/SvgNode.js
+++ b/src/svgmap/SvgNode.js
@@ -20,18 +20,21 @@ export default class SvgNode {
return this
}
- set_style(style) {
+ add_style(style) {
this.style = { ...this.style || {}, ...style }
return this
}
- clear_style(style) {
+ clear_style() {
this.style = null
return this
}
move(x, y) {
- this.transform = { x, y }
+ if (this.transform)
+ this.transform = { x: this.transform.x + x, y: this.transform.y + y }
+ else
+ this.transform = { x, y }
return this
}
diff --git a/src/svgmap/SvgNodes.js b/src/svgmap/SvgNodes.js
index b692b74..7d1cbeb 100644
--- a/src/svgmap/SvgNodes.js
+++ b/src/svgmap/SvgNodes.js
@@ -38,6 +38,22 @@ export default {
return new SvgNode("circle", {r})
},
+ ngon(r, n, ang = 0) {
+ const da = 2 * Math.PI / n
+ ang = ang * Math.PI / 180
+ const pts = Array(n).fill(0).map((x, i) => [Math.sin(i * da + ang) * r, Math.cos(i * da + ang) * r])
+ return new SvgNode("polygon", {points: pts.map(x => `${x[0]},${x[1]}`)})
+ },
+
+ spike1(w, h, ang){
+ const da = ang * Math.PI / 180
+ const sa = Math.sin(da)
+ const ca = Math.cos(da)
+ h = h / 2
+ const pts = `${-sa*h},${-ca*h} ${ca*w},${-sa*w}, ${sa*h},${ca*h}`
+ return new SvgNode("polygon", {points: pts})
+ },
+
sector(r, a0, a1) {
const k = Math.PI / 180;
let s0 = -Math.sin(a0 * k) * r;
@@ -80,7 +96,7 @@ export default {
ring_sectors(r0, r1, sectors){
let sum = sectors.reduce((s,c) => s + c.v, 0)
let angs = sectors.reduce((s, c, i) => [...s, {...c, a0: i && s[i - 1].a1, a1: c.v + (i && s[i - 1].a1)}], [])
- let items = angs.map(x => this.ring_sector(r0, r1, x.a0 * 360 / sum, x.a1 * 360 / sum).set_style(x.style))
+ let items = angs.map(x => this.ring_sector(r0, r1, x.a0 * 360 / sum, x.a1 * 360 / sum).add_style(x.style))
return this.group(items)
},
diff --git a/src/svgmap/SvgWellNodes.js b/src/svgmap/SvgWellNodes.js
new file mode 100644
index 0000000..faee52b
--- /dev/null
+++ b/src/svgmap/SvgWellNodes.js
@@ -0,0 +1,75 @@
+import SvgNode from "./SvgNode.js";
+import SvgNodes from "./SvgNodes.js";
+
+export default {
+ wellhead: {
+ name(text, ppu, styles) {
+ return SvgNodes.text(text)
+ .move(styles["wellhead-name"].dx * ppu, styles["wellhead-name"].dy * ppu)
+ .add_style(styles["wellhead-name"]);
+ },
+
+ 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
+ */
+ prod(ppu, styles) {
+ return SvgNodes.circle(1.5 * ppu).add_style(styles["wellhead-black"]);
+ },
+
+ /**
+ * Нагнетательная
+ * @param {*} ppu
+ * @param {*} styles
+ * @returns
+ */
+ inj(ppu, styles) {
+ return 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),
+ new SvgNode("line", { x1: -2 * ppu, x2: 2 * ppu, y1: 0, y2: 0 }).add_style(styles["black-line"]),
+ new SvgNode("line", { y1: -2 * ppu, y2: 2 * ppu, x1: 0, x2: 0 }).add_style(styles["black-line"]),
+ SvgNodes.circle(1.5 * ppu)
+ .add_style(styles["black-line"])
+ .add_style(styles["white-body"]),
+ ]);
+ },
+
+ /**
+ * Серая с треугольником с малым дебитом/нагнетанием
+ * @param {*} ppu
+ * @param {*} styles
+ * @returns
+ */
+ 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"]),
+ ]);
+ },
+ },
+
+ ring: {
+ pt(wopt, wwpt, rmm, ppu, styles) {
+ return SvgNodes.ring_sectors(1.5 * ppu, rmm * ppu, [
+ { v: wopt, style: styles.opt },
+ { v: wwpt, style: styles.wpt },
+ ]);
+ },
+
+ it(rmm, ppu, styles) {
+ return SvgNodes.circle(rmm * ppu)
+ .add_style(styles.wit)
+ }
+ },
+};
diff --git a/src/svgmap/drawers/SvgWell.js b/src/svgmap/drawers/SvgWell.js
index 9591882..c72451e 100644
--- a/src/svgmap/drawers/SvgWell.js
+++ b/src/svgmap/drawers/SvgWell.js
@@ -1,21 +1,31 @@
export default {
+ wellhead: {
+ prod(x, y, r, style){
+ return SvgNodes.circle(r).add_style(style).move(w.x, w.y);
+ },
+
+ inj(x, y, r, style){
+ return SvgNodes.circle(r).add_style(style).move(w.x, w.y);
+ }
+ },
+
// [{x,y}]
heads(wells, r, style) {
- return wells.map((w) => SvgNodes.circle(r).set_style(style).move(w.x, w.y));
+ return wells.map((w) => SvgNodes.circle(r).add_style(style).move(w.x, w.y));
},
// [{x,y,name}]
names(wells, style, shift) {
return wells.map((w) =>
SvgNodes.text(w.name)
- .set_style(style)
+ .add_style(style)
.move(w.x + shift.x, w.y + shift.y)
);
},
// {x,y,ring[1,2,3,4,5]}
ring(x, y, r0, r1, a0, a1, style) {
- return SvgNodes.ring_sector(r0, r1, a0, a1).move(x, y).set_style(style);
+ return SvgNodes.ring_sector(r0, r1, a0, a1).move(x, y).add_style(style);
},
};