bool wasStopped() const;
- void showWidget(const String &id, const Widget &widget);
+ void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
bool removeWidget(const String &id);
private:
Viz3d(const Viz3d&);
void setPosition (int x, int y);
void setSize (int xw, int yw);
- void showWidget(const String &id, const Widget &widget);
+ void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
bool removeWidget(const String &id);
void all_data();
bool temp_viz::Viz3d::wasStopped() const { return impl_->wasStopped(); }
-void temp_viz::Viz3d::showWidget(const String &id, const Widget &widget)
+void temp_viz::Viz3d::showWidget(const String &id, const Widget &widget, const Affine3f &pose)
{
- impl_->showWidget(id, widget);
+ impl_->showWidget(id, widget, pose);
}
bool temp_viz::Viz3d::removeWidget(const String &id)
return (true);
}
-void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget)
+void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget, const Affine3f &pose)
{
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
bool exists = wam_itr != widget_actor_map_->end();
// Remove it if it exists and add it again
removeActorFromRenderer(wam_itr->second.actor);
}
- renderer_->AddActor(WidgetAccessor::getActor(widget));
- (*widget_actor_map_)[id].actor = WidgetAccessor::getActor(widget);
+ // Get the actor and set the user matrix
+ vtkSmartPointer<vtkLODActor> actor = vtkLODActor::SafeDownCast(WidgetAccessor::getActor(widget));
+ vtkSmartPointer<vtkMatrix4x4> matrix = convertToVtkMatrix(pose.matrix);
+ actor->SetUserMatrix (matrix);
+ actor->Modified();
+ renderer_->AddActor(actor);
+ (*widget_actor_map_)[id].actor = actor;
}
bool temp_viz::Viz3d::VizImpl::removeWidget(const String &id)
pw.setColor(temp_viz::Color(col_blue, col_green, col_red));
sw.setPose(cloudPosition);
- pw.setPose(cloudPosition);
+// pw.setPose(cloudPosition);
aw.setPose(cloudPosition);
cw.setPose(cloudPosition);
cyw.setPose(cloudPosition);
lw.setPose(cloudPosition);
cuw.setPose(cloudPosition);
+ v.showWidget("plane", pw, cloudPosition);
+
angle_x += 0.1f;
angle_y -= 0.1f;
angle_z += 0.1f;