+ Make sure to keep order of selected objects in getSelectionEx()
This commit is contained in:
parent
782cae1d22
commit
c020bab0fa
|
@ -337,25 +337,9 @@ bool SelectionSingleton::hasSelection(const char* doc) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDocName) const
|
|
||||||
//{
|
|
||||||
// return getSelectionEx(pDocName,App::DocumentObject::getClassTypeId());
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDocName,const char* typeName) const
|
|
||||||
//{
|
|
||||||
// // search the type
|
|
||||||
// Base::Type typeId;
|
|
||||||
// if(typeName)
|
|
||||||
// typeId = Base::Type::fromName(typeName);
|
|
||||||
// else
|
|
||||||
// typeId = App::DocumentObject::getClassTypeId();
|
|
||||||
// return getSelectionEx(pDocName,typeId);
|
|
||||||
//}
|
|
||||||
std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDocName, Base::Type typeId) const
|
std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDocName, Base::Type typeId) const
|
||||||
{
|
{
|
||||||
std::vector<SelectionObject> temp;
|
std::vector<SelectionObject> temp;
|
||||||
|
|
||||||
std::map<App::DocumentObject*,SelectionObject> SortMap;
|
std::map<App::DocumentObject*,SelectionObject> SortMap;
|
||||||
|
|
||||||
// check the type
|
// check the type
|
||||||
|
@ -398,8 +382,14 @@ std::vector<SelectionObject> SelectionSingleton::getSelectionEx(const char* pDoc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::map<App::DocumentObject*,SelectionObject>::const_iterator It = SortMap.begin();It != SortMap.end();++It)
|
// The map looses the order thus we have to go again through the list and pick up the SelectionObject from the map
|
||||||
temp.push_back(It->second);
|
for (std::list<_SelObj>::const_iterator It = _SelList.begin();It != _SelList.end();++It) {
|
||||||
|
std::map<App::DocumentObject*,SelectionObject>::iterator Jt = SortMap.find(It->pObject);
|
||||||
|
if (Jt != SortMap.end()) {
|
||||||
|
temp.push_back(Jt->second);
|
||||||
|
SortMap.erase(Jt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user