DGtal 1.3.0
Loading...
Searching...
No Matches
dgtalBoard2D-2-sets.cpp
Go to the documentation of this file.
1
46#include <iostream>
47#include "DGtal/base/Common.h"
48#include "DGtal/io/boards/Board2D.h"
49#include "DGtal/shapes/Shapes.h"
50#include "DGtal/helpers/StdDefs.h"
52
53using namespace std;
54using namespace DGtal;
55using namespace Z2i;
56
58
59int main( )
60{
61 trace.beginBlock ( "Example dgtalBoard2D-2-sets" );
62
63 Point p1( -10, -7 );
64 Point p2( 10, 7 );
65 Domain domain( p1, p2 );
66 DigitalSet shape_set( domain );
67 Shapes<Domain>::addNorm1Ball( shape_set, Point( -5, -1 ), 5 );
68 Shapes<Domain>::addNorm1Ball( shape_set, Point( 5, 1 ), 5 );
69 shape_set.erase( Point( -5, -1 ) );
70 shape_set.erase( Point( 5, 1 ) );
71
72 Board2D board;
73 board << domain << shape_set; // display domain and set
74 board.saveSVG( "dgtalBoard2D-2-sets-1.svg");
75 board.saveEPS( "dgtalBoard2D-2-sets-1.eps");
76 board.saveTikZ( "dgtalBoard2D-2-sets-1.tikz");
77
78#ifdef WITH_CAIRO
79 board.saveCairo("dgtalBoard2D-2-sets-1-cairo.pdf", Board2D::CairoPDF);
80 board.saveCairo("dgtalBoard2D-2-sets-1-cairo.png", Board2D::CairoPNG);
81 board.saveCairo("dgtalBoard2D-2-sets-1-cairo.ps", Board2D::CairoPS);
82 board.saveCairo("dgtalBoard2D-2-sets-1-cairo.svg", Board2D::CairoSVG);
83#endif
84
85 board.clear();
86
87 // Object with couple (4,8) of adjacency.
88 Object4_8 shape( dt4_8, shape_set );
89 board << domain // display domain
90 << SetMode( shape.className(), "DrawAdjacencies" )
91 << shape; // and object with mode "DrawAdjacencies"
92 board.saveSVG( "dgtalBoard2D-2-sets-2.svg");
93 board.saveEPS( "dgtalBoard2D-2-sets-2.eps");
94 board.saveTikZ( "dgtalBoard2D-2-sets-2.tikz");
95
96#ifdef WITH_CAIRO
97 board.saveCairo("dgtalBoard2D-2-sets-2-cairo.pdf", Board2D::CairoPDF);
98 board.saveCairo("dgtalBoard2D-2-sets-2-cairo.png", Board2D::CairoPNG);
99 board.saveCairo("dgtalBoard2D-2-sets-2-cairo.ps", Board2D::CairoPS);
100 board.saveCairo("dgtalBoard2D-2-sets-2-cairo.svg", Board2D::CairoSVG);
101#endif
102
103 board.clear();
104
105 // Object with couple (8,4) of adjacency.
106 Object8_4 shape2( dt8_4, shape_set );
107 board << domain // display domain
108 << SetMode( shape2.className(), "DrawAdjacencies" )
109 << shape2; // and object with mode "DrawAdjacencies"
110 board.saveSVG( "dgtalBoard2D-2-sets-3.svg");
111 board.saveEPS( "dgtalBoard2D-2-sets-3.eps");
112 board.saveTikZ( "dgtalBoard2D-2-sets-3.tikz");
113
114#ifdef WITH_CAIRO
115 board.saveCairo("dgtalBoard2D-2-sets-3-cairo.pdf", Board2D::CairoPDF);
116 board.saveCairo("dgtalBoard2D-2-sets-3-cairo.png", Board2D::CairoPNG);
117 board.saveCairo("dgtalBoard2D-2-sets-3-cairo.ps", Board2D::CairoPS);
118 board.saveCairo("dgtalBoard2D-2-sets-3-cairo.svg", Board2D::CairoSVG);
119#endif
120
121 trace.endBlock();
122 return 0;
123}
124// //
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition: Board2D.h:71
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
Definition: Object.h:120
std::string className() const
static void addNorm1Ball(TDigitalSet &aSet, const Point &aCenter, UnsignedInteger aRadius)
void beginBlock(const std::string &keyword="")
double endBlock()
void saveTikZ(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1219
void clear(const DGtal::Color &color=DGtal::Color::None)
Definition: Board.cpp:152
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
void saveSVG(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1012
void saveCairo(const char *filename, CairoType type=CairoPNG, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:1139
int main()
static const DT8_4 dt8_4
Definition: StdDefs.h:114
static const DT4_8 dt4_8
Definition: StdDefs.h:113
Space::Point Point
Definition: StdDefs.h:95
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:154
STL namespace.
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition: Board2D.h:247
Domain domain