Medical Imaging Interaction Toolkit  2016.11.0
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 29 of file berryGeometry.h.

Member Function Documentation

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

Definition at line 88 of file berryGeometry.cpp.

References berry::Constants::BOTTOM, GetDistanceFromEdge(), berry::Constants::LEFT, max(), berry::Constants::RIGHT, and berry::Constants::TOP.

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

Definition at line 29 of file berryGeometry.cpp.

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

Definition at line 112 of file berryGeometry.cpp.

References berry::Constants::BOTTOM, berry::Constants::LEFT, berry::Constants::RIGHT, and berry::Constants::TOP.

Referenced by GetClosestSide().

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.

Definition at line 44 of file berryGeometry.cpp.

References berry::Constants::BOTTOM, IsHorizontal(), Normalize(), and berry::Constants::RIGHT.

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
swtDirectionConstantone 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

Definition at line 127 of file berryGeometry.cpp.

References berry::Constants::BOTTOM, berry::Constants::LEFT, berry::Constants::RIGHT, and berry::Constants::TOP.

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
swtSideConstantone of Constants::TOP, Constants::BOTTOM, Constants::LEFT, or Constants::RIGHT
Returns
true iff the given side is horizontal.
Since
3.0

Definition at line 38 of file berryGeometry.cpp.

References berry::Constants::LEFT, and berry::Constants::RIGHT.

Referenced by GetExtrudedEdge().

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

Definition at line 73 of file berryGeometry.cpp.

Referenced by GetExtrudedEdge().

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

Definition at line 141 of file berryGeometry.cpp.

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

Definition at line 148 of file berryGeometry.cpp.

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

Definition at line 153 of file berryGeometry.cpp.

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

Definition at line 160 of file berryGeometry.cpp.


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