ViewBase.cxx
Go to the documentation of this file.
1 
12 // inconsistent dll linkage
13 #ifdef _MSC_VER
14 #include "msdevstudio/MSconfig.h"
15 #endif
16 
17 #include "ViewBase.h"
18 
19 #include "plotters/PlotterBase.h"
20 
21 #include <cassert>
22 
23 using std::list;
24 
25 using namespace hippodraw;
26 
28  : m_plotter ( 0 )
29 {
30 }
31 
33  : m_plotter ( plotter )
34 {
35 }
36 
38 {
39  // Do not delete plotter here, some derived classes, such as
40  // EPSView, are only temporary and don't own the plotter.
41 }
42 
43 void
45 setPlotter ( PlotterBase * plotter )
46 {
47  m_plotter = plotter;
48 }
49 
51 {
52  return m_plotter;
53 }
54 
56 {
57  return m_plotter;
58 }
59 
61 {
62  assert ( m_plotter );
63  m_plotter -> prepareToDraw ();
64  m_plotter->drawIn ( this );
65 }
66 
67 const Range &
70 {
71  return m_plotter -> getRange ( axis, false );
72 }
73 
74 const Rect &
76 getUserRect() const
77 {
78  return m_plotter->getUserRect();
79 }
80 
81 const Rect &
83 getRawRect() const
84 {
85  return m_plotter->getRawRect();
86 }
87 
88 double ViewBase::getAspectRatio () const
89 {
90  assert ( m_plotter );
91  return m_plotter -> getAspectRatio ();
92 }
93 
94 void
96 willDelete ( const Observable * observee )
97 {
98  if ( observee == m_plotter ) {
99  m_plotter = 0;
100  }
101 }
102 
103 void
106 {
107  // Do nothing in base class.
108 }
109 
110 void
112 drawImage ( const std::string &filename, int position )
113 {
114  // Do nothing in base class.
115 }
116 
117 void
119 drawLatex ( const std::string &eq, int position )
120 {
121  // Do nothing in base class.
122 }
123 
124 void
126 drawPolygon ( const std::vector <double > & xpoints,
127  const std::vector <double > & ypoints,
128  const Color & color,
129  const Color & edge )
130 {
131  // Do nothing in base class.
132 }
virtual void drawImage(const std::string &filename, int position=0)
Draws a image.
Definition: ViewBase.cxx:112
Part of an implementation of the Observable-Observer pattern based on the example in the GOF Patterns...
Definition: Observable.h:39
virtual ~ViewBase()
The virtual destructor.
Definition: ViewBase.cxx:37
const Rect & getRawRect() const
Returns the raw rectangle before transform.
virtual void drawSelf()
Draws itself.
Definition: ViewBase.cxx:60
virtual void drawLatex(const std::string &eq, int position=0)
Draws a Latex equation.
Definition: ViewBase.cxx:119
virtual double getAspectRatio() const
Get the aspect ratio.
Definition: ViewBase.cxx:88
const Rect & getUserRect() const
Returns the data space rectangle.
A Color class for creating the color object following the standard RGB color space.
Definition: Color.h:37
The base class for the PlotterBase hierarchy.
Definition: PlotterBase.h:55
const Rect & getRawRect() const
Returns the rectangle before transform.
Definition: ViewBase.cxx:83
PlotterBase * getPlotter() const
Returns the plotter used by this view.
Definition: ViewBase.cxx:50
PlotterBase * m_plotter
The plotter object used by this view.
Definition: ViewBase.h:69
ViewBase()
The default constructor.
Definition: ViewBase.cxx:27
Class representing a rectangle.
Definition: Rectangle.h:34
virtual void drawPolygon(const std::vector< double > &xpoints, const std::vector< double > &ypoints, const Color &color, const Color &edge)
Draws a polygon.
Definition: ViewBase.cxx:126
virtual void willDelete(const Observable *plotter)
Responds to notification that the PlotterBase object is being deleted.
Definition: ViewBase.cxx:96
virtual void updateDrawRect()
Update the drawing Rectangle in the devices coordinate system.
Definition: ViewBase.cxx:105
const Rect & getUserRect() const
Is called by the AxisRepBase object (or one of its derived objects), and returns the rectangle where ...
Definition: ViewBase.cxx:76
Expresses a range of values.
Definition: Range.h:33
virtual void setPlotter(PlotterBase *plotter)
Sets the PlotterBase object to plotter.
Definition: ViewBase.cxx:45
const Range & getRange(Axes::Type axis) const
Returns the range of the data space on specified axis.
Definition: ViewBase.cxx:69
hippodraw::ViewBase class interface
virtual void drawIn(ViewBase *view)=0
Starts the drawing in view view.
Type
Axes constants.
Definition: AxesType.h:31
hippodraw::PlotterBase class interface.

Generated for HippoDraw Class Library by doxygen