MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / addObjects

Method addObjects

src/App/GeoFeatureGroupExtension.cpp:147–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145}
146
147std::vector<DocumentObject*>
148GeoFeatureGroupExtension::addObjects(std::vector<App::DocumentObject*> objects)
149{
150
151 std::vector<DocumentObject*> grp = Group.getValues();
152 std::vector<DocumentObject*> ret;
153
154 for (auto object : objects) {
155
156 if (!allowObject(object)) {
157 continue;
158 }
159
160 std::vector<App::DocumentObject*> links;
161
162 // Prevent from extracting children of nested groups fixed issue:(#26743, #28830)
163 // As groups manage their own local coordinate systems and children,
164 // so transfer this and remove from the old group. if not a group then get CSRelevantLinks
165 if (!object->hasExtension(GeoFeatureGroupExtension::getExtensionClassTypeId())) {
166 links = getCSRelevantLinks(object);
167 }
168 links.push_back(object);
169
170 for (auto obj : links) {
171 // only one geofeaturegroup per object.
172 auto* group = App::GeoFeatureGroupExtension::getGroupOfObject(obj);
173 if (group && group != getExtendedObject()) {
174 group->getExtensionByType<App::GroupExtension>()->removeObject(obj);
175 }
176
177 if (!hasObject(obj)) {
178 grp.push_back(obj);
179 ret.push_back(obj);
180 }
181 }
182 }
183
184 Group.setValues(grp);
185 return ret;
186}
187
188std::vector<DocumentObject*>
189GeoFeatureGroupExtension::removeObjects(std::vector<App::DocumentObject*> objects)

Callers

nothing calls this directly

Calls 6

allowObjectFunction · 0.70
getValuesMethod · 0.45
hasExtensionMethod · 0.45
push_backMethod · 0.45
removeObjectMethod · 0.45
setValuesMethod · 0.45

Tested by

no test coverage detected