DGtal  1.5.beta
test3DDomain2DView.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "ConfigTest.h"
34 #include "DGtal/helpers/StdDefs.h"
35 #include "DGtal/io/viewers/Viewer3D.h"
36 
38 
39 using namespace std;
40 using namespace DGtal;
41 using namespace Z3i;
42 
44 // Standard services - public :
45 
46 int main( int argc, char** argv )
47 {
48 
49 
50 
51  QApplication application(argc,argv);
52  Viewer3D<> viewer;
53  viewer.setWindowTitle("simpleViewer");
54  viewer.show();
55  trace.beginBlock ( "Testing class 3DDomain2DView" );
56 
57  Z2i::Point p1( 0, 0 );
58  Z2i::Point p2( 10, 15 );
59 
60  Z3i::Point p13D( 0, 0, 0 );
61  Z3i::Point p23D( 10, 15, 0 );
62 
63  Z3i::Point p13Dt( 20, 20, 20 );
64  Z3i::Point p23Dt( 30, 35, 20 );
65 
66  Z3i::Point p13Dtt( 40, 20, 20 );
67  Z3i::Point p23Dtt( 50, 35, 20 );
68 
69  HyperRectDomain<Z2i::Space> dom ( p1,p2 );
70  HyperRectDomain<Z2i::Space> dom2 ( p1,p2 );
71  HyperRectDomain<Z2i::Space> dom3 ( p1,p2 );
72 
73  HyperRectDomain<Z2i::Space> dom4 ( p1,p2 );
74  HyperRectDomain<Z2i::Space> dom5 ( p1,p2 );
75  HyperRectDomain<Z2i::Space> dom6 ( p1,p2 );
76 
77  HyperRectDomain<Z2i::Space> dom7 ( p1,p2 );
78  HyperRectDomain<Z2i::Space> dom8 ( p1,p2 );
79  HyperRectDomain<Z2i::Space> dom9 ( p1,p2 );
80 
81  viewer << p13D << p23D << p13Dt << p23Dt << p13Dtt << p23Dtt;
82  viewer << dom << dom2 << dom3;
83  viewer << SetMode3D( dom4.className(), "Grid" );
84  viewer << dom4 << dom5 << dom6;
85  viewer << SetMode3D( dom4.className(), "Grid" );
86  viewer << dom7 << dom8 << dom9;
87 
88  viewer << Update2DDomainPosition<Space, KSpace>(0, Viewer3D<Space, KSpace>::xDirection, 0, 0, 0);
89  viewer << Update2DDomainPosition<Space, KSpace>(1, Viewer3D<Space, KSpace>::yDirection, 0, 0, 0);
90  viewer << Update2DDomainPosition<Space, KSpace>(2, Viewer3D<Space, KSpace>::zDirection, 0, 0, 0);
91 
92  viewer << Update2DDomainPosition<Space, KSpace>(3, Viewer3D<Space, KSpace>::xDirection, 0, 0, 0);
93  viewer << Update2DDomainPosition<Space, KSpace>(4, Viewer3D<Space, KSpace>::yDirection, 0, 0, 0);
94  viewer << Update2DDomainPosition<Space, KSpace>(5, Viewer3D<Space, KSpace>::zDirection, 0, 0, 0);
95 
96  viewer << Update2DDomainPosition<Space, KSpace>(6, Viewer3D<Space, KSpace>::xDirection, 0, 0, 0);
97  viewer << Update2DDomainPosition<Space, KSpace>(7, Viewer3D<Space, KSpace>::yDirection, 0, 0, 0);
98  viewer << Update2DDomainPosition<Space, KSpace>(8, Viewer3D<Space, KSpace>::zDirection, 0, 0, 0);
99 
100  viewer << DGtal::Translate2DDomain(3, 20, 20 ,20);
101  viewer << DGtal::Translate2DDomain(4, 20, 20 ,20);
102  viewer << DGtal::Translate2DDomain(5, 20, 20 ,20);
103 
104  viewer << DGtal::Translate2DDomain(6, 40, 20 ,20);
105  viewer << DGtal::Translate2DDomain(7, 40, 20 ,20);
106  viewer << DGtal::Translate2DDomain(8, 40, 20 ,20);
107 
108  viewer << Viewer3D<>::updateDisplay;
109 
110  bool res = application.exec();
111  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
112  trace.endBlock();
113  return res ? 0 : 1;
114 }
115 // //
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
std::string className() const
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....
class to modify the data of an given image and also the possibility to translate it (optional).
int main(int argc, char **argv)