Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
6779f219
Commit
6779f219
authored
Jan 31, 2010
by
Sebastian Eichelbaum
Browse files
[MERGE]
parents
666459d8
67218a3e
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
617 additions
and
66 deletions
+617
-66
src/common/WProperties.cpp
src/common/WProperties.cpp
+27
-0
src/common/WProperties.h
src/common/WProperties.h
+14
-1
src/common/WProperty.cpp
src/common/WProperty.cpp
+38
-37
src/common/WProperty.h
src/common/WProperty.h
+41
-2
src/graphicsEngine/WEvent.cpp
src/graphicsEngine/WEvent.cpp
+50
-0
src/graphicsEngine/WEvent.h
src/graphicsEngine/WEvent.h
+85
-0
src/graphicsEngine/WGE2DManipulator.cpp
src/graphicsEngine/WGE2DManipulator.cpp
+2
-2
src/graphicsEngine/WGE2DManipulator.h
src/graphicsEngine/WGE2DManipulator.h
+2
-2
src/graphicsEngine/WGEViewer.cpp
src/graphicsEngine/WGEViewer.cpp
+9
-1
src/graphicsEngine/WGEViewer.h
src/graphicsEngine/WGEViewer.h
+13
-0
src/graphicsEngine/WMarkHandler.cpp
src/graphicsEngine/WMarkHandler.cpp
+85
-0
src/graphicsEngine/WMarkHandler.h
src/graphicsEngine/WMarkHandler.h
+82
-0
src/graphicsEngine/WROI.h
src/graphicsEngine/WROI.h
+2
-3
src/graphicsEngine/WROIBox.cpp
src/graphicsEngine/WROIBox.cpp
+28
-8
src/graphicsEngine/WROIBox.h
src/graphicsEngine/WROIBox.h
+37
-4
src/gui/WCustomWidget.h
src/gui/WCustomWidget.h
+14
-1
src/gui/qt4/WQtCustomDockWidget.cpp
src/gui/qt4/WQtCustomDockWidget.cpp
+5
-0
src/gui/qt4/WQtCustomDockWidget.h
src/gui/qt4/WQtCustomDockWidget.h
+7
-0
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
+1
-1
src/modules/eegView/WMEEGView.cpp
src/modules/eegView/WMEEGView.cpp
+75
-4
No files found.
src/common/WProperties.cpp
View file @
6779f219
...
...
@@ -159,3 +159,30 @@ void WProperties::unhideProperty( std::string name )
}
}
void
WProperties
::
reemitChangedValueSignals
()
{
std
::
vector
<
WProperty
*
>::
iterator
iter
;
for
(
iter
=
m_propertyVector
.
begin
();
iter
!=
m_propertyVector
.
end
();
++
iter
)
{
WProperty
*
property
=
*
iter
;
if
(
property
->
isDirty
()
)
{
property
->
dirty
(
false
);
// Refire but don't change the value.
property
->
signalValueChanged
();
}
}
}
bool
WProperties
::
isDirty
()
const
{
std
::
vector
<
WProperty
*
>::
const_iterator
cit
;
for
(
cit
=
m_propertyVector
.
begin
();
cit
!=
m_propertyVector
.
end
();
++
cit
)
{
if
(
(
*
cit
)
->
isDirty
()
)
{
return
true
;
}
}
return
false
;
}
src/common/WProperties.h
View file @
6779f219
...
...
@@ -296,7 +296,19 @@ public:
*/
bool
existsProp
(
std
::
string
name
);
private:
/**
* If there are WProperty objects which are marked as dirty, then their
* signals are reemitted.
*/
void
reemitChangedValueSignals
();
/**
* Indicates if at least one WProperty is dirty or all are clean.
*
* \return True if at least one property is dirty, false otherwise
*/
bool
isDirty
()
const
;
/**
* helper function that finds a property by its name
*
...
...
@@ -305,6 +317,7 @@ private:
*/
WProperty
*
findProp
(
std
::
string
name
);
private:
/**
* map of properties for easy access with name string
*/
...
...
src/common/WProperty.cpp
View file @
6779f219
...
...
@@ -28,84 +28,61 @@
WProperty
::
WProperty
(
std
::
string
name
,
std
::
string
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_STRING
),
m_name
(
name
),
m_value
(
value
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
m_value
(
value
)
{
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::
WProperty
(
std
::
string
name
,
bool
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_BOOL
),
m_name
(
name
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
:
m_type
(
P_BOOL
)
{
setValue
(
value
);
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::
WProperty
(
std
::
string
name
,
char
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_CHAR
),
m_name
(
name
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
:
m_type
(
P_CHAR
)
{
setMin
(
-
128
);
setMax
(
127
);
setValue
(
value
);
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::
WProperty
(
std
::
string
name
,
int
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_INT
),
m_name
(
name
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
:
m_type
(
P_INT
)
{
setMin
(
0
);
setMax
(
255
);
setValue
(
value
);
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::
WProperty
(
std
::
string
name
,
float
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_FLOAT
),
m_name
(
name
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
:
m_type
(
P_FLOAT
)
{
setMin
(
0.0
);
setMax
(
100.0
);
setValue
(
value
);
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::
WProperty
(
std
::
string
name
,
double
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_DOUBLE
),
m_name
(
name
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
:
m_type
(
P_DOUBLE
)
{
setMin
(
0.0
);
setMax
(
100.0
);
setValue
(
value
);
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::
WProperty
(
std
::
string
name
,
WColor
value
,
bool
hidden
,
std
::
string
shortDesc
,
std
::
string
longDesc
)
:
m_type
(
P_DOUBLE
),
m_name
(
name
),
m_shortDesc
(
shortDesc
),
m_longDesc
(
longDesc
),
m_isHidden
(
hidden
)
:
m_type
(
P_DOUBLE
)
{
setValue
(
value
);
initMembers
(
name
,
shortDesc
,
longDesc
,
hidden
);
}
WProperty
::~
WProperty
()
{
}
...
...
@@ -165,6 +142,30 @@ bool WProperty::isHidden()
return
m_isHidden
;
}
bool
WProperty
::
isDirty
()
const
{
return
m_isDirty
;
}
void
WProperty
::
dirty
(
bool
isDirty
)
{
m_isDirty
=
isDirty
;
}
void
WProperty
::
initMembers
(
const
std
::
string
&
name
,
const
std
::
string
&
shortDesc
,
const
std
::
string
&
longDesc
,
const
bool
hidden
)
{
m_name
=
name
;
m_shortDesc
=
shortDesc
;
m_longDesc
=
longDesc
;
m_isHidden
=
hidden
;
m_isDirty
=
false
;
}
void
WProperty
::
signalValueChanged
()
{
m_signalValueChanged
(
m_name
);
}
boost
::
signals2
::
signal1
<
void
,
std
::
string
>*
WProperty
::
getSignalValueChanged
()
{
return
&
m_signalValueChanged
;
...
...
src/common/WProperty.h
View file @
6779f219
...
...
@@ -210,7 +210,7 @@ public:
{
m_value
=
""
;
}
m_
signalValueChanged
(
m_name
);
signalValueChanged
();
}
/**
...
...
@@ -284,7 +284,44 @@ public:
*/
std
::
string
getValueString
();
/**
* Determines if this property is considered to be dirty. A Property can be
* dirty if its value changes but its change cannot be applied in the
* module. This can have several reasons: e.g. module is busy and is
* working with current values of the properties. So it recognizes the
* change and mark those properties as dirty for later update.
*
* \return True if this property has unhandled change events and needs a
* fresh update handling
*/
bool
isDirty
()
const
;
/**
* Marks a property as dirty. For more details on the dirtyness \see isDirty().
*
* \param isDirty True if it is dirty, false if appropriate actions took
* place so it is not dirty anymore.
*/
void
dirty
(
bool
isDirty
);
/**
* Fires the signal
*/
void
signalValueChanged
();
private:
/**
* Use this only in constructors to initialize the members. The only reason
* why this member function exists is not to repeat your self. This makes
* it easy to add new member variabels.
*
* \param name
* \param shortDesc
* \param longDesc
* \param hidden
*/
void
initMembers
(
const
std
::
string
&
name
,
const
std
::
string
&
shortDesc
,
const
std
::
string
&
longDesc
,
const
bool
hidden
);
/**
* type of property
*/
...
...
@@ -325,10 +362,12 @@ private:
*/
bool
m_isHidden
;
bool
m_isDirty
;
//!< True if the property has changed but its changed weren't consumed
/**
* boost signal object to indicate property changes
*/
boost
::
signals2
::
signal1
<
void
,
std
::
string
>
m_signalValueChanged
;
boost
::
signals2
::
signal1
<
void
,
std
::
string
>
m_signalValueChanged
;
};
#endif // WPROPERTY_H
src/graphicsEngine/WEvent.cpp
0 → 100644
View file @
6779f219
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WEvent.h"
WEvent
::
WEvent
(
double
time
)
:
m_time
(
time
)
{
}
void
WEvent
::
setTime
(
double
time
)
{
m_time
=
time
;
}
double
WEvent
::
getTime
()
const
{
return
m_time
;
}
void
WEvent
::
setNode
(
osg
::
ref_ptr
<
osg
::
Node
>
node
)
{
m_node
=
node
;
}
osg
::
ref_ptr
<
osg
::
Node
>
WEvent
::
getNode
()
const
{
return
m_node
;
}
src/graphicsEngine/WEvent.h
0 → 100644
View file @
6779f219
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WEVENT_H
#define WEVENT_H
#include <osg/Node>
/**
* This class marks a special time position in an EEG or MEG recording.
*/
class
WEvent
{
public:
/**
* Constructor
*
* \param time sets the time position
*/
explicit
WEvent
(
double
time
);
/**
* Set the time position
*
* \param time time position
*/
void
setTime
(
double
time
);
/**
* Get the time position
*
* \return time position
*/
double
getTime
()
const
;
/**
* Set the OSG-Node representing the event
*
* \param node OSG-Node as ref_ptr
*/
void
setNode
(
osg
::
ref_ptr
<
osg
::
Node
>
node
);
/**
* Get the OSG-Node representing the event
*
* \return OSG-Node as ref_ptr
*/
osg
::
ref_ptr
<
osg
::
Node
>
getNode
()
const
;
protected:
private:
/**
* time position
*/
double
m_time
;
/**
* OSG-Node representing the event
*/
osg
::
ref_ptr
<
osg
::
Node
>
m_node
;
};
#endif // WEVENT_H
src/graphicsEngine/WGE2DManipulator.cpp
View file @
6779f219
...
...
@@ -26,7 +26,7 @@
WGE2DManipulator
::
WGE2DManipulator
()
:
m_positionX
(
0
.0
),
:
m_positionX
(
-
64
.0
),
m_positionY
(
0.0
),
m_zoom
(
1.0
)
{
...
...
@@ -63,7 +63,7 @@ osg::Matrixd WGE2DManipulator::getInverseMatrix() const
void
WGE2DManipulator
::
home
(
const
osgGA
::
GUIEventAdapter
&
/*ea*/
,
osgGA
::
GUIActionAdapter
&
us
)
// NOLINT We can not change the interface of OSG
{
m_positionX
=
0
.0
;
m_positionX
=
-
64
.0
;
m_positionY
=
0.0
;
m_zoom
=
1.0
;
...
...
src/graphicsEngine/WGE2DManipulator.h
View file @
6779f219
...
...
@@ -93,7 +93,7 @@ public:
/**
* Handle events
*
* \param ea event class for storing
K
eyboard, mouse and window events
* \param ea event class for storing
k
eyboard, mouse and window events
* \param us the action adapter used to request actions of the GUI
* \return true if handled, false otherwise
*/
...
...
@@ -149,7 +149,7 @@ private:
/**
* Handles events related to zooming.
*
* \param ea event class for storing
K
eyboard, mouse and window events
* \param ea event class for storing
k
eyboard, mouse and window events
*/
bool
zoom
(
const
osgGA
::
GUIEventAdapter
&
ea
);
...
...
src/graphicsEngine/WGEViewer.cpp
View file @
6779f219
...
...
@@ -60,15 +60,18 @@ WGEViewer::WGEViewer( std::string name, osg::ref_ptr<WindowData> wdata, int x, i
m_View
->
setCamera
(
new
WGECamera
(
width
,
height
,
projectionMode
)
);
m_View
->
getCamera
()
->
setGraphicsContext
(
m_GraphicsContext
);
// camera manipulator
switch
(
projectionMode
)
{
case
(
WGECamera
::
ORTHOGRAPHIC
):
case
(
WGECamera
::
PERSPECTIVE
):
// camera manipulator
m_View
->
setCameraManipulator
(
new
WGEZoomTrackballManipulator
()
);
break
;
case
(
WGECamera
::
TWO_D
):
m_View
->
setCameraManipulator
(
new
WGE2DManipulator
()
);
m_markHandler
=
new
WMarkHandler
();
m_View
->
addEventHandler
(
m_markHandler
);
break
;
default:
throw
WGEInitFailed
(
"Unknown projection mode"
);
...
...
@@ -165,6 +168,11 @@ osg::ref_ptr< WPickHandler > WGEViewer::getPickHandler()
return
m_pickHandler
;
}
osg
::
ref_ptr
<
WMarkHandler
>
WGEViewer
::
getMarkHandler
()
const
{
return
m_markHandler
;
}
void
WGEViewer
::
reset
()
{
m_View
->
home
();
...
...
src/graphicsEngine/WGEViewer.h
View file @
6779f219
...
...
@@ -44,6 +44,7 @@
#include "WGEGraphicsWindow.h"
#include "WGECamera.h"
#include "WMarkHandler.h"
#include "WPickHandler.h"
...
...
@@ -164,6 +165,13 @@ public:
*/
osg
::
ref_ptr
<
WPickHandler
>
getPickHandler
();
/**
* Getter for the mark handler
*
* \return the mark handler
*/
osg
::
ref_ptr
<
WMarkHandler
>
getMarkHandler
()
const
;
protected:
/**
* The OpenSceneGraph view used in this (Composite)Viewer.
...
...
@@ -180,6 +188,11 @@ protected:
*/
osg
::
ref_ptr
<
WPickHandler
>
m_pickHandler
;
/**
* Pointer to the mark handler of the viewer.
*/
osg
::
ref_ptr
<
WMarkHandler
>
m_markHandler
;
private:
};
...
...
src/graphicsEngine/WMarkHandler.cpp
0 → 100644
View file @
6779f219
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include "WMarkHandler.h"
WMarkHandler
::
WMarkHandler
()
:
m_positionFlag
(
new
WCondition
,
-
1.0
)
{
}
WFlag
<
double
>*
WMarkHandler
::
getPositionFlag
()
{
return
&
m_positionFlag
;
}
WMarkHandler
::~
WMarkHandler
()
{
}
bool
WMarkHandler
::
handle
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
aa
)
{
bool
handled
=
false
;
switch
(
ea
.
getEventType
()
)
{
case
osgGA
::
GUIEventAdapter
::
PUSH
:
case
osgGA
::
GUIEventAdapter
::
DRAG
:
if
(
ea
.
getButtonMask
()
==
osgGA
::
GUIEventAdapter
::
LEFT_MOUSE_BUTTON
)
{
handled
=
calculateNewPosition
(
ea
,
aa
);
}
break
;
default:
// do nothing
break
;
}
return
handled
;
}
bool
WMarkHandler
::
calculateNewPosition
(
const
osgGA
::
GUIEventAdapter
&
ea
,
osgGA
::
GUIActionAdapter
&
aa
)
{
bool
handled
=
false
;
osg
::
View
*
view
=
aa
.
asView
();
if
(
view
)
{
osg
::
Camera
*
camera
=
view
->
getCamera
();
if
(
camera
)
{
osg
::
Matrixd
matrix
=
camera
->
getViewMatrix
();
matrix
.
postMult
(
camera
->
getProjectionMatrix
()
);
if
(
camera
->
getViewport
()
)
{
matrix
.
postMult
(
camera
->
getViewport
()
->
computeWindowMatrix
()
);
}
osg
::
Vec3d
selectedPoint
=
osg
::
Vec3d
(
ea
.
getX
(),
ea
.
getY
(),
0.0
)
*
osg
::
Matrixd
::
inverse
(
matrix
);
m_positionFlag
.
set
(
selectedPoint
.
x
()
);
handled
=
true
;
}
}
return
handled
;
}
src/graphicsEngine/WMarkHandler.h
0 → 100644
View file @
6779f219
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMARKHANDLER_H
#define WMARKHANDLER_H
#include <osgGA/GUIEventHandler>
#include "../common/WFlag.h"
/**
* Class to handle events which mark a time position in an EEG or MEG recording.
*/
class
WMarkHandler
:
public
osgGA
::
GUIEventHandler
{
public:
/**
* Constructor