improve whitespaces
This commit is contained in:
@@ -664,7 +664,6 @@ void Document::exportGraphviz(std::ostream& out) const
|
||||
edgeAttrMap[edge]["ltail"] = getClusterName(docObj);
|
||||
if (GraphList[*It2])
|
||||
edgeAttrMap[edge]["lhead"] = getClusterName(*It2);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -771,11 +770,10 @@ void Document::exportGraphviz(std::ostream& out) const
|
||||
}
|
||||
|
||||
void markOutOfScopeLinks() {
|
||||
|
||||
const boost::property_map<Graph, boost::edge_attribute_t>::type& edgeAttrMap = boost::get(boost::edge_attribute, DepList);
|
||||
|
||||
for( auto obj : objects) {
|
||||
|
||||
for( auto obj : objects) {
|
||||
|
||||
std::vector<App::DocumentObject*> invalids;
|
||||
GeoFeatureGroupExtension::getInvalidLinkObjects(obj, invalids);
|
||||
//isLinkValid returns true for non-link properties
|
||||
@@ -785,7 +783,7 @@ void Document::exportGraphviz(std::ostream& out) const
|
||||
if(res.second)
|
||||
edgeAttrMap[res.first]["color"] = "red";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const struct DocumentP* d;
|
||||
@@ -2176,7 +2174,7 @@ int Document::recompute()
|
||||
//do we have anything to do?
|
||||
if(d->objectMap.empty())
|
||||
return 0;
|
||||
|
||||
|
||||
// get the sorted vector of all objects in the document and go though it from the end
|
||||
vector<DocumentObject*> topoSortedObjects = topologicalSort();
|
||||
|
||||
@@ -2209,7 +2207,7 @@ int Document::recompute()
|
||||
}
|
||||
#endif
|
||||
|
||||
return objectCount;
|
||||
return objectCount;
|
||||
}
|
||||
|
||||
#endif // USE_OLD_DAG
|
||||
@@ -2227,7 +2225,7 @@ std::vector<App::DocumentObject*> Document::topologicalSort() const
|
||||
auto in = objectIt.second->getInList();
|
||||
std::sort(in.begin(), in.end());
|
||||
in.erase(std::unique(in.begin(), in.end()), in.end());
|
||||
|
||||
|
||||
countMap[objectIt.second] = in.size();
|
||||
}
|
||||
|
||||
@@ -2242,7 +2240,7 @@ std::vector<App::DocumentObject*> Document::topologicalSort() const
|
||||
|
||||
while (rootObjeIt != countMap.end()){
|
||||
rootObjeIt->second = rootObjeIt->second - 1;
|
||||
|
||||
|
||||
//we need outlist with unique entries
|
||||
auto out = rootObjeIt->first->getOutList();
|
||||
std::sort(out.begin(), out.end());
|
||||
@@ -2650,7 +2648,7 @@ void Document::remObject(const char* sName)
|
||||
// remove from adjancy list
|
||||
//remove_vertex(_DepConMap[pos->second],_DepList);
|
||||
//_DepConMap.erase(pos->second);
|
||||
|
||||
|
||||
pos->second->setStatus(ObjectStatus::Delete, false); // Unset the bit to be on the safe side
|
||||
d->objectMap.erase(pos);
|
||||
}
|
||||
|
||||
@@ -186,14 +186,14 @@ std::vector<DocumentObject*> GeoFeatureGroupExtension::removeObjects(std::vector
|
||||
}
|
||||
|
||||
void GeoFeatureGroupExtension::extensionOnChanged(const Property* p) {
|
||||
|
||||
|
||||
//objects are only allowed in a single GeoFeatureGroup
|
||||
if((strcmp(p->getName(), "Group")==0)) {
|
||||
|
||||
|
||||
bool error = false;
|
||||
auto corrected = Group.getValues();
|
||||
for(auto obj : Group.getValues()) {
|
||||
|
||||
|
||||
//we have already set the obj into the group, so in a case of multiple groups getGroupOfObject
|
||||
//would return anyone of it and hence it is possible that we miss an error. We need a custom check
|
||||
auto list = obj->getInList();
|
||||
@@ -205,14 +205,14 @@ void GeoFeatureGroupExtension::extensionOnChanged(const Property* p) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if an error was found we need to correct the values and inform the user
|
||||
if(error) {
|
||||
Group.setValues(corrected);
|
||||
throw Base::Exception("Object can only be in a single GeoFeatureGroup");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App::GroupExtension::extensionOnChanged(p);
|
||||
}
|
||||
|
||||
@@ -221,13 +221,12 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getScopedObjectsFromLin
|
||||
|
||||
if(!obj)
|
||||
std::vector< DocumentObject* >();
|
||||
|
||||
|
||||
//we get all linked objects. We can't use outList() as this includes the links from expressions
|
||||
std::vector< App::DocumentObject* > result;
|
||||
std::vector<App::Property*> list;
|
||||
obj->getPropertyList(list);
|
||||
for(App::Property* prop : list) {
|
||||
|
||||
auto vec = getScopedObjectsFromLink(prop, scope);
|
||||
result.insert(result.end(), vec.begin(), vec.end());
|
||||
}
|
||||
@@ -235,7 +234,7 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getScopedObjectsFromLin
|
||||
//clear all null objects and douplicates
|
||||
std::sort(result.begin(), result.end());
|
||||
result.erase(std::unique(result.begin(), result.end()), result.end());
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -243,35 +242,35 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getScopedObjectsFromLin
|
||||
|
||||
if(!prop)
|
||||
return std::vector< DocumentObject* >();
|
||||
|
||||
|
||||
std::vector< App::DocumentObject* > result;
|
||||
|
||||
|
||||
if(prop->getTypeId().isDerivedFrom(App::PropertyLink::getClassTypeId()) &&
|
||||
static_cast<App::PropertyLink*>(prop)->getScope() == scope) {
|
||||
|
||||
result.push_back(static_cast<App::PropertyLink*>(prop)->getValue());
|
||||
}
|
||||
|
||||
|
||||
if(prop->getTypeId().isDerivedFrom(App::PropertyLinkList::getClassTypeId()) &&
|
||||
static_cast<App::PropertyLinkList*>(prop)->getScope() == scope) {
|
||||
|
||||
|
||||
auto vec = static_cast<App::PropertyLinkList*>(prop)->getValues();
|
||||
result.insert(result.end(), vec.begin(), vec.end());
|
||||
}
|
||||
|
||||
|
||||
if(prop->getTypeId().isDerivedFrom(App::PropertyLinkSub::getClassTypeId()) &&
|
||||
static_cast<App::PropertyLinkSub*>(prop)->getScope() == scope) {
|
||||
|
||||
|
||||
result.push_back(static_cast<App::PropertyLinkSub*>(prop)->getValue());
|
||||
}
|
||||
|
||||
|
||||
if(prop->getTypeId().isDerivedFrom(App::PropertyLinkSubList::getClassTypeId()) &&
|
||||
static_cast<App::PropertyLinkSubList*>(prop)->getScope() == scope) {
|
||||
|
||||
|
||||
auto vec = static_cast<App::PropertyLinkSubList*>(prop)->getValues();
|
||||
result.insert(result.end(), vec.begin(), vec.end());
|
||||
}
|
||||
|
||||
|
||||
//it is important to remove all nullptrs
|
||||
result.erase(std::remove(result.begin(), result.end(), nullptr), result.end());
|
||||
return result;
|
||||
@@ -284,7 +283,7 @@ void GeoFeatureGroupExtension::getCSOutList(const App::DocumentObject* obj,
|
||||
|
||||
if(!obj)
|
||||
return;
|
||||
|
||||
|
||||
//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);
|
||||
@@ -294,9 +293,9 @@ void GeoFeatureGroupExtension::getCSOutList(const App::DocumentObject* obj,
|
||||
return (obj->isDerivedFrom(App::OriginFeature::getClassTypeId()) ||
|
||||
obj->isDerivedFrom(App::Origin::getClassTypeId()));
|
||||
}), result.end());
|
||||
|
||||
|
||||
vec.insert(vec.end(), result.begin(), result.end());
|
||||
|
||||
|
||||
//post process the vector
|
||||
std::sort(vec.begin(), vec.end());
|
||||
vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
|
||||
@@ -307,21 +306,21 @@ void GeoFeatureGroupExtension::getCSInList(const DocumentObject* obj,
|
||||
|
||||
if(!obj)
|
||||
return;
|
||||
|
||||
|
||||
//search the inlist for objects that have non-expression links to us
|
||||
for(App::DocumentObject* parent : obj->getInList()) {
|
||||
|
||||
|
||||
//not interested in other groups (and here we mean all groups, normal ones and geofeaturegroup)
|
||||
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
|
||||
//enough to check the expressions)
|
||||
auto res = getScopedObjectsFromLinks(parent, LinkScope::Local);
|
||||
if(std::find(res.begin(), res.end(), obj) != res.end())
|
||||
vec.push_back(parent);
|
||||
}
|
||||
|
||||
|
||||
//clear all duplicates
|
||||
std::sort(vec.begin(), vec.end());
|
||||
vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
|
||||
@@ -331,12 +330,12 @@ std::vector< DocumentObject* > GeoFeatureGroupExtension::getCSRelevantLinks(cons
|
||||
|
||||
if(!obj)
|
||||
return std::vector< DocumentObject* >();
|
||||
|
||||
|
||||
//get all out links
|
||||
std::vector<DocumentObject*> vec;
|
||||
|
||||
|
||||
recursiveCSRelevantLinks(obj, vec);
|
||||
|
||||
|
||||
//post process the list after we added many things
|
||||
std::sort(vec.begin(), vec.end());
|
||||
vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
|
||||
@@ -350,7 +349,7 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob
|
||||
|
||||
if(!obj)
|
||||
return;
|
||||
|
||||
|
||||
std::vector< DocumentObject* > links;
|
||||
getCSOutList(obj, links);
|
||||
getCSInList(obj, links);
|
||||
@@ -359,7 +358,7 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob
|
||||
for(auto o : links) {
|
||||
if(!o || o == obj || std::find(vec.begin(), vec.end(), o) != vec.end())
|
||||
continue;
|
||||
|
||||
|
||||
vec.push_back(o);
|
||||
recursiveCSRelevantLinks(o, vec);
|
||||
}
|
||||
@@ -367,10 +366,10 @@ void GeoFeatureGroupExtension::recursiveCSRelevantLinks(const DocumentObject* ob
|
||||
|
||||
|
||||
bool GeoFeatureGroupExtension::areLinksValid(const DocumentObject* obj) {
|
||||
|
||||
|
||||
if(!obj)
|
||||
return true;
|
||||
|
||||
|
||||
//no cross CS link for local links.
|
||||
//Base::Console().Message("Check object links: %s\n", obj->getNameInDocument());
|
||||
std::vector<App::Property*> list;
|
||||
@@ -381,20 +380,20 @@ bool GeoFeatureGroupExtension::areLinksValid(const DocumentObject* obj) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) {
|
||||
|
||||
|
||||
if(!prop)
|
||||
return true;
|
||||
|
||||
|
||||
//get the object that holds the property
|
||||
if(!prop->getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId()))
|
||||
return true; //this link comes not from a document object, scopes are meaningless
|
||||
auto obj = static_cast<App::DocumentObject*>(prop->getContainer());
|
||||
|
||||
|
||||
//no cross CS link for local links.
|
||||
auto result = getScopedObjectsFromLink(prop, LinkScope::Local);
|
||||
auto group = getGroupOfObject(obj);
|
||||
@@ -402,7 +401,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) {
|
||||
if(getGroupOfObject(link) != group)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//for links with scope SubGroup we need to check if all features are part of subgroups
|
||||
if(obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId())) {
|
||||
result = getScopedObjectsFromLink(prop, LinkScope::Child);
|
||||
@@ -412,7 +411,7 @@ bool GeoFeatureGroupExtension::isLinkValid(App::Property* prop) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -420,7 +419,7 @@ void GeoFeatureGroupExtension::getInvalidLinkObjects(const DocumentObject* obj,
|
||||
|
||||
if(!obj)
|
||||
return;
|
||||
|
||||
|
||||
//no cross CS link for local links.
|
||||
auto result = getScopedObjectsFromLinks(obj, LinkScope::Local);
|
||||
auto group = obj->hasExtension(App::GeoFeatureGroupExtension::getExtensionClassTypeId()) ? obj : getGroupOfObject(obj);
|
||||
@@ -428,7 +427,7 @@ void GeoFeatureGroupExtension::getInvalidLinkObjects(const DocumentObject* obj,
|
||||
if(getGroupOfObject(link) != group)
|
||||
vec.push_back(link);
|
||||
}
|
||||
|
||||
|
||||
//for links with scope SubGroup we need to check if all features are part of subgroups
|
||||
if(group) {
|
||||
result = getScopedObjectsFromLinks(obj, LinkScope::Child);
|
||||
|
||||
@@ -173,22 +173,22 @@ DocumentObject *GroupExtension::getObject(const char *Name) const
|
||||
|
||||
bool GroupExtension::hasObject(const DocumentObject* obj, bool recursive) const
|
||||
{
|
||||
|
||||
|
||||
if(obj == getExtendedObject())
|
||||
return false;
|
||||
|
||||
|
||||
const std::vector<DocumentObject*>& grp = Group.getValues();
|
||||
for (auto child : grp) {
|
||||
|
||||
|
||||
if(!child)
|
||||
continue;
|
||||
|
||||
|
||||
if (child == obj) {
|
||||
return true;
|
||||
} else if (child == getExtendedObject()) {
|
||||
Base::Exception("Cyclic dependencies detected: Search cannot be performed");
|
||||
} else if ( recursive && child->hasExtension(GroupExtension::getExtensionClassTypeId()) ) {
|
||||
|
||||
|
||||
App::GroupExtension *subGroup = static_cast<App::GroupExtension *> (
|
||||
child->getExtension(GroupExtension::getExtensionClassTypeId()));
|
||||
std::vector<const GroupExtension*> history;
|
||||
@@ -210,25 +210,25 @@ bool GroupExtension::recursiveHasObject(const DocumentObject* obj, const GroupEx
|
||||
//we store every group we processed on the current leave of the tree, and if we reach an
|
||||
//already processed group we know that it not really is a tree but a cycle.
|
||||
history.push_back(this);
|
||||
|
||||
|
||||
//we use hasObject with out recursion to allow override in derived classes
|
||||
if(group->hasObject(obj, false))
|
||||
return true;
|
||||
|
||||
|
||||
//we checked for the searched object already with hasObject and did not find it, now we need to
|
||||
//do the same for all subgroups
|
||||
for (auto child : group->Group.getValues()) {
|
||||
|
||||
|
||||
if(!child)
|
||||
continue;
|
||||
|
||||
|
||||
if ( child->hasExtension(GroupExtension::getExtensionClassTypeId()) ) {
|
||||
|
||||
|
||||
auto ext = child->getExtensionByType<GroupExtension>();
|
||||
|
||||
if(std::find(history.begin(), history.end(), ext) != history.end())
|
||||
Base::Exception("Cyclic dependencies detected: Search cannot be performed");
|
||||
|
||||
|
||||
if (recursiveHasObject(obj, ext, history)) {
|
||||
return true;
|
||||
}
|
||||
@@ -289,7 +289,7 @@ DocumentObject* GroupExtension::getGroupOfObject(const DocumentObject* obj)
|
||||
}
|
||||
|
||||
PyObject* GroupExtension::getExtensionPyObject(void) {
|
||||
|
||||
|
||||
if (ExtensionPythonObject.is(Py::_None())){
|
||||
// ref counter is set to 1
|
||||
auto grp = new GroupExtensionPy(this);
|
||||
@@ -299,16 +299,16 @@ PyObject* GroupExtension::getExtensionPyObject(void) {
|
||||
}
|
||||
|
||||
void GroupExtension::extensionOnChanged(const Property* p) {
|
||||
|
||||
|
||||
//objects are only allowed in a single group. Note that this check must only be done for normal
|
||||
//groups, not any derived classes
|
||||
if((this->getExtensionTypeId() == GroupExtension::getExtensionClassTypeId()) &&
|
||||
(strcmp(p->getName(), "Group")==0)) {
|
||||
|
||||
|
||||
bool error = false;
|
||||
auto corrected = Group.getValues();
|
||||
for(auto obj : Group.getValues()) {
|
||||
|
||||
|
||||
//we have already set the obj into the group, so in a case of multiple groups getGroupOfObject
|
||||
//would return anyone of it and hence it is possible that we miss an error. We need a custom check
|
||||
auto list = obj->getInList();
|
||||
@@ -320,14 +320,14 @@ void GroupExtension::extensionOnChanged(const Property* p) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if an error was found we need to correct the values and inform the user
|
||||
if(error) {
|
||||
Group.setValues(corrected);
|
||||
throw Base::Exception("Object can only be in a single Group");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
App::Extension::extensionOnChanged(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,11 +133,11 @@ PyObject* GroupExtensionPy::addObjects(PyObject *args) {
|
||||
|
||||
|
||||
PyObject* GroupExtensionPy::setObjects(PyObject *args) {
|
||||
|
||||
|
||||
PyObject *object;
|
||||
if (!PyArg_ParseTuple(args, "O", &object)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
|
||||
|
||||
if (PyTuple_Check(object) || PyList_Check(object)) {
|
||||
Py::Sequence list(object);
|
||||
Py::Sequence::size_type size = list.size();
|
||||
@@ -167,7 +167,7 @@ PyObject* GroupExtensionPy::setObjects(PyObject *args) {
|
||||
std::string error = std::string("type must be list of 'DocumentObject', not ");
|
||||
error += object->ob_type->tp_name;
|
||||
throw Base::TypeError(error);
|
||||
};
|
||||
}
|
||||
|
||||
PyObject* GroupExtensionPy::removeObject(PyObject *args)
|
||||
{
|
||||
@@ -196,7 +196,7 @@ PyObject* GroupExtensionPy::removeObject(PyObject *args)
|
||||
}
|
||||
|
||||
PyObject* GroupExtensionPy::removeObjects(PyObject *args) {
|
||||
|
||||
|
||||
PyObject *object;
|
||||
if (!PyArg_ParseTuple(args, "O", &object)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
@@ -226,11 +226,11 @@ PyObject* GroupExtensionPy::removeObjects(PyObject *args) {
|
||||
|
||||
return Py::new_reference_to(result);
|
||||
}
|
||||
|
||||
|
||||
std::string error = std::string("type must be list of 'DocumentObject', not ");
|
||||
error += object->ob_type->tp_name;
|
||||
throw Base::TypeError(error);
|
||||
};
|
||||
}
|
||||
|
||||
PyObject* GroupExtensionPy::removeObjectsFromDocument(PyObject *args)
|
||||
{
|
||||
@@ -294,4 +294,3 @@ int GroupExtensionPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@
|
||||
|
||||
using namespace App;
|
||||
|
||||
EXTENSION_PROPERTY_SOURCE(App::OriginGroupExtension, App::GeoFeatureGroupExtension);
|
||||
EXTENSION_PROPERTY_SOURCE(App::OriginGroupExtension, App::GeoFeatureGroupExtension)
|
||||
|
||||
OriginGroupExtension::OriginGroupExtension () {
|
||||
|
||||
|
||||
initExtensionType(OriginGroupExtension::getExtensionClassTypeId());
|
||||
|
||||
|
||||
EXTENSION_ADD_PROPERTY_TYPE ( Origin, (0), 0, App::Prop_Hidden, "Origin linked to the group" );
|
||||
Origin.setScope(LinkScope::Child);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ App::Origin *OriginGroupExtension::getOrigin () const {
|
||||
}
|
||||
|
||||
App::DocumentObject *OriginGroupExtension::getGroupOfObject (const DocumentObject* obj) {
|
||||
|
||||
|
||||
if(!obj)
|
||||
return nullptr;
|
||||
|
||||
@@ -186,18 +186,18 @@ void OriginGroupExtension::relinkToOrigin(App::DocumentObject* obj)
|
||||
}
|
||||
|
||||
std::vector< DocumentObject* > OriginGroupExtension::addObjects(std::vector<DocumentObject*> objs) {
|
||||
|
||||
|
||||
for(auto obj : objs)
|
||||
relinkToOrigin(obj);
|
||||
|
||||
|
||||
return App::GeoFeatureGroupExtension::addObjects(objs);
|
||||
}
|
||||
|
||||
bool OriginGroupExtension::hasObject(const DocumentObject* obj, bool recursive) const {
|
||||
|
||||
|
||||
if(Origin.getValue() && (obj == getOrigin() || getOrigin()->hasObject(obj)))
|
||||
return true;
|
||||
|
||||
|
||||
return App::GroupExtension::hasObject(obj, recursive);
|
||||
}
|
||||
|
||||
|
||||
@@ -635,19 +635,19 @@ void PropertyLinkSubList::setValues(const std::vector<DocumentObject*>& lValue,c
|
||||
#ifndef USE_OLD_DAG
|
||||
//maintain backlinks.
|
||||
if(getContainer() && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
|
||||
|
||||
//_lValueList can contain items multiple times, but we trust the document
|
||||
//object to ensure that this works
|
||||
for(auto *obj : _lValueList)
|
||||
obj->_removeBackLink(static_cast<DocumentObject*>(getContainer()));
|
||||
|
||||
|
||||
//maintain backlinks. lValue can contain items multiple times, but we trust the document
|
||||
//object to ensure that the backlink is only added once
|
||||
for(auto *obj : lValue)
|
||||
obj->_addBackLink(static_cast<DocumentObject*>(getContainer()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
aboutToSetValue();
|
||||
_lValueList = lValue;
|
||||
_lSubList.resize(lSubNames.size());
|
||||
@@ -665,19 +665,19 @@ void PropertyLinkSubList::setValues(const std::vector<DocumentObject*>& lValue,c
|
||||
#ifndef USE_OLD_DAG
|
||||
//maintain backlinks.
|
||||
if(getContainer() && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
|
||||
|
||||
//_lValueList can contain items multiple times, but we trust the document
|
||||
//object to ensure that this works
|
||||
for(auto *obj : _lValueList)
|
||||
obj->_removeBackLink(static_cast<DocumentObject*>(getContainer()));
|
||||
|
||||
|
||||
//maintain backlinks. lValue can contain items multiple times, but we trust the document
|
||||
//object to ensure that the backlink is only added once
|
||||
for(auto *obj : lValue)
|
||||
obj->_addBackLink(static_cast<DocumentObject*>(getContainer()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
aboutToSetValue();
|
||||
_lValueList = lValue;
|
||||
_lSubList = lSubNames;
|
||||
@@ -689,19 +689,19 @@ void PropertyLinkSubList::setValue(DocumentObject* lValue, const std::vector<str
|
||||
#ifndef USE_OLD_DAG
|
||||
//maintain backlinks.
|
||||
if(getContainer() && getContainer()->isDerivedFrom(App::DocumentObject::getClassTypeId())) {
|
||||
|
||||
|
||||
//_lValueList can contain items multiple times, but we trust the document
|
||||
//object to ensure that this works
|
||||
for(auto *obj : _lValueList)
|
||||
obj->_removeBackLink(static_cast<DocumentObject*>(getContainer()));
|
||||
|
||||
|
||||
//maintain backlinks. lValue can contain items multiple times, but we trust the document
|
||||
//object to ensure that the backlink is only added once
|
||||
if(lValue)
|
||||
lValue->_addBackLink(static_cast<DocumentObject*>(getContainer()));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
aboutToSetValue();
|
||||
std::size_t size = SubList.size();
|
||||
this->_lValueList.clear();
|
||||
|
||||
@@ -389,7 +389,7 @@ public:
|
||||
virtual void Paste(const Property &from);
|
||||
|
||||
virtual unsigned int getMemSize (void) const;
|
||||
|
||||
|
||||
private:
|
||||
//FIXME: Do not make two independent lists because this will lead to some inconsistencies!
|
||||
std::vector<DocumentObject*> _lValueList;
|
||||
|
||||
@@ -339,16 +339,15 @@ TransactionDocumentObject::~TransactionDocumentObject()
|
||||
void TransactionDocumentObject::applyDel(Document &Doc, TransactionalObject *pcObj)
|
||||
{
|
||||
if (status == Del) {
|
||||
|
||||
DocumentObject* obj = static_cast<DocumentObject*>(pcObj);
|
||||
|
||||
//Make sure the backlinks of all linked objects are updated. As the links of the removed
|
||||
//object are never set to [] they also do not remove the backlink. But as they are
|
||||
//not in the document anymore we need to remove them anyway to ensure a correct graph
|
||||
auto list = obj->getOutList();
|
||||
for(auto link : list)
|
||||
for (auto link : list)
|
||||
link->_removeBackLink(obj);
|
||||
|
||||
|
||||
// simply filling in the saved object
|
||||
Doc._remObject(obj);
|
||||
}
|
||||
@@ -362,7 +361,7 @@ void TransactionDocumentObject::applyNew(Document &Doc, TransactionalObject *pcO
|
||||
|
||||
//make sure the backlinks of all linked objects are updated
|
||||
auto list = obj->getOutList();
|
||||
for(auto link : list)
|
||||
for (auto link : list)
|
||||
link->_addBackLink(obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1296,9 +1296,8 @@ QMimeData * MainWindow::createMimeDataFromSelection () const
|
||||
sel.insert(sel.end(), it->second.begin(), it->second.end());
|
||||
all.insert(all.end(), dep.begin(), dep.end());
|
||||
}
|
||||
|
||||
|
||||
if (all.size() > sel.size()) {
|
||||
|
||||
//check if selection are only geofeaturegroup objects, for them it is intuitive and wanted to copy the
|
||||
//dependencies
|
||||
bool hasGroup = false, hasNormal = false;
|
||||
|
||||
@@ -1164,7 +1164,7 @@ void DocumentItem::populateItem(DocumentObjectItem *item, bool refresh) {
|
||||
// other parents not expanded yet. We don't want to traverse the
|
||||
// whole tree to confirm that. Just let it be. If the other
|
||||
// parent(s) later expanded, this child item will be moved from
|
||||
// root to its parent.
|
||||
// root to its parent.
|
||||
if(obj->myselves->size()==1) {
|
||||
// We only make a difference for geofeaturegroups,
|
||||
// as otherwise it comes to confusing behavior to the user when things
|
||||
@@ -1181,17 +1181,17 @@ void DocumentItem::populateItem(DocumentObjectItem *item, bool refresh) {
|
||||
}
|
||||
|
||||
void DocumentItem::slotChangeObject(const Gui::ViewProviderDocumentObject& view)
|
||||
{
|
||||
{
|
||||
QString displayName = QString::fromUtf8(view.getObject()->Label.getValue());
|
||||
FOREACH_ITEM(item,view)
|
||||
item->setText(0, displayName);
|
||||
populateItem(item, true);
|
||||
END_FOREACH_ITEM
|
||||
|
||||
|
||||
//if the item is in a GeoFeatureGroup we may need to update that too, as the claim children
|
||||
//of the geofeaturegroup depends on what the childs claim
|
||||
auto grp = App::GeoFeatureGroupExtension::getGroupOfObject(view.getObject());
|
||||
if(grp) {
|
||||
if (grp) {
|
||||
FOREACH_ITEM_NAME(item, grp->getNameInDocument())
|
||||
populateItem(item, true);
|
||||
END_FOREACH_ITEM
|
||||
|
||||
@@ -59,7 +59,7 @@ ViewProviderDocumentObjectGroup::ViewProviderDocumentObjectGroup()
|
||||
setDefaultMode(SO_SWITCH_ALL);
|
||||
#endif
|
||||
ViewProviderGroupExtension::initExtension(this);
|
||||
|
||||
|
||||
sPixmap = "Group.svg";
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ ViewProviderGeoFeatureGroupExtension::~ViewProviderGeoFeatureGroupExtension()
|
||||
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderGeoFeatureGroupExtension::extensionClaimChildren3D(void) const {
|
||||
|
||||
|
||||
//all object in the group must be claimed in 3D, as we are a coordinate system for all of them
|
||||
auto* ext = getExtendedViewProvider()->getObject()->getExtensionByType<App::GeoFeatureGroupExtension>();
|
||||
if(ext) {
|
||||
@@ -66,7 +66,7 @@ std::vector<App::DocumentObject*> ViewProviderGeoFeatureGroupExtension::extensio
|
||||
}
|
||||
|
||||
std::vector<App::DocumentObject*> ViewProviderGeoFeatureGroupExtension::extensionClaimChildren(void) const {
|
||||
|
||||
|
||||
//we must be careful which objects to claim, as there might be stacked relations inside the coordinate system,
|
||||
//like pad/sketch
|
||||
auto* ext = getExtendedViewProvider()->getObject()->getExtensionByType<App::GeoFeatureGroupExtension>();
|
||||
@@ -75,11 +75,11 @@ std::vector<App::DocumentObject*> ViewProviderGeoFeatureGroupExtension::extensio
|
||||
//object in the tree
|
||||
std::vector<App::DocumentObject*> claim;
|
||||
auto objs = ext->Group.getValues();
|
||||
|
||||
|
||||
for(auto obj : objs) {
|
||||
|
||||
|
||||
auto vin = obj->getInList();
|
||||
|
||||
|
||||
//we don't want to count objects that are deleted or part of other geo feature groups.
|
||||
//Second criteria is actually not possible in normal operation, but only in some error
|
||||
//condition. But then it is needed to understand the problem for the user
|
||||
|
||||
@@ -52,7 +52,7 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(Gui::ViewProviderPart, Gui::ViewProviderDocument
|
||||
ViewProviderPart::ViewProviderPart()
|
||||
{
|
||||
initExtension(this);
|
||||
|
||||
|
||||
sPixmap = "Geofeaturegroup.svg";
|
||||
}
|
||||
|
||||
|
||||
@@ -42,9 +42,9 @@ BodyBase::BodyBase()
|
||||
{
|
||||
ADD_PROPERTY(Tip , (0) );
|
||||
Tip.setScope(App::LinkScope::Child);
|
||||
|
||||
|
||||
ADD_PROPERTY(BaseFeature , (0) );
|
||||
|
||||
|
||||
App::OriginGroupExtension::initExtension(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ Boolean::Boolean()
|
||||
{
|
||||
ADD_PROPERTY(Type,((long)0));
|
||||
Type.setEnums(TypeEnums);
|
||||
|
||||
|
||||
initExtension(this);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ App::DocumentObjectExecReturn *Boolean::execute(void)
|
||||
Part::TopoShape baseTopShape = baseFeature->Shape.getShape();
|
||||
if (baseTopShape.getShape().IsNull())
|
||||
return new App::DocumentObjectExecReturn("Cannot do boolean operation with invalid base shape");
|
||||
|
||||
|
||||
//get the body this boolean feature belongs to
|
||||
Part::BodyBase* baseBody = Part::BodyBase::findBodyOf(this);
|
||||
|
||||
@@ -145,10 +145,8 @@ void Boolean::onChanged(const App::Property* prop) {
|
||||
|
||||
if(strcmp(prop->getName(), "Group") == 0)
|
||||
touch();
|
||||
|
||||
|
||||
PartDesign::Feature::onChanged(prop);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user