1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 package edu.sc.seis.TauP;
30
31 import java.awt.Container;
32 import java.awt.Graphics;
33 import java.util.Vector;
34
35 /*** Plots distance versus ray parameter.
36 *
37 * @version 1.1.3 Wed Jul 18 15:00:35 GMT 2001
38
39
40
41 * @author H. Philip Crotwell
42 */
43 public class DistPlot extends XYPlot {
44
45 public DistPlot(Container parent) {
46 super(parent);
47 title = "Dist";
48 xLabel = "p (sec/km or km-sec/km)";
49 yLabel = "dist (sec)";
50 yTickWidth = 10;
51 }
52
53 public DistPlot(Container parent, int width, int height) {
54 super(parent, width, height);
55 title = "Dist (km)";
56 xLabel = "p (sec/km or km-sec/km)";
57 yLabel = "distance (km)";
58 yTickWidth = 10;
59 }
60
61 public void plot(TauModel tModel, boolean isPWave) {
62
63 int waveNum;
64 if (! isPWave) {
65 waveNum = 1;
66 minX = 0.0;
67 zoomMinX = minX;
68 maxX = 2000.0;
69 zoomMaxX = maxX;
70 minY = 0.0;
71 zoomMinY = minY;
72 maxY = 270.0;
73 zoomMaxY = maxY;
74 } else {
75 waveNum = 0;
76 minX = 0.0;
77 zoomMinX = minX;
78 maxX = 1300.0;
79 zoomMaxX = maxX;
80 minY = 0.0;
81 zoomMinY = minY;
82 maxY = 200.0;
83 zoomMaxY = maxY;
84 }
85
86 int jj=0;
87 double x, y;
88 double[] tempXData, tempYData;
89 xSegments = new Vector();
90 ySegments = new Vector();
91
92 for (int i=0;i<tModel.tauBranches[waveNum].length;i++) {
93 jj=0;
94 tempXData = new double[tModel.rayParams.length];
95 tempYData = new double[tModel.rayParams.length];
96 for (int j=0;j<tModel.rayParams.length;j++) {
97 x=tModel.rayParams[j];
98 y=0;
99 for (int k=0;k<=i;k++) {
100 y += 2*tModel.tauBranches[waveNum][k].getDist(j);
101 }
102 y*=180/Math.PI;
103 if ((y!=0 || x==0 ) && tModel.tauBranches[waveNum][i].getDist(j) != 0.0) {
104 tempXData[jj]=x;
105 tempYData[jj]=y;
106 if (DEBUG) System.out.println(x+" "+y);
107 jj++;
108 }
109 }
110 if (DEBUG) System.out.println("> ");
111 xData= new double[jj];
112 System.arraycopy(tempXData, 0, xData, 0, jj);
113 yData= new double[jj];
114 System.arraycopy(tempYData, 0, yData, 0, jj);
115 xSegments.addElement(xData);
116 ySegments.addElement(yData);
117 xData=null;
118 yData=null;
119 }
120
121 repaint();
122 }
123
124 public void paint(Graphics g) {
125 super.paint(g);
126 }
127 }