A canvas built on top of Qt. More...
#include <Canvas.h>
Public Member Functions | |
Initializer Methods | |
Methods related to instantiation and destruction. | |
Canvas (int w, int h, int devType=QInternal::Pixmap) | |
It initializes a new Canvas and associates a pixmap as the default device. | |
Canvas (QPaintDevice *device) | |
It initializes a new Canvas associated with the given paint device. | |
Canvas (QPainter *painter) | |
It initializes a new Canvas associated with the given painter. | |
~Canvas () | |
Destructor. | |
Methods Inherited From Abstract Canvas | |
These methods are re-implementations from abstract canvas. | |
void | setWindow (const double &llx, const double &lly, const double &urx, const double &ury) |
It sets the world (or window) coordinates area (supposing a cartesian reference system). | |
const te::gm::Envelope & | getWindow () const |
It gets the world (or window) coordinates area (supposing a cartesian reference system). | |
void | calcAspectRatio (double &llx, double &lly, double &urx, double &ury, const te::map::AlignType hAlign=te::map::Center, const te::map::AlignType vAlign=te::map::Center) |
It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system). | |
void | calcAspectRatio (te::gm::Envelope *envelope, const te::map::AlignType hAlign=te::map::Center, const te::map::AlignType vAlign=te::map::Center) |
It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system). | |
void | setBackgroundColor (const te::color::RGBAColor &color) |
It sets the canvas background color. | |
te::color::RGBAColor | getBackgroundColor () const |
It returns the canvas background color. | |
void | clear () |
It clears the canvas content and fills with the background color. | |
void | resize (int w, int h) |
It adjusts the canvas size (width and height). | |
int | getWidth () const |
It returns the canvas width. | |
int | getHeight () const |
It returns the canvas height. | |
void | draw (const te::gm::Geometry *geom) |
It draws the geometry on canvas. | |
void | draw (const te::gm::Point *point) |
It draws the point on canvas. | |
void | draw (const te::gm::MultiPoint *mpoint) |
It draws the MultiPoint on canvas. | |
void | draw (const te::gm::LineString *line) |
It draws the LineString on canvas. | |
void | draw (const te::gm::MultiLineString *mline) |
It draws the MultiLineString on canvas. | |
void | draw (const te::gm::Polygon *poly) |
It draws the polygon on canvas. | |
void | draw (const te::gm::MultiPolygon *mpoly) |
It draws the MultiPolygon on canvas. | |
void | draw (const te::gm::GeometryCollection *g) |
It draws the GeometryCollection on canvas. | |
void | draw (const te::gm::MultiSurface *g) |
It draws the MultiSurface on canvas. | |
void | save (const char *fileName, te::map::ImageType t, int quality=75, int fg=0) const |
It saves the canvas content to a file image in the specified format type. | |
char * | getImage (te::map::ImageType t, std::size_t &size, int quality=75, int fg=0) const |
It returns the internal content as an image in a specific format (PNG, JPEG, ...). | |
te::color::RGBAColor ** | getImage (const int x=0, const int y=0, const int w=0, const int h=0) const |
It gets a RGBA color array from internal canvas buffer. | |
void | freeImage (char *img) const |
This is the method that you should use to release an image generated by the canvas. | |
void | drawImage (char *src, std::size_t size, te::map::ImageType t) |
It draws the src image over the canvas. | |
void | drawImage (te::color::RGBAColor **src, int w, int h) |
It draws the src image over the canvas. | |
void | drawImage (int x, int y, char *src, std::size_t size, te::map::ImageType t) |
It draws the src image over the canvas at the specified position (x, y). | |
void | drawImage (int x, int y, te::color::RGBAColor **src, int w, int h) |
It draws the src image over the canvas at the specified position (x, y). | |
void | drawImage (int x, int y, int w, int h, char *src, std::size_t size, te::map::ImageType t) |
It draws the source image into the rectangle at position (x, y) with the given width and height. | |
void | drawImage (int x, int y, int w, int h, te::color::RGBAColor **src, int srcw, int srch) |
It draws the source image into the rectangle at position (x, y) with the given width and height. | |
void | drawImage (int x, int y, int w, int h, char *src, std::size_t size, te::map::ImageType t, int sx, int sy, int sw, int sh) |
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. | |
void | drawImage (int x, int y, int w, int h, te::color::RGBAColor **src, int sx, int sy, int sw, int sh) |
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. | |
void | drawImage (int x, int y, te::rst::Raster *src, int opacity=TE_OPAQUE) |
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),. | |
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) |
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. | |
void | drawPixel (int x, int y) |
It sets a pixel using the point pen. | |
void | drawPixel (int x, int y, const te::color::RGBAColor &color) |
It sets a pixel to a particular color. | |
void | drawText (int x, int y, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It draws a text. | |
void | drawText (const te::gm::Point *p, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It draws a text. | |
void | drawText (const double &x, const double &y, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It draws a text. | |
te::gm::Polygon * | getTextBoundary (int x, int y, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It returns the text boundary (its enclose rectangle). | |
te::gm::Polygon * | getTextBoundary (const te::gm::Point *p, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It returns the text boundary (its enclose rectangle). | |
te::gm::Polygon * | getTextBoundary (const double &x, const double &y, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It returns the text boundary (its enclose rectangle). | |
void | setTextColor (const te::color::RGBAColor &color) |
It sets the text drawing color. | |
void | setTextOpacity (int opacity) |
It sets the text opacity. | |
void | setFontFamily (const std::string &family) |
It sets the text font family. | |
void | setTextPointSize (double psize) |
It sets the text point Size. | |
void | setTextStyle (te::se::Font::FontStyleType style) |
It sets the text style. | |
void | setTextWeight (te::se::Font::FontWeightType weight) |
It sets the text weight. | |
void | setTextStretch (std::size_t stretch) |
It sets the text stretch. | |
void | setTextUnderline (bool b) |
It sets the text underline flag. | |
void | setTextOverline (bool b) |
It sets the text overline flag. | |
void | setTextStrikeOut (bool b) |
It sets the text strike out flag. | |
void | setTextDecorationColor (const te::color::RGBAColor &color) |
It sets the text color for drawing text decoration. | |
void | setTextDecorationWidth (int width) |
It sets the width for drawing text decoration. | |
void | setTextContourColor (const te::color::RGBAColor &color) |
It sets the text contour (outline) drawing color. | |
void | setTextContourEnabled (bool b) |
It controls the display of the text outline. | |
void | setTextContourOpacity (int opacity) |
It sets the text contour opacity. | |
void | setTextContourWidth (int width) |
It sets the text contour width. | |
void | setTextJustification (int justType) |
It sets the text justification for multi line text. | |
void | setTextMultiLineSpacing (int spacing) |
It sets the multi line text spacing. | |
void | setPointColor (const te::color::RGBAColor &color) |
It sets the point drawing color. | |
void | setPointWidth (int w) |
It sets the point width. If point has a patterns, this pattern is scaled to width. | |
void | setPointPattern (te::color::RGBAColor **pattern, int ncols, int nrows) |
It sets the point pattern. | |
void | setPointPattern (char *pattern, std::size_t size, te::map::ImageType t) |
It sets the point pattern using a buffered image. | |
void | setPointPatternRotation (const double &angle) |
It sets the point pattern rotation. Rotation is made from the center of the pattern. | |
void | setPointPatternOpacity (int opacity) |
It sets the point pattern opacity. | |
void | setLineColor (const te::color::RGBAColor &color) |
It sets the pen color used to draw line geometries. | |
void | setLinePattern (te::color::RGBAColor **pattern, int ncols, int nrows) |
It sets the line pattern. | |
void | setLinePattern (char *pattern, std::size_t size, te::map::ImageType t) |
It sets the line pattern using a buffered image. | |
void | setLinePatternRotation (const double &angle) |
It sets the line pattern rotation. Rotation is made from the center of the pattern. | |
void | setLinePatternOpacity (int opacity) |
It sets the line pattern opacity. | |
void | setLineDashStyle (te::map::LineDashStyle style) |
It sets the line dash style. | |
void | setLineDashStyle (const std::vector< double > &style) |
It sets the line dash style to the given pattern. | |
void | setLineCapStyle (te::map::LineCapStyle style) |
It sets the line cap style. | |
void | setLineJoinStyle (te::map::LineJoinStyle style) |
It sets the line join style. | |
void | setLineWidth (int w) |
It sets the line width. | |
void | setPolygonFillColor (const te::color::RGBAColor &color) |
It sets the color used to fill the draw of polygon geometries. | |
void | setPolygonFillColor (const QBrush &color) |
void | setPolygonContourColor (const te::color::RGBAColor &color) |
It sets the pen color used to draw the boundary of polygon geometries. | |
void | setPolygonFillPattern (te::color::RGBAColor **pattern, int ncols, int nrows) |
It sets the polygon fill pattern. | |
void | setPolygonFillPattern (char *pattern, std::size_t size, te::map::ImageType t) |
It sets the polygon fill pattern using a buffered image. | |
void | setPolygonPatternWidth (int w) |
It sets the polygon pattern width. | |
void | setPolygonPatternRotation (const double &angle) |
It sets the polygon pattern rotation. | |
void | setPolygonPatternOpacity (int opacity) |
It sets the polygon pattern opacity. | |
void | setPolygonContourPattern (te::color::RGBAColor **pattern, int ncols, int nrows) |
It sets the pen pattern used to draw the boundary of polygon geometries. | |
void | setPolygonContourPattern (char *pattern, std::size_t size, te::map::ImageType t) |
It sets the pen pattern used to draw the boundary of polygon geometries using a buffered image. | |
void | setPolygonContourWidth (int w) |
It sets the polygon contour width. | |
void | setPolygonContourPatternRotation (const double &angle) |
It sets the polygon contour pattern rotation. | |
void | setPolygonContourPatternOpacity (int opacity) |
It sets the polygon contour pattern opacity. | |
void | setPolygonContourDashStyle (te::map::LineDashStyle style) |
It sets the polygon contour dash style. | |
void | setPolygonContourDashStyle (const std::vector< double > &style) |
It sets the polygon contour dash style to the given pattern. | |
void | setPolygonContourCapStyle (te::map::LineCapStyle style) |
It sets the polygon contour cap style. | |
void | setPolygonContourJoinStyle (te::map::LineJoinStyle style) |
It sets the polygon contour join style. | |
void | setEraseMode () |
It sets the painter to erase mode. | |
void | setNormalMode () |
It sets the painter to normal copy source to destination mode. | |
Qt Canvas Specific Methos | |
Methods that belongs only to Qt Canvas. | |
void | drawText (const QPoint &p, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It draws a text. | |
te::gm::Polygon * | getTextBoundary (const QPoint &p, const std::string &txt, float angle=0.0, double anchorX=0.5, double anchorY=0.5, int displacementX=0, int displacementY=0) |
It returns text boundary. Color and font family should be defined in advance. | |
QPixmap * | getPixmap () const |
It returns the internal pixmap used to draw geographical objects. | |
QImage * | getImage () const |
It returns the internal image used to draw geographical objects. | |
QPaintDevice * | getDevice () const |
It returns the internal device used to draw geographical objects. | |
void | setDevice (QPaintDevice *device, bool takeOwnerShip) |
It sets new device as QPrinter. | |
int | getResolution () |
It returns the device resolution. | |
QMatrix | getMatrix () |
It returns the matrix. | |
void | setMatrix (const QMatrix &matrix) |
void | setRenderHint (QPainter::RenderHint hint, bool on=true) |
Sets the given render hint on the canvas painter if on is true; otherwise clears the render hint. | |
QPainter * | getPainter () |
Private Member Functions | |
Copy Constructor and Assignment Operator | |
Copy constructor and assignment operator not allowed. | |
Canvas (const Canvas &rhs) | |
Copy constructor not allowed. | |
Canvas & | operator= (const Canvas &rhs) |
Assignment operator not allowed. | |
Auxiliary Methods | |
Auxiliary methods. | |
QMatrix | m_matrix |
Matrix that transforms the world coordinate to device coordinate. | |
te::gm::Envelope * | m_envelope |
Stores the current world (or window) coordinates area. | |
QPainter * | m_painter |
The painter used to draw geometric objects. | |
QTransform | m_painterTransform |
This transform holds the original transform of the painter. It is stored to be combined to the canvas matrix every time setWindow is called. | |
bool | m_isPainterOwner |
Tells if canvas is the owner of the painter. | |
bool | m_isDeviceOwner |
Tells if canvas is the owner of the paint device. | |
QColor | m_bgColor |
Canvas background color. Defaults: white fully transparent. | |
bool | m_erase |
used for erase operation. | |
QPen | m_ptPen |
The pen used to draw points. | |
QPointF | m_pt |
Point buffer to avoid creating another point instance. | |
int | m_ptWidth |
The width for point markers and point pattern. | |
QColor | m_ptColor |
The color used to draw point (pixel) or marker. | |
QColor | m_ptColorFrom |
Indicates the color that originated the pattern that shows the status of selection. Used for optmization. | |
QImage * | m_ptImg |
The marker or pattern used to point. | |
QImage * | m_ptImgRotated |
The marker or pattern already with rotation used to draw points. | |
QImage * | m_ptSelectionPatternImg |
The marker or pattern used to show selection status. The color is mixed with point pattern. | |
QImage * | m_ptClearPatternImg |
The marker or pattern used to clear (erase point). | |
double | m_ptRotation |
The point pattern rotation. | |
int | m_ptVOffset |
Vertical offset in pixels (in device coordinate) applied to point pattern or marker. | |
int | m_ptHOffset |
Horizontal offset in pixels (in device coordinate) applied to point pattern or marker. | |
QColor | m_lnColor |
The color used to draw lines. | |
QPen | m_lnPen |
The pen used to draw lines. | |
QColor | m_polyContourColor |
The color used to draw polygon contour. | |
QPen | m_polyContourPen |
The pen used to draw contour polygon. | |
QColor | m_polyColor |
The color used to fill polygon (solid, marker or pattern). | |
QBrush | m_polyBrush |
The brush used to fill polygon. | |
QBrush | m_polyDefaultBrush |
The brush used to fill polygon. | |
QImage * | m_polyImage |
The pattern image used to fill polygon. | |
int | m_polyPatternWidth |
The width used to draw marker or pattern. | |
QPen | m_txtContourPen |
The pen used to draw the text contour. | |
bool | m_txtContourEnabled |
The flag indicates whether the outline of the text should be drawn. | |
QBrush | m_txtBrush |
The brush used to draw texts. | |
QFont | m_font |
The text font. | |
int | m_txtLetterSpacing |
Text letter spacing. | |
int | m_txtWordSpacing |
Text word spacing. | |
int | m_txtLineSpacing |
Text multi line spacing. | |
std::map< std::string, QPixmap * > | m_patterns |
The pixmap styles used to draw patterns. | |
void | setLineDashStyle (QPen &pen, const std::vector< double > &style) |
It adjusts the given pen to use the given pattern. | |
void | updateAlpha (QImage &img, const int &opacity) |
It updates the alpha channel of the given image using the given opacity value. | |
void | createPointPatterns () |
It creates two patterns. A pattern used to draw selected objects and the other used to erase this pattern. | |
void | drawContour (const te::gm::LineString *line) |
It draw the polygon contour. | |
te::qt::widgets::Canvas::Canvas | ( | int | w, |
int | h, | ||
int | devType = QInternal::Pixmap |
||
) |
It initializes a new Canvas and associates a pixmap as the default device.
w | The internal pixmap width in pixels. |
h | The internal pixmap height in pixels. |
devType | The internal device. It can be Pixmap or Image. |
te::qt::widgets::Canvas::Canvas | ( | QPaintDevice * | device | ) |
It initializes a new Canvas associated with the given paint device.
device | The paint device that will be associated to this canvas. |
te::qt::widgets::Canvas::Canvas | ( | QPainter * | painter | ) |
It initializes a new Canvas associated with the given painter.
device | The painter that will be associated to this canvas. |
|
virtual |
Destructor.
Reimplemented from te::map::Canvas.
|
private |
Copy constructor not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
|
virtual |
It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system).
llx | Lower left x-coordinate of the World. |
lly | Lower left y-coordinate of the World. |
urx | Upper right x-coordinate of the World. |
ury | Upper right y-coordinate of the World. |
hAlign | Horizontal Alignment. It can be left, center or right. |
vAlign | Vertical Alignment. It can be top, center or bottom. |
Implements te::map::Canvas.
|
virtual |
It calculates the best aspect ratio for world (or window) coordinates area (supposing a cartesian reference system).
envelope | A rectangle with world coordinates that will be adjusted. |
hAlign | Horizontal Alignment. It can be left, center or right. |
vAlign | Vertical Alignment. It can be top, center or bottom. |
Implements te::map::Canvas.
|
virtual |
It clears the canvas content and fills with the background color.
Implements te::map::Canvas.
|
private |
It creates two patterns. A pattern used to draw selected objects and the other used to erase this pattern.
|
virtual |
It draws the geometry on canvas.
geom | Any geometry (point, line, polygon, ...). |
Implements te::map::Canvas.
|
virtual |
It draws the GeometryCollection on canvas.
g | The GeometryCollection. |
Implements te::map::Canvas.
|
virtual |
|
virtual |
It draws the MultiLineString on canvas.
mline | The MultiLineString. |
Implements te::map::Canvas.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
private |
It draw the polygon contour.
|
virtual |
It draws the src image over the canvas.
src | A source image of any type (PNG, JPEG, GIF, ...). |
size | The image size in bytes. |
t | The image format type (see ImageType enum). |
Implements te::map::Canvas.
|
virtual |
It draws the src image over the canvas at the specified position (x, y).
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
src | A source image of any type (PNG, JPEG, GIF, ...). |
size | The image size in bytes. |
t | The image format type (see ImageType enum). |
Implements te::map::Canvas.
|
virtual |
It draws the source image into the rectangle at position (x, y) with the given width and height.
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
w | The rectangle width. |
h | The rectangle height. |
src | A source image of any type (PNG, JPEG, GIF, ...). |
size | The image size in bytes. |
t | The image format type (see ImageType enum). |
Implements te::map::Canvas.
|
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.
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
w | The rectangle width. |
h | The rectangle height. |
src | A source image of any type (PNG, JPEG, GIF, ...). |
size | The image size in bytes. |
t | The image format type (see ImageType enum). |
sx | The source image position. |
sy | The source image position. |
sw | The source image rectangle width. |
sh | The source image rectangle height. |
Implements te::map::Canvas.
|
virtual |
It draws the source image into the rectangle at position (x, y) with the given width and height.
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
w | The rectangle width. |
h | The rectangle height. |
src | The source image. |
srcw | The source image width (number of columns). |
srch | The source image height (number of rows). |
Implements te::map::Canvas.
|
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.
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
w | The rectangle width. |
h | The rectangle height. |
src | The source image. |
sx | The source image start position. |
sy | The source image start position. |
sw | The source image rectangle width. |
sh | The source image rectangle height. |
Implements te::map::Canvas.
|
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.
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
w | The rectangle width. |
h | The rectangle height. |
src | The source raster. |
sx | The source image start position. |
sy | The source image start position. |
sw | The source image rectangle width. |
sh | The source image rectangle height. |
opacity | The opacity value used to draw the image |
Implements te::map::Canvas.
|
virtual |
It draws the src image over the canvas at the specified position (x, y).
x | The canvas start position where the src image will be drawn. |
y | The canvas start position where the src image will be drawn. |
src | The source image. |
w | The image width (number of columns). |
h | The image height (number of rows). |
Implements te::map::Canvas.
|
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),.
x | The canvas start position in x where the raster image will be drawn. |
y | The canvas start position in y where the raster image will be drawn. |
src | The source raster. |
opacity | The opacity value used to draw the image |
Implements te::map::Canvas.
|
virtual |
It draws the src image over the canvas.
src | The source image. |
w | The image width (number of columns). |
h | The image height (number of rows). |
Implements te::map::Canvas.
|
virtual |
|
virtual |
It sets a pixel to a particular color.
The color must be an RGBA value. With the following range:
A: 0-255.
x | Column. |
y | Row. |
color | Pixel color. |
Implements te::map::Canvas.
|
virtual |
It draws a text.
Color and font family should be defined in advance.
x | The text entry point x in world coordinate. |
y | The text entry point y in world coordinate. |
txt | The text to be drawn. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
Implements te::map::Canvas.
void te::qt::widgets::Canvas::drawText | ( | const QPoint & | p, |
const std::string & | txt, | ||
float | angle = 0.0 , |
||
double | anchorX = 0.5 , |
||
double | anchorY = 0.5 , |
||
int | displacementX = 0 , |
||
int | displacementY = 0 |
||
) |
It draws a text.
Color and font family should be defined in advance.
p | The text entry point i device coordinate. |
txt | The text to be drawed. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
|
virtual |
It draws a text.
Color and font family should be defined in advance.
p | The text entry point in world coordinate. |
txt | The text to be drawn. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
Implements te::map::Canvas.
|
virtual |
It draws a text.
Color and font family should be defined in advance.
x | The text entry point x in device coordinate. |
y | The text entry point y in device coordinate. |
txt | The text to be drawn. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
Implements te::map::Canvas.
|
virtual |
This is the method that you should use to release an image generated by the canvas.
img | A pointer to an image previously created by the canvas. |
Implements te::map::Canvas.
|
virtual |
It returns the canvas background color.
Implements te::map::Canvas.
QPaintDevice * te::qt::widgets::Canvas::getDevice | ( | ) | const |
It returns the internal device used to draw geographical objects.
|
virtual |
QImage * te::qt::widgets::Canvas::getImage | ( | ) | const |
It returns the internal image used to draw geographical objects.
|
virtual |
It gets a RGBA color array from internal canvas buffer.
Implements te::map::Canvas.
|
virtual |
It returns the internal content as an image in a specific format (PNG, JPEG, ...).
t | The image format type (see ImageType enum). |
size | The image size in bytes. |
quality | JPEG quality, generally a value between 0 and 95. |
fg | Foreground color for WBMP images. |
Implements te::map::Canvas.
QMatrix te::qt::widgets::Canvas::getMatrix | ( | ) |
It returns the matrix.
QPainter * te::qt::widgets::Canvas::getPainter | ( | ) |
QPixmap * te::qt::widgets::Canvas::getPixmap | ( | ) | const |
It returns the internal pixmap used to draw geographical objects.
int te::qt::widgets::Canvas::getResolution | ( | ) |
It returns the device resolution.
|
virtual |
It returns the text boundary (its enclose rectangle).
Color and font family should be defined in advance.
x | The text entry point x in world coordinate. |
y | The text entry point y in world coordinate. |
txt | The text to be drawn. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
Implements te::map::Canvas.
te::gm::Polygon * te::qt::widgets::Canvas::getTextBoundary | ( | const QPoint & | p, |
const std::string & | txt, | ||
float | angle = 0.0 , |
||
double | anchorX = 0.5 , |
||
double | anchorY = 0.5 , |
||
int | displacementX = 0 , |
||
int | displacementY = 0 |
||
) |
It returns text boundary. Color and font family should be defined in advance.
p | The text entry point in device coordinate. |
tx | The text to be drawed. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
|
virtual |
It returns the text boundary (its enclose rectangle).
Color and font family should be defined in advance.
p | The text entry point in world coordinate. |
txt | The text to be drawn. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
Implements te::map::Canvas.
|
virtual |
It returns the text boundary (its enclose rectangle).
Color and font family should be defined in advance.
x | The text entry point x in device coordinate. |
y | The text entry point y in device coordinate. |
txt | The text to be drawn. |
angle | The text rotation. |
anchorX | The horizontal text anchor. |
anchorY | The vertical text anchor. |
displacementX | The horizontal text displacement. |
displacementY | The vertical text displacement. |
Implements te::map::Canvas.
|
virtual |
|
virtual |
It gets the world (or window) coordinates area (supposing a cartesian reference system).
Implements te::map::Canvas.
Assignment operator not allowed.
rhs | The right-hand-side copy that would be used to copy from. |
|
virtual |
It adjusts the canvas size (width and height).
w | The new canvas width. |
h | The new canvas height. |
Implements te::map::Canvas.
|
virtual |
It saves the canvas content to a file image in the specified format type.
fileName | The file name and path where the image will be saved. |
t | The image format type (see ImageType enum). |
quality | JPEG quality, generally a value between 0 and 95. |
fg | Foreground color for WBMP images. |
Implements te::map::Canvas.
|
virtual |
It sets the canvas background color.
The default is totally transparent (255, 255, 255, 0).
color | The background color. |
Implements te::map::Canvas.
void te::qt::widgets::Canvas::setDevice | ( | QPaintDevice * | device, |
bool | takeOwnerShip | ||
) |
It sets new device as QPrinter.
device | The new paint device. |
takeOwnerShip | If true the canvas will take the ownership of the given device otherwise it is the caller responsability to release the device. |
|
virtual |
It sets the painter to erase mode.
Implements te::map::Canvas.
|
virtual |
It sets the text font family.
family | The new font family for drawing a text. |
Implements te::map::Canvas.
|
virtual |
|
virtual |
It sets the pen color used to draw line geometries.
This method will drop any pattern or line style previously set.
color | The color to be used by the pen. |
Implements te::map::Canvas.
|
virtual |
It sets the line dash style to the given pattern.
style | The line custom dash style. |
Implements te::map::Canvas.
|
private |
It adjusts the given pen to use the given pattern.
pen | The pen that will be adjusted. |
style | The line custom dash style. |
|
virtual |
|
virtual |
|
virtual |
It sets the line pattern using a buffered image.
pattern | The buffered image. |
size | The buffer image size. |
t | The image type used by the style. |
Implements te::map::Canvas.
|
virtual |
It sets the line pattern.
The pattern is a matrix of int's, and each position corresponds to a RGBA color.
pattern | The pattern matrix: a square matrix of int's where each position corresponds to a RGBA color. |
ncols | Number of columns in the matrix. |
nrows | Number of rows in the matrix. |
Implements te::map::Canvas.
|
virtual |
It sets the line pattern opacity.
opacity | The pattern opacity. |
Implements te::map::Canvas.
|
virtual |
It sets the line pattern rotation. Rotation is made from the center of the pattern.
angle | The rotation angle in degress. |
Implements te::map::Canvas.
|
virtual |
void te::qt::widgets::Canvas::setMatrix | ( | const QMatrix & | matrix | ) |
|
virtual |
It sets the painter to normal copy source to destination mode.
Implements te::map::Canvas.
|
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.
color | The new color for drawing a point. |
Implements te::map::Canvas.
|
virtual |
It sets the point pattern using a buffered image.
pattern | The buffered image. |
size | The buffer image size. |
t | The image type used by the style. |
Implements te::map::Canvas.
|
virtual |
It sets the point pattern.
The pattern is a matrix of int's, and each position corresponds to a RGBA color.
pattern | The pattern matrix: a square matrix of int's where each position corresponds to a RGBA color. |
ncols | Number of columns in the matrix. |
nrows | Number of rows in the matrix. |
Implements te::map::Canvas.
|
virtual |
It sets the point pattern opacity.
opacity | The pattern opacity. |
Implements te::map::Canvas.
|
virtual |
It sets the point pattern rotation. Rotation is made from the center of the pattern.
angle | The rotation angle in degress. |
Implements te::map::Canvas.
|
virtual |
It sets the point width. If point has a patterns, this pattern is scaled to width.
w | The width used to draw point. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon contour cap style.
style | The polygon contour cap style. |
Implements te::map::Canvas.
|
virtual |
It sets the pen color used to draw the boundary of polygon geometries.
color | The color to be used to outline a polygon. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon contour dash style to the given pattern.
style | The polygon contour custom dash style. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon contour dash style.
style | The polygon contour dash style. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon contour join style.
style | The polygon contour join style. |
Implements te::map::Canvas.
|
virtual |
It sets the pen pattern used to draw the boundary of polygon geometries using a buffered image.
pattern | The buffered image. |
size | The buffer image size. |
t | The image type used by the style. |
Implements te::map::Canvas.
|
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.
pattern | The pattern matrix: a square matrix of int's where each position corresponds to a RGBA color. |
ncols | Number of columns in the matrix. |
nrows | Number of rows in the matrix. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon contour pattern opacity.
opacity | The pattern opacity. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon contour pattern rotation.
angle | The rotation angle in degress. |
Implements te::map::Canvas.
|
virtual |
void te::qt::widgets::Canvas::setPolygonFillColor | ( | const QBrush & | color | ) |
|
virtual |
It sets the color used to fill the draw of polygon geometries.
color | The color to be used when filling a polygon. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon fill pattern using a buffered image.
pattern | The buffered image. |
size | The buffer image size. |
t | The image type used by the style. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon fill pattern.
The pattern is a matrix of int's, and each position corresponds to a RGBA color.
pattern | The style matrix: a square matrix of int's where each position corresponds to a RGBA color. |
ncols | Number of columns in the matrix. |
nrows | Number of rows in the matrix. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon pattern opacity.
opacity | The pattern opacity. |
Implements te::map::Canvas.
|
virtual |
It sets the polygon pattern rotation.
angle | The rotation angle in degress. |
Implements te::map::Canvas.
|
virtual |
void te::qt::widgets::Canvas::setRenderHint | ( | QPainter::RenderHint | hint, |
bool | on = true |
||
) |
Sets the given render hint on the canvas painter if on is true; otherwise clears the render hint.
|
virtual |
It sets the text drawing color.
color | The new color for drawing a text. |
Implements te::map::Canvas.
|
virtual |
It sets the text contour (outline) drawing color.
color | The new color for drawing the contour of texts. |
Implements te::map::Canvas.
|
virtual |
It controls the display of the text outline.
b | True to display and false to not display. |
Implements te::map::Canvas.
|
virtual |
It sets the text contour opacity.
opacity | The new opacity for drawing the text contour. |
Implements te::map::Canvas.
|
virtual |
It sets the text contour width.
width | The new width for drawing the text contour. |
Implements te::map::Canvas.
|
virtual |
It sets the text color for drawing text decoration.
color | The new color for drawing text decoration. |
Implements te::map::Canvas.
|
virtual |
It sets the width for drawing text decoration.
width | The new width for drawing text decoration. |
Implements te::map::Canvas.
|
virtual |
It sets the text justification for multi line text.
just | The new justification for drawing a multi line text. |
Implements te::map::Canvas.
|
virtual |
It sets the multi line text spacing.
spacing | The new spacing for drawing a multi line text. |
Implements te::map::Canvas.
|
virtual |
It sets the text opacity.
opacity | The new opacity for drawing a text. |
Implements te::map::Canvas.
|
virtual |
It sets the text overline flag.
b | True: for overline. False otherwise. |
Implements te::map::Canvas.
|
virtual |
It sets the text point Size.
size | The new point size for drawing a text. |
Implements te::map::Canvas.
|
virtual |
It sets the text stretch.
stretch | The new stretch for drawing a text. |
Implements te::map::Canvas.
|
virtual |
It sets the text strike out flag.
b | True: for strike out. False otherwise. |
Implements te::map::Canvas.
|
virtual |
It sets the text style.
style | The new style for drawing a text. |
Implements te::map::Canvas.
|
virtual |
It sets the text underline flag.
b | True: for underline. False otherwise. |
Implements te::map::Canvas.
|
virtual |
It sets the text weight.
weight | The new weight for drawing a text. |
Implements te::map::Canvas.
|
virtual |
It sets the world (or window) coordinates area (supposing a cartesian reference system).
llx | Lower left x-coordinate of the World. |
lly | Lower left y-coordinate of the World. |
urx | Upper right x-coordinate of the World. |
ury | Upper right y-coordinate of the World. |
Implements te::map::Canvas.
|
private |
It updates the alpha channel of the given image using the given opacity value.
img | The image that will be updated. |
opacity | The opacity value that will be used. |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |