add convenience method addSelection(SelectionObject)
This commit is contained in:
@@ -773,6 +773,27 @@ bool SelectionSingleton::addSelection(const char* pDocName, const char* pObjectN
|
||||
}
|
||||
}
|
||||
|
||||
bool SelectionSingleton::addSelection(const SelectionObject& obj)
|
||||
{
|
||||
const std::vector<std::string>& subNames = obj.getSubNames();
|
||||
const std::vector<Base::Vector3d> points = obj.getPickedPoints();
|
||||
if (!subNames.empty() && subNames.size() == points.size()) {
|
||||
bool ok = true;
|
||||
for (std::size_t i=0; i<subNames.size(); i++) {
|
||||
const std::string& name = subNames[i];
|
||||
const Base::Vector3d& pnt = points[i];
|
||||
ok &= addSelection(obj.getDocName(), obj.getFeatName(), name.c_str(),
|
||||
static_cast<float>(pnt.x),
|
||||
static_cast<float>(pnt.y),
|
||||
static_cast<float>(pnt.z));
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
else {
|
||||
return addSelection(obj.getDocName(), obj.getFeatName(), subNames);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectionSingleton::rmvSelection(const char* pDocName, const char* pObjectName, const char* pSubName)
|
||||
{
|
||||
std::vector<SelectionChanges> rmvList;
|
||||
|
||||
@@ -222,6 +222,8 @@ public:
|
||||
bool addSelection(const char* pDocName, const char* pObjectName=0, const char* pSubName=0, float x=0, float y=0, float z=0);
|
||||
/// Add to selection with several sub-elements
|
||||
bool addSelection(const char* pDocName, const char* pObjectName, const std::vector<std::string>& pSubNames);
|
||||
/// Add to selection
|
||||
bool addSelection(const SelectionObject&);
|
||||
/// Remove from selection (for internal use)
|
||||
void rmvSelection(const char* pDocName, const char* pObjectName=0, const char* pSubName=0);
|
||||
/// Set the selection for a document
|
||||
|
||||
Reference in New Issue
Block a user