Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
3de3ed5c
Commit
3de3ed5c
authored
Dec 03, 2014
by
Stefan Philips
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] cluster display works again (we don't use pickhandler anymore)
parent
33520c34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
16 deletions
+67
-16
src/modules/clusterDisplay/WMClusterDisplay.cpp
src/modules/clusterDisplay/WMClusterDisplay.cpp
+30
-11
src/modules/clusterDisplay/WMClusterDisplay.h
src/modules/clusterDisplay/WMClusterDisplay.h
+37
-5
No files found.
src/modules/clusterDisplay/WMClusterDisplay.cpp
View file @
3de3ed5c
...
...
@@ -28,6 +28,8 @@
#include <boost/regex.hpp>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIEventHandler>
#include <osgGA/StateSetManipulator>
#include <osgGA/TrackballManipulator>
#include <osgViewer/ViewerEventHandlers>
...
...
@@ -41,6 +43,7 @@
#include "core/graphicsEngine/WGEUtils.h"
#include "core/kernel/WKernel.h"
#include "core/kernel/WROIManager.h"
#include "core/ui/WUIViewWidget.h"
#include "WMClusterDisplay.h"
#include "WMClusterDisplay.xpm"
...
...
@@ -48,6 +51,22 @@
// This line is needed by the module loader to actually find your module. Do not remove. Do NOT add a ";" here.
W_LOADABLE_MODULE
(
WMClusterDisplay
)
bool
WMClusterDisplay
::
MainViewEventHandler
::
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
/* aa */
)
{
// wlog::debug( "WMClusterDisplay::MainViewEventHandler" ) << "handle";
if
(
ea
.
getEventType
()
==
GUIEvents
::
PUSH
&&
ea
.
getButton
()
==
osgGA
::
GUIEventAdapter
::
LEFT_MOUSE_BUTTON
)
{
return
m_signalLeftButtonPush
(
WVector2f
(
ea
.
getX
(),
ea
.
getY
()
)
);
}
return
false
;
}
void
WMClusterDisplay
::
MainViewEventHandler
::
subscribeLeftButtonPush
(
LeftButtonPushSignalType
::
slot_type
slot
)
{
m_signalLeftButtonPush
.
connect
(
slot
);
}
WMClusterDisplay
::
WMClusterDisplay
()
:
WModule
(),
m_widgetDirty
(
false
),
...
...
@@ -368,8 +387,10 @@ void WMClusterDisplay::properties()
void
WMClusterDisplay
::
moduleMain
()
{
boost
::
signals2
::
connection
con
=
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getViewer
()
->
getPickHandler
()
->
getPickSignal
()
->
connect
(
boost
::
bind
(
&
WMClusterDisplay
::
dendrogramClick
,
this
,
_1
)
);
osg
::
ref_ptr
<
MainViewEventHandler
>
eh
(
new
MainViewEventHandler
);
eh
->
subscribeLeftButtonPush
(
boost
::
bind
(
&
WMClusterDisplay
::
dendrogramClick
,
this
,
_1
)
);
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getViewer
()
->
getView
()
->
addEventHandler
(
eh
);
m_moduleState
.
setResetable
(
true
,
true
);
m_moduleState
.
add
(
m_propCondition
);
...
...
@@ -506,7 +527,6 @@ void WMClusterDisplay::moduleMain()
//WKernel::getRunningKernel()->getRoiManager()->setUseExternalBitfield( m_active->get( true ) );
}
}
con
.
disconnect
();
WKernel
::
getRunningKernel
()
->
getGraphicsEngine
()
->
getScene
()
->
remove
(
m_rootNode
);
}
...
...
@@ -966,19 +986,18 @@ void WMClusterDisplay::setColor( std::vector<size_t> clusters, WColor color )
}
}
void
WMClusterDisplay
::
dendrogramClick
(
WPickInfo
pickInfo
)
bool
WMClusterDisplay
::
dendrogramClick
(
const
WVector2f
&
pos
)
{
if
(
!
m_propShowDendrogram
->
get
()
||
!
(
pickInfo
.
getName
()
==
"nothing"
)
)
if
(
m_dendrogramGeode
->
inDendrogramArea
(
pos
)
)
{
return
;
int
x
=
pos
[
0
];
int
y
=
pos
[
1
];
m_propSelectedCluster
->
set
(
m_dendrogramGeode
->
getClickedCluster
(
x
,
y
)
);
return
true
;
}
int
x
=
pickInfo
.
getPickPixel
().
x
();
int
y
=
pickInfo
.
getPickPixel
().
y
();
m_propSelectedCluster
->
set
(
m_dendrogramGeode
->
getClickedCluster
(
x
,
y
)
);
return
false
;
}
void
WMClusterDisplay
::
createFiberGeode
()
{
m_fiberDrawable
=
osg
::
ref_ptr
<
WFiberDrawable
>
(
new
WFiberDrawable
);
...
...
src/modules/clusterDisplay/WMClusterDisplay.h
View file @
3de3ed5c
...
...
@@ -29,14 +29,14 @@
#include <vector>
#include <osg/Geode>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIEventHandler>
#include "core/common/WHierarchicalTreeFibers.h"
#include "core/graphicsEngine/geodes/WDendrogramGeode.h"
#include "core/graphicsEngine/WFiberDrawable.h"
#include "core/graphicsEngine/WGEManagedGroupNode.h"
#include "core/graphicsEngine/widgets/WOSGButton.h"
#include "core/graphicsEngine/WPickHandler.h"
#include "core/graphicsEngine/WPickInfo.h"
#include "core/graphicsEngine/WGECamera.h"
#include "core/kernel/WFiberSelector.h"
#include "core/kernel/WModule.h"
...
...
@@ -108,6 +108,37 @@ protected:
private:
/**
* Small event handler class to catch left mouse buttons clicks in the main view.
*/
class
MainViewEventHandler
:
public
osgGA
::
GUIEventHandler
{
public:
typedef
boost
::
signals2
::
signal
<
bool
(
WVector2f
)
>
LeftButtonPushSignalType
;
/**
* The OSG calls this function whenever a new event has occured.
*
* \param ea Event class for storing GUI events such as mouse or keyboard interation etc.
*
* \return true if the event was handled.
*/
bool
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
/* aa */
);
/**
* Registers a function slot to LEFT BUTTON PUSH events. Whenever the event occurs, the slot is called with current parameters.
*
* \param slot Function object having the appropriate signature according to the used SignalType.
*/
void
subscribeLeftButtonPush
(
LeftButtonPushSignalType
::
slot_type
slot
);
private:
/**
* Signal used for notification of the LEFT BUTTON PUSH event.
*/
LeftButtonPushSignalType
m_signalLeftButtonPush
;
};
/**
* helper function to read a text file
* \param fileName
...
...
@@ -202,10 +233,11 @@ private:
std
::
string
createLabel
(
size_t
id
);
/**
* listenes to the pickhandler and determines if a click into the dendrogram happened
* \param pickInfo the pickInfo object as sent out by the pickhandler
* handles clicks into the dendrogram
* \param pos the mouse position during the click
* \return true if it handled the click
*/
void
dendrogramClick
(
WPickInfo
pickInfo
);
bool
dendrogramClick
(
const
WVector2f
&
pos
);
/**
* helper function to initialize a fiber display node
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment