X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=include%2Fezplot.h;h=f60d08fbc90084b662516ff849f1fb8a349c1f3b;hb=860a2e338a79d7a01d551bc5a70def43f60bdb77;hp=6ad4b5b3b1e9901c813cf940390d4db6a5458bea;hpb=2a3686d3bd1f690d318b81766c261da785cf9b57;p=ctsim.git diff --git a/include/ezplot.h b/include/ezplot.h index 6ad4b5b..f60d08f 100644 --- a/include/ezplot.h +++ b/include/ezplot.h @@ -5,9 +5,9 @@ ** Purpose: Header file for EZplot library ** ** This is part of the CTSim program -** Copyright (C) 1983-2000 Kevin Rosenberg +** Copyright (c) 1983-2001 Kevin Rosenberg ** -** $Id: ezplot.h,v 1.20 2000/12/23 18:12:35 kevin Exp $ +** $Id$ ** ** 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 { @@ -40,13 +41,8 @@ public: double *x; double *y; int m_iPointCount; - int m_iLineStyle; - int m_iSymbol; - int m_iSymbolFreq; - int m_iColor; - std::string m_sLegend; - EZPlotCurve (const double* x, const double* y, int n, int color, int linestyle, int symbol, int sumbolFreq, const std::string& legend); + EZPlotCurve (const double* x, const double* y, int n); ~EZPlotCurve(); }; @@ -56,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, @@ -78,31 +74,32 @@ enum { DASH1, DASH2, DASH3, - DASH4, -}; + DASH4, +}; // symbol definitions -enum { +enum { SB_CROSS = 1, SB_PLUS, SB_BOX, SB_CIRCLE, SB_ERRORBAR, - MAXSYMBOL, + SB_POINT, + 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 * @@ -142,13 +139,14 @@ private: S_DATA = 2, S_HELP, S_EXIT, + S_CURVE, S_SOLID, S_DASH, S_NOLINE, S_BLACK, S_RED, S_GREEN, - S_BLUE, + S_BLUE, S_SYMBOL, S_PEN, S_EVERY, @@ -210,12 +208,37 @@ private: S_TAG, S_TEXTSIZE, }; - - static const struct KeywordCodeTable m_sKeywords[]; - static const int NKEYS; - std::vector m_vecCurves; + 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; + // Colors int clr_axis; // color of all axis lines int clr_title; // color of main title @@ -231,7 +254,6 @@ private: std::string c_xlabel; // label for x axis std::string c_ylabel; // label for y axis std::string c_title; // title to print above graph - std::string c_legend;; // current legend specified int o_linestyle, o_color; // style to use for curves all subsequent curves to EZPLOT int o_xaxis, o_yaxis; // Specifies where axis & labels are drawn @@ -293,24 +315,23 @@ private: double m_dVP_xscale, m_dVP_yscale; double m_xWorldScale, m_yWorldScale; - void drawAxes(void); + void drawAxes(); void symbol (int sym, double symwidth, double symheight); 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 initkw(void); - - static bool ezset_initialized; - + void initKeywords (); + double convertWorldToNDC_X (double x) { return xgn_min + (x - xgw_min) * m_xWorldScale; } @@ -318,11 +339,11 @@ private: { return ygn_min + (y - ygw_min) * m_yWorldScale; } public: - EZPlot (SGP& sgp); + EZPlot (); ~EZPlot (); - bool ezset (const std::string& command); - bool ezset (const char const *command); + 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* x, const float* y, int num); @@ -330,7 +351,7 @@ private: void addCurve (const double* y, int n); void addCurve (const float* y, int n); - void plot (); + void plot (SGP* pSGP); }; #endif