DGtal  0.9.3
Functions
testViewer3D.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 testViewer3D.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
Bertrand Kerautret (kerau.nosp@m.tre@.nosp@m.loria.nosp@m..fr ) LORIA (CNRS, UMR 7503), University of Nancy, France
Date
2011/01/03

Functions for testing class Viewer3D.

This file is part of the DGtal library.

Definition in file testViewer3D.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 68 of file testViewer3D.cpp.

References DGtal::Trace::beginBlock(), DGtal::HyperRectDomain< TSpace >::className(), DGtal::PointVector< dim, TEuclideanRing, TContainer >::className(), domain(), DGtal::Trace::emphase(), DGtal::Trace::endBlock(), DGtal::Viewer3D< Space, KSpace >::show(), and DGtal::trace.

69 {
70 
71  QApplication application(argc,argv);
72  Viewer3D<> viewer;
73  viewer.setWindowTitle("simpleViewer");
74  viewer.show();
75 
76 
77  trace.beginBlock ( "Testing class for Viewer3D" );
78 
79 
80  Point p1( 14, 14, 14 );
81  Point p2( 27, 27, 27 );
82  Domain domain( p1, p2 );
83 
84  viewer << CustomColors3D(Color(20, 20, 20, 50),Color(20, 0,250,30));
85  viewer << SetMode3D(domain.className(), "Grid");
86  viewer << domain;
87 
88  DigitalSet shape_set( domain );
89  Shapes<Domain>::addNorm1Ball( shape_set, Point( 13, 23, 13 ), 7 );
90  viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 50));
91 
92  viewer << shape_set ;
93  DigitalSet shape_set2( domain );
94  Shapes<Domain>::addNorm1Ball( shape_set2, Point( 24, 15, 12 ), 12 );
95  viewer << shape_set2 ;
96 
97  DigitalSet shape_set3( domain );
98  Shapes<Domain>::addNorm2Ball( shape_set3, Point( 11, 15, 12 ), 12 );
99  viewer << CustomColors3D(Color(250, 20,0, 190),Color(220, 20,20, 250));
100  viewer << shape_set3 ;
101 
102 
103 
104 
105  Point pp1( -1, -1, -2 );
106  Point pp2( 2, 2, 3 );
107 
108 
109  Domain domain2( pp1, pp2 );
110  Point pp3( 1, 1, 1 );
111  Point pp4( 2, -1, 5 );
112  Point pp5( -1, 2, 3 );
113  Point pp6( 0, 0, 0 );
114  Point pp0( 0, 2, 1 );
115 
116  //viewer<< m;
117  viewer << SetMode3D( pp1.className(), "Paving" );
118  viewer << pp1 << pp2 << pp3;
119 
120  //viewer << SetMode3D( pp1.className(), "Grid" );
121  viewer << CustomColors3D(Color(250, 0,0),Color(250, 0,0));
122  viewer << SetMode3D( pp1.className(), "PavingWired" );
123  viewer << pp4 << pp5 ;
124  viewer << SetMode3D( pp1.className(), "Both" );
125  viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 0,0, 100));
126  viewer << pp6;
127  viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 20));
128  viewer << pp0;
129 
130 
131  viewer << SetMode3D(domain.className(), "Paving");
132  viewer << domain2 << Display3D<Space, KSpace>::updateDisplay;
133 
134 
135  bool res = application.exec();
136  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
137  trace.endBlock();
138  return res ? 0 : 1;
139 
140 
141 }
void beginBlock(const std::string &keyword="")
const Domain domain(Point(1, 2), Point(6, 5))
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()
std::ostream & emphase()
std::string className() const
MyPointD Point
Definition: testClone2.cpp:383
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
Modifier class in a Display3D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithDisplay3D.

◆ testViewer3D()

bool testViewer3D ( )

Example of a test. To be completed.

Definition at line 51 of file testViewer3D.cpp.

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

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