MeVisLab Toolbox Reference
SoCSOAnnotationDeviceCoordinates.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2014, 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 <Inventor/sensors/SoFieldSensor.h>
19
22
24{
26
27public:
28
30
32
33 SoSFString visibleCSOIds;
35
37
38 SoSFVec2f annotationSize;
39
41 void drawingDone() override;
42
43 void setVisibleCSOs( const std::vector<CSODrawCSOInfos>& drawCSOInformation,
44 const CSODrawView2DInfos& view2DInfos, SoView2DCSOExtensibleEditor* editor) override;
45
46 void draw(const CSODrawCSOInfos& csoInfos, const CSODrawView2DInfos& view2DInfos, const CSODrawSliceInformation& drawSliceInfo, SoView2DCSOExtensibleEditor* editor) override;
47
48 static void initClass();
49
50
51protected:
52
54
55 void createStartPressAt(const SoPointerPosition&) override {}
56 void createDragMoveTo(const SoPointerPosition&) override {}
57 bool createEndPress(int ) override { return false; }
59
62 SoPointingAction* selectAndMoveEndPress(int ) override { return nullptr; }
63
64 bool shouldRenderSpecific(ml::CSO*) const override { return false; }
65 bool shouldRenderGeneral(ml::CSO*) const override { return true; }
66
67 void computeLabelBoxes(const std::vector<CSODrawCSOInfos>& drawCSOInformation, const CSODrawView2DInfos& view2DInfos, std::map < int, SbVec2f >& labelBoxes);
68
69
70private:
71
72 std::vector<int> _csoIds;
73 std::vector<SbVec2f> _deviceCoordinates;
74 ml::CSOLabelPlacement _labelPlacement;
75
76 void _shouldRenderCB(SoField* field);
77
78 void setInheritedFields();
79 void resetFields();
80 void resetStringField(SoSFString& field);
81
82 void redraw();
83
84 void ensurePositionIsInViewer(const SbVec2f& viewerUpperLeft, const SbVec2f& viewerLowerRight, SbVec2f& annotationPosition);
85
86 void updateDeviceCoordinatesField();
87 void updateVisibleCSOIdsField();
88
89 ml::CSOLabelPlacement* getLabelPlacement();
90};
bool shouldRenderGeneral(ml::CSO *) const override
void createDragMoveTo(const SoPointerPosition &) override
void createStartPressAt(const SoPointerPosition &) override
void draw(const CSODrawCSOInfos &csoInfos, const CSODrawView2DInfos &view2DInfos, const CSODrawSliceInformation &drawSliceInfo, SoView2DCSOExtensibleEditor *editor) override
Main routine for drawing a CSO.
void pointerPositionIfAllowedAt(const SoPointerPosition &) override
SoPointingAction * selectAndMoveEndPress(int) override
void computeLabelBoxes(const std::vector< CSODrawCSOInfos > &drawCSOInformation, const CSODrawView2DInfos &view2DInfos, std::map< int, SbVec2f > &labelBoxes)
void drawingDone() override
Is called when all drawing is done.
bool shouldRenderSpecific(ml::CSO *) const override
Returns whether a given CSO should be rendered by this specific extension.
void setVisibleCSOs(const std::vector< CSODrawCSOInfos > &drawCSOInformation, const CSODrawView2DInfos &view2DInfos, SoView2DCSOExtensibleEditor *editor) override
Sets visible CSOs that have been determined in the extensible editor.
void selectAndMoveDragMoveTo(const SoPointerPosition &) override
void selectAndMoveStartPressAt(const SoPointerPosition &) override
void startDrawing(View2DSliceList *) override
Is called before drawing.
SoCSOEditorExtension()
Hidden constructor.
SoPointerPosition manages the current position of the mouse cursor.
a list that holds all View2DSlice objects (lazily created) of a SoView2D
Base module for providing custom label placement strategies.
Definition CSO.h:44