1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
|
//##########################################################################
//# #
//# CLOUDCOMPARE #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 or later of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
//# #
//##########################################################################
#ifndef CC_INDEXED_TRANSFORMATION_BUFFER_HEADER
#define CC_INDEXED_TRANSFORMATION_BUFFER_HEADER
//Local
#include "ccIndexedTransformation.h"
#include "ccHObject.h"
//system
#include <float.h>
//! Indexed Transformation buffer
class ccIndexedTransformationBuffer : public ccHObject, public std::vector< ccIndexedTransformation >
{
public:
//! Default constructor
QCC_DB_LIB_API ccIndexedTransformationBuffer(QString name = QString("Trans. buffer"));
//! Copy constructor
QCC_DB_LIB_API ccIndexedTransformationBuffer(const ccIndexedTransformationBuffer& buffer);
//inherited from ccHObject
virtual CC_CLASS_ENUM getClassID() const override { return CC_TYPES::TRANS_BUFFER; }
virtual bool isSerializable() const override { return true; }
//! Sorts transformations based on their index
/** Ascending sort.
**/
QCC_DB_LIB_API void sort();
//! Returns the nearest indexed transformation(s) to a given index
/** This method returns the preceding and following transformations.
\warning Binary search: buffer must be sorted! (see ccIndexedTransformationBuffer::sort)
\param index query index (e.g. timestamp)
\param trans1 directly preceding transformation (if any - null otherwise)
\param trans2 directly following transformation (if any - null otherwise)
\param trans1IndexInBuffer (optional) index of trans1 in buffer
\param trans2IndexInBuffer (optional) index of trans2 in buffer
\return success
**/
QCC_DB_LIB_API bool findNearest(double index,
const ccIndexedTransformation* &trans1,
const ccIndexedTransformation* &trans2,
size_t* trans1IndexInBuffer = 0,
size_t* trans2IndexInBuffer = 0) const;
//! Returns the indexed transformation at a given index (interpolates it if necessary)
/** \warning Binary search: buffer must be sorted! (see ccIndexedTransformationBuffer::sort)
\param index query index (e.g. timestamp)
\param trans output transformation (if successful)
\param maxIndexDistForInterpolation max 'distance' between query index and existing indexes to actually interpolate/output a transformation
\return success
**/
QCC_DB_LIB_API bool getInterpolatedTransformation( double index,
ccIndexedTransformation& trans,
double maxIndexDistForInterpolation = DBL_MAX) const;
//! [Display option] Returns whether trihedrons should be displayed or not (otherwise only points or a polyline)
bool triherdonsShown() { return m_showTrihedrons; }
//! [Display option] Sets whether trihedrons should be displayed or not (otherwise only points or a polyline)
void showTriherdons(bool state) { m_showTrihedrons = state; }
//! [Display option] Returns trihedron display size
float triherdonsDisplayScale() { return m_trihedronsScale; }
//! [Display option] Sets trihedron display size
void setTriherdonsDisplayScale(float scale) { m_trihedronsScale = scale; }
//! [Display option] Returns whether the path should be displayed as a polyline or not (otherwise only points)
bool isPathShonwAsPolyline() { return m_showAsPolyline; }
//! [Display option] Sets whether the path should be displayed as a polyline or not (otherwise only points)
void showPathAsPolyline(bool state) { m_showAsPolyline = state; }
//! Invalidates the bounding box
/** Should be called whenever the content of this structure changes!
**/
QCC_DB_LIB_API void invalidateBoundingBox();
//Inherited from ccHObject
QCC_DB_LIB_API virtual ccBBox getOwnBB(bool withGLFeatures = false) override;
protected:
//inherited from ccHObject
QCC_DB_LIB_API virtual bool toFile_MeOnly(QFile& out) const override;
QCC_DB_LIB_API virtual bool fromFile_MeOnly(QFile& in, short dataVersion, int flags) override;
QCC_DB_LIB_API virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override;
//! Bounding box
ccBBox m_bBox;
//! Bounding box last 'validity' size
size_t m_bBoxValidSize;
//! Whether the path should be displayed as a polyline or not
bool m_showAsPolyline;
//! Whether trihedrons should be displayed or not
bool m_showTrihedrons;
//! Trihedrons display scale
float m_trihedronsScale;
};
#endif
|