private enum ToolState{NOT_ACTIVE, INITIALIZING, SELECTING_POSITION, SELECTING_SPLIT, ROUTING};
private ToolState state = ToolState.NOT_ACTIVE;
- private ConstraintDetector detector = new DummyConstraintDetector();
+ private ConstraintDetector detector;// = new DummyConstraintDetector();
private boolean useDefault = false;
private Vector3d direction = null;
nodeMap = root.getNodeMap();
splitPointSelectionGizmo = new SplitPointSelectionGizmo(panel);
terminalSelectionGizmo = new TerminalSelectionGizmo(panel);
+ detector = new org.simantics.g3d.vtk.swt.ConstraintDetector(panel);
}
public void setComponent(PipelineComponent component) {
// selectionLine = null;
}
} else if (e.getButton() ==MouseEvent.BUTTON2){
- // detector.updateConstraintReference();
+ updateConstraints();
} else if (e.getButton() == MouseEvent.BUTTON3){
endPiping();
}
return true;
}
+ private void updateConstraints() {
+ detector.clearConstraints();
+ if (hoverObject == null) {
+ return;
+ }
+ if (hoverObject instanceof Nozzle) {
+ Nozzle n = (Nozzle)hoverObject;
+ detector.addContraintPoint(new Point3d(n.getWorldPosition()));
+ } else if (hoverObject instanceof InlineComponent) {
+ InlineComponent c = (InlineComponent)hoverObject;
+ Point3d p1 = new Point3d();
+ Point3d p2 = new Point3d();
+ c.getEnds(p1, p2);
+ detector.addContraintPoint(p1);
+ detector.addContraintPoint(p2);
+ } else if (hoverObject instanceof TurnComponent) {
+ TurnComponent n = (TurnComponent)hoverObject;
+ detector.addContraintPoint(new Point3d(n.getWorldPosition()));
+ }
+ }
+
@Override
public boolean mouseMoved(MouseEvent e) {
if (useDefault) {
return nodes;
}
-
+ INode hoverObject = null;
private void updateRouting(double x, double y) {
// if(input.keyPressed(KeyEvent.VK_ESCAPE)) {
- INode hoverObject = null;
+
List<INode> hover = isOverNode((int)x,(int)y);
if (hover.size() > 0) {
hoverObject = hover.get(0);
- }
+ } else {
+ hoverObject = null;
+ }
// System.out.println(hoverObject + " " + getLast());
if (hoverObject != null) {
if (hoverObject.equals(getLast()) ) {