MeVisLab Toolbox Reference
SoCSOCreatorEditorExtension.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 
16 
17 #pragma once
18 
19 #include "SoCSOEditorExtension.h"
20 
22 
23 
25 
29 {
30  SO_NODE_ABSTRACT_HEADER(SoCSOCreatorEditorExtension);
31 
32 public:
33 
35  static void initClass();
36 
38  bool canCreateCSOs() const override { return true; }
39 
41  int cursorShape() const override { return createCursor.getValue(); }
42 
43  // Fields
44 
46  SoSFInt32 moduleCreatorId;
48  SoSFString moduleCreatorString;
50  SoSFString labelPrefixString;
51 
56 
58  SoSFEnum createCursor;
59  SoSFEnum moveAllCursor;
60  SoSFEnum moveSeedCursor;
62 
68  SoSFString addCSOToGroupLabel;
70  SoSFInt32 addCSOToGroupId;
91 
92 protected:
93 
96 
97  void initMembers() override;
98 
100  int getModuleCreatorId() const override { return moduleCreatorId.getValue(); }
102  std::string getModuleType() const override { return moduleCreatorString.getValue().getString(); }
103 
105  void setCreationData(const SoPointerPosition& pos, ml::CSO* newCSO) override;
106 
109 
112  bool getShouldEmptyBeforeGeneration() const override { return shouldEmptyGroupBeforeGenerating.getValue() == 1; }
114  int getAddCSOToGroupMode() const override { return addCSOToGroupMode.getValue(); }
116  std::string getAddCSOToGroupLabel() const override { return addCSOToGroupLabel.getValue().getString(); }
118  int getAddCSOToGroupId() const override { return addCSOToGroupId.getValue(); }
119 
121  int getDefaultPathPointStyle() const override { return defaultPathPointStyle.getValue(); }
123  float getDefaultPathPointWidth() const override { return defaultPathPointWidth.getValue(); }
126  {
127  SbVec3f color = defaultPathPointColor.getValue();
128  return ml::Vector3(color[0], color[1], color[2]);
129  }
131  float getDefaultPathPointAlpha() const override { return defaultPathPointAlpha.getValue(); }
132 
134  int getDefaultSeedPointStyle() const override { return defaultSeedPointStyle.getValue(); }
136  float getDefaultSeedPointSize() const override { return defaultSeedPointSize.getValue(); }
139  {
140  SbVec3f color = defaultSeedPointColor.getValue();
141  return ml::Vector3(color[0], color[1], color[2]);
142  }
144  float getDefaultSeedPointAlpha() const override { return defaultSeedPointAlpha.getValue(); }
145 
147  int getDefaultVoxelWriteMode() const override { return defaultVoxelWriteMode.getValue(); }
149  float getDefaultVoxelWriteValue() const override { return defaultVoxelWriteValue.getValue(); }
150 
152  ml::CSO* getActiveCSO() const override { return _newCSO ? _newCSO: _hitCSO; }
153 
156  bool isFartherThanEpsilon(const SoPointerPosition& pos) const;
157 
160 
163 };
164 
#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...
SoSFFloat defaultSeedPointSize
Sets the default seed point size.
std::string getModuleType() const override
Returns the module's type string.
SoSFBool shouldEmptyGroupBeforeGenerating
Should the CSO group be emptied before generating new CSOs into it?
static void initClass()
init class in inventor runtime
int getAddCSOToGroupMode() const override
Returns the group generation mode.
SoSFEnum defaultPathPointStyle
Sets the default path point style.
float getDefaultPathPointAlpha() const override
Returns the set default path point alpha for a new CSO.
ml::Vector3 getDefaultSeedPointColor() const override
Returns the set default seed point color for a new CSO.
int cursorShape() const override
Returns the cursor shape that indicates the next creation.
void initMembers() override
SoSFString labelPrefixString
Sets a label prefix string.
int getAddCSOToGroupId() const override
Returns the id of a target group.
SoSFInt32 pointerPositionEpsilonForCreatingCSO
The pointer position movement epsilon distance in pixel to trigger CSO creation.
SoSFInt32 moduleCreatorId
Sets the module's creator id.
SoSFString moduleCreatorString
Sets the module's type string.
float getDefaultPathPointWidth() const override
Returns the set default path point width for a new CSO.
SoSFColor defaultSeedPointColor
Sets the default seed point color.
SoSFFloat defaultPathPointAlpha
Sets the default path point alpha.
bool getShouldEmptyBeforeGeneration() const override
Returns whether the module should empty a group before generating CSOs into it.
std::string getAddCSOToGroupLabel() const override
Returns the label string of a target group.
SoSFInt32 addCSOToGroupId
Sets the group's id for CSO generation.
SoSFFloat defaultSeedPointAlpha
Sets the default seed point alpha.
ml::Vector3 getDefaultPathPointColor() const override
Returns the set default path point color for a new CSO.
float getDefaultSeedPointSize() const override
Returns the set default seed point size for a new CSO.
int getDefaultVoxelWriteMode() const override
Returns the set default voxel write mode for a new CSO.
float getDefaultSeedPointAlpha() const override
Returns the set default seed point alpha for a new CSO.
SoSFEnum addCSOToGroupMode
Sets whether the group's label or its id should be used for cso-into-group generation.
int getModuleCreatorId() const override
Returns the module's creator id.
ml::CSO * getActiveCSO() const override
Returns the currently active CSO.
SoSFEnum defaultVoxelWriteMode
Sets the default voxel write mode.
int getDefaultSeedPointStyle() const override
Returns the set default seed point style for a new CSO.
SoSFFloat defaultPathPointWidth
Sets the default path point width.
int getMaxAvailableId()
Returns the current id for CSOs created by this editor. It is the maximum available id.
SoSFEnum defaultSeedPointStyle
Sets the default seed point style.
void setCreationData(const SoPointerPosition &pos, ml::CSO *newCSO) override
Sets creation data to a newly created CSO.
float getDefaultVoxelWriteValue() const override
Returns the set default voxel write value for a new CSO.
SoSFFloat defaultVoxelWriteValue
Sets the default voxel write value.
int getDefaultPathPointStyle() const override
Returns the set default path point style for a new CSO.
SoSFColor defaultPathPointColor
Sets the default path point color.
SoSFString addCSOToGroupLabel
Sets the group's label for CSO generation.
bool isFartherThanEpsilon(const SoPointerPosition &pos) const
Returns whether the given position is farther away from the start position than the epsilon in pixel.
SoCSOCreatorEditorExtension()
Hidden constructor.
bool canCreateCSOs() const override
Returns whether the editor can create a CSO.
SoSFBool requirePointerPositionMovementToCreateCSO
Should the mouse have to be moved a bit before creating a CSO?
SbVec2f _startDevicePointerPosition
The device position of the pointer at creation start.
Base class for an editor extension for the SoView2DCSOExtensibleEditor.
SoPointerPosition manages the current position of the mouse cursor.
The CSO represents a contour segmentation object.
Definition: CSO.h:44
Tvec3< MLdouble > Vector3
A vector with 3 components of type double.
Definition: mlVector3.h:300