Index: web/client/scripts/draw.js =================================================================== --- web/client/scripts/draw.js (revision 6563) +++ web/client/scripts/draw.js (revision 6564) @@ -8,6 +8,7 @@ * @param options.comm - communication interface * @param options.canvas - HTML canvas rendering context * @param options.colors - color chart for symbolic color names + * @param options.purposeMap - prescriptions based on layer group purposes */ function GraphicEngine(options) { this.options = Object.assign({}, options); @@ -17,6 +18,8 @@ this.cc = this.mainCc; this.colors = options.colors; this.unit = options.unit || "mm"; + this.purposeMap = options.purposeMap && typeof options.purposeMap === "object" ? + options.purposeMap : {}; this.cc.imageSmoothingEnabled = false; this.mainCc.setTransform(1, 0, 0, 1, 0, 0); @@ -207,18 +210,32 @@ if (Array.isArray(location) && location.length > 0) { locstr = location[0]; } + var purposes = []; var isMask = false; if (Array.isArray(purpose)) { for (var i = 0; i < purpose.length; i++) { + if (typeof purpose[i] === "string") { + purposes.push(purpose[i]); + } if (purpose[i] === "mask") { isMask = true; } } } + var props = {}; + if (Array.isArray(properties)) { + for (var i = 0; i < properties.length; i++) { + if (typeof properties[i] === "string") { + props[properties[i]] = true; + } + } + } this.layerGroups[id] = { name: name, id: id, location: locstr, + purposes: purposes, + props: props, isMask: isMask }; } @@ -235,8 +252,16 @@ this.cc = this.mainCc; } this.currentLayerGroup = this.layerGroups[id]; - var name = this.currentLayerGroup.name; - this.enableDraw = name !== "top mask" && name !== "bottom mask" && name !== "fab"; + this.enableDraw = true; + if (this.currentLayerGroup) { + var purposes = this.currentLayerGroup.purposes; + for (var i = 0; i < purposes.length; ++i) { + pe = this.purposeMap[purposes[i]]; + if (pe && pe.hidden) { + this.enableDraw = false; + } + } + } if (this.currentLayerGroup && this.currentLayerGroup.isMask) { this.cc = this.maskCc; this.cc.clearRect(0, 0, this.cc.canvas.width, this.cc.canvas.height); Index: web/testclient/draw.js =================================================================== --- web/testclient/draw.js (revision 6563) +++ web/testclient/draw.js (revision 6564) @@ -6,7 +6,8 @@ var draw = require("../client/scripts/draw"); -drawRemoteFile("../testdata/netlist.remote.gz"); +//drawRemoteFile("../testdata/netlist.remote.gz"); +drawRemoteFile("../testdata/poly_triangle.remote.gz"); //drawRemoteFile("../testdata/line_normal.remote.gz"); @@ -32,6 +33,11 @@ mainCc: mainCc, maskCc: maskCc, colors: { + }, + purposeMap: { + mask: { hidden: true }, + paste: { hidden: true }, + fab: { hidden: true } } });