Commit 950a3ec0 authored by Ivan Dages's avatar Ivan Dages
Browse files

link between components and controllers

parent 5a17ea7a
......@@ -6,6 +6,7 @@ import java.util.logging.Logger;
import fr.ill.ics.bridge.Controller;
import fr.ill.ics.core.property.Property;
import fr.ill.ics.core.property.PropertyManager;
import fr.ill.ics.n3d.model.Component;
/**
* Wrapper for Nomad controller
......@@ -69,12 +70,20 @@ public class Nomad3DController {
/** Wrapped controller. */
private Controller controller;
/** Attached component. */
private Component component;
/**
* Constructor.
* @param controller Controller to wrap
*/
public Nomad3DController(Controller controller) {
this.controller = controller;
this.component = null;
}
public Component getComponent() {
return component;
}
public String getName() {
......@@ -99,6 +108,10 @@ public class Nomad3DController {
return Double.parseDouble(getPropertyServerValue("wanted_position"));
}
public double getOffsetPosition() {
return Double.parseDouble(getPropertyServerValue("offset_position"));
}
public double getMinPosition() {
return Double.parseDouble(getPropertyServerValue("min_position"));
}
......@@ -111,6 +124,10 @@ public class Nomad3DController {
return Type.fromUnitValue(getPropertyServerValue("unit"));
}
public void setComponent(Component component) {
this.component = component;
}
@Override
public String toString() {
return this.getName();
......
......@@ -3,6 +3,7 @@
*/
package fr.ill.ics.n3d.link;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import java.util.logging.Logger;
......@@ -79,6 +80,10 @@ public class NomadLinker {
return controllers.keySet();
}
public Collection<Nomad3DController> getControllers() {
return this.controllers.values();
}
// TODO TEST
public void displayProperties() {
String msg = "";
......
......@@ -14,6 +14,7 @@ import java.util.logging.Logger;
import com.interactivemesh.jfx.importer.stl.StlMeshImporter;
import fr.ill.ics.n3d.link.Nomad3DController;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
......@@ -102,6 +103,9 @@ public class Component {
*/
private ArrayList<Axis> computedAxes;
/** Attached controller, describing the Nomad axis. */
private Nomad3DController controller;
/**
* Default constructor.
*/
......@@ -119,6 +123,7 @@ public class Component {
this.configurations = new ArrayList<>();
this.treeItem = null;
this.wall = false;
this.controller = null;
}
/**
......@@ -210,6 +215,14 @@ public class Component {
return treeItem;
}
/**
* Gets the Nomad controller.
* @return The controller
*/
public Nomad3DController getController() {
return controller;
}
/**
* Sets the name of the component.
* @param name New name
......@@ -279,6 +292,14 @@ public class Component {
public void setWall(boolean wall) {
this.wall = wall;
}
/**
* Sets the Nomad controller
* @param controller New controller
*/
public void setController(Nomad3DController controller) {
this.controller = controller;
}
/**
* Adds a child to this component. If the child already has a parent, it is removed from its former parent children.
......
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