App: fix trailing whitespace

This commit is contained in:
luz paz
2022-12-02 18:02:05 -05:00
committed by Chris Hennes
parent c16e88845b
commit 0e08b51a58
13 changed files with 133 additions and 133 deletions

View File

@@ -53,10 +53,10 @@ GeoFeatureGroupExtension::GeoFeatureGroupExtension()
GeoFeatureGroupExtension::~GeoFeatureGroupExtension() = default;
void GeoFeatureGroupExtension::initExtension(ExtensionContainer* obj) {
if(!obj->isDerivedFrom(App::GeoFeature::getClassTypeId()))
throw Base::RuntimeError("GeoFeatureGroupExtension can only be applied to GeoFeatures");
App::GroupExtension::initExtension(obj);
}
@@ -64,7 +64,7 @@ PropertyPlacement& GeoFeatureGroupExtension::placement() {
if(!getExtendedContainer())
throw Base::RuntimeError("GeoFeatureGroupExtension was not applied to GeoFeature");
return static_cast<App::GeoFeature*>(getExtendedContainer())->Placement;
}
@@ -81,19 +81,19 @@ DocumentObject* GeoFeatureGroupExtension::getGroupOfObject(const DocumentObject*
{
if(!obj)
return nullptr;
//we will find origins, but not origin features
if(obj->isDerivedFrom(App::OriginFeature::getClassTypeId()))
if(obj->isDerivedFrom(App::OriginFeature::getClassTypeId()))
return OriginGroupExtension::getGroupOfObject(obj);
//compared to GroupExtension we do return here all GeoFeatureGroups including all extensions derived from it
//like OriginGroup. That is needed as we use this function to get all local coordinate systems. Also there
//is no reason to distinguish between GeoFeatuerGroups, there is only between group/geofeaturegroup
auto list = obj->getInList();
for (auto inObj : list) {
//There is a chance that a derived geofeaturegroup links with a local link and hence is not
//the parent group even though it links to the object. We use hasObject as one and only truth
//There is a chance that a derived geofeaturegroup links with a local link and hence is not
//the parent group even though it links to the object. We use hasObject as one and only truth
//if it has the object within the group
auto group = inObj->getExtensionByType<GeoFeatureGroupExtension>(true);
if(group && group->hasObject(obj))
@@ -136,47 +136,47 @@ Base::Placement GeoFeatureGroupExtension::recursiveGroupPlacement(GeoFeatureGrou
}
std::vector<DocumentObject*> GeoFeatureGroupExtension::addObjects(std::vector<App::DocumentObject*> objects) {
std::vector<DocumentObject*> grp = Group.getValues();
std::vector<DocumentObject*> ret;
for(auto object : objects) {
if(!allowObject(object))
continue;
//cross CoordinateSystem links are not allowed, so we need to move the whole link group
//cross CoordinateSystem links are not allowed, so we need to move the whole link group
std::vector<App::DocumentObject*> links = getCSRelevantLinks(object);
links.push_back(object);
for( auto obj : links) {
//only one geofeaturegroup per object.
//only one geofeaturegroup per object.
auto *group = App::GeoFeatureGroupExtension::getGroupOfObject(obj);
if(group && group != getExtendedObject())
group->getExtensionByType<App::GroupExtension>()->removeObject(obj);
if (!hasObject(obj)) {
grp.push_back(obj);
ret.push_back(obj);
}
}
}
Group.setValues(grp);
return ret;
}
std::vector<DocumentObject*> GeoFeatureGroupExtension::removeObjects(std::vector<App::DocumentObject*> objects) {
std::vector<DocumentObject*> removed;
std::vector<DocumentObject*> grp = Group.getValues();
for(auto object : objects) {
//cross CoordinateSystem links are not allowed, so we need to remove the whole link group
//cross CoordinateSystem links are not allowed, so we need to remove the whole link group
std::vector< DocumentObject* > links = getCSRelevantLinks(object);
links.push_back(object);
//remove all links out of group
//remove all links out of group
for(auto link : links) {
auto end = std::remove(grp.begin(), grp.end(), link);
if(end != grp.end()) {
@@ -185,10 +185,10 @@ std::vector<DocumentObject*> GeoFeatureGroupExtension::removeObjects(std::vector
}
}
}
if(!removed.empty())
Group.setValues(grp);
return removed;
}
@@ -196,11 +196,11 @@ void GeoFeatureGroupExtension::extensionOnChanged(const Property* p) {
//objects are only allowed in a single GeoFeatureGroup
if(p == &Group && !Group.testStatus(Property::User3)) {
if((!getExtendedObject()->isRestoring()
|| getExtendedObject()->getDocument()->testStatus(Document::Importing))
&& !getExtendedObject()->getDocument()->isPerformingTransaction()) {
bool error = false;
auto corrected = Group.getValues();
for(auto obj : Group.getValues()) {
@@ -279,7 +279,7 @@ void GeoFeatureGroupExtension::getCSOutList(const App::DocumentObject* obj,
//we get all relevant linked objects. We can't use outList() as this includes the links from expressions,
//also we only want links with scope Local
auto result = getScopedObjectsFromLinks(obj, LinkScope::Local);
//we remove all links to origin features and origins, they belong to a CS too and can't be moved
result.erase(std::remove_if(result.begin(), result.end(), [](App::DocumentObject* obj)->bool {
return (obj->isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
@@ -306,7 +306,7 @@ void GeoFeatureGroupExtension::getCSInList(const DocumentObject* obj,
if(parent->hasExtension(App::GroupExtension::getExtensionClassTypeId()))
continue;
//check if the link is real Local scope one or if it is a expression one (could also be both, so it is not
//check if the link is real Local scope one or if it is a expression one (could also be both, so it is not
//enough to check the expressions)
auto res = getScopedObjectsFromLinks(parent, LinkScope::Local);
if(std::find(res.begin(), res.end(), obj) != res.end())
@@ -323,7 +323,7 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getCSRelevantLinks(cons
if(!obj)
return std::vector< DocumentObject* >();
//get all out links
//get all out links
std::vector<DocumentObject*> vec;
recursiveCSRelevantLinks(obj, vec);
@@ -336,7 +336,7 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getCSRelevantLinks(cons
return vec;
}
void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* obj,
void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* obj,
std::vector< DocumentObject* >& vec) {
if(!obj)
@@ -347,7 +347,7 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob
getCSInList(obj, links);
//go on traversing the graph in all directions!
for(auto o : links) {
for(auto o : links) {
if(!o || o == obj || std::find(vec.begin(), vec.end(), o) != vec.end())
continue;
@@ -357,14 +357,14 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob
}
bool GeoFeatureGroupExtension::extensionGetSubObject(DocumentObject *&ret, const char *subname,
PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const
PyObject **pyObj, Base::Matrix4D *mat, bool transform, int depth) const
{
ret = nullptr;
const char *dot;
if(!subname || *subname==0) {
auto obj = dynamic_cast<const DocumentObject*>(getExtendedContainer());
ret = const_cast<DocumentObject*>(obj);
if(mat && transform)
if(mat && transform)
*mat *= const_cast<GeoFeatureGroupExtension*>(this)->placement().getValue().toMatrix();
}else if((dot=strchr(subname,'.'))) {
if(subname[0]!='$')
@@ -380,9 +380,9 @@ bool GeoFeatureGroupExtension::extensionGetSubObject(DocumentObject *&ret, const
}
if(ret) {
if(dot) ++dot;
if(dot && *dot
if(dot && *dot
&& !ret->hasExtension(App::LinkBaseExtension::getExtensionClassTypeId())
&& !ret->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()))
&& !ret->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()))
{
// Consider this
// Body
@@ -405,7 +405,7 @@ bool GeoFeatureGroupExtension::extensionGetSubObject(DocumentObject *&ret, const
}
}
}
if(mat && transform)
if(mat && transform)
*mat *= const_cast<GeoFeatureGroupExtension*>(this)->placement().getValue().toMatrix();
ret = ret->getSubObject(dot?dot:"",pyObj,mat,true,depth+1);
}
@@ -446,7 +446,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) {
auto result = getScopedObjectsFromLink(prop, LinkScope::Local);
auto group = getGroupOfObject(obj);
for(auto link : result) {
if(getGroupOfObject(link) != group)
if(getGroupOfObject(link) != group)
return false;
}
@@ -455,7 +455,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) {
result = getScopedObjectsFromLink(prop, LinkScope::Child);
auto groupExt = obj->getExtensionByType<App::GeoFeatureGroupExtension>();
for(auto link : result) {
if(!groupExt->hasObject(link, true))
if(!groupExt->hasObject(link, true))
return false;
}
}
@@ -472,7 +472,7 @@ void GeoFeatureGroupExtension::getInvalidLinkObjects(const DocumentObject* obj,
auto result = getScopedObjectsFromLinks(obj, LinkScope::Local);
auto group = obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()) ? obj : getGroupOfObject(obj);
for(auto link : result) {
if(getGroupOfObject(link) != group)
if(getGroupOfObject(link) != group)
vec.push_back(link);
}
@@ -481,7 +481,7 @@ void GeoFeatureGroupExtension::getInvalidLinkObjects(const DocumentObject* obj,
result = getScopedObjectsFromLinks(obj, LinkScope::Child);
auto groupExt = group->getExtensionByType<App::GeoFeatureGroupExtension>();
for(auto link : result) {
if(!groupExt->hasObject(link, true))
if(!groupExt->hasObject(link, true))
vec.push_back(link);
}
}