Commit e7c56ebd authored by legoc's avatar legoc
Browse files

Prepare new scale for trajectories

parent be755fdd
......@@ -19,6 +19,7 @@ class TrajectoryLine {
this._type = type;
this._center = center.clone();
this._data = [];
this._scale = 1.0;
this._deltaSphereGroup = new THREE.Group();
......@@ -73,6 +74,10 @@ class TrajectoryLine {
}
}
get type() {
return this._type;
}
set type(value) {
this._type = value;
......@@ -179,6 +184,10 @@ class TrajectoryLine {
this.updateDataGroup();
}
scale(value) {
this._scale = value;
}
calculateSegmentMatrix(start, end) {
let d = end.clone().sub(start).normalize();
......
......@@ -202,6 +202,20 @@ class TrajectoryView3D extends View3D {
let dE = this.calculateDE();
this._energyTranslationGroup.translateZ(-scalarWorldToView(dE));
}
scaleEnergy(value) {
// Iterate on the trajectory lines.
for (let id in this._trajectoryLines) {
let hklLine = this._trajectoryLines[id].hkl;
// Scale only lines that are ki or kf.
if (hklLine.type === 'ki' || hklLine.type === 'kf') {
let energyLine = this._trajectoryLines[id].energy;
energyLine.scale(value);
}
}
}
changeDisplayMode() {
if (displayMode.view == Constants.DisplayMode.SPE) {
......@@ -323,7 +337,7 @@ class TrajectoryView3D extends View3D {
* Clear all trajectories from the view.
*/
clearTrajectories() {
for(let id in this._trajectoryLines) {
for (let id in this._trajectoryLines) {
this.deleteTrajectory(id);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment