DGtal 2.0.0
|
Base class for viewing DGtal objects. More...
#include <DGtal/io/Display3D.h>
Data Structures | |
struct | Callback |
A general callback for the viewer to give control to the user. More... |
Public Types | |
using | Point = typename Space::Point |
using | KCell = typename KSpace::Cell |
using | SCell = typename KSpace::SCell |
using | RealPoint = typename Space::RealPoint |
using | Embedder = CanonicEmbedder<Space> |
using | CellEmbedder = CanonicCellEmbedder<KSpace> |
using | SCellEmbedder = CanonicSCellEmbedder<KSpace> |
Public Member Functions | |
Display3D (const KSpace &space) | |
Display3D () | |
virtual void | show ()=0 |
Starts the event loop and display of elements. | |
virtual void | renderNewData ()=0 |
Renders newly added data. | |
virtual void | renderAll () |
(Re)Render all data | |
virtual void | clearView ()=0 |
Clear the screen. | |
virtual void | clear () |
Clear the viewer, including screen and internal data. | |
virtual void | setCallback (Callback *callback) |
Sets callback. | |
std::string | newList (const std::string &name, size_t eSize=0) |
Create a new group. | |
bool | setCurrentList (const std::string &name) |
Set the current group for further updates. | |
bool | canCreateNewList (size_t elementSize) const |
Tells if a list of a given elementSize can be reused. | |
std::string | createOrReuseList (const std::string &name, size_t elementSize) |
Reuse a list if possible, otherwise create a new one. | |
void | endCurrentGroup () |
End current group and sets an invalid current group. | |
std::string | newCubeList (const std::string &name) |
std::string | newBallList (const std::string &name) |
std::string | newLineList (const std::string &name) |
std::string | newQuadList (const std::string &name) |
std::string | newPolygonList (const std::string &name) |
std::string | newTriangleList (const std::string &name) |
std::string | newVolumetricList (const std::string &name) |
std::string | createOrReuseCubeList (const std::string &name) |
std::string | createOrReuseBallList (const std::string &name) |
std::string | createOrReuseLineList (const std::string &name) |
std::string | createOrReuseQuadList (const std::string &name) |
std::string | createOrReusePolygonList (const std::string &name) |
std::string | createOrReuseTriangleList (const std::string &name) |
std::string | createOrReuseVolumetricList (const std::string &name) |
template<typename Obj> | |
Display3D & | operator<< (const Obj &obj) |
Draw object with stream API. | |
std::string | draw (const Point &p, const std::string &uname="Point_{i}") |
std::string | draw (const RealPoint &rp, const std::string &uname="Point_{i}") |
template<typename T> | |
std::string | draw (const std::vector< T > &vec, const std::string &uname="") |
template<typename A, typename B, typename C> | |
std::string | draw (const ConstRangeAdapter< A, B, C > range, const std::string &uname="") |
template<typename A, typename B, typename C> | |
std::string | draw (const ConstIteratorAdapter< A, B, C > &adapter, const std::string &uname="") |
std::string | draw (const GridCurve< KSpace > &curve, const std::string &uname="GridCurve_{i}") |
std::string | draw (const typename GridCurve< KSpace >::MidPointsRange &range, const std::string &uname="MidPoints_{i}") |
std::string | draw (const typename GridCurve< KSpace >::ArrowsRange &range, const std::string &uname="Arrows_{i}") |
template<DGtal::Dimension emb, DGtal::Dimension amb, typename Algebra, typename Int> | |
std::string | draw (const DiscreteExteriorCalculus< emb, amb, Algebra, Int > &calc, const std::string &uname="Calculus_{i}") |
template<typename Calculus, DGtal::Order order, DGtal::Duality duality> | |
std::string | draw (const KForm< Calculus, order, duality > &kform, const std::string &uname="KForm_{i}") |
template<typename Calculus, DGtal::Duality dual> | |
std::string | draw (const VectorField< Calculus, dual > &field, const std::string &uname="Field_{i}") |
std::string | draw (const KCell &cell, const std::string &name="KCell_{i}_{d}d") |
std::string | draw (const SCell &cell, const std::string &name="SCell_{i}_{d}d") |
std::string | draw (const HyperRectDomain< Space > &domain, const std::string &uname="\xff Domain_{i}") |
template<typename Vec> | |
std::string | drawPolygon (const std::vector< Vec > &vertices, const std::string &uname="Polygon_{i}") |
Draws a polygon. | |
std::string | drawBall (const RealPoint &c, const std::string &uname="Ball_{i}") |
std::string | drawLine (const RealPoint &a, const RealPoint &b, const std::string &uname="Line_{i}") |
std::string | drawQuad (const RealPoint &a, const RealPoint &b, const RealPoint &c, const RealPoint &d, const std::string &uname="Quad_{i}") |
template<typename Obj, typename Cont> | |
std::string | draw (const DigitalSetByAssociativeContainer< Obj, Cont > &set, const std::string &name="Set_{i}") |
template<typename Adj, typename Set> | |
std::string | draw (const DGtal::Object< Adj, Set > &obj, const std::string &uname="Object_{i}") |
template<typename D, typename T> | |
std::string | draw (const ImageContainerBySTLVector< D, T > &image, const std::string &name="Image_{i}") |
template<typename TImageContainer, typename TNewDomain, typename TFunctorD, typename TNewValue, typename TFunctorV, typename TFunctorVm1> | |
std::string | draw (const ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 > &adapter, const std::string &name="Image_{i}") |
template<typename TImageContainer, typename TNewDomain, typename TFunctorD, typename TNewValue, typename TFunctorV> | |
std::string | draw (const ConstImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV > &adapter, const std::string &name="Image_{i}") |
template<typename Pt> | |
std::string | draw (const Mesh< Pt > &mesh, const std::string &uname="Mesh_{i}") |
template<typename It, typename Int, int Con> | |
std::string | draw (const StandardDSS6Computer< It, Int, Con > &computer, const std::string &uname="Computer_{i}") |
template<typename It, typename Int, int Con> | |
std::string | draw (const Naive3DDSSComputer< It, Int, Con > &computer, const std::string &uname="Computer_{i}") |
template<typename T, typename Type> | |
std::string | draw (const WithQuantity< T, Type > &props, const std::string &uname="") |
template<typename Type> | |
void | addQuantity (const std::string &oName, const std::string &qName, const Type &value, QuantityScale scale=QuantityScale::UNKNOWN) |
template<typename Type> | |
void | addQuantity (const std::string &oName, const std::string &qName, const std::vector< Type > &value, QuantityScale scale=QuantityScale::UNKNOWN) |
std::string | draw (const ClippingPlane &plane, const std::string &name="") |
template<typename T> | |
std::string | draw (const SphericalAccumulator< T > accumulator, const std::string &uname="SphericalAccumulator_{i}") |
std::string | draw (const DGtal::Color &color, const std::string &name="") |
void | drawColor (const DGtal::Color &color) |
void | setDefaultColors () |
void | drawAdjacencies (bool toggle=true) |
void | drawAsSimplified (bool toggle=true) |
void | drawAsGrid (bool toggle=true) |
void | defaultStyle () |
void | drawAsPaving () |
void | drawAsBalls () |
Data Fields | |
DisplayStyle | currentStyle |
bool | allowReuseList = false |
std::vector< ClippingPlane > | planes |
std::map< std::string, DisplayData< RealPoint > > | data |
Protected Attributes | |
KSpace | myKSpace |
Embedder | myEmbedder |
CellEmbedder | myCellEmbedder |
SCellEmbedder | mySCellEmbedder |
Callback * | myCallback = nullptr |
std::vector< std::string > | myToRender |
std::string | myCurrentName = "" |
DisplayData< RealPoint > * | myCurrentData = nullptr |
Private Member Functions | |
std::string | draw (const std::pair< RealPoint, RealPoint > &arrow, const std::string &uname="Arrow_{i}") |
template<typename Range> | |
std::string | drawGenericRange (const Range &range, const std::string &uname) |
Draws a range of object to the screen. | |
template<typename T> | |
std::string | drawImage (const std::string &uname, const T &image) |
std::string | drawKCell (std::string uname, const RealPoint &rp, bool xodd, bool yodd, bool zodd, bool hasSign, bool sign) |
Base class for viewing DGtal objects.
Drawing:
Lists: Lists are a key part of this class. A list is a collection of object that are linked together. As such, they should be managed, updated with the same options.
Each DisplayData elements corresponds to a list of elements. However the intent behind subsequent drawcalls can be to groups elements together. For example, looping through a Digital surface doing a computation and then display the current element. For this reason, the field "allowReuseList" can be set to true. This will try, if possible to use reuse the current element if possible. This may not success (common cases are if elements of different size were inserted, or after drawing an object which always create its own list). If this does not fit the need, use setCurrentList.
Definition at line 377 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::CellEmbedder = CanonicCellEmbedder<KSpace> |
Definition at line 394 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::Embedder = CanonicEmbedder<Space> |
Definition at line 393 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::KCell = typename KSpace::Cell |
Definition at line 389 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::Point = typename Space::Point |
Definition at line 388 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::RealPoint = typename Space::RealPoint |
Definition at line 391 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::SCell = typename KSpace::SCell |
Definition at line 390 of file Display3D.h.
using DGtal::Display3D< Space, KSpace >::SCellEmbedder = CanonicSCellEmbedder<KSpace> |
Definition at line 395 of file Display3D.h.
|
inline |
Definition at line 379 of file Display3D.h.
References myCellEmbedder, myKSpace, and mySCellEmbedder.
Referenced by Display3D(), operator<<(), DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::PolyscopeViewer(), and DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >::PolyscopeViewer().
|
inline |
void DGtal::Display3D< Space, KSpace >::addQuantity | ( | const std::string & | oName, |
const std::string & | qName, | ||
const std::vector< Type > & | value, | ||
QuantityScale | scale = QuantityScale::UNKNOWN ) |
References scale, and DGtal::UNKNOWN.
void DGtal::Display3D< Space, KSpace >::addQuantity | ( | const std::string & | oName, |
const std::string & | qName, | ||
const Type & | value, | ||
QuantityScale | scale = QuantityScale::UNKNOWN ) |
References scale, and DGtal::UNKNOWN.
Referenced by main().
bool DGtal::Display3D< Space, KSpace >::canCreateNewList | ( | size_t | elementSize | ) | const |
Tells if a list of a given elementSize can be reused.
elementSize | The size of each elements |
|
virtual |
Clear the viewer, including screen and internal data.
|
pure virtual |
Clear the screen.
Implemented in DGtal::PolyscopeViewer< Space, KSpace >, DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >, and DGtal::PolyscopeViewer< Space, KSpace >.
|
inline |
Definition at line 538 of file Display3D.h.
References createOrReuseList().
|
inline |
|
inline |
std::string DGtal::Display3D< Space, KSpace >::createOrReuseList | ( | const std::string & | name, |
size_t | elementSize ) |
Reuse a list if possible, otherwise create a new one.
name | The name of the created list if needed |
elementSize | The size of each element for the list |
Referenced by createOrReuseBallList(), createOrReuseCubeList(), createOrReuseLineList(), createOrReusePolygonList(), createOrReuseQuadList(), createOrReuseTriangleList(), and createOrReuseVolumetricList().
|
inline |
|
inline |
|
inline |
|
inline |
void DGtal::Display3D< Space, KSpace >::defaultStyle | ( | ) |
Referenced by main().
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const ClippingPlane & | plane, |
const std::string & | name = "" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const ConstImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV > & | adapter, |
const std::string & | name = "Image_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const ConstIteratorAdapter< A, B, C > & | adapter, |
const std::string & | uname = "" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const ConstRangeAdapter< A, B, C > | range, |
const std::string & | uname = "" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const DGtal::Color & | color, |
const std::string & | name = "" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const DGtal::Object< Adj, Set > & | obj, |
const std::string & | uname = "Object_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const DigitalSetByAssociativeContainer< Obj, Cont > & | set, |
const std::string & | name = "Set_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const DiscreteExteriorCalculus< emb, amb, Algebra, Int > & | calc, |
const std::string & | uname = "Calculus_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const GridCurve< KSpace > & | curve, |
const std::string & | uname = "GridCurve_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const HyperRectDomain< Space > & | domain, |
const std::string & | uname = "\xff Domain_{i}" ) |
References domain.
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const ImageAdapter< TImageContainer, TNewDomain, TFunctorD, TNewValue, TFunctorV, TFunctorVm1 > & | adapter, |
const std::string & | name = "Image_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const ImageContainerBySTLVector< D, T > & | image, |
const std::string & | name = "Image_{i}" ) |
References image().
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const KCell & | cell, |
const std::string & | name = "KCell_{i}_{d}d" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const KForm< Calculus, order, duality > & | kform, |
const std::string & | uname = "KForm_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const Mesh< Pt > & | mesh, |
const std::string & | uname = "Mesh_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const Naive3DDSSComputer< It, Int, Con > & | computer, |
const std::string & | uname = "Computer_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const Point & | p, |
const std::string & | uname = "Point_{i}" ) |
Referenced by main().
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const RealPoint & | rp, |
const std::string & | uname = "Point_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const SCell & | cell, |
const std::string & | name = "SCell_{i}_{d}d" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const SphericalAccumulator< T > | accumulator, |
const std::string & | uname = "SphericalAccumulator_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const StandardDSS6Computer< It, Int, Con > & | computer, |
const std::string & | uname = "Computer_{i}" ) |
|
private |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const std::vector< T > & | vec, |
const std::string & | uname = "" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const typename GridCurve< KSpace >::ArrowsRange & | range, |
const std::string & | uname = "Arrows_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const typename GridCurve< KSpace >::MidPointsRange & | range, |
const std::string & | uname = "MidPoints_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const VectorField< Calculus, dual > & | field, |
const std::string & | uname = "Field_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::draw | ( | const WithQuantity< T, Type > & | props, |
const std::string & | uname = "" ) |
void DGtal::Display3D< Space, KSpace >::drawAdjacencies | ( | bool | toggle = true | ) |
Referenced by main().
void DGtal::Display3D< Space, KSpace >::drawAsBalls | ( | ) |
Referenced by main().
void DGtal::Display3D< Space, KSpace >::drawAsGrid | ( | bool | toggle = true | ) |
Referenced by main().
void DGtal::Display3D< Space, KSpace >::drawAsPaving | ( | ) |
Referenced by main().
void DGtal::Display3D< Space, KSpace >::drawAsSimplified | ( | bool | toggle = true | ) |
std::string DGtal::Display3D< Space, KSpace >::drawBall | ( | const RealPoint & | c, |
const std::string & | uname = "Ball_{i}" ) |
void DGtal::Display3D< Space, KSpace >::drawColor | ( | const DGtal::Color & | color | ) |
Referenced by main().
|
private |
Draws a range of object to the screen.
|
private |
References image().
|
private |
std::string DGtal::Display3D< Space, KSpace >::drawLine | ( | const RealPoint & | a, |
const RealPoint & | b, | ||
const std::string & | uname = "Line_{i}" ) |
std::string DGtal::Display3D< Space, KSpace >::drawPolygon | ( | const std::vector< Vec > & | vertices, |
const std::string & | uname = "Polygon_{i}" ) |
Draws a polygon.
Vec | Type of vertex |
Referenced by main(), and viewPolygons().
std::string DGtal::Display3D< Space, KSpace >::drawQuad | ( | const RealPoint & | a, |
const RealPoint & | b, | ||
const RealPoint & | c, | ||
const RealPoint & | d, | ||
const std::string & | uname = "Quad_{i}" ) |
Referenced by main().
void DGtal::Display3D< Space, KSpace >::endCurrentGroup | ( | ) |
End current group and sets an invalid current group.
The purpose of this function is to disallow further automatic update on a group.
|
inline |
Definition at line 530 of file Display3D.h.
References newList().
|
inline |
|
inline |
std::string DGtal::Display3D< Space, KSpace >::newList | ( | const std::string & | name, |
size_t | eSize = 0 ) |
Create a new group.
If the name requested already exists; another one is computed as follows:
This function sets the current data.
name | The name to insert |
eSize | elementSize of the DisplayData |
Referenced by newBallList(), newCubeList(), newLineList(), newPolygonList(), newQuadList(), newTriangleList(), and newVolumetricList().
|
inline |
Definition at line 533 of file Display3D.h.
References newList().
Referenced by main().
|
inline |
Definition at line 532 of file Display3D.h.
References newList().
Referenced by main(), and testLocalConvolutionNormalVectorEstimator().
|
inline |
|
inline |
Display3D & DGtal::Display3D< Space, KSpace >::operator<< | ( | const Obj & | obj | ) |
|
inlinevirtual |
(Re)Render all data
If any modification were made within the viewer they can be lost
Definition at line 453 of file Display3D.h.
References data, myToRender, and renderNewData().
|
pure virtual |
Renders newly added data.
Implemented in DGtal::PolyscopeViewer< Space, KSpace >, DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >, and DGtal::PolyscopeViewer< Space, KSpace >.
Referenced by renderAll().
|
virtual |
Sets callback.
bool DGtal::Display3D< Space, KSpace >::setCurrentList | ( | const std::string & | name | ) |
Set the current group for further updates.
name | The name of the group |
Referenced by main().
void DGtal::Display3D< Space, KSpace >::setDefaultColors | ( | ) |
Referenced by main().
|
pure virtual |
Starts the event loop and display of elements.
It is recommended that this functions calls renderNewData
Implemented in DGtal::PolyscopeViewer< Space, KSpace >, DGtal::PolyscopeViewer< DGtal::Z3i::Space, DGtal::Z3i::KSpace >, and DGtal::PolyscopeViewer< Space, KSpace >.
bool DGtal::Display3D< Space, KSpace >::allowReuseList = false |
Definition at line 730 of file Display3D.h.
Referenced by main(), testBallQuad(), and testLocalConvolutionNormalVectorEstimator().
DisplayStyle DGtal::Display3D< Space, KSpace >::currentStyle |
Definition at line 729 of file Display3D.h.
Referenced by main().
std::map<std::string, DisplayData<RealPoint> > DGtal::Display3D< Space, KSpace >::data |
Definition at line 734 of file Display3D.h.
Referenced by main(), DGtal::Display3D< Space, KSpace >::Callback::OnClick(), and renderAll().
|
protected |
Definition at line 742 of file Display3D.h.
|
protected |
Definition at line 739 of file Display3D.h.
Referenced by Display3D().
|
protected |
Definition at line 746 of file Display3D.h.
|
protected |
Definition at line 745 of file Display3D.h.
|
protected |
Definition at line 738 of file Display3D.h.
|
protected |
Definition at line 737 of file Display3D.h.
Referenced by Display3D().
|
protected |
Definition at line 740 of file Display3D.h.
Referenced by Display3D().
|
protected |
Definition at line 743 of file Display3D.h.
Referenced by renderAll().
std::vector<ClippingPlane> DGtal::Display3D< Space, KSpace >::planes |
Definition at line 732 of file Display3D.h.