This simple example shows also some basic usage of a Board2D to export graphical representations of dgtal objects (here, a digital set and a digital object). Note also the use of different modes that may be defined for some classes. An object may thus be displayed just as a set of points, but also as a set of points with neighborhood structure (a graph).
visualization of resulting export (first export dgtalBoard2D-2-sets-1).
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/boards/Board2D.h"
#include "DGtal/shapes/Shapes.h"
#include "DGtal/helpers/StdDefs.h"
{
trace.beginBlock (
"Example dgtalBoard2D-2-sets" );
shape_set.erase(
Point( -5, -1 ) );
shape_set.erase(
Point( 5, 1 ) );
board.
saveSVG(
"dgtalBoard2D-2-sets-1.svg");
board.
saveEPS(
"dgtalBoard2D-2-sets-1.eps");
board.
saveTikZ(
"dgtalBoard2D-2-sets-1.tikz");
#ifdef DGTAL_WITH_CAIRO
#endif
Object4_8 shape( dt4_8, shape_set );
<<
SetMode( shape.className(),
"DrawAdjacencies" )
<< shape;
board.
saveSVG(
"dgtalBoard2D-2-sets-2.svg");
board.
saveEPS(
"dgtalBoard2D-2-sets-2.eps");
board.
saveTikZ(
"dgtalBoard2D-2-sets-2.tikz");
#ifdef DGTAL_WITH_CAIRO
#endif
Object8_4 shape2( dt8_4, shape_set );
<<
SetMode( shape2.className(),
"DrawAdjacencies" )
<< shape2;
board.
saveSVG(
"dgtalBoard2D-2-sets-3.svg");
board.
saveEPS(
"dgtalBoard2D-2-sets-3.eps");
board.
saveTikZ(
"dgtalBoard2D-2-sets-3.tikz");
#ifdef DGTAL_WITH_CAIRO
#endif
return 0;
}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
static void addNorm1Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void clear(const DGtal::Color &color=DGtal::Color::None)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Z2i this namespace gathers the standard of types for 2D imagery.
DGtal is the top-level namespace which contains all DGtal functions and types.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
HyperRectDomain< Space > Domain
Z2i::DigitalSet DigitalSet