allow to create SelectionObject from SelectionChanges structure
This commit is contained in:
parent
6fef24f676
commit
6d5f7650ab
|
@ -527,6 +527,7 @@ bool SelectionSingleton::setPreselect(const char* pDocName, const char* pObjectN
|
|||
Chng.pDocName = DocName.c_str();
|
||||
Chng.pObjectName = FeatName.c_str();
|
||||
Chng.pSubName = SubName.c_str();
|
||||
Chng.pTypeName = "";
|
||||
Chng.x = x;
|
||||
Chng.y = y;
|
||||
Chng.z = z;
|
||||
|
@ -706,6 +707,7 @@ bool SelectionSingleton::addSelection(const char* pDocName, const char* pObjectN
|
|||
Chng.pDocName = pDocName;
|
||||
Chng.pObjectName = pObjectName ? pObjectName : "";
|
||||
Chng.pSubName = pSubName ? pSubName : "";
|
||||
Chng.pTypeName = temp.TypeName.c_str();
|
||||
Chng.x = x;
|
||||
Chng.y = y;
|
||||
Chng.z = z;
|
||||
|
@ -761,6 +763,7 @@ bool SelectionSingleton::addSelection(const char* pDocName, const char* pObjectN
|
|||
Chng.pDocName = pDocName;
|
||||
Chng.pObjectName = pObjectName ? pObjectName : "";
|
||||
Chng.pSubName = "";
|
||||
Chng.pTypeName = temp.TypeName.c_str();
|
||||
Chng.x = 0;
|
||||
Chng.y = 0;
|
||||
Chng.z = 0;
|
||||
|
@ -793,6 +796,7 @@ void SelectionSingleton::rmvSelection(const char* pDocName, const char* pObjectN
|
|||
std::string tmpDocName = It->DocName;
|
||||
std::string tmpFeaName = It->FeatName;
|
||||
std::string tmpSubName = It->SubName;
|
||||
std::string tmpTypName = It->TypeName;
|
||||
|
||||
// destroy the _SelObj item
|
||||
It = _SelList.erase(It);
|
||||
|
@ -801,6 +805,7 @@ void SelectionSingleton::rmvSelection(const char* pDocName, const char* pObjectN
|
|||
Chng.pDocName = tmpDocName.c_str();
|
||||
Chng.pObjectName = tmpFeaName.c_str();
|
||||
Chng.pSubName = tmpSubName.c_str();
|
||||
Chng.pTypeName = tmpTypName.c_str();
|
||||
Chng.Type = SelectionChanges::RmvSelection;
|
||||
|
||||
Notify(Chng);
|
||||
|
@ -868,6 +873,7 @@ void SelectionSingleton::setSelection(const char* pDocName, const std::vector<Ap
|
|||
Chng.pDocName = pDocName;
|
||||
Chng.pObjectName = "";
|
||||
Chng.pSubName = "";
|
||||
Chng.pTypeName = "";
|
||||
|
||||
Notify(Chng);
|
||||
signalSelectionChanged(Chng);
|
||||
|
@ -901,6 +907,7 @@ void SelectionSingleton::clearSelection(const char* pDocName)
|
|||
Chng.pDocName = docName.c_str();
|
||||
Chng.pObjectName = "";
|
||||
Chng.pSubName = "";
|
||||
Chng.pTypeName = "";
|
||||
|
||||
Notify(Chng);
|
||||
signalSelectionChanged(Chng);
|
||||
|
@ -920,6 +927,7 @@ void SelectionSingleton::clearCompleteSelection()
|
|||
Chng.pDocName = "";
|
||||
Chng.pObjectName = "";
|
||||
Chng.pSubName = "";
|
||||
Chng.pTypeName = "";
|
||||
|
||||
|
||||
Notify(Chng);
|
||||
|
@ -985,6 +993,7 @@ SelectionSingleton::SelectionSingleton()
|
|||
CurrentPreselection.pDocName = 0;
|
||||
CurrentPreselection.pObjectName = 0;
|
||||
CurrentPreselection.pSubName = 0;
|
||||
CurrentPreselection.pTypeName = 0;
|
||||
CurrentPreselection.x = 0.0;
|
||||
CurrentPreselection.y = 0.0;
|
||||
CurrentPreselection.z = 0.0;
|
||||
|
|
|
@ -70,12 +70,22 @@ public:
|
|||
SetPreselect,
|
||||
RmvPreselect
|
||||
};
|
||||
SelectionChanges()
|
||||
: Type(ClrSelection)
|
||||
, pDocName(0)
|
||||
, pObjectName(0)
|
||||
, pSubName(0)
|
||||
, pTypeName(0)
|
||||
, x(0),y(0),z(0)
|
||||
{
|
||||
}
|
||||
|
||||
MsgType Type;
|
||||
|
||||
const char* pDocName;
|
||||
const char* pObjectName;
|
||||
const char* pSubName;
|
||||
const char* pTypeName;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
#include <Base/Interpreter.h>
|
||||
|
||||
#include "SelectionObject.h"
|
||||
#include "SelectionObjectPy.h"
|
||||
#include "Selection.h"
|
||||
#include "Application.h"
|
||||
#include <Gui/SelectionObjectPy.h>
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
|
@ -43,6 +44,17 @@ SelectionObject::SelectionObject()
|
|||
{
|
||||
}
|
||||
|
||||
SelectionObject::SelectionObject(const Gui::SelectionChanges& msg)
|
||||
{
|
||||
FeatName = msg.pObjectName ? msg.pObjectName : "";
|
||||
DocName = msg.pDocName ? msg.pDocName : "";
|
||||
TypeName = msg.pTypeName ? msg.pTypeName : "";
|
||||
if (msg.pSubName) {
|
||||
SubNames.push_back(msg.pSubName);
|
||||
SelPoses.push_back(Base::Vector3d(msg.x, msg.y, msg.z));
|
||||
}
|
||||
}
|
||||
|
||||
SelectionObject::SelectionObject(App::DocumentObject* obj)
|
||||
{
|
||||
FeatName = obj->getNameInDocument();
|
||||
|
|
|
@ -34,6 +34,8 @@ namespace App {
|
|||
|
||||
namespace Gui {
|
||||
|
||||
class SelectionChanges;
|
||||
|
||||
/**
|
||||
* The Selection object class
|
||||
*/
|
||||
|
@ -44,6 +46,9 @@ class GuiExport SelectionObject : public Base::BaseClass
|
|||
public:
|
||||
/** Constructs a SelectionObject object. */
|
||||
SelectionObject();
|
||||
/*! Constructs a SelectionObject from the SelectionChanges structure.
|
||||
*/
|
||||
SelectionObject(const SelectionChanges& msg);
|
||||
SelectionObject(App::DocumentObject*);
|
||||
virtual ~SelectionObject();
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user