** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezplot.h,v 1.22 2000/12/27 03:16:02 kevin Exp $
+** $Id: ezplot.h,v 1.24 2001/01/02 16:02:12 kevin Exp $
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License (version 2) as
#include <cmath>
#include <stddef.h>
#include "ctsupport.h"
-#include "sgp.h"\r
+#include "sgp.h"
#include "pol.h"
//----------------------------------------------------------------------
// axis definitions
-enum {\r
+enum {
LINEAR = 1, // linear axis
LOG, // logrithmic axis
- NOAXIS, // don't plot axis \r
+ NOAXIS, // don't plot axis
};
// tick definitions
-enum {\r
+enum {
ABOVE = 1,
BELOW,
RIGHT,
- LEFT,\r
+ LEFT,
};
-// line types \r
+// line types
enum {
NOLINE = 0,
SOLID,
DASH1,
DASH2,
DASH3,
- DASH4,\r
-};\r
+ DASH4,
+};
// symbol definitions
-enum {\r
+enum {
SB_CROSS = 1,
SB_PLUS,
SB_BOX,
SB_CIRCLE,
SB_ERRORBAR,
- MAXSYMBOL,\r
+ MAXSYMBOL,
};
-enum {\r
+enum {
INSIDE = 1, // values of o_legendbox
OUTSIDE,
- NOLEGEND,\r
-};\r
-\r
+ NOLEGEND,
+};
+
+
+struct KeywordCodeTable {
+ char* keyword;
+ int code;
+};
-struct KeywordCodeTable {\r
- char* keyword;\r
- int code;\r
-};\r
-\r
/*-----------------------------------------------------------------------------
* GLOBAL VARIABLES
*
enum {
S_DATA = 2,
S_HELP,
- S_EXIT,\r
+ S_EXIT,
S_CURVE,
S_SOLID,
S_DASH,
S_BLACK,
S_RED,
S_GREEN,
- S_BLUE,\r
+ S_BLUE,
S_SYMBOL,
S_PEN,
S_EVERY,
S_TAG,
S_TEXTSIZE,
};
- \r
- static const struct KeywordCodeTable m_sKeywords[];\r
- static const int NKEYS;\r
+
+ static const struct KeywordCodeTable m_sKeywords[];
+ static const int NKEYS;
std::vector<class EZPlotCurve*> m_vecCurves;
- std::vector<int> m_veciColor;\r
- std::vector<bool> m_vecbColorSet;\r
- std::vector<int> m_veciSymbol;\r
- std::vector<bool> m_vecbSymbolSet;\r
- std::vector<int> m_veciSymbolFreq;\r
- std::vector<bool> m_vecbSymbolFreqSet;\r
- std::vector<int> m_veciLinestyle;\r
- std::vector<bool> m_vecbLinestyleSet;\r
- std::vector<std::string> m_vecsLegend;\r
- std::vector<bool> m_vecbLegendSet;\r
-\r
- int getColor (unsigned int iCurve) const;\r
- int getSymbol (unsigned int iCurve) const;\r
- const std::string* getLegend (unsigned int iCurve) const;\r
- int getSymbolFreq (unsigned int iCurve) const;\r
- int getLinestyle (unsigned int iCurve) const;\r
-\r
- void setColor (unsigned int iCurve, int iColor);\r
- void setSymbol (unsigned int iCurve, int iSymbol);\r
- void setSymbolFreq (unsigned int iCurve, int iSymbolFreq);\r
- void setLinestyle (unsigned int iCurve, int iLinestyle);\r
- void setLegend (unsigned int iCurve, const std::string& strLegend);\r
- void setLegend (unsigned int iCurve, const char* const pszLegend);\r
-\r
- int m_iCurrentCurve;\r
+ std::vector<int> m_veciColor;
+ std::vector<bool> m_vecbColorSet;
+ std::vector<int> m_veciSymbol;
+ std::vector<bool> m_vecbSymbolSet;
+ std::vector<int> m_veciSymbolFreq;
+ std::vector<bool> m_vecbSymbolFreqSet;
+ std::vector<int> m_veciLinestyle;
+ std::vector<bool> m_vecbLinestyleSet;
+ std::vector<std::string> m_vecsLegend;
+ std::vector<bool> m_vecbLegendSet;
+
+ int getColor (unsigned int iCurve) const;
+ int getSymbol (unsigned int iCurve) const;
+ const std::string* getLegend (unsigned int iCurve) const;
+ int getSymbolFreq (unsigned int iCurve) const;
+ int getLinestyle (unsigned int iCurve) const;
+
+ void setColor (unsigned int iCurve, int iColor);
+ void setSymbol (unsigned int iCurve, int iSymbol);
+ void setSymbolFreq (unsigned int iCurve, int iSymbolFreq);
+ void setLinestyle (unsigned int iCurve, int iLinestyle);
+ void setLegend (unsigned int iCurve, const std::string& strLegend);
+ void setLegend (unsigned int iCurve, const char* const pszLegend);
+
+ int m_iCurrentCurve;
// Colors
int clr_axis; // color of all axis lines
void make_numfmt(char *fmtstr, int *fldwid, int *nfrac, double min, double max, int nint);
int axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp);
- SGP& rSGP;
- POL m_pol;\r
+ SGP* m_pSGP;
+ POL m_pol;
void clearCurves ();
- bool ezcmd (const char* const comm);\r
+ bool ezcmd (const char* const comm);
bool do_cmd(int lx);
void bad_option(char *opt);
void initPlotSettings();
{ return ygn_min + (y - ygw_min) * m_yWorldScale; }
public:
- EZPlot (SGP& sgp);
+ EZPlot ();
~EZPlot ();
- bool ezset (const std::string& command);\r
+ bool ezset (const std::string& command);
bool ezset (const char* const command);
void addCurve (const float* x, const double* y, int num);
void addCurve (const double* y, int n);
void addCurve (const float* y, int n);
- void plot ();
+ void plot (SGP* pSGP);
};
#endif