Developer Documentation
Loading...
Searching...
No Matches
PropertyVisualizer.cc
1/*===========================================================================*\
2* *
3* OpenFlipper *
4 * Copyright (c) 2001-2015, RWTH-Aachen University *
5 * Department of Computer Graphics and Multimedia *
6 * All rights reserved. *
7 * www.openflipper.org *
8 * *
9 *---------------------------------------------------------------------------*
10 * This file is part of OpenFlipper. *
11 *---------------------------------------------------------------------------*
12 * *
13 * Redistribution and use in source and binary forms, with or without *
14 * modification, are permitted provided that the following conditions *
15 * are met: *
16 * *
17 * 1. Redistributions of source code must retain the above copyright notice, *
18 * this list of conditions and the following disclaimer. *
19 * *
20 * 2. Redistributions in binary form must reproduce the above copyright *
21 * notice, this list of conditions and the following disclaimer in the *
22 * documentation and/or other materials provided with the distribution. *
23 * *
24 * 3. Neither the name of the copyright holder nor the names of its *
25 * contributors may be used to endorse or promote products derived from *
26 * this software without specific prior written permission. *
27 * *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39* *
40\*===========================================================================*/
41
42
43
44#include "PropertyVisualizer.hh"
45#include "ACG/Math/Matrix3x3T.hh"
46
54void PropertyVisualizer::visualize(bool _setDrawMode, QWidget* _widget)
55{
56 log(LOGERR, "Visualizing for this type of object not yet supported.");
57}
58
67{
68 log(LOGERR, "Removing for this type of object not yet supported.");
69}
70
79{
80 log(LOGERR, "Duplicating for this type of object not yet supported.");
81}
82
91{
92 log(LOGERR, "Clearing for this type of object not yet supported.");
93}
94
95QString PropertyVisualizer::toStr(OpenMesh::Vec3d v)
96{
97 return QObject::tr("∥(%1, %2, %3)∥ = %4").arg(v[0]).arg(v[1]).arg(v[2])
98 .arg(v.norm());
99}
100
101QString PropertyVisualizer::toStr(OpenMesh::Vec2d v)
102{
103 return QObject::tr("∥(%1, %2)∥ = %3").arg(v[0]).arg(v[1]).arg(v.norm());
104}
105
106QString PropertyVisualizer::toStr(OpenMesh::Vec2f v)
107{
108 return QObject::tr("∥(%1, %2)∥ = %3").arg(v[0]).arg(v[1]).arg(v.norm());
109}
110
111QString PropertyVisualizer::toStr(const ACG::Matrix3x3d &v)
112{
113 return QString("(%1, %2, %3); (%4, %5, %6); (%7, %8, %9) ")
114 .arg(v(0, 0)).arg(v(0, 1)).arg(v(0, 2))
115 .arg(v(1, 0)).arg(v(1, 1)).arg(v(1, 2))
116 .arg(v(2, 0)).arg(v(2, 1)).arg(v(2, 2));
117}
118
119#ifdef ENABLE_SKELETON_SUPPORT
120QString PropertyVisualizer::toStr(BaseSkin::SkinWeights sw)
121{
122 QString text = "";
123 for (std::map<unsigned int, double>::iterator it = sw.begin(); it != sw.end(); ++it) {
124 text += "(";
125 text += QString::number((*it).first);
126 text += ",";
127 text += QString::number((*it).second);
128 text += ")\n";
129 }
130 return text;
131}
132#endif
133
134#ifdef ENABLE_POLYHEDRALMESH_SUPPORT
135QString PropertyVisualizer::toStr(OpenVolumeMesh::Vec3d v)
136{
137 return QObject::tr("∥(%1, %2, %3)∥ = %4").arg(v[0]).arg(v[1]).arg(v[2])
138 .arg(v.norm());
139}
140#endif
141
142
143OpenMesh::Vec3d PropertyVisualizer::strToVec3d (QString str)
144{
145 QString s = str;
146 s.remove(0,2);
147 s.truncate(s.lastIndexOf(")"));
148 QStringList strList = s.split(QObject::tr(", "));
149 return OpenMesh::Vec3d(strList[0].toDouble(),strList[1].toDouble(),strList[2].toDouble());
150}
151
152
153OpenMesh::Vec2d PropertyVisualizer::strToVec2d (QString str)
154{
155 QString s = str;
156 s.remove(0,2);
157 s.truncate(s.lastIndexOf(")"));
158 QStringList strList = s.split(QObject::tr(", "));
159 return OpenMesh::Vec2d(strList[0].toDouble(),strList[1].toDouble());
160}
161
162OpenMesh::Vec2f PropertyVisualizer::strToVec2f (QString str)
163{
164 QString s = str;
165 s.remove(0,2);
166 s.truncate(s.lastIndexOf(")"));
167 QStringList strList = s.split(QObject::tr(", "));
168 return OpenMesh::Vec2f(strList[0].toFloat(),strList[1].toFloat());
169}
170
171std::unique_ptr<ACG::IColorCoder> PropertyVisualizer::buildColorCoder()
172{
173 return nullptr;
174}
@ LOGERR
std::map< unsigned int, double > SkinWeights
Stores the joint weights per vertex.
Definition BaseSkin.hh:94
virtual void duplicateProperty()
Duplicates the property.
virtual void clear()
Clears the property visualization.
virtual void visualize(bool _setDrawMode, QWidget *_widget)
Visualizes the property.
virtual void removeProperty()
Removes the property.
VectorT< double, 2 > Vec2d
Definition Vector11T.hh:836
VectorT< float, 2 > Vec2f
Definition Vector11T.hh:834
VectorT< double, 3 > Vec3d
Definition Vector11T.hh:853