DGtal 1.4.2
Loading...
Searching...
No Matches
Viewer3DFactory.ih
1/**
2 * This program is free software: you can redistribute it and/or modify
3 * it under the terms of the GNU Lesser General Public License as
4 * published by the Free Software Foundation, either version 3 of the
5 * License, or (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 *
15 **/
16
17/**
18 * @file Viewer3DFactory.ih
19 * @author Aline Martin <aline.martin@insa-lyon.fr>
20 * @date mardi 2 juillet 2013
21 *
22 * @brief
23 *
24 * Implementation of inline methods defined in Viewer3DFactory.h
25 *
26 * This file is part of the DGtal library.
27 */
28
29#include <string>
30
31#include "DGtal/helpers/StdDefs.h"
32#include "DGtal/images/ImageHelper.h"
33#include "DGtal/io/Display3DFactory.h"
34
35
36///////////////////////////////////////////////////////////////////////////////
37// Implementation of inline methods //
38
39
40///////////////////////////////////////////////////////////////////////////////
41// Implementation of inline functions and external operators //
42
43template <typename Space, typename KSpace>
44inline
45void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
46 const DGtal::CameraPosition & cp )
47{
48 viewer.setCameraPosition(cp.eyex, cp.eyey, cp.eyez);
49}
50
51template <typename Space, typename KSpace>
52inline
53void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
54 const DGtal::CameraDirection & cd )
55{
56 viewer.setCameraDirection(cd.dirx, cd.diry, cd.dirz);
57}
58
59template <typename Space, typename KSpace>
60inline
61void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CameraUpVector & cuv )
62{
63
64 viewer.setCameraUpVector(cuv.upx, cuv.upy, cuv.upz);
65}
66
67template <typename Space, typename KSpace>
68inline
69void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
70 const DGtal::CameraZNearFar & cz )
71{
72 viewer.setNearFar(cz.ZNear, cz.ZFar);
73}
74
75
76
77// AddTextureImage3DWithFunctor
78template <typename Space, typename KSpace>
79template<typename TImageType, typename TFunctor>
80void
81DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::AddTextureImage3DWithFunctor<TImageType, TFunctor, Space, KSpace> & anAddGS3D )
82{
83 drawImage3D(viewer, *anAddGS3D.my3DImage, anAddGS3D.myFunctor, anAddGS3D.myMode);
84}
85// AddTextureImage3DWithFunctor
86
87// AddTextureImage2DWithFunctor
88template <typename Space, typename KSpace>
89template<typename TImageType, typename TFunctor>
90void
91DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::AddTextureImage2DWithFunctor<TImageType, TFunctor, Space, KSpace> & anAddGS2D )
92{
93 drawImage2D(viewer, *anAddGS2D.my2DImage, anAddGS2D.myFunctor, anAddGS2D.myMode);
94}
95// AddTextureImage2DWithFunctor
96
97template <typename Space, typename KSpace>
98inline
99void
100DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::UpdateImagePosition<Space, KSpace> & anUpdate)
101{
102 viewer.updateOrientationTextureImage(anUpdate.myIndex, anUpdate.myPosXBottomLeft, anUpdate.myPosYBottomLeft,
103 anUpdate.myPosZBottomLeft, anUpdate.myNewDirection);
104}
105
106template< typename Space, typename KSpace>
107inline
108void
109DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::UpdateLastImagePosition<Space, KSpace> & anUpdate )
110{
111 unsigned int index = viewer.getCurrentGLImageNumber()-1;
112 viewer.updateOrientationTextureImage(index, anUpdate.myPosXBottomLeft, anUpdate.myPosYBottomLeft,
113 anUpdate.myPosZBottomLeft, anUpdate.myNewDirection);
114}
115
116template< typename Space, typename KSpace>
117inline
118void
119DGtal::Viewer3DFactory<Space, KSpace>::draw( Viewer3D<Space,KSpace> & viewer, const DGtal::UpdateImage3DEmbedding<Space, KSpace> & anUpdate)
120{
121 viewer.updateEmbeddingTextureImage(anUpdate.myIndex, anUpdate.myNewPoint1, anUpdate.myNewPoint2, anUpdate.myNewPoint3, anUpdate.myNewPoint4);
122}
123
124
125template< typename Space, typename KSpace>
126inline
127void
128DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> &viewer, const DGtal::Update2DDomainPosition<Space, KSpace> & anUpdate)
129{
130 viewer.updateAn2DDomainOrientation(anUpdate.myIndex, anUpdate.myPosXBottomLeft, anUpdate.myPosYBottomLeft,
131 anUpdate.myPosZBottomLeft, anUpdate.myNewDirection);
132}
133
134template< typename Space, typename KSpace>
135inline
136void
137DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> &viewer, const DGtal::Translate2DDomain & anTranslation)
138{
139 viewer.translateAn2DDomain(anTranslation.myIndex, anTranslation.myTranslateX, anTranslation.myTranslateY,
140 anTranslation.myTranslateZ);
141}
142
143template <typename Space, typename KSpace>
144template<typename TImageType, typename TFunctor>
145void
146DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::UpdateImageData<TImageType, TFunctor> & anUpdate)
147{
148 viewer.updateTextureImage(anUpdate.myIndex, *(anUpdate.myImage), anUpdate.myFunctor, anUpdate.myTranslateX,
149 anUpdate.myTranslateY, anUpdate.myTranslateZ, anUpdate.myRotationAngle, anUpdate.myRotationDir);
150}
151
152template <typename Space, typename KSpace>
153template < typename TImageType3D, typename TFunctor>
154inline
155void
156DGtal::Viewer3DFactory<Space,KSpace>::drawImage3D( Viewer3D<Space, KSpace> & viewer, const TImageType3D & anImage3D, const TFunctor & aFunctor,
157 typename Viewer3D<Space, KSpace>::TextureMode aTextureMode)
158{
159 std::string mode = viewer.getMode( anImage3D.className() );
160 ASSERT( (mode=="BoundingBox" || mode=="InterGrid" || mode=="Grid"|| mode=="") ||
161 ("DGtal::Viewer3DFactory<Space,KSpace>::draw( DViewer3D<Space, KSpace> & viewer,const TImageType3D & anImage ): Unknown mode "+mode)=="");
162
163 typedef TImageType3D Image3D;
164
165 functors::Projector<DGtal::Z2i::Space> invFunctorY; invFunctorY.initRemoveOneDim(1);
166 DGtal::Z2i::Domain domainY(invFunctorY(anImage3D.domain().lowerBound()),
167 invFunctorY(anImage3D.domain().upperBound()));
168 functors::Projector<DGtal::Z2i::Space> invFunctorZ; invFunctorZ.initRemoveOneDim(2);
169 DGtal::Z2i::Domain domainZ(invFunctorZ(anImage3D.domain().lowerBound()),
170 invFunctorZ(anImage3D.domain().upperBound()));
171 functors::Projector<DGtal::Z2i::Space> invFunctorX; invFunctorX.initRemoveOneDim(0);
172 DGtal::Z2i::Domain domainX(invFunctorX(anImage3D.domain().lowerBound()),
173 invFunctorX(anImage3D.domain().upperBound()));
174
175
176
177 typedef DGtal::ConstImageAdapter<Image3D, DGtal::Z2i::Domain, DGtal::functors::Projector< Z3i::Space>,
178 typename Image3D::Value, DGtal::functors::Identity > SliceImageAdapter;
179 DGtal::functors::Identity idV;
180 DGtal::functors::Projector<DGtal::Z3i::Space> aSliceFunctorY((int)(anImage3D.domain().lowerBound()[1]));
181
182 aSliceFunctorY.initAddOneDim(1);
183 SliceImageAdapter sliceImageY(anImage3D, domainY, aSliceFunctorY, idV);
184
185 viewer<< SetMode3D( sliceImageY.className(), mode );
186 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor,Space, KSpace> (sliceImageY, aFunctor, aTextureMode );
187
188 viewer << DGtal::UpdateLastImagePosition<Space, KSpace>( Viewer3D<Space, KSpace>::yDirection,
189 anImage3D.domain().lowerBound()[0],
190 anImage3D.domain().lowerBound()[1]-0.5,
191 anImage3D.domain().lowerBound()[2]);
192
193 functors::Projector<DGtal::Z3i::Space> aSliceFunctorX((int)(anImage3D.domain().lowerBound()[0]));
194 aSliceFunctorX.initAddOneDim(0);
195 SliceImageAdapter sliceImageX(anImage3D, domainX, aSliceFunctorX, idV);
196 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor , Space, KSpace> (sliceImageX, aFunctor, aTextureMode );
197 viewer << DGtal::UpdateLastImagePosition<Space, KSpace> ( Viewer3D<Space, KSpace>::xDirection,
198 anImage3D.domain().lowerBound()[0] -0.5,
199 anImage3D.domain().lowerBound()[1],
200 anImage3D.domain().lowerBound()[2]);
201
202 functors::Projector<DGtal::Z3i::Space> aSliceFunctorZ((int)(anImage3D.domain().lowerBound()[2]));
203 aSliceFunctorZ.initAddOneDim(2);
204 SliceImageAdapter sliceImageZ(anImage3D, domainZ, aSliceFunctorZ, idV);
205 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor , Space, KSpace>(sliceImageZ, aFunctor, aTextureMode );
206 viewer << DGtal::UpdateLastImagePosition<Space, KSpace> ( Viewer3D<Space, KSpace>::zDirection,
207 anImage3D.domain().lowerBound()[0],
208 anImage3D.domain().lowerBound()[1],
209 anImage3D.domain().lowerBound()[2]-0.5);
210
211
212 // other symetrics faces
213 functors::Projector<DGtal::Z3i::Space> aSliceFunctorYl((int)(anImage3D.domain().upperBound()[1]));
214 aSliceFunctorYl.initAddOneDim(1);
215 SliceImageAdapter sliceImageYl(anImage3D, domainY, aSliceFunctorYl, idV);
216 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor , Space, KSpace>(sliceImageYl, aFunctor , aTextureMode);
217 viewer << DGtal::UpdateLastImagePosition<Space, KSpace> ( Viewer3D<Space, KSpace>::yDirection,
218 anImage3D.domain().lowerBound()[0],
219 0.5+anImage3D.domain().upperBound()[1],
220 anImage3D.domain().lowerBound()[2]);
221
222
223 functors::Projector<DGtal::Z3i::Space> aSliceFunctorXl((int)(anImage3D.domain().upperBound()[0]));
224 aSliceFunctorXl.initAddOneDim(0);
225 SliceImageAdapter sliceImageXl(anImage3D, domainX, aSliceFunctorXl, idV);
226 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor, Space, KSpace>(sliceImageXl, aFunctor, aTextureMode );
227 viewer << DGtal::UpdateLastImagePosition<Space, KSpace> ( Viewer3D<Space, KSpace>::xDirection,
228 0.5+anImage3D.domain().upperBound()[0],
229 anImage3D.domain().lowerBound()[1],
230 anImage3D.domain().lowerBound()[2] );
231
232 functors::Projector<DGtal::Z3i::Space> aSliceFunctorZl((int)(anImage3D.domain().upperBound()[2]));
233 aSliceFunctorZl.initAddOneDim(2);
234 SliceImageAdapter sliceImageZl(anImage3D, domainZ, aSliceFunctorZl, idV);
235 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor, Space, KSpace>(sliceImageZl, aFunctor , aTextureMode);
236 viewer << DGtal::UpdateLastImagePosition<Space, KSpace>( Viewer3D<Space, KSpace>::zDirection,
237 anImage3D.domain().lowerBound()[0],
238 anImage3D.domain().lowerBound()[1],
239 0.5+ anImage3D.domain().upperBound()[2] );
240}
241
242// ImageContainerBySTLVector (2D)
243template <typename Space, typename KSpace>
244template <typename TValue>
245inline
246void
247DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLVector<DGtal::Z2i::Domain, TValue> & anImage )
248{
249 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode);
250}
251// ImageContainerBySTLVector (2D)
252
253
254// ImageContainerBySTLMap (2D)
255template <typename Space, typename KSpace>
256template <typename TValue>
257inline
258void
259DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLMap<DGtal::Z2i::Domain, TValue> & anImage )
260{
261 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), anImage.myMode);
262}
263// ImageContainerBySTLMap (2D)
264
265
266// ImageContainerBySTLVector (3D)
267template <typename Space, typename KSpace>
268template <typename TValue>
269inline
270void
271DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLVector<DGtal::Z3i::Domain, TValue> & anImage3D )
272{
273 drawImage3D(viewer, anImage3D, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode);
274}
275// ImageContainerBySTLVector (3D)
276
277// ImageContainerBySTLMap (3D)
278template <typename Space, typename KSpace>
279template <typename TValue>
280inline
281void
282DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLMap<DGtal::Z3i::Domain, TValue> & anImage3D )
283{
284 drawImage3D(viewer, anImage3D, functors::Cast<unsigned int> (), anImage3D.myMode);
285}
286// ImageContainerBySTLMap (3D)
287
288
289// ConstImageAdapter (2D)
290template <typename Space, typename KSpace>
291template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue>
292inline
293void
294DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ConstImageAdapter<TImageContainer, DGtal::Z2i::Domain, TFunctorD, TNewValue, TFunctorValue> & anImage )
295{
296 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode );
297}
298// ConstImageAdapter (2D)
299
300// ImageAdapter (2D)
301template <typename Space, typename KSpace>
302template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue, typename TFunctorValueVm1>
303inline
304void
305DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageAdapter<TImageContainer, DGtal::Z2i::Domain, TFunctorD, TNewValue, TFunctorValue, TFunctorValueVm1> & anImage )
306{
307 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), anImage.myMode);
308}
309// ImageAdapter (2D)
310
311
312// ConstImageAdapter (3D)
313template <typename Space, typename KSpace>
314template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue>
315inline
316void
317DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ConstImageAdapter<TImageContainer, DGtal::Z3i::Domain, TFunctorD,
318 TNewValue, TFunctorValue> & anImage )
319{
320 drawImage3D(viewer, anImage, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode);
321}
322// ConstImageAdapter (3D)
323
324// ImageAdapter (3D)
325template <typename Space, typename KSpace>
326template <typename TImageContainer, typename TFunctorD, typename TNewValue,
327 typename TFunctorValue, typename TFunctorValueVm1>
328inline
329void
330DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
331 const ImageAdapter<TImageContainer, DGtal::Z3i::Domain, TFunctorD,
332 TNewValue, TFunctorValue, TFunctorValueVm1> & anImage )
333{
334 drawImage3D(viewer, anImage, functors::Cast<unsigned int> (), anImage.myMode);
335}
336// ImageAdapter (3D)
337
338//HyperRectDomain
339template <typename Space, typename KSpace>
340template <typename SpaceDom>
341inline
342void
343DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
344 const DGtal::HyperRectDomain<SpaceDom> & aDomain )
345{
346 std::string mode = viewer.getMode( aDomain.className() );
347 ASSERT((SpaceDom::dimension==3)|| (SpaceDom::dimension==2));
348
349 ASSERT((SpaceDom::dimension!=3) || (mode=="" || mode=="Grid" || mode=="Paving"|| mode=="PavingPoints"|| mode=="PavingGrids" ||
350 mode=="BoundingBox")||
351 ("DGtal::Display3DFactory<Space,KSpace>::draw( Display3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<Space> & aDomain ): Unknown mode "+mode)=="");
352
353
354 ASSERT((SpaceDom::dimension!=2) || (mode=="" || mode=="BoundingBox" || mode=="InterGrid"|| mode=="Grid") ||
355 ("DGtal::Display3DFactory<Space,KSpace>::draw( Display3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<Space> & aDomain ): Unknown mode "+mode)=="");
356
357 if(SpaceDom::dimension == 3){
358 if ( mode == "BoundingBox" )
359 {
360 viewer.createNewLineList(aDomain.className());
361 drawAsBoundingBox( viewer, aDomain );
362 }else if( ( mode == "" ) || (mode == "Grid"))
363 {
364 viewer.createNewLineList(aDomain.className());
365 drawAsGrid( viewer, aDomain );
366 }
367 else if ( mode == "Paving" )
368 {
369 viewer.createNewCubeList( );
370 drawAsPaving( viewer, aDomain );
371 }else if ( mode == "PavingGrids" )
372 {
373 viewer.createNewLineList(aDomain.className());
374 viewer.createNewCubeList( );
375 drawAsGrid( viewer, aDomain );
376 drawAsPaving( viewer, aDomain );
377 }
378 }else if(SpaceDom::dimension == 2)
379 {
380 if (mode=="")
381 mode="BoundingBox";
382 viewer.addImage2DDomainD3D(aDomain, mode);
383 }
384
385}
386//end HyperRectDomain
387
388//----------------------------------------------------------------------------------------------
389// heritage of methods
390
391
392// SphericalAccumulator
393template <typename Space, typename KSpace>
394template <typename TVector>
395inline
396void
397DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::SphericalAccumulator<TVector> & accumulator,
398 const typename DGtal::Z3i::RealVector & shift,
399 const double radius)
400{
401 DGtal::Display3DFactory<Space,KSpace>::draw ( viewer, accumulator, shift, radius);
402}
403// SphericalAccumulator
404
405// Mesh
406template <typename Space, typename KSpace>
407template <typename TPoint>
408inline
409void
410DGtal::Viewer3DFactory<Space,KSpace>::drawAsFaces( Viewer3D<Space, KSpace> & viewer, const DGtal::Mesh<TPoint> & aMesh )
411{
412 DGtal::Display3DFactory<Space,KSpace>::drawAsFaces( viewer, aMesh);
413}
414
415template <typename Space, typename KSpace>
416template <typename TPoint>
417inline
418void
419DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Mesh<TPoint> & aMesh )
420{
421 DGtal::Display3DFactory<Space,KSpace>::draw (viewer, aMesh);
422}
423// Mesh
424
425// StandardDSS6Computer
426template <typename Space, typename KSpace>
427template <typename TIterator, typename TInteger, int connectivity>
428inline
429DGtal::DrawableWithViewer3D *
430DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
431{
432 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, arithm);
433}
434
435template <typename Space, typename KSpace>
436template <typename TIterator, typename TInteger, int connectivity>
437inline
438void
439DGtal::Viewer3DFactory<Space,KSpace>::drawAsBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
440{
441 DGtal::Display3DFactory<Space,KSpace>::drawAsBalls(viewer, arithm);
442}
443
444template <typename Space, typename KSpace>
445template <typename TIterator, typename TInteger, int connectivity>
446inline
447void
448DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
449{
450 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox(viewer, arithm);
451}
452
453template <typename Space, typename KSpace>
454template <typename TIterator, typename TInteger, int connectivity>
455inline
456void
457DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
458{
459 DGtal::Display3DFactory<Space,KSpace>::draw(viewer , arithm);
460}
461// StandardDSS6Computer
462
463
464// Naive3DDSSComputer
465template <typename Space, typename KSpace>
466template <typename TIterator, typename TInteger, int connectivity>
467inline
468DGtal::DrawableWithViewer3D *
469DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
470{
471 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, arithm);
472}
473
474template <typename Space, typename KSpace>
475template <typename TIterator, typename TInteger, int connectivity>
476inline
477void
478DGtal::Viewer3DFactory<Space,KSpace>::drawAsBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
479{
480 DGtal::Display3DFactory<Space,KSpace>::drawAsBalls(viewer, arithm);
481}
482
483template <typename Space, typename KSpace>
484template <typename TIterator, typename TInteger, int connectivity>
485inline
486void
487DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
488{
489 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox(viewer, arithm);
490}
491
492template <typename Space, typename KSpace>
493template <typename TIterator, typename TInteger, int connectivity>
494inline
495void
496DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
497{
498 DGtal::Display3DFactory<Space,KSpace>::draw(viewer , arithm);
499}
500// Naive3DDSSComputer
501
502// DigitalSetBySTLSet
503template <typename Space, typename KSpace>
504template<typename Domain, typename Compare>
505inline
506DGtal::DrawableWithViewer3D *
507DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
508{
509 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
510}
511
512template <typename Space, typename KSpace>
513template<typename Domain, typename Compare>
514inline
515void
516DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
517{
518 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent(viewer, aSet);
519}
520
521template <typename Space, typename KSpace>
522template<typename Domain, typename Compare>
523inline
524void
525DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
526{
527 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
528}
529
530template <typename Space, typename KSpace>
531template<typename Domain, typename Compare>
532inline
533void
534DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
535{
536 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
537}
538
539template <typename Space, typename KSpace>
540template<typename Domain, typename Compare>
541inline
542void
543DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
544{
545 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
546}
547// DigitalSetBySTLSet
548
549
550// DigitalSetByAssociativeContainer
551template <typename Space, typename KSpace>
552template<typename Domain, typename Container>
553inline
554DGtal::DrawableWithViewer3D *
555DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
556{
557 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
558}
559
560template <typename Space, typename KSpace>
561template<typename Domain, typename Container>
562inline
563void
564DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
565{
566 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent(viewer, aSet);
567}
568
569template <typename Space, typename KSpace>
570template<typename Domain, typename Container>
571inline
572void
573DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
574{
575 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
576}
577
578template <typename Space, typename KSpace>
579template<typename Domain, typename Container>
580inline
581void
582DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
583{
584 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
585}
586
587template <typename Space, typename KSpace>
588template<typename Domain, typename Container>
589inline
590void
591DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
592{
593 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
594}
595// DigitalSetByAssociativeContainer
596
597// DigitalSetBySTLVector
598template <typename Space, typename KSpace>
599template<typename Domain>
600inline
601DGtal::DrawableWithViewer3D *
602DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
603{
604 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
605}
606
607template <typename Space, typename KSpace>
608template<typename Domain>
609inline
610void
611DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
612{
613 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent( viewer, aSet);
614}
615
616template <typename Space, typename KSpace>
617template<typename Domain>
618inline
619void
620DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
621{
622 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
623}
624
625template <typename Space, typename KSpace>
626template<typename Domain>
627inline
628void
629DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
630{
631 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
632}
633
634template <typename Space, typename KSpace>
635template<typename Domain>
636inline
637void
638DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
639{
640 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
641}
642// DigitalSetBySTLVector
643
644
645// HyperRectDomain
646template <typename Space, typename KSpace>
647template <typename SpaceDom>
648inline
649DGtal::DrawableWithViewer3D *
650DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
651{
652 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aDomain);
653}
654
655template <typename Space, typename KSpace>
656template <typename SpaceDom>
657inline
658void
659DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
660{
661 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox( viewer, aDomain);
662}
663
664template <typename Space, typename KSpace>
665template <typename SpaceDom>
666inline
667void
668DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
669{
670 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid( viewer, aDomain);
671}
672
673template <typename Space, typename KSpace>
674template <typename SpaceDom>
675inline
676void
677DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
678{
679 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingBalls( viewer, aDomain);
680}
681
682template <typename Space, typename KSpace>
683template <typename SpaceDom>
684inline
685void
686DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
687{
688 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aDomain);
689}
690
691
692// HyperRectDomain
693
694
695// KhalimskyCell
696template <typename Space, typename KSpace>
697inline
698DGtal::DrawableWithViewer3D *
699DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const typename KSpace::Cell & aCell )
700{
701 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aCell);
702}
703
704template <typename Space, typename KSpace>
705inline
706void
707DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const typename KSpace::Cell & aCell )
708{
709 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aCell);
710}
711// KhalimskyCell
712
713
714// Object
715template <typename Space, typename KSpace>
716template <typename TDigitalTopology, typename TDigitalSet>
717inline
718DGtal::DrawableWithViewer3D *
719DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
720{
721 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, anObject);
722}
723
724template <typename Space, typename KSpace>
725template <typename TDigitalTopology, typename TDigitalSet>
726inline
727void
728DGtal::Viewer3DFactory<Space,KSpace>::drawWithAdjacencies( Viewer3D<Space, KSpace> & viewer, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
729{
730 DGtal::Display3DFactory<Space,KSpace>::drawWithAdjacencies( viewer, anObject);
731}
732
733template <typename Space, typename KSpace>
734template <typename TDigitalTopology, typename TDigitalSet>
735inline
736void
737DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
738{
739 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, anObject);
740}
741// Object
742
743
744// PointVector
745template <typename Space, typename KSpace>
746template< DGtal::Dimension dim, typename TComponent, typename TContainer>
747inline
748DGtal::DrawableWithViewer3D *
749DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
750{
751 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aPoint);
752}
753
754template <typename Space, typename KSpace>
755template< DGtal::Dimension dim, typename TComponent, typename TContainer>
756inline
757void
758DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
759{
760 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid( viewer, aPoint);
761}
762
763template <typename Space, typename KSpace>
764template< DGtal::Dimension dim, typename TComponent, typename TContainer>
765inline
766void
767DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
768{
769 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aPoint);
770}
771
772template <typename Space, typename KSpace>
773template< DGtal::Dimension dim, typename TComponent, typename TContainer>
774inline
775void
776DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingWired( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
777{
778 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingWired( viewer, aPoint);
779}
780
781template <typename Space, typename KSpace>
782template< DGtal::Dimension dim, typename TComponent, typename TContainer>
783inline
784void
785DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
786{
787 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aPoint);
788}
789
790template <typename Space, typename KSpace>
791template< DGtal::Dimension dim, typename TComponent1, typename TComponent2, typename TContainer1, typename TContainer2>
792inline
793void
794DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent1, TContainer1> & aPoint, const DGtal::PointVector<dim, TComponent2, TContainer2> & aPoint2 )
795{
796 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aPoint, aPoint2);
797}
798// PointVector
799
800
801// SignedKhalimskyCell
802template <typename Space, typename KSpace>
803inline
804DGtal::DrawableWithViewer3D *
805DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const typename KSpace::SCell & aSCell )
806{
807 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aSCell);
808}
809
810template <typename Space, typename KSpace>
811inline
812void
813DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const typename KSpace::SCell & aSCell )
814{
815 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSCell);
816}
817// SignedKhalimskyCell
818
819// GridCurve
820template <typename Space, typename KSpace>
821inline
822void
823DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::GridCurve<KSpace> & aGrid )
824{
825 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aGrid);
826}
827// GridCurve
828
829// SCellsRange
830template <typename Space, typename KSpace>
831template < typename TIterator, typename TSCell>
832inline
833void
834DGtal::Viewer3DFactory<Space,KSpace>::draw( DGtal::Viewer3D<Space, KSpace> & viewer,
835 const DGtal::ConstRangeAdapter<TIterator, DGtal::functors::Identity, TSCell> & aRangeAdapter )
836{
837 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
838}
839// SCellsRange
840
841// PointsRange
842template <typename Space, typename KSpace>
843template <typename TIterator>
844inline
845void
846DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
847 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToPoint<KSpace>, typename KSpace::Point> & aRangeAdapter )
848{
849 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
850}
851// PointsRange
852
853// MidPointsRange
854template <typename Space, typename KSpace>
855template <typename TIterator>
856inline
857void
858DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
859 const DGtal::ConstRangeAdapter<TIterator, CanonicSCellEmbedder<KSpace>, typename KSpace::Space::RealPoint> & aRangeAdapter )
860{
861 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
862}
863// MidPointsRange
864
865// ArrowsRange
866template <typename Space, typename KSpace>
867template <typename TIterator>
868inline
869void
870DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
871 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToArrow<KSpace>, std::pair<typename KSpace::Point, typename KSpace::Vector > > & aRangeAdapter )
872{
873 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
874}
875// ArrowsRange
876
877// InnerPointsRange
878template <typename Space, typename KSpace>
879template <typename TIterator>
880inline
881void
882DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
883 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToInnerPoint<KSpace>, typename KSpace::Point> & aRangeAdapter )
884{
885 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
886}
887// InnerPointsRange
888
889// OuterPointsRange
890template <typename Space, typename KSpace>
891template <typename TIterator>
892inline
893void
894DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
895 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToOuterPoint<KSpace>, typename KSpace::Point> & aRangeAdapter )
896{
897 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
898}
899// OuterPointsRange
900
901// IncidentPointsRange
902template <typename Space, typename KSpace>
903template <typename TIterator>
904inline
905void
906DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
907 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToIncidentPoints<KSpace>,std::pair<typename KSpace::Point, typename KSpace::Point > > & aRangeAdapter )
908{
909 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
910}
911// IncidentPointsRange
912
913
914
915template <typename Space, typename KSpace>
916template < typename TImageType2D, typename TFunctor>
917inline
918void
919DGtal::Viewer3DFactory<Space,KSpace>::drawImage2D( Viewer3D<Space, KSpace> & viewer, const TImageType2D & anImage, const TFunctor & aFunctor,
920 typename Viewer3D<Space, KSpace>::TextureMode aTextureMode )
921{
922 std::string mode = viewer.getMode( anImage.className() );
923 ASSERT( (mode=="BoundingBox" || mode=="InterGrid" || mode=="Grid"|| mode=="") ||
924 ("DGtal::Display3DFactory<Space,KSpace>::draw( Display3D<Space, KSpace> & viewer,const TImageType2D & anImage ): Unknown mode "+mode)=="");
925
926 if(mode=="")
927 {
928 typename Viewer3D<Space, KSpace>::TextureImage aGSImage(anImage, aFunctor,Viewer3D<Space, KSpace>::zDirection, 0,0,0, aTextureMode);
929 viewer.addTextureImage(aGSImage);
930 }else if(mode=="BoundingBox" || mode == "InterGrid" || mode == "Grid")
931 {
932 typename Viewer3D<Space, KSpace>::TextureImage aGSImage(anImage, aFunctor, Viewer3D<Space, KSpace>::zDirection, 0,0,0, aTextureMode);
933 aGSImage.myDrawDomain = true;
934 viewer << SetMode3D( anImage.domain().className(), mode );
935 viewer << anImage.domain();
936 aGSImage.myIndexDomain = viewer.getCurrentDomainNumber()-1;
937 viewer.addTextureImage(aGSImage);
938 }
939}
940
941template <typename Space, typename KSpace>
942inline
943void
944DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::SetMode3D & aMode)
945{
946 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aMode);
947}
948
949template <typename Space, typename KSpace>
950inline
951void
952DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CustomStyle3D & aStyle)
953{
954 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aStyle);
955}
956
957template <typename Space, typename KSpace>
958inline
959void
960DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CustomColors3D & aColor)
961{
962 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aColor);
963}
964
965template <typename Space, typename KSpace>
966inline
967void
968DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::ClippingPlane & aClipping)
969{
970 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aClipping);
971}
972
973
974template <typename Space, typename KSpace>
975inline
976void
977DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::TransformedPrism & aTransformedPrism)
978{
979 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aTransformedPrism);
980}
981
982//-----------------------------------------------------------------------------
983template <typename Space, typename KSpace>
984inline
985void
986DGtal::Viewer3DFactory<Space,KSpace>::
987draw( Viewer3D<Space,KSpace> & viewer, const DGtal::SetName3D& aName3d )
988{
989 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aName3d );
990}
991//-----------------------------------------------------------------------------
992template <typename Space, typename KSpace>
993inline
994void
995DGtal::Viewer3DFactory<Space,KSpace>::
996draw( Viewer3D<Space,KSpace> & viewer, const DGtal::SetSelectCallback3D& aFct )
997{
998 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aFct );
999}
1000//-----------------------------------------------------------------------------
1001
1002
1003// end heritage
1004//----------------------------------------------------------------------------------------------
1005
1006
1007//
1008///////////////////////////////////////////////////////////////////////////////