diff --git a/index.html b/index.html index 7225f9a5..47fe6f0c 100644 --- a/index.html +++ b/index.html @@ -228,6 +228,14 @@ Process + + + Activator + + settings + + + LL Chamber diff --git a/src/app/featureSets/featureSet.js b/src/app/featureSets/featureSet.js index 7cf6dc23..2aed60bd 100644 --- a/src/app/featureSets/featureSet.js +++ b/src/app/featureSets/featureSet.js @@ -31,7 +31,7 @@ import ThreeDMixer from "../library/threeDMixer"; import Via from "../library/via"; //new - +import Activator from "../library/activator"; import Filter from "../library/filter"; import CellTrapS from "../library/celltrapS"; import ThreeDMux from "../library/threeDMux"; @@ -105,6 +105,10 @@ export default class FeatureSet { Via: { object: new Via(), key: "FLOW" }, //new + + Activator: { object: new Activator(), key: "FLOW" }, + Activator_control: { object: new Activator(), key: "CONTROL" }, + Filter: { object: new Filter(), key: "Flow" }, CellTrapS: { object: new CellTrapS(), key: "FLOW" }, CellTrapS_cell: { object: new CellTrapS(), key: "CELL" }, diff --git a/src/app/library/activator.js b/src/app/library/activator.js new file mode 100644 index 00000000..572d57a2 --- /dev/null +++ b/src/app/library/activator.js @@ -0,0 +1,199 @@ +import Template from "./template"; +import paper from "paper"; +import ComponentPort from "../core/componentPort"; + +export default class Activator extends Template { + constructor() { + super(); + } + + __setupDefinitions() { + this.__unique = { + position: "Point" + }; + + this.__heritable = { + componentSpacing: "Float", + rotation: "Float", + bendSpacing: "Float", + numberOfBends: "Float", + channelWidth: "Float", + bendLength: "Float", + rotation: "Float", + height: "Float", + temperature : "Float" + }; + + this.__defaults = { + componentSpacing: 1000, + rotation: 0, + channelWidth: 0.8 * 1000, + bendSpacing: 1.23 * 1000, + numberOfBends: 1, + rotation: 0, + bendLength: 2.46 * 1000, + height: 250, + temperature : 0.098 * 1000 + }; + + this.__units = { + componentSpacing: "μm", + rotation: "°", + bendSpacing: "μm", + numberOfBends: "", + channelWidth: "μm", + bendLength: "μm", + height: "μm", + temperature : "°C" + }; + + this.__minimum = { + componentSpacing: 0, + rotation: 0, + channelWidth: 10, + bendSpacing: 10, + numberOfBends: 1, + rotation: 0, + bendLength: 10, + height: 10, + temperature : 0 * 1000 + }; + + this.__maximum = { + componentSpacing: 10000, + rotation: 360, + channelWidth: 2000, + bendSpacing: 6000, + numberOfBends: 50, + rotation: 360, + bendLength: 12 * 10000, + height: 1200, + temperature : 0.15 * 1000 + }; + + this.__featureParams = { + componentSpacing: "componentSpacing", + position: "position", + channelWidth: "channelWidth", + bendSpacing: "bendSpacing", + numberOfBends: "numberOfBends", + rotation: "rotation", + bendLength: "bendLength", + temperature : "temperature" + }; + + this.__targetParams = { + componentSpacing: "componentSpacing", + channelWidth: "channelWidth", + bendSpacing: "bendSpacing", + numberOfBends: "numberOfBends", + rotation: "rotation", + bendLength: "bendLength", + temperature : "temperature" + }; + + this.__placementTool = "componentPositionTool"; + + this.__toolParams = { + position: "position" + }; + + this.__renderKeys = ["FLOW"]; + + this.__mint = "ACTIVATOR"; + } + + getPorts(params) { + let channelWidth = params["channelWidth"]; + let bendLength = params["bendLength"]; + let bendSpacing = params["bendSpacing"]; + let numberOfBends = params["numberOfBends"]; + + let ports = []; + + ports.push(new ComponentPort(bendLength / 2 + channelWidth, 0, "1", "FLOW")); + + ports.push(new ComponentPort(bendLength / 2 + channelWidth, (2 * numberOfBends + 1) * channelWidth + 2 * numberOfBends * bendSpacing, "2", "FLOW")); + + return ports; + } + + render2D(params, key) { + let channelWidth = params["channelWidth"]; + let bendLength = params["bendLength"]; + let bendSpacing = params["bendSpacing"]; + let rotation = params["rotation"]; + let numBends = params["numberOfBends"]; + let x = params["position"][0]; + let y = params["position"][1]; + let color = params["color"]; + let segHalf = bendLength / 2 + channelWidth; + let segLength = bendLength + 2 * channelWidth; + let segBend = bendSpacing + 2 * channelWidth; + let vRepeat = 2 * bendSpacing + 2 * channelWidth; + let vOffset = bendSpacing + channelWidth; + let hOffset = bendLength / 2 + channelWidth / 2; + let serp = new paper.CompoundPath(); + + //draw first segment + let toprect = new paper.Path.Rectangle(x + channelWidth - 1, y, bendLength / 2 + channelWidth / 2 + 1, channelWidth); + toprect.closed = true; + for (let i = 0; i < numBends; i++) { + //draw left curved segment + let leftCurve = new paper.Path.Arc({ + from: [x + channelWidth, y + vRepeat * i], + through: [x + channelWidth - (channelWidth + bendSpacing / 2), y + vRepeat * i + bendSpacing / 2 + channelWidth], + to: [x + channelWidth, y + vRepeat * i + bendSpacing + 2 * channelWidth] + }); + leftCurve.closed = true; + let leftCurveSmall = new paper.Path.Arc({ + from: [x + channelWidth, y + vRepeat * i + bendSpacing + channelWidth], + through: [x + channelWidth - bendSpacing / 2, y + vRepeat * i + bendSpacing / 2 + channelWidth], + to: [x + channelWidth, y + vRepeat * i + channelWidth] + }); + leftCurveSmall.closed = true; + leftCurve = leftCurve.subtract(leftCurveSmall); + toprect = toprect.unite(leftCurve); + // serp.addChild(leftCurve); + //draw horizontal segment + let hseg = new paper.Path.Rectangle(x + channelWidth - 1, y + vOffset + vRepeat * i, bendLength + 2, channelWidth); + toprect = toprect.unite(hseg); + //draw right curved segment + let rightCurve = new paper.Path.Arc({ + from: [x + channelWidth + bendLength, y + vOffset + vRepeat * i], + through: [x + channelWidth + bendLength + (channelWidth + bendSpacing / 2), y + vOffset + vRepeat * i + bendSpacing / 2 + channelWidth], + to: [x + channelWidth + bendLength, y + vOffset + vRepeat * i + bendSpacing + 2 * channelWidth] + }); + rightCurve.closed = true; + let rightCurveSmall = new paper.Path.Arc({ + from: [x + channelWidth + bendLength, y + vOffset + vRepeat * i + bendSpacing + channelWidth], + through: [x + channelWidth + bendLength + bendSpacing / 2, y + vOffset + vRepeat * i + bendSpacing / 2 + channelWidth], + to: [x + channelWidth + bendLength, y + vOffset + vRepeat * i + channelWidth] + }); + rightCurveSmall.closed = true; + rightCurve = rightCurve.subtract(rightCurveSmall); + toprect = toprect.unite(rightCurve); + + if (i == numBends - 1) { + //draw half segment to close + hseg = new paper.Path.Rectangle(x + channelWidth / 2 + bendLength / 2, y + vRepeat * (i + 1), (bendLength + channelWidth) / 2 + 1, channelWidth); + toprect = toprect.unite(hseg); + } else { + //draw full segment + hseg = new paper.Path.Rectangle(x + channelWidth - 1, y + vRepeat * (i + 1), bendLength + 2, channelWidth); + toprect = toprect.unite(hseg); + } + toprect = toprect.unite(hseg); + } + serp.addChild(toprect); + + serp.fillColor = color; + return serp.rotate(rotation, x, y);; + } + + render2DTarget(key, params) { + let render = this.render2D(params, key); + render.fillColor.alpha = 0.5; + return render; + } +} diff --git a/src/app/view/ui/componentToolBar.js b/src/app/view/ui/componentToolBar.js index 38148cfc..5e1dbc88 100644 --- a/src/app/view/ui/componentToolBar.js +++ b/src/app/view/ui/componentToolBar.js @@ -50,7 +50,8 @@ export default class ComponentToolBar { this.__llChamberButton = document.getElementById("llchamber_button"); this.__threeDMixerButton = document.getElementById("3dmixer_button"); - //new + //new + this.__activatorButton = document.getElementById("activator_button"); this.__filterButton = document.getElementById("filter_button"); this.__celltrapsButton = document.getElementById("celltraps_button"); this.__threeDMuxButton = document.getElementById("3dmux_button"); @@ -100,8 +101,9 @@ export default class ComponentToolBar { this.__threeDMixerParams = document.getElementById("3dmixer_params_button"); this.__insertTextDialog = new InsertTextDialog(); - + //new + this.__activatorParams = document.getElementById("activator_params_button"); this.__filterParams = document.getElementById("filter_params_button"); this.__celltrapsParams = document.getElementById("celltraps_params_button"); this.__threeDMuxParams = document.getElementById("3dmux_params_button"); @@ -152,6 +154,7 @@ export default class ComponentToolBar { "3DMixer": this.__threeDMixerButton, //newly added part + Activator: this.__activatorButton, Filter: this.__filterButton, CellTrapS: this.__celltrapsButton, "3DMux": this.__threeDMuxButton, @@ -166,12 +169,12 @@ export default class ComponentToolBar { DropletGenFlow: this.__dropletgenFlowButton, LogicArray: this.__logicarrayButton }; - + this.__setupEventHandlers(); this.__setupParamButtonEventHandlers(); - + } __setupEventHandlers() { @@ -236,7 +239,7 @@ export default class ComponentToolBar { ref.setActiveButton("Pump3D"); ref.__viewManagerDelegate.switchTo2D(); }; - + this.__alignmentMarksButton.onclick = function() { Registry.viewManager.activateTool("AlignmentMarks"); @@ -257,7 +260,7 @@ export default class ComponentToolBar { ref.setActiveButton("Port"); ref.__viewManagerDelegate.switchTo2D(); }; - + this.__anodeButton.onclick = function() {//ck Registry.viewManager.activateTool("Anode");//ck @@ -274,7 +277,7 @@ export default class ComponentToolBar { this.__viaButton.onclick = function() { Registry.viewManager.activateTool("Via"); - + ref.setActiveButton("Via"); ref.__viewManagerDelegate.switchTo2D(); }; @@ -392,6 +395,14 @@ export default class ComponentToolBar { }; //new + + this.__activatorButton.onclick = function() { + Registry.viewManager.activateTool("Activator"); + + ref.setActiveButton("Activator"); + ref.__viewManagerDelegate.switchTo2D(); + }; + this.__dropletgenTButton.onclick = function() { Registry.viewManager.activateTool("DropletGenT"); @@ -528,6 +539,7 @@ export default class ComponentToolBar { this.__threeDMixerParams.onclick = ComponentToolBar.getParamsWindowCallbackFunction("3DMixer", "Basic"); //new + this.__activatorParams.onclick = ComponentToolBar.getParamsWindowCallbackFunction("Activator", "Basic"); this.__filterParams.onclick = ComponentToolBar.getParamsWindowCallbackFunction("Filter", "Basic"); this.__celltrapsParams.onclick = ComponentToolBar.getParamsWindowCallbackFunction("CellTrapS", "Basic"); this.__threeDMuxParams.onclick = ComponentToolBar.getParamsWindowCallbackFunction("3DMux", "Basic"); diff --git a/src/app/view/viewManager.js b/src/app/view/viewManager.js index 4abf926a..f446a7e8 100644 --- a/src/app/view/viewManager.js +++ b/src/app/view/viewManager.js @@ -1220,6 +1220,7 @@ export default class ViewManager { this.tools["GenerateArrayTool"] = new GenerateArrayTool(); //new + this.tools["Activator"] = new MultilayerPositionTool("Activator", "Basic"); this.tools["Filter"] = new ComponentPositionTool("Filter", "Basic"); this.tools["CellTrapS"] = new CellPositionTool("CellTrapS", "Basic"); this.tools["3DMux"] = new MultilayerPositionTool("3DMux", "Basic");