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
enum RenderingProperties
{
VIZ_POINT_SIZE,
VIZ_OPACITY,
VIZ_LINE_WIDTH,
VIZ_FONT_SIZE,
VIZ_COLOR,
VIZ_REPRESENTATION,
VIZ_IMMEDIATE_RENDERING,
VIZ_SHADING
POINT_SIZE,
OPACITY,
LINE_WIDTH,
FONT_SIZE,
COLOR,
REPRESENTATION,
IMMEDIATE_RENDERING,
SHADING
};
enum RenderingRepresentationProperties

View File

@ -81,75 +81,40 @@ void cv::viz::Widget::setRenderingProperty(int property, double value)
switch (property)
{
case VIZ_POINT_SIZE:
case POINT_SIZE:
{
actor->GetProperty()->SetPointSize(float(value));
actor->Modified();
break;
}
case VIZ_OPACITY:
case OPACITY:
{
actor->GetProperty()->SetOpacity(value);
actor->Modified();
break;
}
// Turn on/off flag to control whether data is rendered using immediate
// 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:
case IMMEDIATE_RENDERING:
{
actor->GetMapper()->SetImmediateModeRendering(int(value));
actor->Modified();
break;
}
case VIZ_LINE_WIDTH:
case LINE_WIDTH:
{
actor->GetProperty()->SetLineWidth(float(value));
actor->Modified();
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 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:
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();
tprop->SetFontSize(int(value));
text_actor->Modified();
break;
}
case VIZ_REPRESENTATION:
case REPRESENTATION:
{
switch (int(value))
{
@ -160,7 +125,7 @@ double cv::viz::Widget::getRenderingProperty(int property) const
actor->Modified();
break;
}
case VIZ_SHADING:
case SHADING:
{
switch (int(value))
{
@ -193,6 +158,69 @@ double cv::viz::Widget::getRenderingProperty(int property) const
actor->Modified();
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:
CV_Assert("getPointCloudRenderingProperties: Unknown property");
}