DGtal  1.5.beta
testViewer3D.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/io/viewers/Viewer3D.h"
34 #include "DGtal/io/DrawWithDisplay3DModifier.h"
35 #include "DGtal/io/Color.h"
36 #include "DGtal/helpers/StdDefs.h"
37 #include "DGtal/shapes/Shapes.h"
39 
40 using namespace std;
41 using namespace DGtal;
42 using namespace Z3i;
43 
45 // Functions for testing class Viewer3D.
47 
48 
50 // Standard services - public :
51 
52 int main( int argc, char** argv )
53 {
54 
55  QApplication application(argc,argv);
56  Viewer3D<> viewer;
57  viewer.setWindowTitle("simpleViewer");
58  viewer.show();
59 
60 
61  trace.beginBlock ( "Testing class for Viewer3D" );
62 
63 
64  Point p1( 14, 14, 14 );
65  Point p2( 27, 27, 27 );
66  Domain domain( p1, p2 );
67 
68  viewer << CustomColors3D(Color(20, 20, 20, 50),Color(20, 0,250,30));
69  viewer << SetMode3D(domain.className(), "Grid");
70  viewer << domain;
71 
72  DigitalSet shape_set( domain );
73  Shapes<Domain>::addNorm1Ball( shape_set, Point( 13, 23, 13 ), 7 );
74  viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 50));
75 
76  viewer << shape_set ;
77  DigitalSet shape_set2( domain );
78  Shapes<Domain>::addNorm1Ball( shape_set2, Point( 24, 15, 12 ), 12 );
79  viewer << shape_set2 ;
80 
81  DigitalSet shape_set3( domain );
82  Shapes<Domain>::addNorm2Ball( shape_set3, Point( 11, 15, 12 ), 12 );
83  viewer << CustomColors3D(Color(250, 20,0, 190),Color(220, 20,20, 250));
84  viewer << shape_set3 ;
85 
86 
87 
88 
89  Point pp1( -1, -1, -2 );
90  Point pp2( 2, 2, 3 );
91 
92 
93  Domain domain2( pp1, pp2 );
94  Point pp3( 1, 1, 1 );
95  Point pp4( 2, -1, 5 );
96  Point pp5( -1, 2, 3 );
97  Point pp6( 0, 0, 0 );
98  Point pp0( 0, 2, 1 );
99 
100  //viewer<< m;
101  viewer << SetMode3D( pp1.className(), "Paving" );
102  viewer << pp1 << pp2 << pp3;
103 
104  //viewer << SetMode3D( pp1.className(), "Grid" );
105  viewer << CustomColors3D(Color(250, 0,0),Color(250, 0,0));
106  viewer << SetMode3D( pp1.className(), "PavingWired" );
107  viewer << pp4 << pp5 ;
108  viewer << SetMode3D( pp1.className(), "Both" );
109  viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 0,0, 100));
110  viewer << pp6;
111  viewer << CustomColors3D(Color(250, 200,0, 100),Color(250, 200,0, 20));
112  viewer << pp0;
113 
114 
115  viewer << SetMode3D(domain.className(), "Paving");
116  viewer << domain2 << Display3D<Space, KSpace>::updateDisplay;
117 
118 
119  bool res = application.exec();
120  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
121  trace.endBlock();
122  return res ? 0 : 1;
123 
124 
125 }
126 // //
128 
Structure representing an RGB triple with alpha component.
Definition: Color.h:68
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
std::string className() const
std::string className() const
Aim: A utility class for constructing different shapes (balls, diamonds, and others).
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
double endBlock()
virtual void show()
Overload QWidget method in order to add a call to updateList() method (to ensure that the lists are w...
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
Modifier class in a Display3D stream. Useful to choose your own mode for a given class....
MyPointD Point
Definition: testClone2.cpp:383
Domain domain
int main(int argc, char **argv)