Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
berry::Geometry Struct Reference

#include <berryGeometry.h>

Static Public Member Functions

static int GetDimension (const QRect &toMeasure, bool width)
 
static bool IsHorizontal (int berrySideConstant)
 
static QRect GetExtrudedEdge (const QRect &toExtrude, int size, int orientation)
 
static void Normalize (QRect &rect)
 
static int GetClosestSide (const QRect &boundary, const QPoint &toTest)
 
static int GetDistanceFromEdge (const QRect &rectangle, const QPoint &testPoint, int edgeOfInterest)
 
static int GetOppositeSide (int directionConstant)
 
static QRect ToControl (QWidget *coordinateSystem, const QRect &toConvert)
 
static QPoint ToControl (QWidget *coordinateSystem, const QPoint &toConvert)
 
static QRect ToDisplay (QWidget *coordinateSystem, const QRect &toConvert)
 
static QPoint ToDisplay (QWidget *coordinateSystem, const QPoint &toConvert)
 

Detailed Description

Definition at line 25 of file berryGeometry.h.

Member Function Documentation

◆ GetClosestSide()

static int berry::Geometry::GetClosestSide ( const QRect &  boundary,
const QPoint &  toTest 
)
static

Returns the edge of the given rectangle is closest to the given point.

Parameters
boundaryrectangle to test
toTestpoint to compare
Returns
one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
Since
3.0

◆ GetDimension()

static int berry::Geometry::GetDimension ( const QRect &  toMeasure,
bool  width 
)
static

Returns the height or width of the given rectangle.

Parameters
toMeasurerectangle to measure
widthreturns the width if true, and the height if false
Returns
the width or height of the given rectangle
Since
3.0

◆ GetDistanceFromEdge()

static int berry::Geometry::GetDistanceFromEdge ( const QRect &  rectangle,
const QPoint &  testPoint,
int  edgeOfInterest 
)
static

Returns the distance of the given point from a particular side of the given rectangle. Returns negative values for points outside the rectangle.

Parameters
rectanglea bounding rectangle
testPointa point to test
edgeOfInterestside of the rectangle to test against
Returns
the distance of the given point from the given edge of the rectangle
Since
3.0

◆ GetExtrudedEdge()

static QRect berry::Geometry::GetExtrudedEdge ( const QRect &  toExtrude,
int  size,
int  orientation 
)
static

Extrudes the given edge inward by the given distance. That is, if one side of the rectangle was sliced off with a given thickness, this returns the rectangle that forms the slice. Note that the returned rectangle will be inside the given rectangle if size > 0.

Parameters
toExtrudethe rectangle to extrude. The resulting rectangle will share three sides with this rectangle.
sizedistance to extrude. A negative size will extrude outwards (that is, the resulting rectangle will overlap the original iff this is positive).
orientationthe side to extrude. One of Constants::LEFT, Constants::RIGHT, Constants::TOP, or Constants::BOTTOM. The resulting rectangle will always share this side with the original rectangle.
Returns
a rectangle formed by extruding the given side of the rectangle by the given distance.

◆ GetOppositeSide()

static int berry::Geometry::GetOppositeSide ( int  directionConstant)
static

Returns the opposite of the given direction. That is, returns SWT.LEFT if given SWT.RIGHT and visa-versa.

Parameters
directionConstantone of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
Returns
one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
Since
3.0

◆ IsHorizontal()

static bool berry::Geometry::IsHorizontal ( int  berrySideConstant)
static

Returns true iff the given side constant corresponds to a horizontal side of a rectangle. That is, returns true for the top and bottom but false for the left and right.

Parameters
berrySideConstantone of Constants::TOP, Constants::BOTTOM, Constants::LEFT, or Constants::RIGHT
Returns
true iff the given side is horizontal.
Since
3.0

◆ Normalize()

static void berry::Geometry::Normalize ( QRect &  rect)
static

Normalizes the given rectangle. That is, any rectangle with negative width or height becomes a rectangle with positive width or height that extends to the upper-left of the original rectangle.

Parameters
rectrectangle to modify

◆ ToControl() [1/2]

static QPoint berry::Geometry::ToControl ( QWidget *  coordinateSystem,
const QPoint &  toConvert 
)
static

Converts the given point from display coordinates to the local coordinate system of the given object

Parameters
coordinateSystemlocal coordinate system (widget) being converted to
toConvertpoint to convert
Returns
a point in control coordinates
Since
3.0

◆ ToControl() [2/2]

static QRect berry::Geometry::ToControl ( QWidget *  coordinateSystem,
const QRect &  toConvert 
)
static

Converts the given rectangle from display coordinates to the local coordinate system of the given object

Parameters
coordinateSystemlocal coordinate system (widget) being converted to
toConvertrectangle to convert
Returns
a rectangle in control coordinates
Since
3.0

◆ ToDisplay() [1/2]

static QPoint berry::Geometry::ToDisplay ( QWidget *  coordinateSystem,
const QPoint &  toConvert 
)
static

Converts the given point from the local coordinate system of the given object into display coordinates.

Parameters
coordinateSystemlocal coordinate system (widget) being converted from
toConvertpoint to convert
Returns
a point in display coordinates
Since
3.0

◆ ToDisplay() [2/2]

static QRect berry::Geometry::ToDisplay ( QWidget *  coordinateSystem,
const QRect &  toConvert 
)
static

Converts the given rectangle from the local coordinate system of the given object into display coordinates.

Parameters
coordinateSystemlocal coordinate system (widget) being converted from
toConvertrectangle to convert
Returns
a rectangle in display coordinates
Since
3.0

The documentation for this struct was generated from the following file: