** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ezplot.h,v 1.18 2000/12/16 06:12:47 kevin Exp $
+** $Id: ezplot.h,v 1.19 2000/12/20 14:39:09 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
void clearCurves ();
- bool ezcmd (char *comm);
+ bool ezcmd (const char const *comm);\r
bool do_cmd(int lx);
void bad_option(char *opt);
void initPlotSettings();
EZPlot (SGP& sgp);
~EZPlot ();
- int ezset (char *command);
+ bool ezset (const std::string& command);\r
+ 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);
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: plotfile.h,v 1.1 2000/12/19 21:37:10 kevin Exp $
+** $Id: plotfile.h,v 1.2 2000/12/20 14:39:09 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
void setTitle (const std::string& title)
{ m_strTitle = title; }
+ \r
+ void setTitle (const char* const title)\r
+ { m_strTitle = title; }\r
void setXLabel (const std::string& label)
{ m_strXLabel = label; }
+ \r
+ void setXLabel (const char* const label)\r
+ { m_strXLabel = label; }\r
void setYLabel (const std::string& label)
{ m_strYLabel = label; }
+ void setYLabel (const char* const label)\r
+ { m_strYLabel = label; }\r
+\r
void setCurveSize (int iNCurves, int iNRecords);
void addDescription (const char* const pszDesc)
bool addColumn (int iCol, const float* const pdColumn);\r
\r
+ void getColumn (int iCol, double *pdColumnData) const;\r
+\r
const std::string& getTitle () const
{ return m_strTitle; }
const std::string& getYLabel () const
{ return m_strXLabel; }
- const std::string& getData () const
+ const std::string& getDate () const
{ return m_strDate; }
int getNumColumns () const
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: pol.h,v 1.4 2000/06/13 16:20:31 kevin Exp $
+** $Id: pol.h,v 1.5 2000/12/20 14:39:09 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
typedef struct token_st TOKEN;
/* pol.c */
-void pol_init(void);
-void pol_skpword(char *w);
-void pol_skpchar(char *s);
-int pol_install(char *str, int code);
-int pol_word(char *search, int nlet);
-int pol_usertok(char *str, int *code);
-int pol_string(char *str);
-int pol_integer(int *n, int typecode, int boundcode, int bb1, int bb2);
-int pol_float(double *n, double typecode, double boundcode, double bb1, double bb2);
-int pol_skip(void);
-void pol_reader(void);
-void gettext(char *str, int lim);
-void pol_usefile(int source, char *fn);
-void pol_closefile(void);
-int pol_lookchar(void);
-int pol_inchar(void);
-void pol_ungetch(int c);
-int get_inputline(FILE *fp);
-void set_inputline(char *line);
+void pol_init (void);
+void pol_skpword (char *w);
+void pol_skpchar (char *s);
+int pol_install (char *str, int code);
+int pol_word (char *search, int nlet);
+int pol_usertok (char *str, int *code);
+int pol_string (char *str);
+int pol_integer (int *n, int typecode, int boundcode, int bb1, int bb2);
+int pol_float (double *n, double typecode, double boundcode, double bb1, double bb2);
+int pol_skip (void);
+void pol_reader (void);
+void gettext (char *str, int lim);
+void pol_usefile (int source, char *fn);
+void pol_closefile (void);
+int pol_lookchar (void);
+int pol_inchar (void);
+void pol_ungetch (int c);
+int get_inputline (FILE *fp);
+void set_inputline (const char const *line);
#endif
/*****************************************************************************
- ** FILE IDENTIFICATION
- **
- ** EZSET - Parameter control for EZPLOT
- **
- ** This is part of the CTSim program
- ** Copyright (C) 1983-2000 Kevin Rosenberg
- **
- ** $Id: ezset.cpp,v 1.9 2000/12/06 15:17:51 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
- ** published by the Free Software Foundation.
- **
- ** This program is distributed in the hope that it will be useful,
- ** but WITHOUT ANY WARRANTY; without even the implied warranty of
- ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ** GNU General Public License for more details.
- **
- ** You should have received a copy of the GNU General Public License
- ** along with this program; if not, write to the Free Software
- ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- ******************************************************************************/
+** FILE IDENTIFICATION
+**
+** EZSET - Parameter control for EZPLOT
+**
+** This is part of the CTSim program
+** Copyright (C) 1983-2000 Kevin Rosenberg
+**
+** $Id: ezset.cpp,v 1.10 2000/12/20 14:39:09 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
+** published by the Free Software Foundation.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software
+** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+******************************************************************************/
#include "ctsupport.h"
#include "ezplot.h"
#include "pol.h"
bool EZPlot::ezset_initialized = false;
+\r
+\r
+bool\r
+EZPlot::ezset (const std::string& command)\r
+{\r
+ return ezset (command.c_str());\r
+}\r
-int
-EZPlot::ezset (char *command)
+bool
+EZPlot::ezset (const char const *command)
{
- if (! ezset_initialized) {
- pol_init();
- initkw();
- pol_skpword ("please");
- pol_skpword ("use");
- pol_skpword ("are");
- pol_skpword ("and");
- pol_skpword ("is");
- pol_skpword ("the");
- pol_skpword ("equals");
- pol_skpchar ("=");
-
- pol_usefile (P_USE_STR,"");
- set_inputline ("!eoc ,");
- pol_reader ();
- pol_closefile ();
- ezset_initialized = true;
- }
- return (ezcmd (command));
+ if (! ezset_initialized) {
+ pol_init();
+ initkw();
+ pol_skpword ("please");
+ pol_skpword ("use");
+ pol_skpword ("are");
+ pol_skpword ("and");
+ pol_skpword ("is");
+ pol_skpword ("the");
+ pol_skpword ("equals");
+ pol_skpchar ("=");
+
+ pol_usefile (P_USE_STR,"");
+ set_inputline ("!eoc ,");
+ pol_reader ();
+ pol_closefile ();
+ ezset_initialized = true;
+ }
+ return ezcmd (command);
}
bool
-EZPlot::ezcmd (char *comm)
+EZPlot::ezcmd (const char const *comm)
{
- pol_usefile (P_USE_STR, "");
- set_inputline (comm);
-
- char str[MAXTOK+1];
- int code;
- bool retval = true;
- if (! pol_usertok (str, &code)) {
- sys_error(ERR_WARNING, "Illegal EZSET command: %s", str);
- pol_reader();
- retval = false;
- }
- else
- retval = do_cmd (code);
-
- pol_closefile(); /* close input string file */
- return (retval);
+ pol_usefile (P_USE_STR, "");
+ set_inputline (comm);
+
+ char str[MAXTOK+1];
+ int code;
+ bool retval = true;
+ if (! pol_usertok (str, &code)) {
+ sys_error(ERR_WARNING, "Illegal EZSET command: %s", str);
+ pol_reader();
+ retval = false;
+ }
+ else
+ retval = do_cmd (code);
+
+ pol_closefile(); /* close input string file */
+ return (retval);
}
bool
EZPlot::do_cmd (int lx)
{
- char str [1024];
- char strIn [1024];
- int n;
- double f;
-
- switch (lx) {
- case S_TEXTSIZE:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- {
- if (f >= 0.0 && f <= 1.0) {
- v_textsize = f;
- s_textsize = TRUE;
- } else
- s_textsize = FALSE;
- }
- break;
- case S_REPLOT:
- plot ();
- break;
- case S_CLEAR:
- clearCurves ();
- break;
- case S_TITLE:
- gettext (strIn, sizeof(strIn));
- c_title = strIn;
- break;
- case S_LEGEND:
- gettext (strIn, sizeof(strIn));
- c_legend = strIn;
- break;
- case S_XLABEL:
- gettext (strIn, sizeof(strIn));
- c_xlabel = strIn;
- break;
- case S_YLABEL:
- gettext (strIn, sizeof(strIn));
- c_ylabel = strIn;
- break;
- case S_XCROSS:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
- v_xcross = f;
- s_xcross = TRUE;
- } else
- s_xcross = FALSE;
- break;
- case S_YCROSS:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
- v_ycross = f;
- s_ycross = TRUE;
- } else
- s_ycross = FALSE;
- break;
- case S_NOXAXIS:
- o_xaxis = NOAXIS;
- break;
- case S_NOYAXIS:
- o_yaxis = NOAXIS;
- break;
- case S_XLIN:
- o_xaxis = LINEAR;
- break;
- case S_YLIN:
- o_yaxis = LINEAR;
- break;
- case S_XLOG:
- o_xaxis = LOG;
- break;
- case S_YLOG:
- o_yaxis = LOG;
- break;
- case S_XAUTOSCALE:
- s_xmin = FALSE;
- s_xmax = FALSE;
- break;
- case S_YAUTOSCALE:
- s_ymin = FALSE;
- s_ymax = FALSE;
- break;
- case S_XMIN:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
- v_xmin = f;
- s_xmin = TRUE;
- }
- break;
- case S_XMAX:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
- v_xmax = f;
- s_xmax = TRUE;
- }
- break;
- case S_YMIN:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
- v_ymin = f;
- s_ymin = TRUE;
- }
- break;
- case S_YMAX:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
- v_ymax = f;
- s_ymax = TRUE;
- }
- break;
- case S_SOLID:
- o_linestyle = SGP::LS_SOLID;
- break;
- case S_DASH:
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
- if (n == 1)
- o_linestyle = SGP::LS_DASH1;
- else if (n == 2)
- o_linestyle = SGP::LS_DASH2;
- else if (n == 3)
- o_linestyle = SGP::LS_DASH3;
- else if (n == 4)
- o_linestyle = SGP::LS_DASH4;
- else
- o_linestyle = SGP::LS_DASH1;
- } else
- o_linestyle = SGP::LS_DASH1;
- break;
- case S_NOLINE:
- o_linestyle = SGP::LS_NOLINE;
- break;
- case S_PEN:
- case S_COLOR:
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
- {
- if (n >= 0)
- o_color = n;
- else
- bad_option("The color you picked");
- }
- break;
- case S_BOX:
- o_box = TRUE;
- break;
- case S_NOBOX:
- o_box = FALSE;
- break;
- case S_GRID:
- o_grid = TRUE;
- break;
- case S_NOGRID:
- o_grid = FALSE;
- break;
- case S_XLENGTH:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- if (f > 0.0 && f <= 1.0)
- o_xlength = f;
- break;
- case S_YLENGTH:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- if (f > 0.0 && f <= 1.0)
- o_ylength = f;
- break;
- case S_XPORIGIN:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- if (f >= 0.0 && f < 1.0)
- o_xporigin = f;
- break;
- case S_YPORIGIN:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- if (f >= 0.0 && f < 1.0)
- o_yporigin = f;
- break;
- case S_TAG:
- if (pol_word("no", 2) == TRUE)
- o_tag = FALSE;
- else if (pol_word("off", 2) == TRUE)
- o_tag = FALSE;
- else
- o_tag = TRUE;
- break;
- case S_LEGENDBOX:
- if (pol_word("inside", 2) == TRUE)
- o_legendbox = INSIDE;
- else if (pol_word("outside", 3) == TRUE)
- o_legendbox = OUTSIDE;
- else if (pol_word("none",2) == TRUE)
- o_legendbox = NOLEGEND;
- else {
- gettext (str, MAXTOK);
- bad_option(str);
- }
- break;
- case S_XLEGEND:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- {
- if (f >= 0.0 && f < 1.0) {
- v_xlegend = f;
- s_xlegend = TRUE;
- }
- else
- s_xlegend = FALSE;
- }
- break;
- case S_YLEGEND:
- if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
- {
- if (f >= 0.0 && f < 1.0) {
- v_ylegend = f;
- s_ylegend = TRUE;
- }
- else
- s_ylegend = FALSE;
- }
- break;
- case S_SYMBOL:
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
- if (n > 0 && n <= MAXSYMBOL)
- o_symbol = n;
- else
- o_symbol = 1;
- } else {
- if (pol_word("every",5) == TRUE) {
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
- if (n > 0)
- o_symfreq = n;
- else
- o_symfreq = 1;
- }
- } else if (pol_word ("none",4) == TRUE) {
- o_symbol = -1;
- }
- }
- break;
- case S_XTICKS:
- if (pol_usertok(str,&lx) == FALSE)
- break;
- if (lx == S_ABOVE)
- o_xticks = ABOVE;
- else if (lx == S_BELOW)
- o_xticks = BELOW;
- else if (lx == S_NOLABEL)
- o_xtlabel = FALSE;
- else if (lx == S_LABEL)
- o_xtlabel = TRUE;
- else if (lx == S_MAJOR) {
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
- if (n > 1 && n < 100)
- o_xmajortick = n;
- } else if (lx == S_MINOR)
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
- if (n >= 0 && n < 100)
- o_xminortick = n;
- break;
- case S_YTICKS:
- if (pol_usertok(str,&lx) == FALSE)
- break;
- if (lx == S_RIGHT)
- o_yticks = RIGHT;
- else if (lx == S_LEFT)
- o_yticks = LEFT;
- else if (lx == S_NOLABEL)
- o_ytlabel = FALSE;
- else if (lx == S_LABEL)
- o_ytlabel = TRUE;
- else if (lx == S_MAJOR) {
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
- if (n > 1 && n < 100)
- o_ymajortick = n;
- } else if (lx == S_MINOR)
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
- if (n >= 0 && n < 100)
- o_yminortick = n;
- break;
- case S_LXFRAC:
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
- if (n >= 0) {
- v_lxfrac = n;
- s_lxfrac = TRUE;
- }
- } else
- s_lxfrac = FALSE;
- break;
- case S_LYFRAC:
- if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
- if (n >= 0) {
- v_lyfrac = n;
- s_lyfrac = TRUE;
- }
- } else
- s_lyfrac = FALSE;
- break;
- break;
- default:
- fprintf (stderr, "Unimplemented EZPLOT command\n");
- break;
+ char str [1024];
+ char strIn [1024];
+ int n;
+ double f;
+
+ switch (lx) {
+ case S_TEXTSIZE:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ {
+ if (f >= 0.0 && f <= 1.0) {
+ v_textsize = f;
+ s_textsize = TRUE;
+ } else
+ s_textsize = FALSE;
+ }
+ break;
+ case S_REPLOT:
+ plot ();
+ break;
+ case S_CLEAR:
+ clearCurves ();
+ break;
+ case S_TITLE:
+ gettext (strIn, sizeof(strIn));
+ c_title = strIn;
+ break;
+ case S_LEGEND:
+ gettext (strIn, sizeof(strIn));
+ c_legend = strIn;
+ break;
+ case S_XLABEL:
+ gettext (strIn, sizeof(strIn));
+ c_xlabel = strIn;
+ break;
+ case S_YLABEL:
+ gettext (strIn, sizeof(strIn));
+ c_ylabel = strIn;
+ break;
+ case S_XCROSS:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+ v_xcross = f;
+ s_xcross = TRUE;
+ } else
+ s_xcross = FALSE;
+ break;
+ case S_YCROSS:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+ v_ycross = f;
+ s_ycross = TRUE;
+ } else
+ s_ycross = FALSE;
+ break;
+ case S_NOXAXIS:
+ o_xaxis = NOAXIS;
+ break;
+ case S_NOYAXIS:
+ o_yaxis = NOAXIS;
+ break;
+ case S_XLIN:
+ o_xaxis = LINEAR;
+ break;
+ case S_YLIN:
+ o_yaxis = LINEAR;
+ break;
+ case S_XLOG:
+ o_xaxis = LOG;
+ break;
+ case S_YLOG:
+ o_yaxis = LOG;
+ break;
+ case S_XAUTOSCALE:
+ s_xmin = FALSE;
+ s_xmax = FALSE;
+ break;
+ case S_YAUTOSCALE:
+ s_ymin = FALSE;
+ s_ymax = FALSE;
+ break;
+ case S_XMIN:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+ v_xmin = f;
+ s_xmin = TRUE;
+ }
+ break;
+ case S_XMAX:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+ v_xmax = f;
+ s_xmax = TRUE;
+ }
+ break;
+ case S_YMIN:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+ v_ymin = f;
+ s_ymin = TRUE;
+ }
+ break;
+ case S_YMAX:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE) {
+ v_ymax = f;
+ s_ymax = TRUE;
+ }
+ break;
+ case S_SOLID:
+ o_linestyle = SGP::LS_SOLID;
+ break;
+ case S_DASH:
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+ if (n == 1)
+ o_linestyle = SGP::LS_DASH1;
+ else if (n == 2)
+ o_linestyle = SGP::LS_DASH2;
+ else if (n == 3)
+ o_linestyle = SGP::LS_DASH3;
+ else if (n == 4)
+ o_linestyle = SGP::LS_DASH4;
+ else
+ o_linestyle = SGP::LS_DASH1;
+ } else
+ o_linestyle = SGP::LS_DASH1;
+ break;
+ case S_NOLINE:
+ o_linestyle = SGP::LS_NOLINE;
+ break;
+ case S_PEN:
+ case S_COLOR:
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+ {
+ if (n >= 0)
+ o_color = n;
+ else
+ bad_option("The color you picked");
+ }
+ break;
+ case S_BOX:
+ o_box = TRUE;
+ break;
+ case S_NOBOX:
+ o_box = FALSE;
+ break;
+ case S_GRID:
+ o_grid = TRUE;
+ break;
+ case S_NOGRID:
+ o_grid = FALSE;
+ break;
+ case S_XLENGTH:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ if (f > 0.0 && f <= 1.0)
+ o_xlength = f;
+ break;
+ case S_YLENGTH:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ if (f > 0.0 && f <= 1.0)
+ o_ylength = f;
+ break;
+ case S_XPORIGIN:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ if (f >= 0.0 && f < 1.0)
+ o_xporigin = f;
+ break;
+ case S_YPORIGIN:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ if (f >= 0.0 && f < 1.0)
+ o_yporigin = f;
+ break;
+ case S_TAG:
+ if (pol_word("no", 2) == TRUE)
+ o_tag = FALSE;
+ else if (pol_word("off", 2) == TRUE)
+ o_tag = FALSE;
+ else
+ o_tag = TRUE;
+ break;
+ case S_LEGENDBOX:
+ if (pol_word("inside", 2) == TRUE)
+ o_legendbox = INSIDE;
+ else if (pol_word("outside", 3) == TRUE)
+ o_legendbox = OUTSIDE;
+ else if (pol_word("none",2) == TRUE)
+ o_legendbox = NOLEGEND;
+ else {
+ gettext (str, MAXTOK);
+ bad_option(str);
+ }
+ break;
+ case S_XLEGEND:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ {
+ if (f >= 0.0 && f < 1.0) {
+ v_xlegend = f;
+ s_xlegend = TRUE;
+ }
+ else
+ s_xlegend = FALSE;
+ }
+ break;
+ case S_YLEGEND:
+ if (pol_float (&f, TT_REAL, FALSE, 0.0, 0.0) == TRUE)
+ {
+ if (f >= 0.0 && f < 1.0) {
+ v_ylegend = f;
+ s_ylegend = TRUE;
+ }
+ else
+ s_ylegend = FALSE;
+ }
+ break;
+ case S_SYMBOL:
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+ if (n > 0 && n <= MAXSYMBOL)
+ o_symbol = n;
+ else
+ o_symbol = 1;
+ } else {
+ if (pol_word("every",5) == TRUE) {
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+ if (n > 0)
+ o_symfreq = n;
+ else
+ o_symfreq = 1;
+ }
+ } else if (pol_word ("none",4) == TRUE) {
+ o_symbol = -1;
+ }
+ }
+ break;
+ case S_XTICKS:
+ if (pol_usertok(str,&lx) == FALSE)
+ break;
+ if (lx == S_ABOVE)
+ o_xticks = ABOVE;
+ else if (lx == S_BELOW)
+ o_xticks = BELOW;
+ else if (lx == S_NOLABEL)
+ o_xtlabel = FALSE;
+ else if (lx == S_LABEL)
+ o_xtlabel = TRUE;
+ else if (lx == S_MAJOR) {
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+ if (n > 1 && n < 100)
+ o_xmajortick = n;
+ } else if (lx == S_MINOR)
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+ if (n >= 0 && n < 100)
+ o_xminortick = n;
+ break;
+ case S_YTICKS:
+ if (pol_usertok(str,&lx) == FALSE)
+ break;
+ if (lx == S_RIGHT)
+ o_yticks = RIGHT;
+ else if (lx == S_LEFT)
+ o_yticks = LEFT;
+ else if (lx == S_NOLABEL)
+ o_ytlabel = FALSE;
+ else if (lx == S_LABEL)
+ o_ytlabel = TRUE;
+ else if (lx == S_MAJOR) {
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+ if (n > 1 && n < 100)
+ o_ymajortick = n;
+ } else if (lx == S_MINOR)
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE)
+ if (n >= 0 && n < 100)
+ o_yminortick = n;
+ break;
+ case S_LXFRAC:
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+ if (n >= 0) {
+ v_lxfrac = n;
+ s_lxfrac = TRUE;
+ }
+ } else
+ s_lxfrac = FALSE;
+ break;
+ case S_LYFRAC:
+ if (pol_integer (&n, TT_REAL, FALSE, 0, 0) == TRUE) {
+ if (n >= 0) {
+ v_lyfrac = n;
+ s_lyfrac = TRUE;
+ }
+ } else
+ s_lyfrac = FALSE;
+ break;
+ break;
+ default:
+ fprintf (stderr, "Unimplemented EZPLOT command\n");
+ break;
}
-
+
pol_reader ();
return (true);
}
void
EZPlot::bad_option (char *opt)
{
- sys_error (ERR_WARNING, "INVALID option: %s", opt);
+ sys_error (ERR_WARNING, "INVALID option: %s", opt);
}
/*----------------------------------------------------------------------*/
/*----------------------------------------------------------------------*/
static struct key {
- char *keyword;
- int code;
+ char *keyword;
+ int code;
} keytab[] = {
{"solid", S_SOLID},
{"dash", S_DASH},
- {"noline", S_NOLINE},
- {"black", S_BLACK},
- {"red", S_RED},
- {"blue", S_BLUE},
- {"green", S_GREEN},
+ {"noline", S_NOLINE},
+ {"black", S_BLACK},
+ {"red", S_RED},
+ {"blue", S_BLUE},
+ {"green", S_GREEN},
{"pen", S_PEN},
- {"symbol", S_SYMBOL},
- {"every", S_EVERY},
- {"none", S_NONE},
- {"legend", S_LEGEND},
- {"xlegend", S_XLEGEND},
- {"ylegend", S_YLEGEND},
-
- {"xlin", S_XLIN},
+ {"symbol", S_SYMBOL},
+ {"every", S_EVERY},
+ {"none", S_NONE},
+ {"legend", S_LEGEND},
+ {"xlegend", S_XLEGEND},
+ {"ylegend", S_YLEGEND},
+
+ {"xlin", S_XLIN},
{"ylin", S_YLIN},
- {"xlog", S_XLOG},
- {"ylog", S_YLOG},
- {"xlabel", S_XLABEL},
- {"ylabel", S_YLABEL},
- {"xlength", S_XLENGTH},
- {"ylength", S_YLENGTH},
-
- {"xticks", S_XTICKS},
- {"yticks", S_YTICKS},
- {"above", S_ABOVE},
- {"label", S_LABEL},
- {"below", S_BELOW},
- {"nolabel", S_NOLABEL},
- {"right", S_RIGHT},
- {"left", S_LEFT},
-
- {"xautoscale", S_XAUTOSCALE},
- {"yautoscale", S_YAUTOSCALE},
- {"xmin", S_XMIN},
- {"ymin", S_YMIN},
- {"xmax", S_XMAX},
- {"ymax", S_YMAX},
- {"lxfrac", S_LXFRAC},
- {"lyfrac", S_LYFRAC},
- {"xcross", S_XCROSS},
- {"ycross", S_YCROSS},
- {"noxaxis", S_NOXAXIS},
- {"noyaxis", S_NOYAXIS},
- {"xporigin", S_XPORIGIN},
- {"yporigin", S_YPORIGIN},
- {"title", S_TITLE},
- {"xtitle", S_XTITLE},
- {"ytitle", S_YTITLE},
-
- {"replot", S_REPLOT},
- {"clear", S_CLEAR},
- {"store", S_STORE},
- {"restore", S_RESTORE},
- {"amark", S_AMARK},
- {"units", S_UNITS},
- {"inches", S_INCHES},
- {"user", S_USER},
-
- {"data", S_DATA},
- {"help", S_HELP},
- {"exit", S_EXIT},
-
- {"box", S_BOX},
- {"nobox", S_NOBOX},
- {"grid", S_GRID},
- {"nogrid", S_NOGRID},
- {"major", S_MAJOR},
- {"minor", S_MINOR},
- {"color", S_COLOR},
- {"legendbox", S_LEGENDBOX},
-
- {"no", S_NO},
-
- {"textsize", S_TEXTSIZE},
- };
+ {"xlog", S_XLOG},
+ {"ylog", S_YLOG},
+ {"xlabel", S_XLABEL},
+ {"ylabel", S_YLABEL},
+ {"xlength", S_XLENGTH},
+ {"ylength", S_YLENGTH},
+
+ {"xticks", S_XTICKS},
+ {"yticks", S_YTICKS},
+ {"above", S_ABOVE},
+ {"label", S_LABEL},
+ {"below", S_BELOW},
+ {"nolabel", S_NOLABEL},
+ {"right", S_RIGHT},
+ {"left", S_LEFT},
+
+ {"xautoscale", S_XAUTOSCALE},
+ {"yautoscale", S_YAUTOSCALE},
+ {"xmin", S_XMIN},
+ {"ymin", S_YMIN},
+ {"xmax", S_XMAX},
+ {"ymax", S_YMAX},
+ {"lxfrac", S_LXFRAC},
+ {"lyfrac", S_LYFRAC},
+ {"xcross", S_XCROSS},
+ {"ycross", S_YCROSS},
+ {"noxaxis", S_NOXAXIS},
+ {"noyaxis", S_NOYAXIS},
+ {"xporigin", S_XPORIGIN},
+ {"yporigin", S_YPORIGIN},
+ {"title", S_TITLE},
+ {"xtitle", S_XTITLE},
+ {"ytitle", S_YTITLE},
+
+ {"replot", S_REPLOT},
+ {"clear", S_CLEAR},
+ {"store", S_STORE},
+ {"restore", S_RESTORE},
+ {"amark", S_AMARK},
+ {"units", S_UNITS},
+ {"inches", S_INCHES},
+ {"user", S_USER},
+
+ {"data", S_DATA},
+ {"help", S_HELP},
+ {"exit", S_EXIT},
+
+ {"box", S_BOX},
+ {"nobox", S_NOBOX},
+ {"grid", S_GRID},
+ {"nogrid", S_NOGRID},
+ {"major", S_MAJOR},
+ {"minor", S_MINOR},
+ {"color", S_COLOR},
+ {"legendbox", S_LEGENDBOX},
+
+ {"no", S_NO},
+
+ {"textsize", S_TEXTSIZE},
+};
static const unsigned int NKEYS=(sizeof(keytab) / sizeof(struct key));
void
EZPlot::initkw(void)
{
- for (unsigned int i = 0; i < NKEYS; i++)
- if (! pol_install(keytab[i].keyword, keytab[i].code))
- sys_error(ERR_SEVERE, "error installing ezset keywords [initkw]");
+ for (unsigned int i = 0; i < NKEYS; i++)
+ if (! pol_install(keytab[i].keyword, keytab[i].code))
+ sys_error(ERR_SEVERE, "error installing ezset keywords [initkw]");
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: pol.cpp,v 1.3 2000/12/04 05:36:57 kevin Exp $
+** $Id: pol.cpp,v 1.4 2000/12/20 14:39:09 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
}
void
-set_inputline (char *line)
+set_inputline (const char const *line)
{
lineptr = 0;
bp = 0;
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: plotfile.cpp,v 1.1 2000/12/19 21:37:10 kevin Exp $
+** $Id: plotfile.cpp,v 1.2 2000/12/20 14:39:09 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
return true;\r
}\r
\r
+void\r
+PlotFile::getColumn (int iCol, double* pdColData) const\r
+{\r
+ if (iCol < 0 || iCol >= m_iNumColumns) {\r
+ sys_error (ERR_SEVERE, "Illegal column number %d [PlotFile::addColumn]", iCol);\r
+ return;\r
+ }\r
+\r
+ for (int iRec = 0; iRec < m_iNumRecords; iRec++)\r
+ pdColData[iRec] = m_vecCurves[ iRec + (iCol * m_iNumRecords) ];\r
+\r
+}\r
+\r
bool
PlotFile::fileWrite (const char* const filename)
{
--------------------Configuration: ctsim - Win32 Debug--------------------\r
</h3>\r
<h3>Command Lines</h3>\r
-Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP70.tmp" with contents\r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPD3.tmp" with contents\r
+[\r
+/nologo /G6 /MTd /W3 /Gm /GR /GX /ZI /Od /I "\wx2\include" /I "." /I "..\..\include" /I "..\..\getopt" /I "..\..\..\lpng108" /I "..\..\..\zlib" /I "..\..\..\fftw-2.1.3\fftw" /I "..\..\..\fftw-2.1.3\rfftw" /D VERSION=\"2.5.0\" /D "_DEBUG" /D "__WXMSW__" /D "HAVE_SGP" /D "HAVE_PNG" /D "HAVE_WXWINDOWS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "HAVE_STRING_H" /D "HAVE_FFTW" /D "HAVE_RFFTW" /D "HAVE_GETOPT_H" /D "MSVC" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /D CTSIMVERSION=\"2.5.0\" /FR"Debug/" /Fp"Debug/ctsim.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c \r
+"C:\ctsim-2.0.6\src\views.cpp"\r
+]\r
+Creating command line "cl.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPD3.tmp" \r
+Creating temporary file "C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPD4.tmp" with contents\r
[\r
comctl32.lib winmm.lib rpcrt4.lib ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../libctsim/Debug/libctsim.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ..\..\..\lpng108\msvc\win32\libpng\lib_dbg\libpng.lib ..\..\..\lpng108\msvc\win32\zlib\lib_dbg\zlib.lib libcmtd.lib ..\..\..\fftw-2.1.3\Win32\FFTW2st\Debug\FFTW2st.lib ..\..\..\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib ../../../wx2/lib/wxd.lib /nologo /subsystem:windows /incremental:yes /pdb:"Debug/ctsim.pdb" /debug /machine:I386 /nodefaultlib:"libcd.lib" /nodefaultlib:"libcid.lib" /nodefaultlib:"msvcrtd.lib" /out:"Debug/ctsim.exe" /pdbtype:sept /libpath:"..\..\..\lpng108\msvc\win32\libpng\lib" /libpath:"..\..\..\lpng108\msvc\win32\zlib\lib" \r
".\Debug\ctsim.obj"\r
"\fftw-2.1.3\Win32\RFFTW2st\Debug\RFFTW2st.lib"\r
"\wx2\lib\wxd.lib"\r
]\r
-Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSP70.tmp"\r
+Creating command line "link.exe @C:\DOCUME~1\kevin\LOCALS~1\Temp\RSPD4.tmp"\r
<h3>Output Window</h3>\r
+Compiling...\r
+views.cpp\r
+c:\program files\microsoft visual studio\vc98\include\vector(48) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@IABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information\r
+ c:\ctsim-2.0.6\include\plotfile.h(74) : see reference to class template instantiation 'std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled\r
+c:\program files\microsoft visual studio\vc98\include\vector(61) : warning C4786: '??0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@0ABV?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@1@@Z' : identifier was truncated to '255' characters in the browser information\r
+ c:\ctsim-2.0.6\include\plotfile.h(74) : see reference to class template instantiation 'std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled\r
+c:\program files\microsoft visual studio\vc98\include\vector(103) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information\r
+ c:\ctsim-2.0.6\include\plotfile.h(74) : see reference to class template instantiation 'std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled\r
+c:\program files\microsoft visual studio\vc98\include\vector(105) : warning C4786: '?rbegin@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information\r
+ c:\ctsim-2.0.6\include\plotfile.h(74) : see reference to class template instantiation 'std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled\r
+c:\program files\microsoft visual studio\vc98\include\vector(107) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE?AV?$reverse_iterator@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@AAV12@PAV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information\r
+ c:\ctsim-2.0.6\include\plotfile.h(74) : see reference to class template instantiation 'std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled\r
+c:\program files\microsoft visual studio\vc98\include\vector(108) : warning C4786: '?rend@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QBE?AV?$reverse_iterator@PBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V12@ABV12@PBV12@H@2@XZ' : identifier was truncated to '255' characters in the browser information\r
+ c:\ctsim-2.0.6\include\plotfile.h(74) : see reference to class template instantiation 'std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >' being compiled\r
+c:\program files\microsoft visual studio\vc98\include\vector(114) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > const *,int>' : identifier was truncated to '255' characters in the debug information\r
+ c:\program files\microsoft visual studio\vc98\include\vector(114) : while compiling class-template member function 'unsigned int __thiscall std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::size(void) const'\r
+c:\program files\microsoft visual studio\vc98\include\vector(114) : warning C4786: 'std::reverse_iterator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char> > &,std::basic_string<char,std::char_traits<char>,std::allocator<char> > *,int>' : identifier was truncated to '255' characters in the debug information\r
+ c:\program files\microsoft visual studio\vc98\include\vector(114) : while compiling class-template member function 'unsigned int __thiscall std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::size(void) const'\r
Linking...\r
+Creating command line "bscmake.exe /nologo /o"Debug/ctsim.bsc" ".\Debug\ctsim.sbr" ".\Debug\dialogs.sbr" ".\Debug\dlgprojections.sbr" ".\Debug\dlgreconstruct.sbr" ".\Debug\docs.sbr" ".\Debug\views.sbr""\r
+Creating browse info file...\r
+<h3>Output Window</h3>\r
\r
\r
\r
<h3>Results</h3>\r
-ctsim.exe - 0 error(s), 0 warning(s)\r
+ctsim.exe - 0 error(s), 8 warning(s)\r
</pre>\r
</body>\r
</html>\r
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: ctsim.cpp,v 1.18 2000/12/19 21:37:51 kevin Exp $
+** $Id: ctsim.cpp,v 1.19 2000/12/20 14:39:09 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
#endif
#endif
\r
-static const char* rcsindent = "$Id: ctsim.cpp,v 1.18 2000/12/19 21:37:51 kevin Exp $";
+static const char* rcsindent = "$Id: ctsim.cpp,v 1.19 2000/12/20 14:39:09 kevin Exp $";
class CTSimApp* theApp = NULL;
new wxDocTemplate (m_docManager, "PhantomFile", "*.phm", "", "phm", "Phantom doc", "Phantom View", CLASSINFO(PhantomDocument), CLASSINFO(PhantomView));
- new wxDocTemplate (m_docManager, "PlotFile", "*.plt", "", "plot", "Plot doc", "Plot View", CLASSINFO(PlotFileDocument), CLASSINFO(PlotFileView));
+ new wxDocTemplate (m_docManager, "PlotFile", "*.plt", "", "plt", "Plot doc", "Plot View", CLASSINFO(PlotFileDocument), CLASSINFO(PlotFileView));
//// Create the main frame window
m_pFrame = new MainFrame(m_docManager, (wxFrame *) NULL, -1, "CTSim", wxPoint(0, 0), wxSize(500, 400), wxDEFAULT_FRAME_STYLE);
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: docs.h,v 1.6 2000/12/19 21:37:51 kevin Exp $
+** $Id: docs.h,v 1.7 2000/12/20 14:39:09 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
const PlotFile& getPlotFile () const
{ return m_plot; }
- PlotFile& getPlot ()
- { return m_plot; }
-
+ PlotFile& getPlotFile ()\r
+ { return m_plot; }\r
+\r
virtual bool OnOpenDocument (const wxString& filename);
virtual bool OnCloseDocument ();
virtual bool IsModified () const;
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.cpp,v 1.31 2000/12/19 21:37:51 kevin Exp $
+** $Id: views.cpp,v 1.32 2000/12/20 14:39:09 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
\r
#include "wx/plot.h"\r
\r
-class VectorPlotCurve : wxPlotCurve {\r
-private:\r
- int m_nPoints;\r
- std::vector<double> m_points;\r
-\r
-public:\r
- VectorPlotCurve (const double* const points, int n, double minVal, double maxVal)\r
- : wxPlotCurve (minVal, minVal, maxVal)\r
- {\r
- for (int i = 0; i < n; i++)\r
- m_points.push_back(points[i]);\r
- }\r
-\r
- wxInt32 GetStartX ()\r
- { return 0; }\r
-\r
- wxInt32 GetEndX ()\r
- { return m_nPoints - 1; }\r
-\r
- double GetY (wxInt32 x)\r
- { return m_points[x]; }\r
-};\r
-\r
-
void\r
ImageFileView::OnPlotRow (wxCommandEvent& event)\r
{\r
int xCursor, yCursor;\r
if (! m_canvas->GetCurrentCursor (xCursor, yCursor)) {\r
- // os << "No row selected. Please use left mouse button on image to select row\n";\r
+ *theApp->getLog() << "No row selected. Please use left mouse button on image to select row\n";\r
return;\r
}\r
\r
int ny = rIF.ny();\r
\r
if (v != NULL && yCursor < ny) {\r
- double* pVec = new double [nx];\r
- double minVal = v[0][yCursor];\r
- double maxVal = minVal;\r
+ double* pX = new double [nx];\r
+ double* pY = new double [nx];\r
for (int i = 0; i < nx; i++) {\r
- pVec[i] = v[i][yCursor];\r
- if (pVec[i] < minVal)\r
- minVal = pVec[i];\r
- else if (pVec[i] > maxVal)\r
- maxVal = pVec[i];\r
+ pX[i] = i;\r
+ pY[i] = v[i][yCursor];\r
+ }\r
+ PlotFileDocument* pPlotDoc = dynamic_cast<PlotFileDocument*>(theApp->getDocManager()->CreateDocument("untitled.plt", wxDOC_SILENT));\r
+ if (! pPlotDoc) {\r
+ sys_error (ERR_SEVERE, "Internal error: unable to create Plot file");\r
+ } else {\r
+ PlotFile& rPlot = pPlotDoc->getPlotFile();\r
+ rPlot.setTitle("Row Plot");\r
+ rPlot.setXLabel("Column");\r
+ rPlot.setYLabel("Pixel Value");\r
+ rPlot.setCurveSize (2, nx);\r
+ rPlot.addColumn (0, pX);\r
+ rPlot.addColumn (1, pY);\r
+ delete pX;\r
+ delete pY;\r
}\r
- VectorPlotCurve* plotCurve = new VectorPlotCurve (pVec, nx, minVal, maxVal);\r
- wxPlotWindow* plotWindow = new wxPlotWindow (m_canvas, NULL, wxPoint(0,0), wxSize(500,300));\r
- plotWindow->Add (reinterpret_cast<wxPlotCurve*>(plotCurve));\r
- plotWindow->Enable(TRUE);\r
- plotWindow->Show();\r
}\r
\r
}\r
maxVal = v[xCursor][i];\r
pVec[i] = v[xCursor][i];\r
}\r
-\r
- VectorPlotCurve* plotCurve = new VectorPlotCurve (pVec, ny, minVal, maxVal);\r
- wxPlotWindow plotWindow (m_canvas, NULL, wxPoint(0,0), wxSize(500,300));\r
- plotWindow.Add (reinterpret_cast<wxPlotCurve*>(plotCurve));\r
}\r
}\r
\r
// PlotFileCanvas
-
PlotFileCanvas::PlotFileCanvas (PlotFileView* v, wxFrame *frame, const wxPoint& pos, const wxSize& size, const long style)
: wxScrolledWindow(frame, -1, pos, size, style)
{
void
PlotFileView::OnProperties (wxCommandEvent& event)
{
- const PlotFile& rProj = GetDocument()->getPlot();
+ const PlotFile& rProj = GetDocument()->getPlotFile();
std::ostringstream os;\r
os << "Columns: " << rProj.getNumColumns() << ", Records: " << rProj.getNumRecords() << "\n";
*theApp->getLog() << os.str().c_str();
void
PlotFileView::OnDraw (wxDC* dc)
{
- if (m_bitmap.Ok())
- dc->DrawBitmap (m_bitmap, 0, 0, false);
+ const PlotFile& rPlot = GetDocument()->getPlotFile();\r
+ const int iNColumns = rPlot.getNumColumns();\r
+ const int iNRecords = rPlot.getNumRecords();\r
+\r
+ if (iNColumns > 0 && iNRecords > 0) {\r
+ int xsize, ysize;\r
+ m_canvas->GetClientSize (&xsize, &ysize);\r
+ SGPDriver driver (dc, xsize, ysize);\r
+ SGP sgp (driver);\r
+ const PlotFile& rPhantom = GetDocument()->getPlotFile();\r
+ EZPlot plot (sgp);\r
+\r
+ if (! rPlot.getTitle().empty()) {\r
+ std::string s("title ");\r
+ s += rPlot.getTitle();\r
+ plot.ezset (s);\r
+ }\r
+ if (! rPlot.getXLabel().empty()) {\r
+ std::string s("xlabel ");\r
+ s += rPlot.getXLabel();\r
+ plot.ezset (s);\r
+ }\r
+ if (! rPlot.getYLabel().empty()) {\r
+ std::string s("ylabel ");\r
+ s += rPlot.getYLabel();\r
+ plot.ezset (s);\r
+ }\r
+\r
+ plot.ezset("box");\r
+ plot.ezset("grid");\r
+\r
+ double* pdXaxis = new double [iNRecords];\r
+ rPlot.getColumn (0, pdXaxis);\r
+\r
+ double* pdY = new double [iNRecords];\r
+ for (int iCol = 1; iCol < iNColumns; iCol++) {\r
+ rPlot.getColumn (iCol, pdY);\r
+ plot.addCurve (pdXaxis, pdY, iNRecords);\r
+ }\r
+\r
+ delete pdXaxis;\r
+ delete pdY;\r
+\r
+ plot.plot();\r
+ }\r
}
void
PlotFileView::OnUpdate(wxView *WXUNUSED(sender), wxObject *WXUNUSED(hint) )
{
- const PlotFile& rPlot = GetDocument()->getPlotFile();
- const int iNColumns = rPlot.getNumColumns();\r
- const int iNRecords = rPlot.getNumRecords();
- if (iNColumns > 0 && iNRecords > 0) {
-// int xSize, ySize;\r
-// m_frame->SetClientSize (xSize, ySize);
-// m_canvas->SetScrollbars (20, 20, nDet/20, nView/20);
- }
-
if (m_canvas)
m_canvas->Refresh();
}
** This is part of the CTSim program
** Copyright (C) 1983-2000 Kevin Rosenberg
**
-** $Id: views.h,v 1.12 2000/12/19 21:37:51 kevin Exp $
+** $Id: views.h,v 1.13 2000/12/20 14:39:09 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
{
DECLARE_DYNAMIC_CLASS(PlotFileView)
- wxMemoryDC m_memoryDC;
- wxBitmap m_bitmap;
-
private:
PlotFileCanvas *CreateCanvas(wxView *view, wxFrame *parent);
wxFrame *CreateChildFrame(wxDocument *doc, wxView *view);
PlotFileCanvas *m_canvas;
wxFrame *m_frame;
- int m_iDefaultNX;
- int m_iDefaultNY;
- int m_iDefaultFilter;
- int m_iDefaultFilterMethod;
- double m_dDefaultFilterParam;
- int m_iDefaultFilterGeneration;
- int m_iDefaultZeropad;
- int m_iDefaultInterpolation;
- int m_iDefaultInterpParam;
- int m_iDefaultBackprojector;
- int m_iDefaultTrace;
-
public:
PlotFileView(void);
virtual ~PlotFileView(void);