KanoopCommonQt 2.1.1
Kanoop foundational Qt utility library
Loading...
Searching...
No Matches
Geo Namespace Reference

Geographic type enumerations and string-conversion helpers for Qt geometry types. More...

Enumerations

enum  CardinalDirection {
  InvalidCardinalDirection = 0 , North = 1 , East = 2 , South = 3 ,
  West = 4
}
 Cardinal compass directions used by geographic coordinates. More...
 
enum  Side {
  NoSide = 0x0000 , Top = 0x0001 , Left = 0x0002 , Bottom = 0x0004 ,
  Right = 0x0008 , TopLeftCorner = 0x0010 , TopRightCorner = 0x0020 , BottomLeftCorner = 0x0040 ,
  BottomRightCorner = 0x0080
}
 Bitmask identifying which side(s) of a rectangle are relevant. More...
 
enum  Direction {
  NoDirection = NoSide , Up = Top , Down = Bottom , ToLeft = Left ,
  ToRight = Right
}
 Cardinal directions, aliased to the corresponding Side values. More...
 
enum  SpatialRelationship {
  NoRelationship = 0x0000 , IntersectsWith = 0x0001 , Contains = 0x0002 , ContainedBy = 0x0004 ,
  AwayFrom = 0x0008 , Towards = 0x0010 , Above = 0x0020 , Below = 0x0040 ,
  ToLeftOf = 0x0080 , ToRightOf = 0x0100 , Contained = 0x0200
}
 Spatial relationship between two geometric objects. More...
 
enum  Axis { NoAxis = 0x0000 , XAxis = 0x0001 , YAxis = 0x0002 , ZAxis = 0x0004 }
 Coordinate axes. More...
 

Functions

static QString string (const QRect &rect)
 Format a QRect as a human-readable "x,y w,h" string.
 
static QString string (const QSize &size)
 Format a QSize as a human-readable "w,h" string.
 
static QString string (const QPoint &point)
 Format an integer QPoint as a "x,y" string.
 
static QString string (const QPointF &point)
 Format a floating-point QPointF as a "x,y" string.
 
KANOOP_EXPORT QList< DirectionallDirections ()
 Return a list of all four cardinal directions.
 
KANOOP_EXPORT Side directionToSide (Direction direction)
 Convert a Direction to the corresponding Side value.
 
KANOOP_EXPORT Direction sideToDirection (Side side)
 Convert a Side to the corresponding Direction value.
 
KANOOP_EXPORT double directionToBearing (Direction direction)
 Convert a cardinal Direction to a compass bearing in degrees.
 
KANOOP_EXPORT Direction bearingToDirection (double bearing)
 Convert a compass bearing to the nearest cardinal Direction.
 
KANOOP_EXPORT Direction oppositeDirection (Direction direction)
 Return the opposite of a cardinal Direction.
 

Detailed Description

Geographic type enumerations and string-conversion helpers for Qt geometry types.

Geometry enumerations and utility functions for sides, directions, and spatial relationships.

Geographic namespace providing cardinal direction enumerations and geometry string helpers.

Geometry namespace providing enumerations and free functions for spatial reasoning.

Enumeration Type Documentation

◆ Axis

enum Geo::Axis

Coordinate axes.

Enumerator
NoAxis 

No axis.

XAxis 

X axis.

YAxis 

Y axis.

ZAxis 

Z axis.

Definition at line 69 of file geo.h.

◆ CardinalDirection

Cardinal compass directions used by geographic coordinates.

Enumerator
InvalidCardinalDirection 

Sentinel value for uninitialized direction.

North 

North latitude hemisphere.

East 

East longitude hemisphere.

South 

South latitude hemisphere.

West 

West longitude hemisphere.

Definition at line 19 of file geotypes.h.

◆ Direction

Cardinal directions, aliased to the corresponding Side values.

Enumerator
NoDirection 

No direction.

Up 

Upward (toward smaller Y)

Down 

Downward (toward larger Y)

ToLeft 

Leftward (toward smaller X)

ToRight 

Rightward (toward larger X)

Definition at line 36 of file geo.h.

◆ Side

enum Geo::Side

Bitmask identifying which side(s) of a rectangle are relevant.

Enumerator
NoSide 

No side.

Top 

Top edge.

Left 

Left edge.

Bottom 

Bottom edge.

Right 

Right edge.

TopLeftCorner 

Top-left corner.

TopRightCorner 

Top-right corner.

BottomLeftCorner 

Bottom-left corner.

BottomRightCorner 

Bottom-right corner.

Definition at line 18 of file geo.h.

◆ SpatialRelationship

Spatial relationship between two geometric objects.

Enumerator
NoRelationship 

No defined relationship.

IntersectsWith 

Objects intersect.

Contains 

Origin contains other.

ContainedBy 

Origin is contained by other.

AwayFrom 

Moving away from other.

Towards 

Moving toward other.

Above 

Origin is above other.

Below 

Origin is below other.

ToLeftOf 

Origin is to the left of other.

ToRightOf 

Origin is to the right of other.

Contained 

Origin is contained within other.

Definition at line 50 of file geo.h.

Function Documentation

◆ allDirections()

KANOOP_EXPORT QList< Direction > Geo::allDirections ( )

Return a list of all four cardinal directions.

Returns
List containing Up, Down, ToLeft, ToRight

◆ bearingToDirection()

KANOOP_EXPORT Direction Geo::bearingToDirection ( double  bearing)

Convert a compass bearing to the nearest cardinal Direction.

Parameters
bearingBearing in degrees
Returns
Nearest cardinal Direction

◆ directionToBearing()

KANOOP_EXPORT double Geo::directionToBearing ( Direction  direction)

Convert a cardinal Direction to a compass bearing in degrees.

Parameters
directionDirection to convert
Returns
Bearing in degrees (0 = Up/North, 90 = Right/East, etc.)

◆ directionToSide()

KANOOP_EXPORT Side Geo::directionToSide ( Direction  direction)

Convert a Direction to the corresponding Side value.

Parameters
directionDirection to convert
Returns
Equivalent Side flag

◆ oppositeDirection()

KANOOP_EXPORT Direction Geo::oppositeDirection ( Direction  direction)

Return the opposite of a cardinal Direction.

Parameters
directionInput direction
Returns
Opposite direction (e.g. Up -> Down)

◆ sideToDirection()

KANOOP_EXPORT Direction Geo::sideToDirection ( Side  side)

Convert a Side to the corresponding Direction value.

Parameters
sideSide to convert
Returns
Equivalent Direction value

◆ string() [1/4]

static QString Geo::string ( const QPoint &  point)
inlinestatic

Format an integer QPoint as a "x,y" string.

Parameters
pointPoint to format
Returns
String of the form "x,y"

Definition at line 53 of file geotypes.h.

◆ string() [2/4]

static QString Geo::string ( const QPointF &  point)
inlinestatic

Format a floating-point QPointF as a "x,y" string.

Parameters
pointPoint to format
Returns
String of the form "x,y"

Definition at line 63 of file geotypes.h.

◆ string() [3/4]

static QString Geo::string ( const QRect &  rect)
inlinestatic

Format a QRect as a human-readable "x,y w,h" string.

Parameters
rectRectangle to format
Returns
String of the form "x,y W,H w,h W,H"

Definition at line 33 of file geotypes.h.

◆ string() [4/4]

static QString Geo::string ( const QSize &  size)
inlinestatic

Format a QSize as a human-readable "w,h" string.

Parameters
sizeSize to format
Returns
String of the form "w,h W,H"

Definition at line 43 of file geotypes.h.