Commit cbbc9639 authored by Briac Toussaint's avatar Briac Toussaint
Browse files

The editor calls the merge script when exporting a view

parent d93e53ce
......@@ -13,8 +13,9 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
......@@ -28,5 +29,13 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.base.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.controls.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.fxml.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.graphics.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.media.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.swing.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx.web.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="lib" path="/usr/lib/jvm/javafx-sdk-14.0.1/lib/javafx-swt.jar" sourcepath="/usr/lib/jvm/javafx-sdk-14.0.1/lib/src.zip"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
#
# A simple script calling the node merging program.
# The path to the main js script can be edited to match the user's file system organization.
#
node /home/briac/Documents/Nomad3D/nomad-3d-viewer/js/merger/index-merger.js -- $1 $2 $3 $4
......@@ -3,6 +3,7 @@ package fr.ill.ics.n3d;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Locale;
import java.util.Optional;
import java.util.Properties;
import java.util.logging.FileHandler;
......@@ -140,7 +141,9 @@ public class Nomad3DEditor extends Application {
*/
public static void main(String[] args) {
boolean nomad = true;
Locale.setDefault(Locale.US);
boolean nomad = false;
// Analyse arguments.
for (int i = 0; i < args.length; ++i) {
......
package fr.ill.ics.n3d.gui;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.text.DecimalFormat;
......@@ -296,7 +297,33 @@ public class EditorMenuBar extends MenuBar {
// Save the viewer file.
Nomad3DExporter exporter = new Nomad3DExporter();
exporter.writeForViewer(Nomad3DEditor.getInstance().getModel().getDisplayedRoot(), hideBBDiagonal, selectedFile);
Nomad3DEditor editor = Nomad3DEditor.getInstance();
exporter.writeForViewer(editor.getModel().getDisplayedRoot(), hideBBDiagonal, selectedFile);
String viewPath = selectedFile.getAbsolutePath();
String geometriesPath = editor.getModel().getDirectoryPath();
//Call the merger process
ProcessBuilder builder = new ProcessBuilder("./script/merge-script.sh", "-view", viewPath, "-geometries", geometriesPath);
File LOG_FILE = new File(
System.getProperty("user.dir") + File.separator + "nomad-3d-editor-merge.log");
builder.inheritIO();
builder.redirectOutput(ProcessBuilder.Redirect.appendTo(LOG_FILE));
builder.redirectError(ProcessBuilder.Redirect.appendTo(LOG_FILE));
Process mergeProcess = null;
try {
mergeProcess = builder.start();
} catch (IOException e) {
e.printStackTrace();
}
try {
int exitValue = mergeProcess.waitFor();
Logger.getLogger("nomad-3d").info("Merge script exit value : " + exitValue + "\n");
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
......
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