Skip to content

Commit

Permalink
# Enkele symbolen naar aparte class: Aansluitpunt / Aftakdoos / Zonne…
Browse files Browse the repository at this point in the history
…paneel

# Enkele symbolen iets in de breedte aangepast om geen gaps te hebben met aansluitende leidingen: Batterij / Boiler / Droogkast / Drukknop / Elektriciteitsmeter / Elektrische oven / Ketel / Koelkast / Kookfornuis / Microgolfoven / Motor / Omvormer / Overspanningsbeveiliging / Stoomovem / USB_lader / Vaatwasmachine / Ventilator / Wasmachine
# Symbool  batterij aangepast in SVGSymbols. Alles 1 pixel naar links
  • Loading branch information
igoethal committed Dec 10, 2023
1 parent 8ee7cca commit 32594f1
Show file tree
Hide file tree
Showing 27 changed files with 398 additions and 153 deletions.
2 changes: 1 addition & 1 deletion builddate.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var CONF_builddate="20231209-224057"
var CONF_builddate="20231210-131221"
175 changes: 127 additions & 48 deletions eendraadschema.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/Hierarchical_List.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class Hierarchical_List {
//Create the object
let tempval;
switch (electroType) {
case 'Aansluitpunt': tempval = new Aansluitpunt(structure); break;
case 'Aftakdoos': tempval = new Aftakdoos(structure); break;
case 'Batterij': tempval = new Batterij(structure); break;
case 'Bel': tempval = new Bel(structure); break;
case 'Boiler': tempval = new Boiler(structure); break;
Expand All @@ -190,6 +192,7 @@ class Hierarchical_List {
case 'Vaatwasmachine': tempval = new Vaatwasmachine(structure); break;
case 'Ventilator': tempval = new Ventilator(structure); break;
case 'Wasmachine': tempval = new Wasmachine(structure); break;
case 'Zonnepaneel': tempval = new Zonnepaneel(structure); break;
default: tempval = new Electro_Item(structure);
}
tempval.keys[0][2] = electroType;
Expand Down
37 changes: 37 additions & 0 deletions src/List_Item/Aansluitpunt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Aansluitpunt extends Electro_Item {

constructor(mylist: Hierarchical_List) { super(mylist); }

resetKeys() {
this.clearKeys();
this.keys[0][2] = "Aansluitpunt"; // This is rather a formality as we should already have this at this stage
this.keys[15][2] = ""; // Set Adres/tekst to "" when the item is cleared
}

toHTML(mode: string, Parent?: List_Item) {
let output = this.toHTMLHeader(mode, Parent);

output += " Nr: " + this.stringToHTML(10,5);
output += ", Adres/tekst: " + this.stringToHTML(15,5);

return(output);
}

toSVG(hasChild: Boolean = false) {
let mySVG:SVGelement = new SVGelement();

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

mySVG.data += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>'
+ '<use xlink:href="#aansluitpunt" x="21" y="25"></use>';

mySVG.data += this.addAddress(mySVG,45,0);
mySVG.data += "\n";

return(mySVG);
}

}
37 changes: 37 additions & 0 deletions src/List_Item/Aftakdoos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
class Aftakdoos extends Electro_Item {

constructor(mylist: Hierarchical_List) { super(mylist); }

resetKeys() {
this.clearKeys();
this.keys[0][2] = "Aftakdoos"; // This is rather a formality as we should already have this at this stage
this.keys[15][2] = ""; // Set Adres/tekst to "" when the item is cleared
}

toHTML(mode: string, Parent?: List_Item) {
let output = this.toHTMLHeader(mode, Parent);

output += "&nbsp;Nr: " + this.stringToHTML(10,5);
output += ", Adres/tekst: " + this.stringToHTML(15,5);

return(output);
}

toSVG(hasChild: Boolean = false) {
let mySVG:SVGelement = new SVGelement();

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

mySVG.data += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>'
+ '<use xlink:href="#aftakdoos" x="21" y="25"></use>';

mySVG.data += this.addAddress(mySVG,55,10);
mySVG.data += "\n";

return(mySVG);
}

}
2 changes: 1 addition & 1 deletion src/List_Item/Batterij.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Batterij extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Boiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Boiler extends Electro_Item {
let outputstr:string = "";

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

Expand Down
3 changes: 1 addition & 2 deletions src/List_Item/Droogkast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ class Droogkast extends Electro_Item {

toSVG(hasChild: Boolean = false) {
let mySVG:SVGelement = new SVGelement();
let outputstr:string = "";

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

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


mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien
mySVG.xright = 44;
mySVG.xright = 43;
mySVG.yup = 25;
mySVG.ydown = 25;

Expand Down
30 changes: 0 additions & 30 deletions src/List_Item/Electro_Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,6 @@ class Electro_Item extends List_Item {
output += ", Symbool: " + this.selectToHTML(16,["","deurslot"]);
output += ", Adres/tekst: " + this.stringToHTML(15,5);
break;
case "Zonnepaneel":
output += "&nbsp;Nr: " + this.stringToHTML(10,5) + ", ";
output += " Aantal: " + this.selectToHTML(4,["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40"]);
output += ", Adres/tekst: " + this.stringToHTML(15,5);
break;
case "Meerdere vebruikers":
output += "&nbsp;Nr: " + this.stringToHTML(10,5);
output += ", Adres/tekst: " + this.stringToHTML(15,5);
Expand Down Expand Up @@ -1075,18 +1069,6 @@ class Electro_Item extends List_Item {

switch (this.keys[0][2]) {
case "Leeg":
case "Aansluitpunt":
outputstr += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>';
outputstr += '<use xlink:href="#aansluitpunt" x="21" y="25"></use>';
mySVG.xright = 29;
outputstr += this.addAddress(mySVG,45,0);
break;
case "Aftakdoos":
outputstr += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>';
outputstr += '<use xlink:href="#aftakdoos" x="21" y="25"></use>';
mySVG.xright = 49;
outputstr += this.addAddress(mySVG,55,10);
break;
case "Lichtcircuit":
outputstr += this.toSVGswitches(hasChild, mySVG);
break;
Expand Down Expand Up @@ -1425,18 +1407,7 @@ class Electro_Item extends List_Item {
//Place adres underneath
outputstr += this.addAddress(mySVG,shifty+60,15);
break;
case "Zonnepaneel":
outputstr += '<line x1="1" y1="35" x2="21" y2="35" stroke="black"></line>';
outputstr += '<use xlink:href="#zonnepaneel" x="21" y="35"></use>';
outputstr += '<text x="45" y="9" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">' + htmlspecialchars(this.keys[4][2]) + 'x</text>';
mySVG.xright = 69;
mySVG.yup += 10;
//mySVG.ydown += 10;
outputstr += this.addAddress(mySVG,70,15);
break;

case "Zeldzame symbolen":

switch (this.keys[16][2]) {
case "deurslot":
outputstr += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>';
Expand All @@ -1448,7 +1419,6 @@ class Electro_Item extends List_Item {
outputstr += '<line x1="1" y1="25" x2="21" y2="25" stroke="black"></line>';
break;
}

break;
}
mySVG.data = outputstr + "\n";
Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Elektriciteitsmeter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Elektriciteitsmeter extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Elektrische_oven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Elektrische_oven extends Electro_Item {
let outputstr:string = "";

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

Expand Down
3 changes: 1 addition & 2 deletions src/List_Item/Ketel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class Ketel extends Electro_Item {

toSVG(hasChild: Boolean = false) {
let mySVG:SVGelement = new SVGelement();
let outputstr:string = "";

// Alles naar beneden schuiven als we het aantal laders boven het symbool willen plaatsen
var shifty = 0;
Expand All @@ -34,7 +33,7 @@ class Ketel extends Electro_Item {
}

mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien
mySVG.xright = 60;
mySVG.xright = 59;
mySVG.yup = 25 + shifty;
mySVG.ydown = 25;

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Koelkast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Koelkast extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Kookfornuis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Kookfornuis extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Microgolfoven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Microgolfoven extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Motor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Motor extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Omvormer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Omvormer extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Overspanningsbeveiliging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Overspanningsbeveiliging extends Electro_Item {
let outputstr:string = "";

mySVG.xleft = 1; // foresee at least some space for the conductor
mySVG.xright = 35;
mySVG.xright = 34;
mySVG.yup = 25;
mySVG.ydown = 25;

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Stoomoven.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Stoomoven extends Electro_Item {
let outputstr:string = "";

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

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

mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien
mySVG.xright = 80;
mySVG.xright = 79;
mySVG.yup = 25 + shifty;
mySVG.ydown = 25;

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Vaatwasmachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Vaatwasmachine extends Electro_Item {
let outputstr:string = "";

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

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Ventilator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Ventilator extends Electro_Item {
let outputstr:string = "";

mySVG.xleft = 1; // foresee at least some space for the conductor
mySVG.xright = 50;
mySVG.xright = 49;
mySVG.yup = 25;
mySVG.ydown = 25;

Expand Down
2 changes: 1 addition & 1 deletion src/List_Item/Wasmachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Wasmachine extends Electro_Item {
let outputstr:string = "";

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

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

constructor(mylist: Hierarchical_List) { super(mylist); }

resetKeys() {
this.clearKeys();
this.keys[0][2] = "Zonnepaneel"; // This is rather a formality as we should already have this at this stage
this.keys[4][2] = "1"; // Per default 1 zonnepaneel
this.keys[15][2] = ""; // Set Adres/tekst to "" when the item is cleared
}

toHTML(mode: string, Parent?: List_Item) {
let output = this.toHTMLHeader(mode, Parent);

output += "&nbsp;Nr: " + this.stringToHTML(10,5) + ", "
+ " Aantal: " + this.selectToHTML(4,["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40"])
+ ", Adres/tekst: " + this.stringToHTML(15,5);

return(output);
}

toSVG(hasChild: Boolean = false) {
let mySVG:SVGelement = new SVGelement();

mySVG.xleft = 1; // Links voldoende ruimte voor een eventuele kring voorzien
mySVG.xright = 69;
mySVG.yup = 35;
mySVG.ydown = 25;

mySVG.data += '<line x1="1" y1="35" x2="21" y2="35" stroke="black"></line>'
+ '<use xlink:href="#zonnepaneel" x="21" y="35"></use>'
+ '<text x="45" y="9" style="text-anchor:middle" font-family="Arial, Helvetica, sans-serif" font-size="10">' + htmlspecialchars(this.keys[4][2]) + 'x</text>';

// Adres helemaal onderaan plaatsen
mySVG.data += this.addAddress(mySVG,70,15);
mySVG.data += "\n";

return(mySVG);
}

}0
12 changes: 6 additions & 6 deletions src/SVGSymbols.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ static outputSVGSymbols() {
<line x1="0" y1="0" x2="0" y2="10" stroke="black" />
</pattern>
<g id="batterij">
<rect x="1" y="-12" width="40" height="27" stroke="black" fill="none"/>
<rect x="6" y="-15" width="10" height="3" stroke="black" fill="none"/>
<rect x="26" y="-15" width="10" height="3" stroke="black" fill="none"/>
<line x1="9" y1="-5" x2="13" y2="-5" stroke="black"/>
<line x1="11" y1="-7" x2="11" y2="-3" stroke="black"/>
<line x1="29" y1="-5" x2="33" y2="-5" stroke="black"/>
<rect x="0" y="-12" width="40" height="27" stroke="black" fill="none"/>
<rect x="5" y="-15" width="10" height="3" stroke="black" fill="none"/>
<rect x="25" y="-15" width="10" height="3" stroke="black" fill="none"/>
<line x1="8" y1="-5" x2="12" y2="-5" stroke="black"/>
<line x1="10" y1="-7" x2="10" y2="-3" stroke="black"/>
<line x1="28" y1="-5" x2="32" y2="-5" stroke="black"/>
</g>
<g id="deurslot">
<line x1="1" y1="-15" x2="31" y2="-15" stroke="black"/>
Expand Down
Loading

0 comments on commit 32594f1

Please sign in to comment.