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
35
37
39
41 void drawingDone() override;
42
43 void setVisibleCSOs( const std::vector<CSODrawCSOInfos>& drawCSOInformation,
44 const CSODrawView2DInfos& view2DInfos, SoView2DCSOExtensibleEditor* editor) override;
45
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};
Extension computing the device coordinates for annotation on a viewer for visible CSOs.
bool shouldRenderGeneral(ml::CSO *) const override
Returns whether a given CSO should be rendered by this general extension.
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
Sets seed points while moving the mouse – but not while dragging.
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.
Base class for an editor extension for the SoView2DCSOExtensibleEditor.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
The SoSFMLBase field is the interface used by Inventor Nodes to output ML Base objects to the outside...
Definition SoSFMLBase.h:45
a list that holds all View2DSlice objects (lazily created) of a SoView2D
Base module for providing custom label placement strategies.
The CSO represents a contour segmentation object.
Definition CSO.h:44
Target mlrange_cast(Source arg)
Generic version of checked ML casts.