Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #95 from dnorgaard-usgs/master
Browse files Browse the repository at this point in the history
Additional changes for 2.7.0
  • Loading branch information
Diana Norgaard authored May 10, 2017
2 parents 7ec9e41 + ce016d6 commit ab65c66
Show file tree
Hide file tree
Showing 12 changed files with 68 additions and 53 deletions.
8 changes: 6 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## Version 2.6.4
* Add ability to import QuakeML files
## Version 2.7.0
* Add pick mode to Wave Clipboard
* Add ability to import QuakeML files
* Fix error saving config on exit
* Fix error reading/writing channels in Seisan files
* Fix incorrect time in status bar
* Add general/debug info to particle motion plot for user

## Version 2.6.3
* Enable refresh of data source
Expand Down
Binary file modified docs/Swarm User Guide.docx
Binary file not shown.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>gov.usgs.volcanoes</groupId>
<artifactId>swarm</artifactId>
<version>2.6.4</version>
<version>2.7.0</version>
<packaging>jar</packaging>

<name>Swarm</name>
Expand Down Expand Up @@ -578,7 +578,7 @@
<dependency>
<groupId>gov.usgs.volcanoes</groupId>
<artifactId>usgs</artifactId>
<version>1.3.9</version>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>gov.usgs.volcanoes</groupId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gov/usgs/volcanoes/swarm/FileChooser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import javax.swing.JFileChooser;

@Deprecated // just instantiate new JFileChooser
public final class FileChooser {
private static final FileChooser INSTANCE = new FileChooser(); // Keep to instantiate
private static JFileChooser fileChooser;

private FileChooser() {
Expand Down
55 changes: 28 additions & 27 deletions src/main/java/gov/usgs/volcanoes/swarm/SCNL.java
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
package gov.usgs.volcanoes.swarm;

/**
* SCNL data class.
*
* $Log: not supported by cvs2svn $
* @author Dan Cervelli
*/
public class SCNL
{
public String station;
public String channel;
public String network;
public String location;

public SCNL(String s)
{
String[] ss = s.split(" ");
station = ss[0];
if (ss.length >= 3)
{
channel = ss[1];
network = ss[2];
}
if (ss.length >= 4)
{
location = ss[3];
}
}

public String toString()
{
return station + " " + channel + " " + network + (location != null ? (" " + location) : "");
}
public class SCNL {
public String station;
public String channel;
public String network;
public String location;

/**
* Constructor.
* @param s channel string
*/
public SCNL(String s) {
String[] ss = s.split(" ");
switch (ss.length) {
case 4:
location = ss[3];
case 3:
network = ss[2];
case 2:
channel = ss[1];
default:
station = ss[0];
}
}

public String toString() {
return station + " " + channel + " " + network + (location != null ? (" " + location) : "");
}
}
2 changes: 1 addition & 1 deletion src/main/java/gov/usgs/volcanoes/swarm/SwarmMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private void createFileMenu() {
openFile.setMnemonic('O');
openFile.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser chooser = FileChooser.getFileChooser();
JFileChooser chooser = new JFileChooser();
chooser.resetChoosableFileFilters();
for (FileType ft : FileType.getKnownTypes()) {
ExtensionFileFilter f = new ExtensionFileFilter(ft.extension, ft.description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public Object construct() {
final int channelCount = file.getChannels().size();
final double progressInc = (1 - .2) / channelCount;
for (final String channel : file.getChannels()) {
final Metadata md = swarmConfig.getMetadata(channel, true);
final Metadata md = swarmConfig.getMetadata(channel.replaceAll("\\$", " "), true);
md.addGroup(file.getGroup());

final Wave wave = file.getWave(channel);
Expand All @@ -158,7 +158,7 @@ public Object construct() {
} catch (final Throwable t) {
t.printStackTrace();
result = t;
}
}
fireChannelsProgress(fileName, 1);
fireChannelsUpdated();
MapFrame.getInstance().reset(false);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/usgs/volcanoes/swarm/event/PickBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public void writeImage() {
return;
}

final JFileChooser chooser = FileChooser.getFileChooser();
final JFileChooser chooser = new JFileChooser();
final File lastPath = new File(swarmConfig.lastPath);
chooser.setCurrentDirectory(lastPath);
chooser.setSelectedFile(new File("clipboard.png"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ public void finished() {
if (success) {
if (hd != null && hd.getEndTime() < before && !dataSource.isActiveSource()) {
// this would get executed if the data source
// forcably returned a different time than asked
// forcibly returned a different time than asked
// for -- like in the case of a miniSEED.
final double dt = end - before;
before = hd.getEndTime() - dt / 2;
Expand Down Expand Up @@ -897,7 +897,7 @@ public void run() {
// TODO: refactor out some functions
private class CaptureActionListener implements ActionListener {
public void actionPerformed(final ActionEvent e) {
chooser = FileChooser.getFileChooser();
chooser = new JFileChooser();
chooser.setDialogTitle("Save Helicorder Screen Capture");
chooser.setSelectedFile(new File("heli.png"));
final File lastPath = new File(swarmConfig.lastPath);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gov/usgs/volcanoes/swarm/map/MapFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public void actionPerformed(final ActionEvent e) {

class CaptureActionListener implements ActionListener {
public void actionPerformed(final ActionEvent e) {
final JFileChooser chooser = FileChooser.getFileChooser();
final JFileChooser chooser = new JFileChooser();
final File lastPath = new File(swarmConfig.lastPath);
chooser.setCurrentDirectory(lastPath);
chooser.setSelectedFile(new File("map.png"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void actionPerformed(final ActionEvent e) {
return;
}

final JFileChooser chooser = FileChooser.getFileChooser();
final JFileChooser chooser = new JFileChooser();
final File lastPath = new File(swarmConfig.lastPath);
chooser.setCurrentDirectory(lastPath);
chooser.setSelectedFile(new File("clipboard.png"));
Expand Down Expand Up @@ -595,7 +595,7 @@ public void actionPerformed(final ActionEvent e) {

private class OpenActionListener implements ActionListener {
public void actionPerformed(final ActionEvent e) {
final JFileChooser chooser = FileChooser.getFileChooser();
final JFileChooser chooser = new JFileChooser();
chooser.resetChoosableFileFilters();
for (final FileType ft : FileType.getKnownTypes()) {
final ExtensionFileFilter f = new ExtensionFileFilter(ft.extension, ft.description);
Expand Down Expand Up @@ -637,7 +637,7 @@ public void actionPerformed(final ActionEvent e) {
return;
}

final JFileChooser chooser = FileChooser.getFileChooser();
final JFileChooser chooser = new JFileChooser();
chooser.resetChoosableFileFilters();
chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
chooser.setMultiSelectionEnabled(false);
Expand Down Expand Up @@ -714,7 +714,7 @@ public void actionPerformed(final ActionEvent e) {
}
}

final JFileChooser chooser = FileChooser.getFileChooser();
final JFileChooser chooser = new JFileChooser();
chooser.resetChoosableFileFilters();
chooser.setMultiSelectionEnabled(false);
chooser.setDialogTitle("Save All Files");
Expand Down
30 changes: 19 additions & 11 deletions src/main/java/gov/usgs/volcanoes/swarm/wave/WaveViewPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -819,11 +819,13 @@ private void filter(Wave w) {
* @param g2 graphics
*/
protected void annotateImage(Graphics2D g2) {
if (!Double.isNaN(mark1)) {
paintMark(g2, mark1);
}
if (!Double.isNaN(mark2)) {
paintMark(g2, mark2);
if (timeSeries) {
if (!Double.isNaN(mark1)) {
paintMark(g2, mark1);
}
if (!Double.isNaN(mark2)) {
paintMark(g2, mark2);
}
}
if (settings.pickEnabled && pickMenu != null) {
double[] t = getTranslation();
Expand Down Expand Up @@ -1260,18 +1262,21 @@ private void plotParticleMotion(Plot plot, Wave wave) {
}
Metadata md = swarmConfig.getMetadata(channel);
if (md == null) {
String message = "Unable to plot due to invalid metadata.";
String message = "Unable to plot due to invalid or missing metadata.";
TextRenderer renderer = new TextRenderer(30, 30, message);
plot.addRenderer(renderer);
message = "Channel: " + channel;
renderer = new TextRenderer(30, 60, message);
plot.addRenderer(renderer);
return;
}
String s = md.getSCNL().station;
String c = md.getSCNL().channel;
String n = md.getSCNL().network;
String n = md.getSCNL().network == null ? "" : md.getSCNL().network;
String l = md.getSCNL().location == null ? "" : md.getSCNL().location;

if (s == null || c == null || n == null) {
String message = "Unable to plot due to missing SCNL information.";
if (s == null || c == null) {
String message = "Unable to plot due to missing Station or Channel information.";
TextRenderer renderer = new TextRenderer(30, 30, message);
plot.addRenderer(renderer);
return;
Expand All @@ -1287,7 +1292,10 @@ private void plotParticleMotion(Plot plot, Wave wave) {
for (String direction : new String[] {"Z", "N", "E"}) {
if (!component.equals(direction)) {
String newChannel = c.replaceFirst(".$", direction);
String newStation = s + " " + newChannel + " " + n + " " + l;
String newStation = s + " " + newChannel + " " + n;
if (!l.equals("")) {
newStation += " " + l;
}
stations.put(direction, newStation);
Wave w = source.getWave(newStation, startTime, endTime);
if (w != null) {
Expand All @@ -1311,7 +1319,7 @@ private void plotParticleMotion(Plot plot, Wave wave) {

if (channel != null && displayTitle) {
String title = s + " " + c.replaceFirst(".$", "*") + " " + n + " " + l;
particleMotionRenderer.setTitle(title);
particleMotionRenderer.setTitle(title.trim());
}
plot.addRenderer(particleMotionRenderer);
if (useFilterLabel && settings.filterOn) {
Expand Down

0 comments on commit ab65c66

Please sign in to comment.