68#include <ACG/Math/VectorT.hh>
89 resetPredefinedSplatPropertyPointers();
90 resetPredefinedCloudPropertyPointers();
122 void pushbackSplat();
132 void resizeSplats(
unsigned int _num );
145 template <
typename T>
unsigned int eraseSplatsByIndex(
const T &_indices );
159 template <
typename T>
unsigned int eraseSplatsByFlag(
const std::vector<T> &_flags );
171 template <
typename T>
void cropSplats(
const T &_indices );
179 inline unsigned int numSplats()
const {
return numSplats_; }
213 virtual const std::type_info &
typeId()
const = 0;
219 virtual void resize(
unsigned int _num ) = 0;
220 virtual void crop(
const std::vector<int> &_indices ) = 0;
233 virtual const std::type_info &
typeId()
const = 0;
282 template <
typename T>
292 template <
typename T>
305 virtual inline size_t sizeOf()
const override {
return sizeof( T ); }
306 virtual inline const std::type_info &
typeId()
const override {
return typeid( T ); }
310 virtual inline void clear()
override { std::vector<T>().swap( data_ ); }
311 virtual inline void pushback()
override { data_.push_back( T() ); }
312 virtual inline void resize(
unsigned int _num )
override { data_.resize( _num ); }
313 virtual void crop(
const std::vector<int> &_indices )
override;
323 template <
typename T>
336 virtual inline size_t sizeOf()
const override {
return sizeof( T ); }
337 virtual inline const std::type_info &
typeId()
const override {
return typeid( T ); }
352 void clearSplatProperties();
355 void clearCloudProperties();
400 template <
typename T> SplatPropertyT<T> *releaseSplatProperty(
const PropertyHandleT<T> &_handle );
401 template <
typename T> CloudPropertyT<T> *releaseCloudProperty(
const PropertyHandleT<T> &_handle );
422 template <
typename T> SplatPropertyT<T> *getSplatProperty(
const PropertyHandleT<T> &_handle );
423 template <
typename T>
const SplatPropertyT<T> *getSplatProperty(
const PropertyHandleT<T> &_handle )
const;
424 template <
typename T> CloudPropertyT<T> *getCloudProperty(
const PropertyHandleT<T> &_handle );
425 template <
typename T>
const CloudPropertyT<T> *getCloudProperty(
const PropertyHandleT<T> &_handle )
const;
466 void copySplatProperties(
const SplatCloud &_splatCloud );
469 void copyCloudProperties(
const SplatCloud &_splatCloud );
511 typedef float Pointsize;
513 typedef std::vector<View> Viewlist;
514 typedef unsigned char Selection;
521 typedef std::vector<Position > PositionVector;
522 typedef std::vector<Color > ColorVector;
523 typedef std::vector<Normal > NormalVector;
524 typedef std::vector<Pointsize> PointsizeVector;
525 typedef std::vector<Index > IndexVector;
526 typedef std::vector<Viewlist > ViewlistVector;
527 typedef std::vector<Selection> SelectionVector;
561 inline bool requestPositions() { positionsProperty_ = requestSplatProperty( POSITIONS_HANDLE );
return (positionsProperty_ != 0); }
562 inline bool requestColors() { colorsProperty_ = requestSplatProperty( COLORS_HANDLE );
return (colorsProperty_ != 0); }
563 inline bool requestNormals() { normalsProperty_ = requestSplatProperty( NORMALS_HANDLE );
return (normalsProperty_ != 0); }
564 inline bool requestPointsizes() { pointsizesProperty_ = requestSplatProperty( POINTSIZES_HANDLE );
return (pointsizesProperty_ != 0); }
565 inline bool requestIndices() { indicesProperty_ = requestSplatProperty( INDICES_HANDLE );
return (indicesProperty_ != 0); }
566 inline bool requestViewlists() { viewlistsProperty_ = requestSplatProperty( VIEWLISTS_HANDLE );
return (viewlistsProperty_ != 0); }
567 inline bool requestSelections() { selectionsProperty_ = requestSplatProperty( SELECTIONS_HANDLE );
return (selectionsProperty_ != 0); }
584 inline void releasePositions() { positionsProperty_ = releaseSplatProperty( POSITIONS_HANDLE ); }
585 inline void releaseColors() { colorsProperty_ = releaseSplatProperty( COLORS_HANDLE ); }
586 inline void releaseNormals() { normalsProperty_ = releaseSplatProperty( NORMALS_HANDLE ); }
587 inline void releasePointsizes() { pointsizesProperty_ = releaseSplatProperty( POINTSIZES_HANDLE ); }
588 inline void releaseIndices() { indicesProperty_ = releaseSplatProperty( INDICES_HANDLE ); }
589 inline void releaseViewlists() { viewlistsProperty_ = releaseSplatProperty( VIEWLISTS_HANDLE ); }
590 inline void releaseSelections() { selectionsProperty_ = releaseSplatProperty( SELECTIONS_HANDLE ); }
608 inline bool hasColors()
const {
return (colorsProperty_ != 0); }
609 inline bool hasNormals()
const {
return (normalsProperty_ != 0); }
611 inline bool hasIndices()
const {
return (indicesProperty_ != 0); }
632 inline const Position &
positions (
int _idx )
const {
return positionsProperty_-> data( _idx ); }
633 inline Color &
colors (
int _idx ) {
return colorsProperty_-> data( _idx ); }
634 inline const Color &
colors (
int _idx )
const {
return colorsProperty_-> data( _idx ); }
635 inline Normal &
normals (
int _idx ) {
return normalsProperty_-> data( _idx ); }
636 inline const Normal &
normals (
int _idx )
const {
return normalsProperty_-> data( _idx ); }
637 inline Pointsize &
pointsizes(
int _idx ) {
return pointsizesProperty_->data( _idx ); }
638 inline const Pointsize &
pointsizes(
int _idx )
const {
return pointsizesProperty_->data( _idx ); }
639 inline Index &
indices (
int _idx ) {
return indicesProperty_-> data( _idx ); }
640 inline const Index &
indices (
int _idx )
const {
return indicesProperty_-> data( _idx ); }
641 inline Viewlist &
viewlists (
int _idx ) {
return viewlistsProperty_-> data( _idx ); }
642 inline const Viewlist &
viewlists (
int _idx )
const {
return viewlistsProperty_-> data( _idx ); }
643 inline Selection &
selections(
int _idx ) {
return selectionsProperty_->data( _idx ); }
644 inline const Selection &
selections(
int _idx )
const {
return selectionsProperty_->data( _idx ); }
656 positionsProperty_ = 0;
658 normalsProperty_ = 0;
659 pointsizesProperty_ = 0;
660 indicesProperty_ = 0;
661 viewlistsProperty_ = 0;
662 selectionsProperty_ = 0;
671 positionsProperty_ = getSplatProperty( POSITIONS_HANDLE );
672 colorsProperty_ = getSplatProperty( COLORS_HANDLE );
673 normalsProperty_ = getSplatProperty( NORMALS_HANDLE );
674 pointsizesProperty_ = getSplatProperty( POINTSIZES_HANDLE );
675 indicesProperty_ = getSplatProperty( INDICES_HANDLE );
676 viewlistsProperty_ = getSplatProperty( VIEWLISTS_HANDLE );
677 selectionsProperty_ = getSplatProperty( SELECTIONS_HANDLE );
686 std::swap( positionsProperty_, _splatCloud.positionsProperty_ );
687 std::swap( colorsProperty_, _splatCloud.colorsProperty_ );
688 std::swap( normalsProperty_, _splatCloud.normalsProperty_ );
689 std::swap( pointsizesProperty_, _splatCloud.pointsizesProperty_ );
690 std::swap( indicesProperty_, _splatCloud.indicesProperty_ );
691 std::swap( viewlistsProperty_, _splatCloud.viewlistsProperty_ );
692 std::swap( selectionsProperty_, _splatCloud.selectionsProperty_ );
704 SplatPropertyT<Position> *positionsProperty_;
705 SplatPropertyT<Color> *colorsProperty_;
706 SplatPropertyT<Normal> *normalsProperty_;
707 SplatPropertyT<Pointsize> *pointsizesProperty_;
708 SplatPropertyT<Index> *indicesProperty_;
709 SplatPropertyT<Viewlist> *viewlistsProperty_;
710 SplatPropertyT<Selection> *selectionsProperty_;
717 static const PositionsHandle POSITIONS_HANDLE;
718 static const ColorsHandle COLORS_HANDLE;
719 static const NormalsHandle NORMALS_HANDLE;
720 static const PointsizesHandle POINTSIZES_HANDLE;
721 static const IndicesHandle INDICES_HANDLE;
722 static const ViewlistsHandle VIEWLISTS_HANDLE;
723 static const SelectionsHandle SELECTIONS_HANDLE;
734#if defined(INCLUDE_TEMPLATES) && !defined(SPLATCLOUDT_CC)
735# include "SplatCloudT_impl.hh"
The property handle, use it to access the properties.
void operator=(const CloudPropertyInterface &)=delete
Disallow the assign operator. (private and not implemented)
virtual size_t sizeOf() const =0
Get the size of type.
virtual const std::type_info & typeId() const =0
Get the runtime type information.
virtual ~CloudPropertyInterface()
Destructor.
virtual CloudPropertyInterface * clone() const =0
Return a deep copy of this.
CloudPropertyMapEntry()
Standard constructor.
unsigned int numRequests_
The number of times requestCloudProperty() was called and has not been released yet.
CloudPropertyInterface * property_
A valid pointer to a cloud-property.
CloudPropertyMapEntry(CloudPropertyInterface *_prop, unsigned int _num)
Constructor.
virtual ~CloudPropertyT()
Destructor.
virtual CloudPropertyT * clone() const override
Return a deep copy of this.
virtual const std::type_info & typeId() const override
Get the runtime type information.
virtual size_t sizeOf() const override
Get the size of type.
T data_
The actual stored data.
const T & ConstReference
These are used only out of a consistency reason to the class SplatPropertyT<T>.
T & Reference
These are references to T, not to CloudPropertyT<T>.
void operator=(const CloudPropertyT< T > &)=delete
Disallow the assign operator. (private and not implemented)
CloudPropertyT(const PropertyHandleT< T > &_handle)
Constructor.
ConstReference data() const
Access the data as const reference.
Reference data()
Access the data as reference.
PropertyHandleT(const BasePropertyHandle &_handle)
Constructor.
virtual ~SplatPropertyInterface()
Destructor.
virtual void clear()=0
Clear the data vector.
virtual void pushback()=0
Add one element at the end of the data vector.
virtual void resize(unsigned int _num)=0
Resize the data vector.
virtual SplatPropertyInterface * clone() const =0
Return a deep copy of this.
virtual const std::type_info & typeId() const =0
Get the runtime type information.
virtual void crop(const std::vector< int > &_indices)=0
Keep only the elements with given indices in the data vector. The indices have to be valid,...
virtual size_t sizeOf() const =0
Get the size of type.
SplatPropertyInterface * property_
A valid pointer to a splat-property.
SplatPropertyMapEntry(SplatPropertyInterface *_prop, unsigned int _num)
Constructor.
SplatPropertyMapEntry()
Standard constructor.
unsigned int numRequests_
The number of times requestSplatProperty() was called and has not been released yet.
virtual void resize(unsigned int _num) override
Resize the data vector.
std::vector< T >::const_reference ConstReference
These are used because a std::vector<bool>::reference is not the same as a reference to bool.
ConstReference data(int _idx) const
Access the data as const reference.
Reference data(int _idx)
Access the data as reference.
virtual void clear() override
Clear the data vector.
virtual void pushback() override
Add one element at the end of the data vector.
virtual size_t sizeOf() const override
Get the size of type.
virtual SplatPropertyT * clone() const override
Return a deep copy of this.
std::vector< T > data_
The actual stored data (one element per splat)
virtual ~SplatPropertyT()
Destructor.
virtual const std::type_info & typeId() const override
Get the runtime type information.
std::vector< T >::reference Reference
These are references to T, not to SplatPropertyT<T>.
SplatPropertyT(const PropertyHandleT< T > &_handle, unsigned int _num)
Constructor.
void getPredefinedSplatPropertyPointers()
Get pointers to predefined splat-properties.
void releaseColors()
Release the predefined property.
bool hasPointsizes() const
Return the availability of the predefined property.
SplatPropertyT< T > * releaseSplatProperty(const BasePropertyHandle &_handle)
Release a property.
Selection & selections(int _idx)
Get a reference of the predefined property's value.
const CloudPropertyT< T > * getCloudProperty(const BasePropertyHandle &_handle) const
Get a pointer to a property.
void releasePositions()
Release the predefined property.
void releaseIndices()
Release the predefined property.
const CloudPropertyMap & cloudProperties() const
Get all cloud-properties.
void releaseViewlists()
Release the predefined property.
Pointsize & pointsizes(int _idx)
Get a reference of the predefined property's value.
void swapPredefinedSplatPropertyPointers(SplatCloud &_splatCloud)
Swap pointers to predefined splat-properties.
CloudPropertyT< T > * requestCloudProperty(const BasePropertyHandle &_handle)
Request a new property.
const Normal & normals(int _idx) const
Get a reference of the predefined property's value.
Viewlist & viewlists(int _idx)
Get a reference of the predefined property's value.
SplatPropertyMap splatProperties_
Splat-property map.
const Position & positions(int _idx) const
Get a reference of the predefined property's value.
CloudPropertyMap cloudProperties_
Cloud-property map.
void getPredefinedCloudPropertyPointers()
Get pointers to predefined cloud-properties.
unsigned int numSplats() const
Get the number of splats.
void releaseNormals()
Release the predefined property.
CloudPropertyT< T > * releaseCloudProperty(const BasePropertyHandle &_handle)
Release a property.
void resetPredefinedSplatPropertyPointers()
Reset pointers to predefined splat-properties.
bool hasIndices() const
Return the availability of the predefined property.
const SplatPropertyT< T > * getSplatProperty(const BasePropertyHandle &_handle) const
Get a pointer to a property.
const SplatPropertyMap & splatProperties() const
Get all splat-properties.
bool requestNormals()
Request the predefined property.
const Viewlist & viewlists(int _idx) const
Get a reference of the predefined property's value.
bool requestPointsizes()
Request the predefined property.
bool hasPositions() const
Return the availability of the predefined property.
bool requestViewlists()
Request the predefined property.
void resetPredefinedCloudPropertyPointers()
Reset pointers to predefined cloud-properties.
Position & positions(int _idx)
Get a reference of the predefined property's value.
std::string BasePropertyHandle
const Index & indices(int _idx) const
Get a reference of the predefined property's value.
CloudPropertyT< T > * getCloudProperty(const BasePropertyHandle &_handle)
Get a pointer to a property.
std::map< BasePropertyHandle, SplatPropertyMapEntry > SplatPropertyMap
void releasePointsizes()
Release the predefined property.
unsigned int numSplats_
Number of splats.
bool hasSelections() const
Return the availability of the predefined property.
bool requestColors()
Request the predefined property.
const Pointsize & pointsizes(int _idx) const
Get a reference of the predefined property's value.
const Color & colors(int _idx) const
Get a reference of the predefined property's value.
bool requestIndices()
Request the predefined property.
Index & indices(int _idx)
Get a reference of the predefined property's value.
Normal & normals(int _idx)
Get a reference of the predefined property's value.
void releaseSelections()
Release the predefined property.
SplatCloud()
Standard constructor.
SplatPropertyT< T > * requestSplatProperty(const BasePropertyHandle &_handle)
Request a new property.
SplatCloud & operator=(const SplatCloud &_splatCloud)
Assign operator.
bool hasNormals() const
Return the availability of the predefined property.
SplatPropertyT< T > * getSplatProperty(const BasePropertyHandle &_handle)
Get a pointer to a property.
Color & colors(int _idx)
Get a reference of the predefined property's value.
std::map< BasePropertyHandle, CloudPropertyMapEntry > CloudPropertyMap
bool requestPositions()
Request the predefined property.
void swapPredefinedCloudPropertyPointers(SplatCloud &_splatCloud)
Swap pointers to predefined cloud-properties.
bool hasColors() const
Return the availability of the predefined property.
const Selection & selections(int _idx) const
Get a reference of the predefined property's value.
bool hasViewlists() const
Return the availability of the predefined property.
bool requestSelections()
Request the predefined property.
float y_
y-coordinate of pixel position
int featureIdx_
SIFT-feature index.
float x_
x-coordinate of pixel position
int cameraObjectId_
Camera-object id.