23#include <Inventor/fields/SoSFInt32.h>
24#include <Inventor/fields/SoSFVec3f.h>
165 return isPointInsideDeviceRect(cornerHandlePosition[0], cornerHandlePosition[1], mousePosition[0], mousePosition[1],
171 const float x = mousePosition[0];
172 const float y = mousePosition[1];
174 const float minX = std::min(upperLeft[0], lowerRight[0]);
175 const float maxX = std::max(upperLeft[0], lowerRight[0]);
176 const float minY = std::min(upperLeft[1], lowerRight[1]);
177 const float maxY = std::max(upperLeft[1], lowerRight[1]);
179 return (x > minX && x < maxX && y > minY && y < maxY);
183 void drawThickLine(
float startX,
float startY,
float endX,
float endY)
const;
184 void drawThinLine(
float startX,
float startY,
float endX,
float endY)
const;
192 bool _startDeviceXHigher{};
194 bool _startDeviceYHigher{};
196 bool _swappedDeviceX{};
197 bool _swappedDeviceY{};
214 bool _draggingInCooperativeMode{};
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.
void pointerPosition(SoState *state, const SoPointerPosition &pos) override
Same as below, with additional SoState argument. By default, simply calls the below version.
virtual void pointerLeftWindow()
This is called when the mouse cursor leaves the window.
SoPointerPosition manages the current position of the mouse cursor.
SoPointingAction is the base class for any mouse based interaction.
bool isPointInsideDeviceRect(float pointX, float pointY, float centerX, float centerY, float hitRectangleSize=0.0)
returns whether the given point is inside a rectangle around the given center.
float getSelectDist()
Set the distance tolerance on hit checking in pixels.
SoView2DInteractionExtension is base class for all SoView2DExtensions that want to support the Manage...
allows drawing and editing of a rectangle on a SoView2D
SoView2DRectangle()
Constructor.
bool isSensitiveAt(const SoPointerPosition &pos) override
interface forwarded from SoPointingAction:
SoSFFloat lineBlendOnto
line blend factor when on border of rectangle
DragMode performHitTest(const SoPointerPosition &pos)
bool isSliceIntersectingRectangle(int slice, float vz1, float vz2) const
void drawThinLine(float startX, float startY, float endX, float endY) const
SoSFInt32 labelFontSize
font size of text
SoSFFloat labelHorizontalOffset
void drawLabelText(float px, float py, float qx, float qy)
draws the label (given top-left/bottom-right positions of the rectangle on the slice)
SoSFBool selectOutside
allow selection outside of rectangle
void performDrag(const SoPointerPosition &pos, bool setStart)
perform drag operation (this uses members set by performHitTest)
void dragMoveTo(const SoPointerPosition &pos) override
SoSFBool shadeAllExterior
shade all exterior, also there where the slice does not cross the box.
SoSFFloat labelVerticalOffset
void draw(View2DSliceList *dsl, View2DSlice *dslice, int slice) override
reimplemented from SoView2DExtension
DragMode _dragMode
specify drag mode
void startPressAt(const SoPointerPosition &pos) override
DragMode
type for specifying dragging mode
SoSFFloat blendInside
blend factor inside of rectangle
SbVec3f _lastWorldPos
last world position
bool evalEvent(SoView2D *view2d, View2DSliceList *slicelist, View2DEvent *ec, View2DEventPhase phase) override
reimplemented from SoView2DExtension
SoSFFloat blendOutside
blend factor outside of rectangle
bool isMouseInsideRectangle(const SbVec2f &mousePosition, const SbVec2f &upperLeft, const SbVec2f &lowerRight)
void pointerPosition(SoState *, const SoPointerPosition &pos) override
Same as below, with additional SoState argument. By default, simply calls the below version.
SoSFBool isUnderMouse
flag that indicated is the rectangle is under the mouse
SoSFBool cooperative
enable cooperative mode
SoSFFloat shadeExterior
shade the exterior of the rectangle
SoSFEnum labelHorizontalPosition
void drawHitSideLine(float startX, float startY, float endX, float endY, View2DSliceList *sliceList, int slice) const
SoSFEnum labelVerticalBoxPosition
SoSFBool useSideLineColor
Should the side lines have their own color?
SoSFVec3f endWorldPos
end world position of rectangle
bool isSliceInMiddleOfRectangleExcludingTopAndBottom(int slice, float vz1, float vz2) const
SoSFEnum labelVerticalPosition
SoSFEnum lineStyle
line style
SoSFColor sideLineColor
Optional side line color.
SoSFColor handleColor
Optional handle color.
SoSFFloat lineBlendInside
line blend factor when inside of rectangle
SoPointingAction * endPress(int clickCount) override
SoSFBool resetToImage
reset to 80 percent of the original image
void performDrag(const SbVec3f &voxelPos, bool setStart, View2DSliceList *sliceList)
SoSFFloat lineBlendOutside
line blend factor when outside of rectangle
static void initClass()
inventor runtime type system
SoSFFloat blendOnto
blend factor on border of rectangle
SoSFBool useHandleColor
Should the handles have their own color?
SoSFEnum labelHorizontalBoxPosition
void drawThickLine(float startX, float startY, float endX, float endY) const
bool isPointInsideDeviceCornerHandle(const SbVec2f &cornerHandlePosition, const SbVec2f &mousePosition)
bool ignoreEvent(View2DEvent *ec) override
Overwrite ignoreEvent -> ignore the "ignoreHandledEvents"-Field.
DragMode performHitTest(float dx, float dy, const SbVec3f &voxelPos, View2DSliceList *sliceList)
perform hit test where the rectangle is hit, returns the possible drag mode
SoSFColor labelColor
text color to use
SoSFBool labelShadow
flag if text shadow should be drawn
SoSFVec3f startWorldPos
Fields.
SoSFBool allowDrag
allow dragging of the rectangle
void pointerLeftWindow(SoState *) override
Same as below, with additional SoState argument. By defaults, simply calls the below version.
SoView2D is a 2D viewer for image data.
View2DEvent stores all information on an event on a SoView2D.
a list that holds all View2DSlice objects (lazily created) of a SoView2D
SoView2D * getOwner()
Get the owning SoView2D.
a single slice that is stored in a View2DSliceList, typically created by a View2DSliceList
ML_OPENGL_END_NAMESPACE T GLHiDPIScale(T x)
Convenience template function to scale a value.
Allows drawing and editing of a rectangle on a SoView2D.
bool isDrawnOnViewer(View2DSliceList *slicelist, int slice) const
void reset(View2DSliceList *slicelist, int slice)