View Javadoc

1   package org.catacomb.dataview.formats;
2   
3   import java.io.File;
4   
5   import org.catacomb.datalish.Box;
6   import org.catacomb.dataview.display.ViewConfig;
7   import org.catacomb.graph.gui.Painter;
8   import org.catacomb.report.E;
9   import org.catacomb.util.ArrayUtil;
10  
11  
12  public class MeshSummary implements DataHandler {
13  
14      Mesh2plusTimeDisplay meshDH;
15  
16  
17      double[] xdat;
18  
19      double[][] ydat;
20  
21      double ymin;
22      double ymax;
23  
24      public MeshSummary(DataHandler dh) {
25          meshDH = (Mesh2plusTimeDisplay)dh;
26          xdat = meshDH.getFrameValues();
27          String[] sa = dh.getPlotNames();
28  
29          E.info("setting plot " + sa[sa.length-1]);
30  
31          setPlot(sa[sa.length-1]);
32      }
33  
34  
35      public int getContentStyle() {
36          return DataHandler.STATIC;
37      }
38  
39  
40      public double[] getFrameValues() {
41          return null;
42      }
43  
44  
45      public String getMagic() {
46          return null;
47      }
48  
49  
50      public double getMaxValue() {
51          return 0;
52      }
53  
54  
55      public double getMinValue() {
56          // TODO Auto-generated method stub
57          return 0;
58      }
59  
60  
61      public String[] getPlotNames() {
62          return meshDH.getPlotNames();
63      }
64  
65  
66      public String[] getViewOptions() {
67          // TODO Auto-generated method stub
68          return null;
69      }
70  
71  
72      public void read(File f) {
73          // TODO Auto-generated method stub
74  
75      }
76  
77  
78      public void setFrame(int ifr) {
79          // TODO Auto-generated method stub
80  
81      }
82  
83  
84      public void setPlot(String s) {
85          ydat = new double[5][xdat.length];
86          for (int i = 0; i < xdat.length; i++) {
87  
88              double[] pdat = meshDH.getFrameData(s, i);
89              ydat[0][i] = ArrayUtil.minD(pdat);
90              ydat[1][i] = ArrayUtil.maxD(pdat);
91              ydat[2][i] = ArrayUtil.avg(pdat);
92              double sigma = ArrayUtil.sd(pdat);
93              ydat[3][i] = ydat[2][i] - sigma;
94              ydat[4][i] = ydat[2][i] + sigma;
95          }
96          ymin = ArrayUtil.min(ydat);
97          ymax = ArrayUtil.max(ydat);
98  
99      }
100 
101 
102     public void setViewStyle(String s) {
103         // TODO Auto-generated method stub
104 
105     }
106 
107 
108     public boolean antialias() {
109         // TODO Auto-generated method stub
110         return false;
111     }
112 
113 
114     public Box getLimitBox() {
115         Box b = new Box(xdat[0], ymin, xdat[xdat.length-1], ymax);
116         return b;
117     }
118 
119 
120     public void instruct(Painter p) {
121         if (ydat != null) {
122             int nx = xdat.length;
123             p.setColorRed();
124             p.drawPolyline(xdat, ydat[0], nx);
125             p.drawPolyline(xdat, ydat[1], nx);
126             p.setColorWhite();
127             p.drawPolyline(xdat, ydat[2], nx);
128             p.setColorBlue();
129             p.drawPolyline(xdat, ydat[3], nx);
130             p.drawPolyline(xdat, ydat[4], nx);
131         }
132 
133     }
134 
135 
136     public DataHandler getCoHandler() {
137         return null;
138     }
139 
140 
141     public boolean hasData() {
142         return true;
143     }
144 
145 
146     public String getXAxisLabel() {
147         // TODO Auto-generated method stub
148         return null;
149     }
150 
151 
152     public String getYAxisLabel() {
153         // TODO Auto-generated method stub
154         return null;
155     }
156 
157 
158     public ViewConfig getViewConfig(String s) {
159         // TODO Auto-generated method stub
160         return null;
161     }
162 
163 
164     public void setZValue(double d) {
165         // TODO Auto-generated method stub
166 
167     }
168 
169 }