1 /*******************************************************************************
\r
2 * Copyright (c) 2007- VTT Technical Research Centre of Finland.
\r
3 * All rights reserved. This program and the accompanying materials
\r
4 * are made available under the terms of the Eclipse Public License v1.0
\r
5 * which accompanies this distribution, and is available at
\r
6 * http://www.eclipse.org/legal/epl-v10.html
\r
9 * VTT Technical Research Centre of Finland - initial API and implementation
\r
10 *******************************************************************************/
\r
11 package org.simantics.processeditor.actions;
\r
13 import org.eclipse.jface.action.Action;
\r
14 import org.simantics.processeditor.Activator;
\r
15 import org.simantics.processeditor.dialogs.FloorConfigureDialog;
\r
16 import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase;
\r
18 import com.jme.math.Vector3f;
\r
19 import com.jme.scene.Geometry;
\r
21 public class ConfigureFloorAction extends Action {
\r
23 Geometry floorShape;
\r
24 ThreeDimensionalEditorBase editor;
\r
26 public ConfigureFloorAction(ThreeDimensionalEditorBase editor) {
\r
27 setText("Configure floor");
\r
28 setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png"));
\r
29 this.editor = editor;
\r
33 if (floorShape == null)
\r
34 throw new NullPointerException("FloorShape is null");
\r
35 FloorConfigureDialog dialog = new FloorConfigureDialog(editor.getRenderingComposite().getShell());
\r
36 if (dialog.open() == FloorConfigureDialog.CANCEL)
\r
38 if (dialog.isFloorEnabled()) {
\r
39 if (floorShape.getParent() == null)
\r
40 editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape);
\r
42 floorShape.removeFromParent();
\r
44 floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));
\r
48 public void setFloorShape(Geometry floorShape) {
\r
49 this.floorShape = floorShape;
\r