Continue removing the 'data processing' directory from the source files

parent 71a6a55b
......@@ -7,12 +7,12 @@ import org.vadere.gui.projectview.model.ProjectViewModel.OutputBundle;
import org.vadere.simulator.control.OfflineSimulation;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.io.IOOutput;
import org.vadere.util.io.IOUtils;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.io.IOException;
import javax.swing.*;
public class ActionRunOutput extends AbstractAction {
private static final long serialVersionUID = 1L;
......@@ -37,8 +37,7 @@ public class ActionRunOutput extends AbstractAction {
IOOutput.readScenarioRunManager(outputBundle.getProject(), directoryName);
OfflineSimulation offlineSimulation = new OfflineSimulation(
IOOutput.readTrajectories(outputBundle.getProject(), vadere, directoryName),
vadere, model.getProject().getOutputDir()
.resolveSibling(IOUtils.DATAPROCESSING_DIR));
vadere, model.getProject().getOutputDir());
offlineSimulation.run();
} catch (IOException e1) {
logger.error("Could not run offline simulation (simulate output):"
......
package org.vadere.gui.projectview.view;
import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.beans.IntrospectionException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.BoxLayout;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Messages;
......@@ -41,6 +16,19 @@ import org.vadere.simulator.projects.io.JsonConverter;
import org.vadere.state.scenario.Topography;
import org.vadere.util.io.IOUtils;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.beans.IntrospectionException;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
public class ScenarioJPanel extends JPanel implements IProjectChangeListener, ProjectFinishedListener {
......@@ -180,7 +168,7 @@ public class ScenarioJPanel extends JPanel implements IProjectChangeListener, Pr
topographyFileView = new TextView("/scenarios", "default_directory_scenarios", AttributeType.TOPOGRAPHY);
tabbedPane.addTab(Messages.getString("Tab.Topography.title"), null, topographyFileView, null);
outputView = new TextView("/" + IOUtils.DATAPROCESSING_DIR, "default_directory_outputprocessors", AttributeType.OUTPUTPROCESSOR);
outputView = new TextView("/" + IOUtils.OUTPUT_DIR, "default_directory_outputprocessors", AttributeType.OUTPUTPROCESSOR);
try {
// TODO add more templates and make a loop here
......
......@@ -64,12 +64,9 @@ public class VadereFactory {
ScenarioRunManager v = IOVadere.fromJson(json);
Path outPath = Paths.get(projectdirectory, IOUtils.OUTPUT_DIR);
Path outProcessorPath = Paths.get(projectdirectory, IOUtils.DATAPROCESSING_DIR);
if (!Files.exists(outPath))
Files.createDirectories(outPath);
if (!Files.exists(outProcessorPath))
Files.createDirectories(outProcessorPath);
v.setOutputPaths(outPath, outProcessorPath);
v.setOutputPaths(outPath);
return v;
}
......
......@@ -74,7 +74,7 @@ public class ScenarioRunManager implements Runnable {
this.writers = new LinkedList<>();
this.scenarioStore = store;
this.setOutputPaths(Paths.get(IOUtils.OUTPUT_DIR), Paths.get(IOUtils.DATAPROCESSING_DIR)); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/output
this.setOutputPaths(Paths.get(IOUtils.OUTPUT_DIR)); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/output
}
public void saveChanges() { // get's called by VadereProject.saveChanges on init
......@@ -234,7 +234,7 @@ public class ScenarioRunManager implements Runnable {
return this.processorWriters;
}
public void setOutputPaths(final Path outputPath, final Path processedOutputPath) {
public void setOutputPaths(final Path outputPath) {
String dateString = new SimpleDateFormat(IOUtils.DATE_FORMAT).format(new Date());
this.outputPath = Paths.get(outputPath.toString(), String.format("%s_%s", this.getName(), dateString));
}
......
......@@ -3,12 +3,20 @@ package org.vadere.simulator.projects;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.simulator.control.PassiveCallback;
import org.vadere.util.io.IOUtils;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.concurrent.*;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.stream.Collectors;
/**
......@@ -74,8 +82,7 @@ public class VadereProject implements ScenarioFinishedListener {
*/
public void runScenarios(final Collection<ScenarioRunManager> scenariosRMsToRun) {
for (ScenarioRunManager scenarioRM : scenariosRMsToRun) {
scenarioRM.setOutputPaths(outputDirectory,
outputDirectory.resolveSibling(IOUtils.DATAPROCESSING_DIR));
scenarioRM.setOutputPaths(outputDirectory);
}
// TODO [priority=normal] [task=bugfix] this is a bug: scenariosLeft may be overwritten even if there are still scenarios in it
......
......@@ -49,8 +49,6 @@ public class IOUtils {
public static final String CORRUPT_DIR = "corrupt";
public static final String DATAPROCESSING_DIR = "output";
public static final String VADERE_PROJECT_FILENAME = "vadere.project";
public static final String SYSTEM_VARIABLE_PROJECT_PATH = "VADERE_PROJECTS";
......
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