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.
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.
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/>.
18 * @file Viewer3DFactory.ih
19 * @author Aline Martin <aline.martin@insa-lyon.fr>
20 * @date mardi 2 juillet 2013
24 * Implementation of inline methods defined in Viewer3DFactory.h
26 * This file is part of the DGtal library.
31 #include "DGtal/helpers/StdDefs.h"
32 #include "DGtal/images/ImageHelper.h"
33 #include "DGtal/io/Display3DFactory.h"
36 ///////////////////////////////////////////////////////////////////////////////
37 // Implementation of inline methods //
40 ///////////////////////////////////////////////////////////////////////////////
41 // Implementation of inline functions and external operators //
43 template <typename Space, typename KSpace>
45 void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
46 const DGtal::CameraPosition & cp )
48 viewer.setCameraPosition(cp.eyex, cp.eyey, cp.eyez);
51 template <typename Space, typename KSpace>
53 void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
54 const DGtal::CameraDirection & cd )
56 viewer.setCameraDirection(cd.dirx, cd.diry, cd.dirz);
59 template <typename Space, typename KSpace>
61 void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CameraUpVector & cuv )
64 viewer.setCameraUpVector(cuv.upx, cuv.upy, cuv.upz);
67 template <typename Space, typename KSpace>
69 void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
70 const DGtal::CameraZNearFar & cz )
72 viewer.setNearFar(cz.ZNear, cz.ZFar);
77 // AddTextureImage3DWithFunctor
78 template <typename Space, typename KSpace>
79 template<typename TImageType, typename TFunctor>
81 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::AddTextureImage3DWithFunctor<TImageType, TFunctor, Space, KSpace> & anAddGS3D )
83 drawImage3D(viewer, *anAddGS3D.my3DImage, anAddGS3D.myFunctor, anAddGS3D.myMode);
85 // AddTextureImage3DWithFunctor
87 // AddTextureImage2DWithFunctor
88 template <typename Space, typename KSpace>
89 template<typename TImageType, typename TFunctor>
91 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::AddTextureImage2DWithFunctor<TImageType, TFunctor, Space, KSpace> & anAddGS2D )
93 drawImage2D(viewer, *anAddGS2D.my2DImage, anAddGS2D.myFunctor, anAddGS2D.myMode);
95 // AddTextureImage2DWithFunctor
97 template <typename Space, typename KSpace>
100 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::UpdateImagePosition<Space, KSpace> & anUpdate)
102 viewer.updateOrientationTextureImage(anUpdate.myIndex, anUpdate.myPosXBottomLeft, anUpdate.myPosYBottomLeft,
103 anUpdate.myPosZBottomLeft, anUpdate.myNewDirection);
106 template< typename Space, typename KSpace>
109 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::UpdateLastImagePosition<Space, KSpace> & anUpdate )
111 unsigned int index = viewer.getCurrentGLImageNumber()-1;
112 viewer.updateOrientationTextureImage(index, anUpdate.myPosXBottomLeft, anUpdate.myPosYBottomLeft,
113 anUpdate.myPosZBottomLeft, anUpdate.myNewDirection);
116 template< typename Space, typename KSpace>
119 DGtal::Viewer3DFactory<Space, KSpace>::draw( Viewer3D<Space,KSpace> & viewer, const DGtal::UpdateImage3DEmbedding<Space, KSpace> & anUpdate)
121 viewer.updateEmbeddingTextureImage(anUpdate.myIndex, anUpdate.myNewPoint1, anUpdate.myNewPoint2, anUpdate.myNewPoint3, anUpdate.myNewPoint4);
125 template< typename Space, typename KSpace>
128 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> &viewer, const DGtal::Update2DDomainPosition<Space, KSpace> & anUpdate)
130 viewer.updateAn2DDomainOrientation(anUpdate.myIndex, anUpdate.myPosXBottomLeft, anUpdate.myPosYBottomLeft,
131 anUpdate.myPosZBottomLeft, anUpdate.myNewDirection);
134 template< typename Space, typename KSpace>
137 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> &viewer, const DGtal::Translate2DDomain & anTranslation)
139 viewer.translateAn2DDomain(anTranslation.myIndex, anTranslation.myTranslateX, anTranslation.myTranslateY,
140 anTranslation.myTranslateZ);
143 template <typename Space, typename KSpace>
144 template<typename TImageType, typename TFunctor>
146 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::UpdateImageData<TImageType, TFunctor> & anUpdate)
148 viewer.updateTextureImage(anUpdate.myIndex, *(anUpdate.myImage), anUpdate.myFunctor, anUpdate.myTranslateX,
149 anUpdate.myTranslateY, anUpdate.myTranslateZ, anUpdate.myRotationAngle, anUpdate.myRotationDir);
152 template <typename Space, typename KSpace>
153 template < typename TImageType3D, typename TFunctor>
156 DGtal::Viewer3DFactory<Space,KSpace>::drawImage3D( Viewer3D<Space, KSpace> & viewer, const TImageType3D & anImage3D, const TFunctor & aFunctor,
157 typename Viewer3D<Space, KSpace>::TextureMode aTextureMode)
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)=="");
163 typedef TImageType3D Image3D;
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()));
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]));
182 aSliceFunctorY.initAddOneDim(1);
183 SliceImageAdapter sliceImageY(anImage3D, domainY, aSliceFunctorY, idV);
185 viewer<< SetMode3D( sliceImageY.className(), mode );
186 viewer << DGtal::AddTextureImage2DWithFunctor<SliceImageAdapter, TFunctor,Space, KSpace> (sliceImageY, aFunctor, aTextureMode );
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]);
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]);
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);
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]);
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] );
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] );
242 // ImageContainerBySTLVector (2D)
243 template <typename Space, typename KSpace>
244 template <typename TValue>
247 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLVector<DGtal::Z2i::Domain, TValue> & anImage )
249 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode);
251 // ImageContainerBySTLVector (2D)
254 // ImageContainerBySTLMap (2D)
255 template <typename Space, typename KSpace>
256 template <typename TValue>
259 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLMap<DGtal::Z2i::Domain, TValue> & anImage )
261 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), anImage.myMode);
263 // ImageContainerBySTLMap (2D)
266 // ImageContainerBySTLVector (3D)
267 template <typename Space, typename KSpace>
268 template <typename TValue>
271 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLVector<DGtal::Z3i::Domain, TValue> & anImage3D )
273 drawImage3D(viewer, anImage3D, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode);
275 // ImageContainerBySTLVector (3D)
277 // ImageContainerBySTLMap (3D)
278 template <typename Space, typename KSpace>
279 template <typename TValue>
282 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageContainerBySTLMap<DGtal::Z3i::Domain, TValue> & anImage3D )
284 drawImage3D(viewer, anImage3D, functors::Cast<unsigned int> (), anImage3D.myMode);
286 // ImageContainerBySTLMap (3D)
289 // ConstImageAdapter (2D)
290 template <typename Space, typename KSpace>
291 template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue>
294 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ConstImageAdapter<TImageContainer, DGtal::Z2i::Domain, TFunctorD, TNewValue, TFunctorValue> & anImage )
296 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode );
298 // ConstImageAdapter (2D)
301 template <typename Space, typename KSpace>
302 template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue, typename TFunctorValueVm1>
305 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ImageAdapter<TImageContainer, DGtal::Z2i::Domain, TFunctorD, TNewValue, TFunctorValue, TFunctorValueVm1> & anImage )
307 drawImage2D(viewer, anImage, functors::Cast<unsigned int> (), anImage.myMode);
312 // ConstImageAdapter (3D)
313 template <typename Space, typename KSpace>
314 template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue>
317 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const ConstImageAdapter<TImageContainer, DGtal::Z3i::Domain, TFunctorD,
318 TNewValue, TFunctorValue> & anImage )
320 drawImage3D(viewer, anImage, functors::Cast<unsigned int> (), Viewer3D<Space,KSpace>::GrayScaleMode);
322 // ConstImageAdapter (3D)
325 template <typename Space, typename KSpace>
326 template <typename TImageContainer, typename TFunctorD, typename TNewValue,
327 typename TFunctorValue, typename TFunctorValueVm1>
330 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
331 const ImageAdapter<TImageContainer, DGtal::Z3i::Domain, TFunctorD,
332 TNewValue, TFunctorValue, TFunctorValueVm1> & anImage )
334 drawImage3D(viewer, anImage, functors::Cast<unsigned int> (), anImage.myMode);
339 template <typename Space, typename KSpace>
340 template <typename SpaceDom>
343 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
344 const DGtal::HyperRectDomain<SpaceDom> & aDomain )
346 std::string mode = viewer.getMode( aDomain.className() );
347 ASSERT((SpaceDom::dimension==3)|| (SpaceDom::dimension==2));
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)=="");
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)=="");
357 if(SpaceDom::dimension == 3){
358 if ( mode == "BoundingBox" )
360 viewer.createNewLineList(aDomain.className());
361 drawAsBoundingBox( viewer, aDomain );
362 }else if( ( mode == "" ) || (mode == "Grid"))
364 viewer.createNewLineList(aDomain.className());
365 drawAsGrid( viewer, aDomain );
367 else if ( mode == "Paving" )
369 viewer.createNewCubeList( );
370 drawAsPaving( viewer, aDomain );
371 }else if ( mode == "PavingGrids" )
373 viewer.createNewLineList(aDomain.className());
374 viewer.createNewCubeList( );
375 drawAsGrid( viewer, aDomain );
376 drawAsPaving( viewer, aDomain );
378 }else if(SpaceDom::dimension == 2)
382 viewer.addImage2DDomainD3D(aDomain, mode);
386 //end HyperRectDomain
388 //----------------------------------------------------------------------------------------------
389 // heritage of methods
392 // SphericalAccumulator
393 template <typename Space, typename KSpace>
394 template <typename TVector>
397 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::SphericalAccumulator<TVector> & accumulator,
398 const typename DGtal::Z3i::RealVector & shift,
401 DGtal::Display3DFactory<Space,KSpace>::draw ( viewer, accumulator, shift, radius);
403 // SphericalAccumulator
406 template <typename Space, typename KSpace>
407 template <typename TPoint>
410 DGtal::Viewer3DFactory<Space,KSpace>::drawAsFaces( Viewer3D<Space, KSpace> & viewer, const DGtal::Mesh<TPoint> & aMesh )
412 DGtal::Display3DFactory<Space,KSpace>::drawAsFaces( viewer, aMesh);
415 template <typename Space, typename KSpace>
416 template <typename TPoint>
419 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Mesh<TPoint> & aMesh )
421 DGtal::Display3DFactory<Space,KSpace>::draw (viewer, aMesh);
425 // StandardDSS6Computer
426 template <typename Space, typename KSpace>
427 template <typename TIterator, typename TInteger, int connectivity>
429 DGtal::DrawableWithViewer3D *
430 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
432 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, arithm);
435 template <typename Space, typename KSpace>
436 template <typename TIterator, typename TInteger, int connectivity>
439 DGtal::Viewer3DFactory<Space,KSpace>::drawAsBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
441 DGtal::Display3DFactory<Space,KSpace>::drawAsBalls(viewer, arithm);
444 template <typename Space, typename KSpace>
445 template <typename TIterator, typename TInteger, int connectivity>
448 DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
450 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox(viewer, arithm);
453 template <typename Space, typename KSpace>
454 template <typename TIterator, typename TInteger, int connectivity>
457 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
459 DGtal::Display3DFactory<Space,KSpace>::draw(viewer , arithm);
461 // StandardDSS6Computer
464 // Naive3DDSSComputer
465 template <typename Space, typename KSpace>
466 template <typename TIterator, typename TInteger, int connectivity>
468 DGtal::DrawableWithViewer3D *
469 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
471 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, arithm);
474 template <typename Space, typename KSpace>
475 template <typename TIterator, typename TInteger, int connectivity>
478 DGtal::Viewer3DFactory<Space,KSpace>::drawAsBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
480 DGtal::Display3DFactory<Space,KSpace>::drawAsBalls(viewer, arithm);
483 template <typename Space, typename KSpace>
484 template <typename TIterator, typename TInteger, int connectivity>
487 DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
489 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox(viewer, arithm);
492 template <typename Space, typename KSpace>
493 template <typename TIterator, typename TInteger, int connectivity>
496 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
498 DGtal::Display3DFactory<Space,KSpace>::draw(viewer , arithm);
500 // Naive3DDSSComputer
502 // DigitalSetBySTLSet
503 template <typename Space, typename KSpace>
504 template<typename Domain, typename Compare>
506 DGtal::DrawableWithViewer3D *
507 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
509 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
512 template <typename Space, typename KSpace>
513 template<typename Domain, typename Compare>
516 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
518 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent(viewer, aSet);
521 template <typename Space, typename KSpace>
522 template<typename Domain, typename Compare>
525 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
527 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
530 template <typename Space, typename KSpace>
531 template<typename Domain, typename Compare>
534 DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
536 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
539 template <typename Space, typename KSpace>
540 template<typename Domain, typename Compare>
543 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
545 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
547 // DigitalSetBySTLSet
550 // DigitalSetByAssociativeContainer
551 template <typename Space, typename KSpace>
552 template<typename Domain, typename Container>
554 DGtal::DrawableWithViewer3D *
555 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
557 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
560 template <typename Space, typename KSpace>
561 template<typename Domain, typename Container>
564 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
566 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent(viewer, aSet);
569 template <typename Space, typename KSpace>
570 template<typename Domain, typename Container>
573 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
575 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
578 template <typename Space, typename KSpace>
579 template<typename Domain, typename Container>
582 DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
584 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
587 template <typename Space, typename KSpace>
588 template<typename Domain, typename Container>
591 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
593 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
595 // DigitalSetByAssociativeContainer
597 // DigitalSetBySTLVector
598 template <typename Space, typename KSpace>
599 template<typename Domain>
601 DGtal::DrawableWithViewer3D *
602 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
604 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
607 template <typename Space, typename KSpace>
608 template<typename Domain>
611 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
613 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent( viewer, aSet);
616 template <typename Space, typename KSpace>
617 template<typename Domain>
620 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
622 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
625 template <typename Space, typename KSpace>
626 template<typename Domain>
629 DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
631 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
634 template <typename Space, typename KSpace>
635 template<typename Domain>
638 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
640 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
642 // DigitalSetBySTLVector
646 template <typename Space, typename KSpace>
647 template <typename SpaceDom>
649 DGtal::DrawableWithViewer3D *
650 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
652 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aDomain);
655 template <typename Space, typename KSpace>
656 template <typename SpaceDom>
659 DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
661 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox( viewer, aDomain);
664 template <typename Space, typename KSpace>
665 template <typename SpaceDom>
668 DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
670 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid( viewer, aDomain);
673 template <typename Space, typename KSpace>
674 template <typename SpaceDom>
677 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
679 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingBalls( viewer, aDomain);
682 template <typename Space, typename KSpace>
683 template <typename SpaceDom>
686 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
688 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aDomain);
696 template <typename Space, typename KSpace>
698 DGtal::DrawableWithViewer3D *
699 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const typename KSpace::Cell & aCell )
701 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aCell);
704 template <typename Space, typename KSpace>
707 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const typename KSpace::Cell & aCell )
709 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aCell);
715 template <typename Space, typename KSpace>
716 template <typename TDigitalTopology, typename TDigitalSet>
718 DGtal::DrawableWithViewer3D *
719 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
721 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, anObject);
724 template <typename Space, typename KSpace>
725 template <typename TDigitalTopology, typename TDigitalSet>
728 DGtal::Viewer3DFactory<Space,KSpace>::drawWithAdjacencies( Viewer3D<Space, KSpace> & viewer, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
730 DGtal::Display3DFactory<Space,KSpace>::drawWithAdjacencies( viewer, anObject);
733 template <typename Space, typename KSpace>
734 template <typename TDigitalTopology, typename TDigitalSet>
737 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
739 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, anObject);
745 template <typename Space, typename KSpace>
746 template< DGtal::Dimension dim, typename TComponent, typename TContainer>
748 DGtal::DrawableWithViewer3D *
749 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
751 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aPoint);
754 template <typename Space, typename KSpace>
755 template< DGtal::Dimension dim, typename TComponent, typename TContainer>
758 DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
760 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid( viewer, aPoint);
763 template <typename Space, typename KSpace>
764 template< DGtal::Dimension dim, typename TComponent, typename TContainer>
767 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
769 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aPoint);
772 template <typename Space, typename KSpace>
773 template< DGtal::Dimension dim, typename TComponent, typename TContainer>
776 DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingWired( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
778 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingWired( viewer, aPoint);
781 template <typename Space, typename KSpace>
782 template< DGtal::Dimension dim, typename TComponent, typename TContainer>
785 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
787 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aPoint);
790 template <typename Space, typename KSpace>
791 template< DGtal::Dimension dim, typename TComponent1, typename TComponent2, typename TContainer1, typename TContainer2>
794 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent1, TContainer1> & aPoint, const DGtal::PointVector<dim, TComponent2, TContainer2> & aPoint2 )
796 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aPoint, aPoint2);
801 // SignedKhalimskyCell
802 template <typename Space, typename KSpace>
804 DGtal::DrawableWithViewer3D *
805 DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const typename KSpace::SCell & aSCell )
807 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aSCell);
810 template <typename Space, typename KSpace>
813 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const typename KSpace::SCell & aSCell )
815 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSCell);
817 // SignedKhalimskyCell
820 template <typename Space, typename KSpace>
823 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::GridCurve<KSpace> & aGrid )
825 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aGrid);
830 template <typename Space, typename KSpace>
831 template < typename TIterator, typename TSCell>
834 DGtal::Viewer3DFactory<Space,KSpace>::draw( DGtal::Viewer3D<Space, KSpace> & viewer,
835 const DGtal::ConstRangeAdapter<TIterator, DGtal::functors::Identity, TSCell> & aRangeAdapter )
837 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
842 template <typename Space, typename KSpace>
843 template <typename TIterator>
846 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
847 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToPoint<KSpace>, typename KSpace::Point> & aRangeAdapter )
849 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
854 template <typename Space, typename KSpace>
855 template <typename TIterator>
858 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
859 const DGtal::ConstRangeAdapter<TIterator, CanonicSCellEmbedder<KSpace>, typename KSpace::Space::RealPoint> & aRangeAdapter )
861 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
866 template <typename Space, typename KSpace>
867 template <typename TIterator>
870 DGtal::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 )
873 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
878 template <typename Space, typename KSpace>
879 template <typename TIterator>
882 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
883 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToInnerPoint<KSpace>, typename KSpace::Point> & aRangeAdapter )
885 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
890 template <typename Space, typename KSpace>
891 template <typename TIterator>
894 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
895 const DGtal::ConstRangeAdapter<TIterator, functors::SCellToOuterPoint<KSpace>, typename KSpace::Point> & aRangeAdapter )
897 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
901 // IncidentPointsRange
902 template <typename Space, typename KSpace>
903 template <typename TIterator>
906 DGtal::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 )
909 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
911 // IncidentPointsRange
915 template <typename Space, typename KSpace>
916 template < typename TImageType2D, typename TFunctor>
919 DGtal::Viewer3DFactory<Space,KSpace>::drawImage2D( Viewer3D<Space, KSpace> & viewer, const TImageType2D & anImage, const TFunctor & aFunctor,
920 typename Viewer3D<Space, KSpace>::TextureMode aTextureMode )
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)=="");
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")
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);
941 template <typename Space, typename KSpace>
944 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::SetMode3D & aMode)
946 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aMode);
949 template <typename Space, typename KSpace>
952 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CustomStyle3D & aStyle)
954 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aStyle);
957 template <typename Space, typename KSpace>
960 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CustomColors3D & aColor)
962 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aColor);
965 template <typename Space, typename KSpace>
968 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::ClippingPlane & aClipping)
970 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aClipping);
974 template <typename Space, typename KSpace>
977 DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::TransformedPrism & aTransformedPrism)
979 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aTransformedPrism);
982 //-----------------------------------------------------------------------------
983 template <typename Space, typename KSpace>
986 DGtal::Viewer3DFactory<Space,KSpace>::
987 draw( Viewer3D<Space,KSpace> & viewer, const DGtal::SetName3D& aName3d )
989 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aName3d );
991 //-----------------------------------------------------------------------------
992 template <typename Space, typename KSpace>
995 DGtal::Viewer3DFactory<Space,KSpace>::
996 draw( Viewer3D<Space,KSpace> & viewer, const DGtal::SetSelectCallback3D& aFct )
998 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aFct );
1000 //-----------------------------------------------------------------------------
1004 //----------------------------------------------------------------------------------------------
1008 ///////////////////////////////////////////////////////////////////////////////