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;
// update control points.
// TODO : this should be optimized.
try {
- for (INode node : rootNode.getChild()) {
- if (node instanceof PipeRun) {
- for (PipelineComponent pc : ((PipeRun) node).getChild())
- pc.sync();
- } else if (node instanceof Equipment) {
- for (PipelineComponent pc : ((Equipment) node).getChild())
- pc.sync();
- }
- }
+ P3DUtil.finalizeDBLoad(rootNode);
- for (INode node : rootNode.getChild()) {
- if (node instanceof PipeRun) {
- for (PipelineComponent pc : ((PipeRun) node).getChild())
- pc.sync2();
- } else if (node instanceof Equipment) {
- for (PipelineComponent pc : ((Equipment) node).getChild())
- pc.sync2();
- }
- }
- for (INode node : rootNode.getChild()) {
- if (node instanceof PipeRun) {
- PipingRules.validate((PipeRun)node);
- }
- }
- PipingRules.setEnabled(true);
- for (INode node : rootNode.getChild()) {
- if (node instanceof PipeRun) {
- PipeRun run = (PipeRun)node;
- for (PipeControlPoint pcp : run.getControlPoints())
- PipingRules.positionUpdate(pcp);
-
- }
- }
} catch (Exception e) {
throw new DatabaseException(e);
}
return;
}
+ createActions();
+
+ }
+
+ protected void createActions() {
translateAction = new TranslateAction(panel,nodeMap);
translateInlineAction = new TranslateInlineAction(panel, nodeMap);
rotateAction = new RotateAction(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);
-
}
public void populate() {
}
protected P3DNodeMap createNodeMap(Session session, IMapping<Resource, Object> mapping, VtkView panel, P3DRootNode rootNode) {
- return new P3DNodeMap(session, mapping, panel,rootNode);
+ return new P3DNodeMap(session, mapping, panel,rootNode);
}
@Override
ren1.SetBackground(0.9,0.9,0.9);
ren1.SetGradientBackground(true);
- // vtkActor grid = vtkShape.createGridActor(8,1.0,1|2|4);
- vtkActor grid = vtkShape.createGridActor(8,1.0, 2 );
- grid.SetPickable(0);
- ren1.AddActor(grid);
- panel.addDeletable(grid);
-
- AxesDisplay axesDisplay = new AxesDisplay(panel);
- axesDisplay.show();
+ // vtkActor grid = vtkShape.createGridActor(8,1.0,1|2|4);
+ vtkActor grid = vtkShape.createGridActor(8,1.0, 2 );
+ grid.SetPickable(0);
+ ren1.AddActor(grid);
+ panel.addDeletable(grid);
+
+ AxesDisplay axesDisplay = new AxesDisplay(panel);
+ axesDisplay.show();
}
protected Menu contextMenu;
protected void hookContextMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu");
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- createContextMenu(manager);
- }
- });
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ createContextMenu(manager);
+ }
+ });
- contextMenu = menuMgr.createContextMenu(parent);
- }
+ contextMenu = menuMgr.createContextMenu(parent);
+ }
protected void createContextMenu(IMenuManager m) {
List<IG3DNode> selected = selectionProvider.getSelectedNodes();
add.setEquipment((Equipment)node);
m.add(add);
}
+ m.add(removeAction);
} else if (node instanceof Nozzle) {
- m.add(translateAction);
- m.add(rotateAction);
Nozzle nozzle = (Nozzle)node;
+ if (!nozzle.isFixed()) {
+ m.add(translateAction);
+ m.add(rotateAction);
+ }
m.add(routePipeAction);
routePipeAction.setComponent(nozzle);
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);
}
} catch (DatabaseException e) {
- ExceptionUtils.logAndShowError(e);
- }
+ ExceptionUtils.logAndShowError(e);
+ }
}
private IContentOutlinePage createOutline() {