Skip to content

Commit

Permalink
# Nieuw symbool magneetcontact in Schakelaars
Browse files Browse the repository at this point in the history
# Nieuw symbool Luidspreker in Media
  • Loading branch information
igoethal committed Jan 30, 2024
1 parent bbce0fd commit bb6f353
Show file tree
Hide file tree
Showing 12 changed files with 339 additions and 45 deletions.
2 changes: 1 addition & 1 deletion builddate.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var CONF_builddate="20240115-215745"
var CONF_builddate="20240129-213201"
127 changes: 111 additions & 16 deletions eendraadschema.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Hierarchical_List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class Hierarchical_List {
case 'Lichtcircuit': tempval = new Lichtcircuit(structure); break;
case 'Lichtpunt': tempval = new Lichtpunt(structure); break;
case 'Meerdere verbruikers': tempval = new Meerdere_verbruikers(structure); break;
case 'Media': tempval = new Media(structure); break;
case 'Microgolfoven': tempval = new Microgolfoven(structure); break;
case 'Motor': tempval = new Motor(structure); break;
case 'Omvormer': tempval = new Omvormer(structure); break;
Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Domotica_gestuurde_verbruiker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Domotica_gestuurde_verbruiker extends Electro_Item {
}

allowedChilds() : Array<string> { // returns an array with the type-names of allowed childs
return ["", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "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 ["", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "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"];
}

getMaxNumChilds(): number {
Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Electro_Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Electro_Item extends List_Item {
// -- Lijst met toegestande kinderen van het Electro_item --

allowedChilds() : Array<string> {
return ["", "Aansluiting", "Domotica", "Domotica gestuurde verbruiker", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "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 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"];
}

// -- Aantal actieve kinderen van het Electro_item --
Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Kring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class Kring extends Electro_Item {
}

allowedChilds() : Array<string> { // returns an array with the type-names of allowed childs
return ["", "Aansluiting", "Bord", "Domotica", "Domotica gestuurde verbruiker", "Kring", "Meerdere verbruikers", "Splitsing", "---", "Batterij", "Bel", "Boiler", "Contactdoos", "Diepvriezer", "Droogkast", "Drukknop", "Elektriciteitsmeter", "Elektrische oven", "EV lader", "Ketel", "Koelkast", "Kookfornuis", "Lichtcircuit", "Lichtpunt", "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 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"];
}

getMaxNumChilds(): number {
Expand Down
71 changes: 71 additions & 0 deletions src/List_Item/Media.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
class Media extends Electro_Item {

convertLegacyKeys(mykeys: Array<[string,string,any]>) {
//Nothing to do since Media did not exist when Legacy Keys where still a thing
}

resetProps() {
this.clearProps();
this.props.type = "Media";
this.props.adres = "";
this.props.aantal = 1;
this.props.symbool = "";
}

overrideKeys() {
if (this.props.symbool == 'luidspreker') {
if (this.props.aantal < 1) this.props.aantal = 1;
if (this.props.aantal > 20) this.props.aantal = 20;
} else {
this.props.aantal = 1;
}
}

toHTML(mode: string) {
this.overrideKeys();
let output = this.toHTMLHeader(mode);

output += "&nbsp;Nr: " + this.stringPropToHTML('nr',5)
+ ", Symbool: " + this.selectPropToHTML('symbool',["","luidspreker"]);

if (this.props.symbool == 'luidspreker') {
output += ", Aantal: " + this.selectPropToHTML('aantal',["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]);
}

output += ", Adres/tekst: " + this.stringPropToHTML('adres',5);

return(output);
}

toSVG() {
let mySVG:SVGelement = new SVGelement();

// Alles naar beneden schuiven als we het aantal laders boven het symbool willen plaatsen
var shifty = 0;
if (this.props.aantal>1) {
shifty = 15;
mySVG.data += '<text x="31" y="12" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.props.aantal) + '</text>'
}

mySVG.xleft = 1; // foresee at least some space for the conductor
mySVG.xright = 59;
mySVG.yup = 25 + shifty;
mySVG.ydown = 25;

switch (this.props.symbool) {
case "luidspreker":
mySVG.data += '<line x1="1" y1="' + (25 + shifty) + '" x2="21" y2="' + (25 + shifty) + '" stroke="black"></line>'
+ '<use xlink:href="#luidspreker" x="21" y="' + (25 + shifty) + '"></use>';
mySVG.xright = 36;
mySVG.data += this.addAddressToSVG(mySVG,60 + shifty,15,0);
break;
default:
mySVG.data += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>';
mySVG.xright = 19;
break;
}

return(mySVG);
}

}
2 changes: 1 addition & 1 deletion src/List_Item/Meerdere_verbruikers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meerdere_verbruikers extends Electro_Item {
}

allowedChilds() : Array<string> { // 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", "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", "Zonnepaneel", "---", "Aansluitpunt", "Aftakdoos", "Leeg", "Zeldzame symbolen"];
}

getMaxNumChilds(): number {
Expand Down
26 changes: 24 additions & 2 deletions src/List_Item/Schakelaars/Schakelaar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ class Schakelaar {
verklikkerlamp: boolean;
signalisatielamp: boolean;
trekschakelaar: boolean;
aantal: number;

constructor(type: String, halfwaterdicht: boolean=false, verklikkerlamp: boolean=false, signalisatielamp: boolean=false, trekschakelaar: boolean=false) {
constructor(type: String, halfwaterdicht: boolean=false, verklikkerlamp: boolean=false, signalisatielamp: boolean=false, trekschakelaar: boolean=false, aantal: number=1) {
this.type = type;
this.halfwaterdicht = halfwaterdicht;
this.verklikkerlamp = verklikkerlamp;
this.signalisatielamp = signalisatielamp;
this.trekschakelaar = trekschakelaar;
this.aantal = aantal;
}

schakelaarAttributentoSVGString(endx: number, isdubbel: boolean = false) {
Expand Down Expand Up @@ -160,6 +162,21 @@ class Schakelaar {
return({endx: endx, str: outputstr, lowerbound: null});
}

magneetcontacttoDrawReturnObj(startx: number): drawReturnObj {
let outputstr:string = "";
let endx = startx + 20;

// Alles naar beneden schuiven als we het aantal laders boven het symbool willen plaatsen
if (this.aantal>1) {
outputstr += '<text x="31" y="10" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">x' + htmlspecialchars(this.aantal) + '</text>'
}

outputstr += '<line x1="' + startx + '" x2="' + endx + '" y1="25" y2="25" stroke="black" />'
+ '<use xlink:href="#magneetcontact" x="' + endx + '" y="25" />';

return({endx: endx, str: outputstr, lowerbound: null});
}

defaulttoDrawReturnObj(startx: number, symbol: string): drawReturnObj {
let outputstr:string = "";
let endx = startx + 20;
Expand Down Expand Up @@ -233,6 +250,11 @@ class Schakelaar {
endx += 8;
lowerbound = Math.max(lowerbound,25);
break;
case "magneetcontact":
( {endx: endx, str: outputstr} = (this.magneetcontacttoDrawReturnObj(startx,)) );
endx += 20;
lowerbound = Math.max(lowerbound,25);
break;
case "schakelaar":
( {endx: endx, str: outputstr} = (this.defaulttoDrawReturnObj(startx,'#schakelaar')) );
endx += 40;
Expand Down Expand Up @@ -270,7 +292,7 @@ class Schakelaar {
( {endx: endx, str: outputstr} = (this.defaulttoDrawReturnObj(startx,'#tijdschakelaar')) );
endx += 40;
lowerbound = Math.max(lowerbound,30);
break;
break;
default:
endx = 30; //Indien type niet herkend wordt minstens deze variabele definieren
}
Expand Down
15 changes: 9 additions & 6 deletions src/List_Item/Schakelaars/Schakelaars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ class Schakelaars extends Electro_Item {

overrideKeys() {
switch (this.props.type_schakelaar) {
case "enkelpolig": this.props.aantal_schakelaars = String(Math.min(Number(this.props.aantal_schakelaars),5)); break;
case "dubbelpolig": this.props.aantal_schakelaars = String(Math.min(Number(this.props.aantal_schakelaars),2)); break;
default: this.props.aantal_schakelaars = "1"; break;
case "enkelpolig": this.props.aantal_schakelaars = String(Math.min(Number(this.props.aantal_schakelaars),5)); break;
case "dubbelpolig": this.props.aantal_schakelaars = String(Math.min(Number(this.props.aantal_schakelaars),2)); break;
case "magneetcontact": this.props.aantal_schakelaars = String(Math.min(Number(this.props.aantal_schakelaars),20)); break;
default: this.props.aantal_schakelaars = "1"; break;
}
if (!this.kanHalfwaterdichtZijn) this.props.is_halfwaterdicht = false;
if (!this.kanVerklikkerlampjeHebben) this.props.heeft_verklikkerlampje = false;
Expand All @@ -66,16 +67,17 @@ class Schakelaars extends Electro_Item {
let output = this.toHTMLHeader(mode);

output += "&nbsp;Nr: " + this.stringPropToHTML('nr',5);
output += ", " + this.selectPropToHTML('type_schakelaar',["enkelpolig", "dubbelpolig", "driepolig", "dubbelaansteking", "wissel_enkel", "wissel_dubbel", "kruis_enkel", "---", "schakelaar", "dimschakelaar", "dimschakelaar wissel", "bewegingsschakelaar", "schemerschakelaar", "---", "teleruptor", "relais", "dimmer", "tijdschakelaar", "minuterie", "thermostaat", "rolluikschakelaar"]);
output += ", " + this.selectPropToHTML('type_schakelaar',["enkelpolig", "dubbelpolig", "driepolig", "dubbelaansteking", "wissel_enkel", "wissel_dubbel", "kruis_enkel", "---", "schakelaar", "dimschakelaar", "dimschakelaar wissel", "bewegingsschakelaar", "schemerschakelaar", "---", "teleruptor", "relais", "dimmer", "tijdschakelaar", "minuterie", "thermostaat", "rolluikschakelaar", "---", "magneetcontact"]);

if (this.kanHalfwaterdichtZijn()) output += ", Halfwaterdicht: " + this.checkboxPropToHTML('is_halfwaterdicht');
if (this.kanVerklikkerlampjeHebben()) output += ", Verklikkerlampje: " + this.checkboxPropToHTML('heeft_verklikkerlampje');
if (this.kanSignalisatielampjeHebben()) output += ", Signalisatielampje: " + this.checkboxPropToHTML('heeft_signalisatielampje');
if (this.kanTrekschakelaarHebben()) output += ", Trekschakelaar: " + this.checkboxPropToHTML('is_trekschakelaar');

switch (this.props.type_schakelaar) {
case "enkelpolig": output += ", Aantal schakelaars: " + this.selectPropToHTML('aantal_schakelaars',["1","2","3","4","5"]); break;
case "dubbelpolig": output += ", Aantal schakelaars: " + this.selectPropToHTML('aantal_schakelaars',["1","2"]); break;
case "enkelpolig": output += ", Aantal schakelaars: " + this.selectPropToHTML('aantal_schakelaars',["1","2","3","4","5"]); break;
case "dubbelpolig": output += ", Aantal schakelaars: " + this.selectPropToHTML('aantal_schakelaars',["1","2"]); break;
case "magneetcontact": output += ", Aantal schakelaars: " + this.selectPropToHTML('aantal_schakelaars',["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"]); break;
}

output += ", Adres/tekst: " + this.stringPropToHTML('adres',5);
Expand All @@ -96,6 +98,7 @@ class Schakelaars extends Electro_Item {
case "minuterie": tekenKeten.push(new Schakelaar("minuterie")); break;
case "thermostaat": tekenKeten.push(new Schakelaar("thermostaat")); break;
case "tijdschakelaar": tekenKeten.push(new Schakelaar("tijdschakelaar")); break;
case "magneetcontact": tekenKeten.push(new Schakelaar("magneetcontact",false,false,false,false,this.props.aantal_schakelaars)); break;
case "rolluikschakelaar": tekenKeten.push(new Schakelaar("rolluikschakelaar",this.props.is_halfwaterdicht)); break;
case "dubbelaansteking": tekenKeten.push(new Schakelaar("dubbelaansteking",this.props.is_halfwaterdicht,this.props.heeft_verklikkerlampje,this.props.heeft_signalisatielampje,this.props.is_trekschakelaar)); break;
case "dimschakelaar": tekenKeten.push(new Schakelaar("dimschakelaar",this.props.is_halfwaterdicht,this.props.heeft_verklikkerlampje,this.props.heeft_signalisatielampje,false)); break;
Expand Down
7 changes: 7 additions & 0 deletions src/SVGSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ static outputSVGSymbols() {
<line x1="10" y1="-11" x2="11.11" y2="-9.34" stroke="black" stroke-width="1" />
<line x1="10" y1="-11" x2="8.34" y2="-9.9" stroke="black" stroke-width="1" />
</g>
<g id="luidspreker">
<polygon points="0,-10 7,-10 17,-20 17,20 7,10 0,10" fill="none" stroke="black"/>
<line x1="7" y1="-10" x2="7" y2="10" stroke="black" stroke-width="1" />
</g>
<g id="magneetcontact">
<rect x="0" y="-10" width="20" height="20" fill="black" stroke="black"/>
</g>
<g id="sinus">
<path d="M0,0 C2,-5 8,-5 10,0 S18,5 20,0" style="stroke:black;fill:none" />
</g>
Expand Down
Loading

0 comments on commit bb6f353

Please sign in to comment.