Fix critical error: restored accidentally removed function declaration and added DB loading safety
Deploy Bürgerwind / deploy (push) Successful in 16s
Details
Deploy Bürgerwind / deploy (push) Successful in 16s
Details
This commit is contained in:
parent
d14eed0c7f
commit
4fe64857d9
9
app.js
9
app.js
|
|
@ -124,7 +124,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
|
|
||||||
// Calculation Functions
|
// Calculation Functions
|
||||||
function calculateGeometries(latlng, rotorDiameter, hubHeight, foundationRadius, ksfAngle = 0, ksfMirrored = false, hersteller = 'Enercon') {
|
function calculateGeometries(latlng, rotorDiameter, hubHeight, foundationRadius, ksfAngle = 0, ksfMirrored = false, hersteller = 'Enercon') {
|
||||||
// Ensure valid numbers for Turf
|
console.log(`Berechne Geometrien für ${hersteller}, RD=${rotorDiameter}, HH=${hubHeight}`);
|
||||||
const rd = parseFloat(rotorDiameter) || 160;
|
const rd = parseFloat(rotorDiameter) || 160;
|
||||||
const hh = parseFloat(hubHeight) || 165;
|
const hh = parseFloat(hubHeight) || 165;
|
||||||
const fr = parseFloat(foundationRadius) || 15;
|
const fr = parseFloat(foundationRadius) || 15;
|
||||||
|
|
@ -229,11 +229,16 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const blf = transform(blfCoords);
|
const blf = transform(blfCoords);
|
||||||
const ksf = transform(ksfCoords);
|
const ksf = transform(ksfCoords);
|
||||||
const mf = turf.featureCollection(mfParts.map(part => transform(part)));
|
const mf = turf.featureCollection(mfParts.map(part => transform(part)));
|
||||||
|
|
||||||
return { sweptArea, techDist, techDistSmall, loadRadius, foundation, blf, ksf, mf, totalHeight, utmCoords };
|
return { sweptArea, techDist, techDistSmall, loadRadius, foundation, blf, ksf, mf, totalHeight, utmCoords };
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Fehler in calculateGeometries:", err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateLabel(turbine, geoms) {
|
function updateLabel(turbine, geoms) {
|
||||||
|
|
@ -1925,7 +1930,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
if (dbTurbines.length > 0) {
|
if (dbTurbines.length > 0) {
|
||||||
// Clear existing turbines
|
// Clear existing turbines
|
||||||
state.turbines.forEach(t => {
|
state.turbines.forEach(t => {
|
||||||
|
if (t.layers && t.variant && variantLayers[t.variant]) {
|
||||||
Object.values(t.layers).forEach(l => variantLayers[t.variant].removeLayer(l));
|
Object.values(t.layers).forEach(l => variantLayers[t.variant].removeLayer(l));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
state.turbines = [];
|
state.turbines = [];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue