DGtal 2.1.0
Loading...
Searching...
No Matches
fileGridCurveRanges.cpp File Reference

An example of reading and displaying a gridcurve and its ranges. More...

#include <iostream>
#include <fstream>
#include <algorithm>
#include "DGtal/base/Common.h"
#include "DGtal/helpers/StdDefs.h"
#include "ConfigExamples.h"
#include "DGtal/io/boards/Board2D.h"
Include dependency graph for fileGridCurveRanges.cpp:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

An example of reading and displaying a gridcurve and its ranges.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Tristan Roussillon (trist.nosp@m.an.r.nosp@m.oussi.nosp@m.llon.nosp@m.@liri.nosp@m.s.cn.nosp@m.rs.fr)
Date
2010/10/17

This file is part of the DGtal library.

Definition in file fileGridCurveRanges.cpp.

Function Documentation

◆ main()

int main ( void  )

[fileGridCurveRanges-declaration]

[fileGridCurveRanges-declaration]

[fileGridCurveRanges-ex]

[fileGridCurveRanges-ex]

[fileGridCurveRanges-read]

[fileGridCurveRanges-read]

[fileGridCurveRanges-board]

[fileGridCurveRanges-board]

[fileGridCurveRanges-displayCurve]

[fileGridCurveRanges-displayCurve]

[fileGridCurveRanges-displayInnerPoints]

[fileGridCurveRanges-displayInnerPoints]

[fileGridCurveRanges-displayIncidentPoints]

[fileGridCurveRanges-displayIncidentPoints]

Definition at line 51 of file fileGridCurveRanges.cpp.

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}
Aim: This class specializes a 'Board' class so as to display DGtal objects more naturally (with <<)....
Definition Board2D.h:71
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition GridCurve.h:173
bool initFromVectorStream(std::istream &in)
void saveEPS(const char *filename, PageSize size=Board::BoundingBox, double margin=10.0) const
Definition Board.cpp:804
Modifier class in a Board2D stream. Useful to choose your own mode for a given class....
Definition Board2D.h:247

References DGtal::HyperRectDomain< TSpace >::className(), DGtal::GridCurve< TKSpace >::getIncidentPointsRange(), DGtal::GridCurve< TKSpace >::getInnerPointsRange(), DGtal::GridCurve< TKSpace >::initFromVectorStream(), and LibBoard::Board::saveEPS().