Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
Plugin-PropertyVis
Commits
1b86f07e
Commit
1b86f07e
authored
Nov 10, 2016
by
Martin Heistermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Propvis histograms: use unique_ptr where possible.
parent
bd79ca9a
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
33 additions
and
37 deletions
+33
-37
OpenMesh/OMPropertyVisualizerDouble.hh
OpenMesh/OMPropertyVisualizerDouble.hh
+2
-3
OpenMesh/OMPropertyVisualizerDoubleT.cc
OpenMesh/OMPropertyVisualizerDoubleT.cc
+5
-7
OpenMesh/OMPropertyVisualizerIntegerT.cc
OpenMesh/OMPropertyVisualizerIntegerT.cc
+4
-5
OpenVolumeMesh/OVMPropertyVisualizerDouble.hh
OpenVolumeMesh/OVMPropertyVisualizerDouble.hh
+2
-1
OpenVolumeMesh/OVMPropertyVisualizerDoubleT.cc
OpenVolumeMesh/OVMPropertyVisualizerDoubleT.cc
+2
-3
OpenVolumeMesh/OVMPropertyVisualizerInteger.hh
OpenVolumeMesh/OVMPropertyVisualizerInteger.hh
+2
-1
OpenVolumeMesh/OVMPropertyVisualizerIntegerT.cc
OpenVolumeMesh/OVMPropertyVisualizerIntegerT.cc
+2
-3
PropertyVisualizer.cc
PropertyVisualizer.cc
+1
-1
PropertyVisualizer.hh
PropertyVisualizer.hh
+3
-3
Widgets/DoubleWidget.hh
Widgets/DoubleWidget.hh
+5
-5
Widgets/IntegerWidget.hh
Widgets/IntegerWidget.hh
+5
-5
No files found.
OpenMesh/OMPropertyVisualizerDouble.hh
View file @
1b86f07e
...
...
@@ -58,8 +58,7 @@
#include <ACG/Utils/ColorCoder.hh>
#include <memory>
#include <iostream>
template
<
typename
MeshT
>
...
...
@@ -85,7 +84,7 @@ protected:
virtual
void
setHalfedgePropertyFromText
(
unsigned
int
index
,
QString
text
);
virtual
void
setVertexPropertyFromText
(
unsigned
int
index
,
QString
text
);
ACG
::
IColorCoder
*
buildColorCoder
()
override
;
std
::
unique_ptr
<
ACG
::
IColorCoder
>
buildColorCoder
()
override
;
};
...
...
OpenMesh/OMPropertyVisualizerDoubleT.cc
View file @
1b86f07e
...
...
@@ -73,7 +73,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode)
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
doubleWidget
->
doubleMin
->
color
());
// color coder in [0,1]
ACG
::
IColorCoder
*
cc
=
doubleWidget
->
buildColorCoder
();
auto
cc
=
doubleWidget
->
buildColorCoder
();
OpenMesh
::
FPropHandleT
<
double
>
prop
;
...
...
@@ -140,7 +140,6 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeFaceProp(bool _setDrawMode)
OMPropertyVisualizer
<
MeshT
>::
mesh
->
set_color
(
*
f_it
,
color
);
}
}
delete
cc
;
if
(
_setDrawMode
)
PluginFunctions
::
setDrawMode
(
ACG
::
SceneGraph
::
DrawModes
::
SOLID_FACES_COLORED
);
...
...
@@ -155,7 +154,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp(bool _setDrawMode)
colorMin
=
ACG
::
to_Vec4f
(
doubleWidget
->
doubleMin
->
color
());
// color coder in [0,1]
ACG
::
IColorCoder
*
cc
=
doubleWidget
->
buildColorCoder
();
auto
cc
=
doubleWidget
->
buildColorCoder
();
//TODO check if this also works if the property is Vec3d
OpenMesh
::
EPropHandleT
<
double
>
prop
;
...
...
@@ -224,7 +223,6 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeEdgeProp(bool _setDrawMode)
OMPropertyVisualizer
<
MeshT
>::
mesh
->
set_color
(
*
e_it
,
color
);
}
}
delete
cc
;
if
(
_setDrawMode
)
PluginFunctions
::
setDrawMode
(
ACG
::
SceneGraph
::
DrawModes
::
EDGES_COLORED
);
...
...
@@ -239,7 +237,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeHalfedgeProp(bool _setDrawMode)
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
doubleWidget
->
doubleMin
->
color
());
// color coder in [0,1]
ACG
::
IColorCoder
*
cc
=
doubleWidget
->
buildColorCoder
();
auto
cc
=
doubleWidget
->
buildColorCoder
();
//TODO check if this also works if the property is Vec3d
OpenMesh
::
HPropHandleT
<
double
>
prop
;
...
...
@@ -319,7 +317,7 @@ void OMPropertyVisualizerDouble<MeshT>::visualizeVertexProp(bool _setDrawMode)
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
doubleWidget
->
doubleMin
->
color
());
// color coder in [0,1]
ACG
::
IColorCoder
*
cc
=
doubleWidget
->
buildColorCoder
();
auto
cc
=
doubleWidget
->
buildColorCoder
();
//TODO check if this also works if the property is Vec3d
OpenMesh
::
VPropHandleT
<
double
>
prop
;
...
...
@@ -453,7 +451,7 @@ void OMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(unsigned int i
}
template
<
typename
MeshT
>
ACG
::
IColorCoder
*
OMPropertyVisualizerDouble
<
MeshT
>::
buildColorCoder
()
std
::
unique_ptr
<
ACG
::
IColorCoder
>
OMPropertyVisualizerDouble
<
MeshT
>::
buildColorCoder
()
{
DoubleWidget
*
doubleWidget
=
static_cast
<
DoubleWidget
*>
(
PropertyVisualizer
::
widget
);
return
doubleWidget
->
buildColorCoder
();
...
...
OpenMesh/OMPropertyVisualizerIntegerT.cc
View file @
1b86f07e
...
...
@@ -81,7 +81,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode)
IntegerWidget
*
integerWidget
=
static_cast
<
IntegerWidget
*>
(
PropertyVisualizer
::
widget
);
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
integerWidget
->
intMin
->
color
());
ACG
::
IColorCoder
*
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
auto
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
std
::
map
<
int
,
typename
MeshT
::
Color
>
randomColor
;
...
...
@@ -146,7 +146,6 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeFaceProp(bool _setDrawMode)
OMPropertyVisualizer
<
MeshT
>::
mesh
->
set_color
(
*
f_it
,
color
);
}
}
delete
cc
;
if
(
_setDrawMode
)
PluginFunctions
::
setDrawMode
(
ACG
::
SceneGraph
::
DrawModes
::
SOLID_FACES_COLORED
);
...
...
@@ -158,7 +157,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeEdgeProp(bool _setDrawMode)
IntegerWidget
*
integerWidget
=
static_cast
<
IntegerWidget
*>
(
PropertyVisualizer
::
widget
);
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
integerWidget
->
intMin
->
color
());
ACG
::
IColorCoder
*
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
auto
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
std
::
map
<
int
,
typename
MeshT
::
Color
>
randomColor
;
...
...
@@ -235,7 +234,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeHalfedgeProp(bool _setDrawM
IntegerWidget
*
integerWidget
=
static_cast
<
IntegerWidget
*>
(
PropertyVisualizer
::
widget
);
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
integerWidget
->
intMin
->
color
());
ACG
::
IColorCoder
*
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
auto
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
std
::
map
<
int
,
typename
MeshT
::
Color
>
randomColor
;
...
...
@@ -311,7 +310,7 @@ void OMPropertyVisualizerInteger<MeshT, T>::visualizeVertexProp(bool _setDrawMod
IntegerWidget
*
integerWidget
=
static_cast
<
IntegerWidget
*>
(
PropertyVisualizer
::
widget
);
typename
MeshT
::
Color
colorMin
=
ACG
::
to_Vec4f
(
integerWidget
->
intMin
->
color
());
ACG
::
IColorCoder
*
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
auto
cc
=
integerWidget
->
buildColorCoder
();
// color coder in [0,1]
std
::
map
<
int
,
typename
MeshT
::
Color
>
randomColor
;
...
...
OpenVolumeMesh/OVMPropertyVisualizerDouble.hh
View file @
1b86f07e
...
...
@@ -60,6 +60,7 @@
#include <ACG/Utils/IColorCoder.hh>
#include <memory>
#include <iostream>
template
<
typename
MeshT
>
...
...
@@ -90,7 +91,7 @@ protected:
virtual
void
setHalfedgePropertyFromText
(
unsigned
int
index
,
QString
text
);
virtual
void
setVertexPropertyFromText
(
unsigned
int
index
,
QString
text
);
ACG
::
IColorCoder
*
buildColorCoder
()
override
;
std
::
unique_ptr
<
ACG
::
IColorCoder
>
buildColorCoder
()
override
;
};
#if defined(INCLUDE_TEMPLATES) && !defined(OVM_PROPERTY_VISUALIZER_DOUBLE_CC)
...
...
OpenVolumeMesh/OVMPropertyVisualizerDoubleT.cc
View file @
1b86f07e
...
...
@@ -82,7 +82,7 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
DoubleWidget
*
doubleWidget
=
static_cast
<
DoubleWidget
*>
(
PropertyVisualizer
::
widget
);
ACG
::
Vec4f
colorMin
=
ACG
::
to_Vec4f
(
doubleWidget
->
doubleMin
->
color
());
ACG
::
IColorCoder
*
cc
=
doubleWidget
->
buildColorCoder
();
auto
cc
=
doubleWidget
->
buildColorCoder
();
double
min
,
max
;
if
(
doubleWidget
->
doubleAbsolute
->
isChecked
()
){
...
...
@@ -149,7 +149,6 @@ void OVMPropertyVisualizerDouble<MeshT>::visualizeProp(PropType prop, EntityIter
object
->
colors
()[
*
e_it
]
=
color
;
}
}
delete
cc
;
}
CALLS_TO_VISUALIZE_PROP
(
OVMPropertyVisualizerDouble
<
MeshT
>
,
typename
MeshT
,
double
)
...
...
@@ -268,7 +267,7 @@ void OVMPropertyVisualizerDouble<MeshT>::setVertexPropertyFromText(unsigned int
}
template
<
typename
MeshT
>
ACG
::
IColorCoder
*
OVMPropertyVisualizerDouble
<
MeshT
>::
buildColorCoder
()
std
::
unique_ptr
<
ACG
::
IColorCoder
>
OVMPropertyVisualizerDouble
<
MeshT
>::
buildColorCoder
()
{
DoubleWidget
*
doubleWidget
=
static_cast
<
DoubleWidget
*>
(
PropertyVisualizer
::
widget
);
return
doubleWidget
->
buildColorCoder
();
...
...
OpenVolumeMesh/OVMPropertyVisualizerInteger.hh
View file @
1b86f07e
...
...
@@ -59,6 +59,7 @@
#include <ACG/Utils/HuePartitioningColors.hh>
#include <iostream>
#include <memory>
template
<
typename
MeshT
,
typename
T
>
class
OVMPropertyVisualizerInteger
:
public
OVMPropertyVisualizer
<
MeshT
>
{
...
...
@@ -88,7 +89,7 @@ protected:
virtual
void
setHalfedgePropertyFromText
(
unsigned
int
index
,
QString
text
);
virtual
void
setVertexPropertyFromText
(
unsigned
int
index
,
QString
text
);
ACG
::
IColorCoder
*
buildColorCoder
()
override
;
std
::
unique_ptr
<
ACG
::
IColorCoder
>
buildColorCoder
()
override
;
T
mNumericLimitMax
;
T
mNumericLimitMin
;
...
...
OpenVolumeMesh/OVMPropertyVisualizerIntegerT.cc
View file @
1b86f07e
...
...
@@ -112,7 +112,7 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
integerWidget
->
intFixedRangeMax
->
setValue
(
max
);
}
ACG
::
IColorCoder
*
cc
=
integerWidget
->
buildColorCoder
();
auto
cc
=
integerWidget
->
buildColorCoder
();
unsigned
int
range
=
max
-
min
;
VolumeMeshObject
<
MeshT
>*
object
;
...
...
@@ -145,7 +145,6 @@ void OVMPropertyVisualizerInteger<MeshT, T>::visualizeProp(PropType prop, Entity
object
->
colors
()[
*
e_it
]
=
color
;
}
}
delete
cc
;
}
#define KOMMA ,
CALLS_TO_VISUALIZE_PROP
(
OVMPropertyVisualizerInteger
<
MeshT
KOMMA
T
>
,
typename
MeshT
KOMMA
typename
T
,
T
)
...
...
@@ -266,7 +265,7 @@ void OVMPropertyVisualizerInteger<MeshT, T>::setVertexPropertyFromText(unsigned
}
template
<
typename
MeshT
,
typename
T
>
ACG
::
IColorCoder
*
OVMPropertyVisualizerInteger
<
MeshT
,
T
>::
buildColorCoder
()
std
::
unique_ptr
<
ACG
::
IColorCoder
>
OVMPropertyVisualizerInteger
<
MeshT
,
T
>::
buildColorCoder
()
{
IntegerWidget
*
integerWidget
=
static_cast
<
IntegerWidget
*>
(
PropertyVisualizer
::
widget
);
return
integerWidget
->
buildColorCoder
();
...
...
PropertyVisualizer.cc
View file @
1b86f07e
...
...
@@ -156,7 +156,7 @@ OpenMesh::Vec2f PropertyVisualizer::strToVec2f (QString str)
return
OpenMesh
::
Vec2f
(
strList
[
0
].
toFloat
(),
strList
[
1
].
toFloat
());
}
ACG
::
IColorCoder
*
PropertyVisualizer
::
buildColorCoder
()
std
::
unique_ptr
<
ACG
::
IColorCoder
>
PropertyVisualizer
::
buildColorCoder
()
{
throw
std
::
runtime_error
(
"Requested color coder on a Propvis that does not implement it"
);
}
PropertyVisualizer.hh
View file @
1b86f07e
...
...
@@ -56,6 +56,7 @@
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <ACG/QtWidgets/QtHistogramWidget.hh>
#include <ACG/Utils/IColorCoder.hh>
#include <ACG/Utils/SmartPointer.hh>
#include "OpenMesh/Core/Geometry/VectorT.hh"
...
...
@@ -180,7 +181,7 @@ public:
protected:
virtual
ACG
::
IColorCoder
*
buildColorCoder
();
virtual
std
::
unique_ptr
<
ACG
::
IColorCoder
>
buildColorCoder
();
template
<
typename
PropType
,
typename
Iterable
>
void
showHistogramT
(
ACG
::
QtWidgets
::
QtHistogramWidget
*
widget
,
...
...
@@ -200,8 +201,7 @@ void PropertyVisualizer::showHistogramT(
const
size_t
max_bins
=
50
;
// TODO: expose in GUI?
widget
->
setMinimumHeight
(
300
);
widget
->
setColorCoder
(
buildColorCoder
());
ACG
::
Histogram
*
hist
=
new
ACG
::
HistogramT
<
PropType
>
(
data
.
begin
(),
data
.
end
(),
max_bins
);
widget
->
setHistogram
(
hist
);
widget
->
setHistogram
(
ptr
::
make_unique
<
ACG
::
HistogramT
<
PropType
>>
(
data
.
begin
(),
data
.
end
(),
max_bins
));
}
#endif
/* PROPERTY_VISUALIZER_HH */
Widgets/DoubleWidget.hh
View file @
1b86f07e
...
...
@@ -55,6 +55,7 @@
#include "ACG/Utils/IColorCoder.hh"
#include "ACG/Utils/LinearTwoColorCoder.hh"
#include <ACG/Utils/ColorConversion.hh>
#include <ACG/Utils/SmartPointer.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
...
...
@@ -76,15 +77,14 @@ public:
/**
* @brief Builds a color coder according to UI settings
* @return Pointer to an IColorCoder for parameters in [0..1]
* @note Caller is responsible for deleting the returned object.
* @return unique_ptr to an IColorCoder for parameters in [0..1]
*/
ACG
::
IColorCoder
*
buildColorCoder
()
std
::
unique_ptr
<
ACG
::
IColorCoder
>
buildColorCoder
()
{
if
(
doubleColorCoder
->
isChecked
())
{
return
new
ACG
::
ColorCoder
();
return
ptr
::
make_unique
<
ACG
::
ColorCoder
>
();
}
else
{
return
new
ACG
::
LinearTwoColorCoder
(
return
ptr
::
make_unique
<
ACG
::
LinearTwoColorCoder
>
(
ACG
::
to_Vec4f
(
doubleMin
->
color
()),
ACG
::
to_Vec4f
(
doubleMax
->
color
()));
}
...
...
Widgets/IntegerWidget.hh
View file @
1b86f07e
...
...
@@ -56,6 +56,7 @@
#include "ACG/Utils/ColorCoder.hh"
#include "ACG/Utils/LinearTwoColorCoder.hh"
#include <ACG/Utils/ColorConversion.hh>
#include <ACG/Utils/SmartPointer.hh>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
...
...
@@ -77,15 +78,14 @@ public:
/**
* @brief Builds a color coder according to UI settings
* @return Pointer to an IColorCoder for parameters in [0..1]
* @note Caller is responsible for deleting the returned object.
* @return unique_ptr to an IColorCoder for parameters in [0..1]
*/
ACG
::
IColorCoder
*
buildColorCoder
()
std
::
unique_ptr
<
ACG
::
IColorCoder
>
buildColorCoder
()
{
if
(
intColorCoder
->
isChecked
())
{
return
new
ACG
::
ColorCoder
();
return
ptr
::
make_unique
<
ACG
::
ColorCoder
>
();
}
else
{
return
new
ACG
::
LinearTwoColorCoder
(
return
ptr
::
make_unique
<
ACG
::
LinearTwoColorCoder
>
(
ACG
::
to_Vec4f
(
intMin
->
color
()),
ACG
::
to_Vec4f
(
intMax
->
color
()));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment