MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
SoCSOBulgeEditor.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
21#include <ThirdPartyWarningsDisable.h>
22#include <boost/unordered_set.hpp>
23#include <ThirdPartyWarningsRestore.h>
24
26
29{
30 SO_NODE_HEADER(SoCSOBulgeEditor);
31
32public:
35
37 void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos,
39
41 static void initClass();
42
47
52
55
56 void setVisibleCSOs(const std::vector<CSODrawCSOInfos>& drawCSOInformation, const CSODrawView2DInfos& view2DInfos,
58
60 {}
61 void createDragMoveTo(const SoPointerPosition&) override
62 {}
63 bool createEndPress(int) override
64 {
65 return false;
66 }
68 {}
69
71 {}
73 {}
75 {
76 return nullptr;
77 }
78
79 void bulgeStartPressAt(const SoPointerPosition& pos) override;
80 void bulgeDragMoveTo(const SoPointerPosition& pos) override;
81 SoPointingAction* bulgeEndPress(int clickCount) override;
82
83 void pointerPosition(const SoPointerPosition&) override;
84
85 void cancel() override;
86 bool isModificationEditor() const override
87 {
88 return true;
89 }
90
91 bool shouldRenderSpecific(ml::CSO*) const override
92 {
93 return false;
94 }
95 bool shouldRenderGeneral(ml::CSO*) const override
96 {
97 return true;
98 }
99
100 bool isCSOWithIdVisible(int id);
101
102 void showInfluence(bool state);
104 unsigned int pathPointIndex, float distance);
105
106protected:
107 void initMembers() override;
108
109
110private:
111 struct PositionOnPath
112 {
113 PositionOnPath()
114 {
115 bulgeFactor = 0;
116 }
117 ml::Vector3 position;
118 float bulgeFactor;
119 };
120
121 void getDeviceCoordinates(View2DSliceList* slicelist, const ml::Vector3& position, float& deviceX, float& deviceY);
122 void getDeviceCoordinates(View2DSliceList* slicelist, const SbVec3f& position, float& deviceX, float& deviceY);
123
124 void fillPositionsOnPath(View2DSliceList* slicelist);
125 void fillPositionsOnPath(View2DSliceList* slicelist, std::vector<PositionOnPath>& positions, bool searchUpwards);
126
127 void draw(View2DSliceList* slicelist, const std::vector<PositionOnPath>& positions, float startX, float startY);
128
129 float getSquaredDistance(float x1, float y1, float x2, float y2) const;
130
131 void initializePositionsInteractive(const std::vector<PositionOnPath>& positionsInitial,
132 std::vector<PositionOnPath>& positionsInteractive);
133
134 void movePositions(const std::vector<PositionOnPath>& source, std::vector<PositionOnPath>& destination,
135 const SbVec3f& moveDelta);
136
137 void fillBulgedClosedCSO();
138 void fillBulgedOpenCSO();
139
140 std::vector<PositionOnPath> _positionsUpInitial;
141 std::vector<PositionOnPath> _positionsDownInitial;
142
143 std::vector<PositionOnPath> _positionsUpInteractive;
144 std::vector<PositionOnPath> _positionsDownInteractive;
145
146 ml::CSOPathPointIterator _endUpIter;
147 ml::CSOPathPointIterator _endDownIter;
148
149 unsigned int _hitPathPointIndex;
150 bool _shouldShowInfluence;
151 SbVec3f _startPosition;
152 bool _isBulging;
153 bool _wasCanceled;
154
155 boost::unordered_set<int> _visibleCSOIds;
156};
157
#define SOCSO_EXPORT
Header file for system independent resolution.
Definition SoCSOSystem.h:21
Extension for bulging any type of CSO in an influence radius.
void bulgeStartPressAt(const SoPointerPosition &pos) override
SoSFColor previewColor
The preview color.
SoPointingAction * bulgeEndPress(int clickCount) override
void bulgeDragMoveTo(const SoPointerPosition &pos) override
void selectAndMoveStartPressAt(const SoPointerPosition &) override
SoSFFloat previewWidth
The preview width.
void setVisibleCSOs(const std::vector< CSODrawCSOInfos > &drawCSOInformation, const CSODrawView2DInfos &view2DInfos, SoView2DCSOExtensibleEditor *editor) override
Sets visible CSOs that have been determined in the extensible editor.
bool shouldRenderGeneral(ml::CSO *) const override
Returns whether a given CSO should be rendered by this general extension.
void pointerPositionIfAllowedAt(const SoPointerPosition &) override
Sets seed points while moving the mouse – but not while dragging.
SoSFEnum interactionPossibleCursor
static void initClass()
init class in inventor runtime
void selectAndMoveDragMoveTo(const SoPointerPosition &) override
SoSFInt32 pathInfluenceLength
The influence along the path in pixel.
void setBulgeInformation(ml::CSOList *csoList, ml::CSO *cso, ml::CSOPathPoints *pathPoints, unsigned int pathPointIndex, float distance)
bool isCSOWithIdVisible(int id)
bool createEndPress(int) override
SoPointingAction * selectAndMoveEndPress(int) override
SoCSOBulgeEditor()
Standard constructor.
void draw(const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &drawSliceInfo, SoView2DCSOExtensibleEditor *editor) override
Drawing routine.
void initMembers() override
void showInfluence(bool state)
bool shouldRenderSpecific(ml::CSO *) const override
Returns whether a given CSO should be rendered by this specific extension.
void createDragMoveTo(const SoPointerPosition &) override
SoSFEnum interactionPerformCursor
SoSFInt32 selectionDistance
The selection distance in pixel.
void cancel() override
Cancels an action like generating a CSO. Depends on concrete editor.
bool isModificationEditor() const override
Returns whether the editor is a modification editor.
void pointerPosition(const SoPointerPosition &) override
Called when the mouse moves over a viewer.
void createStartPressAt(const SoPointerPosition &) override
Base class for an editor extension for the SoView2DCSOExtensibleEditor.
virtual void draw(const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &sliceInfo, SoView2DCSOExtensibleEditor *editor)
Main routine for drawing a CSO.
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
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 CSO represents a contour segmentation object.
Definition CSO.h:44
Target mlrange_cast(Source arg)
Generic version of checked ML casts.