19 mrpt::maps::CPointsMap::Ptr outPc;
21 if (layerName.empty())
26 THROW_EXCEPTION(
"Layer name cannot be empty");
29 if (
auto itLy = m.
layers.find(layerName); itLy != m.
layers.end())
31 outPc = std::dynamic_pointer_cast<mrpt::maps::CPointsMap>(itLy->second);
33 THROW_EXCEPTION_FMT(
"Layer '%s' must be of point cloud type.", layerName.c_str());
37 auto o = mrpt::rtti::classFactory(classForLayerCreation);
40 "Could not create layer of type '%s' (wrong or "
41 "unregistered class name?)",
42 classForLayerCreation.c_str()));
44 auto newMap = std::dynamic_pointer_cast<mrpt::maps::CPointsMap>(o);
47 "Provided class name '%s' seems not to be derived from "
48 "mrpt::maps::CPointsMap",
49 classForLayerCreation.c_str()));
52 m.
layers[layerName] = newMap;