latest version v1.9 - last update 10 Apr 2010 |
00001 /* 00002 * Copyright (C) 2002, 2003, 2004, 2005, 2006 00003 * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany 00004 * 00005 * This file is part of the LTI-Computer Vision Library (LTI-Lib) 00006 * 00007 * The LTI-Lib is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License (LGPL) 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * The LTI-Lib is distributed in the hope that it will be 00013 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 00014 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with the LTI-Lib; see the file LICENSE. If 00019 * not, write to the Free Software Foundation, Inc., 59 Temple Place - 00020 * Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 00023 00024 /*-------------------------------------------------------------------- 00025 * project ....: LTI-Lib: Image Processing and Computer Vision Library 00026 * file .......: ltiDrawBase.h 00027 * authors ....: Jens Paustenbach 00028 * organization: LTI, RWTH Aachen 00029 * creation ...: 19.11.2002 00030 * revisions ..: $Id: ltiDrawBase.h,v 1.9 2006/02/07 18:47:41 ltilib Exp $ 00031 */ 00032 00033 #ifndef _LTI_DRAW_BASE_H_ 00034 #define _LTI_DRAW_BASE_H_ 00035 00036 #include "ltiObject.h" 00037 #include "ltiStatus.h" 00038 #include "ltiTypes.h" 00039 #include "ltiHTypes.h" 00040 #include "ltiImage.h" 00041 #include "ltiContour.h" 00042 #include "ltiIoHandler.h" 00043 #include "ltiLocation.h" 00044 #include "ltiLinearKernels.h" 00045 #include "ltiGraphicsPattern.h" 00046 00047 00048 namespace lti { 00049 00050 /** 00051 * Abstract parent class for draw and epsDraw. 00052 * This class provides all methods that are implemented in ltiDraw and 00053 * ltiEpsDraw. It makes a base class availabel with all generall drawing 00054 * methods. Some special methods, are not implemented in this base class. 00055 * The class is aiming at providing a base class, so that, according to 00056 * the given parameter, a picture is drawn or an eps file written. <br> 00057 */ 00058 template<class T> 00059 class drawBase : public object, public status { 00060 public: 00061 00062 /** 00063 * Specifies different types of marker which can be defined for 00064 * the marker-method. 00065 * 00066 * @see setMarkerType, setStyle 00067 */ 00068 enum eMarkerType { 00069 Pixel = 0, /**< Pixel ('.') */ 00070 Circle, /**< Circle ('o') */ 00071 Xmark, /**< Xmark ('x') */ 00072 Plus, /**< Plus ('+') */ 00073 Star, /**< Star ('*') */ 00074 Square, /**< Square ('s') */ 00075 Diamond, /**< Diamond ('d') */ 00076 TriangleUp, /**< Triangle up ('^') */ 00077 TriangleDown, /**< Triangle down ('v') */ 00078 TriangleLeft, /**< Triangle left ('<') */ 00079 TriangleRight, /**< Triangle right ('>') */ 00080 Dot, /**< Dot ('#') */ 00081 LtiLogo /**< LTI-Logo*/ 00082 }; 00083 00084 /** 00085 * default constructor 00086 */ 00087 drawBase(); 00088 00089 00090 /** 00091 * copy constructor 00092 * @param other the object to be copied 00093 */ 00094 drawBase(const drawBase& other); 00095 00096 /** 00097 * destructor 00098 */ 00099 virtual ~drawBase(); 00100 00101 /** 00102 * copy data of "other" functor. 00103 * @param other the functor to be copied 00104 * @return a reference to this functor object 00105 */ 00106 drawBase& copy(const drawBase& other); 00107 00108 00109 /** 00110 * returns the name of this type ("drawBase") 00111 */ 00112 virtual const char* getTypeName() const; 00113 00114 00115 /** 00116 * Specifies grayscale level to be used (range from 0 to 1) for 00117 * the next graphics objects. 00118 */ 00119 virtual void setGray(const float k)=0; 00120 00121 00122 /** 00123 * Specifies the size for the next markers. 00124 * Default is 5 in draw and 2 in epsDraw 00125 */ 00126 virtual void setMarkerSize(const int size); 00127 00128 /** 00129 * Specifies color to be used. 00130 */ 00131 virtual void setColor(const char* color)=0; 00132 00133 /** 00134 * Specifies color to be used. 00135 */ 00136 virtual void setColor(const T& color)=0; 00137 00138 /** 00139 * Sets the style used for drawing points. This includes the color and 00140 * the symbols for the %point 00141 * @see point(const int, const int, const char*) 00142 * 00143 * The string characterizing consists of two parts: the first 00144 * definining color and the second defining the symbol. These are 00145 * as close to the MATLAB(TM) attributes as possible. If one of the 00146 * parts is missing, the corresponding value remains unchanged. 00147 * 00148 * <table> 00149 * <tr> 00150 * <th>Colors</th> <th width="10%" > <br></th> <th>Symbols</th> 00151 * </tr> 00152 * <tr> <td> 00153 * <table> 00154 * <tr><td>y</td><td>yellow</td></tr> 00155 * <tr><td>m</td><td>magenta</td></tr> 00156 * <tr><td>c</td><td>cyan</td></tr> 00157 * <tr><td>r</td><td>red</td></tr> 00158 * <tr><td>g</td><td>green</td></tr> 00159 * <tr><td>b</td><td>blue</td></tr> 00160 * <tr><td>w</td><td>white</td></tr> 00161 * <tr><td>k</td><td>black</td></tr> 00162 * </table> 00163 * </td> <td> <br> </td> 00164 * <td> 00165 * <table> 00166 * <tr><td>.</td><td>point/pixel</td></tr> 00167 * <tr><td>o</td><td>circle</td></tr> 00168 * <tr><td>x</td><td>x-mark</td></tr> 00169 * <tr><td>+</td><td>plus</td></tr> 00170 * <tr><td>*</td><td>star</td></tr> 00171 * <tr><td>s</td><td>square</td></tr> 00172 * <tr><td>d</td><td>diamond</td></tr> 00173 * <tr><td>^</td><td>triangle (up)</td></tr> 00174 * <tr><td>v</td><td>triangle (down)</td></tr> 00175 * <tr><td><</td><td>triangle (left)</td></tr> 00176 * <tr><td>></td><td>triangle (right)</td></tr> 00177 * <tr><td>#</td><td>dot</td></tr> 00178 * </table> 00179 * </td></tr> 00180 * </table> 00181 * 00182 * In addition all colors except for black can be darkened by a 00183 * number between 0 and 9 following the color letter. The default 00184 * is 0. The higher the number, the darker the color. Also the 00185 * closed symbols are available in a filled version. This is 00186 * activated by an 'f' following the symbol specifier. 00187 * 00188 * Colors only work properly if the canvas used is of type image, 00189 * ie using rgbPixel as template type. Otherwise, gray-levels are 00190 * used instead of the colors. Here, 'c', 'm', and 'y' result in 00191 * the same gray-level as do 'r', 'g' and 'b'. For better 00192 * predictability use white with different factors for getting 00193 * gray-levels. 00194 * 00195 * A change of the color using setColor(const char*) or 00196 * setColor(const T&) does not affect the type of symbol being 00197 * used. 00198 */ 00199 virtual void setStyle(const char* style); 00200 00201 /** 00202 * Specifies the marker type to be used for points 00203 */ 00204 virtual void setMarkerType(const eMarkerType m); 00205 00206 00207 /** 00208 * Sets the pattern for drawing lines. All subsequent lines 00209 * will be drawn in the given pattern. The default is the 00210 * continuous line. 00211 * @param pat pattern for drawing lines. 00212 */ 00213 virtual void setLinePattern(const linePattern& pat); 00214 00215 /** 00216 * Sets the pattern for filling areas. All subsequenly filled 00217 * areas will be filled with the given pattern. The default 00218 * pattern is a homogenouos fill. 00219 * @param pat pattern for filling areas. 00220 */ 00221 virtual void setFillPattern(const fillPattern& pat); 00222 00223 /** 00224 * returns the size of the drawing area. 00225 */ 00226 virtual point getCanvasSize()=0; 00227 00228 /** 00229 * sets a single pixel at point (x,y) 00230 * In epsDraw this pixel is a small square. 00231 */ 00232 virtual void set(const int x,const int y)=0; 00233 00234 /** 00235 * sets a single pixel at p 00236 */ 00237 virtual void set(const point& p) { 00238 set(p.x,p.y); 00239 }; 00240 00241 /** 00242 * sets a single pixel at p 00243 */ 00244 template<class U> 00245 void set(const hPoint2D<U>& p) 00246 {set(p.x/p.h,p.y/p.h);}; 00247 00248 /** 00249 * sets pixels at all points in c, moved by the given offset 00250 */ 00251 virtual void set(const pointList& c, const point& offset=point(0,0)); 00252 00253 /** 00254 * draw a location. 00255 * 00256 * @param loc location with position, angle and radius 00257 * @param showAngleLine if true, a line from the middle point of the 00258 * location (given by loc.position) with the angle given by 00259 * loc.angle will be drawn. 00260 */ 00261 virtual void set(const location& loc,const bool showAngleLine = false); 00262 00263 /** 00264 * draw a rectLocation 00265 * 00266 * @param loc location with position, angle and radius 00267 * @param showAngleLine if true, a line from the middle point of the 00268 * location (given by loc.position) with the angle given by 00269 * loc.angle will be drawn. 00270 */ 00271 virtual void set(const rectLocation& loc,const bool showAngleLine = false); 00272 00273 /** 00274 * draws a list of locations 00275 */ 00276 virtual void set(const std::list<location>& locs, 00277 const bool showAngleLine = false); 00278 00279 00280 /** 00281 * Set marker at point (x,y). 00282 * If there is no style, markerType or width is given, the value 00283 * set by the setStyle or setWidth is used. 00284 * @param x the x coordinate 00285 * @param y the y coordinate 00286 */ 00287 virtual void marker(const int x,const int y) { 00288 marker(x,y,actSize,actSymbol); }; 00289 00290 /** 00291 * Set marker at point (x,y). 00292 * If there is no style, markerType or width is given, the value 00293 * set by the setStyle or setWidth is used. 00294 * @param x the x coordinate 00295 * @param y the y coordinate 00296 * @param width the size of the marker symbol 00297 */ 00298 virtual void marker(const int x,const int y,const int width) { 00299 marker(x, y, width, actSymbol); }; 00300 00301 /** 00302 * Set marker at point (x,y). 00303 * If there is no style, markerType or width is given, the value 00304 * set by the setStyle or setWidth is used. 00305 * @param x the x coordinate 00306 * @param y the y coordinate 00307 * @param style the style of the marker symbol. 00308 */ 00309 virtual void marker(const int x,const int y,const char* style) { 00310 marker(x,y,actSize,style); }; 00311 00312 /** 00313 * Set marker at point (x,y). 00314 * If there is no style, markerType or width is given, the value 00315 * set by the setStyle or setWidth is used. 00316 * @param x the x coordinate 00317 * @param y the y coordinate 00318 * @param t the type of the marker 00319 */ 00320 virtual void marker(const int x,const int y,const eMarkerType t) { 00321 marker(x,y,actSize,t); }; 00322 00323 /** 00324 * Set marker at point (x,y). 00325 * If there is no style, markerType or width is given, the value 00326 * set by the setStyle or setWidth is used. 00327 * @param x the x coordinate 00328 * @param y the y coordinate 00329 * @param w the size of the marker symbol 00330 * @param style the style of the marker symbol. 00331 */ 00332 virtual void marker(const int x,const int y,const int w,const char* style){ 00333 drawSymbol(x,y,w,style); }; 00334 00335 /** 00336 * Set marker at point (x,y). 00337 * If there is no style, markerType or width is given, the value 00338 * set by the setStyle or setWidth is used. 00339 * @param x the x coordinate 00340 * @param y the y coordinate 00341 * @param w the size of the marker symbol 00342 * @param t the type of the marker 00343 */ 00344 virtual void marker(const int x,const int y,const int w, eMarkerType t) 00345 {drawSymbol(x,y,w,t);}; 00346 00347 /** 00348 * Set marker at p. 00349 * @see marker(int,int) 00350 */ 00351 virtual void marker(const point& p) { 00352 marker(p.x,p.y,actSize,actSymbol); }; 00353 00354 /** 00355 * Set marker at p with given width. 00356 * @see marker(int,int) 00357 */ 00358 virtual void marker(const point& p,const int width) { 00359 marker(p.x, p.y, width, actSymbol); }; 00360 00361 /** 00362 * Set marker at p with given style 00363 * @see marker(int,int) 00364 */ 00365 virtual void marker(const point& p, char* style) { 00366 marker(p.x,p.y,actSize,style); }; 00367 00368 /** 00369 * Set given marker type at p. 00370 * @see marker(int,int) 00371 */ 00372 virtual void marker(const point& p, eMarkerType t) { 00373 marker(p.x,p.y,actSize,t); }; 00374 00375 /** 00376 * Set given marker type at p with given width. 00377 * @see marker(int,int) 00378 */ 00379 virtual void marker(const point& p, int width, eMarkerType t) { 00380 marker(p.x,p.y,width,t); }; 00381 00382 /** 00383 * Set marker at p with given width and style. 00384 * @see marker(int,int) 00385 */ 00386 virtual void marker(const point& p, int width, char* style) { 00387 marker(p.x,p.y,width,style); }; 00388 00389 /** 00390 * Set marker at p. 00391 * @param p coordinates of the pixel to be set 00392 * @see marker(int,int) 00393 */ 00394 template <class U> 00395 void marker(const hPoint2D<U>& p) { 00396 marker(p.x/p.h,p.y/p.h,actSize,actSymbol); }; 00397 00398 /** 00399 * Set marker at p width given width. 00400 * @see marker(int,int) 00401 */ 00402 template <class U> 00403 void marker(const hPoint2D<U>& p, const int width) { 00404 marker(p.x/p.h,p.y/p.h,width,actSymbol); }; 00405 00406 /** 00407 * Set given marker type at p. 00408 * @see marker(int,int) 00409 */ 00410 template <class U> 00411 void marker(const hPoint2D<U>& p, const eMarkerType t) { 00412 marker(p.x/p.h,p.y/p.h,actSize,t); }; 00413 00414 /** 00415 * Set marker at p width given style. 00416 * @see marker(int,int,char*) 00417 */ 00418 template <class U> 00419 void marker(const hPoint2D<U>& p, const char* style) { 00420 marker(p.x/p.h,p.y/p.h,actSize,style); }; 00421 00422 /** 00423 * Set given marker type at p with given width. 00424 * @see marker(int,int) 00425 */ 00426 template <class U> 00427 void marker(const hPoint2D<U>& p, const int width, const eMarkerType t) { 00428 marker(p.x/p.h,p.y/p.h,width,t); }; 00429 00430 /** 00431 * Set marker at p with given width and style. 00432 * @see marker(int,int) 00433 */ 00434 template <class U> 00435 void marker(const hPoint2D<U>& p, const int width, const char* style) { 00436 marker(p.x/p.h,p.y/p.h,width,style); }; 00437 00438 00439 /** 00440 * Sets markers at all positions in c,moved by offset. 00441 * @see marker(int,int) 00442 */ 00443 00444 virtual void marker(const pointList& c,const point& offset=point(0,0)) { 00445 marker(c,actSize,actSymbol,offset); }; 00446 00447 /** 00448 * Sets markers at all positions in c,moved by offset, with given width. 00449 * @see marker(int,int) 00450 */ 00451 virtual void marker(const pointList& c, int width, 00452 const point& offset=point(0,0)) { 00453 marker(c,width,actSymbol,offset); }; 00454 00455 /** 00456 * Sets markers at all positions in c,moved by offset, with given style. 00457 * @see marker(int,int) 00458 */ 00459 virtual void marker(const pointList& c, char* style, 00460 const point& offset=point(0,0)) { 00461 marker(c,actSize,style,offset); }; 00462 00463 /** 00464 * Sets given marker types at all positions in c,moved by offset. 00465 * @see marker(int,int) 00466 */ 00467 virtual void marker(const pointList& c, eMarkerType t, 00468 const point& offset=point(0,0)) { 00469 marker(c,actSize,t,offset); }; 00470 00471 /** 00472 * Sets markers at all positions in the c, moved by offset, with given 00473 * width and style. 00474 * @see marker(int,int) 00475 */ 00476 virtual void marker(const pointList& c, int width, char* style, 00477 const point& offset=point(0,0)); 00478 00479 /** 00480 * Sets given marker types at all positions in the c, moved by offset, 00481 * with given width. 00482 * @see marker(int,int) 00483 */ 00484 virtual void marker(const pointList& c, int width, eMarkerType t, 00485 const point& offset=point(0,0)); 00486 00487 /** 00488 * Draws a line from the point (fx,fy) to point (tx,ty). 00489 * The "last point" will be defined with the last "set", "line" or 00490 * "lineTo" method. 00491 */ 00492 virtual void line(const int fx, const int fy, 00493 const int tx, const int ty)=0; 00494 00495 00496 /** 00497 * Draws a line from the point p to point p2. 00498 * @see line(int,int,int,int) 00499 */ 00500 virtual void line(const point& p1,const point& p2) { 00501 line(p1.x,p1.y,p2.x,p2.y); 00502 } 00503 00504 /** 00505 * Draws a line from the last point to point (x,y). 00506 * The "last point" will be defined with the last "set", "point", "line" or 00507 * "lineTo" method. 00508 */ 00509 virtual void lineTo(const int x,const int y)=0; 00510 00511 /** 00512 * Draw a line from the last point to point p. 00513 * @see lineTo(int,int) 00514 */ 00515 virtual void lineTo(const point& p) { 00516 lineTo(p.x,p.y); 00517 } 00518 00519 /** 00520 * Draws a vertical line from (x,y1) to (x,y2). 00521 */ 00522 virtual void verticalLine(const int x, const int y1, const int y2)=0; 00523 00524 /** 00525 * Draws a horizontal line from (x1,y) to (x2,y). 00526 */ 00527 virtual void horizontalLine(const int x1, const int x2, const int y)=0; 00528 00529 /** 00530 * Draws a vertical line from (p1.x,p1.y) to (p1.x,p2.y). 00531 */ 00532 virtual void verticalLine(const point& p1, const point& p2) { 00533 verticalLine(p1.x,p1.y,p2.y); 00534 } 00535 00536 /** 00537 * Draws a horizontal line from (p1.x,p1.y) to (p2.x,p1.y). 00538 */ 00539 virtual void horizontalLine(const point& p1, const point& p2) { 00540 horizontalLine(p1.x,p2.x,p1.y); 00541 } 00542 00543 /** 00544 * Draw a line from the point p with the length "length" and the 00545 * angle "angle". The angles should be a value between -2Pi and 00546 * 2Pi in radian. */ 00547 virtual void polarLine(const point& p,const float& length, 00548 const float& angle); 00549 00550 /** 00551 * Draws a grid in the image. 00552 * The interpretation of delta depends on the value of interval. 00553 * if interval is true, the values are taken as number of pixels 00554 * between two grid lines in x and y direction. Otherwise, it 00555 * is used as number of grid lines. 00556 * This method is actually not implemented in epsDraw !!! 00557 */ 00558 virtual void grid(const point& delta, const bool interval)=0; 00559 00560 /** 00561 * draw a box. 00562 * 00563 * \deprecated use rectangle(int, int, int, int, const bool) instead! 00564 * 00565 * @param x1 left x-coordinate. 00566 * @param y1 upper y-coordinate. 00567 * @param x2 right x-coordinate. 00568 * @param y2 bottom y-coordinate. 00569 * @param filled if true box is filled 00570 */ 00571 virtual void box(const int x1, const int y1, const int x2, const int y2, 00572 const bool& filled=false) { 00573 rectangle(x1,y1,x2,y2,filled); 00574 } 00575 00576 /** 00577 * draws a box. 00578 * 00579 * \deprecated use rectangle(point&, point&, const bool) instead! 00580 * 00581 * @see box(int,int,int,int,const bool) 00582 */ 00583 virtual void box(const point& upperLeft, const point& bottomRight, 00584 const bool& filled=false) { 00585 box(upperLeft.x,upperLeft.y,bottomRight.x,bottomRight.y,filled); 00586 } 00587 00588 /** 00589 * draw a box. 00590 * the rectangle must contain the upper left and the bottom right point 00591 * 00592 * \deprecated use rectangle(rectangle&, const bool) instead! 00593 * 00594 * @see box(int,int,int,int,const bool) 00595 */ 00596 virtual void box(const trectangle<int>& r, const bool& filled=false) { 00597 box(r.ul.x,r.ul.y,r.br.x,r.br.y,filled); 00598 } 00599 00600 /** 00601 * draw a rectangle. 00602 * @param x1 left x-coordinate. 00603 * @param y1 upper y-coordinate. 00604 * @param x2 right x-coordinate. 00605 * @param y2 bottom y-coordinate. 00606 * @param filled if true rectangle is filled 00607 */ 00608 virtual void rectangle(const int x1, const int y1, 00609 const int x2, const int y2, 00610 const bool& filled=false)=0; 00611 00612 /** 00613 * draws a rectangle. 00614 * @param upperLeft upper left corner of the rectangle 00615 * @param bottomRight bottom right corner of the rectangle 00616 * @param filled if true rectangle is filled 00617 */ 00618 virtual void rectangle(const point& upperLeft, const point& bottomRight, 00619 const bool& filled=false) { 00620 rectangle(upperLeft.x,upperLeft.y,bottomRight.x,bottomRight.y,filled); 00621 } 00622 00623 /** 00624 * draw a rectangle. 00625 * the rectangle must contain the upper left and the bottom right point 00626 * @param r rectangle to be drawn 00627 * @param filled if true rectangle is filled 00628 */ 00629 virtual void rectangle(const trectangle<int>& r, 00630 const bool& filled=false) { 00631 rectangle(r.ul.x,r.ul.y,r.br.x,r.br.y,filled); 00632 } 00633 00634 /** 00635 * draw a circle with circle center 'p1' and radius 'r' 00636 * @param p1 center of the circle 00637 * @param r radius of the circle 00638 * @param filled if true circle is filled 00639 */ 00640 virtual void circle(const point& p1,const int r, 00641 const bool& filled=false)=0; 00642 00643 00644 /** 00645 * draw an ellipse with center 'p1' and main axes 'aX' and 'aY' 00646 */ 00647 virtual void ellipse(const point& p1,const int aX, const int aY, 00648 const bool& filled=false)=0; 00649 00650 /** 00651 * Draw an ellipse with center 'p1' and main axes 'aX' and 'aY'. 00652 * The ellipse is turned by the given angle. 00653 * @param p1 center of ellipse 00654 * @param aX radius of ellipse in the first main direction 00655 * @param aY radius of ellipse in the second main direction 00656 * @param angle angle between first main direction and x axis. Must be 00657 * given in radians (rad=deg/180*Pi). 00658 * @param filled if true, the ellipse is filled 00659 */ 00660 virtual void ellipse(const point& p1,const int aX, const int aY, 00661 const float& angle, const bool& filled=false)=0; 00662 00663 /** 00664 * draw an arc from 'pA' to 'pB', clockwise around center 'p1'. 00665 */ 00666 virtual void arc(const point& p1, const point& pA, const point& pB)=0; 00667 00668 00669 /** 00670 * draw an arrow. arrow tip will be at (tx,ty). 00671 * If size<1.0 then tipsize will be the relative portion of arrow length. 00672 * If size>1.0 then tipsize will be (int)size, independent of arrow length. 00673 */ 00674 virtual void arrow(const int fx, const int fy, 00675 const int tx, const int ty, 00676 const float& size=0.2f)=0; 00677 00678 /** 00679 * draw an arrow. arrow tip will be at p2. 00680 * If size<1.0 then tipsize will be the relative portion of arrow length. 00681 * If size>1.0 then tipsize will be (int)size, independent of arrow length. 00682 */ 00683 virtual void arrow(const point& p1,const point& p2,const float& size=0.2f){ 00684 arrow(p1.x,p1.y,p2.x,p2.y,size); 00685 }; 00686 00687 /** 00688 * Draw the given text at the position x,y. 00689 * According to the typ of the subclass the position and the lenght of 00690 * the drawn text could differ 00691 * @param txt the output text 00692 * @param x the x coordinate in the image where the text will be 00693 * written 00694 * @param y the y coordinate in the image where the text will be 00695 * written 00696 */ 00697 virtual void text(const std::string txt,const int x, const int y)=0; 00698 00699 /** 00700 * Draw the given text at the position p=(x,y). 00701 * @see test(std::string,int,int) 00702 */ 00703 virtual void text(const std::string txt,const point& p) { 00704 text(txt,p.x,p.y);}; 00705 00706 /** 00707 * draw an integer <code>num</code> at position 'x'/'y'. 00708 * According to the typ of the subclass the position and the lenght of 00709 * the drawn text could differ 00710 * @param num the number to be written 00711 * @param x the column where the number will be drawn 00712 * @param y the row where the number will be drawn 00713 */ 00714 virtual void number(const int num, const int x, const int y)=0; 00715 00716 /** 00717 * draw an integer <code>num</code> at position p='x'/'y'. 00718 * @see number(int,int,int) 00719 */ 00720 virtual void number(const int num,const point& p) { 00721 number(num,p.x,p.y);}; 00722 00723 00724 protected: 00725 00726 /** 00727 * actual (last used) position X 00728 */ 00729 int actX; 00730 00731 /** 00732 * actual (last used) position Y 00733 */ 00734 int actY; 00735 00736 /** 00737 * the actual symbol that is used for markers 00738 */ 00739 eMarkerType actSymbol; 00740 00741 /** 00742 * the actual size that is used for markers 00743 * for epsDraw the default is 1 and for draw the default is 5 00744 * because the elements are much smaller and with a size smaller than 5 00745 * they are indistinguishable. 00746 */ 00747 int actSize; 00748 00749 /** 00750 * If true symbols are filled where possible. 00751 */ 00752 bool filled; 00753 00754 /** 00755 * The pattern for drawing lines. 00756 */ 00757 linePattern linepat; 00758 00759 /** 00760 * The pattern for filling areas. 00761 */ 00762 fillPattern fillpat; 00763 00764 /** 00765 * Flag telling the drawing methods to use the pattern. 00766 */ 00767 bool useLinePattern; 00768 00769 /** 00770 * Flag telling the drawing methods to use the pattern. 00771 */ 00772 bool useFillPattern; 00773 00774 private: 00775 /** 00776 * Abstract drawing methods for markers. This methods are needed by the 00777 * marker methods 00778 */ 00779 virtual void drawSymbol(const int x,const int y,const int w,const char* style)=0; 00780 /** 00781 * Abstract drawing methods for markers. This methods are needed by the 00782 * marker methods 00783 */ 00784 virtual void drawSymbol(const int x,const int y,const int w,const eMarkerType t)=0; 00785 00786 00787 }; 00788 00789 } 00790 00791 #endif