19#include <Inventor/nodes/SoCamera.h>
20#include <Inventor/Qt/viewers/SoQtViewer.h>
68 std::cout<<
"IVP13DSystem::Imp::clickedoutside Error: Got null selection pointer!"<<std::endl;
73 std::cout<<
"IVP13DSystem::Imp::clickedoutside Error: Could not find system pointer!"<<std::endl;
87 if (!
m_d->clickedoutsideScheduled)
89 m_d->clickedoutsideScheduled =
false;
98 std::cout<<
"IVP13DSystem::Imp::start_changeselection Error: Could not find selection pointer!"<<std::endl;
102 if (
selection->policy.getValue()==SoSelection::SINGLE)
107 std::cout<<
"IVP13DSystem::Imp::start_changeselection Error: Could not find system pointer!"<<std::endl;
125 std::cout<<
"IVP13DSystem::Imp::finished_changeselection Error: Could not find selection pointer!"<<std::endl;
131 std::cout<<
"IVP13DSystem::Imp::finished_changeselection Error: Could not find system pointer!"<<std::endl;
137 if (
selection->policy.getValue()==SoSelection::SINGLE)
142 std::cout<<
"IVP13DSystem::Imp::finished_changeselection Error: Could not find last selection path list!"<<std::endl;
147 bool changed =
false;
148 if (nlastselection!=
selection->getList()->getLength()) {
151 for (
int i = 0; i <
selection->getList()->getLength(); ++i) {
166 if (
selection->getList()->getLength()>nlastselection) {
173 QSet<SoNode*> selnodes;
174 QSet<SoPath*> selpaths;
175 int n =
selection->getList()->getLength();
176 for (
int i = 0; i < n; ++i) {
177 SoPath * path = (*(
selection->getList()))[i];
180 SoFullPath *fPath =
static_cast<SoFullPath *
>(path);
181 SoNode *
node = fPath->getTail();
194 SoFullPath *fPath =
static_cast<SoFullPath *
>(path);
197 SoNode *selectedNode = fPath->getTail();
202 std::cout<<
"IVP13DSystem::Imp::made_selection Error: Could not find selection pointer!"<<std::endl;
205 if (
selection->policy.getValue()!=SoSelection::SINGLE)
209 std::cout <<
"IVP13DSystem::Imp::made_selection Error: Could not find system pointer!"<<std::endl;
229 SoFullPath *fPath =
static_cast<SoFullPath *
>(path);
232 SoNode *deselectedNode = fPath->getTail();
238 std::cout<<
"IVP13DSystem::Imp::made_deselection Error: Could not find selection pointer!"<<std::endl;
241 if (
selection->policy.getValue()!=SoSelection::SINGLE)
245 std::cout <<
"IVP13DSystem::Imp::made_deselection Error: Could not find system pointer!"<<std::endl;
260 message(
"registerSelectionNode Error: NULL selection pointer!");
264 message(
"registerSelectionNode Error: Trying to register selection node more than once!");
284 message(
"unregisterSelectionNode Error: NULL selection pointer!");
288 message(
"registerSelectionNode Error: Trying to unregister unknown selection node!");
299 if (
m_d->selectionsWithDisabledNotifications.contains(
selection))
300 m_d->selectionsWithDisabledNotifications.remove(
selection);
313 message(
"setUserSelectionNotificationsEnabled Error: NULL selection pointer!");
317 message(
"setUserSelectionNotificationsEnabled Error: Called for selection which was never registered!");
320 if (enabled !=
m_d->selectionsWithDisabledNotifications.contains(
selection))
324 m_d->selectionsWithDisabledNotifications.remove(
selection);
333 static std::map<SoCooperativeSelection*,IVP13DSystem*>::iterator it, itE =
Imp::selection2system.end();
335 if (it->second!=
this)
337 if (it->first!=exception_sel) {
338 if (it->first->policy.getValue()!=SoCooperativeSelection::SINGLE) {
340 it->first->deselectAll();
343 if (it->first->getList()->getLength()==1) {
345 SoPath * path =
static_cast<SoPath*
>(it->first->getList()->
get(0));
347 it->first->deselectAll();
360 m_d->clickedoutsideScheduled =
false;
368 m_d->selection2lastpathlist.clear();
371 std::set<SoCooperativeSelection*> sel2unregister;
374 if (it->second ==
this)
375 sel2unregister.insert(it->first);
376 std::set<SoCooperativeSelection*>::iterator itSel, itSelE = sel2unregister.end();
378 for (itSel = sel2unregister.begin();itSel!=itSelE;++itSel) {
382 messageDebug(
"Unregistered all nodes. Unref all camera pointers...");
385 std::set<SoCamera*>
::iterator itCam, itCamE =
m_d->staticcameras.end();
386 for (itCam =
m_d->staticcameras.begin();itCam!=itCamE;++itCam)
397 std::set<SoCamera*> cameralist =
m_d->staticcameras;
398 std::set<SoQtViewer*>::const_iterator it, itE=
m_d->viewers.end();
399 for (it=
m_d->viewers.begin();it!=itE;++it) {
400 SoCamera*cam = (*it)->getCamera();
402 cameralist.insert(cam);
413 m_d->staticcameras.insert(cam);
422 m_d->viewers.insert(viewer);
static void clickedoutside(void *userdata, SoCooperativeSelection *sel)
std::set< SoQtViewer * > viewers
std::vector< SoSelectionPathCB * > _callbacks
bool clickedoutsideScheduled
static void start_changeselection(void *userdata, SoSelection *sel)
QSet< SoCooperativeSelection * > selectionsWithDisabledNotifications
static void made_selection(void *userdata, SoPath *path)
std::set< SoCamera * > staticcameras
static void finished_changeselection(void *userdata, SoSelection *sel)
static std::map< SoCooperativeSelection *, IVP13DSystem * > selection2system
std::map< SoCooperativeSelection *, SoPathList > selection2lastpathlist
static void made_deselection(void *userdata, SoPath *path)
void activateClickedOutside()
void itemFromSystemSelected()
virtual void userClickedOnBgd()
virtual void userChangedSelection(SoCooperativeSelection *, const QSet< SoNode * > &, QSet< SoPath * >)
void unregisterSelectionNode(SoCooperativeSelection *)
void registerCamera(SoCamera *camera)
virtual void deselectAll(SoCooperativeSelection *exception_sel=0)
IVP13DSystem(const QString &name, const QString &information, const QString &contact_info)
virtual void userDeselectedSingleNode(SoCooperativeSelection *, SoNode *, SoPath *)
virtual void userSelectedSingleNode(SoCooperativeSelection *, SoNode *, SoPath *)
void setUserSelectionNotificationsEnabled(SoCooperativeSelection *sel, bool enabled)
void registerSelectionNode(SoCooperativeSelection *)
void registerViewer(SoQtViewer *viewer)
void messageVerbose(const QString &) const
void messageDebug(const QString &) const
const QString & name() const
IVP1System(const QString &name, const QString &information, const QString &contact_info)
void message(const QString &) const
const QString & information() const
const QString & contact_info() const
static void ensureInitClass()
const std::string selection
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
std::string find(const std::string &s)
return a remapped string