Commit 4628b0e0 authored by Justin Barno's avatar Justin Barno
Browse files

Updated to Spring Boot RC2.

Removed a defunct entry from the header of the GUI.
Refactor of the Site plotting to eliminate duplicated legend and standardize symbols/colors per station.
Tweaked the logo for differentiation purposes when viewed in Git repos.
Simple output for SAC files from Waveforms.
Fixed a minor plotting bug where picks are 'bad' in that they don't coincide with the time of the waveform segment.
Simple local pass-through services for when you are running in standalone mode to avoid undue serialization.
parent 6dd5f9e4
![Livermore logo](logo.gif)
![Livermore logo](llnl-logo.gif)
The `Coda Calibration Tool` (CCT) is a Java based application for calibrating 1D shear wave coda measurement models to observed data using a much smaller set of reference MWs calculated from other means (waveform modeling, etc.).
<br/>These calibrated measurement models can then be used in other tools to generate coda MW measurements, source spectra, estimated stress drop, and other useful measurements against the rest of the events and any new data collected in the calibrated region.
......
......@@ -5,7 +5,7 @@
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>calibration-gui</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<packaging>jar</packaging>
<name>calibration-gui</name>
......@@ -54,7 +54,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M4</version>
<version>2.0.0.RC2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
......@@ -65,12 +65,12 @@
<dependency>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>externals</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>gov.llnl.gnem.apps.coda.calibration</groupId>
<artifactId>model</artifactId>
<version>1.0.0</version>
<version>1.0.1</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.persistence</groupId>
......@@ -202,7 +202,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.0.0.M4</version>
<version>2.0.0.RC2</version>
<configuration>
<executable>true</executable>
<mainClass>${start-class}</mainClass>
......
......@@ -34,7 +34,7 @@ import com.google.common.eventbus.EventBus;
import com.google.common.eventbus.Subscribe;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.CodaParamLoadingController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.LoadingGui;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.ProgressGui;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.ReferenceEventLoadingController;
import gov.llnl.gnem.apps.coda.calibration.gui.controllers.WaveformLoadingController;
import gov.llnl.gnem.apps.coda.calibration.gui.data.client.api.CalibrationClient;
......@@ -75,7 +75,7 @@ public class CodaGuiController {
private EventBus bus;
private LoadingGui loadingGui;
private ProgressGui loadingGui;
private WaveformGui waveformGui;
private Map<Long, ProgressMonitor> monitors = new HashMap<>();
......@@ -122,6 +122,11 @@ public class CodaGuiController {
waveformGui.show();
}
@FXML
private void openWaveformDirectorySavingWindow() {
Optional.ofNullable(sacDirFileChooser.showDialog(rootElement.getScene().getWindow())).ifPresent(waveformLoadingController::saveToDirectory);
}
@FXML
private void openWaveformDirectoryLoadingWindow() {
Optional.ofNullable(sacDirFileChooser.showDialog(rootElement.getScene().getWindow())).map(Collections::singletonList).ifPresent(waveformLoadingController::loadFiles);
......@@ -183,7 +188,7 @@ public class CodaGuiController {
});
try {
loadingGui = new LoadingGui();
loadingGui = new ProgressGui();
} catch (IllegalStateException e) {
log.error("Unable to instantiate loading display {}", e.getMessage(), e);
}
......
......@@ -119,7 +119,7 @@ public class GuiApplication extends Application {
atts.getValue("Built-By"),
atts.getValue("Build-Timestamp"));
// Update the title bar
baseTitle += " Build(" + atts.getValue("Implementation-Build") + ") at " + atts.getValue("Build-Timestamp") + " ";
baseTitle += " Built at " + atts.getValue("Build-Timestamp");
} else {
// Class not from JAR
log.info("{} not running from a jar.", baseTitle);
......
/*
* Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory
* CODE-743439.
* All rights reserved.
* This file is part of CCT. For details, see https://github.com/LLNL/coda-calibration-tool.
*
* Licensed under the Apache License, Version 2.0 (the “Licensee”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the license.
*
* This work was performed under the auspices of the U.S. Department of Energy
* by Lawrence Livermore National Laboratory under Contract DE-AC52-07NA27344.
*/
package gov.llnl.gnem.apps.coda.calibration.gui.controllers;
import java.io.IOException;
import gov.llnl.gnem.apps.coda.calibration.gui.util.ProgressMonitor;
import javafx.application.Platform;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.TableCell;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.text.Font;
import javafx.stage.Stage;
import javafx.stage.StageStyle;
import javafx.util.Callback;
/**
* @throws IllegalStateException
* if the FXML sub-system is unable to initialize the display
*/
public class ProgressGui {
@FXML
private TableView<ProgressMonitor> progressTable;
@FXML
private TableColumn<ProgressMonitor, Node> progressColumn;
@FXML
private TableColumn<ProgressMonitor, String> taskColumn;
private Stage stage;
private ObservableList<ProgressMonitor> monitors = FXCollections.observableArrayList();
public ProgressGui() {
Platform.runLater(() -> {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/fxml/ProgressDisplay.fxml"));
fxmlLoader.setController(this);
stage = new Stage(StageStyle.UTILITY);
Font.loadFont(getClass().getResource("/fxml/MaterialIcons-Regular.ttf").toExternalForm(), 18);
Parent root;
try {
root = fxmlLoader.load();
Scene scene = new Scene(root);
stage.setScene(scene);
taskColumn.setCellValueFactory(value -> Bindings.createStringBinding(() -> value.getValue().getDisplayableName()));
progressColumn.setCellValueFactory(value -> Bindings.createObjectBinding(() -> value.getValue()));
progressColumn.setCellFactory(new Callback<TableColumn<ProgressMonitor, Node>, TableCell<ProgressMonitor, Node>>() {
@Override
public TableCell<ProgressMonitor, Node> call(TableColumn<ProgressMonitor, Node> param) {
return new TableCell<ProgressMonitor, Node>() {
@Override
protected void updateItem(Node item, boolean empty) {
if (item == getItem())
return;
super.updateItem(item, empty);
if (item == null) {
super.setText(null);
super.setGraphic(null);
} else if (item instanceof Node) {
super.setText(null);
super.setGraphic((Node) item);
}
}
};
}
});
progressTable.setItems(monitors);
} catch (IOException e) {
throw new IllegalStateException(e);
}
});
}
public void addProgressMonitor(ProgressMonitor monitor) {
monitors.add(monitor);
Platform.runLater(() -> {
stage.show();
});
}
public void removeProgressMonitor(ProgressMonitor monitor) {
monitors.remove(monitor);
}
public void hide() {
Platform.runLater(() -> {
stage.hide();
});
}
public void show() {
Platform.runLater(() -> {
stage.show();
});
}
}
......@@ -303,7 +303,7 @@ public class ShapeController {
private EventHandler<Event> showWaveformPopup(Waveform waveform) {
return event -> {
bus.post(new WaveformSelectionEvent(waveform.getId().toString()));
bus.post(new WaveformSelectionEvent(waveform.getId()));
};
}
......
......@@ -39,7 +39,10 @@ import com.google.common.eventbus.EventBus;
import gov.llnl.gnem.apps.coda.calibration.gui.data.client.api.ReferenceEventClient;
import gov.llnl.gnem.apps.coda.calibration.gui.data.client.api.SpectraClient;
import gov.llnl.gnem.apps.coda.calibration.gui.events.WaveformSelectionEvent;
import gov.llnl.gnem.apps.coda.calibration.gui.plotting.LabeledPlotPoint;
import gov.llnl.gnem.apps.coda.calibration.gui.plotting.PlotPoint;
import gov.llnl.gnem.apps.coda.calibration.gui.plotting.SpectralPlot;
import gov.llnl.gnem.apps.coda.calibration.gui.plotting.SymbolStyleMapFactory;
import gov.llnl.gnem.apps.coda.calibration.gui.util.MaybeNumericStringComparator;
import gov.llnl.gnem.apps.coda.calibration.model.domain.MeasuredMwParameters;
import gov.llnl.gnem.apps.coda.calibration.model.domain.ReferenceMwParameters;
......@@ -49,6 +52,7 @@ import gov.llnl.gnem.apps.coda.calibration.model.domain.Waveform;
import javafx.beans.binding.Bindings;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.embed.swing.SwingFXUtils;
import javafx.embed.swing.SwingNode;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
......@@ -56,9 +60,11 @@ import javafx.scene.control.ComboBox;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableColumn.CellDataFeatures;
import javafx.scene.control.TableView;
import javafx.scene.image.ImageView;
import llnl.gnem.core.gui.plotting.PlotObjectClicked;
import llnl.gnem.core.gui.plotting.plotobject.PlotObject;
import llnl.gnem.core.gui.plotting.plotobject.Symbol;
import llnl.gnem.core.gui.plotting.plotobject.SymbolFactory;
@Component
public class SiteController {
......@@ -87,42 +93,58 @@ public class SiteController {
private TableView<MeasuredMwParameters> measuredEventTable;
@FXML
TableColumn<ReferenceMwParameters, String> evidCol;
private TableView<LabeledPlotPoint> iconTable;
@FXML
TableColumn<ReferenceMwParameters, Double> mwCol;
private TableColumn<ReferenceMwParameters, String> evidCol;
@FXML
TableColumn<ReferenceMwParameters, Double> stressDropCol;
private TableColumn<ReferenceMwParameters, Double> mwCol;
@FXML
TableColumn<MeasuredMwParameters, String> measuredEvidCol;
private TableColumn<ReferenceMwParameters, Double> stressDropCol;
@FXML
TableColumn<MeasuredMwParameters, Double> measuredMwCol;
private TableColumn<MeasuredMwParameters, String> measuredEvidCol;
@FXML
TableColumn<MeasuredMwParameters, Double> measuredStressDropCol;
private TableColumn<MeasuredMwParameters, Double> measuredMwCol;
@FXML
private TableColumn<MeasuredMwParameters, Double> measuredStressDropCol;
@FXML
private TableColumn<LabeledPlotPoint, ImageView> iconCol;
@FXML
private TableColumn<LabeledPlotPoint, String> stationCol;
private SpectraClient spectraClient;
private List<SpectraMeasurement> spectralMeasuremenets = new ArrayList<>();
private List<SpectraMeasurement> spectralMeasurements = new ArrayList<>();
private ObservableList<String> evids = FXCollections.observableArrayList();
private ReferenceEventClient referenceEventClient;
private ObservableList<ReferenceMwParameters> referenceMwParameters = FXCollections.observableArrayList();
private ObservableList<MeasuredMwParameters> measuredMwParameters = FXCollections.observableArrayList();
private ObservableList<LabeledPlotPoint> stationSymbols = FXCollections.observableArrayList();
private EventBus bus;
protected Map<Point2D.Double, SpectraMeasurement> rawSymbolMap = new ConcurrentHashMap<>();
protected Map<Point2D.Double, SpectraMeasurement> pathSymbolMap = new ConcurrentHashMap<>();
protected Map<Point2D.Double, SpectraMeasurement> siteSymbolMap = new ConcurrentHashMap<>();
private SymbolStyleMapFactory symbolStyleMapFactory;
private Map<String, PlotPoint> symbolStyleMap;
@Autowired
private SiteController(SpectraClient spectraClient, ReferenceEventClient referenceEventClient, EventBus bus) {
private SiteController(SpectraClient spectraClient, ReferenceEventClient referenceEventClient, EventBus bus, SymbolStyleMapFactory styleFactory) {
this.spectraClient = spectraClient;
this.referenceEventClient = referenceEventClient;
this.bus = bus;
this.symbolStyleMapFactory = styleFactory;
}
@FXML
......@@ -236,12 +258,27 @@ public class SiteController {
.orElseGet(() -> 0.0))
.asObject());
iconCol.setCellValueFactory(x -> Bindings.createObjectBinding(() -> Optional.ofNullable(x).map(CellDataFeatures::getValue).map(pp -> {
ImageView imView = new ImageView(SwingFXUtils.toFXImage(SymbolFactory.createSymbol(pp.getStyle(), 0, 0, 2, pp.getColor(), pp.getColor(), pp.getColor(), "", true, false, 10.0)
.getBufferedImage(256),
null));
imView.setFitHeight(12);
imView.setFitWidth(12);
return imView;
}).orElseGet(() -> new ImageView())));
stationCol.setCellValueFactory(x -> Bindings.createStringBinding(() -> Optional.ofNullable(x).map(CellDataFeatures::getValue).map(LabeledPlotPoint::getLabel).orElseGet(String::new)));
refEventTable.setItems(referenceMwParameters);
measuredEventTable.setItems(measuredMwParameters);
iconTable.setItems(stationSymbols);
iconCol.prefWidthProperty().bind(iconTable.widthProperty().multiply(0.3));
stationCol.prefWidthProperty().bind(iconTable.widthProperty().multiply(0.7));
}
private void showWaveformPopup(Waveform waveform) {
bus.post(new WaveformSelectionEvent(waveform.getId().toString()));
bus.post(new WaveformSelectionEvent(waveform.getId()));
}
private void plotSpectra() {
......@@ -251,20 +288,20 @@ public class SiteController {
siteSymbolMap.clear();
if (evidCombo != null && evidCombo.getSelectionModel().getSelectedIndex() > 0) {
List<SpectraMeasurement> filteredMeasurements = filterToEvent(evidCombo.getSelectionModel().getSelectedItem(), spectralMeasuremenets);
List<SpectraMeasurement> filteredMeasurements = filterToEvent(evidCombo.getSelectionModel().getSelectedItem(), spectralMeasurements);
rawSymbolMap.putAll(mapSpectraToPoint(filteredMeasurements, SpectraMeasurement::getRawAtMeasurementTime));
pathSymbolMap.putAll(mapSpectraToPoint(filteredMeasurements, SpectraMeasurement::getPathCorrected));
siteSymbolMap.putAll(mapSpectraToPoint(filteredMeasurements, SpectraMeasurement::getPathAndSiteCorrected));
Spectra referenceSpectra = spectraClient.getReferenceSpectra(evidCombo.getSelectionModel().getSelectedItem()).block(Duration.ofSeconds(2));
Spectra theoreticalSpectra = spectraClient.getFitSpectra(evidCombo.getSelectionModel().getSelectedItem()).block(Duration.ofSeconds(2));
rawPlot.plotXYdata(mapToStationAndEvent(filteredMeasurements, SpectraMeasurement::getRawAtMeasurementTime), Boolean.TRUE);
pathPlot.plotXYdata(mapToStationAndEvent(filteredMeasurements, SpectraMeasurement::getPathCorrected), Boolean.TRUE);
sitePlot.plotXYdata(mapToStationAndEvent(filteredMeasurements, SpectraMeasurement::getPathAndSiteCorrected), Boolean.TRUE, referenceSpectra, theoreticalSpectra);
rawPlot.plotXYdata(toPlotPoints(filteredMeasurements, SpectraMeasurement::getRawAtMeasurementTime), Boolean.TRUE);
pathPlot.plotXYdata(toPlotPoints(filteredMeasurements, SpectraMeasurement::getPathCorrected), Boolean.TRUE);
sitePlot.plotXYdata(toPlotPoints(filteredMeasurements, SpectraMeasurement::getPathAndSiteCorrected), Boolean.TRUE, referenceSpectra, theoreticalSpectra);
} else {
rawPlot.plotXYdata(mapToStationAndEvent(spectralMeasuremenets, SpectraMeasurement::getRawAtMeasurementTime), Boolean.FALSE);
pathPlot.plotXYdata(mapToStationAndEvent(spectralMeasuremenets, SpectraMeasurement::getPathCorrected), Boolean.FALSE);
sitePlot.plotXYdata(mapToStationAndEvent(spectralMeasuremenets, SpectraMeasurement::getPathAndSiteCorrected), Boolean.FALSE);
rawPlot.plotXYdata(toPlotPoints(spectralMeasurements, SpectraMeasurement::getRawAtMeasurementTime), Boolean.FALSE);
pathPlot.plotXYdata(toPlotPoints(spectralMeasurements, SpectraMeasurement::getPathCorrected), Boolean.FALSE);
sitePlot.plotXYdata(toPlotPoints(spectralMeasurements, SpectraMeasurement::getPathAndSiteCorrected), Boolean.FALSE);
}
}
......@@ -274,30 +311,26 @@ public class SiteController {
sitePlot.clearPlot();
}
private List<SpectraMeasurement> filterToEvent(String selectedItem, List<SpectraMeasurement> spectralMeasuremenets) {
return spectralMeasuremenets.stream().filter(spec -> selectedItem.equalsIgnoreCase(spec.getWaveform().getEvent().getEventId())).collect(Collectors.toList());
private List<SpectraMeasurement> filterToEvent(String selectedItem, List<SpectraMeasurement> spectralMeasurements) {
return spectralMeasurements.stream().filter(spec -> selectedItem.equalsIgnoreCase(spec.getWaveform().getEvent().getEventId())).collect(Collectors.toList());
}
private Map<Point2D.Double, SpectraMeasurement> mapSpectraToPoint(List<SpectraMeasurement> spectralMeasuremenets, Function<SpectraMeasurement, Double> func) {
return spectralMeasuremenets.stream()
.filter(spectra -> !func.apply(spectra).equals(0.0))
.collect(Collectors.toMap(spectra -> new Point2D.Double(Math.log10(centerFreq(spectra.getWaveform().getLowFrequency(), spectra.getWaveform().getHighFrequency())),
func.apply(spectra)),
Function.identity(),
(a, b) -> b,
HashMap::new));
private Map<Point2D.Double, SpectraMeasurement> mapSpectraToPoint(List<SpectraMeasurement> spectralMeasurements, Function<SpectraMeasurement, Double> func) {
return spectralMeasurements.stream()
.filter(spectra -> !func.apply(spectra).equals(0.0))
.collect(Collectors.toMap(spectra -> new Point2D.Double(Math.log10(centerFreq(spectra.getWaveform().getLowFrequency(), spectra.getWaveform().getHighFrequency())),
func.apply(spectra)),
Function.identity(),
(a, b) -> b,
HashMap::new));
}
private Map<String, List<Point2D.Double>> mapToStationAndEvent(List<SpectraMeasurement> spectralMeasuremenets, Function<SpectraMeasurement, Double> func) {
return spectralMeasuremenets.stream()
.filter(spectra -> !func.apply(spectra).equals(0.0))
.collect(Collectors.groupingBy(spectra -> String.join(".",
spectra.getWaveform().getStream().getStation().getStationName(),
spectra.getWaveform().getEvent().getEventId()),
Collectors.mapping(spectra -> new Point2D.Double(Math.log10(centerFreq(spectra.getWaveform().getLowFrequency(),
spectra.getWaveform().getHighFrequency())),
func.apply(spectra)),
Collectors.toList())));
private List<PlotPoint> toPlotPoints(List<SpectraMeasurement> spectralMeasurements, Function<SpectraMeasurement, Double> func) {
List<PlotPoint> list = spectralMeasurements.stream().filter(spectra -> !func.apply(spectra).equals(0.0)).map(spectra -> {
PlotPoint pp = symbolStyleMap.get(spectra.getWaveform().getStream().getStation().getStationName());
return new PlotPoint(Math.log10(centerFreq(spectra.getWaveform().getLowFrequency(), spectra.getWaveform().getHighFrequency())), func.apply(spectra), pp.getStyle(), pp.getColor());
}).collect(Collectors.toList());
return list;
}
private double centerFreq(Double lowFrequency, Double highFrequency) {
......@@ -317,16 +350,26 @@ public class SiteController {
referenceEventClient.getReferenceEvents().filter(ref -> ref.getId() != null).subscribe(ref -> referenceMwParameters.add(ref));
referenceEventClient.getMeasuredEvents().filter(meas -> meas.getId() != null).subscribe(meas -> measuredMwParameters.add(meas));
spectralMeasuremenets.clear();
spectralMeasurements.clear();
stationSymbols.clear();
evids.clear();
evids.add("All");
spectralMeasuremenets.addAll(spectraClient.getMeasuredSpectra()
.filter(Objects::nonNull)
.filter(spectra -> spectra.getWaveform() != null && spectra.getWaveform().getEvent() != null && spectra.getWaveform().getStream() != null)
.toStream()
.collect(Collectors.toList()));
spectralMeasurements.addAll(spectraClient.getMeasuredSpectra()
.filter(Objects::nonNull)
.filter(spectra -> spectra.getWaveform() != null && spectra.getWaveform().getEvent() != null && spectra.getWaveform().getStream() != null)
.toStream()
.collect(Collectors.toList()));
symbolStyleMap = symbolStyleMapFactory.build(spectralMeasurements, new Function<SpectraMeasurement, String>() {
@Override
public String apply(SpectraMeasurement t) {
return t.getWaveform().getStream().getStation().getStationName();
}
});
stationSymbols.addAll(symbolStyleMap.entrySet().stream().map(e -> new LabeledPlotPoint(e.getKey(), e.getValue())).collect(Collectors.toList()));
evids.addAll(spectralMeasuremenets.stream().map(spec -> spec.getWaveform().getEvent().getEventId()).distinct().sorted(new MaybeNumericStringComparator()).collect(Collectors.toList()));
evids.addAll(spectralMeasurements.stream().map(spec -> spec.getWaveform().getEvent().getEventId()).distinct().sorted(new MaybeNumericStringComparator()).collect(Collectors.toList()));
}
}
......@@ -36,6 +36,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.eventbus.EventBus;
import gov.llnl.gnem.apps.coda.calibration.gui.converters.api.FileToWaveformConverter;
import gov.llnl.gnem.apps.coda.calibration.gui.converters.sac.SacExporter;
import gov.llnl.gnem.apps.coda.calibration.gui.data.client.api.WaveformClient;
import gov.llnl.gnem.apps.coda.calibration.gui.util.PassFailEventProgressListener;
import gov.llnl.gnem.apps.coda.calibration.gui.util.ProgressEventProgressListener;
......@@ -62,12 +63,46 @@ public class WaveformLoadingController {
private AtomicLong idCounter = new AtomicLong();
private SacExporter sacExporter;
@Autowired
public WaveformLoadingController(List<FileToWaveformConverter> fileConverters, WaveformClient client, EventBus bus) {
public WaveformLoadingController(List<FileToWaveformConverter> fileConverters, WaveformClient client, EventBus bus, SacExporter sacExporter) {
super();
this.fileConverters = fileConverters;
this.client = client;
this.bus = bus;
this.sacExporter = sacExporter;
}
public void saveToDirectory(File exportDirectory) {
CompletableFuture.runAsync(() -> {
try {
if (exportDirectory.isDirectory() && exportDirectory.canWrite()) {
Progress fileProcessingProgress = new Progress(0l, 0l);
ProgressEvent processingProgressEvent = new ProgressEvent(idCounter.getAndIncrement(), fileProcessingProgress);
ProgressMonitor processingMonitor = new ProgressMonitor("Exporting", new ProgressEventProgressListener(bus, processingProgressEvent));
try {
ProgressGui progressGui = new ProgressGui();
progressGui.show();
progressGui.addProgressMonitor(processingMonitor);
fileProcessingProgress.setTotal(1l);
bus.post(processingProgressEvent);
client.getAllStacks().doOnComplete(() -> {
fileProcessingProgress.setCurrent(1l);
bus.post(processingProgressEvent);
}).filter(w -> w != null).filter(w -> w.getId() != null).subscribe(w -> {
sacExporter.writeWaveformToDirectory(exportDirectory, w);
});
} catch (RuntimeException e) {
log.error(e.getMessage(), e);
}
}
} catch (IllegalStateException e) {
log.error("Unable to instantiate loading display {}", e.getMessage(), e);
}
});
}
public void loadFiles(List<File> inputFiles) {
......@@ -94,10 +129,10 @@ public class WaveformLoadingController {
ProgressMonitor uploadMonitor = new ProgressMonitor("Saving Data", new PassFailEventProgressListener(bus, fileUploadProgressEvent));
try {
LoadingGui loadingGui = new LoadingGui();
loadingGui.show();
loadingGui.addProgressMonitor(processingMonitor);
loadingGui.addProgressMonitor(uploadMonitor);
ProgressGui progressGui = new ProgressGui();
progressGui.show();
progressGui.addProgressMonitor(processingMonitor);
progressGui.addProgressMonitor(uploadMonitor);
fileUploadProgress.setTotal((long) (files.size() / maxBatching) + 1);
bus.post(fileUploadProgressEvent);
......
/*
* Copyright (c) 2017, Lawrence Livermore National Security, LLC. Produced at the Lawrence Livermore National Laboratory
* CODE-743439.
* All rights reserved.
* This file is part of CCT. For details, see https://github.com/LLNL/coda-calibration-tool.
*
* Licensed under the Apache License, Version 2.0 (the “Licensee”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and limitations under the license.
*