MeVisLab Toolbox Reference
SoView2DRuler.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, 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 "SoView2DSystem.h"
19 #include "SoView2DExtension.h"
20 
21 #include <Inventor/fields/SoSFBool.h>
22 #include <Inventor/fields/SoSFInt32.h>
23 
24 //-------------------------------------------------------------------------
26 
33 {
34  SO_NODE_HEADER(SoView2DRuler);
35 
36 public:
37 
39  {
40  int minx;
41  int maxx;
42  int miny;
43  int maxy;
44  };
45 
47 
48  SoSFInt32 rulerFontSize;
49 
50  SoSFBool verticalRuler;
51  SoSFBool horizontalRuler;
54 
56 
58  static void initClass();
59 
62 
63  ~SoView2DRuler() override;
64 
66  void draw(View2DSliceList *dsl, View2DSlice* dslice, int slice) override;
67 
69  float decimalFloor(float number, SbString& result, int &divider);
70 
72  void drawVerticalRuler(View2DSliceList* dsl, View2DSlice* dslice, bool drawText, int marginRight, const PixelBoundingBox& pixelBoundingBox);
73  void drawHorizontalRuler(View2DSliceList* dsl, View2DSlice* dslice, bool drawText, int marginBottom, const PixelBoundingBox& pixelBoundingBox);
74 
75 private:
77  SbString _asString(double value, int precision) const;
78  void _drawRulers(View2DSliceList * dsl, View2DSlice* dslice, const PixelBoundingBox& pixelBoundingBox);
79 
80  void _fillPixelBoundingBoxes(View2DSlice* dslice, PixelBoundingBox &pixelBoundingBox);
81 };
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoView2DExtension Base class for all View2DExtensions used for drawing and event handling on the View...
SoView2D extension for drawing rulers.
Definition: SoView2DRuler.h:33
SoSFBool verticalRuler
Definition: SoView2DRuler.h:50
SoView2DRuler()
Constructor.
SoSFInt32 verticalRulerMarginRight
Definition: SoView2DRuler.h:52
void drawHorizontalRuler(View2DSliceList *dsl, View2DSlice *dslice, bool drawText, int marginBottom, const PixelBoundingBox &pixelBoundingBox)
void drawVerticalRuler(View2DSliceList *dsl, View2DSlice *dslice, bool drawText, int marginRight, const PixelBoundingBox &pixelBoundingBox)
draws an annotated ruler
SoSFInt32 rulerFontSize
Fields.
Definition: SoView2DRuler.h:48
static void initClass()
inventor runtime type system
SoSFInt32 horizontalRulerMarginBottom
Definition: SoView2DRuler.h:53
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
draw annotations on slice
SoSFBool coupleVerticalRulerToSkinLine
Definition: SoView2DRuler.h:55
float decimalFloor(float number, SbString &result, int &divider)
returns the closest decimal floor and copies a printable string into the buffer
SoSFBool horizontalRuler
Definition: SoView2DRuler.h:51
~SoView2DRuler() override
a list that holds all View2DSlice objects (lazily created) of a SoView2D
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
Definition: View2DSlice.h:48