OpenWalnut  1.5.0dev
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
WROISphere Class Reference

A sphere representing a region of interest. More...

#include <WROISphere.h>

+ Inheritance diagram for WROISphere:
+ Collaboration diagram for WROISphere:

Public Member Functions

 WROISphere (WPosition position, float radius=5.0)
 Yields sphere with desired center point and radius. More...
 
virtual ~WROISphere ()
 standard destructor More...
 
WPosition getPosition () const
 getter More...
 
void setPosition (WPosition position)
 setter More...
 
void setPosition (float x, float y, float z)
 setter More...
 
void setColor (osg::Vec4 color)
 Setter for standard color. More...
 
void setNotColor (osg::Vec4 color)
 Setter for color in negated state. More...
 
void redrawSphere ()
 removes the old drawable from the osg geode and adds a new one at the current position and size More...
 
void setLockX (bool value=true)
 sets the flag that allows or disallows movement along the x axis More...
 
void setLockY (bool value=true)
 sets the flag that allows or disallows movement along the y axis More...
 
void setLockZ (bool value=true)
 sets the flag that allows or disallows movement along the z axis More...
 
void moveSphere (WVector3d offset)
 move the sphere with a given offset More...
 
void setX (float x)
 setter More...
 
void setY (float y)
 setter More...
 
void setZ (float z)
 setter More...
 
void setLockVector (WVector3d vector)
 setter More...
 
void setLockOnVector (bool value=true)
 setter More...
 
- Public Member Functions inherited from WROI
virtual ~WROI ()
 Need virtual destructor because of virtual function. More...
 
void setNot (bool isNot=true)
 sets the NOT flag More...
 
bool isNot ()
 getter for NOT flag More...
 
bool active ()
 getter More...
 
void setActive (bool active)
 setter More...
 
void hide ()
 hides the roi in the scene More...
 
void unhide ()
 unhides the roi in the scene More...
 
bool dirty ()
 Getter for modified flag. More...
 
void setDirty ()
 sets the dirty flag More...
 
std::shared_ptr< WPropertiesgetProperties ()
 Getter. More...
 
void addROIChangeNotifier (std::shared_ptr< boost::function< void() > > notifier)
 Add a specified notifier to the list of default notifiers which get connected to each roi. More...
 
void removeROIChangeNotifier (std::shared_ptr< boost::function< void() > > notifier)
 Remove a specified notifier from the list of default notifiers which get connected to each roi. More...
 
WPropBool invertProperty ()
 Invert property. More...
 
WPropBool showProperty ()
 The property for toggling ROI visibility. More...
 
WPropBool activeProperty ()
 The active property. More...
 
WPropString nameProperty ()
 The name property. More...
 

Private Member Functions

void registerRedrawRequest (WPickInfo pickInfo)
 note that there was a pick More...
 
virtual void updateGFX ()
 updates the graphics More...
 

Private Attributes

size_t sphereId
 Id of the current sphere. More...
 
WPosition m_position
 The position of the sphere. More...
 
WPosition m_originalPosition
 The position of the sphere when created, used for locking. More...
 
float m_radius
 The radius of the sphere. More...
 
bool m_isPicked
 Indicates whether the box is currently picked or not. More...
 
WPosition m_pickedPosition
 Caches the old picked position to a allow for comparison. More...
 
WVector3d m_pickNormal
 Store the normal that occured when the pick action was started. More...
 
WVector2d m_oldPixelPosition
 Caches the old picked position to a allow for cmoparison. More...
 
WPickInfo m_pickInfo
 Stores the pick information for potential redraw. More...
 
std::shared_ptr< WGEViewerm_viewer
 makes viewer available all over this class. More...
 
osg::Vec4 m_color
 the color of the box More...
 
osg::Vec4 m_notColor
 the color of the box when negated More...
 
WVector3d m_lockPoint
 stores to point of origin of the lock vector More...
 
WVector3d m_lockVector
 stores the lock vector More...
 
bool m_lockOnVector
 flag indicatin wether the movement of the sphere is restricted More...
 
bool m_lockX
 flag indicatin wether the movement of the sphere is restricted More...
 
bool m_lockY
 flag indicatin wether the movement of the sphere is restricted More...
 
bool m_lockZ
 flag indicatin wether the movement of the sphere is restricted More...
 

Static Private Attributes

static size_t maxSphereId = 0
 Current maximum boxId over all spheres. More...
 

Additional Inherited Members

- Public Types inherited from WROI
typedef osg::ref_ptr< WROIRefPtr
 Ref Pointer type. More...
 
- Protected Member Functions inherited from WROI
void properties ()
 initializes the roi's properties More...
 
void propertyChanged ()
 callback when a property gets changed More...
 
void signalRoiChange ()
 signals a roi change to all subscribers More...
 
- Protected Attributes inherited from WROI
osg::ref_ptr< WPickHandlerm_pickHandler
 A pointer to the pick handler used to get gui events for moving the box. More...
 
std::shared_ptr< WPropertiesm_properties
 the property object for the module More...
 
WPropBool m_dirty
 dirty flag, indicating the graphics needs updating, it is no longer used for bitfield updating since these customers get the update notification via callback More...
 
WPropBool m_active
 indicates if the roi is active More...
 
WPropBool m_show
 indicates if the roi is visible in the scene More...
 
WPropBool m_not
 indicates if the roi is negated More...
 
WPropString m_name
 name of the ROI. More...
 
WPropDouble m_threshold
 threshold for an arbitrary roi More...
 
WPropColor m_color
 A color for painting the roi in the scene. More...
 
std::list< std::shared_ptr< boost::function< void() > > > m_changeNotifiers
 The notifiers connected to added rois by default. More...
 
std::shared_mutex m_associatedNotifiersLock
 Lock for associated notifiers set. More...
 

Detailed Description

A sphere representing a region of interest.

Definition at line 43 of file WROISphere.h.

Constructor & Destructor Documentation

◆ WROISphere()

WROISphere::WROISphere ( WPosition  position,
float  radius = 5.0 
)

Yields sphere with desired center point and radius.

Parameters
positionposition of the center of the sphere
radiusradius of the sphere

Definition at line 40 of file WROISphere.cpp.

References WGraphicsEngine::getGraphicsEngine(), WROI::m_dirty, WROI::m_pickHandler, m_viewer, redrawSphere(), registerRedrawRequest(), and updateGFX().

+ Here is the call graph for this function:

◆ ~WROISphere()

WROISphere::~WROISphere ( )
virtual

standard destructor

Definition at line 90 of file WROISphere.cpp.

Member Function Documentation

◆ getPosition()

WPosition WROISphere::getPosition ( ) const

getter

Returns
position

Definition at line 98 of file WROISphere.cpp.

References m_position.

◆ moveSphere()

void WROISphere::moveSphere ( WVector3d  offset)

move the sphere with a given offset

Parameters
offsetthe distance to move

Definition at line 209 of file WROISphere.cpp.

References m_lockOnVector, m_lockPoint, m_lockVector, m_lockX, m_lockY, m_lockZ, and m_position.

Referenced by updateGFX().

+ Here is the caller graph for this function:

◆ redrawSphere()

void WROISphere::redrawSphere ( )

removes the old drawable from the osg geode and adds a new one at the current position and size

Definition at line 74 of file WROISphere.cpp.

References m_color, m_position, m_radius, and sphereId.

Referenced by setColor(), updateGFX(), and WROISphere().

+ Here is the caller graph for this function:

◆ registerRedrawRequest()

void WROISphere::registerRedrawRequest ( WPickInfo  pickInfo)
private

note that there was a pick

Parameters
pickInfoinfo from pick

Definition at line 142 of file WROISphere.cpp.

References m_pickInfo.

Referenced by WROISphere().

+ Here is the caller graph for this function:

◆ setColor()

void WROISphere::setColor ( osg::Vec4  color)

Setter for standard color.

Parameters
colorThe new color.

Definition at line 257 of file WROISphere.cpp.

References m_color, and redrawSphere().

+ Here is the call graph for this function:

◆ setLockOnVector()

void WROISphere::setLockOnVector ( bool  value = true)

setter

Parameters
valueif the the movement of the sphere is restricted to a given vector

Definition at line 274 of file WROISphere.cpp.

References m_lockOnVector.

◆ setLockVector()

void WROISphere::setLockVector ( WVector3d  vector)

setter

Parameters
vectortogether witht he current position this sets line in space to which the movement of the sphere is restricted

Definition at line 268 of file WROISphere.cpp.

References m_lockPoint, m_lockVector, and m_position.

◆ setLockX()

void WROISphere::setLockX ( bool  value = true)

sets the flag that allows or disallows movement along the x axis

Parameters
valuethe flag

Definition at line 238 of file WROISphere.cpp.

References m_lockPoint, m_lockX, and m_position.

◆ setLockY()

void WROISphere::setLockY ( bool  value = true)

sets the flag that allows or disallows movement along the y axis

Parameters
valuethe flag

Definition at line 244 of file WROISphere.cpp.

References m_lockPoint, m_lockY, and m_position.

◆ setLockZ()

void WROISphere::setLockZ ( bool  value = true)

sets the flag that allows or disallows movement along the z axis

Parameters
valuethe flag

Definition at line 250 of file WROISphere.cpp.

References m_lockPoint, m_lockZ, and m_position.

◆ setNotColor()

void WROISphere::setNotColor ( osg::Vec4  color)

Setter for color in negated state.

Parameters
colorThe new color.

Definition at line 263 of file WROISphere.cpp.

References m_notColor.

◆ setPosition() [1/2]

void WROISphere::setPosition ( float  x,
float  y,
float  z 
)

setter

Parameters
x
y
z

Definition at line 111 of file WROISphere.cpp.

References WROI::m_dirty, m_lockPoint, m_originalPosition, and m_position.

◆ setPosition() [2/2]

void WROISphere::setPosition ( WPosition  position)

setter

Parameters
position

Definition at line 103 of file WROISphere.cpp.

References WROI::m_dirty, m_lockPoint, m_originalPosition, and m_position.

◆ setX()

void WROISphere::setX ( float  x)

setter

Parameters
xsets the x component of the position of this sphere

Definition at line 120 of file WROISphere.cpp.

References WROI::m_dirty, m_originalPosition, and m_position.

◆ setY()

void WROISphere::setY ( float  y)

setter

Parameters
ysets the y component of the position of this sphere

Definition at line 127 of file WROISphere.cpp.

References WROI::m_dirty, m_originalPosition, and m_position.

◆ setZ()

void WROISphere::setZ ( float  z)

setter

Parameters
zsets the z component of the position of this sphere

Definition at line 134 of file WROISphere.cpp.

References WROI::m_dirty, m_originalPosition, and m_position.

◆ updateGFX()

void WROISphere::updateGFX ( )
privatevirtual

Member Data Documentation

◆ m_color

osg::Vec4 WROISphere::m_color
private

the color of the box

Definition at line 177 of file WROISphere.h.

Referenced by redrawSphere(), and setColor().

◆ m_isPicked

bool WROISphere::m_isPicked
private

Indicates whether the box is currently picked or not.

Definition at line 165 of file WROISphere.h.

Referenced by updateGFX().

◆ m_lockOnVector

bool WROISphere::m_lockOnVector
private

flag indicatin wether the movement of the sphere is restricted

Definition at line 185 of file WROISphere.h.

Referenced by moveSphere(), and setLockOnVector().

◆ m_lockPoint

WVector3d WROISphere::m_lockPoint
private

stores to point of origin of the lock vector

Definition at line 181 of file WROISphere.h.

Referenced by moveSphere(), setLockVector(), setLockX(), setLockY(), setLockZ(), and setPosition().

◆ m_lockVector

WVector3d WROISphere::m_lockVector
private

stores the lock vector

Definition at line 183 of file WROISphere.h.

Referenced by moveSphere(), and setLockVector().

◆ m_lockX

bool WROISphere::m_lockX
private

flag indicatin wether the movement of the sphere is restricted

Definition at line 187 of file WROISphere.h.

Referenced by moveSphere(), and setLockX().

◆ m_lockY

bool WROISphere::m_lockY
private

flag indicatin wether the movement of the sphere is restricted

Definition at line 188 of file WROISphere.h.

Referenced by moveSphere(), and setLockY().

◆ m_lockZ

bool WROISphere::m_lockZ
private

flag indicatin wether the movement of the sphere is restricted

Definition at line 189 of file WROISphere.h.

Referenced by moveSphere(), and setLockZ().

◆ m_notColor

osg::Vec4 WROISphere::m_notColor
private

the color of the box when negated

Definition at line 179 of file WROISphere.h.

Referenced by setNotColor().

◆ m_oldPixelPosition

WVector2d WROISphere::m_oldPixelPosition
private

Caches the old picked position to a allow for cmoparison.

Definition at line 171 of file WROISphere.h.

Referenced by updateGFX().

◆ m_originalPosition

WPosition WROISphere::m_originalPosition
private

The position of the sphere when created, used for locking.

Definition at line 161 of file WROISphere.h.

Referenced by setPosition(), setX(), setY(), and setZ().

◆ m_pickedPosition

WPosition WROISphere::m_pickedPosition
private

Caches the old picked position to a allow for comparison.

Definition at line 167 of file WROISphere.h.

◆ m_pickInfo

WPickInfo WROISphere::m_pickInfo
private

Stores the pick information for potential redraw.

Definition at line 173 of file WROISphere.h.

Referenced by registerRedrawRequest(), and updateGFX().

◆ m_pickNormal

WVector3d WROISphere::m_pickNormal
private

Store the normal that occured when the pick action was started.

Definition at line 169 of file WROISphere.h.

Referenced by updateGFX().

◆ m_position

WPosition WROISphere::m_position
private

The position of the sphere.

Definition at line 159 of file WROISphere.h.

Referenced by getPosition(), moveSphere(), redrawSphere(), setLockVector(), setLockX(), setLockY(), setLockZ(), setPosition(), setX(), setY(), and setZ().

◆ m_radius

float WROISphere::m_radius
private

The radius of the sphere.

Definition at line 163 of file WROISphere.h.

Referenced by redrawSphere().

◆ m_viewer

std::shared_ptr< WGEViewer > WROISphere::m_viewer
private

makes viewer available all over this class.

Definition at line 175 of file WROISphere.h.

Referenced by updateGFX(), and WROISphere().

◆ maxSphereId

size_t WROISphere::maxSphereId = 0
staticprivate

Current maximum boxId over all spheres.

Definition at line 156 of file WROISphere.h.

◆ sphereId

size_t WROISphere::sphereId
private

Id of the current sphere.

Definition at line 157 of file WROISphere.h.

Referenced by redrawSphere(), and updateGFX().


The documentation for this class was generated from the following files: