Go to the documentation of this file.
26 #ifndef __TERRALIB_MAPTOOLS_INTERNAL_CANVAS_H
27 #define __TERRALIB_MAPTOOLS_INTERNAL_CANVAS_H
30 #include "../color/RGBAColor.h"
31 #include "../se/Font.h"
36 #include <boost/noncopyable.hpp>
50 class GeometryCollection;
52 class MultiLineString;
92 class Canvas :
public boost::noncopyable
124 virtual void setWindow(
const double& llx,
const double& lly,
125 const double& urx,
const double& ury) = 0;
292 virtual void save(
const char* fileName,
ImageType t,
int quality = 75,
int fg = 0)
const = 0;
405 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;
503 const std::string& txt,
505 double anchorX = 0.5,
double anchorY = 0.5,
506 int displacementX = 0,
int displacementY = 0) = 0;
522 const std::string& txt,
524 double anchorX = 0.5,
double anchorY = 0.5,
525 int displacementX = 0,
int displacementY = 0) = 0;
541 virtual void drawText(
const double& x,
const double& y,
542 const std::string& txt,
544 double anchorX = 0.5,
double anchorY = 0.5,
545 int displacementX = 0,
int displacementY = 0) = 0;
566 const std::string& txt,
568 double anchorX = 0.5,
double anchorY = 0.5,
569 int displacementX = 0,
int displacementY = 0) = 0;
589 const std::string& txt,
591 double anchorX = 0.5,
double anchorY = 0.5,
592 int displacementX = 0,
int displacementY = 0) = 0;
613 const std::string& txt,
615 double anchorX = 0.5,
double anchorY = 0.5,
616 int displacementX = 0,
int displacementY = 0) = 0;
1026 #endif // __TERRALIB_MAPTOOLS_INTERNAL_CANVAS_H
virtual void setPolygonPatternRotation(const double &angle)=0
It sets the polygon pattern rotation.
virtual void setLinePattern(char *pattern, std::size_t size, ImageType t)=0
It sets the line pattern using a buffered image.
An Envelope defines a 2D rectangular region.
MultiPoint is a GeometryCollection whose elements are restricted to points.
virtual void setTextContourEnabled(bool b)=0
It controls the display of the text outline.
virtual void setTextMultiLineSpacing(int spacing)=0
It sets the multi line text spacing.
virtual int getHeight() const =0
It returns the canvas height.
virtual void setLinePattern(te::color::RGBAColor **pattern, int ncols, int nrows)=0
It sets the line pattern.
virtual void setTextPointSize(double size)=0
It sets the text point Size.
virtual void clear()=0
It clears the canvas content and fills with the background color.
virtual void setTextContourColor(const te::color::RGBAColor &color)=0
It sets the text contour (outline) drawing color.
LineJoinStyle
This enum encodes enumerated values telling how line strings should be joined (between line segments)...
virtual void setPolygonContourDashStyle(LineDashStyle style)=0
It sets the polygon contour dash style.
virtual const te::gm::Envelope & getWindow() const =0
It gets the world (or window) coordinates area (supposing a cartesian reference system).
virtual 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)=0
It draws a text.
virtual void drawImage(te::color::RGBAColor **src, int w, int h)=0
It draws the src image over the canvas.
virtual void setPolygonContourPatternRotation(const double &angle)=0
It sets the polygon contour pattern rotation.
AlignType
This enum contains values to control the alignment of components (like Canvas and MapDisplay).
An abstract class for raster data strucutures.
virtual void setPolygonFillPattern(char *pattern, std::size_t size, ImageType t)=0
It sets the polygon fill pattern using a buffered image.
virtual void setPolygonContourJoinStyle(LineJoinStyle style)=0
It sets the polygon contour join style.
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).
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-b...
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).
virtual void draw(const te::gm::Polygon *poly)=0
It draws the polygon on canvas.
virtual void setTextContourOpacity(int opacity)=0
It sets the text contour opacity.
FontStyleType
It defines the style to use for a font.
virtual void draw(const te::gm::MultiPoint *mpoint)=0
It draws the MultiPoint on canvas.
virtual void setLineDashStyle(LineDashStyle style)=0
It sets the line dash style.
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.
virtual void setPointPattern(char *pattern, std::size_t size, ImageType t)=0
It sets the point pattern using a buffered image.
It is a collection of other geometric objects.
virtual void setPointPatternOpacity(int opacity)=0
It sets the point pattern opacity.
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,...
virtual void setPolygonContourDashStyle(const std::vector< double > &style)=0
It sets the polygon contour dash style to the given pattern.
Polygon is a subclass of CurvePolygon whose rings are defined by linear rings.
virtual void drawImage(char *src, std::size_t size, ImageType t)=0
It draws the src image over the canvas.
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 ref...
virtual void setEraseMode()=0
It sets the painter to erase mode.
virtual void setTextColor(const te::color::RGBAColor &color)=0
It sets the text drawing color.
virtual int getWidth() const =0
It returns the canvas width.
virtual void setPolygonFillPattern(te::color::RGBAColor **pattern, int ncols, int nrows)=0
It sets the polygon fill pattern.
virtual void setTextDecorationWidth(int width)=0
It sets the width for drawing text decoration.
virtual void draw(const te::gm::MultiLineString *mline)=0
It draws the MultiLineString on canvas.
Enumerations of XML module.
virtual void setTextUnderline(bool b)=0
It sets the text underline flag.
virtual void setLineCapStyle(LineCapStyle style)=0
It sets the line cap style.
LineCapStyle
This enum encodes enumerated values telling how line strings should be capped (at the two ends of the...
virtual void setPointPatternRotation(const double &angle)=0
It sets the point pattern rotation. Rotation is made from the center of the pattern.
virtual void setLineDashStyle(const std::vector< double > &style)=0
It sets the line dash style to the given pattern.
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
virtual void setPolygonContourColor(const te::color::RGBAColor &color)=0
It sets the pen color used to draw the boundary of polygon geometries.
virtual void setLinePatternOpacity(int opacity)=0
It sets the line pattern opacity.
LineDashStyle
This enum encodes enumerated values telling how lines should be drawn. e.g. as a plain line or dash l...
virtual void setPolygonContourWidth(int w)=0
It sets the polygon contour width.
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.
virtual void setTextDecorationColor(const te::color::RGBAColor &color)=0
It sets the text color for drawing text decoration.
FontWeightType
It gives the amount of weight or boldness to use for a font.
virtual void draw(const te::gm::MultiSurface *g)=0
It draws the MultiSurface on canvas.
virtual void freeImage(char *img) const =0
This is the method that you should use to release an image generated by the canvas.
virtual 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)=0
It returns the text boundary (its enclose rectangle).
virtual void setTextStyle(te::se::Font::FontStyleType style)=0
It sets the text style.
virtual void setLineWidth(int w)=0
It sets the line width.
virtual void setPolygonFillColor(const te::color::RGBAColor &color)=0
It sets the color used to fill the draw of polygon geometries.
MultiPolygon is a MultiSurface whose elements are Polygons.
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.
virtual void setTextOpacity(int opacity)=0
It sets the text opacity.
A canvas is an abstraction of a drawing area.
virtual void setTextStrikeOut(bool b)=0
It sets the text strike out flag.
virtual void setPointPattern(te::color::RGBAColor **pattern, int ncols, int nrows)=0
It sets the point pattern.
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, ...).
virtual void setTextWeight(te::se::Font::FontWeightType weight)=0
It sets the text weight.
LineString is a curve with linear interpolation between points.
virtual void setNormalMode()=0
It sets the painter to normal copy source to destination mode.
virtual 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)=0
It draws a text.
virtual void draw(const te::gm::MultiPolygon *mpoly)=0
It draws the MultiPolygon on canvas.
virtual 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)=0
It returns the text boundary (its enclose rectangle).
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,...
virtual void setPolygonPatternWidth(int w)=0
It sets the polygon pattern width.
virtual void drawPixel(int x, int y, const te::color::RGBAColor &color)=0
It sets a pixel to a particular color.
virtual 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)=0
It draws a text.
virtual void setFontFamily(const std::string &family)=0
It sets the text font family.
virtual void setBackgroundColor(const te::color::RGBAColor &color)=0
It sets the canvas background color.
virtual void setLineJoinStyle(LineJoinStyle style)=0
It sets the line join style.
virtual void setTextOverline(bool b)=0
It sets the text overline flag.
virtual 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)=0
It returns the text boundary (its enclose rectangle).
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
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.
virtual void setTextStretch(std::size_t stretch)=0
It sets the text stretch.
virtual void draw(const te::gm::Geometry *geom)=0
It draws the geometry on canvas.
virtual void setLinePatternRotation(const double &angle)=0
It sets the line pattern rotation. Rotation is made from the center of the pattern.
virtual te::color::RGBAColor getBackgroundColor() const =0
It returns the canvas background color.
virtual void setPolygonContourPatternOpacity(int opacity)=0
It sets the polygon contour pattern opacity.
virtual void draw(const te::gm::Point *point)=0
It draws the point on canvas.
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).
virtual void setTextJustification(int justType)=0
It sets the text justification for multi line text.
ImageType
This enum specifies the possible input and output image formats supported by the canvas API.
virtual ~Canvas()
Virtual destructor.
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.
Proxy configuration file for TerraView (see terraview_config.h).
MultiLineString is a MultiCurve whose elements are LineStrings.
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,...
virtual void setTextContourWidth(int width)=0
It sets the text contour width.
virtual void draw(const te::gm::LineString *line)=0
It draws the LineString on canvas.
virtual void resize(int w, int h)=0
It adjusts the canvas size (width and height).
Geometry is the root class of the geometries hierarchy, it follows OGC and ISO standards.
virtual void draw(const te::gm::GeometryCollection *g)=0
It draws the GeometryCollection on canvas.
virtual void setPolygonPatternOpacity(int opacity)=0
It sets the polygon pattern opacity.
virtual void setPolygonContourCapStyle(LineCapStyle style)=0
It sets the polygon contour cap style.
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 ref...
virtual void setPointColor(const te::color::RGBAColor &color)=0
It sets the point drawing color.
A point with x and y coordinate values.
virtual void setLineColor(const te::color::RGBAColor &color)=0
It sets the pen color used to draw line geometries.
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.
virtual void setPointWidth(int w)=0
It sets the point width. If point has a patterns, this pattern is scaled to width.
virtual void drawPixel(int x, int y)=0
It sets a pixel using the point pen.
MultiSurface is a class that represents a 2-dimensional GeometryCollection whose elements are surface...