26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_CANVAS_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_CANVAS_H
30 #include "../../../maptools/Canvas.h"
31 #include "../Config.h"
34 #include <QtGui/QColor>
35 #include <QtGui/QPainter>
36 #include <QtGui/QPolygonF>
37 #include <QtGui/QWidget>
70 Canvas(
int w,
int h,
int devType = QInternal::Pixmap);
79 Canvas(QPaintDevice* device);
91 void setWindow(
const double& llx,
const double& lly,
92 const double& urx,
const double& ury);
94 void calcAspectRatio(
double& llx,
double& lly,
double& urx,
double& ury,
107 void resize(
int w,
int h);
109 int getWidth()
const;
111 int getHeight()
const;
129 void save(
const char* fileName,
te::map::ImageType t,
int quality = 75,
int fg = 0)
const;
131 char* getImage(
te::map::ImageType t, std::size_t& size,
int quality = 75,
int fg = 0)
const;
133 te::color::RGBAColor** getImage(
const int x = 0,
const int y = 0,
const int w = 0,
const int h = 0)
const;
135 void freeImage(
char* img)
const;
145 void drawImage(
int x,
int y,
int w,
int h,
char* src, std::size_t size,
te::map::ImageType t);
149 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);
151 void drawImage(
int x,
int y,
int w,
int h,
te::color::RGBAColor** src,
int sx,
int sy,
int sw,
int sh);
155 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);
157 void drawPixel(
int x,
int y);
161 void drawText(
int x,
int y,
162 const std::string& txt,
168 const std::string& txt,
173 void drawText(
const double& x,
const double& y,
174 const std::string& txt,
182 const std::string& txt,
188 const std::string& txt,
194 const std::string& txt,
201 void setTextOpacity(
int opacity);
203 void setFontFamily(
const std::string& family);
205 void setTextPointSize(
double psize);
211 void setTextStretch(std::size_t stretch);
213 void setTextUnderline(
bool b);
215 void setTextOverline(
bool b);
217 void setTextStrikeOut(
bool b);
221 void setTextDecorationWidth(
int width);
225 void setTextContourEnabled(
bool b);
227 void setTextContourOpacity(
int opacity);
229 void setTextContourWidth(
int width);
233 void setTextMultiLineSpacing(
int spacing);
237 void setPointWidth(
int w);
243 void setPointPatternRotation(
const double& angle);
245 void setPointPatternOpacity(
int opacity);
253 void setLinePatternRotation(
const double& angle);
255 void setLinePatternOpacity(
int opacity);
259 void setLineDashStyle(
const std::vector<double>& style);
265 void setLineWidth(
int w);
275 void setPolygonPatternWidth(
int w);
277 void setPolygonPatternRotation(
const double& angle);
279 void setPolygonPatternOpacity(
int opacity);
285 void setPolygonContourWidth(
int w);
287 void setPolygonContourPatternRotation(
const double& angle);
289 void setPolygonContourPatternOpacity(
int opacity);
293 void setPolygonContourDashStyle(
const std::vector<double>& style);
301 void setNormalMode();
323 void drawText(
const QPoint& p,
324 const std::string& txt,
344 te::gm::Polygon* getTextBoundary(
const QPoint& p,
const std::string& txt,
float angle = 0.0,
357 QPixmap* getPixmap()
const;
368 QImage* getImage()
const;
379 QPaintDevice* getDevice()
const;
387 void setDevice(QPaintDevice* device,
bool takeOwnerShip);
404 void setRenderHint(QPainter::RenderHint hint,
bool on =
true);
444 void setLineDashStyle(QPen& pen,
const std::vector<double>& style);
452 void updateAlpha(QImage& img,
const int& opacity);
458 void createPointPatterns();
519 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_CANVAS_H
MultiLineString is a MultiCurve whose elements are LineStrings.
int m_ptWidth
The width for point markers and point pattern.
QColor m_bgColor
Canvas background color. Defaults: white fully transparent.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
FontWeight
Font weight for drawing text.
bool m_erase
used for erase operation.
QImage * m_ptImgRotated
The marker or pattern already with rotation used to draw points.
int m_polyPatternWidth
The width used to draw marker or pattern.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
std::map< std::string, QPixmap * > m_patterns
The pixmap styles used to draw patterns.
QImage * m_ptImg
The marker or pattern used to point.
QPen m_polyContourPen
The pen used to draw contour polygon.
QColor m_polyContourColor
The color used to draw polygon contour.
A canvas is an abstraction of a drawing area.
int m_txtLetterSpacing
Text letter spacing.
bool m_txtContourEnabled
The flag indicates whether the outline of the text should be drawn.
int m_txtWordSpacing
Text word spacing.
QPen m_lnPen
The pen used to draw lines.
QImage * m_ptSelectionPatternImg
The marker or pattern used to show selection status. The color is mixed with point pattern...
AlignType
This enum contains values to control the alignment of components (like Canvas and MapDisplay)...
QImage * m_polyRotatedImage
The pattern rotated image used to fill polygon.
HorizontalAlignment
Horizontal alignment for drawing text.
ImageType
This enum specifies the possible input and output image formats supported by the canvas API...
QColor m_lnColor
The color used to draw lines.
LineString is a curve with linear interpolation between points.
QBrush m_polyBrush
The brush used to fill polygon.
MultiPolygon is a MultiSurface whose elements are Polygons.
QImage * m_polyImage
The pattern image used to fill polygon.
LineJustification
Line justification for drawing multi line text.
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
LineCapStyle
This enum encodes enumerated values telling how line strings should be capped (at the two ends of the...
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
A canvas built on top of Qt.
A point with x and y coordinate values.
QFont m_font
The text font.
A Text may contain 1 or more Text Elements.
QPen m_ptPen
The pen used to draw points.
QColor m_ptColorFrom
Indicates the color that originated the pattern that shows the status of selection. Used for optmization.
int m_ptHOffset
Horizontal offset in pixels (in device coordinate) applied to point pattern or marker.
int m_ptVOffset
Vertical offset in pixels (in device coordinate) applied to point pattern or marker.
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
It is a collection of other geometric objects.
QPointF m_pt
Point buffer to avoid creating another point instance.
double m_ptRotation
The point pattern rotation.
int m_txtLineSpacing
Text multi line spacing.
bool m_isDeviceOwner
Tells if canvas is the owner of the paint device.
LineDashStyle
This enum encodes enumerated values telling how lines should be drawn. e.g. as a plain line or dash l...
An abstract class for raster data strucutures.
MultiPoint is a GeometryCollection whose elements are restricted to points.
QPainter m_painter
The painter used to draw geometric objects.
FontStyle
Font style for drawing text.
QColor m_polyColor
The color used to fill polygon (solid, marker or pattern).
QColor m_ptColor
The color used to draw point (pixel) or marker.
An Envelope defines a 2D rectangular region.
VerticalAlignment
Vertical alignment for drawing text.
QMatrix m_matrix
Matrix that transforms the world coordinate to device coordinate.
QBrush m_txtBrush
The brush used to draw texts.
LineJoinStyle
This enum encodes enumerated values telling how line strings should be joined (between line segments)...
QPen m_txtContourPen
The pen used to draw the text contour.
QImage * m_ptClearPatternImg
The marker or pattern used to clear (erase point).