DGtal  0.9.3
Functions
testPolygon3D.cpp File Reference
#include <iostream>
#include "DGtal/base/Common.h"
#include "DGtal/io/viewers/Viewer3D.h"
#include "DGtal/io/DrawWithDisplay3DModifier.h"
#include "DGtal/io/Color.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/shapes/Shapes.h"
Include dependency graph for testPolygon3D.cpp:

Go to the source code of this file.

Functions

bool testViewer3D ()
 
int main (int argc, char **argv)
 

Detailed Description

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
David Coeurjolly
Date
2013/09/06

Functions for testing class Viewer3D.

This file is part of the DGtal library.

Definition in file testPolygon3D.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 66 of file testPolygon3D.cpp.

References DGtal::Display3D< Space, KSpace >::addPolygon(), DGtal::Trace::beginBlock(), DGtal::Display3D< Space, KSpace >::createNewPolygonList(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Viewer3D< Space, KSpace >::show(), and DGtal::trace.

67 {
68 
69  QApplication application(argc,argv);
70  Viewer3D<> viewer;
71  viewer.setWindowTitle("simpleViewer");
72  viewer.show();
73  trace.beginBlock ( "Testing Polygon 3D display in Viewer3D" );
74  std::vector<Z3i::RealPoint> polyg1;
75 
76  polyg1.push_back(Z3i::RealPoint(0,0,0));
77  polyg1.push_back(Z3i::RealPoint(0,1,0));
78  polyg1.push_back(Z3i::RealPoint(1,1,0));
79 
80  viewer.addPolygon(polyg1);
81 
82  viewer.createNewPolygonList("hop");
83 
84  std::vector<Z3i::RealPoint> polyg2;
85 
86  polyg2.push_back(Z3i::RealPoint(0,10,0));
87  polyg2.push_back(Z3i::RealPoint(0,11,0));
88  polyg2.push_back(Z3i::RealPoint(11,11,0));
89 
90  viewer.addPolygon(polyg2);
91 
92  viewer << Viewer3D<>::updateDisplay;
93 
94  bool res = application.exec();
95  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
96  trace.endBlock();
97  return res ? 0 : 1;
98 
99 
100 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:137
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
double endBlock()
void createNewPolygonList(std::string s="")
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
std::ostream & emphase()
void addPolygon(const std::vector< RealPoint > &vertices)

◆ testViewer3D()

bool testViewer3D ( )

Example of a test. To be completed.

Definition at line 49 of file testPolygon3D.cpp.

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), and DGtal::trace.

50 {
51  unsigned int nbok = 0;
52  unsigned int nb = 0;
53  trace.beginBlock ( "Testing block ..." );
54  nbok += true ? 1 : 0;
55  nb++;
56  trace.info() << "(" << nbok << "/" << nb << ") "
57  << "true == true" << std::endl;
58  trace.endBlock();
59 
60  return nbok == nb;
61 }
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:137
double endBlock()
std::ostream & info()