MeVisLab Toolbox Reference
SoView2DLegend Class Reference

SoView2DLegend allows to draw legends on SoView2D. More...

#include <SoView2DLegend.h>

Inheritance diagram for SoView2DLegend:
SoView2DExtension SoInteractionProviderNode SoInteractionOwner SoInteractionProvider

Public Types

enum  LegendAlignPosition { LEGEND_TOP , LEGEND_BOTTOM , LEGEND_LEFT , LEGEND_RIGHT }
 enumeration for alignment More...
 
enum  LegendFormat { TEXT_LINE , LINE_TEXT }
 text/line format.. draw a line or the text first? More...
 
- Public Types inherited from SoView2DExtension
enum  Sign { ZERO , NEGATIVE , POSITIVE }
 defines the sign of a number, with zero as an extra value More...
 
- Public Types inherited from SoInteractionProvider
typedef SoInteractionProvider *(* GetProviderFunc) (SoNode *)
 

Public Member Functions

 SoView2DLegend ()
 
void toggleLegend ()
 
- Public Member Functions inherited from SoView2DExtension
 SoView2DExtension ()
 Constructor.
 
void init ()
 setup internal state
 
virtual void updateValues ()
 Update fields to local variables, may be reimplemented if you want to update additional local vars.
 
virtual void startDrawing (View2DSliceList *)
 
virtual void endDrawing (View2DSliceList *)
 
virtual void overwriteDrawingSettings (SoView2DDrawingSettings &)
 
View2DEventgetEvent ()
 get the current event (when inside of evalEvent)
 
float getSelectDist ()
 Set the distance tolerance on hit checking in pixels.
 
bool isPointInsideDeviceRect (float pointX, float pointY, float centerX, float centerY, float hitRectangleSize=0.0)
 returns whether the given point is inside a rectangle around the given center.
 
void drawMiniRect (float xp, float yp, float ext, float lineWidth=1.f)
 Draws a small rectangle with given half side length and a line width.
 
void drawDashedMiniRect (float xp, float yp, float ext, float lineWidth)
 
void drawFilledMiniRect (float xp, float yp, float ext, float lineWidth=1.f)
 Draws a small filled rectangle with given half side length.
 
void drawMiniTriangle (float xp, float yp, float ext, float lineWidth=1.f)
 Draws a small triangle with given center point, half height and line width.
 
void drawFilledMiniTriangle (float xp, float yp, float ext, float lineWidth=1.f)
 Draws a small filled triangle with given center point and half height.
 
void drawMiniCircle (float xp, float yp, float ext, float lineWidth=1.f)
 Draws a small circle with given center point and radius.
 
void drawFilledMiniCircle (float xp, float yp, float ext, float lineWidth=1.f)
 Draws a small filled circle with given center point and radius.
 
void drawFixedSizeMiniCircleAt (float xp, float yp)
 Draws a fixed size small circle at the given position.
 
void drawVoxelBorder (View2DSlice *slice, float vx, float vy, float vz)
 surround the given voxel with a border
 
int getX ()
 get the x device position of current event, only returns valid result when called inside of evalEvent()
 
int getY ()
 get the y device position of current event, only returns valid result when called inside of evalEvent()
 
virtual bool isDrawingOn ()
 check if drawing is on
 
virtual bool isEditingOn ()
 check if editing is on
 
virtual bool isFixZOn ()
 check if z should stay fixed
 
virtual bool isClipToSlice ()
 check if the image is clipped to slice
 
virtual void fieldChanged (SoSensor *sensor)
 handle if any field has changed
 
bool isCreateNewMode ()
 check if extension is in createNewMode
 
void setCreateNewMode (bool flag)
 set this extension to create new objects
 
bool isCreateNewModeRequest ()
 check if extension has a request for createNewMode
 
void setCreateNewModeRequest (bool flag)
 set that extension want to become createNewMode
 
virtual bool isActive ()
 returns if the extension is active (derive this method in child) (in createNewMode or with a selected object)(called by SoView2D)
 
virtual void deleteSelectedObject ()
 deletes the currently active object (derive this method in child) (called by SoView2D)
 
virtual void getStatusString (SbString &status)
 get the current status of this extension
 
virtual bool evaluateEvent (SoView2D *view2d, View2DEvent *ec)
 
virtual bool ignoreEvent (View2DEvent *ec)
 Return true if ec has been handled before and if ignoreHandledEvents is True.
 
bool wantsMouseOverUpdates () const
 public access to _wantsMouseOverUpdateEvents
 
virtual void consumeEvent (View2DEvent *ec, bool handled=TRUE)
 Set handled-flag of ec to true (= consumed) if handled is True and setEventHandled is True.
 
int getSelectedModifierMask ()
 Get compare and ignore mask for the currently selected button/modifier combination, usable with SoPointingAction.
 
int getSelectedIgnoreMask ()
 
SoPointingAction::Trigger getPointingActionTriggerFromFields ()
 Get the trigger that matches the button/modifier field state.
 
- Public Member Functions inherited from SoInteractionProviderNode
 SoInteractionProviderNode ()
 Default constructor.
 
 ~SoInteractionProviderNode () override
 Destructor.
 
std::string getID () const override
 Returns the id string for identifying the provider (and its actions) - this is usually the name of the scene node.
 
void objRef () override
 Memory management by reference counting; must be implemented in derived classes.
 
void objUnref () override
 
- Public Member Functions inherited from SoInteractionOwner
 SoInteractionOwner ()
 Default constructor.
 
 ~SoInteractionOwner () override
 The destructor will destroy all interactions created with this object as owner.
 
std::list< SoInteraction * > getInteractions (SoState *state) override
 Returns the list of all interactions of this provider.
 
void pointerPosition (SoState *state, const SoPointerPosition &pos) override
 Same as below, with additional SoState argument. Be defaults simply calls the below version.
 
void pointerLeftWindow (SoState *state) override
 Same as below, with additional SoState argument. Be defaults simply calls the below version.
 
void addListener (SoInteractionOwnerListenerInterface *listener)
 Add a listener object that is notified of changes in the interaction list.
 
void removeListener (SoInteractionOwnerListenerInterface *listener)
 Remove a listener object that was notified of changes in the interaction list.
 
- Public Member Functions inherited from SoInteractionProvider
 SoInteractionProvider ()
 Default constructor.
 
virtual ~SoInteractionProvider ()
 
template<class T >
std::list< T * > getInteractionsOfType (SoState *state)
 Returns list of interactions of a specific type:
 
virtual std::list< SoCommandAction * > getCommandActions (SoState *state)
 
virtual std::list< SoPointingAction * > getPointingActions (SoState *state)
 
virtual std::list< SoOffsetAction * > getOffsetActions (SoState *state)
 

Static Public Member Functions

static void initClass ()
 
- Static Public Member Functions inherited from SoView2DExtension
static void initClass ()
 Initializes this class.
 
static float snapToPixelCenter (float coordinateComponent)
 Snaps the coordinate component to the pixel center.
 
static void fieldChangedCB (void *data, SoSensor *sensor)
 inventor callbacks if any field has changed, calls fieldChanged
 
static bool isImageParallel (SoSFMLImage *image, View2DSliceList *dsl)
 Return true if image is parallel to the image of the slice list up to slice thickness.
 
static void enableLineStippling (const SoSFEnum &lineStyleField)
 Set/reset stippling pattern.
 
static void disableLineStippling (const SoSFEnum &lineStyleField)
 
static void getAxisOrientation (int axis, SbMatrix &matrix, char &negativeResult, char &positiveResult)
 Geometry helpers.
 
static float pointToLineDistance (SbVec3f point, SbVec3f line1, SbVec3f line2)
 calculate 3D point to line distance
 
static float pointToLineDistance (SbVec2f point, SbVec2f line1, SbVec2f line2)
 calculate 2D point to line distance
 
static Sign edgeIntersectWithPlane (const SbVec3f &v1, const SbVec3f &v2, const SbPlane &plane, SbVec3f &intersect)
 intersect given edge from v1 to v2 with given plane, returns sign and intersect point
 
- Static Public Member Functions inherited from SoInteractionProviderNode
static void initClass ()
 Initializes this class.
 
- Static Public Member Functions inherited from SoInteractionProvider
static void registerInteractionProviderNode (SoType type, GetProviderFunc func)
 Register a function to obtain a SoInteractionProvider from a SoNode.
 
static SoInteractionProvidergetInteractionProvider (SoNode *node)
 Get a SoInteractionProvider from a SoNode if registered, else NULL.
 

Public Attributes

SoSFString legendString
 the string to be parsed the format for one entry (item) is: $(item rr gg bb line_width line_stipple "text") 0 <= rr,gg,bb <= 255 0 <= line_width <= 16 0 <= line_stipple <= 65535 "text" should NOT contain closing brackets ')' all numbers can be either octal, decimal or hexadecimal
 
SoSFFloat margin
 the margin of the legend relative to the nearest border
 
SoSFBool showLegend
 show legend?
 
SoSFEnum legendFontSize
 set the font size (or set it to 'automatic')
 
SoSFEnum legendAlignment
 set the alignment
 
SoSFEnum legendFormat
 text <-> line
 
SoSFBool textShadow
 text shadow?
 
SoSFBool drawTheBox
 draw the box?
 
SoSFColor boxColor
 the color of the box
 
- Public Attributes inherited from SoView2DExtension
SoSFColor color
 color that should be used for drawing
 
SoSFBool drawingOn
 flag if the extension should draw, needs to be checked inside of the draw() method
 
SoSFBool editingOn
 flag if the extension should edit objects on mouse events, needs to be checked inside of the evalEvent() method
 
SoSFBool maskValid
 flag if the event mask is valid.
 
SoSFFloat selectionTolerance
 the selection tolerance in pixels
 
SoSFBool wantsAllEvents
 flag if ALL events should be passed to evalEvent(), if disabled, events are only passed to evalEvent when the mouse mask gets valid
 
SoSFBool wantsKeyEvents
 flag if keyboard events should be passed to evalEvent()
 
SoSFBool wantsMouseWheelEvents
 flag if MouseWheel events should be passed to evalEvent()
 
SoSFBool setEventHandled
 Set event handled if it is indeed handled by this extension.
 
SoSFBool ignoreHandledEvents
 Ignore events, that have been handled by previous extensions.
 
SoSFEnum button1
 mouse mask for button1
 
SoSFEnum button2
 mouse mask for button2
 
SoSFEnum button3
 mouse mask for button3
 
SoSFEnum shift
 shift modifier for mouse mask
 
SoSFEnum control
 shift control for mouse mask
 
SoSFEnum alt
 shift alt for mouse mask
 
SoSFBool needsValidVoxel
 sets if a valid voxel must be hit to get evalEvent() calls
 
SoSFBool renderOnSlab
 defines if the extension should be rendered on all slab slices
 
SoSFBool createNewMode
 flag if extension is in createNewMode
 
SoSFTrigger createNewModeRequest
 
SoSFBool clipToSlice
 Flag to clip drawing to slice.
 
SoSFEnum cursorShape
 Set cursor shape if the mouse mask fits and mouseEvents are effectively sent to evalEvent for editing.
 
SoSFBool fixZOn
 DEPRECATED flag that indicates that the extension should fix the z value, only used in SoView2DRectangle.
 
- Public Attributes inherited from SoInteractionProviderNode
SoSFString instanceName
 Defines interface field to store the instance name.
 
SoSFString interactionProviderID
 This field overrides the instanceName as providerID if specified.
 

Protected Member Functions

void draw (View2DSliceList *dsl, View2DSlice *dslice, int slice) override
 inherited draw method.. parses the string and draws the legend
 
bool evalEvent (SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
 Called by the SoView2D for each event that happens on the viewer.
 
virtual bool implementsManagedInteraction () const
 also implements managed interactions
 
bool implementsManagedInteractionAndClassicEventHandling () const override
 this node is a hybrid module providing managed interaction and classic event handling
 
void editingOnChanged (SoField *field) override
 called when editingOn field is touched:
 
- Protected Member Functions inherited from SoView2DExtension
virtual void buttonMaskChanged (SoField *)
 called when one of the button/modifier fields is touched:
 
virtual void createNewModeRequestTriggered (SoField *)
 called when createNewModeRequest field ist touched:
 
 ~SoView2DExtension () override
 destructor
 
void GLRender (SoGLRenderAction *action) override
 Inventor actions.
 
void callback (SoCallbackAction *action) override
 
void handleEvent (SoHandleEventAction *action) override
 
void getMatrix (SoGetMatrixAction *action) override
 
void getBoundingBox (SoGetBoundingBoxAction *action) override
 
void pick (SoPickAction *action) override
 
void doAction (SoAction *action) override
 
- Protected Member Functions inherited from SoInteractionOwner
virtual void pointerPosition (const SoPointerPosition &)
 Override this if you always need to be informed of the current mouse cursor position.
 
virtual void pointerLeftWindow ()
 This is called when the mouse cursor leaves the window.
 
bool hasInteractions () const
 Returns whether there are any actions defined by this owner.
 
template<class T >
bool hasInteractionsOfType () const
 Same as above, but asking for a specific type of interaction.
 
void addPointingAction (SoPointingAction *)
 
void addCommandAction (SoCommandAction *)
 
void addOffsetAction (SoOffsetAction *)
 

Additional Inherited Members

- Protected Attributes inherited from SoView2DExtension
SoNodeSensor_nodeSensor
 node sensor that is used to notice field changes
 
float _rgbColor [4]
 Color of the object, update on each field change by _nodeSensor.
 
bool _wantsMouseOverUpdateEvents
 set this flag to receive mouse over events while the extension is active
 

Detailed Description

SoView2DLegend allows to draw legends on SoView2D.

Definition at line 72 of file SoView2DLegend.h.

Member Enumeration Documentation

◆ LegendAlignPosition

enumeration for alignment

Enumerator
LEGEND_TOP 
LEGEND_BOTTOM 
LEGEND_LEFT 
LEGEND_RIGHT 

Definition at line 78 of file SoView2DLegend.h.

◆ LegendFormat

text/line format.. draw a line or the text first?

Enumerator
TEXT_LINE 
LINE_TEXT 

Definition at line 86 of file SoView2DLegend.h.

Constructor & Destructor Documentation

◆ SoView2DLegend()

SoView2DLegend::SoView2DLegend ( )

Member Function Documentation

◆ draw()

void SoView2DLegend::draw ( View2DSliceList * dsl,
View2DSlice * dslice,
int slice )
overrideprotectedvirtual

inherited draw method.. parses the string and draws the legend

Reimplemented from SoView2DExtension.

◆ editingOnChanged()

void SoView2DLegend::editingOnChanged ( SoField * field)
overrideprotectedvirtual

called when editingOn field is touched:

Reimplemented from SoView2DExtension.

◆ evalEvent()

bool SoView2DLegend::evalEvent ( SoView2D * view2d,
View2DSliceList * slicelist,
View2DEvent * ec,
View2DEventPhase phase )
overrideprotectedvirtual

Called by the SoView2D for each event that happens on the viewer.

Implement this method if you want to handle events. If this method is called depends on the fields wantsAllEvents, wantsKeyEvents, wantsMouseWheelEvents and the mouse mask given by button1, button2, button3, shift, control, alt. When using the mouse mask (when wantsAllEvents is set to false), the View2DEventPhase indicates in which phase of the mouse mask you are in.

Reimplemented from SoView2DExtension.

◆ implementsManagedInteraction()

virtual bool SoView2DLegend::implementsManagedInteraction ( ) const
inlineprotectedvirtual

also implements managed interactions

Definition at line 134 of file SoView2DLegend.h.

◆ implementsManagedInteractionAndClassicEventHandling()

bool SoView2DLegend::implementsManagedInteractionAndClassicEventHandling ( ) const
inlineoverrideprotectedvirtual

this node is a hybrid module providing managed interaction and classic event handling

Reimplemented from SoView2DExtension.

Definition at line 138 of file SoView2DLegend.h.

◆ initClass()

static void SoView2DLegend::initClass ( )
static

◆ toggleLegend()

void SoView2DLegend::toggleLegend ( )

Member Data Documentation

◆ boxColor

SoSFColor SoView2DLegend::boxColor

the color of the box

Definition at line 116 of file SoView2DLegend.h.

◆ drawTheBox

SoSFBool SoView2DLegend::drawTheBox

draw the box?

Definition at line 114 of file SoView2DLegend.h.

◆ legendAlignment

SoSFEnum SoView2DLegend::legendAlignment

set the alignment

Definition at line 108 of file SoView2DLegend.h.

◆ legendFontSize

SoSFEnum SoView2DLegend::legendFontSize

set the font size (or set it to 'automatic')

Definition at line 106 of file SoView2DLegend.h.

◆ legendFormat

SoSFEnum SoView2DLegend::legendFormat

text <-> line

Definition at line 110 of file SoView2DLegend.h.

◆ legendString

SoSFString SoView2DLegend::legendString

the string to be parsed the format for one entry (item) is: $(item rr gg bb line_width line_stipple "text") 0 <= rr,gg,bb <= 255 0 <= line_width <= 16 0 <= line_stipple <= 65535 "text" should NOT contain closing brackets ')' all numbers can be either octal, decimal or hexadecimal

Definition at line 99 of file SoView2DLegend.h.

◆ margin

SoSFFloat SoView2DLegend::margin

the margin of the legend relative to the nearest border

Definition at line 102 of file SoView2DLegend.h.

◆ showLegend

SoSFBool SoView2DLegend::showLegend

show legend?

Definition at line 104 of file SoView2DLegend.h.

◆ textShadow

SoSFBool SoView2DLegend::textShadow

text shadow?

Definition at line 112 of file SoView2DLegend.h.


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