MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoCSODistanceLineEditor.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
20
21#include "EndpointDecorator.h"
22
24
27{
28 SO_NODE_HEADER(SoCSODistanceLineEditor);
29
30public:
33
38
41
44
47
50
57
64
66 void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
68
70 static void initClass();
71
72 void cancel() override;
73
74 void createStartPressAt(const SoPointerPosition& pos) override;
75
77
79 void createDragMoveTo(const SoPointerPosition& pos) override;
80 bool createEndPress(int clickCount) override;
82 {}
83
85 void selectAndMoveDragMoveTo(const SoPointerPosition& pos) override;
86 SoPointingAction* selectAndMoveEndPress(int clickCount) override;
87
88protected:
89private:
90 void computeDeviceShadowOffset(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
92
93 void drawEndpointDecorations(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
95
96 unsigned short getStipplePattern(ml::CSO* cso, bool isAboveTopPlane, bool isAboveBottomPlane,
97 unsigned short overwriteStipplePattern);
98 void getColor(ml::CSO* cso, bool isAboveTopPlane, bool isAboveBottomPlane, bool isMouseOver, SbColor& color,
99 float& alpha);
100 float getLineWidth(ml::CSO* cso, bool isAboveTopPlane, bool isAboveBottomPlane, bool isMouseOver);
101
102 void createLineFixedLength();
103 ml::Vector3 getFixedEndPosition(const ml::Vector3& startPosition);
104
105 ml::Vector3 getInteractiveSeedPointPosition(const SoPointerPosition& pos, const SbVec3f& currentPosition);
106
107 ml::Vector3 snapDistanceLineToAngle(const SoPointerPosition& pos, const SbVec3f& currentPosition,
109
110 ml::Vector3 getPositionOfOtherSeedPoint(ml::CSOSeedPoint* seedPoint);
112
113 MLdouble toDegree(MLdouble radians)
114 {
115 return radians * 180.0 / ML_M_PI;
116 }
117 MLdouble toRadians(MLdouble degree)
118 {
119 return degree * ML_M_PI / 180.0;
120 }
121
122 int doubleModulo(MLdouble number, MLdouble divisor);
123
124 bool _wasCanceled;
125
126 SbVec3f _startPosition;
127 SoPointerPosition _startPointerPosition;
128};
129
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition SoCSOSystem.h:21
Base class for extensions that extend the editor with interaction and rendering for specific CSO type...
Extension for rendering, generating, and modifying a distance line CSO.
void selectAndMoveStartPressAt(const SoPointerPosition &pos) override
SoSFBool shouldRenderDecorationOnGhost
Should the decoration also be rendered on ghosts of CSOs?
void createStartPressAt(const SoPointerPosition &pos) override
void createNewCSO(const SoPointerPosition &pos)
SoSFInt32 endPositionDeviceOffsetY
The fixed length in y-direction of a single-click created line in pixel.
bool createEndPress(int clickCount) override
SoSFBool shouldUseShiftToToggleSnapAngle
Should SHIFT toggle snap angle/no snap angle?
void selectAndMoveDragMoveTo(const SoPointerPosition &pos) override
SoSFTypedEnum< DecorationLineStyleOverwriteModes > decorationOverwriteLineStyleAtEnd
SoSFInt32 decorationPixelSizeAtStart
The size of the decoration at the start of the distance line.
SoSFInt32 endPositionDeviceOffsetX
The fixed length in x-direction of a single-click created line in pixel.
SoSFBool createLineWithSingleClick
Shall a line with fixed length in pixel be created with a single click?
SoSFTypedEnum< DecorationLineStyleOverwriteModes > decorationOverwriteLineStyleAtStart
SoSFBool shouldSnapAngle
Should the line snap to an angle relative to the voxel grid?
SoCSODistanceLineEditor()
Standard constructor.
void pointerPositionIfAllowedAt(const SoPointerPosition &) override
Sets seed points while moving the mouse – but not while dragging.
static void initClass()
init class in inventor runtime
void cancel() override
Cancels an action like generating a CSO. Depends on concrete editor.
bool deleteSeedPoint(ml::CSO *cso, ml::CSOSeedPoint *seedPoint) override
Removes the given seed point from the given CSO and returns whether that was successful.
SoSFFloat snapAngle
The angle for snapping.
void draw(const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &drawSliceInfo, SoView2DCSOExtensibleEditor *editor) override
Drawing routine.
SoSFTypedEnum< DecorationTypes > decorationTypeAtEnd
The decoration to be rendered at the end of the distance line.
void createDragMoveTo(const SoPointerPosition &pos) override
SoPointingAction * selectAndMoveEndPress(int clickCount) override
SoSFTypedEnum< DecorationTypes > decorationTypeAtStart
The decoration to be rendered at the start of the distance line.
SoSFInt32 decorationPixelSizeAtEnd
The size of the decoration at the end of the distance line.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
The CSOSeedPoint can be interactively set and modified, and is the framework for contours.
The CSO represents a contour segmentation object.
Definition CSO.h:44
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double MLdouble
Definition mlTypeDefs.h:217
#define ML_M_PI
Pi as ML constant for backward compatibility.
Definition mlTypeDefs.h:376