Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activator Component Added #252

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@
</nav>
<span class="mdl-layout-title">Process</span>
<nav class="mdl-navigation" id="feature-process">

<div class="button_row">
<a id="activator_button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--raised feature-button">Activator</a>
<button id="activator_params_button" class="params-button mdl-button mdl-js-button mdl-button--icon">
<i class="material-icons">settings</i>
</button>
</div>

<div class="button_row">
<a id="llchamber_button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--raised feature-button">LL Chamber</a>
<button id="llchamber_params_button" class="params-button mdl-button mdl-js-button mdl-button--icon">
Expand Down
6 changes: 5 additions & 1 deletion src/app/featureSets/featureSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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" },
Expand Down
199 changes: 199 additions & 0 deletions src/app/library/activator.js
Original file line number Diff line number Diff line change
@@ -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: "&mu;m",
rotation: "&deg;",
bendSpacing: "&mu;m",
numberOfBends: "",
channelWidth: "&mu;m",
bendLength: "&mu;m",
height: "&mu;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;
}
}
26 changes: 19 additions & 7 deletions src/app/view/ui/componentToolBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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,
Expand All @@ -166,12 +169,12 @@ export default class ComponentToolBar {
DropletGenFlow: this.__dropletgenFlowButton,
LogicArray: this.__logicarrayButton
};


this.__setupEventHandlers();

this.__setupParamButtonEventHandlers();

}

__setupEventHandlers() {
Expand Down Expand Up @@ -236,7 +239,7 @@ export default class ComponentToolBar {
ref.setActiveButton("Pump3D");
ref.__viewManagerDelegate.switchTo2D();
};

this.__alignmentMarksButton.onclick = function() {
Registry.viewManager.activateTool("AlignmentMarks");

Expand All @@ -257,7 +260,7 @@ export default class ComponentToolBar {
ref.setActiveButton("Port");
ref.__viewManagerDelegate.switchTo2D();
};

this.__anodeButton.onclick = function() {//ck
Registry.viewManager.activateTool("Anode");//ck

Expand All @@ -274,7 +277,7 @@ export default class ComponentToolBar {

this.__viaButton.onclick = function() {
Registry.viewManager.activateTool("Via");

ref.setActiveButton("Via");
ref.__viewManagerDelegate.switchTo2D();
};
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/app/view/viewManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down