00001 00012 // inconsistent dll linkage 00013 #ifdef _MSC_VER 00014 #include "msdevstudio/MSconfig.h" 00015 #endif 00016 00017 #include "ViewBase.h" 00018 00019 #include "plotters/PlotterBase.h" 00020 00021 #include <cassert> 00022 00023 using std::list; 00024 00025 using namespace hippodraw; 00026 00027 ViewBase::ViewBase( ) 00028 : m_plotter ( 0 ) 00029 { 00030 } 00031 00032 ViewBase::ViewBase ( PlotterBase * plotter ) 00033 : m_plotter ( plotter ) 00034 { 00035 } 00036 00037 ViewBase::~ViewBase() 00038 { 00039 // Do not delete plotter here, some derived classes, such as 00040 // EPSView, are only temporary and don't own the plotter. 00041 } 00042 00043 void 00044 ViewBase:: 00045 setPlotter ( PlotterBase * plotter ) 00046 { 00047 m_plotter = plotter; 00048 } 00049 00050 PlotterBase * ViewBase::getPlotter () const 00051 { 00052 return m_plotter; 00053 } 00054 00055 PlotterBase * ViewBase::getPlotter () 00056 { 00057 return m_plotter; 00058 } 00059 00060 void ViewBase::drawSelf () 00061 { 00062 assert ( m_plotter ); 00063 m_plotter -> prepareToDraw (); 00064 m_plotter->drawIn ( this ); 00065 } 00066 00067 const Range & 00068 ViewBase:: 00069 getRange ( hippodraw::Axes::Type axis ) const 00070 { 00071 return m_plotter -> getRange ( axis, false ); 00072 } 00073 00074 const Rect & 00075 ViewBase:: 00076 getUserRect() const 00077 { 00078 return m_plotter->getUserRect(); 00079 } 00080 00081 const Rect & 00082 ViewBase:: 00083 getRawRect() const 00084 { 00085 return m_plotter->getRawRect(); 00086 } 00087 00088 double ViewBase::getAspectRatio () const 00089 { 00090 assert ( m_plotter ); 00091 return m_plotter -> getAspectRatio (); 00092 } 00093 00094 void 00095 ViewBase:: 00096 willDelete ( const Observable * observee ) 00097 { 00098 if ( observee == m_plotter ) { 00099 m_plotter = 0; 00100 } 00101 } 00102 00103 void 00104 ViewBase:: 00105 updateDrawRect () 00106 { 00107 // Do nothing in base class. 00108 } 00109 00110 void 00111 ViewBase:: 00112 drawImage ( const std::string &filename, int position ) 00113 { 00114 // Do nothing in base class. 00115 } 00116 00117 void 00118 ViewBase:: 00119 drawLatex ( const std::string &eq, int position ) 00120 { 00121 // Do nothing in base class. 00122 } 00123 00124 void 00125 ViewBase:: 00126 drawPolygon ( const std::vector <double > & xpoints, 00127 const std::vector <double > & ypoints, 00128 const Color & color, 00129 const Color & edge ) 00130 { 00131 // Do nothing in base class. 00132 }