MeVisLab Toolbox Reference
SoView2DArrowHeadSettings.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2016, 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 #pragma once
14 
15 #include "SoView2DSystem.h"
16 
17 #include <Inventor/nodes/SoSubNode.h>
18 #include <Inventor/fields/SoSFBool.h>
19 #include <Inventor/fields/SoSFEnum.h>
20 #include <Inventor/fields/SoSFFloat.h>
21 #include <Inventor/sensors/SoNodeSensor.h>
22 
23 #include <SoSFMLBase.h>
24 #include <mlBase.h>
25 #include <mlModuleIncludes.h>
26 
27 
28 
30 
31 namespace ml {
33  {
34  public:
36 
38 
39  void renderArrowHead(const SbVec2f& deviceStart, const SbVec2f& deviceEnd, bool isEndArrow=true);
40 
41  private:
42  SoView2DArrowHeadSettings* _renderer;
43 
45  };
46 }
47 
49 
51 {
56 };
57 
59 {
63 };
64 
66 {
67 public:
70 
71  static void initClass();
72 
74 
76 
77  SoSFFloat endSize;
78  SoSFFloat endAngleFactor;
79  SoSFTypedEnum<ArrowRenderingStyle> endRenderingStyle;
80  SoSFTypedEnum<ArrowDirectionMode> endDirection;
82 
83  SoSFFloat startSize;
84  SoSFFloat startAngleFactor;
85  SoSFTypedEnum<ArrowRenderingStyle> startRenderingStyle;
86  SoSFTypedEnum<ArrowDirectionMode> startDirection;
88 
89  void renderArrowHead(const SbVec2f& deviceFrom, const SbVec2f& deviceTo, bool isEndArrow);
90 
91 private:
92 
93  void renderAsLines(const SbVec2f& deviceTo, const SbVec2f& arrow1, const SbVec2f& arrow2) const;
94  void renderAsTriangle(const SbVec2f& deviceTo, const SbVec2f& arrow1, const SbVec2f& arrow2) const;
95  void renderAsFilledTriangle(const SbVec2f& deviceTo, const SbVec2f& arrow1, const SbVec2f& arrow2) const;
96 
97  bool useEndSettings(bool isEndArrow) const;
98  float getAngleFactor(float vectorLengthInPixel, bool isEndArrow) const;
99  float getAngleFactor(bool isEndArrow) const;
100  float getSize(bool isEndArrow) const;
101  ArrowRenderingStyle getRenderingStyle(bool isEndArrow) const;
102  ArrowDirectionMode getDirectionMode(bool isEndArrow) const;
103  float getDirectionAutomaticLengthThreshold(bool isEndArrow) const;
104 
105  ml::ArrowHeadSettings arrowHeadSettings;
106 
107  static void fieldChangedCB(void *data, SoSensor *sensor);
108  SoNodeSensor* _nodeSensor;
109 
110  SO_NODE_HEADER(SoView2DArrowHeadSettings);
111 };
@ DIRECTION_MODE_STANDARD
@ DIRECTION_MODE_AUTOMATIC
@ DIRECTION_MODE_REVERSE
@ RENDERING_STYLE_TRIANGLE
@ RENDERING_STYLE_FILLED_TRIANGLE
@ RENDERING_STYLE_NONE
@ RENDERING_STYLE_LINES
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
The SoSFMLBase field is the interface used by Inventor Nodes to output ML Base objects to the outside...
Definition: SoSFMLBase.h:45
~SoView2DArrowHeadSettings() override
SoSFTypedEnum< ArrowRenderingStyle > endRenderingStyle
void renderArrowHead(const SbVec2f &deviceFrom, const SbVec2f &deviceTo, bool isEndArrow)
SoSFTypedEnum< ArrowRenderingStyle > startRenderingStyle
SoSFTypedEnum< ArrowDirectionMode > startDirection
SoSFTypedEnum< ArrowDirectionMode > endDirection
void renderArrowHead(const SbVec2f &deviceStart, const SbVec2f &deviceEnd, bool isEndArrow=true)
void setRenderer(SoView2DArrowHeadSettings *renderer)
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Definition: mlBase.h:62
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
Main documentation file for ML users and developers.
Definition: SoSFMLImage.h:51