DGtal  0.9.2
Display3DFactory.h
1 
17 #pragma once
18 
31 #if defined(Display3DFactory_RECURSES)
32 #error Recursive header files inclusion detected in Display3DFactory.h
33 #else // defined(Display3DFactory_RECURSES)
34 
35 #define Display3DFactory_RECURSES
36 
37 #if !defined Display3DFactory_h
38 
39 #define Display3DFactory_h
40 
42 // Inclusions
43 
44 #include "DGtal/helpers/StdDefs.h"
45 #include "DGtal/base/Common.h"
46 
47 #include "DGtal/io/DrawWithDisplay3DModifier.h"
48 #include "DGtal/geometry/curves/StandardDSS6Computer.h"
49 #include "DGtal/geometry/curves/Naive3DDSSComputer.h"
50 #include "DGtal/kernel/sets/DigitalSetBySTLSet.h"
51 #include "DGtal/kernel/sets/DigitalSetBySTLVector.h"
52 #include "DGtal/kernel/domains/HyperRectDomain.h"
53 #include "DGtal/topology/KhalimskySpaceND.h"
54 #include "DGtal/topology/Object.h"
55 #include "DGtal/kernel/PointVector.h"
56 #include "DGtal/geometry/curves/GridCurve.h"
57 #include "DGtal/shapes/Mesh.h"
58 #include "DGtal/geometry/tools/SphericalAccumulator.h"
59 #include "DGtal/io/colormaps/GradientColorMap.h"
60 #include "DGtal/io/colormaps/HueShadeColorMap.h"
61 #include "DGtal/io/colormaps/CColorMap.h"
62 #include "DGtal/images/ImageContainerBySTLVector.h"
63 #include "DGtal/images/ImageContainerBySTLMap.h"
64 #include "DGtal/images/ConstImageAdapter.h"
65 #include "DGtal/images/ImageAdapter.h"
66 #include "DGtal/helpers/StdDefs.h"
67 #include "DGtal/topology/CanonicSCellEmbedder.h"
68 #include "DGtal/dec/VectorField.h"
69 #include "DGtal/dec/KForm.h"
70 #include "DGtal/dec/DiscreteExteriorCalculus.h"
71 
72 #include "DGtal/kernel/sets/DigitalSetByAssociativeContainer.h"
73 
74 //
76 
77 namespace DGtal
78 {
80  // struct Display3DFactory
85  template <typename TSpace=Z3i::Space, typename TKSpace=Z3i::KSpace>
87  {
88 
90  BOOST_STATIC_CONSTANT(unsigned int, POINT_AS_BALL_RADIUS = 5);
92  BOOST_STATIC_CONSTANT(unsigned int, POINT_AS_BALL_RES = 5);
93 
94  typedef TSpace Space;
95  typedef TKSpace KSpace;
98  typedef typename Display::RealPoint RealPoint;
99  typedef typename Display::RealVector RealVector;
100 
101  // DiscreteExteriorCalculus
102  template <Dimension dimEmbedded, Dimension dimAmbient, typename TLinearAlgebraBackend, typename TInteger>
103  static
104  void
106  // DiscreteExteriorCalculus
107 
108  // KForm
109  template <typename Calculus, DGtal::Order order, DGtal::Duality duality>
110  static
111  void
112  draw(Display3D<Space, KSpace>& display, const DGtal::KForm<Calculus, order, duality>& kform, double cmap_min = 0, double cmap_max = 0);
113 
114  template <typename Calculus, DGtal::Order order, DGtal::Duality duality, typename ColorMap>
115  static
116  void
117  drawWithColorMap(Display3D<Space, KSpace>& display, const DGtal::KForm<Calculus, order, duality>& kform, const ColorMap& colormap);
118  // KForm
119 
120  // VectorField
121  template <typename Calculus, DGtal::Duality duality>
122  static
123  void
124  draw(Display3D<Space, KSpace>& display, const DGtal::VectorField<Calculus, duality>& vector_field, const double& scale = 0.5, const double& epsilon = 1e-5, const DGtal::Color color = DGtal::Color::Black);
125  // VectorField
126 
127  // SphericalAccumulator
139  template <typename TVector>
140  static void draw( Display & display, const DGtal::SphericalAccumulator<TVector> & accumulator,
141  const DGtal::Z3i::RealVector &shift = DGtal::Z3i::RealVector(0,0,0),
142  const double radius=1.0);
143  // SphericalAccumulator
144 
145  // Mesh
151  template <typename TPoint>
152  static void drawAsFaces( Display & display, const DGtal::Mesh<TPoint> & aMesh);
153 
159  template <typename TPoint>
160  static void draw( Display & display, const DGtal::Mesh<TPoint> & aMesh);
161  // Mesh
162 
163 
164  // StandardDSS6Computer
171  template <typename TIterator, typename TInteger, int connectivity>
173 
179  template <typename TIterator, typename TInteger, int connectivity>
180  static void drawAsBalls( Display & display, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & anObject );
181 
187  template <typename TIterator, typename TInteger, int connectivity>
188  static void drawAsBoundingBox( Display & display, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & anObject );
189 
195  template <typename TIterator, typename TInteger, int connectivity>
196  static void draw( Display & display, const DGtal::StandardDSS6Computer<TIterator,TInteger,connectivity> & anObject );
197  // StandardDSS6Computer
198 
199  // Naive3DDSSComputer
207  template <typename TIterator, typename TInteger, int connectivity>
209 
215  template <typename TIterator, typename TInteger, int connectivity>
216  static void drawAsBalls( Display & display, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & anObject );
217 
223  template <typename TIterator, typename TInteger, int connectivity>
224  static void drawAsBoundingBox( Display & display, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & anObject );
225 
231  template <typename TIterator, typename TInteger, int connectivity>
232  static void draw( Display & display, const DGtal::Naive3DDSSComputer<TIterator,TInteger,connectivity> & anObject );
233  // Naive3DDSSComputer
234 
235 
236  // DigitalSetByAssociativeContainer
243  template<typename Domain, typename Container>
245 
251  template<typename Domain, typename Container>
252  static void drawAsPavingTransparent( Display & display, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & anObject );
253 
259  template<typename Domain, typename Container>
260  static void drawAsPaving( Display & display, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & anObject );
261 
267  template<typename Domain, typename Container>
268  static void drawAsGrid( Display & display, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & anObject );
269 
275  template<typename Domain, typename Container>
276  static void draw( Display & display, const DGtal::DigitalSetByAssociativeContainer<Domain, Container> & anObject );
277  // DigitalSetByAssociativeContainer
278 
279 
280  // DigitalSetBySTLSet
287  template<typename Domain, typename Compare>
288  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const DGtal::DigitalSetBySTLSet<Domain, Compare> & anObject );
289 
295  template<typename Domain, typename Compare>
296  static void drawAsPavingTransparent( Display & display, const DGtal::DigitalSetBySTLSet<Domain, Compare> & anObject );
297 
303  template<typename Domain, typename Compare>
304  static void drawAsPaving( Display & display, const DGtal::DigitalSetBySTLSet<Domain, Compare> & anObject );
305 
311  template<typename Domain, typename Compare>
312  static void drawAsGrid( Display & display, const DGtal::DigitalSetBySTLSet<Domain, Compare> & anObject );
313 
319  template<typename Domain, typename Compare>
320  static void draw( Display & display, const DGtal::DigitalSetBySTLSet<Domain, Compare> & anObject );
321  // DigitalSetBySTLSet
322 
323 
324  // DigitalSetBySTLVector
331  template<typename Domain>
332  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const DGtal::DigitalSetBySTLVector<Domain> & anObject );
333 
339  template<typename Domain>
340  static void drawAsPavingTransparent( Display & display, const DGtal::DigitalSetBySTLVector<Domain> & anObject );
341 
347  template<typename Domain>
348  static void drawAsPaving( Display & display, const DGtal::DigitalSetBySTLVector<Domain> & anObject );
349 
355  template<typename Domain>
356  static void drawAsGrid( Display & display, const DGtal::DigitalSetBySTLVector<Domain> & anObject );
357 
363  template<typename Domain>
364  static void draw( Display & display, const DGtal::DigitalSetBySTLVector<Domain> & anObject );
365  // DigitalSetBySTLVector
366 
367 
368  // HyperRectDomain
375  template <typename SpaceDom>
376  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const DGtal::HyperRectDomain<SpaceDom> & anObject );
377 
383  template <typename SpaceDom>
384  static void drawAsBoundingBox( Display & display, const DGtal::HyperRectDomain<SpaceDom> & anObject );
385 
391  template <typename SpaceDom>
392  static void drawAsGrid( Display & display, const DGtal::HyperRectDomain<SpaceDom> & anObject );
393 
399  template <typename SpaceDom>
400  static void drawAsPavingBalls( Display & display, const DGtal::HyperRectDomain<SpaceDom> & anObject );
401 
407  template <typename SpaceDom>
408  static void drawAsPaving( Display & display, const DGtal::HyperRectDomain<SpaceDom> & anObject );
409 
410 
416  template <typename SpaceDom>
417  static void draw( Display & display, const DGtal::HyperRectDomain<SpaceDom> & anObject );
418 
419 
420  // HyperRectDomain
421 
422 
423  // KhalimskyCell
430  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const typename KSpace::Cell & anObject );
431 
437  static void draw( Display & display, const typename KSpace::Cell & anObject );
438 
453  static void drawUnorientedSurfelWithNormal( Display & display, const typename KSpace::Cell & anObject,
454  const RealVector & aNormal,
455  const bool enableDoubleFace = false);
456  // KhalimskyCell
457 
458  // SignedKhalimskyCell
465  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const typename KSpace::SCell & anObject );
466 
472  static void draw( Display & display, const typename KSpace::SCell & anObject );
473 
485  static void drawOrientedSurfelWithNormal( Display & display,
486  const typename KSpace::SCell & aSignedCell,
487  const RealVector & aNormal,
488  const bool enableDoubleFace = false);
489  // SignedKhalimskyCell
490 
491  // Object
498  template <typename TDigitalTopology, typename TDigitalSet>
499  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject );
500 
506  template <typename TDigitalTopology, typename TDigitalSet>
507  static void drawWithAdjacencies( Display & display, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject );
508 
514  template <typename TDigitalTopology, typename TDigitalSet>
515  static void draw( Display & display, const DGtal::Object<TDigitalTopology, TDigitalSet> & anObject );
516  // Object
517 
518 
519  // PointVector
526  template<Dimension dim, typename TComponent>
527  static DGtal::DrawableWithDisplay3D * defaultStyle( std::string str, const DGtal::PointVector<dim,TComponent> & anObject );
528 
534  template<Dimension dim, typename TComponent>
535  static void drawAsGrid( Display & display, const DGtal::PointVector<dim,TComponent> & anObject );
536 
542  template<Dimension dim, typename TComponent>
543  static void drawAsPaving( Display & display, const DGtal::PointVector<dim,TComponent> & anObject );
544 
550  template<Dimension dim, typename TComponent>
551  static void drawAsPavingWired( Display & display, const DGtal::PointVector<dim,TComponent> & anObject );
552 
558  template<Dimension dim, typename TComponent>
559  static void draw( Display & display, const DGtal::PointVector<dim,TComponent> & anObject );
560 
566  template<Dimension dim, typename TComponent>
567  static void draw( Display & display, const DGtal::PointVector<dim,TComponent> & , const DGtal::PointVector<dim,TComponent> & anObject );
568  // PointVector
569 
570  // GridCurve
576  static void draw( Display & display, const DGtal::GridCurve<KSpace> & anObject );
577  // GridCurve
578 
579  // SCellsRange
585  template < typename TIterator, typename TSCell>
586  static void draw( Display & display,
588  // SCellsRange
589 
590  // PointsRange
596  template <typename TIterator>
597  static void draw( Display & display,
598  const DGtal::ConstRangeAdapter<TIterator, DGtal::functors::SCellToPoint<KSpace>, typename TKSpace::Point> & anObject );
599  // PointsRange
600 
601  // MidPointsRange
602  template <typename TIterator>
608  static void draw( Display & display,
610  typename TKSpace::Space::RealPoint> & anObject );
611  // MidPointsRange
612 
613  // ArrowsRange
619  template <typename TIterator>
620  static void draw( Display & display,
622  std::pair<typename TKSpace::Point, typename TKSpace::Vector > > & anObject );
623  // ArrowsRange
624 
625  // InnerPointsRange
631  template <typename TIterator>
632  static void draw( Display & display,
633  const DGtal::ConstRangeAdapter<TIterator, DGtal::functors::SCellToInnerPoint<KSpace>, typename TKSpace::Point> & anObject );
634  // InnerPointsRange
635 
636  // OuterPointsRange
642  template <typename TIterator>
643  static void draw( Display & display,
644  const DGtal::ConstRangeAdapter<TIterator, DGtal::functors::SCellToOuterPoint<KSpace>, typename TKSpace::Point> & anObject );
645  // OuterPointsRange
646 
647  // IncidentPointsRange
653  template <typename TIterator>
654  static void draw( Display & display,
656  std::pair<typename KSpace::Point, typename KSpace::Point > > & anObject );
657  // IncidentPointsRange
658 
665  static void
666  draw( Display & display, const DGtal::SetMode3D & anObject );
667 
674  static void
675  draw( Display & display, const DGtal::CustomStyle3D & anObject );
676 
683  static void
684  draw( Display & display, const DGtal::CustomColors3D & anObject );
685 
691  static void
692  draw( Display & display, const DGtal::ClippingPlane & anObject );
693 
694 
700  static void
701  draw( Display & display, const DGtal::TransformedPrism & aTransformedPrism);
702 
708  static void
709  draw( Display & display, const DGtal::SetName3D& aName3d );
710 
718  static void
719  draw( Display & display, const DGtal::SetSelectCallback3D& aFct );
720 
721  }; // end of struct Display3DFactory
722 
723 } // namespace DGtal
724 
726 // Includes inline functions/methods
727 
728 #include "DGtal/io/Display3DFactory.ih"
729 
730 // //
732 
733 #endif // !defined Display3DFactory_h
734 
735 #undef Display3DFactory_RECURSES
736 #endif // else defined(Display3DFactory_RECURSES)
Aim: An object (or digital object) represents a set in some digital space associated with a digital t...
Definition: Object.h:119
static const Color Black
Definition: Color.h:388
Aim: DiscreteExteriorCalculus represents a calculus in the dec package. This is the main structure in...
Display3D< Space, KSpace > Display
Display::RealPoint RealPoint
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: This class is defined to represent a surface mesh through a set of vertices and faces...
Definition: Mesh.h:91
Aim: KForm represents discrete kforms in the dec package.
Definition: KForm.h:65
Factory for GPL Display3D:
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:141
static void draw(Display3D< Space, KSpace > &display, const DGtal::DiscreteExteriorCalculus< dimEmbedded, dimAmbient, TLinearAlgebraBackend, TInteger > &calculus)
Modifier class in a Display3D stream. Useful to choose your own style for a given class...
static void drawOrientedSurfelWithNormal(Display &display, const typename KSpace::SCell &aSignedCell, const RealVector &aNormal, const bool enableDoubleFace=false)
static void drawAsBoundingBox(Display &display, const DGtal::StandardDSS6Computer< TIterator, TInteger, connectivity > &anObject)
drawAsBoundingBox
Aim: transforms a signed cell into an arrow, ie. a pair point-vector.
static void drawAsBalls(Display &display, const DGtal::StandardDSS6Computer< TIterator, TInteger, connectivity > &anObject)
drawAsBalls
Aim: transforms a scell into a point.
static void drawAsPavingBalls(Display &display, const DGtal::HyperRectDomain< SpaceDom > &anObject)
drawAsPavingBalls
static void drawUnorientedSurfelWithNormal(Display &display, const typename KSpace::Cell &anObject, const RealVector &aNormal, const bool enableDoubleFace=false)
static void drawAsPavingTransparent(Display &display, const DGtal::DigitalSetByAssociativeContainer< Domain, Container > &anObject)
drawAsPavingTransparent
static void drawAsGrid(Display &display, const DGtal::DigitalSetByAssociativeContainer< Domain, Container > &anObject)
drawAsGrid
Display3DFactory< Space, KSpace > Self
DGtal is the top-level namespace which contains all DGtal functions and types.
Aim: A wrapper class around a STL associative container for storing sets of digital points within som...
Aim: transforms a signed cell c into a point corresponding to the signed cell of greater dimension th...
Aim: model of CConstBidirectionalRange that adapts any range of elements bounded by two iterators [it...
Aim: implements an accumulator (as histograms for 1D scalars) adapted to spherical point samples...
static void drawWithAdjacencies(Display &display, const DGtal::Object< TDigitalTopology, TDigitalSet > &anObject)
drawWithAdjacencies
static void drawAsPaving(Display &display, const DGtal::DigitalSetByAssociativeContainer< Domain, Container > &anObject)
drawAsPaving
Display::RealVector RealVector
Aim: Realizes the concept CDigitalSet by using the STL container std::vector.
Aim: Dynamic recognition of a 3d-digital straight segment (DSS)
Structure representing an RGB triple with alpha component.
Definition: Color.h:66
static void drawAsFaces(Display &display, const DGtal::Mesh< TPoint > &aMesh)
drawAsFaces
BOOST_STATIC_CONSTANT(unsigned int, POINT_AS_BALL_RADIUS=5)
The ball radius (the actual radius being 1/POINT_AS_BALL_RADIUS )when used to display a 3D point...
Aim: describes, in a cellular space of dimension n, a closed or open sequence of signed d-cells (or d...
Definition: GridCurve.h:172
Class for adding a Clipping plane through the Viewer3D stream. Realizes the concept CDrawableWithView...
static void drawWithColorMap(Display3D< Space, KSpace > &display, const DGtal::KForm< Calculus, order, duality > &kform, const ColorMap &colormap)
static void drawAsPavingWired(Display &display, const DGtal::PointVector< dim, TComponent > &anObject)
drawAsPavingWired
Aim: transforms a signed cell c into a point corresponding to the signed cell of greater dimension th...
Aim: VectorField represents a discrete vector field in the dec package. Vector field values are attac...
Definition: VectorField.h:66
Aim: A container class for storing sets of digital points within some given domain.
Aim: This semi abstract class defines the stream mechanism to display 3d primitive (like BallVector...
Definition: Common.h:134
class to modify the position and scale to construct better illustration mode.
Modifier class in a Display3D stream. Useful to choose your own mode for a given class. Realizes the concept CDrawableWithDisplay3D.
static DGtal::DrawableWithDisplay3D * defaultStyle(std::string str, const DGtal::StandardDSS6Computer< TIterator, TInteger, connectivity > &anObject)
Aim: transforms a signed cell c into a pair of points corresponding to the signed cells of greater di...