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

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

#include <WROIBox.h>

+ Inheritance diagram for WROIBox:
+ Collaboration diagram for WROIBox:

Classes

class  ROIBoxNodeCallback
 Node callback to handle updates properly. More...
 

Public Member Functions

 WROIBox (WPosition minPos, WPosition maxPos)
 Yields box with desired extremal points minPos and maxPos. More...
 
WPosition getMinPos () const
 Get the corner of the box that has minimal x, y and z values. More...
 
WPosition getMaxPos () const
 Get the corner of the box that has maximal x, y and z values. More...
 
WPropPosition getMinPosProperty ()
 Get the corner of the box that has minimal x, y and z values. More...
 
WPropPosition getMaxPosProperty ()
 Get the corner of the box that has maximal x, y and z values. More...
 
void setColor (osg::Vec4 color)
 Setter for standard color. More...
 
void setNotColor (osg::Vec4 color)
 Setter for color in negated state. 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...
 
void boxPropertiesChanged (std::shared_ptr< WPropertyBase > property)
 Called when the specified property has changed. More...
 
void updateColor (osg::Vec4 color)
 Set new color of the box in the geometry. More...
 

Private Attributes

size_t boxId
 Id of the current box. More...
 
WPropGroup m_propGrp
 Group for box specific props. More...
 
WPropPosition m_minPos
 The minimum position of the box. More...
 
WPropPosition m_maxPos
 The maximum position of the box. More...
 
WGEShader::RefPtr m_lightShader
 Shader for proper lighting. More...
 
bool m_needVertexUpdate
 If true, the box' vertex data is updated. 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 cmoparison. 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...
 
int16_t m_oldScrollWheel
 caches scroll wheel value More...
 
std::shared_mutex m_updateLock
 Lock to prevent concurrent threads trying to update the osg node. More...
 
osg::ref_ptr< osg::Geometry > m_surfaceGeometry
 store this pointer for use in updates 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...
 

Static Private Attributes

static size_t maxBoxId = 0
 Current maximum boxId over all boxes. 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 box representing a region of interest.

Definition at line 48 of file WROIBox.h.

Constructor & Destructor Documentation

◆ WROIBox()

WROIBox::WROIBox ( WPosition  minPos,
WPosition  maxPos 
)

Yields box with desired extremal points minPos and maxPos.

Parameters
minPosLeft, lower, front corner. Minimal x, y and z coordinates.
maxPosRight, upper, back corner. Maximal x, y and z coordinates.

Definition at line 43 of file WROIBox.cpp.

References boxId, boxPropertiesChanged(), WGraphicsEngine::getGraphicsEngine(), m_lightShader, m_maxPos, m_minPos, m_needVertexUpdate, WROI::m_not, WROI::m_pickHandler, WROI::m_properties, m_propGrp, m_viewer, registerRedrawRequest(), and WROI::setDirty().

+ Here is the call graph for this function:

Member Function Documentation

◆ boxPropertiesChanged()

void WROIBox::boxPropertiesChanged ( std::shared_ptr< WPropertyBase property)
private

Called when the specified property has changed.

Used to update the ROI when modifying box properties.

Parameters
propertythe property

Definition at line 133 of file WROIBox.cpp.

References m_needVertexUpdate.

Referenced by WROIBox().

+ Here is the caller graph for this function:

◆ getMaxPos()

WPosition WROIBox::getMaxPos ( ) const

Get the corner of the box that has maximal x, y and z values.

Returns
the corner position

Definition at line 108 of file WROIBox.cpp.

References m_maxPos.

Referenced by updateGFX().

+ Here is the caller graph for this function:

◆ getMaxPosProperty()

WPropPosition WROIBox::getMaxPosProperty ( )

Get the corner of the box that has maximal x, y and z values.

Returns
the corner position

Definition at line 118 of file WROIBox.cpp.

References m_maxPos.

◆ getMinPos()

WPosition WROIBox::getMinPos ( ) const

Get the corner of the box that has minimal x, y and z values.

Returns
the corner position

Definition at line 103 of file WROIBox.cpp.

References m_minPos.

Referenced by updateGFX().

+ Here is the caller graph for this function:

◆ getMinPosProperty()

WPropPosition WROIBox::getMinPosProperty ( )

Get the corner of the box that has minimal x, y and z values.

Returns
the corner position

Definition at line 113 of file WROIBox.cpp.

References m_minPos.

◆ registerRedrawRequest()

void WROIBox::registerRedrawRequest ( WPickInfo  pickInfo)
private

note that there was a pick

Parameters
pickInfoinfo from pick

Definition at line 123 of file WROIBox.cpp.

References m_pickInfo, and m_updateLock.

Referenced by WROIBox().

+ Here is the caller graph for this function:

◆ setColor()

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

Setter for standard color.

Parameters
colorThe new color.

Definition at line 285 of file WROIBox.cpp.

References m_color.

◆ setNotColor()

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

Setter for color in negated state.

Parameters
colorThe new color.

Definition at line 290 of file WROIBox.cpp.

References m_notColor.

◆ updateColor()

void WROIBox::updateColor ( osg::Vec4  color)
private

Set new color of the box in the geometry.

Parameters
colorthe new color

Definition at line 295 of file WROIBox.cpp.

References m_surfaceGeometry.

Referenced by updateGFX().

+ Here is the caller graph for this function:

◆ updateGFX()

void WROIBox::updateGFX ( )
privatevirtual

Member Data Documentation

◆ boxId

size_t WROIBox::boxId
private

Id of the current box.

Definition at line 103 of file WROIBox.h.

Referenced by updateGFX(), and WROIBox().

◆ m_color

osg::Vec4 WROIBox::m_color
private

the color of the box

Definition at line 133 of file WROIBox.h.

Referenced by setColor(), and updateGFX().

◆ m_isPicked

bool WROIBox::m_isPicked
private

Indicates whether the box is currently picked or not.

Definition at line 121 of file WROIBox.h.

Referenced by updateGFX().

◆ m_lightShader

WGEShader::RefPtr WROIBox::m_lightShader
private

Shader for proper lighting.

Definition at line 115 of file WROIBox.h.

Referenced by WROIBox().

◆ m_maxPos

WPropPosition WROIBox::m_maxPos
private

The maximum position of the box.

Definition at line 110 of file WROIBox.h.

Referenced by getMaxPos(), getMaxPosProperty(), updateGFX(), and WROIBox().

◆ m_minPos

WPropPosition WROIBox::m_minPos
private

The minimum position of the box.

Definition at line 109 of file WROIBox.h.

Referenced by getMinPos(), getMinPosProperty(), updateGFX(), and WROIBox().

◆ m_needVertexUpdate

bool WROIBox::m_needVertexUpdate
private

If true, the box' vertex data is updated.

Definition at line 120 of file WROIBox.h.

Referenced by boxPropertiesChanged(), updateGFX(), and WROIBox().

◆ m_notColor

osg::Vec4 WROIBox::m_notColor
private

the color of the box when negated

Definition at line 135 of file WROIBox.h.

Referenced by setNotColor(), and updateGFX().

◆ m_oldPixelPosition

WVector2d WROIBox::m_oldPixelPosition
private

Caches the old picked position to a allow for cmoparison.

Definition at line 124 of file WROIBox.h.

Referenced by updateGFX().

◆ m_oldScrollWheel

int16_t WROIBox::m_oldScrollWheel
private

caches scroll wheel value

Definition at line 125 of file WROIBox.h.

Referenced by updateGFX().

◆ m_pickedPosition

WPosition WROIBox::m_pickedPosition
private

Caches the old picked position to a allow for cmoparison.

Definition at line 122 of file WROIBox.h.

◆ m_pickInfo

WPickInfo WROIBox::m_pickInfo
private

Stores the pick information for potential redraw.

Definition at line 129 of file WROIBox.h.

Referenced by registerRedrawRequest(), and updateGFX().

◆ m_pickNormal

WVector3d WROIBox::m_pickNormal
private

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

Definition at line 123 of file WROIBox.h.

Referenced by updateGFX().

◆ m_propGrp

WPropGroup WROIBox::m_propGrp
private

Group for box specific props.

Definition at line 108 of file WROIBox.h.

Referenced by WROIBox().

◆ m_surfaceGeometry

osg::ref_ptr< osg::Geometry > WROIBox::m_surfaceGeometry
private

store this pointer for use in updates

Definition at line 127 of file WROIBox.h.

Referenced by updateColor(), and updateGFX().

◆ m_updateLock

std::shared_mutex WROIBox::m_updateLock
private

Lock to prevent concurrent threads trying to update the osg node.

Definition at line 126 of file WROIBox.h.

Referenced by registerRedrawRequest(), and updateGFX().

◆ m_viewer

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

makes viewer available all over this class.

Definition at line 131 of file WROIBox.h.

Referenced by updateGFX(), and WROIBox().

◆ maxBoxId

size_t WROIBox::maxBoxId = 0
staticprivate

Current maximum boxId over all boxes.

Definition at line 102 of file WROIBox.h.


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