DGtal  1.5.beta
LibBoard::Transform Struct Referenceabstract

base class for transforms. More...

#include <Board/Transforms.h>

Inheritance diagram for LibBoard::Transform:
[legend]

Public Member Functions

 Transform ()
 
virtual ~Transform ()
 
virtual double mapX (double x) const
 
virtual double mapY (double y) const =0
 
virtual void apply (double &x, double &y) const
 
virtual double scale (double x) const
 
virtual double rounded (double x) const
 
virtual void setBoundingBox (const Rect &rect, const double pageWidth, const double pageHeight, const double margin)=0
 

Static Public Member Functions

static double round (const double &x)
 

Protected Attributes

double _scale
 
double _deltaX
 
double _deltaY
 
double _height
 

Detailed Description

base class for transforms.

The base class for transforms.

Definition at line 31 of file Transforms.h.

Constructor & Destructor Documentation

◆ Transform()

LibBoard::Transform::Transform ( )
inline

◆ ~Transform()

virtual LibBoard::Transform::~Transform ( )
inlinevirtual

Definition at line 34 of file Transforms.h.

34 { };

Member Function Documentation

◆ apply()

void LibBoard::Transform::apply ( double &  x,
double &  y 
) const
virtual

Definition at line 51 of file Transforms.cpp.

52 {
53  x = mapX( x );
54  y = mapY( y );
55 }
virtual double mapX(double x) const
Definition: Transforms.cpp:39
virtual double mapY(double y) const =0

References mapX(), and mapY().

◆ mapX()

double LibBoard::Transform::mapX ( double  x) const
virtual

Definition at line 39 of file Transforms.cpp.

40 {
41  return rounded( x * _scale + _deltaX );
42 }
virtual double rounded(double x) const
Definition: Transforms.cpp:33

References _deltaX, _scale, and rounded().

Referenced by apply().

◆ mapY()

virtual double LibBoard::Transform::mapY ( double  y) const
pure virtual

◆ round()

◆ rounded()

double LibBoard::Transform::rounded ( double  x) const
virtual

Reimplemented in LibBoard::TransformCairo, LibBoard::TransformSVG, and LibBoard::TransformFIG.

Definition at line 33 of file Transforms.cpp.

34 {
35  return Transform::round( 1000000*x ) / 1000000;
36 }
static double round(const double &x)

References round().

Referenced by mapX(), LibBoard::TransformEPS::mapY(), and scale().

◆ scale()

double LibBoard::Transform::scale ( double  x) const
virtual

Definition at line 45 of file Transforms.cpp.

46 {
47  return rounded( x * _scale );
48 }

References _scale, and rounded().

◆ setBoundingBox()

virtual void LibBoard::Transform::setBoundingBox ( const Rect rect,
const double  pageWidth,
const double  pageHeight,
const double  margin 
)
pure virtual

Field Documentation

◆ _deltaX

◆ _deltaY

◆ _height

◆ _scale


The documentation for this struct was generated from the following files: