r328: *** empty log message ***
[ctsim.git] / include / ezplot.h
index 6ad4b5b3b1e9901c813cf940390d4db6a5458bea..f6dbf77af635c943fa2f2fd18aa5110fb6fe7393 100644 (file)
@@ -7,7 +7,7 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.h,v 1.20 2000/12/23 18:12:35 kevin Exp $
+**  $Id: ezplot.h,v 1.23 2000/12/29 15:45:06 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
@@ -32,7 +32,8 @@
 #include <cmath>
 #include <stddef.h>
 #include "ctsupport.h"
-#include "sgp.h"
+#include "sgp.h"\r
+#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();
 };
@@ -141,7 +137,8 @@ private:
   enum {
     S_DATA = 2,
       S_HELP,
-      S_EXIT,
+      S_EXIT,\r
+      S_CURVE,
       S_SOLID,
       S_DASH,      
       S_NOLINE,
@@ -215,7 +212,32 @@ private:
   static const int NKEYS;\r
   
   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
+
   // Colors
   int clr_axis;                        // color of all axis lines 
   int clr_title;                       // color of main title 
@@ -231,7 +253,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 +314,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;\r
   
   void clearCurves ();
   
-  bool ezcmd (const char const *comm);\r
+  bool ezcmd (const char* const comm);\r
   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 +338,11 @@ private:
   { return ygn_min + (y - ygw_min) * m_yWorldScale; }
   
  public:
-   EZPlot (SGP& sgp);
+   EZPlot ();
    ~EZPlot ();
    
    bool ezset (const std::string& command);\r
-   bool ezset (const char const *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 +350,7 @@ private:
    void addCurve (const double* y, int n);
    void addCurve (const float* y, int n);
    
-   void plot ();
+   void plot (SGP* pSGP);
 };     
 
 #endif