X-Git-Url: http://git.kpe.io/?p=ctsim.git;a=blobdiff_plain;f=include%2Fezplot.h;h=6a8de8489a23939afe25dc062cb8027dc56a44b4;hp=a7559da265de0bfc90bc32a5cb27117581a1d4a1;hb=c00c639073653fac7463a88f2b000f263236550d;hpb=5ec5449357eaae253d6b1026621262480e2efa63 diff --git a/include/ezplot.h b/include/ezplot.h index a7559da..6a8de84 100644 --- a/include/ezplot.h +++ b/include/ezplot.h @@ -7,7 +7,7 @@ ** This is part of the CTSim program ** Copyright (C) 1983-2000 Kevin Rosenberg ** -** $Id: ezplot.h,v 1.21 2000/12/25 21:54:26 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 @@ -33,6 +33,7 @@ #include #include "ctsupport.h" #include "sgp.h" +#include "pol.h" class EZPlotCurve { @@ -51,21 +52,21 @@ public: //---------------------------------------------------------------------- // axis definitions -enum { +enum { LINEAR = 1, // linear axis LOG, // logrithmic axis - NOAXIS, // don't plot axis + NOAXIS, // don't plot axis }; // tick definitions -enum { +enum { ABOVE = 1, BELOW, RIGHT, - LEFT, + LEFT, }; -// line types +// line types enum { NOLINE = 0, SOLID, @@ -73,31 +74,31 @@ enum { DASH1, DASH2, DASH3, - DASH4, -}; + DASH4, +}; // symbol definitions -enum { +enum { SB_CROSS = 1, SB_PLUS, SB_BOX, SB_CIRCLE, SB_ERRORBAR, - MAXSYMBOL, + MAXSYMBOL, }; -enum { +enum { INSIDE = 1, // values of o_legendbox OUTSIDE, - NOLEGEND, -}; - + NOLEGEND, +}; + + +struct KeywordCodeTable { + char* keyword; + int code; +}; -struct KeywordCodeTable { - char* keyword; - int code; -}; - /*----------------------------------------------------------------------------- * GLOBAL VARIABLES * @@ -136,7 +137,7 @@ private: enum { S_DATA = 2, S_HELP, - S_EXIT, + S_EXIT, S_CURVE, S_SOLID, S_DASH, @@ -144,7 +145,7 @@ private: S_BLACK, S_RED, S_GREEN, - S_BLUE, + S_BLUE, S_SYMBOL, S_PEN, S_EVERY, @@ -206,36 +207,36 @@ private: S_TAG, S_TEXTSIZE, }; - - static const struct KeywordCodeTable m_sKeywords[]; - static const int NKEYS; + + static const struct KeywordCodeTable m_sKeywords[]; + static const int NKEYS; std::vector m_vecCurves; - std::vector m_veciColor; - std::vector m_vecbColorSet; - std::vector m_veciSymbol; - std::vector m_vecbSymbolSet; - std::vector m_veciSymbolFreq; - std::vector m_vecbSymbolFreqSet; - std::vector m_veciLinestyle; - std::vector m_vecbLinestyleSet; - std::vector m_vecsLegend; - std::vector 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; + std::vector m_veciColor; + std::vector m_vecbColorSet; + std::vector m_veciSymbol; + std::vector m_vecbSymbolSet; + std::vector m_veciSymbolFreq; + std::vector m_vecbSymbolFreqSet; + std::vector m_veciLinestyle; + std::vector m_vecbLinestyleSet; + std::vector m_vecsLegend; + std::vector 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 @@ -318,19 +319,18 @@ private: 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; + SGP* m_pSGP; + POL m_pol; void clearCurves (); - bool ezcmd (const char* const comm); + bool ezcmd (const char* const comm); bool do_cmd(int lx); void bad_option(char *opt); void initPlotSettings(); - static void initKeywords (); - - static bool ezset_initialized; - + void initKeywords (); + double convertWorldToNDC_X (double x) { return xgn_min + (x - xgw_min) * m_xWorldScale; } @@ -338,10 +338,10 @@ private: { return ygn_min + (y - ygw_min) * m_yWorldScale; } public: - EZPlot (SGP& sgp); + EZPlot (); ~EZPlot (); - bool ezset (const std::string& command); + bool ezset (const std::string& command); bool ezset (const char* const command); void addCurve (const float* x, const double* y, int num); @@ -350,7 +350,7 @@ private: void addCurve (const double* y, int n); void addCurve (const float* y, int n); - void plot (); + void plot (SGP* pSGP); }; #endif