X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=org.simantics.g3d.shapeeditor%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fshapeeditor%2Factions%2FLoadFileAction.java;fp=org.simantics.g3d.shapeeditor%2Fsrc%2Forg%2Fsimantics%2Fproconf%2Fg3d%2Fshapeeditor%2Factions%2FLoadFileAction.java;h=0000000000000000000000000000000000000000;hb=6b6fcff5d6c326feef07ccf8401f97911778fffe;hp=c0c6440e4717fc8e5534c72a7ed54b4826dc0363;hpb=504c111db40d78f4913badddd126b283b5504dbb;p=simantics%2F3d.git diff --git a/org.simantics.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFileAction.java b/org.simantics.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFileAction.java deleted file mode 100644 index c0c6440e..00000000 --- a/org.simantics.g3d.shapeeditor/src/org/simantics/proconf/g3d/shapeeditor/actions/LoadFileAction.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * 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.proconf.g3d.shapeeditor.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.FileDialog; -import org.simantics.proconf.g3d.base.ThreeDimensionalEditorBase; -import org.simantics.proconf.g3d.occ.geometry.OccTriangulator; - -import com.jme.renderer.ColorRGBA; -import com.jme.scene.Geometry; -import com.jme.scene.state.MaterialState; - - -public class LoadFileAction extends Action { - private ThreeDimensionalEditorBase editor; - - public LoadFileAction(ThreeDimensionalEditorBase editor) { - super("Load file"); - this.editor = editor; - - } - - public void run() { - FileDialog loadDialog = new FileDialog(editor.getRenderingComposite().getShell(), SWT.OPEN); - String exts[] = { "*.stp;*.step", "*.iges", "*.brep", "*.ply" }; //$NON-NLS-1$ - String names[] = { "STEP (AP214/AP203)", "IGES", "BREP", "PLY" }; //$NON-NLS-1$ - loadDialog.setFilterNames(names); - loadDialog.setFilterExtensions(exts); - loadDialog.setText("Load model"); - - String filename = loadDialog.open(); - if (filename != null) { - Geometry g = OccTriangulator.getGeometryFromFile(filename)[0]; - MaterialState ms = editor.getRenderingComponent().getDisplaySystem().getRenderer().createMaterialState(); - ms.setAmbient(new ColorRGBA(0.f,0.f,0.f,0.f)); - ms.setEmissive(new ColorRGBA(0.f,0.f,0.f,0.f)); - ms.setShininess(128.f); - ms.setDiffuse(new ColorRGBA(0.8f,0.8f,0.8f,0.f)); - ms.setSpecular(new ColorRGBA(1.f,1.f,1.f,0.f)); - ms.setMaterialFace(MaterialState.MF_FRONT_AND_BACK); - if (g.getColorBuffer(0) != null) { - ms.setColorMaterial(MaterialState.CM_DIFFUSE); - } - g.setRenderState(ms); - editor.getRenderingComponent().getShadowRoot().attachChild(g); - // mo.setGeometry(mesh, filename); - // xithComposite.getScene().compile(); - } - - } - -}