📄 masterview.java
字号:
}
}
*/
/**
* Load the amplitudes for this MasterView. Loads all amps associated with
* the preferred magnitude of all solutions in view.
*/
/* This should be done for a time window but they've fucked up the dbase by
* writing multiple RT system's data into it with no indication of what is primary.
* I am ignoring "network amplitudes" for now.
*/
public void loadAmplitudes() {
if (ampRetrieveFlag) {
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
// add amps to the sol's mag's list...
sol[i].addAmps (Amplitude.create().getByMagnitude(sol[i].magnitude) );
}
}
}
/**
* Load the codas for this MasterView. Loads all codas associated with
* the preferred magnitude of all solutions in view.
*/
public void loadCodas() {
if (codaRetrieveFlag) {
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
sol[i].addCodas( Coda.create().getByMagnitude(sol[i].magnitude) );
}
}
}
/**
* Load the phases for this MasterView. Connect a list to each solution
* and add all phases to the MasterView's list.
*/
public void loadPhases() {
if (phaseRetrieveFlag) {
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
sol[i].addPhases( Phase.create().getBySolution(sol[i]) );
// phaseList.addAll( sol[i].phaseList );
}
}
}
/**
* Load the waveforms for this MasterView using the mode defined by
* MasterView.waveformLoadMode. */
public void loadWaveforms() {
// Get timeseries if flag is set
System.out.println ("MV: loadWaveforms mode= "+waveformLoadMode);
if (waveformLoadMode == LoadAllInForeground) {
wfvList.loadWaveformsNow();
} else if (waveformLoadMode == LoadAllInBackground) {
wfvList.loadWaveformsInBackground();
} else if (waveformLoadMode == Cache) {
// start the CacheMgr
System.out.println ("MV: loadWaveformsInCache ");
wfvList.loadWaveformsInCache();
}
}
/**
* Return Collection (ArrayList) of waveforms in this masterView. Not all
* WFViews will necessarily have a waveform so you can't assume the returned
* collection will have the same size or order as the WFView list.
* Returns null if there are no
* waveforms. */
public Collection getWaveformList () {
WFView wfv[] = wfvList.getArray();
ArrayList wfa = new ArrayList();
for (int i = 0; i<wfv.length; i++) {
if (wfv[i].wf != null) wfa.add(wfv[i].wf);
}
return wfa;
}
public int getWFSegmentCount() {
WFView wfv[] = wfvList.getArray();
Waveform wf[] = new Waveform[wfv.length];
int knt = 0;
for (int i = 0; i<wfv.length; i++) {
knt = wfv[i].wf.getSegmentCount();
}
return knt;
}
/**
* Return array of waveforms in this masterView. Not all
* WFViews will necessarily have a waveform. Returns empty array if there are no
* waveforms. */
public Waveform[] getWaveformArray () {
WFView wfv[] = wfvList.getArray();
Waveform wf[] = new Waveform[wfv.length];
for (int i = 0; i<wfv.length; i++) {
wf[i] = wfv[i].wf;
}
return wf;
}
/**
* Add a WFView to the masterView
*/
public void addWFView (WFView wfv) {
wfvList.add(wfv);
this.timeSpan.include(wfv.viewSpan);
}
/** Associate this phase with the currently selected Solution and add the phase
to the Solutions's phase list and the MasterView's phase list. Enforces the rule that
only one phase of each type is allowed in each solution. */
public void addPhaseToCurrentSolution(Phase ph) {
Solution sol = getSelectedSolution();
// associate phase with current solution
ph.associate(sol);
// add it to the Solution phase list
Phase phres = sol.phaseList.addOrReplacePhase(ph);
// if the method returns the original phase that phase was ADDED
// to the list, otherwise it replaced and existing phase.
/* if (phres == ph)
// add it to the MasterView phase list
phaseList.addOrReplacePhase(ph);
*/
}
/**
* Return the number of WFView in this MasterView
*/
public int getWFViewCount() {
return wfvList.size();
}
public TimeSpan getViewSpan () {
return timeSpan;
}
public PhaseList getAllPhases() {
PhaseList bigList = new PhaseList();
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
bigList.addAll(sol[i].phaseList);
}
return bigList;
}
/** Return the count of phases in ALL solutions. */
public int getPhaseCount() {
int knt = 0;
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
knt += sol[i].phaseList.size();
}
return knt;
}
public AmpList getAllAmps() {
AmpList bigList = new AmpList();
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
bigList.addAll(sol[i].ampList);
}
return bigList;
}
/** Return the count of amps in ALL solutions. */
public int getAmpCount() {
int knt = 0;
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
knt += sol[i].ampList.size();
}
return knt;
}
public CodaList getAllCodas() {
CodaList bigList = new CodaList();
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
bigList.addAll(sol[i].codaList);
}
return bigList;
}
/** Return the count of codas in ALL solutions. */
public int getCodaCount() {
int knt = 0;
Solution sol[] = solList.getArray();
for (int i = 0; i<sol.length; i++) {
knt += sol[i].codaList.size();
}
return knt;
}
/** If arg is true, only WFViews with phases will be included in the master view. */
public void includeOnlyWithPhases (boolean tf) {
includeOnlyWithPhases = tf;
}
/** Returns true if only WFViews with phases will be included in the master view. */
public boolean getIncludeOnlyWithPhases () {
return includeOnlyWithPhases;
}
/** Set the alignment mode. Currently only time alignment is supported. Returns
* false if an invalid mode is specified. */
public boolean setAlignmentMode (int mode) {
if (mode > -1 && mode < AlignmentModeCount) {
alignmentMode = mode;
return true;
} else {
return false;
}
}
/** Return the alignment mode. */
public int getAlignmentMode() {
return alignmentMode;
}
/** Align views on whatever is defined by getAlignmentMode() */
public void alignViews() {
if (getAlignmentMode() == AlignOnTime) {
timeAlignViews();
} /* else if (getAlignmentMode() == AlignOnP) {
pAlignViews();
} else if (getAlignmentMode() == AlignOnS) {
sAlignViews();
} */
}
/**
* Time align the WFViews by setting all the viewSpans equal to the
* MasterView's viewSpan
*/
public void timeAlignViews () {
WFView wfv[] = wfvList.getArray();
for (int i = 0; i<wfv.length; i++) {
wfv[i].setViewSpan(this.timeSpan);
}
}
/**
* Align the WFViews on the P-arrival by adding a move-out to all the viewSpans
*/
////
//// THIS WAS NEVER REALLY WORKING CORRECTLY
/*
public void pAlignViews () {
WFView wfv[] = wfvList.getArray();
if (wfv.length < 1) return;
TravelTime tt = new TravelTime();
// OT - 10 sec
double ot = getSelectedSolution().datetime.doubleValue() - 10.0;
double baseTime = wfvList.getEarliestSampleTime();
double offset;
// add P=wave travetime to each
for (int i = 0; i<wfv.length; i++) {
offset = wfv[i].getViewSpan().getStart() - baseTime + tt.getTTp(wfv[i].dist);
wfv[i].getViewSpan().setStart(baseTime + tt.getTTp(wfv[i].dist));
}
}
*/
/**
* Align the WFViews on the S-arrival by adding a move-out to all the viewSpans
*/
/*
public void sAlignViews () {
WFView wfv[] = wfvList.getArray();
if (wfv.length < 1) return;
TravelTime tt = new TravelTime();
// OT - 10 sec
double baseTime = getSelectedSolution().datetime.doubleValue() - 10.0;
// add P=wave travetime to each
for (int i = 0; i<wfv.length; i++) {
wfv[i].getViewSpan().setStart(baseTime + tt.getTTs(wfv[i].dist));
}
}
*/
/**
* Set the viewSpan of the MasterView and ALL WFViews to this timeSpan.
*/
public void setAllViewSpans (TimeSpan ts) {
this.timeSpan = ts;
alignViews();
}
/**
* Set flag to time align the WFViews by setting all the viewSpans equal to
* the MasterView's viewSpan
*/
/* public void setTimeAlign (boolean tf) {
timeAlign = tf;
}
*/
/**
* Set max number of waveforms to load. Used to avoid memory overflow
*/
public void setWaveformLoadLimit (int limit) {
waveformLoadLimit = limit;
}
/**
* Return max number of waveforms to load. Used to avoid memory overflow
*/
public int getWaveformLoadLimit () {
return waveformLoadLimit;
}
/**
* Sort/resort the WFView list by distance from the current selected Solution.
*/
public void distanceSort() {
distanceSort(solList.getSelected());
}
/**
* Sort/resort the WFView list by distance from the given Solution.
*/
public void distanceSort(Solution sol) {
distanceSort(sol.getLatLonZ());
}
/**
* Sort/resort the WFView list by distance from the given LatLonZ.
*/
public void distanceSort (LatLonZ latlonz) {
wfvList.distanceSort(latlonz);
if (getSelectedSolution() != null)
getSelectedSolution().sortReadingLists();
}
/**
* Delete all Amps associated with this solution that are greater
* than or equal to this dist. Returns the number of deleted items.
*/
public int stripAmpsByDistance(double cutDist, Solution sol) {
int knt = 0;
Amplitude am[] = sol.ampList.getArray();
for (int i = 0;i<am.length; i++) {
// must delete from Solutions's list *NOT* WFView's list because
// the MV's list is Active and will notify observers of change
// This, in turn, will update the WFView.phaseLists
if (am[i].getDistance() > cutDist) {
sol.deleteAmplitude(am[i]);
knt++;
}
}
return knt;
}
/**
* Delete all Codas associated with this solution that are greater
* than or equal to this dist. Returns the number of deleted items.
*/
public int stripCodasByDistance(double cutDist, Solution sol) {
int knt = 0;
Coda coda[] = sol.codaList.getArray();
for (int i = 0;i<coda.length; i++) {
// must delete from Solutions's list *NOT* WFView's list because
// the MV's list is Active and will notify observers of change
// This, in turn, will update the WFView.phaseLists
if (coda[i].getDistance() > cutDist) {
sol.deleteCoda(coda[i]);
knt++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -