te::map::Canvas Class Referenceabstract

A canvas is an abstraction of a drawing area. More...

#include <Canvas.h>

Inheritance diagram for te::map::Canvas:
te::ag::Canvas te::qt::widgets::Canvas

Public Member Functions

Initializer Methods

Methods related to instantiation and destruction.

 Canvas ()
 Constructor. More...
 
virtual ~Canvas ()
 Virtual destructor. More...
 
Accessor Methods

Methods used to access internal attributes.

virtual void setWindow (const double &llx, const double &lly, const double &urx, const double &ury)=0
 It sets the world (or window) coordinates area (supposing a cartesian reference system). More...
 
virtual void calcAspectRatio (double &llx, double &lly, double &urx, double &ury, const AlignType hAlign=Center, const AlignType vAlign=Center)=0
 It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system). More...
 
virtual void calcAspectRatio (te::gm::Envelope *envelope, const AlignType hAlign=Center, const AlignType vAlign=Center)=0
 It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system). More...
 
virtual void setBackgroundColor (const te::color::RGBAColor &color)=0
 It sets the canvas background color. More...
 
virtual te::color::RGBAColor getBackgroundColor () const =0
 It returns the canvas background color. More...
 
virtual void clear ()=0
 It clears the canvas content and fills with the background color. More...
 
virtual void resize (int w, int h)=0
 It adjusts the canvas size (width and height). More...
 
virtual int getWidth () const =0
 It returns the canvas width. More...
 
virtual int getHeight () const =0
 It returns the canvas height. More...
 
Geographical Objects Drawing Methods (TerraLib Geometry)

Methods used to draw geographical objects encoded as a TerraLib Geometry.

Note that the visual (style and symbol) used to draw geometries is affected by the visual methods.

virtual void draw (const te::gm::Geometry *geom)=0
 It draws the geometry on canvas. More...
 
virtual void draw (const te::gm::Point *point)=0
 It draws the point on canvas. More...
 
virtual void draw (const te::gm::MultiPoint *mpoint)=0
 It draws the MultiPoint on canvas. More...
 
virtual void draw (const te::gm::LineString *line)=0
 It draws the LineString on canvas. More...
 
virtual void draw (const te::gm::MultiLineString *mline)=0
 It draws the MultiLineString on canvas. More...
 
virtual void draw (const te::gm::Polygon *poly)=0
 It draws the polygon on canvas. More...
 
virtual void draw (const te::gm::MultiPolygon *mpoly)=0
 It draws the MultiPolygon on canvas. More...
 
virtual void draw (const te::gm::GeometryCollection *g)=0
 It draws the GeometryCollection on canvas. More...
 
virtual void draw (const te::gm::MultiSurface *g)=0
 It draws the MultiSurface on canvas. More...
 
Image Handling

Methods used to draw an image on Canvas.

virtual void save (const char *fileName, ImageType t, int quality=75, int fg=0) const =0
 It saves the canvas content to a file image in the specified format type. More...
 
virtual char * getImage (ImageType t, std::size_t &size, int quality=75, int fg=0) const =0
 It returns the internal content as an image in a specific format (PNG, JPEG, ...). More...
 
virtual te::color::RGBAColor ** getImage (const int x=0, const int y=0, const int w=0, const int h=0) const =0
 It gets a RGBA color array from internal canvas buffer. More...
 
virtual void freeImage (char *img) const =0
 This is the method that you should use to release an image generated by the canvas. More...
 
virtual void drawImage (char *src, std::size_t size, ImageType t)=0
 It draws the src image over the canvas. More...
 
virtual void drawImage (te::color::RGBAColor **src, int w, int h)=0
 It draws the src image over the canvas. More...
 
virtual void drawImage (int x, int y, char *src, std::size_t size, ImageType t)=0
 It draws the src image over the canvas at the specified position (x, y). More...
 
virtual void drawImage (int x, int y, te::color::RGBAColor **src, int w, int h)=0
 It draws the src image over the canvas at the specified position (x, y). More...
 
virtual void drawImage (int x, int y, int w, int h, char *src, std::size_t size, ImageType t)=0
 It draws the source image into the rectangle at position (x, y) with the given width and height. More...
 
virtual void drawImage (int x, int y, int w, int h, te::color::RGBAColor **src, int srcw, int srch)=0
 It draws the source image into the rectangle at position (x, y) with the given width and height. More...
 
virtual void drawImage (int x, int y, int w, int h, char *src, std::size_t size, ImageType t, int sx, int sy, int sw, int sh)=0
 It draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the source image, at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy. More...
 
virtual void drawImage (int x, int y, int w, int h, te::color::RGBAColor **src, int sx, int sy, int sw, int sh)=0
 It draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the source image, at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy. More...
 
virtual void drawImage (int x, int y, te::rst::Raster *src, int opacity=TE_OPAQUE)=0
 It draws a raster over the canvas at the specified position (x, y). The raster must be with three 8-bit bands (1R, 2G, 3B),. More...
 
virtual void drawImage (int x, int y, int w, int h, te::rst::Raster *src, int sx, int sy, int sw, int sh, int opacity=TE_OPAQUE)=0
 It draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the source raster, starting at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy. More...
 
Pixel Handling

Methods used to draw a pixel on Canvas.

virtual void drawPixel (int x, int y)=0
 It sets a pixel using the point pen. More...
 
virtual void drawPixel (int x, int y, const te::color::RGBAColor &color)=0
 It sets a pixel to a particular color. More...
 
Text Handling

Methods used to draw a text on Canvas.

virtual void drawText (int x, int y, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
 It draws a text. More...
 
virtual void drawText (const te::gm::Point *p, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
 It draws a text. More...
 
virtual void drawText (const double &x, const double &y, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
 It draws a text. More...
 
virtual void draw (const te::at::Text *txt)=0
 It draws an annotaion text. More...
 
virtual te::gm::PolygongetTextBoundary (int x, int y, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
 It returns the text boundary (its enclose rectangle). More...
 
virtual te::gm::PolygongetTextBoundary (const te::gm::Point *p, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
 It returns the text boundary (its enclose rectangle). More...
 
virtual te::gm::PolygongetTextBoundary (const double &x, const double &y, const std::string &txt, float angle=0.0, te::at::HorizontalAlignment hAlign=te::at::Start, te::at::VerticalAlignment vAlign=te::at::Baseline)=0
 It returns the text boundary (its enclose rectangle). More...
 
Visual and Style Configuration

Note that the visual (style and symbol) used to draw geometries is affected by the visual methods.

virtual void setTextColor (const te::color::RGBAColor &color)=0
 It sets the text drawing color. More...
 
virtual void setTextOpacity (int opacity)=0
 It sets the text opacity. More...
 
virtual void setFontFamily (const std::string &family)=0
 It sets the text font family. More...
 
virtual void setTextPointSize (double size)=0
 It sets the text point Size. More...
 
virtual void setTextStyle (te::at::FontStyle style)=0
 It sets the text style. More...
 
virtual void setTextWeight (te::at::FontWeight weight)=0
 It sets the text weight. More...
 
virtual void setTextStretch (std::size_t stretch)=0
 It sets the text stretch. More...
 
virtual void setTextUnderline (bool b)=0
 It sets the text underline flag. More...
 
virtual void setTextOverline (bool b)=0
 It sets the text overline flag. More...
 
virtual void setTextStrikeOut (bool b)=0
 It sets the text strike out flag. More...
 
virtual void setTextDecorationColor (const te::color::RGBAColor &color)=0
 It sets the text color for drawing text decoration. More...
 
virtual void setTextDecorationWidth (int width)=0
 It sets the width for drawing text decoration. More...
 
virtual void setTextContourColor (const te::color::RGBAColor &color)=0
 It sets the text contour (outline) drawing color. More...
 
virtual void setTextContourEnabled (bool b)=0
 It controls the display of the text outline. More...
 
virtual void setTextContourOpacity (int opacity)=0
 It sets the text contour opacity. More...
 
virtual void setTextContourWidth (int width)=0
 It sets the text contour width. More...
 
virtual void setTextJustification (te::at::LineJustification just)=0
 It sets the text justification for multi line text. More...
 
virtual void setTextMultiLineSpacing (int spacing)=0
 It sets the multi line text spacing. More...
 
virtual void setPointColor (const te::color::RGBAColor &color)=0
 It sets the point drawing color. More...
 
virtual void setPointWidth (int w)=0
 It sets the point width. If point has a patterns, this pattern is scaled to width. More...
 
virtual void setPointPattern (te::color::RGBAColor **pattern, int ncols, int nrows)=0
 It sets the point pattern. More...
 
virtual void setPointPattern (char *pattern, std::size_t size, ImageType t)=0
 It sets the point pattern using a buffered image. More...
 
virtual void setPointPatternRotation (const double &angle)=0
 It sets the point pattern rotation. Rotation is made ​​from the center of the pattern. More...
 
virtual void setPointPatternOpacity (int opacity)=0
 It sets the point pattern opacity. More...
 
virtual void setLineColor (const te::color::RGBAColor &color)=0
 It sets the pen color used to draw line geometries. More...
 
virtual void setLinePattern (te::color::RGBAColor **pattern, int ncols, int nrows)=0
 It sets the line pattern. More...
 
virtual void setLinePattern (char *pattern, std::size_t size, ImageType t)=0
 It sets the line pattern using a buffered image. More...
 
virtual void setLinePatternRotation (const double &angle)=0
 It sets the line pattern rotation. Rotation is made ​​from the center of the pattern. More...
 
virtual void setLinePatternOpacity (int opacity)=0
 It sets the line pattern opacity. More...
 
virtual void setLineWidth (int w)=0
 It sets the line width. More...
 
virtual void setLineDashStyle (LineDashStyle style)=0
 It sets the line dash style. More...
 
virtual void setLineDashStyle (const std::vector< double > &style)=0
 It sets the line dash style to the given pattern. More...
 
virtual void setLineCapStyle (LineCapStyle style)=0
 It sets the line cap style. More...
 
virtual void setLineJoinStyle (LineJoinStyle style)=0
 It sets the line join style. More...
 
virtual void setPolygonFillColor (const te::color::RGBAColor &color)=0
 It sets the color used to fill the draw of polygon geometries. More...
 
virtual void setPolygonContourColor (const te::color::RGBAColor &color)=0
 It sets the pen color used to draw the boundary of polygon geometries. More...
 
virtual void setPolygonFillPattern (te::color::RGBAColor **pattern, int ncols, int nrows)=0
 It sets the polygon fill pattern. More...
 
virtual void setPolygonFillPattern (char *pattern, std::size_t size, ImageType t)=0
 It sets the polygon fill pattern using a buffered image. More...
 
virtual void setPolygonPatternWidth (int w)=0
 It sets the polygon pattern width. More...
 
virtual void setPolygonPatternRotation (const double &angle)=0
 It sets the polygon pattern rotation. More...
 
virtual void setPolygonPatternOpacity (int opacity)=0
 It sets the polygon pattern opacity. More...
 
virtual void setPolygonContourPattern (te::color::RGBAColor **pattern, int ncols, int nrows)=0
 It sets the pen pattern used to draw the boundary of polygon geometries. More...
 
virtual void setPolygonContourPattern (char *pattern, std::size_t size, ImageType t)=0
 It sets the pen pattern used to draw the boundary of polygon geometries using a buffered image. More...
 
virtual void setPolygonContourWidth (int w)=0
 It sets the polygon contour width. More...
 
virtual void setPolygonContourPatternRotation (const double &angle)=0
 It sets the polygon contour pattern rotation. More...
 
virtual void setPolygonContourPatternOpacity (int opacity)=0
 It sets the polygon contour pattern opacity. More...
 
virtual void setPolygonContourDashStyle (LineDashStyle style)=0
 It sets the polygon contour dash style. More...
 
virtual void setPolygonContourDashStyle (const std::vector< double > &style)=0
 It sets the polygon contour dash style to the given pattern. More...
 
virtual void setPolygonContourCapStyle (LineCapStyle style)=0
 It sets the polygon contour cap style. More...
 
virtual void setPolygonContourJoinStyle (LineJoinStyle style)=0
 It sets the polygon contour join style. More...
 
virtual void setEraseMode ()=0
 It sets the painter to erase mode. More...
 
virtual void setNormalMode ()=0
 It sets the painter to normal copy source to destination mode. More...
 

Detailed Description

A canvas is an abstraction of a drawing area.

What is a Canvas?

It is an abstraction of a drawing area. You can use it to:

  • draw geographical objects from a layer, with a given visual (or style);
  • draw texts;
  • draw the map legend;
  • create a chart.

The Canvas can be viewed as one of the rendering surface used by an application to show a map.

See also
te::qt::widgets::Canvas, te::agg::Canvas, te::gd::Canvas

Definition at line 92 of file Canvas.h.

Constructor & Destructor Documentation

te::map::Canvas::Canvas ( )
inline

Constructor.

Definition at line 102 of file Canvas.h.

virtual te::map::Canvas::~Canvas ( )
inlinevirtual

Virtual destructor.

Reimplemented in te::ag::Canvas, and te::qt::widgets::Canvas.

Definition at line 105 of file Canvas.h.

Member Function Documentation

virtual void te::map::Canvas::calcAspectRatio ( double &  llx,
double &  lly,
double &  urx,
double &  ury,
const AlignType  hAlign = Center,
const AlignType  vAlign = Center 
)
pure virtual

It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system).

Parameters
llxLower left x-coordinate of the World.
llyLower left y-coordinate of the World.
urxUpper right x-coordinate of the World.
uryUpper right y-coordinate of the World.
hAlignHorizontal Alignment. It can be left, center or right.
vAlignVertical Alignment. It can be top, center or bottom.
Note
The input coordinates will be adjusted according to the alignment parameters provided.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::calcAspectRatio ( te::gm::Envelope envelope,
const AlignType  hAlign = Center,
const AlignType  vAlign = Center 
)
pure virtual

It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system).

Parameters
envelopeA rectangle with world coordinates that will be adjusted.
hAlignHorizontal Alignment. It can be left, center or right.
vAlignVertical Alignment. It can be top, center or bottom.
Note
The input coordinates will be adjusted according to the alignment parameters provided.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::clear ( )
pure virtual

It clears the canvas content and fills with the background color.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::Geometry geom)
pure virtual

It draws the geometry on canvas.

Parameters
geomAny geometry (point, line, polygon, ...).

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::Point point)
pure virtual

It draws the point on canvas.

Parameters
pointThe point.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::MultiPoint mpoint)
pure virtual

It draws the MultiPoint on canvas.

Parameters
mpointThe MultiPoint.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::LineString line)
pure virtual

It draws the LineString on canvas.

Parameters
lineThe LineString.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::MultiLineString mline)
pure virtual

It draws the MultiLineString on canvas.

Parameters
mlineThe MultiLineString.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::Polygon poly)
pure virtual

It draws the polygon on canvas.

Parameters
polyThe polygon.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::MultiPolygon mpoly)
pure virtual

It draws the MultiPolygon on canvas.

Parameters
mpolyThe MultiPolygon.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::GeometryCollection g)
pure virtual

It draws the GeometryCollection on canvas.

Parameters
gThe GeometryCollection.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::gm::MultiSurface g)
pure virtual

It draws the MultiSurface on canvas.

Parameters
gThe MultiSurface.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::draw ( const te::at::Text txt)
pure virtual

It draws an annotaion text.

Parameters
txtThe annotation text to be drawn.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( char *  src,
std::size_t  size,
ImageType  t 
)
pure virtual

It draws the src image over the canvas.

Parameters
srcA source image of any type (PNG, JPEG, GIF, ...).
sizeThe image size in bytes.
tThe image format type (see ImageType enum).

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( te::color::RGBAColor **  src,
int  w,
int  h 
)
pure virtual

It draws the src image over the canvas.

Parameters
srcThe source image.
wThe image width (number of columns).
hThe image height (number of rows).

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
char *  src,
std::size_t  size,
ImageType  t 
)
pure virtual

It draws the src image over the canvas at the specified position (x, y).

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
srcA source image of any type (PNG, JPEG, GIF, ...).
sizeThe image size in bytes.
tThe image format type (see ImageType enum).

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
te::color::RGBAColor **  src,
int  w,
int  h 
)
pure virtual

It draws the src image over the canvas at the specified position (x, y).

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
srcThe source image.
wThe image width (number of columns).
hThe image height (number of rows).

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
int  w,
int  h,
char *  src,
std::size_t  size,
ImageType  t 
)
pure virtual

It draws the source image into the rectangle at position (x, y) with the given width and height.

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
wThe rectangle width.
hThe rectangle height.
srcA source image of any type (PNG, JPEG, GIF, ...).
sizeThe image size in bytes.
tThe image format type (see ImageType enum).

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
int  w,
int  h,
te::color::RGBAColor **  src,
int  srcw,
int  srch 
)
pure virtual

It draws the source image into the rectangle at position (x, y) with the given width and height.

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
wThe rectangle width.
hThe rectangle height.
srcThe source image.
srcwThe source image width (number of columns).
srchThe source image height (number of rows).

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
int  w,
int  h,
char *  src,
std::size_t  size,
ImageType  t,
int  sx,
int  sy,
int  sw,
int  sh 
)
pure virtual

It draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the source image, at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy.

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
wThe rectangle width.
hThe rectangle height.
srcA source image of any type (PNG, JPEG, GIF, ...).
sizeThe image size in bytes.
tThe image format type (see ImageType enum).
sxThe source image position.
syThe source image position.
swThe source image rectangle width.
shThe source image rectangle height.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
int  w,
int  h,
te::color::RGBAColor **  src,
int  sx,
int  sy,
int  sw,
int  sh 
)
pure virtual

It draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the source image, at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy.

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
wThe rectangle width.
hThe rectangle height.
srcThe source image.
sxThe source image start position.
syThe source image start position.
swThe source image rectangle width.
shThe source image rectangle height.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
te::rst::Raster src,
int  opacity = TE_OPAQUE 
)
pure virtual

It draws a raster over the canvas at the specified position (x, y). The raster must be with three 8-bit bands (1R, 2G, 3B),.

Parameters
xThe canvas start position in x where the raster image will be drawn.
yThe canvas start position in y where the raster image will be drawn.
srcThe source raster.
opacityThe opacity value used to draw the image

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawImage ( int  x,
int  y,
int  w,
int  h,
te::rst::Raster src,
int  sx,
int  sy,
int  sw,
int  sh,
int  opacity = TE_OPAQUE 
)
pure virtual

It draws the rectangular portion with the origin (sx, sy), width sw and height sh, of the source raster, starting at the point (x, y), with a width of w and a height of h. If sw or sh are equal to zero the width/height of the pixmap is used and adjusted by the offset sx/sy.

Parameters
xThe canvas start position where the src image will be drawn.
yThe canvas start position where the src image will be drawn.
wThe rectangle width.
hThe rectangle height.
srcThe source raster.
sxThe source image start position.
syThe source image start position.
swThe source image rectangle width.
shThe source image rectangle height.
opacityThe opacity value used to draw the image

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawPixel ( int  x,
int  y 
)
pure virtual

It sets a pixel using the point pen.

Parameters
xColumn.
yRow.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawPixel ( int  x,
int  y,
const te::color::RGBAColor color 
)
pure virtual

It sets a pixel to a particular color.

The color must be an RGBA value. With the following range:

  • R: 0-255;
  • G: 0-255;
  • B: 0-255;
  • A: 0-255.

    Parameters
    xColumn.
    yRow.
    colorPixel color.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawText ( int  x,
int  y,
const std::string &  txt,
float  angle = 0.0,
te::at::HorizontalAlignment  hAlign = te::at::Start,
te::at::VerticalAlignment  vAlign = te::at::Baseline 
)
pure virtual

It draws a text.

Color and font family should be defined in advance.

Parameters
xThe text entry point x in device coordinate.
yThe text entry point y in device coordinate.
txtThe text to be drawn.
angleThe text rotation.
hAlignThe horizontal text alignment.
vAlignThe vertical text alignment.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawText ( const te::gm::Point p,
const std::string &  txt,
float  angle = 0.0,
te::at::HorizontalAlignment  hAlign = te::at::Start,
te::at::VerticalAlignment  vAlign = te::at::Baseline 
)
pure virtual

It draws a text.

Color and font family should be defined in advance.

Parameters
pThe text entry point in world coordinate.
txtThe text to be drawn.
angleThe text rotation.
hAlignThe horizontal text alignment.
vAlignThe vertical text alignment.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::drawText ( const double &  x,
const double &  y,
const std::string &  txt,
float  angle = 0.0,
te::at::HorizontalAlignment  hAlign = te::at::Start,
te::at::VerticalAlignment  vAlign = te::at::Baseline 
)
pure virtual

It draws a text.

Color and font family should be defined in advance.

Parameters
xThe text entry point x in world coordinate.
yThe text entry point y in world coordinate.
txtThe text to be drawn.
angleThe text rotation.
hAlignThe horizontal text alignment.
vAlignThe vertical text alignment.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::freeImage ( char *  img) const
pure virtual

This is the method that you should use to release an image generated by the canvas.

Parameters
imgA pointer to an image previously created by the canvas.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual te::color::RGBAColor te::map::Canvas::getBackgroundColor ( ) const
pure virtual

It returns the canvas background color.

Returns
The canvas background color.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual int te::map::Canvas::getHeight ( ) const
pure virtual

It returns the canvas height.

Returns
The canvas height.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual char* te::map::Canvas::getImage ( ImageType  t,
std::size_t &  size,
int  quality = 75,
int  fg = 0 
) const
pure virtual

It returns the internal content as an image in a specific format (PNG, JPEG, ...).

Parameters
tThe image format type (see ImageType enum).
sizeThe image size in bytes.
qualityJPEG quality, generally a value between 0 and 95.
fgForeground color for WBMP images.
Returns
The internal content as an image. The caller will take the ownership of the returned pointer.
Note
Use canvas freeImage in order to release the returned image resources.

Implemented in te::qt::widgets::Canvas.

virtual te::color::RGBAColor** te::map::Canvas::getImage ( const int  x = 0,
const int  y = 0,
const int  w = 0,
const int  h = 0 
) const
pure virtual

It gets a RGBA color array from internal canvas buffer.

Returns
The Pointer RGBA colors.
Note
The caller of this method will take the ownership of the returned array.

Implemented in te::qt::widgets::Canvas.

virtual te::gm::Polygon* te::map::Canvas::getTextBoundary ( int  x,
int  y,
const std::string &  txt,
float  angle = 0.0,
te::at::HorizontalAlignment  hAlign = te::at::Start,
te::at::VerticalAlignment  vAlign = te::at::Baseline 
)
pure virtual

It returns the text boundary (its enclose rectangle).

Color and font family should be defined in advance.

Parameters
xThe text entry point x in device coordinate.
yThe text entry point y in device coordinate.
txtThe text to be drawn.
angleThe text rotation.
hAlignThe horizontal text alignment.
vAlignThe vertical text alignment.
Returns
The text boundary in world coordinate.
Note
The caller of this method will take the ownership of the returned Polygon.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual te::gm::Polygon* te::map::Canvas::getTextBoundary ( const te::gm::Point p,
const std::string &  txt,
float  angle = 0.0,
te::at::HorizontalAlignment  hAlign = te::at::Start,
te::at::VerticalAlignment  vAlign = te::at::Baseline 
)
pure virtual

It returns the text boundary (its enclose rectangle).

Color and font family should be defined in advance.

Parameters
pThe text entry point in world coordinate.
txtThe text to be drawn.
angleThe text rotation.
hAlignThe horizontal text alignment.
vAlignThe vertical text alignment.
Returns
The text boundary in world coordinate.
Note
The caller of this method will take the ownership of the returned Polygon.

Implemented in te::qt::widgets::Canvas.

virtual te::gm::Polygon* te::map::Canvas::getTextBoundary ( const double &  x,
const double &  y,
const std::string &  txt,
float  angle = 0.0,
te::at::HorizontalAlignment  hAlign = te::at::Start,
te::at::VerticalAlignment  vAlign = te::at::Baseline 
)
pure virtual

It returns the text boundary (its enclose rectangle).

Color and font family should be defined in advance.

Parameters
xThe text entry point x in world coordinate.
yThe text entry point y in world coordinate.
txtThe text to be drawn.
angleThe text rotation.
hAlignThe horizontal text alignment.
vAlignThe vertical text alignment.
Returns
The text boundary in world coordinates.
Note
The caller of this method will take the ownership of the returned Polygon.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual int te::map::Canvas::getWidth ( ) const
pure virtual

It returns the canvas width.

Returns
The canvas width.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::resize ( int  w,
int  h 
)
pure virtual

It adjusts the canvas size (width and height).

Parameters
wThe new canvas width.
hThe new canvas height.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::save ( const char *  fileName,
ImageType  t,
int  quality = 75,
int  fg = 0 
) const
pure virtual

It saves the canvas content to a file image in the specified format type.

Parameters
fileNameThe file name and path where the image will be saved.
tThe image format type (see ImageType enum).
qualityJPEG quality, generally a value between 0 and 95.
fgForeground color for WBMP images.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setBackgroundColor ( const te::color::RGBAColor color)
pure virtual

It sets the canvas background color.

The default is totally transparent (255, 255, 255, 0).

Parameters
colorThe background color.
Note
When this method is called, all the canvas content is dropped out.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setEraseMode ( )
pure virtual

It sets the painter to erase mode.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setFontFamily ( const std::string &  family)
pure virtual

It sets the text font family.

Parameters
familyThe new font family for drawing a text.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLineCapStyle ( LineCapStyle  style)
pure virtual

It sets the line cap style.

Parameters
styleThe line cap style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLineColor ( const te::color::RGBAColor color)
pure virtual

It sets the pen color used to draw line geometries.

This method will drop any pattern or line style previously set.

Parameters
colorThe color to be used by the pen.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLineDashStyle ( LineDashStyle  style)
pure virtual

It sets the line dash style.

Parameters
styleThe line dash style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLineDashStyle ( const std::vector< double > &  style)
pure virtual

It sets the line dash style to the given pattern.

Parameters
styleThe line custom dash style.
Note
The style should be specified as an even number of positive double where the entries 0, 2, 4, ... are dashes and 1, 3, 5, ... are spaces.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLineJoinStyle ( LineJoinStyle  style)
pure virtual

It sets the line join style.

Parameters
styleThe line join style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLinePattern ( te::color::RGBAColor **  pattern,
int  ncols,
int  nrows 
)
pure virtual

It sets the line pattern.

The pattern is a matrix of int's, and each position corresponds to a RGBA color.

Parameters
patternThe pattern matrix: a square matrix of int's where each position corresponds to a RGBA color.
ncolsNumber of columns in the matrix.
nrowsNumber of rows in the matrix.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLinePattern ( char *  pattern,
std::size_t  size,
ImageType  t 
)
pure virtual

It sets the line pattern using a buffered image.

Parameters
patternThe buffered image.
sizeThe buffer image size.
tThe image type used by the style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLinePatternOpacity ( int  opacity)
pure virtual

It sets the line pattern opacity.

Parameters
opacityThe pattern opacity.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLinePatternRotation ( const double &  angle)
pure virtual

It sets the line pattern rotation. Rotation is made ​​from the center of the pattern.

Parameters
angleThe rotation angle in degress.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setLineWidth ( int  w)
pure virtual

It sets the line width.

Parameters
wThe line width.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setNormalMode ( )
pure virtual

It sets the painter to normal copy source to destination mode.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPointColor ( const te::color::RGBAColor color)
pure virtual

It sets the point drawing color.

This method will instruct the canvas to draw points like pixels. Any pattern previously set will be released.

Parameters
colorThe new color for drawing a point.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPointPattern ( te::color::RGBAColor **  pattern,
int  ncols,
int  nrows 
)
pure virtual

It sets the point pattern.

The pattern is a matrix of int's, and each position corresponds to a RGBA color.

Parameters
patternThe pattern matrix: a square matrix of int's where each position corresponds to a RGBA color.
ncolsNumber of columns in the matrix.
nrowsNumber of rows in the matrix.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPointPattern ( char *  pattern,
std::size_t  size,
ImageType  t 
)
pure virtual

It sets the point pattern using a buffered image.

Parameters
patternThe buffered image.
sizeThe buffer image size.
tThe image type used by the style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPointPatternOpacity ( int  opacity)
pure virtual

It sets the point pattern opacity.

Parameters
opacityThe pattern opacity.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPointPatternRotation ( const double &  angle)
pure virtual

It sets the point pattern rotation. Rotation is made ​​from the center of the pattern.

Parameters
angleThe rotation angle in degress.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPointWidth ( int  w)
pure virtual

It sets the point width. If point has a patterns, this pattern is scaled to width.

Parameters
wThe width used to draw point.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourCapStyle ( LineCapStyle  style)
pure virtual

It sets the polygon contour cap style.

Parameters
styleThe polygon contour cap style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourColor ( const te::color::RGBAColor color)
pure virtual

It sets the pen color used to draw the boundary of polygon geometries.

Parameters
colorThe color to be used to outline a polygon.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourDashStyle ( LineDashStyle  style)
pure virtual

It sets the polygon contour dash style.

Parameters
styleThe polygon contour dash style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourDashStyle ( const std::vector< double > &  style)
pure virtual

It sets the polygon contour dash style to the given pattern.

Parameters
styleThe polygon contour custom dash style.
Note
The style should be specified as an even number of positive double where the entries 0, 2, 4, ... are dashes and 1, 3, 5, ... are spaces.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourJoinStyle ( LineJoinStyle  style)
pure virtual

It sets the polygon contour join style.

Parameters
styleThe polygon contour join style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourPattern ( te::color::RGBAColor **  pattern,
int  ncols,
int  nrows 
)
pure virtual

It sets the pen pattern used to draw the boundary of polygon geometries.

The pattern is a matrix of int's, and each position corresponds to a RGBA color.

Parameters
patternThe pattern matrix: a square matrix of int's where each position corresponds to a RGBA color.
ncolsNumber of columns in the matrix.
nrowsNumber of rows in the matrix.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourPattern ( char *  pattern,
std::size_t  size,
ImageType  t 
)
pure virtual

It sets the pen pattern used to draw the boundary of polygon geometries using a buffered image.

Parameters
patternThe buffered image.
sizeThe buffer image size.
tThe image type used by the style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourPatternOpacity ( int  opacity)
pure virtual

It sets the polygon contour pattern opacity.

Parameters
opacityThe pattern opacity.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourPatternRotation ( const double &  angle)
pure virtual

It sets the polygon contour pattern rotation.

Parameters
angleThe rotation angle in degress.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonContourWidth ( int  w)
pure virtual

It sets the polygon contour width.

Parameters
wThe contour width.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonFillColor ( const te::color::RGBAColor color)
pure virtual

It sets the color used to fill the draw of polygon geometries.

Parameters
colorThe color to be used when filling a polygon.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonFillPattern ( te::color::RGBAColor **  pattern,
int  ncols,
int  nrows 
)
pure virtual

It sets the polygon fill pattern.

The pattern is a matrix of int's, and each position corresponds to a RGBA color.

Parameters
patternThe style matrix: a square matrix of int's where each position corresponds to a RGBA color.
ncolsNumber of columns in the matrix.
nrowsNumber of rows in the matrix.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonFillPattern ( char *  pattern,
std::size_t  size,
ImageType  t 
)
pure virtual

It sets the polygon fill pattern using a buffered image.

Parameters
patternThe buffered image.
sizeThe buffer image size.
tThe image type used by the style.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonPatternOpacity ( int  opacity)
pure virtual

It sets the polygon pattern opacity.

Parameters
opacityThe pattern opacity.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonPatternRotation ( const double &  angle)
pure virtual

It sets the polygon pattern rotation.

Parameters
angleThe rotation angle in degress.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setPolygonPatternWidth ( int  w)
pure virtual

It sets the polygon pattern width.

Parameters
wThe pattern width.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextColor ( const te::color::RGBAColor color)
pure virtual

It sets the text drawing color.

Parameters
colorThe new color for drawing a text.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextContourColor ( const te::color::RGBAColor color)
pure virtual

It sets the text contour (outline) drawing color.

Parameters
colorThe new color for drawing the contour of texts.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextContourEnabled ( bool  b)
pure virtual

It controls the display of the text outline.

Parameters
bTrue to display and false to not display.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextContourOpacity ( int  opacity)
pure virtual

It sets the text contour opacity.

Parameters
opacityThe new opacity for drawing the text contour.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextContourWidth ( int  width)
pure virtual

It sets the text contour width.

Parameters
widthThe new width for drawing the text contour.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextDecorationColor ( const te::color::RGBAColor color)
pure virtual

It sets the text color for drawing text decoration.

Parameters
colorThe new color for drawing text decoration.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextDecorationWidth ( int  width)
pure virtual

It sets the width for drawing text decoration.

Parameters
widthThe new width for drawing text decoration.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextJustification ( te::at::LineJustification  just)
pure virtual

It sets the text justification for multi line text.

Parameters
justThe new justification for drawing a multi line text.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextMultiLineSpacing ( int  spacing)
pure virtual

It sets the multi line text spacing.

Parameters
spacingThe new spacing for drawing a multi line text.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextOpacity ( int  opacity)
pure virtual

It sets the text opacity.

Parameters
opacityThe new opacity for drawing a text.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextOverline ( bool  b)
pure virtual

It sets the text overline flag.

Parameters
bTrue: for overline. False otherwise.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextPointSize ( double  size)
pure virtual

It sets the text point Size.

Parameters
sizeThe new point size for drawing a text.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextStretch ( std::size_t  stretch)
pure virtual

It sets the text stretch.

Parameters
stretchThe new stretch for drawing a text.

Implemented in te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextStrikeOut ( bool  b)
pure virtual

It sets the text strike out flag.

Parameters
bTrue: for strike out. False otherwise.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextStyle ( te::at::FontStyle  style)
pure virtual

It sets the text style.

Parameters
styleThe new style for drawing a text.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextUnderline ( bool  b)
pure virtual

It sets the text underline flag.

Parameters
bTrue: for underline. False otherwise.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setTextWeight ( te::at::FontWeight  weight)
pure virtual

It sets the text weight.

Parameters
weightThe new weight for drawing a text.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.

virtual void te::map::Canvas::setWindow ( const double &  llx,
const double &  lly,
const double &  urx,
const double &  ury 
)
pure virtual

It sets the world (or window) coordinates area (supposing a cartesian reference system).

Parameters
llxLower left x-coordinate of the World.
llyLower left y-coordinate of the World.
urxUpper right x-coordinate of the World.
uryUpper right y-coordinate of the World.
Note
The coordinates must be in the Spatial Reference System of the features to be drawn in canvas.

Implemented in te::ag::Canvas, and te::qt::widgets::Canvas.


The documentation for this class was generated from the following file: