import org.simantics.plant3d.actions.AddComponentAction;
import org.simantics.plant3d.actions.AddEquipmentAction;
import org.simantics.plant3d.actions.AddNozzleAction;
+import org.simantics.plant3d.actions.RemoveAndSplitAction;
import org.simantics.plant3d.actions.RoutePipeAction;
import org.simantics.plant3d.actions.TranslateInlineAction;
import org.simantics.plant3d.scenegraph.EndComponent;
import org.simantics.plant3d.scenegraph.InlineComponent;
import org.simantics.plant3d.scenegraph.Nozzle;
import org.simantics.plant3d.scenegraph.P3DRootNode;
-import org.simantics.plant3d.scenegraph.PipeRun;
import org.simantics.plant3d.scenegraph.PipelineComponent;
import org.simantics.plant3d.scenegraph.SchemaBuilder;
import org.simantics.plant3d.scenegraph.TurnComponent;
import org.simantics.plant3d.scenegraph.controlpoint.ControlPointFactory;
-import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
import org.simantics.plant3d.utils.ComponentUtils;
import org.simantics.plant3d.utils.Item;
private TranslateInlineAction translateInlineAction;
private RotateAction rotateAction;
private RemoveAction removeAction;
+ private RemoveAndSplitAction removeSplitAction;
private RoutePipeAction routePipeAction;
private AddComponentAction addComponentAction;
new ContextMenuListener(panel, contextMenu);
- cameraAction = new vtkCameraAndSelectorAction(panel);
+ cameraAction = createCameraAction();
panel.setDefaultAction(cameraAction);
panel.useDefaultAction();
panel.setPickType(4);
throw new RuntimeException("Scenegraph loading failed.");
populate();
- selectionProvider = new NodeSelectionProvider2<Resource,Object>(this,mapping,nodeMap);
+ selectionProvider = createSelectionProvider();
cameraAction.addSelectionChangedListener(selectionProvider);
- cameraAction.addHoverChangedListener(new HoverHighlighter(panel,nodeMap));
- selectionProvider.addSelectionChangedListener(new SelectionHighlighter(panel,nodeMap));
+ cameraAction.addHoverChangedListener(createHoverHighlhighter());
+ selectionProvider.addSelectionChangedListener(createSelectionHighlighter());
getSite().setSelectionProvider(selectionProvider);
getSite().getPage().addPostSelectionListener(selectionProvider);
}
+ protected vtkCameraAndSelectorAction createCameraAction() {
+ return new vtkCameraAndSelectorAction(panel);
+ }
+
+ protected NodeSelectionProvider2<Resource,Object> createSelectionProvider() {
+ return new NodeSelectionProvider2<Resource,Object>(this,mapping,nodeMap);
+ }
+
+ protected HoverHighlighter createHoverHighlhighter() {
+ return new HoverHighlighter(panel,nodeMap);
+ }
+
+ protected SelectionHighlighter<INode> createSelectionHighlighter() {
+ return new SelectionHighlighter<INode>(panel,nodeMap);
+ }
+
protected void createActions() {
translateAction = new TranslateAction(panel,nodeMap);
translateInlineAction = new TranslateInlineAction(panel, nodeMap);
removeAction = new RemoveAction(nodeMap) {
public void setNode(IG3DNode node) {
super.setNode(node);
-
-
}
};
+
+ removeSplitAction = new RemoveAndSplitAction(nodeMap);
routePipeAction = new RoutePipeAction(panel,rootNode);
addComponentAction = new AddComponentAction(panel, rootNode);
}
add.setEquipment((Equipment)node);
m.add(add);
}
+ m.add(removeAction);
} else if (node instanceof Nozzle) {
Nozzle nozzle = (Nozzle)node;
if (!nozzle.isFixed()) {
routePipeAction.setEnabled(nozzle.getNext() == null && nozzle.getPrevious() == null);
m.add(addComponentAction);
addComponentAction.setComponent(nozzle);
+ m.add(removeAction);
} else if (node instanceof TurnComponent) {
m.add(translateAction);
TurnComponent component = (TurnComponent)node;
routePipeAction.setEnabled(component.getNext() == null || component.getPrevious() == null);
m.add(addComponentAction);
addComponentAction.setComponent(component);
+ m.add(removeAction);
+ m.add(removeSplitAction);
+ removeSplitAction.setNode(node);
} else if (node instanceof EndComponent) {
m.add(translateAction);
m.add(addComponentAction);
addComponentAction.setComponent((PipelineComponent)node);
+ m.add(removeAction);
} else if (node instanceof InlineComponent) {
//m.add(translateInlineAction);
InlineComponent component = (InlineComponent)node;
routePipeAction.setComponent(component);
m.add(addComponentAction);
addComponentAction.setComponent(component);
+ m.add(removeAction);
+ m.add(removeSplitAction);
+ removeSplitAction.setNode(node);
+ } else {
+ m.add(removeAction);
}
- m.add(removeAction);
+
translateAction.setNode(node);
translateInlineAction.setNode(node);
rotateAction.setNode(node);
return result;
}
+ public InteractiveVtkComposite getPanel() {
+ return panel;
+ }
+
public P3DRootNode getRootNode() {
return rootNode;
}
public IMapping<Resource, Object> getMapping() {
return mapping;
}
+
+ public P3DNodeMap getNodeMap() {
+ return nodeMap;
+ }
}