MCPcopy Create free account
hub / github.com/PlotJuggler/PlotJuggler / addRobotModelLayer

Method addRobotModelLayer

pj_scene3D/widgets/src/Scene3DDockWidget.cpp:521–540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

519}
520
521ObjectTopicId Scene3DDockWidget::addRobotModelLayer(const QString& urdf_path) {
522 const ObjectTopicId topic_id = allocateLocalRobotLayerId();
523 if (topic_id.id == 0) {
524 qCWarning(lcScene3DDock) << "addRobotModelLayer: exhausted local topic ids";
525 return ObjectTopicId{0};
526 }
527 const QString title = urdf_path.isEmpty() ? tr("Robot model") : QFileInfo(urdf_path).fileName();
528 if (!addTopic(topic_id, sdk::BuiltinObjectType::kRobotDescription, title)) {
529 local_robot_layer_ids_.erase(topic_id.id);
530 return ObjectTopicId{0};
531 }
532 // One-click flow: point the freshly created File-source layer at the chosen
533 // URDF immediately (the creator already forced kFile per the PUNCH-4 rule).
534 if (!urdf_path.isEmpty()) {
535 if (auto* layer = dynamic_cast<RobotModelLayer*>(layerFor(topic_id)); layer != nullptr) {
536 layer->setSourceFile(urdf_path);
537 }
538 }
539 return topic_id;
540}
541
542ObjectTopicId Scene3DDockWidget::addRobotModelLayerFromUrl(const QString& url) {
543 const ObjectTopicId topic_id = allocateLocalRobotLayerId();

Callers 1

onAddModelClickedMethod · 0.80

Calls 4

trFunction · 0.85
eraseMethod · 0.80
setSourceFileMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected