combine representation methods to one as setRepresentation

This commit is contained in:
Ozan Tonkal 2013-09-07 15:16:26 +02:00
parent 94ca5d65d0
commit fcf437cf69
4 changed files with 25 additions and 32 deletions

View File

@ -65,9 +65,7 @@ namespace cv
void setDesiredUpdateRate(double time);
double getDesiredUpdateRate();
void setRepresentationToSurface();
void setRepresentationToWireframe();
void setRepresentationToPoints();
void setRepresentation(int representation);
private:
struct VizImpl;

View File

@ -87,6 +87,4 @@ double cv::viz::Viz3d::getRenderingProperty(const String &id, int property) { re
void cv::viz::Viz3d::setDesiredUpdateRate(double time) { impl_->setDesiredUpdateRate(time); }
double cv::viz::Viz3d::getDesiredUpdateRate() { return impl_->getDesiredUpdateRate(); }
void cv::viz::Viz3d::setRepresentationToSurface() { impl_->setRepresentationToSurface(); }
void cv::viz::Viz3d::setRepresentationToWireframe() { impl_->setRepresentationToWireframe(); }
void cv::viz::Viz3d::setRepresentationToPoints() { impl_->setRepresentationToPoints(); }
void cv::viz::Viz3d::setRepresentation(int representation) { impl_->setRepresentation(representation); }

View File

@ -464,33 +464,32 @@ void cv::viz::Viz3d::VizImpl::resetCamera()
}
///////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setRepresentationToSurface()
void cv::viz::Viz3d::VizImpl::setRepresentation(int representation)
{
vtkActorCollection * actors = renderer_->GetActors();
actors->InitTraversal();
vtkActor * actor;
while ((actor = actors->GetNextActor()) != NULL)
actor->GetProperty()->SetRepresentationToSurface();
}
///////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setRepresentationToPoints()
{
vtkActorCollection * actors = renderer_->GetActors();
actors->InitTraversal();
vtkActor * actor;
while ((actor = actors->GetNextActor()) != NULL)
actor->GetProperty()->SetRepresentationToPoints();
}
///////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setRepresentationToWireframe()
{
vtkActorCollection * actors = renderer_->GetActors();
actors->InitTraversal();
vtkActor *actor;
while ((actor = actors->GetNextActor()) != NULL)
actor->GetProperty()->SetRepresentationToWireframe();
switch (representation)
{
case REPRESENTATION_POINTS:
{
while ((actor = actors->GetNextActor()) != NULL)
actor->GetProperty()->SetRepresentationToPoints();
break;
}
case REPRESENTATION_SURFACE:
{
while ((actor = actors->GetNextActor()) != NULL)
actor->GetProperty()->SetRepresentationToSurface();
break;
}
case REPRESENTATION_WIREFRAME:
{
while ((actor = actors->GetNextActor()) != NULL)
actor->GetProperty()->SetRepresentationToWireframe();
break;
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -44,9 +44,7 @@ public:
}
}
void setRepresentationToSurface();
void setRepresentationToPoints();
void setRepresentationToWireframe();
void setRepresentation(int representation);
void setCamera(const Camera &camera);
Camera getCamera() const;