+package org.simantics.processeditor.actions;\r
+\r
+import org.eclipse.jface.action.Action;\r
+import org.simantics.processeditor.Activator;\r
+import org.simantics.processeditor.dialogs.FloorConfigureDialog;\r
+import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;\r
+\r
+import com.jme.math.Vector3f;\r
+import com.jme.scene.Geometry;\r
+\r
+public class ConfigureFloorAction extends Action {\r
+ \r
+ Geometry floorShape;\r
+ ThreeDimensionalEditorBase editor;\r
+ \r
+ public ConfigureFloorAction(ThreeDimensionalEditorBase editor) {\r
+ setText("Configure floor");\r
+ setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png"));\r
+ this.editor = editor;\r
+ }\r
+ \r
+ public void run() {\r
+ if (floorShape == null)\r
+ throw new NullPointerException("FloorShape is null");\r
+ FloorConfigureDialog dialog = new FloorConfigureDialog(editor.getRenderingComposite().getShell());\r
+ if (dialog.open() == FloorConfigureDialog.CANCEL)\r
+ return;\r
+ if (dialog.isFloorEnabled()) {\r
+ if (floorShape.getParent() == null)\r
+ editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
+ } else {\r
+ floorShape.removeFromParent();\r
+ }\r
+ floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));\r
+ \r
+ }\r
+ \r
+ public void setFloorShape(Geometry floorShape) {\r
+ this.floorShape = floorShape;\r
+ }\r
+\r
+}\r