44#ifndef PROPERTY_VISUALIZER_HH
45#define PROPERTY_VISUALIZER_HH
51#include <ACG/QtWidgets/QtHistogramWidget.hh>
52#include <ACG/Utils/IColorCoder.hh>
53#include <ACG/Utils/SmartPointer.hh>
55#include "OpenMesh/Core/Geometry/VectorT.hh"
57#ifdef ENABLE_SKELETON_SUPPORT
58 #include <ObjectTypes/Skeleton/BaseSkin.hh>
65 explicit VizException(
const std::string &msg) : std::logic_error(msg) {}
82 void log(
Logtype _type, QString _message);
83 void log(QString _message);
93 propertyInfo(_propertyInfo),
102 virtual void visualize(
bool _setDrawMode, QWidget* _widget);
111 virtual void clear();
119 virtual QString
getName() {
return propertyInfo.toString(); }
156 static inline QString toStr(
bool b) {
return b ? QObject::tr(
"True") : QObject::tr(
"False"); }
157 static inline QString toStr(
double d) {
return QObject::tr(
"%1").arg(d); }
158 static inline QString toStr(
int i) {
return QObject::tr(
"%1").arg(i); }
159 static inline QString toStr(uint8_t i) {
return QObject::tr(
"%1").arg(i); }
160 static inline QString toStr(
unsigned int i) {
return QObject::tr(
"%1").arg(i); }
165#ifdef ENABLE_SKELETON_SUPPORT
168#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
172 static inline bool strToBool (QString str) {
return (str.compare(QObject::tr(
"True"))==0); }
173 static inline double strToDouble(QString str) {
return str.toDouble() ; }
174 static inline int strToInt (QString str) {
return str.toInt(); }
175 static inline unsigned int strToUInt (QString str) {
return str.toUInt(); }
180 template <
typename Vec3T>
static Vec3T strToVec3 (QString str);
183 virtual std::unique_ptr<ACG::IColorCoder> buildColorCoder();
185 template<
typename PropType,
typename Iterable>
195template<
typename PropType,
typename Iterable>
196void PropertyVisualizer::showHistogramT(
200 widget->setMinimumHeight(300);
201 widget->setColorCoder(buildColorCoder());
202 widget->setHistogram(ACG::create_histogram_auto(data));
205template <
typename Vec3T>
206Vec3T PropertyVisualizer::strToVec3 (QString str)
210 s.truncate(s.lastIndexOf(
")"));
211 QStringList strList = s.split(QObject::tr(
", "));
212 return Vec3T(strList[0].toDouble(),strList[1].toDouble(),strList[2].toDouble());
Logtype
Log types for Message Window.
std::map< unsigned int, double > SkinWeights
Stores the joint weights per vertex.
Cellection of information about a property.
This class vizualizes a property.
virtual void duplicateProperty()
Duplicates the property.
virtual int getEntityCount()=0
Returns the number of entities.
virtual QString getName()
Returns a beautiful name.
virtual void clear()
Clears the property visualization.
virtual QString getHeader()=0
Returns the header for saving.
virtual QString getPropertyText(unsigned int i)=0
Returns the value of a property in text form.
PropertyVisualizer(const PropertyInfo &_propertyInfo)
Constructor.
virtual ~PropertyVisualizer()
Destructor.
virtual void visualize(bool _setDrawMode, QWidget *_widget)
Visualizes the property.
const PropertyInfo & getPropertyInfo() const
Returns the PropertyInfo.
virtual void setPropertyFromText(unsigned int index, QString text)=0
Returns the value of a property in text form.
virtual QWidget * getWidget()
Returns the visualizer's widget.
virtual void removeProperty()
Removes the property.