Public Types | Public Member Functions | Data Fields

DGtal::DGtalBoard Class Reference

Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<). The user has simply to declare a DGtalBoard object and uses stream operators to display most digital objects. Furthermore, one can use this class to modify the current style for drawing. More...

#include <DGtalBoard.h>

Inheritance diagram for DGtal::DGtalBoard:
Inheritance graph
[legend]
Collaboration diagram for DGtal::DGtalBoard:
Collaboration graph
[legend]

Public Types

typedef std::map< std::string,
CountedPtr
< DrawableWithDGtalBoard > > 
StyleMapping
typedef std::map< std::string,
std::string > 
ModeMapping
typedef LibBoard::Color Color
typedef LibBoard::Shape Shape

Public Member Functions

 ~DGtalBoard ()
 DGtalBoard (const DGtalBoard::Color &backgroundColor=DGtalBoard::Color::None)
 DGtalBoard (const DGtalBoard &other)
DGtalBoardoperator= (const DGtalBoard &other)
std::string getMode (const std::string &objectName) const
template<typename TDrawableWithDGtalBoard >
DGtalBoardoperator<< (const TDrawableWithDGtalBoard &object)
void selfDisplay (std::ostream &out) const
bool isValid () const

Data Fields

DomainDrawMode myDomainDrawMode
bool myDrawObjectAdjacencies
StyleMapping myStyles
ModeMapping myModes

Detailed Description

Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<). The user has simply to declare a DGtalBoard object and uses stream operators to display most digital objects. Furthermore, one can use this class to modify the current style for drawing.

Description of class 'DGtalBoard'

Examples:

dgtalboard-1-points.cpp, dgtalboard-2-sets.cpp, dgtalboard-3-custom-classes.cpp, dgtalboard-3-custom-points.cpp, dgtalboard-4-colormaps.cpp, dgtalboard-5-greedy-dss.cpp, distancetransform2D.cpp, and DSS.cpp.


Member Typedef Documentation

typedef std::map< std::string, std::string > DGtal::DGtalBoard::ModeMapping

The associated map type for storing possible modes used for displaying for digital objects.

The associated map type for storing the default styles of digital objects.


Constructor & Destructor Documentation

DGtal::DGtalBoard::~DGtalBoard (  ) 

Destructor.

DGtal::DGtalBoard::DGtalBoard ( const DGtalBoard::Color backgroundColor = DGtalBoard::Color::None  ) 

Constructs a new board and sets the background color, if any.

Parameters:
backgroundColor A color for the drawing's background.

References LibBoard::Board::setUnit(), and LibBoard::Board::UCentimeter.

DGtal::DGtalBoard::DGtalBoard ( const DGtalBoard other  ) 

Copy constructor.

Parameters:
other The object to be copied.

Member Function Documentation

std::string DGtal::DGtalBoard::getMode ( const std::string &  objectName  )  const
Parameters:
objectName the name of the object (generally obtained with a 'object.styleName()').
Returns:
the current mode for the given object name or "" if no specific mode has been set.
bool DGtal::DGtalBoard::isValid (  )  const

Checks the validity/consistency of the object.

Returns:
'true' if the object is valid, 'false' otherwise.
template<typename TDrawableWithDGtalBoard >
DGtalBoard& DGtal::DGtalBoard::operator<< ( const TDrawableWithDGtalBoard &  object  ) 

Draws the drawable [object] in this board. It should satisfy the concept CDrawableWithDGtalBoard, which requires for instance a method selfDraw( DGtalBoard & ).

Parameters:
object any drawable object.
Returns:
a reference on 'this'.
DGtal::DGtalBoard & DGtal::DGtalBoard::operator= ( const DGtalBoard other  ) 

Assignment.

Parameters:
other the object to copy.
Returns:
a reference on 'this'.

References myDomainDrawMode, myDrawObjectAdjacencies, and myStyles.

void DGtal::DGtalBoard::selfDisplay ( std::ostream &  out  )  const

Writes/Displays the object on an output stream.

Parameters:
out the output stream where the object is written.

Field Documentation

Deprecated:
Since:
2010/11/8
See also:
myModes

Referenced by operator=().

Deprecated:
Since:
2010/11/8
See also:
myModes

Referenced by operator=().

May associate a current mode for a given class. myModes[ "HyperRectDomain" ] = "Paving".

Next display of a HyperRectDomain object will used the mode "Paving". Modes may only be used in objects implementing the concept CDrawableWithDGtalBoard.

Referenced by DGtal::DrawGridPixel::selfDraw(), DGtal::DrawPavingPixel::selfDraw(), DGtal::DrawObjectAdjacencies::selfDraw(), DGtal::DrawDomainPaving::selfDraw(), DGtal::DrawDomainGrid::selfDraw(), DGtal::SetMode::selfDraw(), DGtal::DrawDSSPoints::selfDraw(), and DGtal::DrawDSSBoundingBox::selfDraw().

For instance, may associate a new style object T1 to the class "HyperRectDomain": myStyles[ "HyperRectDomain" ] = T1.

One can also store a new style T2 for a specific mode used for drawing a class: myStyles[ "HyperRectDomain/Paving" ] = T2.

Modes may only be used in objects implementing the concept CDrawableWithDGtalBoard.

Referenced by operator=(), and DGtal::CustomStyle::selfDraw().


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