X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Feditor%2FPlant3DEditor.java;h=033f8544cf6f71103130d6b7db37a986609959f0;hb=68bb44ea41644141aaaf7467ac3d201678e31db3;hp=9d0c3b820a289e912a3be846b5c55fa748ab0897;hpb=22bb24d2a7e26c70b0dd4c57080f2c25ac3d40a8;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 9d0c3b82..033f8544 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java @@ -31,11 +31,13 @@ import org.simantics.g3d.vtk.action.RemoveAction; import org.simantics.g3d.vtk.action.RotateAction; import org.simantics.g3d.vtk.action.TranslateAction; import org.simantics.g3d.vtk.action.vtkCameraAndSelectorAction; +import org.simantics.g3d.vtk.common.ContextMenuListener; import org.simantics.g3d.vtk.common.HoverHighlighter; import org.simantics.g3d.vtk.common.InteractiveVtkPanel; import org.simantics.g3d.vtk.common.NodeSelectionProvider2; import org.simantics.g3d.vtk.common.SelectionHighlighter; import org.simantics.g3d.vtk.shape.vtkShape; +import org.simantics.g3d.vtk.utils.AxesDisplay; import org.simantics.g3d.vtk.utils.vtkPanelUtil; import org.simantics.objmap.graph.IMapping; import org.simantics.objmap.graph.Mappings; @@ -44,6 +46,7 @@ import org.simantics.plant3d.actions.AddComponentAction; import org.simantics.plant3d.actions.AddEquipmentAction; import org.simantics.plant3d.actions.AddNozzleAction; import org.simantics.plant3d.actions.RoutePipeAction; +import org.simantics.plant3d.actions.TranslateInlineAction; import org.simantics.plant3d.scenegraph.EndComponent; import org.simantics.plant3d.scenegraph.Equipment; import org.simantics.plant3d.scenegraph.IP3DNode; @@ -94,6 +97,7 @@ public class Plant3DEditor extends ResourceEditorPart { private vtkCameraAndSelectorAction cameraAction; private TranslateAction translateAction; + private TranslateInlineAction translateInlineAction; private RotateAction rotateAction; private RemoveAction removeAction; private RoutePipeAction routePipeAction; @@ -128,21 +132,8 @@ public class Plant3DEditor extends ResourceEditorPart { component.syncPopulate(); - panel.addMouseListener(new java.awt.event.MouseAdapter() { - @Override - public void mouseClicked(final java.awt.event.MouseEvent e) { - if (e.getButton() == java.awt.event.MouseEvent.BUTTON3) { - Display.getDefault().asyncExec(new Runnable() { - public void run() { - contextMenu.setLocation(e.getXOnScreen(), e.getYOnScreen()); - contextMenu.setVisible(true); - } - }); - } - } - }); + new ContextMenuListener(panel, contextMenu); - cameraAction = new vtkCameraAndSelectorAction(panel); panel.setDefaultAction(cameraAction); panel.useDefaultAction(); @@ -255,6 +246,7 @@ public class Plant3DEditor extends ResourceEditorPart { } translateAction = new TranslateAction(panel,nodeMap); + translateInlineAction = new TranslateInlineAction(panel, nodeMap); rotateAction = new RotateAction(panel,nodeMap); removeAction = new RemoveAction(nodeMap) { public void setNode(IG3DNode node) { @@ -310,8 +302,6 @@ public class Plant3DEditor extends ResourceEditorPart { vtkSequencePass seq = new vtkSequencePass(); seq.SetPasses(passes); - - vtkCameraPass cameraPass = new vtkCameraPass(); cameraPass.SetDelegatePass(seq); @@ -335,34 +325,8 @@ public class Plant3DEditor extends ResourceEditorPart { ren1.AddActor(grid); panel.addDeletable(grid); - { - vtkAxesActor axes = new vtkAxesActor(); - axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(0,0,0); - axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().SetColor(0,0,0); - axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().SetColor(0,0,0); - axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetShadow(0); - axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().SetShadow(0); - axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().SetShadow(0); - axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff(); - axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff(); - axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().ItalicOff(); - axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().Delete(); - axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().Delete(); - axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().Delete(); - axes.GetXAxisCaptionActor2D().Delete(); - axes.GetYAxisCaptionActor2D().Delete(); - axes.GetZAxisCaptionActor2D().Delete(); - vtkOrientationMarkerWidget widget = new vtkOrientationMarkerWidget(); - widget.SetOutlineColor(0.9300, 0.5700, 0.1300 ); - widget.SetOrientationMarker(axes); - widget.SetInteractor(panel.getRenderWindowInteractor()); - //widget.SetViewport(0.8, 0.0, 1.0, 0.2); // bottom right - //widget.SetViewport(0.0, 0.0, 0.4, 0.4); - widget.SetViewport(0.0, 0.0, 0.2, 0.2); // bottom left - widget.SetEnabled(1); - widget.InteractiveOff(); - } - + AxesDisplay axesDisplay = new AxesDisplay(panel); + axesDisplay.show(); } @@ -421,6 +385,7 @@ public class Plant3DEditor extends ResourceEditorPart { } else if (node instanceof InlineComponent) { //m.add(translateInlineAction); InlineComponent component = (InlineComponent)node; + m.add(translateInlineAction); m.add(routePipeAction); routePipeAction.setComponent(component); m.add(addComponentAction); @@ -429,6 +394,7 @@ public class Plant3DEditor extends ResourceEditorPart { m.add(removeAction); translateAction.setNode(node); + translateInlineAction.setNode(node); rotateAction.setNode(node); removeAction.setNode(node);