last update 20 Sep 2009 |
#include <cvrDrawBase.h>
Public Types | |
enum | eMarkerType { Pixel = 0, Circle, Xmark, Plus, Star, Square, Diamond, TriangleUp, TriangleDown, TriangleLeft, TriangleRight, Dot } |
Public Member Functions | |
drawBase () | |
drawBase (const drawBase &other) | |
virtual | ~drawBase () |
drawBase & | copy (const drawBase &other) |
virtual const std::string & | name () const |
virtual void | setGray (const float k)=0 |
virtual void | setMarkerSize (int size) |
virtual void | setColor (const char *color)=0 |
virtual void | setColor (const T &color)=0 |
virtual void | setStyle (const char *style) |
virtual void | setMarkerType (eMarkerType m) |
virtual ipoint | getCanvasSize ()=0 |
virtual void | set (int x, int y)=0 |
virtual void | set (const ipoint &p) |
virtual void | set (const ipointList &c, const ipoint &offset=ipoint(0, 0)) |
virtual void | set (const location &loc, bool showAngleLine=false) |
virtual void | set (const rectLocation &loc, bool showAngleLine=false) |
virtual void | set (const affineLocation &loc, bool approximateEllipse=false, bool showAngleLine=false) |
virtual void | set (const list< location > &locs, bool showAngleLine=false) |
virtual void | set (const list< affineLocation > &locs, bool approximateEllipse=false, bool showAngleLine=false) |
virtual void | marker (int x, int y) |
virtual void | marker (int x, int y, int width) |
virtual void | marker (int x, int y, const char *style) |
virtual void | marker (int x, int y, eMarkerType t) |
virtual void | marker (int x, int y, int w, const char *style) |
virtual void | marker (int x, int y, int w, eMarkerType t) |
virtual void | marker (const ipoint &p) |
virtual void | marker (const ipoint &p, int width) |
virtual void | marker (const ipoint &p, const char *style) |
virtual void | marker (const ipoint &p, eMarkerType t) |
virtual void | marker (const ipoint &p, int width, eMarkerType t) |
virtual void | marker (const ipoint &p, int width, const char *style) |
virtual void | marker (const ipointList &c, const ipoint &offset=ipoint(0, 0)) |
virtual void | marker (const ipointList &c, int width, const ipoint &offset=ipoint(0, 0)) |
virtual void | marker (const ipointList &c, const char *style, const ipoint &offset=ipoint(0, 0)) |
virtual void | marker (const ipointList &c, eMarkerType t, const ipoint &offset=ipoint(0, 0)) |
virtual void | marker (const ipointList &c, int width, const char *style, const ipoint &offset=ipoint(0, 0)) |
virtual void | marker (const ipointList &c, int width, eMarkerType t, const ipoint &offset=ipoint(0, 0)) |
virtual void | line (int fx, int fy, int tx, int ty)=0 |
virtual void | line (const ipoint &p1, const ipoint &p2) |
virtual void | lineTo (int x, int y)=0 |
virtual void | lineTo (const ipoint &p) |
virtual void | moveTo (int x, int y)=0 |
virtual void | moveTo (const ipoint &p) |
virtual void | verticalLine (int x, int y1, int y2)=0 |
virtual void | horizontalLine (int x1, int x2, int y)=0 |
virtual void | verticalLine (const ipoint &p1, const ipoint &p2) |
virtual void | horizontalLine (const ipoint &p1, const ipoint &p2) |
virtual void | polarLine (const ipoint &p, const float &length, const float &angle) |
virtual void | grid (const ipoint &delta, bool interval)=0 |
virtual void | rectangle (int x1, int y1, int x2, int y2, bool filled=false)=0 |
virtual void | rectangle (const ipoint &upperLeft, const ipoint &bottomRight, bool filled=false) |
virtual void | rectangle (const cvr::rectangle< int > &r, bool filled=false) |
virtual void | polygon (const ipolygonPoints &poly, bool filled=false, const float angle=0.0f, const ipoint &shift=ipoint(0, 0))=0 |
virtual void | circle (const ipoint &p1, int r, bool filled=false)=0 |
virtual void | ellipse (const ipoint &p1, int aX, int aY, bool filled=false)=0 |
virtual void | ellipse (const ipoint &p1, int aX, int aY, const float &angle, bool filled=false)=0 |
virtual void | arc (const ipoint &p1, const ipoint &pA, const ipoint &pB)=0 |
virtual void | arrow (int fx, int fy, int tx, int ty, const float &size=0.2f)=0 |
virtual void | arrow (const ipoint &p1, const ipoint &p2, const float &size=0.2f) |
virtual void | text (const std::string txt, int x, int y)=0 |
virtual void | text (const std::string txt, const ipoint &p) |
virtual void | number (int num, int x, int y)=0 |
virtual void | number (int num, const ipoint &p) |
Protected Attributes | |
int | actX_ |
int | actY_ |
eMarkerType | actSymbol_ |
int | actSize_ |
bool | filled_ |
bool | useLinePattern_ |
bool | useFillPattern_ |
This class provides all methods that are implemented in cvrDraw and cvrEpsDraw. It makes a base class availabel with all generall drawing methods. Some special methods, are not implemented in this base class. The class is aiming at providing a base class, so that, according to the given parameter, a picture is drawn or an eps file written.
enum cvr::drawBase::eMarkerType |
Specifies different types of marker which can be defined for the marker-method.
cvr::drawBase< T >::drawBase | ( | ) |
default constructor
cvr::drawBase< T >::drawBase | ( | const drawBase< T > & | other | ) |
virtual cvr::drawBase< T >::~drawBase | ( | ) | [virtual] |
destructor
virtual void cvr::drawBase< T >::arc | ( | const ipoint & | p1, | |
const ipoint & | pA, | |||
const ipoint & | pB | |||
) | [pure virtual] |
virtual void cvr::drawBase< T >::arrow | ( | const ipoint & | p1, | |
const ipoint & | p2, | |||
const float & | size = 0.2f | |||
) | [inline, virtual] |
Draw an arrow.
arrow tip will be at p2. If size<1.0 then tipsize will be the relative portion of arrow length. If size>1.0 then tipsize will be (int)size, independent of arrow length.
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::arrow | ( | int | fx, | |
int | fy, | |||
int | tx, | |||
int | ty, | |||
const float & | size = 0.2f | |||
) | [pure virtual] |
Draw an arrow.
arrow tip will be at (tx, ty). If size<1.0 then tipsize will be the relative portion of arrow length. If size>1.0 then tipsize will be (int)size, independent of arrow length.
fx | x coordinate of the initial point. | |
fy | y coordinate of the initial point. | |
tx | x coordinate of the final point. | |
ty | y coordinate of the final point. | |
size | size of the arrow |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::circle | ( | const ipoint & | p1, | |
int | r, | |||
bool | filled = false | |||
) | [pure virtual] |
Draw a circle with circle center 'p1' and radius 'r'.
p1 | center of the circle | |
r | radius of the circle | |
filled | if true circle is filled |
Implemented in cvr::draw< T >.
drawBase& cvr::drawBase< T >::copy | ( | const drawBase< T > & | other | ) |
virtual void cvr::drawBase< T >::ellipse | ( | const ipoint & | p1, | |
int | aX, | |||
int | aY, | |||
const float & | angle, | |||
bool | filled = false | |||
) | [pure virtual] |
Draw an ellipse with center 'p1' and main axes 'aX' and 'aY'.
The ellipse is turned by the given angle.
p1 | center of ellipse | |
aX | radius of ellipse in the first main direction | |
aY | radius of ellipse in the second main direction | |
angle | angle between first main direction and x axis. Must be given in radians (rad=deg/180*Pi). | |
filled | if true, the ellipse is filled |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::ellipse | ( | const ipoint & | p1, | |
int | aX, | |||
int | aY, | |||
bool | filled = false | |||
) | [pure virtual] |
virtual ipoint cvr::drawBase< T >::getCanvasSize | ( | ) | [pure virtual] |
virtual void cvr::drawBase< T >::grid | ( | const ipoint & | delta, | |
bool | interval | |||
) | [pure virtual] |
Draws a grid in the image.
The interpretation of delta depends on the value of interval.
If interval is true, the values are taken as number of pixels between two grid lines in x and y direction. Otherwise, it is used as number of grid lines.
delta | Number of pixels between lines or number of lines in the image. | |
interval | if true then delta means distance between lines, otherwise it means number of lines. |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::horizontalLine | ( | const ipoint & | p1, | |
const ipoint & | p2 | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::horizontalLine | ( | int | x1, | |
int | x2, | |||
int | y | |||
) | [pure virtual] |
Draws a horizontal line from (x1, y) to (x2, y).
x1 | x component of the initial point. | |
x2 | x component of the final point. | |
y | y component of the line. |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::line | ( | const ipoint & | p1, | |
const ipoint & | p2 | |||
) | [inline, virtual] |
Draws a line from the point p to point p2.
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::line | ( | int | fx, | |
int | fy, | |||
int | tx, | |||
int | ty | |||
) | [pure virtual] |
Draws a line from the point (fx, fy) to point (tx, ty).
The "last point" will be defined with the last "set", "line" or "lineTo" method.
fx | x component of the initial point. | |
fy | y component of the initial point. | |
tx | x component of the initial point. | |
ty | y component of the initial point. |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::lineTo | ( | const ipoint & | p | ) | [inline, virtual] |
Draw a line from the last point to point p.
p | initial point. |
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::lineTo | ( | int | x, | |
int | y | |||
) | [pure virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipointList & | c, | |
int | width, | |||
eMarkerType | t, | |||
const ipoint & | offset = ipoint(0, 0) | |||
) | [virtual] |
Sets given marker types at all positions in the c, moved by offset, with given width.
c | list of points to put markers on. | |
width | width of the marker | |
t | marker type | |
offset | offset to be added to all points in the previous list. |
virtual void cvr::drawBase< T >::marker | ( | const ipointList & | c, | |
int | width, | |||
const char * | style, | |||
const ipoint & | offset = ipoint(0, 0) | |||
) | [virtual] |
Sets markers at all positions in the c, moved by offset, with given width and style.
c | list of points to put markers on. | |
width | width of the marker | |
style | string denoting the marker type. | |
offset | offset to be added to all points in the previous list. |
virtual void cvr::drawBase< T >::marker | ( | const ipointList & | c, | |
eMarkerType | t, | |||
const ipoint & | offset = ipoint(0, 0) | |||
) | [inline, virtual] |
Sets given marker types at all positions in c, moved by offset.
c | list of points to put markers on. | |
t | type of the markers. | |
offset | offset to be added to all points in the previous list. |
virtual void cvr::drawBase< T >::marker | ( | const ipointList & | c, | |
const char * | style, | |||
const ipoint & | offset = ipoint(0, 0) | |||
) | [inline, virtual] |
Sets markers at all positions in c, moved by offset, with given style.
c | list of points to put markers on. | |
style | string with format for the markers. | |
offset | offset to be added to all points in the previous list. |
virtual void cvr::drawBase< T >::marker | ( | const ipointList & | c, | |
int | width, | |||
const ipoint & | offset = ipoint(0, 0) | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipointList & | c, | |
const ipoint & | offset = ipoint(0, 0) | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipoint & | p, | |
int | width, | |||
const char * | style | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipoint & | p, | |
int | width, | |||
eMarkerType | t | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipoint & | p, | |
eMarkerType | t | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipoint & | p, | |
const char * | style | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipoint & | p, | |
int | width | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | const ipoint & | p | ) | [inline, virtual] |
virtual void cvr::drawBase< T >::marker | ( | int | x, | |
int | y, | |||
int | w, | |||
eMarkerType | t | |||
) | [inline, virtual] |
Set marker at point (x, y).
If there is no style, markerType or width is given, the value set by the setStyle or setWidth is used.
x | the x coordinate | |
y | the y coordinate | |
w | the size of the marker symbol | |
t | the type of the marker |
virtual void cvr::drawBase< T >::marker | ( | int | x, | |
int | y, | |||
int | w, | |||
const char * | style | |||
) | [inline, virtual] |
Set marker at point (x, y).
If there is no style, markerType or width is given, the value set by the setStyle or setWidth is used.
x | the x coordinate | |
y | the y coordinate | |
w | the size of the marker symbol | |
style | the style of the marker symbol. |
virtual void cvr::drawBase< T >::marker | ( | int | x, | |
int | y, | |||
eMarkerType | t | |||
) | [inline, virtual] |
Set marker at point (x, y).
If there is no style, markerType or width is given, the value set by the setStyle or setWidth is used.
x | the x coordinate | |
y | the y coordinate | |
t | the type of the marker |
virtual void cvr::drawBase< T >::marker | ( | int | x, | |
int | y, | |||
const char * | style | |||
) | [inline, virtual] |
Set marker at point (x, y).
If there is no style, markerType or width is given, the value set by the setStyle or setWidth is used.
x | the x coordinate | |
y | the y coordinate | |
style | the style of the marker symbol. |
virtual void cvr::drawBase< T >::marker | ( | int | x, | |
int | y, | |||
int | width | |||
) | [inline, virtual] |
Set marker at point (x, y).
If there is no style, markerType or width is given, the value set by the setStyle or setWidth is used.
x | the x coordinate | |
y | the y coordinate | |
width | the size of the marker symbol |
virtual void cvr::drawBase< T >::marker | ( | int | x, | |
int | y | |||
) | [inline, virtual] |
Set marker at point (x, y).
If there is no style, markerType or width is given, the value set by the setStyle or setWidth is used.
x | the x coordinate | |
y | the y coordinate |
virtual void cvr::drawBase< T >::moveTo | ( | const ipoint & | p | ) | [inline, virtual] |
virtual void cvr::drawBase< T >::moveTo | ( | int | x, | |
int | y | |||
) | [pure virtual] |
Doesn't draw anything, only sets the last position to the given coordinates.
This can be useful before using lineTo()
Implemented in cvr::draw< T >.
virtual const std::string& cvr::drawBase< T >::name | ( | ) | const [virtual] |
virtual void cvr::drawBase< T >::number | ( | int | num, | |
const ipoint & | p | |||
) | [inline, virtual] |
Draw an integer num
at position p='x'/'y'.
num | the number to be written | |
p | the coordinates where the number will be drawn |
virtual void cvr::drawBase< T >::number | ( | int | num, | |
int | x, | |||
int | y | |||
) | [pure virtual] |
Draw an integer num
at position 'x'/'y'.
According to the typ of the subclass the position and the lenght of the drawn text could differ
num | the number to be written | |
x | the column where the number will be drawn | |
y | the row where the number will be drawn |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::polarLine | ( | const ipoint & | p, | |
const float & | length, | |||
const float & | angle | |||
) | [virtual] |
virtual void cvr::drawBase< T >::polygon | ( | const ipolygonPoints & | poly, | |
bool | filled = false , |
|||
const float | angle = 0.0f , |
|||
const ipoint & | shift = ipoint(0, 0) | |||
) | [pure virtual] |
Draw a polygon represented by the given polygonPoints list optionally, it can be rotated by the given angle and shifted.
poly | the polygon vertices | |
filled | true if the polygon must be filled, false otherwise | |
angle | rotation angle on the mean point of the vertices | |
shift | shift amount to the polygon points. |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::rectangle | ( | const cvr::rectangle< int > & | r, | |
bool | filled = false | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::rectangle | ( | const ipoint & | upperLeft, | |
const ipoint & | bottomRight, | |||
bool | filled = false | |||
) | [inline, virtual] |
Draws a rectangle.
upperLeft | upper left corner of the rectangle | |
bottomRight | bottom right corner of the rectangle | |
filled | if true rectangle is filled |
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::rectangle | ( | int | x1, | |
int | y1, | |||
int | x2, | |||
int | y2, | |||
bool | filled = false | |||
) | [pure virtual] |
Draw a rectangle.
x1 | left x-coordinate. | |
y1 | upper y-coordinate. | |
x2 | right x-coordinate. | |
y2 | bottom y-coordinate. | |
filled | if true rectangle is filled |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::set | ( | const list< affineLocation > & | locs, | |
bool | approximateEllipse = false , |
|||
bool | showAngleLine = false | |||
) | [virtual] |
Draws a list of affineLocation.
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::set | ( | const list< location > & | locs, | |
bool | showAngleLine = false | |||
) | [virtual] |
virtual void cvr::drawBase< T >::set | ( | const affineLocation & | loc, | |
bool | approximateEllipse = false , |
|||
bool | showAngleLine = false | |||
) | [virtual] |
draw an affineLocation.
Depending on approximateEllipse
an ellipse is approximated from the transMatrix of loc
or the transformed square is drawn.
loc | affineLocation | |
approximateEllipse | if true, an ellipse is drawn, otherwise the transformed square | |
showAngleLine | if true, a line from the middle point of the location (given by loc.position) with the angle given by loc.angle will be drawn. |
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::set | ( | const rectLocation & | loc, | |
bool | showAngleLine = false | |||
) | [virtual] |
loc | location with position, angle and radius | |
showAngleLine | if true, a line from the middle point of the location (given by loc.position) with the angle given by loc.angle will be drawn. |
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::set | ( | const location & | loc, | |
bool | showAngleLine = false | |||
) | [virtual] |
virtual void cvr::drawBase< T >::set | ( | const ipointList & | c, | |
const ipoint & | offset = ipoint(0, 0) | |||
) | [virtual] |
sets a single pixel at p
sets pixels at all points in c, moved by the given offset
Reimplemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::set | ( | const ipoint & | p | ) | [inline, virtual] |
virtual void cvr::drawBase< T >::set | ( | int | x, | |
int | y | |||
) | [pure virtual] |
sets a single pixel at point (x, y) In epsDraw this pixel is a small square.
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::setColor | ( | const T & | color | ) | [pure virtual] |
virtual void cvr::drawBase< T >::setColor | ( | const char * | color | ) | [pure virtual] |
virtual void cvr::drawBase< T >::setGray | ( | const float | k | ) | [pure virtual] |
Specifies grayscale level to be used (range from 0 to 1) for the next graphics objects.
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::setMarkerSize | ( | int | size | ) | [virtual] |
Specifies the size for the next markers.
Default is 5 in draw and 2 in epsDraw
virtual void cvr::drawBase< T >::setMarkerType | ( | eMarkerType | m | ) | [virtual] |
Specifies the marker type to be used for points.
virtual void cvr::drawBase< T >::setStyle | ( | const char * | style | ) | [virtual] |
Sets the style used for drawing points.
This includes the color and the symbols for the point
Colors | Symbols | |||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
In addition all colors except for black can be darkened by a number between 0 and 9 following the color letter. The default is 0. The higher the number, the darker the color. Also the closed symbols are available in a filled version. This is activated by an 'f' following the symbol specifier.
Colors only work properly if the canvas used is of type image, ie using rgbPixel as template type. Otherwise, gray-levels are used instead of the colors. Here, 'c', 'm', and 'y' result in the same gray-level as do 'r', 'g' and 'b'. For better predictability use white with different factors for getting gray-levels.
A change of the color using setColor(const char*) or setColor(const T&) does not affect the type of symbol being used.
virtual void cvr::drawBase< T >::text | ( | const std::string | txt, | |
const ipoint & | p | |||
) | [inline, virtual] |
Draw the given text at the position p=(x, y).
txt | the output text | |
p | coordinate in the image where the text will be written. |
virtual void cvr::drawBase< T >::text | ( | const std::string | txt, | |
int | x, | |||
int | y | |||
) | [pure virtual] |
Draw the given text at the position x, y.
According to the typ of the subclass the position and the lenght of the drawn text could differ
txt | the output text | |
x | the x coordinate in the image where the text will be written | |
y | the y coordinate in the image where the text will be written |
Implemented in cvr::draw< T >.
virtual void cvr::drawBase< T >::verticalLine | ( | const ipoint & | p1, | |
const ipoint & | p2 | |||
) | [inline, virtual] |
virtual void cvr::drawBase< T >::verticalLine | ( | int | x, | |
int | y1, | |||
int | y2 | |||
) | [pure virtual] |
Draws a vertical line from (x, y1) to (x, y2).
x | x component of the line | |
y1 | y component of the initial point. | |
y2 | y component of the final point. |
Implemented in cvr::draw< T >.
int cvr::drawBase< T >::actSize_ [protected] |
the actual size that is used for markers for epsDraw the default is 1 and for draw the default is 5 because the elements are much smaller and with a size smaller than 5 they are indistinguishable.
eMarkerType cvr::drawBase< T >::actSymbol_ [protected] |
the actual symbol that is used for markers
int cvr::drawBase< T >::actX_ [protected] |
actual (last used) position X
int cvr::drawBase< T >::actY_ [protected] |
actual (last used) position Y
bool cvr::drawBase< T >::filled_ [protected] |
If true symbols are filled where possible.
bool cvr::drawBase< T >::useFillPattern_ [protected] |
Flag telling the drawing methods to use the pattern.
bool cvr::drawBase< T >::useLinePattern_ [protected] |
The pattern for drawing lines.
The pattern for filling areas. Flag telling the drawing methods to use the pattern.