13 #include "msdevstudio/MSconfig.h"
24 #ifdef ITERATOR_MEMBER_DEFECT
32 using namespace hippodraw;
35 EpsView (
const std::string filename,
double x,
double y,
double w,
double h )
37 m_boundingRect ( x, y, w, h )
51 m_outfile << x <<
" " << y <<
" lineto\n";
58 m_outfile << x <<
" " << y <<
" moveto\n";
95 double inv = 1. / 255.;
98 << blue * inv <<
" setrgbcolor\n";
112 double,
double,
double w,
double h )
115 const char *
fn = fname.c_str();
118 m_outfile <<
"%%!PS-Adobe-3.0 EPSF-3.0" << endl;
119 m_outfile <<
"%%Creator: HippoDraw" << endl;
127 << x1 <<
" " << y1 <<
" "
128 << x2 <<
" " << y2 << endl;
133 m_outfile <<
"%% Add emulation of selectfont if needed" << endl;
134 m_outfile <<
"%% taken from PS Lang. Ref. Manual, Appendix D.4" << endl;
136 m_outfile <<
" exch findfont exch" << endl;
137 m_outfile <<
" dup type /arraytype eq {makefont}{scalefont} ifelse setfont"
141 m_outfile <<
"/languagelevel where" << endl;
142 m_outfile <<
" {pop languagelevel} {1} ifelse" << endl;
143 m_outfile <<
"2 lt {/SF /*SF load def}{/SF /selectfont load def} ifelse"
146 m_outfile <<
"%%" << endl <<
"%%" << endl;
156 const std::vector< double > & y,
172 for (
unsigned int i = 0;
i < x.size();
i =
i+2 )
175 m_outfile <<
"gsave" << endl <<
"newpath systemdict begin" << endl;
188 const std::vector< double > & y,
190 const std::vector < Color > & colors,
198 for (
unsigned int i = 0;
i < x.size();
i+=2 ){
200 const Color & color = colors[
i];
205 m_outfile <<
"gsave" << endl <<
"newpath systemdict begin" << endl;
220 const std::vector< double > & y,
227 m_outfile <<
"%% drawViewLines1" << endl;
234 for (
unsigned int i = 0;
i < x.size();
i =
i+2 )
237 m_outfile <<
"gsave" << endl <<
"newpath systemdict begin" << endl;
250 const std::vector< double > & y,
257 m_outfile <<
"%% drawViewLines2" << endl;
265 for (
unsigned int i = 0;
i < x.size();
i =
i+2 )
268 m_outfile <<
"gsave" << endl <<
"newpath systemdict begin" << endl;
281 const std::vector< double > & ypoints,
296 m_outfile <<
"gsave" << endl <<
"newpath systemdict begin" << endl;
299 for (
unsigned int i = 1;
i < xpoints.size();
i++ )
301 double view_x =
toViewX ( xpoints[
i] );
302 double view_y =
toViewY ( ypoints[i] );
303 lineTo ( view_x, view_y );
317 int red,
int green,
int blue )
338 int red,
int green,
int blue )
361 double x,
double y,
float sym_size )
391 <<
"0.0 360 arc" << endl;
414 const std::vector<double> & y,
417 const Color & color )
432 m_outfile <<
"newpath systemdict begin" << endl;
434 for (
unsigned int i = 0;
i < x.size();
i++) {
456 const std::vector< double > & y,
457 const std::vector< Color > & colors,
471 for (
unsigned int i = 0;
i < x.size();
i++)
475 const Color & color = colors[
i];
478 m_outfile <<
"newpath systemdict begin" << endl;
498 float fontsize,
float angle,
499 char xp,
char yp,
const FontBase * font )
501 float xStep = 0.0, yStep = 0.0;
536 m_outfile <<
"(Helvetica) " << fontsize <<
" SF" << endl;
537 size = static_cast <
int > ( fontsize );
540 string family (
"(" );
541 family += font -> family ();
543 size = font -> pointSize ();
544 m_outfile << family << size <<
" SF" << endl;
546 m_outfile << x <<
" " << y <<
" translate " << angle <<
" rotate" << endl;
548 m_outfile <<
"(" << s <<
") stringwidth pop" << endl;
549 m_outfile << xStep <<
" neg mul " << -size*yStep <<
" moveto" << endl;
550 m_outfile <<
"(" << s <<
") show" << endl;
559 float fontsize,
float angle,
560 char xp,
char yp,
bool,
562 const Color * color )
637 return ( s1 - ( s2 - ( mar_y
638 - 2 * margin_rect.
getY()
virtual void drawColorLines(const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, const std::vector< Color > &color, float size)
Draws multiple line segments, each with a different color - that is, a line between x0...
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
virtual void drawPolyLine(const std::vector< double > &xpoints, const std::vector< double > &ypoints, hippodraw::Line::Style style, const Color &color, float size)
Draws a polyline.
void setLineWidth(double size)
Sets the line width with PostScript setlinewidth.
virtual float userToMarginColor(double c) const
Converts the user Z coordinate into the margin color (X) coordinate.
double getHeight() const
A shortcut to get size.height.
void drawSymbol(hippodraw::Symbol::Type type, double x, double y, float size)
Draws a symbol.
void moveTo(double x, double y)
Does a PostScript moveto.
float userToDrawX(double x) const
virtual void closeFile()
Terminate the PostScript file.
Type
Enumeration of the type of symbols supported by this class.
void setDash(hippodraw::Line::Style style)
Uses PostScript setdash to set the line style.
virtual float userToMarginX(double x) const
Converts the user X coordinate into the margin X coordinate.
float userToDrawXAutoInv(double x) const
float userToDrawColor(double c) const
virtual void update(const Observable *)
Implements the update method of the Observer pattern.
A abstract base class for font handling.
The abstract base class for views that have a region for drawing data points with area around it for ...
A Color class for creating the color object following the standard RGB color space.
float toX(double x) const
hippodraw::EpsView class interface
PlotterBase * m_plotter
The plotter object used by this view.
void setRect(double x, double y, double width, double height)
Set the parameters of 2D Rectangle.
PyArray_TYPES type(numeric::array arr)
virtual void drawText(const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp, bool resize, const FontBase *font, const Color *color)
virtual void drawSquare(double x1, double y1, double x2, double y2, int red, int green, int blue)
Draws a colored square.
intp size(numeric::array arr)
virtual Rect getDrawRect() const
Returns the drawing Rectangle in the devices coordinate system.
virtual float userToInvertedMarginX(double x) const
Converts the user X coordinate into the inverted X coordinate.
float userToDrawY(double x) const
virtual void drawPoints(const std::vector< double > &x, const std::vector< double > &y, hippodraw::Symbol::Type type, float sym_size, const Color &color)
Draws symbol points.
float toY(double y) const
Class representing a rectangle.
Style
Line style constants.
void setRgbColor(const Color &color)
Does a PostScript setrgbcolor.
virtual void draw_Text(const std::string &s, float x, float y, float fontsize, float angle, char xp, char yp, const FontBase *)
float toViewX(double datX) const
float toViewY(double datY) const
void initPlot(const std::string &filename, double x, double y, double w, double h)
Initializes data for the EPSF file generation.
void lineTo(double x, double y)
Does a PostScript lineto.
virtual void drawViewLines(const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, bool color, float size)
virtual void setDrawRect(float x, float y, float w, float h)
Sets the drawing Rectangle in the devices coordinate system.
FontBase class interface.
virtual float userToMarginY(double y) const
Converts the user Y coordinate into the margin Y coordinate.
double getX() const
A shortcut to get origin.X.
virtual void drawLines(const std::vector< double > &x, const std::vector< double > &y, hippodraw::Line::Style style, const Color &color, float size)
Draws multiple line segments - that is, a line between x0,y0 and x1,y2, another between x2...
const Rect & getMarginRect() const
Returns the rectangle area in which data points are drawn.
virtual void drawViewSquare(float x1, float y1, float x2, float y2, int red, int green, int blue)
Draws a colored square in view space.
virtual float userToInvertedMarginY(double y) const
Converts the user Y coordinate into the top-left based margin Y coordinate.
double getY() const
A shortcut to get origin.Y.
hippodraw::PlotterBase class interface.