/******************************************************************************* * Copyright (c) 2007- VTT Technical Research Centre of Finland. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.processeditor.actions; import org.eclipse.jface.action.Action; import org.simantics.processeditor.Activator; import org.simantics.processeditor.dialogs.FloorConfigureDialog; import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase; import com.jme.math.Vector3f; import com.jme.scene.Geometry; public class ConfigureFloorAction extends Action { Geometry floorShape; ThreeDimensionalEditorBase editor; public ConfigureFloorAction(ThreeDimensionalEditorBase editor) { setText("Configure floor"); setImageDescriptor(Activator.imageDescriptorFromPlugin("fi.vtt.proconf.ode", "icons/silk/shape_align_bottom.png")); this.editor = editor; } public void run() { if (floorShape == null) throw new NullPointerException("FloorShape is null"); FloorConfigureDialog dialog = new FloorConfigureDialog(editor.getRenderingComposite().getShell()); if (dialog.open() == FloorConfigureDialog.CANCEL) return; if (dialog.isFloorEnabled()) { if (floorShape.getParent() == null) editor.getRenderingComponent().getNoCastRoot().attachChild(floorShape); } else { floorShape.removeFromParent(); } floorShape.setLocalTranslation(new Vector3f(0.f,(float)dialog.getFloorHeight(),0.f)); } public void setFloorShape(Geometry floorShape) { this.floorShape = floorShape; } }