remove VIZ prefix from rendering properties, fix setRenderingProperties and getRenderingProperties methods

This commit is contained in:
Ozan Tonkal 2013-09-07 14:48:46 +02:00
parent fdbf20c172
commit 94ca5d65d0
2 changed files with 129 additions and 101 deletions

View File

@ -10,14 +10,14 @@ namespace cv
/// Widget rendering properties /// Widget rendering properties
enum RenderingProperties enum RenderingProperties
{ {
VIZ_POINT_SIZE, POINT_SIZE,
VIZ_OPACITY, OPACITY,
VIZ_LINE_WIDTH, LINE_WIDTH,
VIZ_FONT_SIZE, FONT_SIZE,
VIZ_COLOR, COLOR,
VIZ_REPRESENTATION, REPRESENTATION,
VIZ_IMMEDIATE_RENDERING, IMMEDIATE_RENDERING,
VIZ_SHADING SHADING
}; };
enum RenderingRepresentationProperties enum RenderingRepresentationProperties

View File

@ -81,75 +81,40 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
switch (property) switch (property)
{ {
case VIZ_POINT_SIZE: case POINT_SIZE:
{ {
actor->GetProperty()->SetPointSize(float(value)); actor->GetProperty()->SetPointSize(float(value));
actor->Modified(); actor->Modified();
break; break;
} }
case VIZ_OPACITY: case OPACITY:
{ {
actor->GetProperty()->SetOpacity(value); actor->GetProperty()->SetOpacity(value);
actor->Modified(); actor->Modified();
break; break;
} }
// Turn on/off flag to control whether data is rendered using immediate case IMMEDIATE_RENDERING:
// mode or note. Immediate mode rendering tends to be slower but it can
// handle larger datasets. The default value is immediate mode off. If you
// are having problems rendering a large dataset you might want to consider
// using immediate more rendering.
case VIZ_IMMEDIATE_RENDERING:
{ {
actor->GetMapper()->SetImmediateModeRendering(int(value)); actor->GetMapper()->SetImmediateModeRendering(int(value));
actor->Modified(); actor->Modified();
break; break;
} }
case VIZ_LINE_WIDTH: case LINE_WIDTH:
{ {
actor->GetProperty()->SetLineWidth(float(value)); actor->GetProperty()->SetLineWidth(float(value));
actor->Modified(); actor->Modified();
break; break;
} }
default: case FONT_SIZE:
CV_Assert("setPointCloudRenderingProperties: Unknown property");
}
}
double cv::viz::Widget::getRenderingProperty(int property) const
{
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert("Widget type is not supported." && actor);
double value = 0.0;
switch (property)
{
case VIZ_POINT_SIZE:
{
value = actor->GetProperty ()->GetPointSize ();
actor->Modified ();
break;
}
case VIZ_OPACITY:
{
value = actor->GetProperty ()->GetOpacity ();
actor->Modified ();
break;
}
case VIZ_LINE_WIDTH:
{
value = actor->GetProperty ()->GetLineWidth ();
actor->Modified ();
break;
}
case VIZ_FONT_SIZE:
{ {
vtkTextActor* text_actor = vtkTextActor::SafeDownCast(actor); vtkTextActor* text_actor = vtkTextActor::SafeDownCast(actor);
CV_Assert("Widget does not have text content." && text_actor);
vtkSmartPointer<vtkTextProperty> tprop = text_actor->GetTextProperty(); vtkSmartPointer<vtkTextProperty> tprop = text_actor->GetTextProperty();
tprop->SetFontSize(int(value)); tprop->SetFontSize(int(value));
text_actor->Modified(); text_actor->Modified();
break; break;
} }
case VIZ_REPRESENTATION: case REPRESENTATION:
{ {
switch (int(value)) switch (int(value))
{ {
@ -160,7 +125,7 @@ double cv::viz::Widget::getRenderingProperty(int property) const
actor->Modified(); actor->Modified();
break; break;
} }
case VIZ_SHADING: case SHADING:
{ {
switch (int(value)) switch (int(value))
{ {
@ -193,6 +158,69 @@ double cv::viz::Widget::getRenderingProperty(int property) const
actor->Modified(); actor->Modified();
break; break;
} }
default:
CV_Assert("setPointCloudRenderingProperties: Unknown property");
}
}
double cv::viz::Widget::getRenderingProperty(int property) const
{
vtkActor *actor = vtkActor::SafeDownCast(WidgetAccessor::getProp(*this));
CV_Assert("Widget type is not supported." && actor);
double value = 0.0;
switch (property)
{
case POINT_SIZE:
{
value = actor->GetProperty()->GetPointSize();
break;
}
case OPACITY:
{
value = actor->GetProperty()->GetOpacity();
break;
}
case IMMEDIATE_RENDERING:
{
value = actor->GetMapper()->GetImmediateModeRendering();
break;
}
case LINE_WIDTH:
{
value = actor->GetProperty()->GetLineWidth();
break;
}
case FONT_SIZE:
{
vtkTextActor* text_actor = vtkTextActor::SafeDownCast(actor);
CV_Assert("Widget does not have text content." && text_actor);
vtkSmartPointer<vtkTextProperty> tprop = text_actor->GetTextProperty();
value = tprop->GetFontSize();
break;
}
case REPRESENTATION:
{
switch (actor->GetProperty()->GetRepresentation())
{
case VTK_POINTS: value = REPRESENTATION_POINTS; break;
case VTK_WIREFRAME: value = REPRESENTATION_WIREFRAME; break;
case VTK_SURFACE: value = REPRESENTATION_SURFACE; break;
}
break;
}
case SHADING:
{
switch (actor->GetProperty()->GetInterpolation())
{
case VTK_FLAT: value = SHADING_FLAT; break;
case VTK_GOURAUD: value = SHADING_GOURAUD; break;
case VTK_PHONG: value = SHADING_PHONG; break;
}
break;
}
default: default:
CV_Assert("getPointCloudRenderingProperties: Unknown property"); CV_Assert("getPointCloudRenderingProperties: Unknown property");
} }