diff --git a/builddate.js b/builddate.js index 5874ca9..217c8c1 100644 --- a/builddate.js +++ b/builddate.js @@ -1 +1 @@ -var CONF_builddate="20241015-230111" +var CONF_builddate="20241020-141725" diff --git a/eendraadschema.js b/eendraadschema.js index 149b518..efc29ac 100644 --- a/eendraadschema.js +++ b/eendraadschema.js @@ -107,6 +107,8 @@ function svgTextWidth(input, fontsize, options) { return (Math.ceil(width)); } function flattenSVG(SVGstruct, shiftx, shifty, node) { + if (node == 0) + structure.print_table.pagemarkers.clear(); var str = ""; var X = new XMLSerializer(); var parser = new DOMParser(); @@ -195,6 +197,7 @@ function flattenSVG(SVGstruct, shiftx, shifty, node) { var regex = /xmlns="[^"]+"/g; str = str.replace(regex, ''); } + structure.print_table.pagemarkers.addMarker(node, shiftx); return str; } function flattenSVGfromString(xmlstr) { @@ -239,6 +242,237 @@ var SVGelement = /** @class */ (function () { } return SVGelement; }()); +var Page_Info = /** @class */ (function () { + function Page_Info() { + this.height = 0; + this.start = 0; + this.stop = 0; + } + return Page_Info; +}()); +var MarkerList = /** @class */ (function () { + function MarkerList() { + this.clear(); + } + MarkerList.prototype.clear = function () { + this.markers = []; + }; + MarkerList.prototype.addMarker = function (depth, xpos) { + // Check if the marker already exists + var exists = this.markers.some(function (marker) { return marker.depth === depth && marker.xpos === xpos; }); + if (!exists) { + this.markers.push({ depth: depth, xpos: xpos }); + } + }; + MarkerList.prototype.sort = function () { + this.markers.sort(function (a, b) { return a.xpos - b.xpos; }); + }; + MarkerList.prototype.findMinDepth = function (min, max) { + // Filter markers within the range + var filteredMarkers = this.markers.filter(function (marker) { return marker.xpos > min && marker.xpos <= max; }); + if (filteredMarkers.length === 0) { + return { depth: null, xpos: max }; // No markers in the specified range so we just take the maximum + } + // Find the marker with the lowest depth + var minDepthMarker = filteredMarkers[0]; + for (var _i = 0, filteredMarkers_1 = filteredMarkers; _i < filteredMarkers_1.length; _i++) { + var marker = filteredMarkers_1[_i]; + if (marker.depth < minDepthMarker.depth || + (marker.depth === minDepthMarker.depth && marker.xpos > minDepthMarker.xpos)) { + minDepthMarker = marker; + } + } + return minDepthMarker; + }; + return MarkerList; +}()); +var Print_Table = /** @class */ (function () { + function Print_Table() { + this.enableAutopage = true; + this.height = 0; + this.maxwidth = 0; + this.displaypage = 0; + this.enableAutopage = true; + this.pages = new Array(); + var page_info; + page_info = new Page_Info(); + this.pages.push(page_info); + this.pagemarkers = new MarkerList; + } + Print_Table.prototype.setPaperSize = function (papersize) { + this.papersize = papersize; + }; + Print_Table.prototype.getPaperSize = function () { + if (!this.papersize) { + this.papersize = "A4"; + } + return (this.papersize); + }; + Print_Table.prototype.setHeight = function (height) { + var pagenum; + this.height = height; + for (pagenum = 0; pagenum < this.pages.length; pagenum++) { + this.pages[pagenum].height = height; + } + }; + Print_Table.prototype.getHeight = function () { + return (this.height); + }; + Print_Table.prototype.setModeVertical = function (mode) { + this.modevertical = mode; + }; + Print_Table.prototype.getModeVertical = function () { + this.forceCorrectFigures(); + return (this.modevertical); + }; + Print_Table.prototype.forceCorrectFigures = function () { + if (!this.modevertical) { + this.modevertical = "alles"; + } + switch (this.modevertical) { + case "kies": + this.starty = Math.min(Math.max(0, this.starty), this.height); + this.stopy = Math.min(Math.max(this.starty, this.stopy), this.height); + break; + default: + this.starty = 0; + this.stopy = this.height; + } + var pagenum; + this.pages[this.pages.length - 1].stop = this.maxwidth; + for (pagenum = 0; pagenum < this.pages.length; pagenum++) { + if (pagenum > 0) { + this.pages[pagenum].start = this.pages[pagenum - 1].stop; + } + if (this.pages[pagenum].stop > this.maxwidth) { + this.pages[this.pages.length - 1].stop = this.maxwidth; + } + ; + if (this.pages[pagenum].start > this.pages[pagenum].stop) { + this.pages[pagenum].start = this.pages[pagenum].stop; + } + ; + } + }; + Print_Table.prototype.setMaxWidth = function (maxwidth) { + this.maxwidth = maxwidth; + this.forceCorrectFigures(); + }; + Print_Table.prototype.getMaxWidth = function () { + return (this.maxwidth); + }; + Print_Table.prototype.getstarty = function () { + this.forceCorrectFigures(); + return (this.starty); + }; + Print_Table.prototype.getstopy = function () { + this.forceCorrectFigures(); + return (this.stopy); + }; + Print_Table.prototype.setstarty = function (starty) { + this.starty = starty; + this.forceCorrectFigures; + }; + Print_Table.prototype.setstopy = function (stopy) { + this.stopy = stopy; + this.forceCorrectFigures; + }; + Print_Table.prototype.setStop = function (page, stop) { + if (page > 0) { + if (stop < this.pages[page - 1].stop) + stop = this.pages[page - 1].stop; + } + if (page < this.pages.length - 1) { + if (stop > this.pages[page + 1].stop) + stop = this.pages[page + 1].stop; + } + if (stop > this.maxwidth) + stop = this.maxwidth; + this.pages[page].stop = stop; + this.forceCorrectFigures(); + }; + Print_Table.prototype.autopage = function () { + /* Autopage uses some ratio's determined by the useful SVG drawing size on the PDF. This depends on the margins configured in print.js + At present all of this is still hard-coded. Should become a function of print.js + + A4 + + Height: 210-20-30-5-5 --> 150 + Width: 297-20 --> 277 + Ratio: 1.8467 + + A3 + + Height: 297-20-30-5-5 --> 237 + Width: 420-20 --> 400 + Ratio: 1.6878 + */ + var height = this.getstopy() - this.getstarty(); + var maxsvgwidth = height * (this.getPaperSize() == "A3" ? 1.6878 : 1.8467); + var minsvgwidth = 3 / 4 * maxsvgwidth; + var page = 0; + var pos = 0; + while ((this.maxwidth - pos) > maxsvgwidth) { // The undivided part still does not fit on a page + pos = this.pagemarkers.findMinDepth(pos + minsvgwidth, pos + maxsvgwidth).xpos; + while (this.pages.length < page + 2) + this.addPage(); + this.setStop(page, pos); + page++; + } + // + this.setStop(page, this.maxwidth); + // Delete unneeded pages at the end + for (var i = this.pages.length - 1; i > page; i--) { + this.deletePage(i); + } + }; + Print_Table.prototype.addPage = function () { + var page_info; + page_info = new Page_Info(); + page_info.height = this.height; + page_info.start = this.pages[this.pages.length - 1].stop; + page_info.stop = this.maxwidth; + this.pages.push(page_info); + }; + Print_Table.prototype.deletePage = function (page) { + if (page == 0) { + this.pages[1].start = 0; + } + else { + this.pages[page - 1].stop = this.pages[page].stop; + } + this.pages.splice(page, 1); + }; + Print_Table.prototype.toHTML = function () { + if (structure.print_table.enableAutopage) + this.autopage(); + var outstr = ""; + var pagenum; + outstr += '
Pagina | Startx | Stopx | Acties |
---|---|---|---|
' + (pagenum + 1) + ' | ' + this.pages[pagenum].start + ' | '; + if (pagenum != this.pages.length - 1) { + outstr += ''; + } + else { + outstr += this.pages[pagenum].stop.toString(); + } + outstr += ' | '; + if (pagenum == this.pages.length - 1) { + outstr += ''; + } + if (this.pages.length > 1) { + outstr += ''; + } + outstr += ' |
Pagina | Start | Stop | Acties |
---|---|---|---|
' + (pagenum + 1) + ' | ' + this.pages[pagenum].start + ' | '; - if (pagenum != this.pages.length - 1) { - outstr += ''; - } - else { - outstr += this.pages[pagenum].stop.toString(); - } - outstr += ' | '; - if (pagenum == this.pages.length - 1) { - outstr += ''; - } - if (this.pages.length > 1) { - outstr += ''; - } - outstr += ' |
\n \n Welkom op \u00E9\u00E9ndraadschema\n \n\n Kies \u00E9\u00E9n van onderstaande voorbeelden om van te starten of start van een leeg schema (optie 3).\n \n \n \n Tip: Om de mogelijkheden van het programma te leren kennen is het vaak beter eerst een voorbeeldschema te\n bekijken alvorens van een leeg schema te vertrekken.\n \n \n |
\n Voorbeeld 1\n | \n\n Voorbeeld 2\n | \n\n Leeg schema\n | \n\n Openen\n | \n
\n \n \n Eenvoudig schema, enkel contactdozen en lichtpunten.\n \n | \n \n \n \n Iets complexer schema met teleruptoren, verbruikers achter contactdozen en gesplitste kringen.\n \n | \n \n \n \n"; var CONFIGPAGE_RIGHT = "\n \n | \n \n \n \n Open een schema dat u eerder heeft opgeslagen op uw computer (EDS-bestand). Enkel bestanden aangemaakt na 12 juli 2019 worden herkend.\n \n | \n
\n \n \n \n | \n \n \n \n \n | \n \n \n \n \n | \n \n \n \n \n | \n
Een créatie van Ivan Goethals
\nDit is een standalone versie (development) waarbij enkele functionaliteiten zijn uitgeschakeld.
\nGebruik de online versie op https://eendraadschema.goethals-jacobs.be om toegang te krijgen tot het contactformulier.
\nKies Bewerken in het menu om verder te gaan met tekenen.
\n \n"; function PROP_GDPR() { @@ -6043,7 +6133,7 @@ function HL_cancelFilename() { document.getElementById("settings").innerHTML = '' + structure.properties.filename + '
';
}
function HL_changeFilename() {
- var regex = new RegExp('^[-_ A-Za-z0-9]{2,}\\.eds$');
+ var regex = new RegExp('^.*\\.eds$');
var filename = document.getElementById("filename").value;
if (regex.test(filename)) {
structure.properties.setFilename(document.getElementById("filename").value);
@@ -6055,7 +6145,7 @@ function HL_changeFilename() {
}
}
function HL_enterSettings() {
- document.getElementById("settings").innerHTML = ' Gebruik enkel alphanumerieke karakters a-z A-Z 0-9, streepjes en spaties. Eindig met ".eds". Druk daarna op enter.';
- strleft += structure.print_table.toHTML() + ' '; - strleft += ' | ';
- strleft += 'Klik op de groene pijl om het schema over meerdere pagina\'s te printen en kies voor elke pagina de start- en stop-positie in het schema (in pixels). '
- + ' Onderaan kan je bekijken welk deel van het schema op welke pagina belandt. '; - strleft += ' |
';
+ strleft += structure.print_table.toHTML() + ' '; + strleft += ' | ';
+ strleft += 'Klik op de groene pijl om het schema over meerdere pagina\'s te printen en kies voor elke pagina de start- en stop-positie in het schema (in pixels). '
+ + ' Onderaan kan je bekijken welk deel van het schema op welke pagina belandt. '; + strleft += ' |
Sla tekening hieronder op als SVG en converteer met een ander programma naar PDF (bvb Inkscape). |
Pagina | Start | Stop | Acties | |
---|---|---|---|---|
Pagina | Startx | Stopx | Acties | ' + (pagenum+1) + ' | ' + this.pages[pagenum].start + ' | ';
diff --git a/src/config.ts b/src/config.ts
index 4ece1ee..93ae39f 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -89,8 +89,8 @@ var CONFIGPRINTPAGE:string = `
`; -var EXAMPLE0 = `EDS0040000eJztWe9r6zYU/VeMv84rjp0fNIyxtoO38bZPHd2gPIxi3TiqFcnITtL20fe370h2Yue9NEvSDl6hUIp9pXt1dc6VdBR/9iWprJr549554HNWMX98+9kXHIbAL5ghVfnjMPCF4uvHVEvJip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1kt6IdI0AdC6C6/Aps1GUZ4jkE5FsIpKdQ+Sz+68T8LvO/NpzisCNP7RxUF/bCsidTF9fLc4chAGBtFSmXHbKj0X//YSMkKTLHd6regw4duiZtsymtuRTW/J/m4+f0v9hQG7pngrdEtZNP1mnf3TNRG/SOIvzeHbLRJQJZYClRqaDhk8LkrntezZM5xpVveZRv3wTiwZ2d0ryekpfp6y1bzXsB/eEFaiZHm2skygfwA27yhN2H8tk2bsBt0HnhwoI30qkpgRVAfce6MP04gCwHxH2B9wWaLy8uu9324w1YWk5HHt9V4oGGxq+RjTSAUie7wYuUDKsvTP9d39NW4A1jhbVOmB/fLt0764CRYQo4XNCv4joEk5ANnxDXUQv8iwi+/Fh+8erL0f76QW+bEBRzPaQ7ALGZO+lbVCZiyVy+w1Ve1hISmLD829NcJYFYaDeZ2V520a7KMuT6+j7PIk+3bMA9Klwk+eDlFy4VEE8/gDGURmI`; diff --git a/src/general.ts b/src/general.ts index 8d4fe94..a4b5862 100644 --- a/src/general.ts +++ b/src/general.ts @@ -44,6 +44,9 @@ function svgTextWidth(input:String, fontsize:Number = 10, options:String = '') { } function flattenSVG(SVGstruct,shiftx,shifty,node) { + + if (node==0) structure.print_table.pagemarkers.clear(); + var str:string = ""; var X = new XMLSerializer() @@ -131,6 +134,9 @@ function flattenSVG(SVGstruct,shiftx,shifty,node) { var regex = /xmlns="[^"]+"/g; str = str.replace(regex, ''); } + + structure.print_table.pagemarkers.addMarker(node,shiftx); + return str; } diff --git a/src/importExport.ts b/src/importExport.ts index a0d1944..6684525 100644 --- a/src/importExport.ts +++ b/src/importExport.ts @@ -241,6 +241,11 @@ function json_to_structure(text: string, version = 0, redraw = true) { structure.print_table.setModeVertical(mystructure.print_table.modevertical); structure.print_table.setstarty(mystructure.print_table.starty); structure.print_table.setstopy(mystructure.print_table.stopy); + if (typeof mystructure.print_table.enableAutopage != "undefined") { + structure.print_table.enableAutopage = mystructure.print_table.enableAutopage; + } else { + structure.print_table.enableAutopage = false; + } for (let i=0; i '; + document.getElementById("settings").innerHTML = ' Gebruik enkel alphanumerieke karakters a-z A-Z 0-9, streepjes en spaties. Eindig met ".eds". Druk daarna op enter. '; } function HLRedrawTreeHTML() { @@ -213,6 +213,17 @@ function HLChangeStopY() { function HLChangePaperSize() { structure.print_table.setPaperSize((document.getElementById("id_papersize") as HTMLInputElement).value); + printsvg(); +} + +function HLupdateAutopage() { + structure.print_table.enableAutopage = !((document.getElementById("autopage") as HTMLInputElement).checked); + printsvg(); +} + +function HLsuggestPages() { + structure.print_table.autopage(); + printsvg(); } function buildNewStructure(structure: Hierarchical_List) { @@ -424,7 +435,7 @@ function printsvg() { var width = outSVG.xleft + outSVG.xright; structure.print_table.setHeight(height); - structure.print_table.setMaxWidth(width); + structure.print_table.setMaxWidth(width); // foresee some extra space for items like boiler that sometimes go our of their box strleft += ' '; @@ -441,20 +452,39 @@ function printsvg() { strleft += ' '; + if (structure.print_table.enableAutopage) { + strleft += ' '; + structure.print_table.setModeVertical("alles"); + structure.print_table.autopage(); + } else { + strleft += ' '; + strleft += ''; + + switch (structure.print_table.getModeVertical()) { + case "kies": + strleft += 'Hoogte '; + strleft += ' StartY '; + strleft += ''; + strleft += ' StopY ' + strleft += ''; + break; + case "alles": + default: + strleft += 'Hoogte '; + } + strleft += ''; - strleft += '
'; strleft += 'Printvoorbeeld: Pagina '; + strleft += ' (Enkel tekening, kies "Genereer PDF" om ook de tekstuele gegevens te zien)'; - switch (structure.print_table.getModeVertical()) { - case "kies": - strleft += 'Hoogte '; - strleft += ' StartY '; - strleft += ''; - strleft += ' StopY ' - strleft += ''; - break; - case "alles": - default: - strleft += 'Hoogte '; - } + strleft += ' '; strleft += '
'; diff --git a/src/tsconfig.json b/src/tsconfig.json index 7bc3a3a..fc82034 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -8,6 +8,7 @@ "include": [ "general.ts", "SVGelement.ts", + "Print_Table.ts", "importExport.ts", "undoRedo.ts", "List_Item/List_Item.ts", @@ -19,7 +20,6 @@ "Properties.ts", "SVGSymbols.ts", "Hierarchical_List.ts", - "Print_Table.ts", "config.ts", "../prop/prop_scripts.ts", "main.ts" |