00001 //------------------------------------------------------------------- 00002 // 00003 // File: TxLinePlotData.h 00004 // 00005 // Purpose: Interface for holder of line plot data 00006 // 00007 // Version: $Id: TxLinePlotData.h,v 1.4 2002/04/05 21:53:55 kgl Exp $ 00008 // 00009 // Copyright 2001, tech-X Corporation 00010 // 00011 //------------------------------------------------------------------- 00012 00013 #ifndef TX_LINE_PLOT_DATA_H 00014 #define TX_LINE_PLOT_DATA_H 00015 00016 // unix includes 00017 #include <txc_assert.h> 00018 00019 // txmodel includes 00020 #include "TxPlotData.h" 00021 #include "TxLinePlotDesc.h" 00022 00023 // txmath includes 00024 #include <TxThroughStream.h> 00025 00046 class TxLinePlotData : public TxPlotData { 00047 00048 public: 00049 00051 TxLinePlotData(); 00052 00054 virtual ~TxLinePlotData(); 00055 00063 virtual void initialCalculation() {} 00064 00071 virtual void printInitialCalculation() {} 00072 00074 virtual TXSTD::string getClassID() const { return "TxLinePlotData";} 00075 00077 // virtual int read(istream&); 00078 00080 // virtual int write(ostream&) const; 00081 00083 virtual void restart(); 00084 00086 virtual void paramsChanged(); 00087 00089 virtual void optionsChanged(); 00090 00092 virtual void stringsChanged(); 00093 00095 int getNumValuesCalculated() const { return getNumColumns();} 00096 00098 int getNumSeries(){ return dataName.size();} 00099 00101 int getNumSeries(int i){ return txlpd[i].getNumSeries();} 00102 00104 int getMaxNumSeries(){ return getMaxNumRows();} 00105 00107 const double* getDataRow(int i){ return getDataPtr(i,0);} 00108 00113 const double* getXSeries(int ipl, int iseries) { 00114 return getDataRow( txlpd[ipl].getXIndex(iseries) ); 00115 } 00116 00121 const double* getYSeries(int ipl, int iseries) { 00122 return getDataRow( txlpd[ipl].getYIndex(iseries) ); 00123 } 00124 00128 const double* getXSeries(int ipl, int iseries, int istart) { 00129 return getDataPtr(txlpd[ipl].getXIndex(iseries), istart); 00130 } 00131 00135 const double* getYSeries(int ipl, int iseries, int istart) { 00136 return getDataPtr(txlpd[ipl].getYIndex(iseries), istart); 00137 } 00138 00142 int clearPlots() { 00143 // cout << "claerPlots: " << txlpd.size() << endl; 00144 txlpd.clear(); 00145 return 0; 00146 } 00147 00151 int isConnected() const {return iconnect;} 00152 00154 virtual int getNumPlots() const { return txlpd.size();} 00155 00157 virtual const TXSTD::string getTitle(int i) const { return txlpd[i].getTitle();} 00158 00160 virtual const TXSTD::string getXLabel(int i) const { return txlpd[i].getXLabel();} 00161 00163 virtual double getXMin(int i) const { return txlpd[i].getXMin();} 00164 00166 virtual double getXMinPlot(int i) const { return txlpd[i].getXMinPlot();} 00167 00169 virtual double getXMax(int i) const { return txlpd[i].getXMax();} 00170 00172 virtual double getXMaxPlot(int i) const { return txlpd[i].getXMaxPlot();} 00173 00175 virtual const TXSTD::string getYLabel(int i) const { return txlpd[i].getYLabel();} 00176 00178 virtual double getYMin(int i) const { return txlpd[i].getYMin();} 00179 00181 virtual double getYMinPlot(int i) const { return txlpd[i].getYMinPlot();} 00182 00184 virtual double getYMax(int i) const { return txlpd[i].getYMax();} 00185 00187 virtual double getYMaxPlot(int i) const { return txlpd[i].getYMaxPlot();} 00188 00195 int appendPlotDesc(const TXSTD::string&, const TXSTD::string&, const TXSTD::string&, int, int); 00196 00201 void appendSeriesToPlot(int, int, int); 00202 00204 void setXMin(int i, double d){ txlpd[i].setXMin(d);} 00205 00207 void setXMinPlot(int i, double d){ txlpd[i].setXMinPlot(d);} 00208 00213 void setXMinAuto(int i, int a){ txlpd[i].setXMinAuto(a);} 00214 00219 void setXMinNice(int i, int a){ txlpd[i].setXMinNice(a);} 00220 00222 void setXMax(int i, double d){ txlpd[i].setXMax(d);} 00223 00225 void setXMaxPlot(int i, double d){ txlpd[i].setXMaxPlot(d); } 00226 00231 void setXMaxAuto(int i, int a){ txlpd[i].setXMaxAuto(a);} 00232 00237 void setXMaxNice(int i, int a){ txlpd[i].setXMaxNice(a);} 00238 00240 void setYMin(int i, double d){ txlpd[i].setYMin(d);} 00241 00243 void setYMinPlot(int i, double d){ txlpd[i].setYMinPlot(d);} 00244 00249 void setYMinAuto(int i, int a){ txlpd[i].setYMinAuto(a);} 00250 00255 void setYMinNice(int i, int a){ txlpd[i].setYMinNice(a);} 00256 00258 void setYMax(int i, double d){ txlpd[i].setYMax(d);} 00259 00261 void setYMaxPlot(int i, double d){ txlpd[i].setYMaxPlot(d);} 00262 00267 void setYMaxAuto(int i, int a){ txlpd[i].setYMaxAuto(a);} 00268 00273 void setYMaxNice(int i, int a){ txlpd[i].setYMaxNice(a);} 00274 00276 void disconnect() {iconnect = 0;} 00277 00283 virtual void calcLims() { 00284 int i; 00285 for(unsigned int i=0; i<txlpd.size(); i++) calcLims(i); 00286 } 00287 00293 void setOutThroughStream(TxThroughStream& t) { 00294 if(outThruStrmOwner) delete txcout; 00295 txcout = &t; 00296 outThruStrmOwner = false; 00297 } 00298 00304 void setErrThroughStream(TxThroughStream& t) { 00305 if(errThruStrmOwner) delete txcerr; 00306 txcerr = &t; 00307 errThruStrmOwner = false; 00308 } 00309 00315 virtual TxThroughStream *getOutThroughStream() const { return txcout; } 00316 00322 virtual TxThroughStream *getErrThroughStream() const { return txcerr; } 00323 00324 protected: 00325 00326 /* 00327 * The TxThroughStream output log 00328 */ 00329 TxThroughStream *txcout; 00330 00331 /* 00332 * The TxThroughStream error log 00333 */ 00334 TxThroughStream *txcerr; 00335 00336 /* 00337 * Whether I own the outThroughStream 00338 */ 00339 bool outThruStrmOwner; 00340 00341 /* 00342 * Whether I own the errThroughStream 00343 */ 00344 bool errThruStrmOwner; 00345 00347 int appendSeries(const TXSTD::string&); 00348 00350 void setNumValuesCalculated(int i){ setNumColumns(i);} 00351 00353 void setMaxDataPoints(int i){ setMaxNumColumns(i);} 00354 00356 void setMaxNumSeries(int i){ setMaxNumRows(i);} 00357 00359 void appendValues(double* d); 00360 00362 int iconnect; 00363 00364 private: 00365 00367 TxLinePlotData(const TxPlotData&); 00368 00370 const TxLinePlotData& operator=(const TxPlotData&); 00371 00376 virtual void updateLims(int); 00377 00379 virtual void calcLims(int i){ txlpd[i].calcLims();} 00380 00382 TXSTD::vector<TXSTD::string> dataName; 00383 00385 TXSTD::vector<TxLinePlotDesc> txlpd; 00386 00387 }; 00388 00389 #endif // TX_LINE_PLOT_DATA_H
Copyright Tech-X Corporation, all rights reserved.