21#include <Inventor/fields/SoSFString.h>
22#include <Inventor/fields/SoSFFloat.h>
23#include <Inventor/fields/SoSFDouble.h>
24#include <Inventor/fields/SoSFEnum.h>
25#include <Inventor/fields/SoSFInt32.h>
26#include <Inventor/fields/SoSFNode.h>
27#include <Inventor/nodes/SoSeparator.h>
29#include <unordered_map>
34class SoMatrixTransform;
296 top = 0; bottom = 0; left = 0; right = 0;
299 top = value; bottom = value; left = value; right = value;
301 Margins(
int top,
int right,
int bottom,
int left) {
304 this->bottom = bottom;
308 top *= value; bottom *= value; left *= value; right *= value;
395 long _lastEventUSecs;
399 void clearLastViewerInfoCache(
SoField*
field) { _lastViewerInfoCache.clear(); }
401 std::unordered_map<void*, LastViewerInfo> _lastViewerInfoCache;
403 struct OrientationCubePolygon
406 char orientationLetter;
409 std::vector < OrientationCubePolygon > _orientationCubePolygons;
416 bool isOverOrientationCube(
const SbVec2f& position) {
char letter;
return isOverOrientationCube(position,
letter); }
418 bool isOverOrientationCube(
const SbVec2f& position,
char&
letter);
427 bool _findFontSizeAndDetailLevel(
View2DSliceList *
dsl,
View2DSlice*
dslice,
int& fontSize,
const PixelBoundingBox&
pixelBoundingBox,
const PixelBoundingBox&
centerBoundingBox,
SbString*
resultString,
const SbString&
topLeft,
const SbString&
topRight,
const SbString&
bottomLeft,
const SbString&
bottomRight,
const SbString&
bottomCenter);
441 SoSeparator* _orientationModelInnerScene;
AnnotationOrientionModelPosition
AnnotationOrientationMode
@ ANNO_ORIENTATION_SIZE_WEIGHTED
@ ANNO_ORIENTATION_SIZE_FIXED
View2DEventPhase
event phase for simple extensions that grab the focus, do something (motion) and are released afterwa...
#define SOVIEW2D_API
File to resolve system dependencies in View2D library.
SoCommandAction is the base class for instantaneous actions.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
Annotation extension for the SoView2D.
virtual void drawOrientationCubeLetter(char letter, int modelSize, bool shadowPass)
draw the given letters.
virtual int calculateOrientationModelOffset(int viewSize, const SoSFFloat &relativeOffset, const SoSFInt32 &minOffsetPixels, const SoSFInt32 &maxOffsetPixels)
calculates an offset for the orientation model position
SoView2DAnnotation()
Constructor.
SoSFEnum annotationFontSize
SoSFString annotationCTBottomLeft
~SoView2DAnnotation() override
SoSFColor backgroundColor
SoSFString shortBottomCenter
SoSFInt32 userDetailFontSize
void drawOrientation(const char *string, float posX, float posY, float fontSize, View2DFont *font, float relOffX, float relOffY, float *orWeights)
Draw orientation letters.
SoSFInt32 orientationModelMinHorizontalOffset
void startPressAt(const SoPointerPosition &pos) override
SoSFBool drawBackgroundBox
void toggleAnnotation()
toggle displayed information
SoSFBool showTechnicalInfo
void drawAnnotation(const char *string, const PixelBoundingBox &pixelBoundingBox, int fontsize, AlignPosition pos, bool shouldDrawBox, int &outBoxWidth, int &outBoxHeight)
draws an AnnotationBox at the given position
SoSFString annotationUserBottomLeft
SoSFInt32 minDetailFontSize
void toggleTechnicalInfo()
void editingOnChanged(SoField *field) override
called when editingOn field is touched:
SoSFFloat orientationModelRelativeVerticalOffset
static void getExtOrientation(int axis, SbMatrix &matrix, float *orWeights, char *negOrientation, char *posOrientation)
Return extended orientation letters (up to three letters for oblique views) and weights.
virtual void clearViewerCache(SoField *field)
called when any field is changed that affects cached changes
SoSFColor textShadowColor
SoSFString annotationUserBottomCenter
bool implementsManagedInteractionAndClassicEventHandling() const override
this node is a hybrid module providing managed interaction and classic event handling
SoSFString annotationUserTopLeft
Fields.
void dragMoveTo(const SoPointerPosition &pos) override
SoSFString fontWidthDummyString
SoSFInt32 orientationModelMaxHorizontalOffset
virtual Margins calculateCenterTextMargins(int width, int height)
margins for center text (horizontally) can be different
SoSFString hitOrientationLetter
SoSFString annotationCTTopRight
SoSFString annotationMRBottomCenter
static void initClass()
inventor runtime type system
SoSFInt32 horizontalRulerMarginBottom
SoSFString annotationMRBottomRight
SoSFInt32 verticalRulerMarginRight
virtual SbString asString(double value, int precision) const
SoSFFloat backgroundEdgeOpacity
virtual int calculateOrientationModelSize(int width, int height)
calculates the size of the orientation model
SbMatrix calculateOrientationModelRotationMatrix(View2DSlice *slice)
calculates the rotation matrix for the orientation model
SoSFInt32 minShortFontSize
SoSFString annotationUserTopRight
virtual Margins calculateTextMargins(int width, int height)
calculates the margin of the text annotations (to be reimplemented by a derived class)
SoSFBool orientationModel
virtual void drawAndStoreCubePolygon(char letter, const SbMatrix &rotationMatrix, int posX, int posY, int modelSize, int pass, const SbVec3f &pos0, const SbVec3f &pos1, const SbVec3f &pos2, const SbVec3f &pos3)
Draws an orientation cube polygon (a side of the cube) and stores the projected polygon in an interna...
SoSFColor backgroundEdgeColor
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
handle keyboard events
SoSFNode inOrientationModel
virtual SbString getDicomTagValueAsString(DCMTree::Const_TagPtr tagPtr, unsigned int index, unsigned int precision) const
get the value of a dicom tag for display purposes; derived classes might e.g.
virtual void drawOrientationCube(const SbMatrix &rotationMatrix, int posX, int posY, int modelSize)
draws the annotation model for the given rotation matrix at the given position and size using the bui...
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
draw annotations on slice
static SbVec2f getTargetSizeInScene(SoNode *scene, int width, int height)
Get the minimum view port size of all SoView2Ds in the given scene, provided the scene would be displ...
SoSFInt32 orientationModelMinSize
SoSFBool orientationAndScaleFromCamera
field that enables getting the orientation matrix from the Inventor scene instead of the input image
bool isSensitiveAt(const SoPointerPosition &pos) override
interface forwarded from SoPointingAction:
SoSFString shortBottomLeft
SoSFString annotationMRTopLeft
SoSFString annotationCTBottomCenter
SoSFFloat orientationModelRelativeSize
virtual bool implementsManagedInteraction() const
also implements managed interactions
SoSFBool drawNegativeOrientation
virtual SbString restrict(const SbString &value, int maxLength) const
restrict string to maximum length, appending "..." if string was truncated
SoSFInt32 orientationModelMaxVerticalOffset
SoSFColor orientationColor
SoPointingAction * endPress(int clickCount) override
SoSFInt32 maxDetailFontSize
AlignPosition
Mode for alignment of text boxes on viewer.
SoSFBool drawPositiveOrientation
SoSFInt32 orientationModelMaxSize
SoSFInt32 abreviateShortChars
SoSFEnum orientationModelPosition
SoSFString annotationUserBottomRight
void parseString(View2DSliceList *list, View2DSlice *slice, const SbString &string, SbString &resultString, int limitToChars=-1)
parses the given string and substitutes and
SoSFInt32 maxShortFontSize
SoSFString shortBottomRight
SoSFString annotationMRTopRight
virtual void drawOrientationModelUsingInventor(SoAction *action, const SbMatrix &rotationMatrix, int posX, int posY, int modelSize)
draws the annotation model for the given rotation matrix at the given position and size using the inO...
SoSFFloat orientationModelRelativeHorizontalOffset
SoSFColor orientationModelColor
SoSFFloat backgroundOpacity
float decimalFloor(float number, SbString &result, int ÷r)
returns the closest decimal floor and copies a printable string into the buffer
void drawHorizontalRuler(View2DSliceList *dsl, View2DSlice *dslice, bool drawText, int marginBottom, const PixelBoundingBox &pixelBoundingBox)
virtual bool drawVerticalRulerTextBelow() const
override this to draw the unit text below the vertical ruler instead of to the left of it.
SoSFInt32 orientationModelMinVerticalOffset
SoSFString annotationCTBottomRight
SoSFString annotationMRBottomLeft
virtual SbString asString(int value) const
return numeric value formatted as string derived classes might e.g.
SoSFInt32 userShortFontSize
void drawVerticalRuler(View2DSliceList *dsl, View2DSlice *dslice, bool drawText, int marginRight, const PixelBoundingBox &pixelBoundingBox)
draws an annotated ruler
SoSFString annotationCTTopLeft
SoView2DInteractionExtension is base class for all SoView2DExtensions that want to support the Manage...
SoView2D is a 2D viewer for image data.
View2DEvent stores all information on an event on a SoView2D.
Abstract GL font drawing using FTGL.
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
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
boost::shared_ptr< const Tag > Const_TagPtr
MLCSO_EXPORT bool isPointInPolygon(const std::vector< Vector3 > &points, const Vector3 &normal, const Vector3 &point)
int lastSetAnnotationMode
bool hasFoundFontSizeLastTime
Stores top/bottom/left/right margins.
Margins(int top, int right, int bottom, int left)