diff --git a/src/map_element.cpp b/src/map_element.cpp index c52e79b..85fbc39 100644 --- a/src/map_element.cpp +++ b/src/map_element.cpp @@ -179,12 +179,24 @@ void MapElement::visualizeMap(lanelet::LaneletMapConstPtr theMap) { // Create manual objects that will be attached to the scene-node + if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) { + sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_)); + } Ogre::ManualObject* mapManualObject = sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++)); + if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) { + sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_)); + } Ogre::ManualObject* seperatorManualObject = sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++)); + if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) { + sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_)); + } Ogre::ManualObject* areaManualObject = sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++)); + if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) { + sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_)); + } Ogre::ManualObject* parkingManualObject = sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++)); @@ -397,4 +409,4 @@ Ogre::Vector3 MapElement::ogreVec3FromLLetPoint(const lanelet::ConstPoint3d poin return Ogre::Vector3(numeric_cast(point.x()), numeric_cast(point.y()), 0.f); } -} // namespace lanelet_rviz_plugin_ros \ No newline at end of file +} // namespace lanelet_rviz_plugin_ros