remove widget implementation
This commit is contained in:
parent
ecdd8513fd
commit
5bb95c4110
@ -72,6 +72,7 @@ namespace temp_viz
|
||||
bool wasStopped() const;
|
||||
|
||||
void showWidget(const String &id, const Widget &widget);
|
||||
bool removeWidget(const String &id);
|
||||
private:
|
||||
Viz3d(const Viz3d&);
|
||||
Viz3d& operator=(const Viz3d&);
|
||||
|
@ -247,6 +247,8 @@ public:
|
||||
void setSize (int xw, int yw);
|
||||
|
||||
void showWidget(const String &id, const Widget &widget);
|
||||
bool removeWidget(const String &id);
|
||||
|
||||
void all_data();
|
||||
|
||||
private:
|
||||
|
@ -143,3 +143,8 @@ void temp_viz::Viz3d::showWidget(const String &id, const Widget &widget)
|
||||
{
|
||||
impl_->showWidget(id, widget);
|
||||
}
|
||||
|
||||
bool temp_viz::Viz3d::removeWidget(const String &id)
|
||||
{
|
||||
return impl_->removeWidget(id);
|
||||
}
|
||||
|
@ -1183,3 +1183,21 @@ void temp_viz::Viz3d::VizImpl::showWidget(const String &id, const Widget &widget
|
||||
renderer_->AddActor(WidgetAccessor::getActor(widget));
|
||||
(*widget_actor_map_)[id].actor = WidgetAccessor::getActor(widget);
|
||||
}
|
||||
|
||||
bool temp_viz::Viz3d::VizImpl::removeWidget(const String &id)
|
||||
{
|
||||
WidgetActorMap::iterator wam_itr = widget_actor_map_->find(id);
|
||||
bool exists = !(wam_itr == widget_actor_map_->end());
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
std::cout << "[removeWidget] A widget with id <" << id << "> does not exist!" << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!removeActorFromRenderer (wam_itr->second.actor))
|
||||
return false;
|
||||
|
||||
widget_actor_map_->erase(wam_itr);
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user