]> gerrit.simantics Code Review - simantics/3d.git/blob
3cca915808c5fb32110b2e72d3c91c59da585513
[simantics/3d.git] /
1 package org.simantics.processeditor.actions;\r
2 \r
3 import org.eclipse.jface.action.Action;\r
4 import org.simantics.processeditor.Activator;\r
5 import org.simantics.processeditor.dialogs.FloorConfigureDialog;\r
6 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
7 \r
8 import com.jme.math.Vector3f;\r
9 import com.jme.scene.Geometry;\r
10 \r
11 public class ConfigureFloorAction extends Action {\r
12         \r
13         Geometry floorShape;\r
14         ThreeDimensionalEditorBase editor;\r
15         \r
16         public ConfigureFloorAction(ThreeDimensionalEditorBase editor) {\r
17                 setText("Configure floor");\r
18         setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png"));\r
19         this.editor = editor;\r
20         }\r
21         \r
22         public void run() {\r
23                 if (floorShape == null)\r
24                         throw new NullPointerException("FloorShape is null");\r
25                 FloorConfigureDialog dialog = new FloorConfigureDialog(editor.getRenderingComposite().getShell());\r
26                 if (dialog.open() == FloorConfigureDialog.CANCEL)\r
27                         return;\r
28                 if (dialog.isFloorEnabled()) {\r
29                         if (floorShape.getParent() == null)\r
30                                 editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
31                 } else {\r
32                         floorShape.removeFromParent();\r
33                 }\r
34                 floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));\r
35                 \r
36         }\r
37         \r
38         public void setFloorShape(Geometry floorShape) {\r
39                 this.floorShape = floorShape;\r
40         }\r
41 \r
42 }\r