GitLab will be shut down on June 25 to move to a new facility. https://www.eclipsestatus.io/incidents/5ffy27gwcbx7

Commit 78e4f710 authored by Kasper Gammeltoft's avatar Kasper Gammeltoft
Browse files

Added ability to import STL data into Geometry editor from imports.

Signed-off-by Kasper Gammeltoft <kaspergam@bellsouth.net>
parent 37ad897f
......@@ -12,6 +12,10 @@
*******************************************************************************/
package org.eclipse.ice.item.geometry;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.core.resources.IProject;
......@@ -19,6 +23,7 @@ import org.eclipse.ice.datastructures.form.Form;
import org.eclipse.ice.datastructures.form.GeometryComponent;
import org.eclipse.ice.item.Item;
import org.eclipse.ice.item.ItemType;
import org.eclipse.january.geometry.Geometry;
import org.eclipse.january.geometry.GeometryFactory;
/**
......@@ -104,4 +109,17 @@ public class GeometryEditor extends Item {
return;
}
@Override
public void loadInput(String file) {
Path path = FileSystems.getDefault().getPath(file);
GeometryComponent comp = (GeometryComponent) form.getComponent(1);
Geometry geom = comp.getGeometry();
Geometry imported = GeometryFactory.eINSTANCE.createSTLGeometryImporter().load(path);
synchronized (geom) {
//comp.setGeometry(imported);
geom.getNodes().addAll(imported.getNodes());
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment