View Javadoc

1   /*
2     The TauP Toolkit: Flexible Seismic Travel-Time and Raypath Utilities.
3     Copyright (C) 1998-2000 University of South Carolina
4   
5     This program is free software; you can redistribute it and/or
6     modify it under the terms of the GNU General Public License
7     as published by the Free Software Foundation; either version 2
8     of the License, or (at your option) any later version.
9   
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14  
15    You should have received a copy of the GNU General Public License
16    along with this program; if not, write to the Free Software
17    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18  
19    The current version can be found at 
20    <A HREF="www.seis.sc.edu">http://www.seis.sc.edu</A>
21  
22    Bug reports and comments should be directed to 
23    H. Philip Crotwell, crotwell@seis.sc.edu or
24    Tom Owens, owens@seis.sc.edu
25  
26  */
27  
28  package edu.sc.seis.TauP;
29  
30  import java.awt.Container;
31  import java.awt.Graphics;
32  import java.util.Vector;
33  
34  /*** plots slowness versus depth.
35    *
36    * @version 1.1.3 Wed Jul 18 15:00:35 GMT 2001
37  
38  
39  
40    * @author H. Philip Crotwell
41    *
42    */
43  public class SlownessPlot extends XYPlot {
44  
45     public SlownessPlot(Container parent) {
46        super(parent);
47        title = "Slowness";
48        xLabel = "p (sec/km or km-sec/km)";
49        yLabel = "depth (km)";
50        yTickWidth = 500;
51     }
52  
53     public SlownessPlot(Container parent, int width, int height) {
54        super(parent, width, height);
55        title = "Slowness";
56        xLabel = "p (sec/km or km-sec/km)";
57        yLabel = "depth (km)";
58        yTickWidth = 500;
59     }
60  
61     public void plot(SlownessModel sModel, boolean isPWave) {
62        SlownessLayer ss;
63  
64        xSegments = new Vector();
65        ySegments = new Vector();
66        xData = new double[2*sModel.getNumLayers(isPWave)];
67        yData = new double[2*sModel.getNumLayers(isPWave)];
68  
69        if (! isPWave) {
70           minX = 0.0;
71           zoomMinX = minX;
72           maxX = 2500.0;
73           zoomMaxX = maxX;
74           minY = 0.0;
75           zoomMinY = minY;
76           maxY = sModel.getRadiusOfEarth();
77           zoomMaxY = maxY;
78        } else {
79           minX = 0.0;
80           zoomMinX = minX;
81           maxX = 1300.0;
82           zoomMaxX = maxX;
83           minY = 0.0;
84           zoomMinY = minY;
85           maxY = sModel.getRadiusOfEarth();
86           zoomMaxY = maxY;
87        }
88  
89        int j=0;
90        for (int i=0;i<sModel.getNumLayers(isPWave);i++) {
91           ss=sModel.getSlownessLayerClone(i, isPWave);
92           yData[j]=sModel.getRadiusOfEarth() - ss.getTopDepth();
93           xData[j]=ss.getTopP();
94           if (DEBUG) System.out.println("x "+xData[j]+" y "+yData[j]);
95           j++;
96           yData[j]=sModel.getRadiusOfEarth() - ss.getBotDepth();
97           xData[j]=ss.getBotP();
98           if (DEBUG) System.out.println("x "+xData[j]+" y "+yData[j]);
99           j++;
100       }
101       xSegments.addElement(xData);
102       ySegments.addElement(yData);
103 
104       repaint();
105    }
106  
107    public void paint(Graphics g) {
108       super.paint(g);
109    }
110 }