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 #116 from dnorgaard-usgs/master
Browse files Browse the repository at this point in the history
2.7.3 doc update
  • Loading branch information
Diana Norgaard authored Jul 6, 2017
2 parents b1774b2 + 912182c commit 50cfb5f
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 24 deletions.
Binary file modified docs/Swarm User Guide.docx
Binary file not shown.
35 changes: 26 additions & 9 deletions src/main/java/gov/usgs/volcanoes/swarm/event/PickMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ private void createPickMenu() {
mi[i].addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Pick pick = createPick(phase, onset, j2k, weight);
propagatePick(phase, pick);
setWeightButton(phase, onset, weight);
pickChannels.put(phase, true);
wvp.repaint();
propagatePick(phase, pick);
propagateUncertainty(phase, onset, weight);
}
});
Expand Down Expand Up @@ -308,8 +309,7 @@ public void propagateUncertainty(String phase, Pick.Onset onset, int weight) {
continue;
}
if (wvp.isSameStation(otherWvp)) {
String key = phase + onset.toString().substring(0, 1);
otherWvp.getPickMenu().getWeightButtons().get(key)[weight].setSelected(true);
otherWvp.getPickMenu().setWeightButton(phase, onset, weight);
otherWvp.repaint();
}
}
Expand Down Expand Up @@ -504,13 +504,34 @@ private void clearPick(String pickType) {
if (pickType.equals(P) || pickType.equals(S)) {
propagatePick(pickType, null);
// reset weights to 0
weightButtons.get(pickType + "E")[0].setSelected(true);
weightButtons.get(pickType + "I")[0].setSelected(true);
setWeightButton(pickType, Pick.Onset.EMERGENT, 0); // I done automatically
propagateUncertainty(pickType, Pick.Onset.EMERGENT, 0);
propagateUncertainty(pickType, Pick.Onset.IMPULSIVE, 0);
repaint();
}
}

/**
* Toggle weight for a given phase/onset combination.
* @param phase P or S
* @param onset Emergent or Impulsive
* @param weight 0 to 4
*/
private void setWeightButton(String phase, Pick.Onset onset, int weight) {
for (Pick.Onset o : Pick.Onset.values()) {
if (o == Pick.Onset.QUESTIONABLE) {
continue;
}
if (o == onset) {
String key = phase + onset.toString().substring(0, 1);
weightButtons.get(key)[weight].setSelected(true);
} else {
String key = phase + o.toString().substring(0, 1);
weightButtons.get(key)[0].setSelected(true);
}
}
}

/**
* Get enabled/disabled option for hiding coda.
*
Expand Down Expand Up @@ -568,9 +589,5 @@ public boolean isPlot() {
public void setPlot(boolean plot) {
plotMenu.setSelected(plot);
}

public HashMap<String, JRadioButtonMenuItem[]> getWeightButtons() {
return weightButtons;
}

}
25 changes: 10 additions & 15 deletions src/main/java/gov/usgs/volcanoes/swarm/event/PickMenuBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.xml.sax.SAXException;

/**
* Right click menu for picks.
* Pick menu bar on clipboard toolbar.
*
* @author Diana Norgaard
*/
Expand Down Expand Up @@ -59,17 +59,6 @@ public PickMenuBar(WaveClipboardFrame clipboard) {
this.createMenu();
}

/**
* Get instance of PickModeMenu.
* @return pick mode menu
*/
/* public static PickMenuBar getInstance() {
if (menuBar == null) {
menuBar = new PickMenuBar();
}
return menuBar;
}*/

/**
* Create right click menu for pick.
*/
Expand Down Expand Up @@ -223,9 +212,15 @@ public void actionPerformed(ActionEvent e) {
clearMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_D, ActionEvent.CTRL_MASK));
clearMenu.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
for (WaveViewPanel wvp : clipboard.getWaves()) {
wvp.getPickMenu().clearAllPicks();
wvp.repaint();
String message = "Are you sure you want to remove all picks from clipboard?";
message += "\nThis cannot be undone.";
int result = JOptionPane.showConfirmDialog(Swarm.getApplicationFrame(), message,
"Remove Picks", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
for (WaveViewPanel wvp : clipboard.getWaves()) {
wvp.getPickMenu().clearAllPicks();
wvp.repaint();
}
}
}
});
Expand Down

0 comments on commit 50cfb5f

Please sign in to comment.