1 package org.simantics.processeditor.actions;
\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
8 import com.jme.math.Vector3f;
\r
9 import com.jme.scene.Geometry;
\r
11 public class ConfigureFloorAction extends Action {
\r
13 Geometry floorShape;
\r
14 ThreeDimensionalEditorBase editor;
\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
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
28 if (dialog.isFloorEnabled()) {
\r
29 if (floorShape.getParent() == null)
\r
30 editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape);
\r
32 floorShape.removeFromParent();
\r
34 floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));
\r
38 public void setFloorShape(Geometry floorShape) {
\r
39 this.floorShape = floorShape;
\r