libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::ScreenBox Class Referencefinal

Anonymous screen rectangular bounding box. More...

#include <ScreenBox.h>

Public Member Functions

Vertex2D GetCenter () const
 Returns the center coordinates of the box.
double GetHeight () const
 Returns the height of the bounding box (maxLat-minLat).
double GetMaxX () const
double GetMaxY () const
double GetMinX () const
double GetMinY () const
double GetSize () const
 Returns the size of the screen box (width*height).
double GetWidth () const
 Returns the width of the bounding box (maxLon-minLon).
bool Intersects (const ScreenBox &other) const
bool Intersects (const ScreenBox &other, bool openInterval) const
bool IsEmpty () const
 Check if size of the screen box is zero.
ScreenBox Merge (const ScreenBox &other) const
ScreenBox & operator= (const ScreenBox &other)=default
 Assign the value of other.
ScreenBox & operator= (ScreenBox &&other)=default
 Move assignment operator.
bool operator== (const ScreenBox &other) const
 Compare two values.
ScreenBox Resize (double offset) const
 Resize the rectangle in all dimension using the given amount.
 ScreenBox ()=default
 The default constructor creates an invalid instance.
 ScreenBox (const ScreenBox &other)=default
 Copy-Constructor.
 ScreenBox (const Vertex2D &coordA, const Vertex2D &coordB)
 Initialize the GeoBox based on the given coordinates.
 ScreenBox (ScreenBox &&other)=default
 Move-Constructor.

Static Public Attributes

static const ScreenBox EMPTY

Detailed Description

Anonymous screen rectangular bounding box.

The bounding box is defined by two coordinates (type Vertex2D) that span a (in coordinate space) rectangular area.

Constructor & Destructor Documentation

◆ ScreenBox() [1/4]

osmscout::ScreenBox::ScreenBox ( )
default

The default constructor creates an invalid instance.

Referenced by Intersects(), Intersects(), Merge(), operator=(), operator=(), operator==(), Resize(), ScreenBox(), and ScreenBox().

◆ ScreenBox() [2/4]

osmscout::ScreenBox::ScreenBox ( const ScreenBox & other)
default

Copy-Constructor.

References ScreenBox().

◆ ScreenBox() [3/4]

osmscout::ScreenBox::ScreenBox ( ScreenBox && other)
default

Move-Constructor.

References ScreenBox().

◆ ScreenBox() [4/4]

osmscout::ScreenBox::ScreenBox ( const Vertex2D & coordA,
const Vertex2D & coordB )

Initialize the GeoBox based on the given coordinates.

The two Coordinates together span a rectangular (in coordinates, not on the sphere) area.

Member Function Documentation

◆ GetCenter()

Vertex2D osmscout::ScreenBox::GetCenter ( ) const
inlinenodiscard

Returns the center coordinates of the box.

Returns
the center coordinates

Referenced by osmscout::MapPainterAgg::DrawSymbol(), and osmscout::SymbolRenderer::Render().

◆ GetHeight()

double osmscout::ScreenBox::GetHeight ( ) const
inlinenodiscard

◆ GetMaxX()

double osmscout::ScreenBox::GetMaxX ( ) const
inlinenodiscard

Referenced by Intersects().

◆ GetMaxY()

double osmscout::ScreenBox::GetMaxY ( ) const
inlinenodiscard

Referenced by Intersects().

◆ GetMinX()

double osmscout::ScreenBox::GetMinX ( ) const
inlinenodiscard

Referenced by Intersects().

◆ GetMinY()

double osmscout::ScreenBox::GetMinY ( ) const
inlinenodiscard

Referenced by Intersects().

◆ GetSize()

double osmscout::ScreenBox::GetSize ( ) const
inlinenodiscard

Returns the size of the screen box (width*height).

Returns
GetWidth()*GetHeight()

References GetHeight(), and GetWidth().

Referenced by IsEmpty().

◆ GetWidth()

double osmscout::ScreenBox::GetWidth ( ) const
inlinenodiscard

◆ Intersects() [1/2]

bool osmscout::ScreenBox::Intersects ( const ScreenBox & other) const
nodiscard

◆ Intersects() [2/2]

bool osmscout::ScreenBox::Intersects ( const ScreenBox & other,
bool openInterval ) const
nodiscard

◆ IsEmpty()

bool osmscout::ScreenBox::IsEmpty ( ) const
inlinenodiscard

Check if size of the screen box is zero.

Returns
GetSize()==0.0

References GetSize().

◆ Merge()

ScreenBox osmscout::ScreenBox::Merge ( const ScreenBox & other) const
nodiscard

◆ operator=() [1/2]

ScreenBox & osmscout::ScreenBox::operator= ( const ScreenBox & other)
default

Assign the value of other.

References ScreenBox().

◆ operator=() [2/2]

ScreenBox & osmscout::ScreenBox::operator= ( ScreenBox && other)
default

Move assignment operator.

References operator==(), and ScreenBox().

◆ operator==()

bool osmscout::ScreenBox::operator== ( const ScreenBox & other) const

Compare two values.

References ScreenBox().

Referenced by operator=().

◆ Resize()

ScreenBox osmscout::ScreenBox::Resize ( double offset) const
nodiscard

Resize the rectangle in all dimension using the given amount.

If offset is >=0 the resulting area will be bigger, else smaller.

If the reduction (negative offset) is bigger than width/2 or height/2, resulted screen box will have zero size (will be empty).

The size delta will be 2*offset in width and in height!

Parameters
offsetthe amount to change the coordinates.
Returns
the resulting ScreenBox

References GetHeight(), GetWidth(), and ScreenBox().

Referenced by osmscout::IsAreaRingVisible(), osmscout::MapPainter::IsVisibleArea(), and osmscout::MapPainter::IsVisibleWay().

Member Data Documentation

◆ EMPTY

const ScreenBox osmscout::ScreenBox::EMPTY
static

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