00001 /* -*- mode:c++ -*- */ 00002 00018 class ViewBase : Observer 00019 { 00020 %TypeHeaderCode 00021 #include "hippoplot/ViewBase.h" 00022 %End 00023 00024 00025 public: 00026 00028 ViewBase(); 00029 00032 ViewBase ( PlotterBase * ); 00033 00035 ViewBase ( const ViewBase & ); 00036 00038 virtual ~ViewBase(); 00039 00044 virtual void setPlotter ( PlotterBase * ); 00045 00047 PlotterBase * getPlotter () const; 00048 00050 PlotterBase * getPlotter (); 00051 00056 virtual void update ( const Observable * ) = 0; 00057 00059 virtual void drawSelf(); 00060 00065 virtual void initPlot ( double ) = 0; 00066 00068 virtual void endPlot () = 0; 00069 00070 // /** Draws multiple line segments - that is, a line between x0,y0 and 00071 // x1,y2, another between x2,y2 and x3,y3 and so on. 00072 // @p x pairs of coordinates in user space on the X axis for the beginning 00073 // and the end of the line segment. 00074 // @p y pairs of coordinates in user space on the Y axis for the beginning 00075 // and the end of the line segment. 00076 // @p style the line style. 00077 // @p color The color 00078 // @p size The thickness of the line. */ 00079 // virtual void drawLines ( const std::vector< double > & , 00080 // const std::vector< double > & , 00081 // hippodraw::Line::Style , 00082 // const Color & , 00083 // float ) = 0; 00084 00085 // /** Draws multiple line segments, each with a different color - that 00086 // is, a line between x0,y0 and x1,y1, with color[0] =color[1] 00087 // another between x2,y2 and x3,y3 with color[2]=color[3] and so 00088 // on. 00089 00090 // @p x pairs of coordinates in user space on the X axis for the 00091 // beginning and the end of the line segment. 00092 00093 // @p y pairs of coordinates in user space on the Y axis for the 00094 // beginning and the end of the line segment. 00095 00096 // @p style the line style. 00097 00098 // @p color The RGB values for the color of the line. 00099 00100 // @p size The thickness of the line. 00101 00102 // @bug Could call drawPolyLine for each contour with same color. 00103 00104 // */ 00105 // virtual void drawColorLines ( const std::vector< double > & , 00106 // const std::vector< double > & , 00107 // hippodraw::Line::Style , 00108 // const std::vector < Color > & , 00109 // float ) = 0; 00110 00111 // /** Draws multiple line segments. 00112 // @p x pairs of coordinates in view space on the X axis for the beginning 00113 // and the end of the line segment. 00114 // @p y pairs of coordinates in view space on the Y axis for the beginning 00115 // and the end of the line segment. 00116 // @p style the line style. 00117 // @p color if @c true, use the display's point color; otherwise, use 00118 // the default color. 00119 // @p size The thickness of the line. */ 00120 // virtual void drawViewLines ( const std::vector< double > & , 00121 // const std::vector< double > & , 00122 // hippodraw::Line::Style , 00123 // bool , 00124 // float ) = 0; 00125 00126 // /** Draws multiple line segments. 00127 // @p x pairs of coordinates in view space on the X axis for the beginning 00128 // and the end of the line segment. 00129 // @p y pairs of coordinates in view space on the Y axis for the beginning 00130 // and the end of the line segment. 00131 // @p style the line style. 00132 // @p color The color 00133 // @p size The thickness of the line. */ 00134 // virtual void drawViewLines ( const std::vector< double > & , 00135 // const std::vector< double > & , 00136 // hippodraw::Line::Style , 00137 // const Color & , 00138 // float ) = 0; 00139 // /** Draws a polyline. 00140 // @p xpoints points along the X axis. 00141 // @p ypoints points along the Y axis. 00142 // @p style the line style. 00143 // @p color The color. 00144 // @p size The thickness of the line. */ 00145 // virtual void drawPolyLine ( const std::vector< double > & , 00146 // const std::vector< double > & , 00147 // hippodraw::Line::Style , 00148 // const Color & , 00149 // float ) = 0; 00150 00151 // /** Draws a text string at a point in the view's coordinate system. 00152 00153 // @param s The string to be drawn. 00154 00155 // @param x The x coordinate in the view's coordinate system. 00156 00157 // @param y The y coordinate in the view's coordinate system. 00158 00159 // @param fontsize The font size. If zero, then taken from the 00160 // font object. 00161 00162 // @param angle The angle to draw. 90 degrees is vertical with the 00163 // beginning of the text towards the bottom. 00164 00165 // @param xp The horizontal alignment with respect to the 00166 // coordinate. 'r' means the coordinate is on the right side of 00167 // the text, 'c' means centered, and 'l' for the left side. 00168 00169 // @param yp The vertical alignment with respect to the 00170 // coordinate. 't' means toward the top, 'c' means centered, and 00171 // 'b' means bottom. 00172 00173 // @param resize If @c true, the bounding rectangle of the view 00174 // should be resized to fit the text string. 00175 00176 // @param font If not a null pointer, then the font object to be 00177 // used, otherwise the default font will be used. 00178 00179 // */ 00180 // virtual void drawText ( const std::string & , float , float , 00181 // float , float angle = 0.0, 00182 // char xp = 'l', char yp = 't', 00183 // bool resize = false, 00184 // const FontBase * font = 0 ) = 0; 00185 00191 virtual void drawUserText ( const std::string & , float , float , 00192 float , float , 00193 char , char ) = 0; 00194 00203 virtual void drawMag ( float , float , int , float ) = 0; 00204 00205 // /** Draws symbol points. @a x and @a y are the coordinates, @a type 00206 // is the type of symbol, and @a sym_size is the size. All symbols 00207 // are draw in the same color. */ 00208 // virtual void drawPoints ( const std::vector<double> & , 00209 // const std::vector<double> & , 00210 // hippodraw::Symbol::Type , 00211 // float , const Color & ) = 0; 00212 00213 // /** Draws symbol points. @a x and @a y are the coordinates, @a type 00214 // is the type of symbol, and @a sym_size is the size. @a hue is 00215 // the hue parameters for each point. The saturation and brightness 00216 // are set to 1.0. 00217 // */ 00218 // virtual void drawPoints ( const std::vector< double > & , 00219 // const std::vector< double > & , 00220 // const std::vector< Color > & , 00221 // hippodraw::Symbol::Type , float ) = 0; 00222 00225 virtual void drawSquare ( double , double , double , double , 00226 int , int, int ) = 0; 00227 00230 virtual void drawViewSquare ( float , float , float , float , 00231 int , int , int ) = 0; 00232 00233 // /** Returns the range of the data space on specified axis. 00234 // */ 00235 // const Range & getRange ( hippodraw::Axes::Type ) const; 00236 00237 // /** Is called by the AxisRepBase object (or one of its derived 00238 // * objects), and returns the rectangle where the drawing is 00239 // * made. */ 00240 // const HippoRectangle & getUserRect () const; 00241 00242 // /** Returns the drawing Rectangle in the devices coordinate system. 00243 // Must be implemented in derived class. */ 00244 // virtual HippoRectangle getDrawRect() const = 0; 00245 00247 virtual void setDrawRect ( float , float , float , float ) = 0; 00248 00249 // /** Returns the Rectangle within which points representations are 00250 // draw. 00251 00252 // @todo It might be better to maintain insets instead of separate 00253 // Rectangle. In that way, only one rectangle would move with 00254 // respect to canvas. 00255 // */ 00256 // virtual HippoRectangle getMarginRect() const; 00257 00260 virtual float userToDrawX ( double ) const = 0; 00261 00264 virtual float userToDrawY ( double ) const = 0; 00265 00268 virtual float userToDrawColor ( double ) const = 0; 00269 00271 virtual double getAspectRatio () const; 00272 00273 };