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 //
43template <typename Space, typename KSpace>
45void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
46 const DGtal::CameraPosition & cp )
48 viewer.setCameraPosition(cp.eyex, cp.eyey, cp.eyez);
51template <typename Space, typename KSpace>
53void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
54 const DGtal::CameraDirection & cd )
56 viewer.setCameraDirection(cd.dirx, cd.diry, cd.dirz);
59template <typename Space, typename KSpace>
61void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CameraUpVector & cuv )
64 viewer.setCameraUpVector(cuv.upx, cuv.upy, cuv.upz);
67template <typename Space, typename KSpace>
69void DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer,
70 const DGtal::CameraZNearFar & cz )
72 viewer.setNearFar(cz.ZNear, cz.ZFar);
77// AddTextureImage3DWithFunctor
78template <typename Space, typename KSpace>
79template<typename TImageType, typename TFunctor>
81DGtal::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
88template <typename Space, typename KSpace>
89template<typename TImageType, typename TFunctor>
91DGtal::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
97template <typename Space, typename KSpace>
100DGtal::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);
106template< typename Space, typename KSpace>
109DGtal::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);
116template< typename Space, typename KSpace>
119DGtal::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);
125template< typename Space, typename KSpace>
128DGtal::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);
134template< typename Space, typename KSpace>
137DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> &viewer, const DGtal::Translate2DDomain & anTranslation)
139 viewer.translateAn2DDomain(anTranslation.myIndex, anTranslation.myTranslateX, anTranslation.myTranslateY,
140 anTranslation.myTranslateZ);
143template <typename Space, typename KSpace>
144template<typename TImageType, typename TFunctor>
146DGtal::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);
152template <typename Space, typename KSpace>
153template < typename TImageType3D, typename TFunctor>
156DGtal::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)
243template <typename Space, typename KSpace>
244template <typename TValue>
247DGtal::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)
255template <typename Space, typename KSpace>
256template <typename TValue>
259DGtal::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)
267template <typename Space, typename KSpace>
268template <typename TValue>
271DGtal::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)
278template <typename Space, typename KSpace>
279template <typename TValue>
282DGtal::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)
290template <typename Space, typename KSpace>
291template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue>
294DGtal::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)
301template <typename Space, typename KSpace>
302template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue, typename TFunctorValueVm1>
305DGtal::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)
313template <typename Space, typename KSpace>
314template <typename TImageContainer, typename TFunctorD, typename TNewValue, typename TFunctorValue>
317DGtal::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)
325template <typename Space, typename KSpace>
326template <typename TImageContainer, typename TFunctorD, typename TNewValue,
327 typename TFunctorValue, typename TFunctorValueVm1>
330DGtal::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);
339template <typename Space, typename KSpace>
340template <typename SpaceDom>
343DGtal::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);
388//----------------------------------------------------------------------------------------------
389// heritage of methods
392// SphericalAccumulator
393template <typename Space, typename KSpace>
394template <typename TVector>
397DGtal::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
406template <typename Space, typename KSpace>
407template <typename TPoint>
410DGtal::Viewer3DFactory<Space,KSpace>::drawAsFaces( Viewer3D<Space, KSpace> & viewer, const DGtal::Mesh<TPoint> & aMesh )
412 DGtal::Display3DFactory<Space,KSpace>::drawAsFaces( viewer, aMesh);
415template <typename Space, typename KSpace>
416template <typename TPoint>
419DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Mesh<TPoint> & aMesh )
421 DGtal::Display3DFactory<Space,KSpace>::draw (viewer, aMesh);
425// StandardDSS6Computer
426template <typename Space, typename KSpace>
427template <typename TIterator, typename TInteger, int connectivity>
429DGtal::DrawableWithViewer3D *
430DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
432 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, arithm);
435template <typename Space, typename KSpace>
436template <typename TIterator, typename TInteger, int connectivity>
439DGtal::Viewer3DFactory<Space,KSpace>::drawAsBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
441 DGtal::Display3DFactory<Space,KSpace>::drawAsBalls(viewer, arithm);
444template <typename Space, typename KSpace>
445template <typename TIterator, typename TInteger, int connectivity>
448DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & arithm )
450 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox(viewer, arithm);
453template <typename Space, typename KSpace>
454template <typename TIterator, typename TInteger, int connectivity>
457DGtal::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
465template <typename Space, typename KSpace>
466template <typename TIterator, typename TInteger, int connectivity>
468DGtal::DrawableWithViewer3D *
469DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
471 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, arithm);
474template <typename Space, typename KSpace>
475template <typename TIterator, typename TInteger, int connectivity>
478DGtal::Viewer3DFactory<Space,KSpace>::drawAsBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
480 DGtal::Display3DFactory<Space,KSpace>::drawAsBalls(viewer, arithm);
483template <typename Space, typename KSpace>
484template <typename TIterator, typename TInteger, int connectivity>
487DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
489 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox(viewer, arithm);
492template <typename Space, typename KSpace>
493template <typename TIterator, typename TInteger, int connectivity>
496DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & arithm )
498 DGtal::Display3DFactory<Space,KSpace>::draw(viewer , arithm);
503template <typename Space, typename KSpace>
504template<typename Domain, typename Compare>
506DGtal::DrawableWithViewer3D *
507DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
509 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
512template <typename Space, typename KSpace>
513template<typename Domain, typename Compare>
516DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
518 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent(viewer, aSet);
521template <typename Space, typename KSpace>
522template<typename Domain, typename Compare>
525DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
527 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
530template <typename Space, typename KSpace>
531template<typename Domain, typename Compare>
534DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
536 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
539template <typename Space, typename KSpace>
540template<typename Domain, typename Compare>
543DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLSet<Domain, Compare> & aSet )
545 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
550// DigitalSetByAssociativeContainer
551template <typename Space, typename KSpace>
552template<typename Domain, typename Container>
554DGtal::DrawableWithViewer3D *
555DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
557 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
560template <typename Space, typename KSpace>
561template<typename Domain, typename Container>
564DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
566 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent(viewer, aSet);
569template <typename Space, typename KSpace>
570template<typename Domain, typename Container>
573DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
575 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
578template <typename Space, typename KSpace>
579template<typename Domain, typename Container>
582DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & aSet )
584 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
587template <typename Space, typename KSpace>
588template<typename Domain, typename Container>
591DGtal::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
598template <typename Space, typename KSpace>
599template<typename Domain>
601DGtal::DrawableWithViewer3D *
602DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
604 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aSet);
607template <typename Space, typename KSpace>
608template<typename Domain>
611DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingTransparent( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
613 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingTransparent( viewer, aSet);
616template <typename Space, typename KSpace>
617template<typename Domain>
620DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
622 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aSet);
625template <typename Space, typename KSpace>
626template<typename Domain>
629DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
631 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid(viewer, aSet);
634template <typename Space, typename KSpace>
635template<typename Domain>
638DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::DigitalSetBySTLVector<Domain> & aSet )
640 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSet);
642// DigitalSetBySTLVector
646template <typename Space, typename KSpace>
647template <typename SpaceDom>
649DGtal::DrawableWithViewer3D *
650DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
652 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aDomain);
655template <typename Space, typename KSpace>
656template <typename SpaceDom>
659DGtal::Viewer3DFactory<Space,KSpace>::drawAsBoundingBox( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
661 DGtal::Display3DFactory<Space,KSpace>::drawAsBoundingBox( viewer, aDomain);
664template <typename Space, typename KSpace>
665template <typename SpaceDom>
668DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
670 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid( viewer, aDomain);
673template <typename Space, typename KSpace>
674template <typename SpaceDom>
677DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingBalls( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
679 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingBalls( viewer, aDomain);
682template <typename Space, typename KSpace>
683template <typename SpaceDom>
686DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::HyperRectDomain<SpaceDom> & aDomain )
688 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aDomain);
696template <typename Space, typename KSpace>
698DGtal::DrawableWithViewer3D *
699DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const typename KSpace::Cell & aCell )
701 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle(str, aCell);
704template <typename Space, typename KSpace>
707DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const typename KSpace::Cell & aCell )
709 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aCell);
715template <typename Space, typename KSpace>
716template <typename TDigitalTopology, typename TDigitalSet>
718DGtal::DrawableWithViewer3D *
719DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
721 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, anObject);
724template <typename Space, typename KSpace>
725template <typename TDigitalTopology, typename TDigitalSet>
728DGtal::Viewer3DFactory<Space,KSpace>::drawWithAdjacencies( Viewer3D<Space, KSpace> & viewer, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
730 DGtal::Display3DFactory<Space,KSpace>::drawWithAdjacencies( viewer, anObject);
733template <typename Space, typename KSpace>
734template <typename TDigitalTopology, typename TDigitalSet>
737DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject )
739 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, anObject);
745template <typename Space, typename KSpace>
746template< DGtal::Dimension dim, typename TComponent, typename TContainer>
748DGtal::DrawableWithViewer3D *
749DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
751 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aPoint);
754template <typename Space, typename KSpace>
755template< DGtal::Dimension dim, typename TComponent, typename TContainer>
758DGtal::Viewer3DFactory<Space,KSpace>::drawAsGrid( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
760 DGtal::Display3DFactory<Space,KSpace>::drawAsGrid( viewer, aPoint);
763template <typename Space, typename KSpace>
764template< DGtal::Dimension dim, typename TComponent, typename TContainer>
767DGtal::Viewer3DFactory<Space,KSpace>::drawAsPaving( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
769 DGtal::Display3DFactory<Space,KSpace>::drawAsPaving( viewer, aPoint);
772template <typename Space, typename KSpace>
773template< DGtal::Dimension dim, typename TComponent, typename TContainer>
776DGtal::Viewer3DFactory<Space,KSpace>::drawAsPavingWired( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
778 DGtal::Display3DFactory<Space,KSpace>::drawAsPavingWired( viewer, aPoint);
781template <typename Space, typename KSpace>
782template< DGtal::Dimension dim, typename TComponent, typename TContainer>
785DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::PointVector<dim, TComponent, TContainer> & aPoint )
787 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aPoint);
790template <typename Space, typename KSpace>
791template< DGtal::Dimension dim, typename TComponent1, typename TComponent2, typename TContainer1, typename TContainer2>
794DGtal::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
802template <typename Space, typename KSpace>
804DGtal::DrawableWithViewer3D *
805DGtal::Viewer3DFactory<Space,KSpace>::defaultStyle( std::string str, const typename KSpace::SCell & aSCell )
807 return DGtal::Display3DFactory<Space,KSpace>::defaultStyle( str, aSCell);
810template <typename Space, typename KSpace>
813DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const typename KSpace::SCell & aSCell )
815 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aSCell);
817// SignedKhalimskyCell
820template <typename Space, typename KSpace>
823DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::GridCurve<KSpace> & aGrid )
825 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aGrid);
830template <typename Space, typename KSpace>
831template < typename TIterator, typename TSCell>
834DGtal::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);
842template <typename Space, typename KSpace>
843template <typename TIterator>
846DGtal::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);
854template <typename Space, typename KSpace>
855template <typename TIterator>
858DGtal::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);
866template <typename Space, typename KSpace>
867template <typename TIterator>
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 )
873 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
878template <typename Space, typename KSpace>
879template <typename TIterator>
882DGtal::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);
890template <typename Space, typename KSpace>
891template <typename TIterator>
894DGtal::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
902template <typename Space, typename KSpace>
903template <typename TIterator>
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 )
909 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aRangeAdapter);
911// IncidentPointsRange
915template <typename Space, typename KSpace>
916template < typename TImageType2D, typename TFunctor>
919DGtal::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);
941template <typename Space, typename KSpace>
944DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::SetMode3D & aMode)
946 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aMode);
949template <typename Space, typename KSpace>
952DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CustomStyle3D & aStyle)
954 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aStyle);
957template <typename Space, typename KSpace>
960DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::CustomColors3D & aColor)
962 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aColor);
965template <typename Space, typename KSpace>
968DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::ClippingPlane & aClipping)
970 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aClipping);
974template <typename Space, typename KSpace>
977DGtal::Viewer3DFactory<Space,KSpace>::draw( Viewer3D<Space, KSpace> & viewer, const DGtal::TransformedPrism & aTransformedPrism)
979 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aTransformedPrism);
982//-----------------------------------------------------------------------------
983template <typename Space, typename KSpace>
986DGtal::Viewer3DFactory<Space,KSpace>::
987draw( Viewer3D<Space,KSpace> & viewer, const DGtal::SetName3D& aName3d )
989 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aName3d );
991//-----------------------------------------------------------------------------
992template <typename Space, typename KSpace>
995DGtal::Viewer3DFactory<Space,KSpace>::
996draw( Viewer3D<Space,KSpace> & viewer, const DGtal::SetSelectCallback3D& aFct )
998 DGtal::Display3DFactory<Space,KSpace>::draw( viewer, aFct );
1000//-----------------------------------------------------------------------------
1004//----------------------------------------------------------------------------------------------
1008///////////////////////////////////////////////////////////////////////////////