MeVisLab Toolbox Reference
CSOBulgeAction.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2012, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 
15 
16 #pragma once
17 
18 #include "CSOPointingAction.h"
19 
21 class SoCSOBulgeEditor;
22 
24 
26 {
27 public:
28 
30 
31  bool isSensitiveAt(const SoPointerPosition& pos) override;
32 
33  void startPressAt(const SoPointerPosition& pos) override;
34  void dragMoveTo(const SoPointerPosition& pos) override;
35  SoPointingAction* endPress(int clickCount) override;
36 
37  int getCurrentCursor(SoViewerProxy* ) const override;
38 
42 
43  void setMode(int mode) override;
44  int getNumModes() const override;
45 
46  bool isInViewportRegion(const SoPointerPosition& pos) const
47  {
48  const SbVec3f& pointerPos = pos.getView2DPosition()->getVoxelPosition();
49  const SbVec2f& viewportStart = pos.getView2DPosition()->getViewportOrigin();
50  const SbVec2f& viewportEnd = viewportStart + pos.getView2DPosition()->getViewportSize();
51 
52  return (pointerPos[0] >= viewportStart[0]) &&
53  (pointerPos[1] >= viewportStart[1]) &&
54  (pointerPos[0] <= viewportEnd[0]) &&
55  (pointerPos[1] <= viewportEnd[1]);
56  }
57 
58 protected:
59 
61 
63  bool isEligibleForBulging(ml::CSO* cso, View2DSliceList* slicelist, SoCSOBulgeEditor* bulgeEditor);
64 
69  unsigned int _hitPathPointIndex;
71  float _hitDistance;
72 
74  SbVec3f _sliceNormal;
75 
77 
79 };
80 
SbVec3f _initialPosition
void initializeMembers()
bool isInViewportRegion(const SoPointerPosition &pos) const
ml::CSOPathPoints * _hitPathPoints
unsigned int _hitPathPointIndex
SoCSOBulgeEditor * _hitEditor
void startPressAt(const SoPointerPosition &pos) override
Starts a drag at given device position.
ml::CSO * _hitCSO
void setInteractOnlyWithSelectedCSO(bool flag)
Sets this action to be active only for selected CSOs or for all CSOs.
ml::CSOSeedPoint * _hitSeedPoint
SbVec3f _sliceNormal
int getNumModes() const override
Returns the number of different modes this action has - modes can be changed during drag and handle d...
CSOBulgeAction(SoView2DCSOExtensibleEditor *editor)
SoPointingAction * endPress(int clickCount) override
Ends the drag at last device position.
bool _interactOnlyWithSelectedCSOs
bool isAllowedToDrag(const SoPointerPosition &pos)
void dragMoveTo(const SoPointerPosition &pos) override
Continues the drag to given device position.
bool isSensitiveAt(const SoPointerPosition &pos) override
Returns true if the gesture is startable at the given device position.
ml::CSOList * _hitCSOList
void setMode(int mode) override
This gets called if the mode was changed and before startPressAt is called.
bool isEligibleForBulging(ml::CSO *cso, View2DSliceList *slicelist, SoCSOBulgeEditor *bulgeEditor)
int getCurrentCursor(SoViewerProxy *) const override
Returns the cursor ID to display for this action, as defined in SoViewerProxy.h - this gets (at least...
Extension for bulging any type of CSO in an influence radius.
SoPointerPosition manages the current position of the mouse cursor.
const View2DPosition * getView2DPosition() const
SoPointingAction is the base class for any mouse based interaction.
This class gives access to state of a viewer during scene graph traversal.
Definition: SoViewerProxy.h:30
SbVec3f getVoxelPosition() const
Return voxel position of pointer.
SbVec2f getViewportOrigin() const
Return view port origin of current slice in voxel coordinates.
SbVec2f getViewportSize() const
Return view port size of current slice in voxel coordinates.
a list that holds all View2DSlice objects (lazily created) of a SoView2D
A CSOList comprises a number of CSOs and CSOGroups and is the central object for contour segmentation...
Definition: CSOList.h:61
The CSOPathPoints is a list of world coordinates which are interpolated by a certain interpolation sc...
Definition: CSOPathPoints.h:37
The CSOSeedPoint can be interactively set and modified and is the framework for contours.
Definition: CSOSeedPoint.h:35
The CSO represents a contour segmentation object.
Definition: CSO.h:44