diff --git a/builddate.js b/builddate.js index ae84a11..bc150a2 100644 --- a/builddate.js +++ b/builddate.js @@ -1 +1 @@ -var CONF_builddate="20240715-204933" +var CONF_builddate="20240823-133216" diff --git a/eendraadschema.js b/eendraadschema.js index da9ca6d..946300a 100644 --- a/eendraadschema.js +++ b/eendraadschema.js @@ -313,7 +313,7 @@ var Electro_Item = /** @class */ (function (_super) { }; // -- Lijst met toegestande kinderen van het Electro_item -- Electro_Item.prototype.allowedChilds = function () { - return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; // -- Aantal actieve kinderen van het Electro_item -- Electro_Item.prototype.getNumChildsWithKnownType = function () { @@ -379,6 +379,13 @@ var Electro_Item = /** @class */ (function (_super) { }; // -- Type van het Electro_item teruggeven -- Electro_Item.prototype.getType = function () { return this.props.type; }; + // -- Checken of parent een gevraagd type is -- + Electro_Item.prototype.isChildOf = function (typestr) { + if (this.parent != 0) + return (this.getParent().getType() == typestr); + else + return false; + }; //-- Clear all keys, met uitzondering van nr indien er een nummer is -- Electro_Item.prototype.clearProps = function () { var oldnr; @@ -440,7 +447,7 @@ var Electro_Item = /** @class */ (function (_super) { var parent = this.getParent(); var consumerArray; if (parent == null) - consumerArray = ["", "Kring", "Aansluiting"]; + consumerArray = ["", "Aansluiting", "Zekering/differentieel", "Kring"]; else consumerArray = this.getParent().allowedChilds(); output += this.selectPropToHTML('type', consumerArray); @@ -1567,8 +1574,16 @@ var Bord = /** @class */ (function (_super) { // Voorzie 10 extra pixels rechts na de allerlaatste kring mySVG.xright += 10; // Schuif het geheel voldoende naar links om plaats te hebben voor label en eventuele aarding - var mintextsize = Math.max(30, svgTextWidth('<' + htmlspecialchars(this.props.naam) + '>', 10, 'font-weight="bold"') + 13); + var mintextsize = Math.max(30, svgTextWidth(htmlspecialchars(this.props.naam), 10, 'font-weight="bold"') + 13); var minxleft = mintextsize + (this.props.is_geaard ? 70 : 0); //Indien geaard hebben we 70 meer nodig + if (this.isChildOf("Aansluiting")) { + var maxTotalSize = 145; + if (this.getParent().props.type_kabel_voor_teller != "") + maxTotalSize = maxTotalSize + 50; + var lengthToAdd = Math.max(0, (maxTotalSize - minxleft)); + mintextsize = mintextsize + lengthToAdd; + minxleft = minxleft + lengthToAdd; + } if (mySVG.xleft <= minxleft) { // Minstens 100 pixels indien aarding mySVG.xright = mySVG.xleft + mySVG.xright - minxleft; mySVG.xleft = minxleft; @@ -1584,8 +1599,8 @@ var Bord = /** @class */ (function (_super) { // Voeg naam van het bord toe if (this.props.naam !== "") mySVG.data += '<' - + htmlspecialchars(this.props.naam) + '>'; + + 'style="text-anchor:start" font-family="Arial, Helvetica, sans-serif" font-weight="bold" font-size="10">' + + htmlspecialchars(this.props.naam) + ''; // Teken aarding onderaan if (this.props.is_geaard) mySVG.data += '' @@ -1968,7 +1983,7 @@ var Domotica_verticaal = /** @class */ (function (_super) { this.props.tekst = "Domotica"; }; Domotica_verticaal.prototype.allowedChilds = function () { - return ["", "Aansluiting", "Domotica", "Domotica gestuurde verbruiker", "Leiding", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Leiding", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; Domotica_verticaal.prototype.getMaxNumChilds = function () { return 256; @@ -2520,7 +2535,7 @@ var Kring = /** @class */ (function (_super) { } }; Kring.prototype.allowedChilds = function () { - return ["", "Aansluiting", "Bord", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Bord", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; Kring.prototype.getMaxNumChilds = function () { return 256; @@ -3218,7 +3233,7 @@ var Meerdere_verbruikers = /** @class */ (function (_super) { this.props.adres = ""; // Set Adres/tekst to "" when the item is cleared }; Meerdere_verbruikers.prototype.allowedChilds = function () { - return ["", "Domotica", "Domotica gestuurde verbruiker", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Omvormer", "Overspanningsbeveiliging", "Media", "Microgolfoven", "Motor", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Domotica", "Domotica gestuurde verbruiker", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Omvormer", "Overspanningsbeveiliging", "Media", "Microgolfoven", "Motor", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; Meerdere_verbruikers.prototype.getMaxNumChilds = function () { return 256; @@ -4130,6 +4145,175 @@ var Wasmachine = /** @class */ (function (_super) { }; return Wasmachine; }(Electro_Item)); +var Zekering = /** @class */ (function (_super) { + __extends(Zekering, _super); + function Zekering() { + return _super !== null && _super.apply(this, arguments) || this; + } + Zekering.prototype.convertLegacyKeys = function (mykeys) { }; // Not needed as this element didn't exist when we still had legacy keys + Zekering.prototype.resetProps = function () { + this.clearProps(); + this.props.type = "Zekering/differentieel"; // This is rather a formality as we should already have this at this stage + this.props.nr = ""; + this.props.aantal_polen = "2"; + this.props.bescherming = "automatisch"; + this.props.amperage = "20"; + this.props.differentieel_delta_amperage = "300"; + this.props.type_differentieel = ""; + this.props.curve_automaat = ""; + this.props.differentieel_is_selectief = false; + this.props.kortsluitvermogen = ""; + }; + Zekering.prototype.overrideKeys = function () { + if ((this.props.aantal_polen < 1) || (this.props.aantal_polen > 4)) + this.props.aantal_polen = "2"; //Test dat aantal polen bestaat + if ((this.props.bescherming != "differentieel") && (this.props.bescherming != "differentieelautomaat")) + this.props.differentieel_is_selectief = false; + if (!this.isChildOf("Kring")) + this.props.nr = ""; + }; + Zekering.prototype.toHTML = function (mode) { + this.overrideKeys(); + var output = this.toHTMLHeader(mode); + output += " "; + if (this.isChildOf("Kring")) + output = output + this.nrToHtml(); + output = output + this.selectPropToHTML('bescherming', ["automatisch", "differentieel", "differentieelautomaat", "smelt"]); + // Aantal polen en AmpĂ©rage + if ((this.props.bescherming != "geen")) + output += this.selectPropToHTML('aantal_polen', ["2", "3", "4", "-", "1"]) + this.stringPropToHTML('amperage', 2) + "A"; + // Specifieke input voor differentielen en automaten + switch (this.props.bescherming) { + case "differentieel": + output += ", \u0394 " + this.stringPropToHTML('differentieel_delta_amperage', 3) + "mA" + + ", Type:" + this.selectPropToHTML('type_differentieel', ["", "A", "B"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen', 3) + "kA" + + ", Selectief: " + this.checkboxPropToHTML('differentieel_is_selectief'); + break; + case "automatisch": + output += ", Curve:" + this.selectPropToHTML('curve_automaat', ["", "B", "C", "D"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen', 3) + "kA"; + break; + case "differentieelautomaat": + output += ", \u0394 " + this.stringPropToHTML('differentieel_delta_amperage', 3) + "mA" + + ", Curve:" + this.selectPropToHTML('curve_automaat', ["", "B", "C", "D"]) + + ", Type:" + this.selectPropToHTML('type_differentieel', ["", "A", "B"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen', 3) + "kA" + + ", Selectief: " + this.checkboxPropToHTML('differentieel_is_selectief'); + break; + } + return (output); + }; + Zekering.prototype.toSVG = function () { + var mySVG = new SVGelement(); + var outputstr = ""; + mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien + mySVG.xright = 50; + mySVG.yup = 25; + mySVG.ydown = 25; + mySVG.data += ''; + var numlines = 1; // Hier houden we het aantal lijnen tekst bij + switch (this.props.bescherming) { + case "automatisch": + numlines = 1; // Hier houden we het aantal lijnen tekst bij + // Basiscode voor het amperage + mySVG.data += '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + // Code om de curve toe te voegen + if ((this.props.curve_automaat == 'B') || (this.props.curve_automaat == 'C') || (this.props.curve_automaat == 'D')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Curve " + this.props.curve_automaat) + ''; + } + // Code om kortsluitvermogen toe te voegen + if ((this.props.kortsluitvermogen != '')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + case "differentieel": + numlines = 2; // Hier houden we het aantal lijnen tekst bij + // Basiscode voor het amperage + mySVG.data += '' + + '' + + '\u0394' + htmlspecialchars(this.props.differentieel_delta_amperage + "mA") + '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + // Code om het type toe te voegen + if ((this.props.type_differentieel == 'A') || (this.props.type_differentieel == 'B')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Type " + this.props.type_differentieel) + ''; + } + // Code om kortsluitvermogen toe te voegen + if ((this.props.kortsluitvermogen != '')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + case "differentieelautomaat": + numlines = 2; // Hier houden we het aantal lijnen tekst bij + // Basiscode voor het amperage + mySVG.data += '' + + '' + + '\u0394' + htmlspecialchars(this.props.differentieel_delta_amperage + "mA") + '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + // Code om de curve toe te voegen + if ((this.props.curve_automaat == 'B') || (this.props.curve_automaat == 'C') || (this.props.curve_automaat == 'D')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Curve " + this.props.curve_automaat) + ''; + } + // Code om het type toe te voegen + if ((this.props.type_differentieel == 'A') || (this.props.type_differentieel == 'B')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Type " + this.props.type_differentieel) + ''; + } + // Code om kortsluitvermogen toe te voegen + if ((this.props.kortsluitvermogen != '')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + case "smelt": + mySVG.data += '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + break; + } + mySVG.ydown = mySVG.ydown + 11 * (numlines - 1); + // Selectief differentieel tekenen indien van toepassing + if (this.props.differentieel_is_selectief) { //Differentieel is selectief + mySVG.data += '' + + '' + + '' + 'S' + ''; + mySVG.xright = mySVG.xright + 30; + } + mySVG.data += "\n"; + return (mySVG); + }; + return Zekering; +}(Electro_Item)); var Zeldzame_symbolen = /** @class */ (function (_super) { __extends(Zeldzame_symbolen, _super); function Zeldzame_symbolen() { @@ -4236,7 +4420,7 @@ var SVGSymbols = /** @class */ (function () { function SVGSymbols() { } SVGSymbols.outputSVGSymbols = function () { - var output = "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n V\n E\n E\n V\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n S\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n PIR\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n M\n \n \n \n \n kWh\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \"\n \"\n \"\n \n \n \n \n \n \n \n \n \n \n AC/DC\n USB\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -> shift x -7.5 y -15\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; + var output = "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n V\n E\n E\n V\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n S\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n PIR\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n M\n \n \n \n \n kWh\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \"\n \"\n \"\n \n \n \n \n \n \n \n \n \n \n AC/DC\n USB\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -> shift x -7.5 y -15\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; return (output); }; return SVGSymbols; @@ -4521,6 +4705,9 @@ var Hierarchical_List = /** @class */ (function () { case 'Zeldzame symbolen': tempval = new Zeldzame_symbolen(structure); break; + case 'Zekering/differentieel': + tempval = new Zekering(structure); + break; case 'Zonnepaneel': tempval = new Zonnepaneel(structure); break; @@ -5136,16 +5323,16 @@ function exportjson() { var listitem = _c[_b]; listitem.sourcelist = structure; } - // Compress the output structure and offer as download to the user. We are at version 003 + // Compress the output structure and offer as download to the user. We are at version 004 try { var decoder = new TextDecoder("utf-8"); var encoder = new TextEncoder(); var pako_inflated = new Uint8Array(encoder.encode(text)); var pako_deflated = new Uint8Array(pako.deflate(pako_inflated)); - text = "EDS0030000" + btoa(String.fromCharCode.apply(null, pako_deflated)); + text = "EDS0040000" + btoa(String.fromCharCode.apply(null, pako_deflated)); } catch (error) { - text = "TXT0030000" + text; + text = "TXT0040000" + text; } finally { download_by_blob(text, filename, 'data:text/eds;charset=utf-8'); @@ -5653,6 +5840,21 @@ function import_to_structure(mystring, redraw) { mystructure.data[i].props.type = "Contactdoos"; } } + //Vanaf versie 4 staan niet automatisch meer haakjes <> rond de benaming van borden. Indien kleiner dan versie 4 moeten we deze toevoegen + if (version < 4) { + if (version < 3) { + for (var i = 0; i < mystructure.length; i++) { + if ((mystructure.data[i].keys[0][2] === "Bord") && (mystructure.data[i].keys[10][2] !== "")) + mystructure.data[i].keys[10][2] = '<' + mystructure.data[i].keys[10][2] + '>'; + } + } + else { + for (var i = 0; i < mystructure.length; i++) { + if ((mystructure.data[i].props.type === "Bord") && (mystructure.data[i].props.naam !== "")) + mystructure.data[i].props.naam = '<' + mystructure.data[i].props.naam + '>'; + } + } + } /* We starten met het kopieren van data naar de eigenlijke structure. * Ook hier houden we er rekening mee dat in oude saves mogelijk niet alle info voorhanden was */ diff --git a/prop/prop_scripts.ts b/prop/prop_scripts.ts index adc681a..e785cb6 100644 --- a/prop/prop_scripts.ts +++ b/prop/prop_scripts.ts @@ -61,15 +61,15 @@ function exportjson() { listitem.sourcelist = structure; } - // Compress the output structure and offer as download to the user. We are at version 003 + // Compress the output structure and offer as download to the user. We are at version 004 try { let decoder = new TextDecoder("utf-8"); let encoder = new TextEncoder(); let pako_inflated = new Uint8Array(encoder.encode(text)); let pako_deflated = new Uint8Array(pako.deflate(pako_inflated)); - text = "EDS0030000" + btoa(String.fromCharCode.apply(null, pako_deflated)); + text = "EDS0040000" + btoa(String.fromCharCode.apply(null, pako_deflated)); } catch (error) { - text = "TXT0030000" + text; + text = "TXT0040000" + text; } finally { download_by_blob(text, filename, 'data:text/eds;charset=utf-8'); } diff --git a/src/Hierarchical_List.ts b/src/Hierarchical_List.ts index 6cede43..15519e2 100644 --- a/src/Hierarchical_List.ts +++ b/src/Hierarchical_List.ts @@ -211,6 +211,7 @@ class Hierarchical_List { case 'Warmtepomp/airco': tempval = new Warmtepomp(structure); break; case 'Wasmachine': tempval = new Wasmachine(structure); break; case 'Zeldzame symbolen': tempval = new Zeldzame_symbolen(structure); break; + case 'Zekering/differentieel': tempval = new Zekering(structure); break; case 'Zonnepaneel': tempval = new Zonnepaneel(structure); break; default: tempval = new Electro_Item(structure); } diff --git a/src/List_Item/Bord.ts b/src/List_Item/Bord.ts index b7f6582..db7895e 100644 --- a/src/List_Item/Bord.ts +++ b/src/List_Item/Bord.ts @@ -44,9 +44,16 @@ class Bord extends Electro_Item { // Schuif het geheel voldoende naar links om plaats te hebben voor label en eventuele aarding - let mintextsize = Math.max(30, svgTextWidth('<'+htmlspecialchars(this.props.naam)+'>',10,'font-weight="bold"') + 13); + let mintextsize = Math.max(30, svgTextWidth(htmlspecialchars(this.props.naam),10,'font-weight="bold"') + 13); let minxleft = mintextsize + (this.props.is_geaard ? 70 : 0); //Indien geaard hebben we 70 meer nodig - + if (this.isChildOf("Aansluiting")) { + let maxTotalSize = 145; + if (this.getParent().props.type_kabel_voor_teller != "") maxTotalSize = maxTotalSize + 50; + let lengthToAdd = Math.max(0,(maxTotalSize - minxleft)); + mintextsize = mintextsize + lengthToAdd; + minxleft = minxleft + lengthToAdd; + } + if (mySVG.xleft <= minxleft) { // Minstens 100 pixels indien aarding mySVG.xright = mySVG.xleft + mySVG.xright - minxleft; mySVG.xleft = minxleft; @@ -65,8 +72,8 @@ class Bord extends Electro_Item { // Voeg naam van het bord toe if (this.props.naam !== "") mySVG.data += '<' - + htmlspecialchars(this.props.naam)+'>'; + + 'style="text-anchor:start" font-family="Arial, Helvetica, sans-serif" font-weight="bold" font-size="10">' + + htmlspecialchars(this.props.naam)+''; // Teken aarding onderaan if (this.props.is_geaard) diff --git a/src/List_Item/Domotica_verticaal.ts b/src/List_Item/Domotica_verticaal.ts index f3b932c..d11f182 100644 --- a/src/List_Item/Domotica_verticaal.ts +++ b/src/List_Item/Domotica_verticaal.ts @@ -12,7 +12,7 @@ class Domotica_verticaal extends Electro_Item { } allowedChilds() : Array { // returns an array with the type-names of allowed childs - return ["", "Aansluiting", "Domotica", "Domotica gestuurde verbruiker", "Leiding", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Leiding", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; } getMaxNumChilds(): number { diff --git a/src/List_Item/Electro_Item.ts b/src/List_Item/Electro_Item.ts index b8c35ac..c6ef026 100644 --- a/src/List_Item/Electro_Item.ts +++ b/src/List_Item/Electro_Item.ts @@ -32,7 +32,7 @@ class Electro_Item extends List_Item { // -- Lijst met toegestande kinderen van het Electro_item -- allowedChilds() : Array { - return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; } // -- Aantal actieve kinderen van het Electro_item -- @@ -103,6 +103,12 @@ class Electro_Item extends List_Item { getType() : string { return this.props.type; } + // -- Checken of parent een gevraagd type is -- + + isChildOf(typestr: string) { + if (this.parent != 0) return (this.getParent().getType() == typestr); else return false; + } + //-- Clear all keys, met uitzondering van nr indien er een nummer is -- clearProps() { @@ -163,7 +169,7 @@ class Electro_Item extends List_Item { let parent:Electro_Item = this.getParent(); let consumerArray; - if (parent == null) consumerArray = ["", "Kring", "Aansluiting"]; + if (parent == null) consumerArray = ["", "Aansluiting", "Zekering/differentieel", "Kring"]; else consumerArray = this.getParent().allowedChilds() output += this.selectPropToHTML('type', consumerArray); diff --git a/src/List_Item/Kring.ts b/src/List_Item/Kring.ts index d570f5d..a0ee7b0 100644 --- a/src/List_Item/Kring.ts +++ b/src/List_Item/Kring.ts @@ -80,7 +80,7 @@ class Kring extends Electro_Item { } allowedChilds() : Array { // returns an array with the type-names of allowed childs - return ["", "Aansluiting", "Bord", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Bord", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; } getMaxNumChilds(): number { diff --git a/src/List_Item/Meerdere_verbruikers.ts b/src/List_Item/Meerdere_verbruikers.ts index b878bf2..cdb6323 100644 --- a/src/List_Item/Meerdere_verbruikers.ts +++ b/src/List_Item/Meerdere_verbruikers.ts @@ -13,7 +13,7 @@ class Meerdere_verbruikers extends Electro_Item { } allowedChilds() : Array { // returns an array with the type-names of allowed childs - return ["", "Domotica", "Domotica gestuurde verbruiker", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Omvormer", "Overspanningsbeveiliging", "Media", "Microgolfoven", "Motor", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Domotica", "Domotica gestuurde verbruiker", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Omvormer", "Overspanningsbeveiliging", "Media", "Microgolfoven", "Motor", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; } getMaxNumChilds(): number { diff --git a/src/List_Item/Zekering.ts b/src/List_Item/Zekering.ts new file mode 100644 index 0000000..8131bd0 --- /dev/null +++ b/src/List_Item/Zekering.ts @@ -0,0 +1,202 @@ +class Zekering extends Electro_Item { + + convertLegacyKeys(mykeys: Array<[string,string,any]>) {} // Not needed as this element didn't exist when we still had legacy keys + + resetProps() { + this.clearProps(); + this.props.type = "Zekering/differentieel"; // This is rather a formality as we should already have this at this stage + this.props.nr = ""; + this.props.aantal_polen = "2"; + this.props.bescherming = "automatisch"; + this.props.amperage = "20"; + this.props.differentieel_delta_amperage = "300"; + this.props.type_differentieel = ""; + this.props.curve_automaat = ""; + this.props.differentieel_is_selectief = false; + this.props.kortsluitvermogen = ""; + } + + overrideKeys() { + if ( ( (this.props.aantal_polen as number) < 1 ) || ( (this.props.aantal_polen as number) > 4 ) ) this.props.aantal_polen = "2"; //Test dat aantal polen bestaat + if ( (this.props.bescherming != "differentieel") && (this.props.bescherming != "differentieelautomaat") ) this.props.differentieel_is_selectief = false; + if (!this.isChildOf("Kring")) this.props.nr = ""; + } + + toHTML(mode: string) { + this.overrideKeys(); + let output = this.toHTMLHeader(mode); + + output += " "; + if (this.isChildOf("Kring")) output = output + this.nrToHtml(); + output = output + this.selectPropToHTML('bescherming',["automatisch","differentieel","differentieelautomaat","smelt"]); + + // Aantal polen en AmpĂ©rage + + if ( (this.props.bescherming != "geen") ) output += this.selectPropToHTML('aantal_polen',["2","3","4","-","1"]) + this.stringPropToHTML('amperage',2) + "A"; + + // Specifieke input voor differentielen en automaten + + switch (this.props.bescherming) { + + case "differentieel": + output += ", \u0394 " + this.stringPropToHTML('differentieel_delta_amperage',3) + "mA" + + ", Type:" + this.selectPropToHTML('type_differentieel',["","A","B"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen',3) + "kA" + + ", Selectief: " + this.checkboxPropToHTML('differentieel_is_selectief'); + break; + + case "automatisch": + output += ", Curve:" + this.selectPropToHTML('curve_automaat',["","B","C","D"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen',3) + "kA"; + break; + + case "differentieelautomaat": + output += ", \u0394 " + this.stringPropToHTML('differentieel_delta_amperage',3) + "mA" + + ", Curve:" + this.selectPropToHTML('curve_automaat',["","B","C","D"]) + + ", Type:" + this.selectPropToHTML('type_differentieel',["","A","B"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen',3) + "kA" + + ", Selectief: " + this.checkboxPropToHTML('differentieel_is_selectief'); + break; + + } + + return(output); + } + + toSVG() { + let mySVG:SVGelement = new SVGelement(); + let outputstr:string = ""; + + mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien + mySVG.xright = 50; + mySVG.yup = 25; + mySVG.ydown = 25; + + mySVG.data += ''; + + let numlines = 1; // Hier houden we het aantal lijnen tekst bij + + switch (this.props.bescherming) { + + case "automatisch": + numlines = 1; // Hier houden we het aantal lijnen tekst bij + + // Basiscode voor het amperage + mySVG.data += '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + + // Code om de curve toe te voegen + if ( (this.props.curve_automaat=='B') || (this.props.curve_automaat=='C') || (this.props.curve_automaat=='D') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Curve " + this.props.curve_automaat) + ''; + } + + // Code om kortsluitvermogen toe te voegen + if ( (this.props.kortsluitvermogen!='') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + + case "differentieel": + numlines = 2; // Hier houden we het aantal lijnen tekst bij + + // Basiscode voor het amperage + mySVG.data += '' + + '' + + '\u0394' + htmlspecialchars(this.props.differentieel_delta_amperage + "mA") + '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + + // Code om het type toe te voegen + if ( (this.props.type_differentieel=='A') || (this.props.type_differentieel=='B') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Type " + this.props.type_differentieel) + ''; + + } + + // Code om kortsluitvermogen toe te voegen + if ( (this.props.kortsluitvermogen!='') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + + case "differentieelautomaat": + + numlines = 2; // Hier houden we het aantal lijnen tekst bij + + // Basiscode voor het amperage + mySVG.data += '' + + '' + + '\u0394' + htmlspecialchars(this.props.differentieel_delta_amperage + "mA") + '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + + // Code om de curve toe te voegen + if ( (this.props.curve_automaat=='B') || (this.props.curve_automaat=='C') || (this.props.curve_automaat=='D') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Curve " + this.props.curve_automaat) + ''; + } + + // Code om het type toe te voegen + if ( (this.props.type_differentieel=='A') || (this.props.type_differentieel=='B') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Type " + this.props.type_differentieel) + ''; + + } + + // Code om kortsluitvermogen toe te voegen + if ( (this.props.kortsluitvermogen!='') ) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + + case "smelt": + + mySVG.data += '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + break; + } + + mySVG.ydown = mySVG.ydown + 11 * (numlines-1); + + // Selectief differentieel tekenen indien van toepassing + + if (this.props.differentieel_is_selectief) { //Differentieel is selectief + mySVG.data += '' + + '' + + '' + 'S' + ''; + mySVG.xright = mySVG.xright + 30; + } + + mySVG.data += "\n"; + + return(mySVG); + } + +} \ No newline at end of file diff --git a/src/SVGSymbols.ts b/src/SVGSymbols.ts index 11fa917..fee90c3 100644 --- a/src/SVGSymbols.ts +++ b/src/SVGSymbols.ts @@ -394,10 +394,18 @@ static outputSVGSymbols() { + + + + + + + + diff --git a/src/eendraadschema.js b/src/eendraadschema.js index da9ca6d..946300a 100644 --- a/src/eendraadschema.js +++ b/src/eendraadschema.js @@ -313,7 +313,7 @@ var Electro_Item = /** @class */ (function (_super) { }; // -- Lijst met toegestande kinderen van het Electro_item -- Electro_Item.prototype.allowedChilds = function () { - return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; // -- Aantal actieve kinderen van het Electro_item -- Electro_Item.prototype.getNumChildsWithKnownType = function () { @@ -379,6 +379,13 @@ var Electro_Item = /** @class */ (function (_super) { }; // -- Type van het Electro_item teruggeven -- Electro_Item.prototype.getType = function () { return this.props.type; }; + // -- Checken of parent een gevraagd type is -- + Electro_Item.prototype.isChildOf = function (typestr) { + if (this.parent != 0) + return (this.getParent().getType() == typestr); + else + return false; + }; //-- Clear all keys, met uitzondering van nr indien er een nummer is -- Electro_Item.prototype.clearProps = function () { var oldnr; @@ -440,7 +447,7 @@ var Electro_Item = /** @class */ (function (_super) { var parent = this.getParent(); var consumerArray; if (parent == null) - consumerArray = ["", "Kring", "Aansluiting"]; + consumerArray = ["", "Aansluiting", "Zekering/differentieel", "Kring"]; else consumerArray = this.getParent().allowedChilds(); output += this.selectPropToHTML('type', consumerArray); @@ -1567,8 +1574,16 @@ var Bord = /** @class */ (function (_super) { // Voorzie 10 extra pixels rechts na de allerlaatste kring mySVG.xright += 10; // Schuif het geheel voldoende naar links om plaats te hebben voor label en eventuele aarding - var mintextsize = Math.max(30, svgTextWidth('<' + htmlspecialchars(this.props.naam) + '>', 10, 'font-weight="bold"') + 13); + var mintextsize = Math.max(30, svgTextWidth(htmlspecialchars(this.props.naam), 10, 'font-weight="bold"') + 13); var minxleft = mintextsize + (this.props.is_geaard ? 70 : 0); //Indien geaard hebben we 70 meer nodig + if (this.isChildOf("Aansluiting")) { + var maxTotalSize = 145; + if (this.getParent().props.type_kabel_voor_teller != "") + maxTotalSize = maxTotalSize + 50; + var lengthToAdd = Math.max(0, (maxTotalSize - minxleft)); + mintextsize = mintextsize + lengthToAdd; + minxleft = minxleft + lengthToAdd; + } if (mySVG.xleft <= minxleft) { // Minstens 100 pixels indien aarding mySVG.xright = mySVG.xleft + mySVG.xright - minxleft; mySVG.xleft = minxleft; @@ -1584,8 +1599,8 @@ var Bord = /** @class */ (function (_super) { // Voeg naam van het bord toe if (this.props.naam !== "") mySVG.data += '<' - + htmlspecialchars(this.props.naam) + '>'; + + 'style="text-anchor:start" font-family="Arial, Helvetica, sans-serif" font-weight="bold" font-size="10">' + + htmlspecialchars(this.props.naam) + ''; // Teken aarding onderaan if (this.props.is_geaard) mySVG.data += '' @@ -1968,7 +1983,7 @@ var Domotica_verticaal = /** @class */ (function (_super) { this.props.tekst = "Domotica"; }; Domotica_verticaal.prototype.allowedChilds = function () { - return ["", "Aansluiting", "Domotica", "Domotica gestuurde verbruiker", "Leiding", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Leiding", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; Domotica_verticaal.prototype.getMaxNumChilds = function () { return 256; @@ -2520,7 +2535,7 @@ var Kring = /** @class */ (function (_super) { } }; Kring.prototype.allowedChilds = function () { - return ["", "Aansluiting", "Bord", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Aansluiting", "Bord", "Domotica", "Domotica module (verticaal)", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Media", "Microgolfoven", "Motor", "Omvormer", "Overspanningsbeveiliging", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; Kring.prototype.getMaxNumChilds = function () { return 256; @@ -3218,7 +3233,7 @@ var Meerdere_verbruikers = /** @class */ (function (_super) { this.props.adres = ""; // Set Adres/tekst to "" when the item is cleared }; Meerdere_verbruikers.prototype.allowedChilds = function () { - return ["", "Domotica", "Domotica gestuurde verbruiker", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Omvormer", "Overspanningsbeveiliging", "Media", "Microgolfoven", "Motor", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; + return ["", "Domotica", "Domotica gestuurde verbruiker", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "Omvormer", "Overspanningsbeveiliging", "Media", "Microgolfoven", "Motor", "Schakelaars", "Stoomoven", "Transformator", "USB lader", "Vaatwasmachine", "Ventilator", "Verlenging", "Verwarmingstoestel", "Verbruiker", "Vrije tekst", "Warmtepomp/airco", "Wasmachine", "Zekering/differentieel", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"]; }; Meerdere_verbruikers.prototype.getMaxNumChilds = function () { return 256; @@ -4130,6 +4145,175 @@ var Wasmachine = /** @class */ (function (_super) { }; return Wasmachine; }(Electro_Item)); +var Zekering = /** @class */ (function (_super) { + __extends(Zekering, _super); + function Zekering() { + return _super !== null && _super.apply(this, arguments) || this; + } + Zekering.prototype.convertLegacyKeys = function (mykeys) { }; // Not needed as this element didn't exist when we still had legacy keys + Zekering.prototype.resetProps = function () { + this.clearProps(); + this.props.type = "Zekering/differentieel"; // This is rather a formality as we should already have this at this stage + this.props.nr = ""; + this.props.aantal_polen = "2"; + this.props.bescherming = "automatisch"; + this.props.amperage = "20"; + this.props.differentieel_delta_amperage = "300"; + this.props.type_differentieel = ""; + this.props.curve_automaat = ""; + this.props.differentieel_is_selectief = false; + this.props.kortsluitvermogen = ""; + }; + Zekering.prototype.overrideKeys = function () { + if ((this.props.aantal_polen < 1) || (this.props.aantal_polen > 4)) + this.props.aantal_polen = "2"; //Test dat aantal polen bestaat + if ((this.props.bescherming != "differentieel") && (this.props.bescherming != "differentieelautomaat")) + this.props.differentieel_is_selectief = false; + if (!this.isChildOf("Kring")) + this.props.nr = ""; + }; + Zekering.prototype.toHTML = function (mode) { + this.overrideKeys(); + var output = this.toHTMLHeader(mode); + output += " "; + if (this.isChildOf("Kring")) + output = output + this.nrToHtml(); + output = output + this.selectPropToHTML('bescherming', ["automatisch", "differentieel", "differentieelautomaat", "smelt"]); + // Aantal polen en AmpĂ©rage + if ((this.props.bescherming != "geen")) + output += this.selectPropToHTML('aantal_polen', ["2", "3", "4", "-", "1"]) + this.stringPropToHTML('amperage', 2) + "A"; + // Specifieke input voor differentielen en automaten + switch (this.props.bescherming) { + case "differentieel": + output += ", \u0394 " + this.stringPropToHTML('differentieel_delta_amperage', 3) + "mA" + + ", Type:" + this.selectPropToHTML('type_differentieel', ["", "A", "B"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen', 3) + "kA" + + ", Selectief: " + this.checkboxPropToHTML('differentieel_is_selectief'); + break; + case "automatisch": + output += ", Curve:" + this.selectPropToHTML('curve_automaat', ["", "B", "C", "D"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen', 3) + "kA"; + break; + case "differentieelautomaat": + output += ", \u0394 " + this.stringPropToHTML('differentieel_delta_amperage', 3) + "mA" + + ", Curve:" + this.selectPropToHTML('curve_automaat', ["", "B", "C", "D"]) + + ", Type:" + this.selectPropToHTML('type_differentieel', ["", "A", "B"]) + + ", Kortsluitvermogen: " + this.stringPropToHTML('kortsluitvermogen', 3) + "kA" + + ", Selectief: " + this.checkboxPropToHTML('differentieel_is_selectief'); + break; + } + return (output); + }; + Zekering.prototype.toSVG = function () { + var mySVG = new SVGelement(); + var outputstr = ""; + mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien + mySVG.xright = 50; + mySVG.yup = 25; + mySVG.ydown = 25; + mySVG.data += ''; + var numlines = 1; // Hier houden we het aantal lijnen tekst bij + switch (this.props.bescherming) { + case "automatisch": + numlines = 1; // Hier houden we het aantal lijnen tekst bij + // Basiscode voor het amperage + mySVG.data += '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + // Code om de curve toe te voegen + if ((this.props.curve_automaat == 'B') || (this.props.curve_automaat == 'C') || (this.props.curve_automaat == 'D')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Curve " + this.props.curve_automaat) + ''; + } + // Code om kortsluitvermogen toe te voegen + if ((this.props.kortsluitvermogen != '')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + case "differentieel": + numlines = 2; // Hier houden we het aantal lijnen tekst bij + // Basiscode voor het amperage + mySVG.data += '' + + '' + + '\u0394' + htmlspecialchars(this.props.differentieel_delta_amperage + "mA") + '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + // Code om het type toe te voegen + if ((this.props.type_differentieel == 'A') || (this.props.type_differentieel == 'B')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Type " + this.props.type_differentieel) + ''; + } + // Code om kortsluitvermogen toe te voegen + if ((this.props.kortsluitvermogen != '')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + case "differentieelautomaat": + numlines = 2; // Hier houden we het aantal lijnen tekst bij + // Basiscode voor het amperage + mySVG.data += '' + + '' + + '\u0394' + htmlspecialchars(this.props.differentieel_delta_amperage + "mA") + '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + // Code om de curve toe te voegen + if ((this.props.curve_automaat == 'B') || (this.props.curve_automaat == 'C') || (this.props.curve_automaat == 'D')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Curve " + this.props.curve_automaat) + ''; + } + // Code om het type toe te voegen + if ((this.props.type_differentieel == 'A') || (this.props.type_differentieel == 'B')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("Type " + this.props.type_differentieel) + ''; + } + // Code om kortsluitvermogen toe te voegen + if ((this.props.kortsluitvermogen != '')) { + ++numlines; + mySVG.data += '' + + htmlspecialchars("" + this.props.kortsluitvermogen) + 'kA'; + } + break; + case "smelt": + mySVG.data += '' + + '' + + htmlspecialchars(this.props.aantal_polen + "P - " + this.props.amperage + "A") + ''; + break; + } + mySVG.ydown = mySVG.ydown + 11 * (numlines - 1); + // Selectief differentieel tekenen indien van toepassing + if (this.props.differentieel_is_selectief) { //Differentieel is selectief + mySVG.data += '' + + '' + + '' + 'S' + ''; + mySVG.xright = mySVG.xright + 30; + } + mySVG.data += "\n"; + return (mySVG); + }; + return Zekering; +}(Electro_Item)); var Zeldzame_symbolen = /** @class */ (function (_super) { __extends(Zeldzame_symbolen, _super); function Zeldzame_symbolen() { @@ -4236,7 +4420,7 @@ var SVGSymbols = /** @class */ (function () { function SVGSymbols() { } SVGSymbols.outputSVGSymbols = function () { - var output = "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n V\n E\n E\n V\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n S\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n PIR\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n M\n \n \n \n \n kWh\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \"\n \"\n \"\n \n \n \n \n \n \n \n \n \n \n AC/DC\n USB\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -> shift x -7.5 y -15\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; + var output = "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n V\n E\n E\n V\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n S\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n PIR\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n M\n \n \n \n \n kWh\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n t\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \"\n \n \n \n \n \n \n \n \n \n \"\n \"\n \"\n \n \n \n \n \n \n \n \n \n \n AC/DC\n USB\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n -> shift x -7.5 y -15\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n "; return (output); }; return SVGSymbols; @@ -4521,6 +4705,9 @@ var Hierarchical_List = /** @class */ (function () { case 'Zeldzame symbolen': tempval = new Zeldzame_symbolen(structure); break; + case 'Zekering/differentieel': + tempval = new Zekering(structure); + break; case 'Zonnepaneel': tempval = new Zonnepaneel(structure); break; @@ -5136,16 +5323,16 @@ function exportjson() { var listitem = _c[_b]; listitem.sourcelist = structure; } - // Compress the output structure and offer as download to the user. We are at version 003 + // Compress the output structure and offer as download to the user. We are at version 004 try { var decoder = new TextDecoder("utf-8"); var encoder = new TextEncoder(); var pako_inflated = new Uint8Array(encoder.encode(text)); var pako_deflated = new Uint8Array(pako.deflate(pako_inflated)); - text = "EDS0030000" + btoa(String.fromCharCode.apply(null, pako_deflated)); + text = "EDS0040000" + btoa(String.fromCharCode.apply(null, pako_deflated)); } catch (error) { - text = "TXT0030000" + text; + text = "TXT0040000" + text; } finally { download_by_blob(text, filename, 'data:text/eds;charset=utf-8'); @@ -5653,6 +5840,21 @@ function import_to_structure(mystring, redraw) { mystructure.data[i].props.type = "Contactdoos"; } } + //Vanaf versie 4 staan niet automatisch meer haakjes <> rond de benaming van borden. Indien kleiner dan versie 4 moeten we deze toevoegen + if (version < 4) { + if (version < 3) { + for (var i = 0; i < mystructure.length; i++) { + if ((mystructure.data[i].keys[0][2] === "Bord") && (mystructure.data[i].keys[10][2] !== "")) + mystructure.data[i].keys[10][2] = '<' + mystructure.data[i].keys[10][2] + '>'; + } + } + else { + for (var i = 0; i < mystructure.length; i++) { + if ((mystructure.data[i].props.type === "Bord") && (mystructure.data[i].props.naam !== "")) + mystructure.data[i].props.naam = '<' + mystructure.data[i].props.naam + '>'; + } + } + } /* We starten met het kopieren van data naar de eigenlijke structure. * Ook hier houden we er rekening mee dat in oude saves mogelijk niet alle info voorhanden was */ diff --git a/src/main.ts b/src/main.ts index 2a1ee82..c839df8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -604,6 +604,19 @@ function import_to_structure(mystring: string, redraw = true) { } } + //Vanaf versie 4 staan niet automatisch meer haakjes <> rond de benaming van borden. Indien kleiner dan versie 4 moeten we deze toevoegen + if (version < 4) { + if (version < 3) { + for (let i = 0; i < mystructure.length; i++) { + if ( (mystructure.data[i].keys[0][2] === "Bord") && (mystructure.data[i].keys[10][2] !== "") ) mystructure.data[i].keys[10][2] = '<' + mystructure.data[i].keys[10][2] + '>'; + } + } else { + for (let i = 0; i < mystructure.length; i++) { + if ( (mystructure.data[i].props.type === "Bord") && (mystructure.data[i].props.naam !== "") ) mystructure.data[i].props.naam = '<' + mystructure.data[i].props.naam + '>'; + } + } + } + /* We starten met het kopieren van data naar de eigenlijke structure. * Ook hier houden we er rekening mee dat in oude saves mogelijk niet alle info voorhanden was */