DGtal  1.5.beta
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

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 52 of file testViewer3D.cpp.

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 }
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
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...
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

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