| 1176 | namespace |
| 1177 | { |
| 1178 | std::vector<DocumentObject*> |
| 1179 | getSubObjectListFlatten(const std::vector<App::DocumentObject*>& resNotFlatten, |
| 1180 | std::vector<int>* const subsizes, |
| 1181 | const App::DocumentObject* sobj, |
| 1182 | App::DocumentObject** container, |
| 1183 | bool& lastChild) |
| 1184 | { |
| 1185 | auto res {resNotFlatten}; |
| 1186 | auto linked = sobj->getLinkedObject(); |
| 1187 | if (*container) { |
| 1188 | auto grp = App::GeoFeatureGroupExtension::getGroupOfObject(linked); |
| 1189 | if (grp != *container) { |
| 1190 | *container = nullptr; |
| 1191 | } |
| 1192 | else { |
| 1193 | if (lastChild && !res.empty()) { |
| 1194 | res.pop_back(); |
| 1195 | if (subsizes) { |
| 1196 | subsizes->pop_back(); |
| 1197 | } |
| 1198 | } |
| 1199 | lastChild = true; |
| 1200 | } |
| 1201 | } |
| 1202 | if (linked->getExtensionByType<App::GeoFeatureGroupExtension>(true)) { |
| 1203 | *container = linked; |
| 1204 | lastChild = false; |
| 1205 | } |
| 1206 | else if (linked != sobj || sobj->hasChildElement()) { |
| 1207 | // Check for Link or LinkGroup |
| 1208 | *container = nullptr; |
| 1209 | } |
| 1210 | else if (auto ext = sobj->getExtensionByType<LinkBaseExtension>(true)) { |
| 1211 | // check for Link array |
| 1212 | if (ext->getElementCountValue() != 0) { |
| 1213 | *container = nullptr; |
| 1214 | } |
| 1215 | } |
| 1216 | return res; |
| 1217 | } |
| 1218 | } // namespace |
| 1219 | |
| 1220 | std::vector<DocumentObject*> DocumentObject::getSubObjectList(const char* subname, |
no test coverage detected