DGtal  0.9.2
fileGridCurveRanges.cpp
1 
30 #include <iostream>
32 #include <fstream>
33 #include <algorithm>
35 
37 #include "DGtal/base/Common.h"
38 #include "DGtal/helpers/StdDefs.h"
39 #include "ConfigExamples.h"
41 
43 #include "DGtal/io/boards/Board2D.h"
45 
46 
47 using namespace DGtal;
48 
50 
51 int main()
52 {
53 
55  Z2i::Curve c;
57 
59  std::string square = examplesPath + "samples/smallSquare.dat";
61 
63  std::fstream inputStream;
64  inputStream.open (square.c_str(), std::ios::in);
65  c.initFromVectorStream(inputStream);
66  inputStream.close();
68 
70  DGtal::Board2D aBoard;
72 
73  //displaying domain
74  Z2i::Point low(-1,-1);
75  Z2i::Point up(3,3);
76  Z2i::Domain aDomain( low,up );
77  aBoard << SetMode(aDomain.className(), "Paving") << aDomain;
78 
80  aBoard << c;
81  aBoard.saveEPS("DisplayGridCurveTuto.eps");
83 
85  Z2i::Curve::InnerPointsRange r1 = c.getInnerPointsRange();
86  aBoard << r1;
88  aBoard.saveEPS("DisplayInnerPointsTuto.eps");
89 
91  Z2i::Curve::IncidentPointsRange r2 = c.getIncidentPointsRange();
92  aBoard << r2;
94  aBoard.saveEPS("DisplayIncidentPointsTuto.eps");
95 
96 
97  return 0;
98 
99 }
100 
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
bool initFromVectorStream(std::istream &in)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition: Board.cpp:805
Modifier class in a Board2D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithBoard2D.
Definition: Board2D.h:247
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition: GridCurve.h:172
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)...
Definition: Board2D.h:70