]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.proconf.processeditor/src/org/simantics/processeditor/actions/ConfigureFloorAction.java
Set copyright texts for java files in the latest development branches.
[simantics/3d.git] / org.simantics.proconf.processeditor / src / org / simantics / processeditor / actions / ConfigureFloorAction.java
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
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.processeditor.actions;\r
12 \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
17 \r
18 import com.jme.math.Vector3f;\r
19 import com.jme.scene.Geometry;\r
20 \r
21 public class ConfigureFloorAction extends Action {\r
22         \r
23         Geometry floorShape;\r
24         ThreeDimensionalEditorBase editor;\r
25         \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
30         }\r
31         \r
32         public void run() {\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
37                         return;\r
38                 if (dialog.isFloorEnabled()) {\r
39                         if (floorShape.getParent() == null)\r
40                                 editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape);\r
41                 } else {\r
42                         floorShape.removeFromParent();\r
43                 }\r
44                 floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f));\r
45                 \r
46         }\r
47         \r
48         public void setFloorShape(Geometry floorShape) {\r
49                 this.floorShape = floorShape;\r
50         }\r
51 \r
52 }\r