MeVisLabToolboxReference
SoCSOEditorExtension Class Reference

Base class for an editor extension for the SoView2DCSOExtensibleEditor. More...

#include <SoCSOEditorExtension.h>

Inheritance diagram for SoCSOEditorExtension:
SoCSOCreatorEditorExtension SoCSODefaultRenderer SoCSOGeneralRendererEditorExtension SoCSOImageStatistics SoCSOLabelRenderer SoCSOModifyEditor SoCSOTransformEditor SoCSODistanceLineEditor SoCSOEllipseEditor SoCSOLineCreatorEditorExtension SoCSOPointEditor SoCSOCrossSectionRenderer SoCSOFillingRenderer SoCSODistancePolylineEditor SoCSOPolygonEditor SoCSOSplineEditor

List of all members.

Public Member Functions

void setExtensibleEditor (SoView2DCSOExtensibleEditor *extensibleEditor)
 Sets the pointer to the calling extensible editor.
virtual void startDrawing (View2DSliceList *)
 Is called before drawing.
virtual void draw (const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &sliceInfo, SoView2DCSOExtensibleEditor *editor)
 General drawing routine.
virtual void createStartPressAt (const SoPointerPosition &pos)=0
virtual void createDragMoveTo (const SoPointerPosition &pos)=0
virtual bool createEndPress (int clickCount)=0
virtual void selectAndMoveStartPressAt (const SoPointerPosition &pos)=0
virtual void selectAndMoveDragMoveTo (const SoPointerPosition &pos)=0
virtual SoPointingAction * selectAndMoveEndPress (int clickCount)=0
virtual void insertSeedPointStartPressAt (const SoPointerPosition &)
virtual void insertSeedPointDragMoveTo (const SoPointerPosition &)
virtual SoPointingAction * insertSeedPointEndPress (int)
virtual void pointerPosition (const SoPointerPosition &)
 Is called with the current pointer position on each mouse move.
virtual void pointerLeftWindow ()
 Is called when mouse pointer leaves the window.
virtual bool isCreationAllowed () const
 Returns whether the editor is allowed to create a new CSO.
virtual bool isModificationAllowed () const
 Returns whether the editor is allowed to modify an existing CSO.
virtual bool shouldRenderCSOs () const
 Returns whether the editor should render.
virtual bool canCreateCSOs () const
 Returns whether the editor can create a CSO.
SbString getCreatorExtensionId () const
void setActiveCSOList (ml::CSOList *hitCSOList)
void setSelectAndMoveInformation (ml::CSOList *hitCSOList, ml::CSO *hitCSO, ml::CSOSeedPoint *hitSeedPoint, ml::CSOPathPoints *hitPathPoints, float hitDistance)
void setCSOUnderMouse (ml::CSO *cso)
virtual SbString getSubType () const
 Returns the sub type string of the derived class.
virtual bool shouldRenderSpecific (ml::CSO *cso) const
 Returns whether a given CSO should be rendered by this specific extension.
virtual bool shouldRenderGeneral (ml::CSO *) const
 Returns whether a given CSO should be rendered by this general extension.
virtual bool isDefaultRenderer () const
 Returns whether the editor is the default editor.
virtual void resetCache ()
 Resets internal module caches, if there are any.
virtual void cancel ()
 Cancels an action like generation a CSO. Depends on concrete editor.
virtual int cursorShape () const
 Returns the cursor shape that indicates the next creation.
virtual bool deleteSeedPoint (ml::CSO *cso, ml::CSOSeedPoint *)
 Removes the given seed point from the given CSO and returns whether that was successful.
ml::CSOSeedPointgetPreviousSeedPoint (ml::CSOSeedPoint *seedPoint) const
 Returns the previous seed point of the given seed point for setting it as the next selected seed point.
virtual bool evaluateHitPoint (const ml::Vector3 &worldPosition, View2DSliceList *slicelist, ml::CSOList *csoList, const ml::CSOBoundingBox &slabBB, SoView2DCSOExtensibleEditor *editor, ml::CSO *&localHitCSO, ml::CSOSeedPoint *&localHitSeedPoint, ml::CSOPathPoints *&localHitPathPoints, float &distance)
 Returns whether the given world position is within the selection distance set in the editor and fills the selection distance.

Static Public Member Functions

static void initClass ()
 init class in inventor runtime

Public Attributes

SoSFString extensionId
 ID for a editor, needs to be unique per editor extension instance.
SoSFBool allowCreation
 Shall the editor allow creation?
SoSFBool allowModification
 Shall the editor allow modification of CSOs of its type?
SoSFBool allowSeedPointInteraction
 Should the interaction with seed points be allowed?
SoSFBool shouldRender
 Shall the editor render its CSOs?
SoSFMLBase inVisualizationSettings
 Optionally attached visualization settings, overrides the vis.

Protected Member Functions

 SoCSOEditorExtension ()
 Hidden constructor.
 ~SoCSOEditorExtension ()
 Hidden destructor.
void sendCSONotificationRepaint ()
 Sends a CSO notification to repaint the CSOList.
void sendCSONotificationMove ()
 Sends a CSO notification on moving a CSO or seed point.
void sendCSONotificationFinishInteraction ()
 Sends a CSO notification on finishing an interaction with a CSO.
void sendCSONotificationResetInteractionState ()
 Sends a CSO notification on having the interaction state being reset.
void sendCSONotificationInsertSeedPoint ()
 Sends a CSO notification on inserting a seed point.
void sendCSONotificationNewCSOStarted ()
 Sends a CSO notification on having started to create a new CSO.
void setExtensionIdAsSubType ()
 Sets the subtype member to the value of the extension id string.
virtual void setCreationData (const SoPointerPosition &pos, ml::CSO *newCSO)
 Sets creation data to a newly created CSO.
ml::CSOVisualizationSettingsgetVisualizationSettings ()
 Returns a pointer to the visual settings that are either the default ones or the ones set to the extensible editor (if present).
void drawPathPoints (const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &drawSliceInfo, const SbVec2f &shadowOffsetDevice, SoView2DCSOExtensibleEditor *editor)
 Draws the CSO by drawing lines between the path points. Renders different types of CSOs.
void renderPathPoints (const CSOPathPointsRenderSettings &renderSettings, const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const std::vector< CSOSliceCrossing > &pathPointsLists)
 Draws path points with given render settings.
void drawPathAndCrossingPoints (const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const SbVec2f &shadowOffsetDevice, const std::vector< CSOSliceCrossing > &pathAndCrossingPoints)
 Draws the path and crossing points.
void drawSeedPoints (const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &drawSliceInfo, SoView2DCSOExtensibleEditor *editor)
 Draw the CSO's seed points.
void drawFixedSizeCircleAt (float deviceX, float deviceY)
 Renders a fixed size circle at the given position.
void glVertex2fForVector3 (const CSODrawView2DInfos &view2DInfos, const ml::Vector3 &position, const SbVec2f &deviceOffset)
 Calls glVertex2f in device space for a given position. Adds an (optional) x/y offset to device position.
void mapWorldToDeviceViaVoxel (const CSODrawView2DInfos &view2DInfos, const ml::Vector3 &position, float &deviceX, float &deviceY)
 Maps the given world position to device coordinates via voxel coordinate; z in voxel space is set to current slice.
ml::Vector3 getTransformedPosition (const CSODrawView2DInfos &view2DInfos, const ml::Vector3 &position)
 If a SoCSOTransform exists, this method returns the transformed position.
void mapWorldToDevice (const SoPointerPosition &pos, const ml::Vector3 &worldPosition, float &deviceX, float &deviceY)
 Returns device coordinates for a given world position.
ml::Vector3 mapDeviceToWorld (const SoPointerPosition &pos, float deviceX, float deviceY)
 Returns world coordinates for given device position.
ml::Vector3 mapWorldToVoxel (const SoPointerPosition &pos, const ml::Vector3 &worldPosition)
 Returns a voxel position for a given world position.
ml::Vector3 mapVoxelToWorld (const SoPointerPosition &pos, const ml::Vector3 &voxelPosition)
 Returns a world position for a given voxel position.
SbVec2f nonShadowOffset () const
 Returns the default offset for non-shadows in pixels.
SbVec2f shadowOffset () const
 Returns the default offset for shadows in pixels.
void setupGLForCSO (const CSODrawCSOInfos &csoInfos)
 Sets up GL state for color, line width, and point size.
void setupGLAntiAlias ()
 Sets up GL state (for using anti-aliasing).
void restoreGLAntiAlias ()
 Restores GL state (for using anti-aliasing).
void setupGLShadow (float generalAlpha=1.0f)
 Sets up the GL state for shadow rendering (color and line width).
void glSetAlpha (float alpha)
 Sets an alpha value but retains the set color.
float getDepthAlpha (int maxSliceDistance, int currentSliceDistance) const
 Returns an alpha factor based on the max distance and the current distance.

Static Protected Member Functions

static void extensionIdCB (void *data, SoDataSensor *)

Protected Attributes

SoView2DCSOExtensibleEditor_editor
ml::CSOList_hitCSOList
 Pointer to internal/interactive states.
ml::CSO_hitCSO
ml::CSOSeedPoint_hitSeedPoint
ml::CSOPathPoints_hitPathPoints
float _hitDistance
ml::CSO_csoUnderMouse
SoFieldSensor * _extensionIdSensor
ml::CSOVisualizationSettings _visualizationSettings
 Default visual settings. Access them via the method getVisualSettings().
SbString _subType
 Member for subtype of generated CSOs.

Detailed Description

Base class for an editor extension for the SoView2DCSOExtensibleEditor.

An editor extension can render and generate/modify only specific types of CSOs.

Definition at line 34 of file SoCSOEditorExtension.h.


Constructor & Destructor Documentation

SoCSOEditorExtension::SoCSOEditorExtension ( ) [protected]

Hidden constructor.

SoCSOEditorExtension::~SoCSOEditorExtension ( ) [protected]

Hidden destructor.


Member Function Documentation

virtual void SoCSOEditorExtension::cancel ( ) [inline, virtual]

Cancels an action like generation a CSO. Depends on concrete editor.

Reimplemented in SoCSODistancePolylineEditor, SoCSOPolygonEditor, and SoCSOSplineEditor.

Definition at line 105 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::canCreateCSOs ( ) const [inline, virtual]

Returns whether the editor can create a CSO.

Reimplemented in SoCSOModifyEditor, and SoCSOCreatorEditorExtension.

Definition at line 83 of file SoCSOEditorExtension.h.

virtual int SoCSOEditorExtension::cursorShape ( ) const [inline, virtual]
virtual bool SoCSOEditorExtension::deleteSeedPoint ( ml::CSO cso,
ml::CSOSeedPoint  
) [virtual]

Removes the given seed point from the given CSO and returns whether that was successful.

Reimplemented in SoCSODistancePolylineEditor, SoCSOPolygonEditor, and SoCSOSplineEditor.

virtual void SoCSOEditorExtension::draw ( const CSODrawCSOInfos csoInfos,
const CSODrawView2DInfos view2DInfos,
const CSODrawSliceInformation sliceInfo,
SoView2DCSOExtensibleEditor editor 
) [virtual]
void SoCSOEditorExtension::drawFixedSizeCircleAt ( float  deviceX,
float  deviceY 
) [protected]

Renders a fixed size circle at the given position.

void SoCSOEditorExtension::drawPathAndCrossingPoints ( const CSODrawCSOInfos csoInfos,
const CSODrawView2DInfos view2DInfos,
const SbVec2f &  shadowOffsetDevice,
const std::vector< CSOSliceCrossing > &  pathAndCrossingPoints 
) [protected]

Draws the path and crossing points.

void SoCSOEditorExtension::drawPathPoints ( const CSODrawCSOInfos csoInfos,
const CSODrawView2DInfos view2DInfos,
const CSODrawSliceInformation drawSliceInfo,
const SbVec2f &  shadowOffsetDevice,
SoView2DCSOExtensibleEditor editor 
) [protected]

Draws the CSO by drawing lines between the path points. Renders different types of CSOs.

void SoCSOEditorExtension::drawSeedPoints ( const CSODrawCSOInfos csoInfos,
const CSODrawView2DInfos view2DInfos,
const CSODrawSliceInformation drawSliceInfo,
SoView2DCSOExtensibleEditor editor 
) [protected]

Draw the CSO's seed points.

virtual bool SoCSOEditorExtension::evaluateHitPoint ( const ml::Vector3 worldPosition,
View2DSliceList slicelist,
ml::CSOList csoList,
const ml::CSOBoundingBox slabBB,
SoView2DCSOExtensibleEditor editor,
ml::CSO *&  localHitCSO,
ml::CSOSeedPoint *&  localHitSeedPoint,
ml::CSOPathPoints *&  localHitPathPoints,
float &  distance 
) [virtual]

Returns whether the given world position is within the selection distance set in the editor and fills the selection distance.

Reimplemented in SoCSOModifyEditor, and SoCSOTransformEditor.

static void SoCSOEditorExtension::extensionIdCB ( void *  data,
SoDataSensor *   
) [static, protected]
SbString SoCSOEditorExtension::getCreatorExtensionId ( ) const [inline]

Definition at line 85 of file SoCSOEditorExtension.h.

float SoCSOEditorExtension::getDepthAlpha ( int  maxSliceDistance,
int  currentSliceDistance 
) const [protected]

Returns an alpha factor based on the max distance and the current distance.

ml::CSOSeedPoint* SoCSOEditorExtension::getPreviousSeedPoint ( ml::CSOSeedPoint seedPoint) const

Returns the previous seed point of the given seed point for setting it as the next selected seed point.

virtual SbString SoCSOEditorExtension::getSubType ( ) const [inline, virtual]

Returns the sub type string of the derived class.

Definition at line 92 of file SoCSOEditorExtension.h.

ml::Vector3 SoCSOEditorExtension::getTransformedPosition ( const CSODrawView2DInfos view2DInfos,
const ml::Vector3 position 
) [protected]

If a SoCSOTransform exists, this method returns the transformed position.

Returns the identity of the position otherwise.

ml::CSOVisualizationSettings* SoCSOEditorExtension::getVisualizationSettings ( ) [protected]

Returns a pointer to the visual settings that are either the default ones or the ones set to the extensible editor (if present).

void SoCSOEditorExtension::glSetAlpha ( float  alpha) [protected]

Sets an alpha value but retains the set color.

void SoCSOEditorExtension::glVertex2fForVector3 ( const CSODrawView2DInfos view2DInfos,
const ml::Vector3 position,
const SbVec2f &  deviceOffset 
) [protected]

Calls glVertex2f in device space for a given position. Adds an (optional) x/y offset to device position.

virtual void SoCSOEditorExtension::insertSeedPointDragMoveTo ( const SoPointerPosition &  ) [inline, virtual]

Reimplemented in SoCSODistancePolylineEditor, SoCSOPolygonEditor, and SoCSOSplineEditor.

Definition at line 68 of file SoCSOEditorExtension.h.

virtual SoPointingAction* SoCSOEditorExtension::insertSeedPointEndPress ( int  ) [inline, virtual]

Reimplemented in SoCSODistancePolylineEditor, SoCSOPolygonEditor, and SoCSOSplineEditor.

Definition at line 69 of file SoCSOEditorExtension.h.

virtual void SoCSOEditorExtension::insertSeedPointStartPressAt ( const SoPointerPosition &  ) [inline, virtual]

Reimplemented in SoCSODistancePolylineEditor, SoCSOPolygonEditor, and SoCSOSplineEditor.

Definition at line 67 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::isCreationAllowed ( ) const [inline, virtual]

Returns whether the editor is allowed to create a new CSO.

Reimplemented in SoCSOModifyEditor.

Definition at line 77 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::isDefaultRenderer ( ) const [inline, virtual]

Returns whether the editor is the default editor.

Reimplemented in SoCSODefaultRenderer.

Definition at line 99 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::isModificationAllowed ( ) const [inline, virtual]

Returns whether the editor is allowed to modify an existing CSO.

Definition at line 79 of file SoCSOEditorExtension.h.

ml::Vector3 SoCSOEditorExtension::mapDeviceToWorld ( const SoPointerPosition &  pos,
float  deviceX,
float  deviceY 
) [protected]

Returns world coordinates for given device position.

ml::Vector3 SoCSOEditorExtension::mapVoxelToWorld ( const SoPointerPosition &  pos,
const ml::Vector3 voxelPosition 
) [protected]

Returns a world position for a given voxel position.

void SoCSOEditorExtension::mapWorldToDevice ( const SoPointerPosition &  pos,
const ml::Vector3 worldPosition,
float &  deviceX,
float &  deviceY 
) [protected]

Returns device coordinates for a given world position.

void SoCSOEditorExtension::mapWorldToDeviceViaVoxel ( const CSODrawView2DInfos view2DInfos,
const ml::Vector3 position,
float &  deviceX,
float &  deviceY 
) [protected]

Maps the given world position to device coordinates via voxel coordinate; z in voxel space is set to current slice.

This method transforms the given position if view2DInfos contains a SoCSOTransform.

ml::Vector3 SoCSOEditorExtension::mapWorldToVoxel ( const SoPointerPosition &  pos,
const ml::Vector3 worldPosition 
) [protected]

Returns a voxel position for a given world position.

SbVec2f SoCSOEditorExtension::nonShadowOffset ( ) const [inline, protected]

Returns the default offset for non-shadows in pixels.

Definition at line 219 of file SoCSOEditorExtension.h.

virtual void SoCSOEditorExtension::pointerLeftWindow ( ) [inline, virtual]

Is called when mouse pointer leaves the window.

Definition at line 74 of file SoCSOEditorExtension.h.

virtual void SoCSOEditorExtension::pointerPosition ( const SoPointerPosition &  ) [inline, virtual]

Is called with the current pointer position on each mouse move.

Reimplemented in SoCSODistancePolylineEditor, SoCSOPolygonEditor, and SoCSOSplineEditor.

Definition at line 72 of file SoCSOEditorExtension.h.

void SoCSOEditorExtension::renderPathPoints ( const CSOPathPointsRenderSettings renderSettings,
const CSODrawCSOInfos csoInfos,
const CSODrawView2DInfos view2DInfos,
const std::vector< CSOSliceCrossing > &  pathPointsLists 
) [protected]

Draws path points with given render settings.

virtual void SoCSOEditorExtension::resetCache ( ) [inline, virtual]

Resets internal module caches, if there are any.

Reimplemented in SoCSOLabelRenderer.

Definition at line 102 of file SoCSOEditorExtension.h.

void SoCSOEditorExtension::restoreGLAntiAlias ( ) [protected]

Restores GL state (for using anti-aliasing).

void SoCSOEditorExtension::sendCSONotificationFinishInteraction ( ) [protected]

Sends a CSO notification on finishing an interaction with a CSO.

void SoCSOEditorExtension::sendCSONotificationInsertSeedPoint ( ) [protected]

Sends a CSO notification on inserting a seed point.

void SoCSOEditorExtension::sendCSONotificationMove ( ) [protected]

Sends a CSO notification on moving a CSO or seed point.

void SoCSOEditorExtension::sendCSONotificationNewCSOStarted ( ) [protected]

Sends a CSO notification on having started to create a new CSO.

void SoCSOEditorExtension::sendCSONotificationRepaint ( ) [protected]

Sends a CSO notification to repaint the CSOList.

void SoCSOEditorExtension::sendCSONotificationResetInteractionState ( ) [protected]

Sends a CSO notification on having the interaction state being reset.

void SoCSOEditorExtension::setActiveCSOList ( ml::CSOList hitCSOList)
virtual void SoCSOEditorExtension::setCreationData ( const SoPointerPosition &  pos,
ml::CSO newCSO 
) [protected, virtual]

Sets creation data to a newly created CSO.

Reimplemented in SoCSOCreatorEditorExtension.

void SoCSOEditorExtension::setCSOUnderMouse ( ml::CSO cso) [inline]

Definition at line 89 of file SoCSOEditorExtension.h.

void SoCSOEditorExtension::setExtensibleEditor ( SoView2DCSOExtensibleEditor extensibleEditor) [inline]

Sets the pointer to the calling extensible editor.

Definition at line 47 of file SoCSOEditorExtension.h.

void SoCSOEditorExtension::setExtensionIdAsSubType ( ) [inline, protected]

Sets the subtype member to the value of the extension id string.

The subtype member is stored in a created CSO and is used to identify the editor for a given CSO.

Definition at line 164 of file SoCSOEditorExtension.h.

void SoCSOEditorExtension::setSelectAndMoveInformation ( ml::CSOList hitCSOList,
ml::CSO hitCSO,
ml::CSOSeedPoint hitSeedPoint,
ml::CSOPathPoints hitPathPoints,
float  hitDistance 
)
void SoCSOEditorExtension::setupGLAntiAlias ( ) [protected]

Sets up GL state (for using anti-aliasing).

void SoCSOEditorExtension::setupGLForCSO ( const CSODrawCSOInfos csoInfos) [protected]

Sets up GL state for color, line width, and point size.

void SoCSOEditorExtension::setupGLShadow ( float  generalAlpha = 1.0f) [protected]

Sets up the GL state for shadow rendering (color and line width).

SbVec2f SoCSOEditorExtension::shadowOffset ( ) const [inline, protected]

Returns the default offset for shadows in pixels.

Definition at line 221 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::shouldRenderCSOs ( ) const [inline, virtual]

Returns whether the editor should render.

Definition at line 81 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::shouldRenderGeneral ( ml::CSO ) const [inline, virtual]

Returns whether a given CSO should be rendered by this general extension.

Overwrite this in general renderers.

Reimplemented in SoCSOCrossSectionRenderer, SoCSOFillingRenderer, SoCSOImageStatistics, SoCSOLabelRenderer, SoCSOModifyEditor, and SoCSOTransformEditor.

Definition at line 97 of file SoCSOEditorExtension.h.

virtual bool SoCSOEditorExtension::shouldRenderSpecific ( ml::CSO cso) const [virtual]

Returns whether a given CSO should be rendered by this specific extension.

Reimplemented in SoCSOModifyEditor, and SoCSOTransformEditor.

virtual void SoCSOEditorExtension::startDrawing ( View2DSliceList ) [inline, virtual]

Is called before drawing.

Reimplemented in SoCSOLabelRenderer.

Definition at line 50 of file SoCSOEditorExtension.h.


Member Data Documentation

Definition at line 146 of file SoCSOEditorExtension.h.

SoFieldSensor* SoCSOEditorExtension::_extensionIdSensor [protected]

Definition at line 169 of file SoCSOEditorExtension.h.

Definition at line 142 of file SoCSOEditorExtension.h.

Pointer to internal/interactive states.

Definition at line 141 of file SoCSOEditorExtension.h.

Definition at line 145 of file SoCSOEditorExtension.h.

SbString SoCSOEditorExtension::_subType [protected]

Member for subtype of generated CSOs.

This subtype is set to a created CSO and is also used to decide whether an editor should handle the interaction with a CSO. If an editor should handle the interaction for all subtypes of CSOs, set the subtype of an editor to an empty string.

Definition at line 183 of file SoCSOEditorExtension.h.

Default visual settings. Access them via the method getVisualSettings().

Definition at line 177 of file SoCSOEditorExtension.h.

Shall the editor allow creation?

Definition at line 117 of file SoCSOEditorExtension.h.

Shall the editor allow modification of CSOs of its type?

Definition at line 119 of file SoCSOEditorExtension.h.

Should the interaction with seed points be allowed?

Definition at line 121 of file SoCSOEditorExtension.h.

ID for a editor, needs to be unique per editor extension instance.

Definition at line 115 of file SoCSOEditorExtension.h.

Optionally attached visualization settings, overrides the vis.

settings from the extensible editor.

Definition at line 126 of file SoCSOEditorExtension.h.

Shall the editor render its CSOs?

Definition at line 123 of file SoCSOEditorExtension.h.


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