MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoCSOModifyEditor.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2013, 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
22
25{
26 SO_NODE_HEADER(SoCSOModifyEditor);
27
28public:
31
47
49
51 static void initClass();
52
53 void createStartPressAt(const SoPointerPosition& pos) override;
54 void createDragMoveTo(const SoPointerPosition& pos) override;
55 bool createEndPress(int clickCount) override;
57 {}
58
59 bool isCreationAllowed() const override;
60 bool isModificationEditor() const override
61 {
62 return true;
63 }
64
66 // This editor does not actually create CSOs but otherwise the mouse events would not reach this.
67 bool canCreateCSOs() const override
68 {
69 return true;
70 }
72 bool shouldRenderSpecific(ml::CSO*) const override
73 {
74 return false;
75 }
77 bool shouldRenderGeneral(ml::CSO*) const override
78 {
79 return false;
80 }
81
82 // just overload the methods below because they are purely virtual but not used in here
84 {}
86 {}
88 {
89 return nullptr;
90 }
91
92 int cursorShape() const override
93 {
94 return defaultCursor.getValue();
95 }
96
101 float&) override
102 {
103 return false;
104 }
105
106 void cancel() override;
107
108protected:
109 void initMembers() override;
110
111
112private:
114 ml::CSO* getModifyCandidate();
116 bool isEligibleForModification(ml::CSO* cso);
119 void fillPreCandidatesList(std::vector<ml::CSO*>& candidates);
122 void fillCandidatesOnSameSlice(const std::vector<ml::CSO*>& candidates, std::vector<ml::CSO*>& candidatesOnSameSlice);
125 void fillCandidatesCrossedVoxelBoundingBox(const std::vector<ml::CSO*>& candidatesOnSameSlice,
126 std::vector<ml::CSO*>& candidatesCrossedBoundingBox);
129 void fillCandidatesPointInsideTrailBoundingBox(const std::vector<ml::CSO*>& candidatesCrossedBoundingBox,
130 std::vector<ml::CSO*>& candidatesPointInsideTrailBoundingBox);
133 void fillCandidatesCrossedByTrail(const std::vector<ml::CSO*>& candidatesPointInsideTrailBoundingBox,
134 std::vector<ml::CSO*>& candidatesCrossingTrail);
135
137 void modifyCandidate(ml::CSO* candidate);
138
140 void reverseOrder(std::vector<ml::Vector3>& positions);
141
144 void fillUpTrail(const std::vector<ml::Vector3>& inputPositions, std::vector<ml::Vector3>& filledOutputPositions);
145
146 void setupGLForTrail();
147 void setBackGLForTrail();
148
151 void floorCeilCSOBoundingBox(ml::CSOBoundingBox& boundingBox);
152
154 bool _isUNIONModification;
155
156 CSOTrailRenderer _trailRenderer;
157
158 std::string viewerName;
159
160 std::map<ml::CSO*, std::vector<ml::Vector3>> _csoPathPointsVoxelSpace;
161
163 bool contains(const std::vector<ml::CSO*>& csoVector, ml::CSO* cso) const;
164
165 bool _wasCanceled;
166
167 ml::Matrix4 _worldToVoxelMatrix;
168};
169
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition SoCSOSystem.h:21
Base class for an editor extension for the SoView2DCSOExtensibleEditor.
Extension for modifying an existing CSO.
bool shouldRenderSpecific(ml::CSO *) const override
Does not render specific CSOs but only its own temporary trail.
bool isModificationEditor() const override
Returns whether the editor is a modification editor.
void selectAndMoveStartPressAt(const SoPointerPosition &) override
SoSFBool shouldCheckCSOForSelfIntersection
If checked, the module tests a candidate CSO whether it is self-intersection before attempting to mod...
static void initClass()
init class in inventor runtime
SoCSOModifyEditor()
Standard constructor.
SoSFTrigger notifyTrailIsSelfIntersecting
Button is triggered from the inside if the modification trail is intersecting itself.
void drawAdditionalGeometry(const CSODrawView2DInfos &view2DInfos, SoView2DCSOExtensibleEditor *editor) override
Routine for drawing additional geometry of the extension.
void createStartPressAt(const SoPointerPosition &pos) override
SoPointingAction * selectAndMoveEndPress(int) override
bool createEndPress(int clickCount) override
void createDragMoveTo(const SoPointerPosition &pos) override
void selectAndMoveDragMoveTo(const SoPointerPosition &) override
bool shouldRenderGeneral(ml::CSO *) const override
Returns true so we can use the general render code.
void cancel() override
Cancels an action like generating a CSO. Depends on concrete editor.
SoSFTrigger notifyRejectModification
Button is triggered from the inside if the modification has been rejected because it would have cause...
void initMembers() override
SoSFColor selfIntersectionColor
Color for the trail in case it intersects itself.
bool evaluateHitPoint(const ml::Vector3 &, View2DSliceList *, ml::CSOList *, const ml::CSOBoundingBox &, SoView2DCSOExtensibleEditor *, ml::CSO *&, ml::CSOSeedPoint *&, ml::CSOPathPoints *&, float &) override
a modification interaction can start anywhere, so overload this and always return 'false'.
int cursorShape() const override
Returns the cursor shape that indicates the next creation.
bool isCreationAllowed() const override
Returns whether the editor is allowed to create a new CSO.
SoSFBool shouldSetModifiedCSOSelected
If checked, the modified CSO gets selected, otherwise the selection remains unchanged.
bool canCreateCSOs() const override
Returns whether the editor can create a CSO.
void pointerPositionIfAllowedAt(const SoPointerPosition &) override
Sets seed points while moving the mouse – but not while dragging.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
a list that holds all View2DSlice objects (lazily created) of a SoView2D
The CSOBoundingBox defines an axis-parallel bounding box with double precision.
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 that are interpolated by a certain interpolation sch...
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.