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