X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Feditor%2FPlant3DEditor.java;h=ba56f2f9201d0d1ca3d0c09dada69d7ee2284888;hb=refs%2Fchanges%2F28%2F3328%2F1;hp=b1bb5000995c394503504c3a3aa54a68bea3ab25;hpb=84132a1d750c45f9161afbd58b78572964e50d26;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java b/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java index b1bb5000..ba56f2f9 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java @@ -158,39 +158,8 @@ public class Plant3DEditor extends ResourceEditorPart { // 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); } @@ -235,6 +204,11 @@ public class Plant3DEditor extends ResourceEditorPart { return; } + createActions(); + + } + + protected void createActions() { translateAction = new TranslateAction(panel,nodeMap); translateInlineAction = new TranslateInlineAction(panel, nodeMap); rotateAction = new RotateAction(panel,nodeMap); @@ -247,7 +221,6 @@ public class Plant3DEditor extends ResourceEditorPart { }; routePipeAction = new RoutePipeAction(panel,rootNode); addComponentAction = new AddComponentAction(panel, rootNode); - } public void populate() { @@ -267,7 +240,7 @@ public class Plant3DEditor extends ResourceEditorPart { } protected P3DNodeMap createNodeMap(Session session, IMapping mapping, VtkView panel, P3DRootNode rootNode) { - return new P3DNodeMap(session, mapping, panel,rootNode); + return new P3DNodeMap(session, mapping, panel,rootNode); } @Override @@ -310,30 +283,30 @@ public class Plant3DEditor extends ResourceEditorPart { 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 selected = selectionProvider.getSelectedNodes(); @@ -353,9 +326,11 @@ public class Plant3DEditor extends ResourceEditorPart { m.add(add); } } 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); @@ -391,8 +366,8 @@ public class Plant3DEditor extends ResourceEditorPart { } } catch (DatabaseException e) { - ExceptionUtils.logAndShowError(e); - } + ExceptionUtils.logAndShowError(e); + } } private IContentOutlinePage createOutline() {