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);
105 virtual void removeProperty();
108 virtual void duplicateProperty();
111 virtual void clear();
119 virtual QString
getName() {
return propertyInfo.toString(); }
136 virtual QString getPropertyText(
unsigned int i) = 0;
148 virtual void setPropertyFromText(
unsigned int index, QString text) = 0;
151 virtual int getEntityCount() = 0;
154 virtual QString getHeader() = 0;
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>
195 template<
typename PropType,
typename Iterable>
196 void PropertyVisualizer::showHistogramT(
200 widget->setMinimumHeight(300);
201 widget->setColorCoder(buildColorCoder());
202 widget->setHistogram(ACG::create_histogram_auto(data));
205 template <
typename Vec3T>
206 Vec3T 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());
PropertyVisualizer(const PropertyInfo &_propertyInfo)
Constructor.
virtual QWidget * getWidget()
Returns the visualizer's widget.
virtual ~PropertyVisualizer()
Destructor.
Logtype
Log types for Message Window.
std::map< unsigned int, double > SkinWeights
Stores the joint weights per vertex.
virtual QString getName()
Returns a beautiful name.
const PropertyInfo & getPropertyInfo() const
Returns the PropertyInfo.
Cellection of information about a property.
This class vizualizes a property.