⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wfview.java

📁 一个用java写的地震分析软件(无源码)-used to write a seismic analysis software (without source)
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package org.trinet.jiggle;

import java.util.*;
import org.trinet.jdbc.*;
import org.trinet.jasi.*;
import org.trinet.jasi.TravelTime;
import org.trinet.jasi.coda.*;
import org.trinet.util.*;
import org.trinet.util.gazetteer.LatLonZ;
/**
 * This is a container that holds a Waveform and bounds info for a
 * particular channel/time-window.
 * The viewSpan (time bounds) of the view may be set arbitrarily by the caller
 * and may be independent of the data that may actually be available.
 * Therefore, the viewSpan time window may
 * have no time series, be incomplete, or may clip a Waveform.
 * A WFView may have associated Phases, Amplitudes, etc. even if
 * there is no time series. <p>

 <tt>
    WFView
    viewSpan.start					     viewSpan.end
    |	|dataSpan.start					|dataSpan.end	|
    v   v                                               v               v
    +===WFView==========================================================+
    |   +---Waveform------------------------------------+               |
    |	+-----------+		+-----------------------+		|
    |	| WFSegment | time-tear	|      WFSegment	|		|
    |	+-----------+		+-----------------------+		|
    |   tstart      tend        tstart			tend		|
    |   +-----------------------------------------------+               |
    +===================================================================+
</tt>
*/

public class WFView implements Channelable {
    /** Channel description and info */
    // Note: a Waveform object also has a Channel's but this one is used for
    // sorting, etc.
    public Channel chan;

    /** Time series */
    public Waveform wf = null;

    /** List of original data packet start/stop times if data was
     * in a packetized form when read in. */
    public TimeSpan packetSpans[];

    /** Distance (km) from current active origin */
//    public double dist;

    /** The time window of the virtural "view".
     *  It is independent of the actual data (dataSpan), especially if there is
     *  no waveform in the view.*/
    TimeSpan viewSpan = new TimeSpan();

    /** The span of the actual Waveform data. May contain time-tears. */
    TimeSpan dataSpan = new TimeSpan();

    /** List of Phases that are in this view */
    // This list is dynamically maintained by the update method in ActiveWFPanel.
    PhaseList phaseList = new PhaseList();

    /** List of Amplitudes in this view. */
    AmpList ampList = new AmpList();

    /** List of Amplitudes in this view. */
    CodaList codaList = new CodaList();

    /** One reference to the MasterView shared by all WFViews */
    // this looks suspect to me 1/17/02
    static MasterView mv;

    /** Travel time for P and S identification. */
    TravelTime tt = TravelTime.getInstance();
/**
 * Construct a nul view window.
 */
public WFView ()
{
}

/**
 * Construct an empty view window.
 * ViewSpan and DataSpan will be empty.
 */
public WFView (Channelable ch) {
    chan = Channel.create();
    chan.setChannelObj(ch.getChannelObj());
}
/**
 * Construct view window with defined viewSpan set to these time bounds.
 * DataSpan will be empty.
 */
 public WFView (Channelable ch, double t0, double tn) {
     this(ch);
     viewSpan.set(t0, tn);
 }
/**
 * Construct view window with defined viewSpan time bounds.
 * DataSpan will be empty.
 */
 public WFView (Channelable ch, TimeSpan ts) {
     this(ch, ts.getStart(), ts.getEnd());
 }
/**
 * Construct a view window containing the given WFSegment.
 * Set viewSpan time window to segment data time span.
 */
public WFView (Waveform wf) {
    setWaveform (wf);
}

/**
 * Give ALL WFViews a reference to the MasterView.
 */
    public static void setMasterView(MasterView masterView) {
	mv = masterView;
    }

/**
 * Set the WFSegment vector for this WFView to the one passed as arg.
 * Set viewSpan time window to include data time span.
 */
public void setWaveform(Waveform wf) {

    this.wf = wf;
    chan = Channel.create();
    chan.setChannelObj(wf.getChannelObj());

    dataSpan = new TimeSpan(wf.getTimeSpan());
    viewSpan.include(dataSpan);
    //    dataSpan.include(wf.timeStart.doubleValue(), wf.timeEnd.doubleValue());
    //    viewSpan = new TimeSpan (dataSpan);
}

/**
 * Set the viewSpan to the given Timespan. This is used to align traces by
 * setting all their viewSpans equal.
 */
public void setViewSpan (TimeSpan ts) {
    viewSpan = new TimeSpan(ts);
}

public void setViewSpanStart (double start) {
    viewSpan.setStart(start);
}

public void setViewSpanEnd (double end) {
    viewSpan.setStart(end);
}

/**
 * Make sure the viewSpan includes the given TimeSpan.
 */
public void viewSpanInclude (TimeSpan ts) {
    viewSpan.include(ts);
}
/**
 * Make sure the viewSpan includes the given time.
 */
public void viewSpanInclude (double t0) {
    viewSpan.include(t0);
}

/**
 * Return the Waveform object. Will return 'null' if there is no waveform.
 */
public Waveform getWaveform() {

       return wf;
}

/**
 * Returns 'true' if there is waveform header data in this WFView. The actual time-series
 * may or may not be loaded. Use hasTimeSeries() to check for actual time-series.
 */
    public boolean hasWaveformHeader()  {
	if (getWaveform() == null) return false;
	return true;
    }
/**
 * Returns 'true' if there is actual time-series loaded for this WFView.
 */
    public boolean hasTimeSeries() {
	    if (wf == null) return false;
         return  wf.hasTimeSeries();

    }
/**
 * Attempt to load the time series for his WFView. There may be none to load. Do
 * NOT reload if hasTimeSeries() is true. Returns 'true' if time-series was/is loaded.  */
    public synchronized boolean loadTimeSeries() {

	if (hasTimeSeries()) return true;	// don't reload if we already have it

	return reloadTimeSeries();

    }

/**
 * Attempt to reload the time series for his WFView. There may be none to load.
 Returns 'true' if time-series was reloaded.  */
    public boolean reloadTimeSeries() {
//	if (wf == null) return false;
     if (!hasWaveformHeader()) return false;

	return wf.loadTimeSeries();

    }
/**
 * Attempt to unload the time series for his WFView. There may be none to load.
 Returns 'true' if time-series was unloaded.  */
    public synchronized boolean unloadTimeSeries() {
	if (wf == null) return false;

	return wf.unloadTimeSeries();

    }

/**
 * Returns an array of WFSegments that make up the Waveform in this WFView
 */
/*   public WFSegment [] getSegmentArray() {

       if (wf == null) return null;
       return WFSegment.getArray(wf.getSegmentList());

   }
*/
   // Implement the Channelable interface
    /** Set the Channel */
    public void setChannelObj(Channel chan){
      this.chan = chan;
    }
    /** Return the Channel. */
    public Channel getChannelObj() {
      return chan;
    }

    /** Calculate and set both epicentral (horizontal) distance and true (hypocentral)
     * distance of this channel from the given location in km.
     * Note: this is better than setDistance() or setHorizontalDistance() because
     * it does both and insures they are consistent. If the channel's LatLonZ or
     * the LatLonZ in the argument is null, both distances are set = 9999.9*/
    public double calcDistance (LatLonZ loc) {
        return chan.calcDistance(loc);
    }
    /** Set the distance. */
    public void setDistance(double distance) {
      chan.setDistance(distance);
    }
    /** Set the distance. */
//    public void setDistance(double distance, double horizDistance) {
//      chan.setDistance(distance, horizDistance);
//    }
    /** Set the distance. */
    public void setHorizontalDistance(double hdistance) {
      chan.setHorizontalDistance(hdistance);;
    }
    /** Return the distance. */
    public double getDistance(){
      return chan.getDistance();
    }
    /** Return the distance. */
    public double getHorizontalDistance(){
      return chan.getHorizontalDistance();
    }

     public void setAzimuth(double az) {
        getChannelObj().setAzimuth(az);
     }
     public double getAzimuth () {
        return getChannelObj().getAzimuth();
     }

/**
 * Given a Collection of Channels (i.e. a station list), find the one that
 * matches this WFViews's current Channel. Replace the WFView's Channel object
 * with the "found" Channel which has complete Channel location & response info.
 * This is necessary for distance calcs, sorting, magnitudes, etc.  Return
 * 'true' if match was found, else return 'false'.  */
public boolean copyChannel(Collection chanList)
    {
	if (chanList == null) return false;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -