Compare commits
4 commits
e98837082e
...
c142be9e4a
Author | SHA1 | Date | |
---|---|---|---|
Wolfgang | c142be9e4a | ||
Wolfgang | 603bd72bbb | ||
Wolfgang | 401b52b768 | ||
Wolfgang | 87ce5c1a8e |
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
- header: true
|
||||
columns: [power]
|
||||
titles: {
|
||||
power_a: Power A,
|
||||
power_e: Power E,
|
||||
power_n: Power N
|
||||
}
|
||||
- start: 135.7
|
||||
end: 137.8
|
||||
power_a: 1 W ERP
|
||||
power: {a: 1 W ERP}
|
||||
- start: 472
|
||||
end: 479
|
||||
power_a: 1 W ERP
|
||||
power: {a: 1 W ERP}
|
||||
- start: 1810
|
||||
end: 1850
|
||||
power_a: 750 W PEP
|
||||
power_e: 100 W PEP
|
||||
power: {a: 750 W PEP, e: 100 W PEP}
|
||||
- start: 1850
|
||||
end: 1890
|
||||
power_a: 75 W PEP
|
||||
power_e: 75 W PEP
|
||||
power: {a: 75 W PEP, e: 75 W PEP}
|
||||
- start: 1890
|
||||
end: 2000
|
||||
power_a: 10 W PEP
|
||||
power_e: 10 W PEP
|
||||
power: {a: 10 W PEP, e: 10 W PEP}
|
||||
- start: 3500
|
||||
end: 3800
|
||||
power_a: 750 W PEP
|
||||
power_e: 100 W PEP
|
||||
power: {a: 750 W PEP, e: 100 W PEP}
|
||||
- start: 5351.5
|
||||
end: 5366.5
|
||||
power_a: 15 W EIRP
|
||||
power: {a: 15 W EIRP}
|
||||
- start: 7000
|
||||
end: 7100
|
||||
power_a: 750 W PEP
|
||||
power: {a: 750 W PEP}
|
||||
- start: 7100
|
||||
end: 7200
|
||||
power_a: 750 W PEP
|
||||
power: {a: 750 W PEP}
|
||||
- start: 10100
|
||||
end: 10150
|
||||
power_a: 150 W PEP
|
||||
power: {a: 150 W PEP}
|
||||
- start: 14000
|
||||
end: 14350
|
||||
power_a: 750 W PEP
|
||||
power: {a: 750 W PEP}
|
||||
- start: 18068
|
||||
end: 18168
|
||||
power_a: 750 W PEP
|
||||
power: {a: 750 W PEP}
|
||||
- start: 21000
|
||||
end: 21450
|
||||
power_a: 750 W PEP
|
||||
power_e: 100 W PEP
|
||||
power: {a: 750 W PEP, e: 100 W PEP}
|
||||
- start: 24890
|
||||
end: 24990
|
||||
power_a: 750 W PEP
|
||||
power: {a: 750 W PEP}
|
||||
- start: 28000
|
||||
end: 29700
|
||||
power_a: 750 W PEP
|
||||
power_e: 100 W PEP
|
||||
power_n: 10 W ERP
|
||||
power: {a: 750 W PEP, e: 100 W PEP, n: 10 W ERP}
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
- header: true
|
||||
columns: [band, frequency, mode, bandwidth, description]
|
||||
part_columns: [description]
|
||||
titles: {
|
||||
band: Band,
|
||||
frequency: Frequency / kHz,
|
||||
mode: Mode,
|
||||
bandwidth: Bandwidth / Hz,
|
||||
description: Description
|
||||
}
|
||||
- band: 2.2 km
|
||||
mode: CW
|
||||
bandwidth: 200
|
||||
|
|
140
band-plan.html
140
band-plan.html
|
@ -77,74 +77,92 @@ div#togglebuttons>button {
|
|||
}
|
||||
|
||||
function add_power(add, p) {
|
||||
if (typeof add.power_a !== "undefined") {
|
||||
p["power_a"] = add.power_a;
|
||||
}
|
||||
if (typeof add.power_e !== "undefined") {
|
||||
p["power_e"] = add.power_e;
|
||||
}
|
||||
if (typeof add.power_n !== "undefined") {
|
||||
p["power_n"] = add.power_n;
|
||||
for (const [key, value] of Object.entries(add.power)) {
|
||||
p["power_" + key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function update_table(bands, additions) {
|
||||
var tdata = [];
|
||||
var base_header = {};
|
||||
var add_header = {};
|
||||
|
||||
// first, fill base_header
|
||||
bands.forEach((band) => {
|
||||
band.parts.forEach((part) => {
|
||||
let p = {
|
||||
"band": band.band,
|
||||
"frequency": typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end,
|
||||
"mode": band.mode,
|
||||
//"band_start": band.start,
|
||||
//"band_end": band.end,
|
||||
"bandwidth": band.bandwidth,
|
||||
"description": part.description,
|
||||
};
|
||||
let parts_already_added = false;
|
||||
additions.forEach((add) => {
|
||||
if (typeof part.at !== "undefined") {
|
||||
if (isInRange(part.at, add.start, add.end)) {
|
||||
// at single frequency
|
||||
add_power(add, p);
|
||||
}
|
||||
} else {
|
||||
// frequeny range
|
||||
if ((add.start == part.start) && (add.end == part.end)) {
|
||||
// ranges are the same
|
||||
add_power(add, p);
|
||||
} else if (isInRange(part.start, add.start, add.end) && isInRange(part.end, add.start, add.end)) {
|
||||
// range of part is inside of range of add
|
||||
add_power(add, p);
|
||||
if ((typeof band.header !== "undefined") && band.header) {
|
||||
base_header = structuredClone(band);
|
||||
}
|
||||
});
|
||||
|
||||
// then fill tdata
|
||||
bands.forEach((band) => {
|
||||
if ((typeof band.header === "undefined") || (band.header == false)) {
|
||||
band.parts.forEach((part) => {
|
||||
let p = {};
|
||||
base_header.columns.forEach((col) => {
|
||||
if (base_header.part_columns.includes(col)) {
|
||||
p[col] = part[col];
|
||||
} else {
|
||||
// part range is split by add range
|
||||
if (isInRange(add.start, part.start, part.end)) {
|
||||
// part range starts below add range
|
||||
let p_clone = structuredClone(p);
|
||||
let start = add.start;
|
||||
let end = part.end < add.end ? part.end : add.end;
|
||||
p_clone["frequency"] = start + '\u2013' + end;
|
||||
add_power(add, p_clone);
|
||||
tdata.push(p_clone);
|
||||
parts_already_added = true;
|
||||
} else if (isInRange(add.end, part.start, part.end)) {
|
||||
// add range starts below part range
|
||||
let p_clone = structuredClone(p);
|
||||
let start = part.start;
|
||||
let end = add.end;
|
||||
p_clone["frequency"] = start + '\u2013' + end;
|
||||
add_power(add, p_clone);
|
||||
tdata.push(p_clone);
|
||||
parts_already_added = true;
|
||||
p[col] = band[col];
|
||||
}
|
||||
});
|
||||
p["frequency"] = typeof part.at !== "undefined" ? part.at : part.start + '\u2013' + part.end;
|
||||
|
||||
// first, fill add_header
|
||||
additions.forEach((add) => {
|
||||
if ((typeof add.header !== "undefined") && add.header) {
|
||||
add_header = structuredClone(add);
|
||||
}
|
||||
});
|
||||
|
||||
// then fill tdata
|
||||
let parts_already_added = false;
|
||||
additions.forEach((add) => {
|
||||
if ((typeof add.header === "undefined") || (add.header == false)) {
|
||||
if (typeof part.at !== "undefined") {
|
||||
if (isInRange(part.at, add.start, add.end)) {
|
||||
// at single frequency
|
||||
add_power(add, p);
|
||||
}
|
||||
} else {
|
||||
// frequeny range
|
||||
if ((add.start == part.start) && (add.end == part.end)) {
|
||||
// ranges are the same
|
||||
add_power(add, p);
|
||||
} else if (isInRange(part.start, add.start, add.end) && isInRange(part.end, add.start, add.end)) {
|
||||
// range of part is inside of range of add
|
||||
add_power(add, p);
|
||||
} else {
|
||||
// part range is split by add range
|
||||
if (isInRange(add.start, part.start, part.end)) {
|
||||
// part range starts below add range
|
||||
let p_clone = structuredClone(p);
|
||||
let start = add.start;
|
||||
let end = part.end < add.end ? part.end : add.end;
|
||||
p_clone["frequency"] = start + '\u2013' + end;
|
||||
add_power(add, p_clone);
|
||||
tdata.push(p_clone);
|
||||
parts_already_added = true;
|
||||
} else if (isInRange(add.end, part.start, part.end)) {
|
||||
// add range starts below part range
|
||||
let p_clone = structuredClone(p);
|
||||
let start = part.start;
|
||||
let end = add.end;
|
||||
p_clone["frequency"] = start + '\u2013' + end;
|
||||
add_power(add, p_clone);
|
||||
tdata.push(p_clone);
|
||||
parts_already_added = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!parts_already_added) {
|
||||
tdata.push(p);
|
||||
}
|
||||
parts_already_added = false;
|
||||
});
|
||||
if (!parts_already_added) {
|
||||
tdata.push(p);
|
||||
}
|
||||
parts_already_added = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// require in tabular-tables
|
||||
|
@ -162,7 +180,7 @@ div#togglebuttons>button {
|
|||
autoColumnsDefinitions: function(definitions){
|
||||
definitions.forEach((column) => {
|
||||
if (column.field == "band") {
|
||||
column.sorter = function(a, b, aRow, bRow, column, dir, sorterParams) {
|
||||
column.sorter = function(a, b) {
|
||||
return parseFloat(new Measures().from(a).to('m')) - parseFloat(new Measures().from(b).to('m'));
|
||||
}
|
||||
}
|
||||
|
@ -173,6 +191,12 @@ div#togglebuttons>button {
|
|||
|
||||
column.headerFilter = "input";
|
||||
column.headerFilterFunc = filter_with_not;
|
||||
if (typeof base_header.titles[column.field] !== "undefined") {
|
||||
column.title = base_header.titles[column.field];
|
||||
}
|
||||
if (typeof add_header.titles[column.field] !== "undefined") {
|
||||
column.title = add_header.titles[column.field];
|
||||
}
|
||||
});
|
||||
|
||||
return definitions;
|
||||
|
|
Loading…
Reference in a new issue