LuciadCPillar 2023.1.04
luciad::MapScale Struct Referencefinal

This class represents a map scale, a ratio of a distance on the map to the corresponding actual distance. More...

#include <luciad/maps/MapScale.h>

Public Member Functions

constexpr MapScale (double value)
 Creates a new MapScale based on the given ratio. More...
 
double getDenominator () const
 Returns the denominator of this map scale. More...
 
double getValue () const
 Returns the scale value. More...
 
 operator double () const
 Returns this map scale value as a double value. More...
 
bool operator!= (const MapScale &other) const
 
bool operator< (const MapScale &other) const
 
bool operator<= (const MapScale &other) const
 
bool operator== (const MapScale &other) const
 
bool operator> (const MapScale &other) const
 
bool operator>= (const MapScale &other) const
 
MapScale zoomIn (double factor) const
 Creates a new MapScale which is zoomed in with a given factor. More...
 
MapScale zoomOut (double factor) const
 Creates a new MapScale which is zoomed outn with a given factor. More...
 

Static Public Member Functions

static constexpr MapScale fromDenominator (double denominator)
 Creates a map scale from a denominator value. More...
 
static const MapScalemaxZoomedIn ()
 The value that represents a maximally zoomed in map scale (1:0 ≈ the maximum double value) More...
 
static const MapScalemaxZoomedOut ()
 The value that represents a maximally zoomed out map scale (1:inf == 0) More...
 

Detailed Description

This class represents a map scale, a ratio of a distance on the map to the corresponding actual distance.

For example: a map scale of 1:50000 means that 1 centimeter on a map corresponds with 500 meters on the ground.

This class gives a natural ordering to map scales, from zoomed out to zoomed in. When a part of the API takes an ordered collection as input, it must be ordered according to this natural ordering (unless stated otherwise).

In order for a Map instance to interpret MapScale values correctly, it needs to know the DPI (see Map::getDpi) value of the screen on which it is rendered.

See also the related article

Constructor & Destructor Documentation

◆ MapScale()

constexpr luciad::MapScale::MapScale ( double  value)
inlineconstexpr

Creates a new MapScale based on the given ratio.

Parameters
valuea value that represents 1 / denominator. For example: a MapScale of 1:50000 can be created using 0.00002 (=1/50000) as value.
Exceptions
luciad::InvalidArgumentExceptionwhen the map scale is smaller than 0.

Member Function Documentation

◆ fromDenominator()

static constexpr MapScale luciad::MapScale::fromDenominator ( double  denominator)
inlinestaticconstexpr

Creates a map scale from a denominator value.

For example when using 1:50000 as map scale, the denominator is 50000.

Parameters
denominatorthe scale denominator.
Returns
a map scale that corresponds to 1:denominator
Exceptions
luciad::InvalidArgumentExceptionwhen the denominator is negative.

◆ getDenominator()

double luciad::MapScale::getDenominator ( ) const
inline

Returns the denominator of this map scale.

For example when the Map Scale is 1:50000, this method returns 50000.

Returns
the denominator of this map scale.

◆ getValue()

double luciad::MapScale::getValue ( ) const
inline

Returns the scale value.

Returns
the scale value.

◆ maxZoomedIn()

static const MapScale & luciad::MapScale::maxZoomedIn ( )
static

The value that represents a maximally zoomed in map scale (1:0 ≈ the maximum double value)

◆ maxZoomedOut()

static const MapScale & luciad::MapScale::maxZoomedOut ( )
static

The value that represents a maximally zoomed out map scale (1:inf == 0)

◆ operator double()

luciad::MapScale::operator double ( ) const
inline

Returns this map scale value as a double value.

For example when the map scale is 1:50000, this method returns 0.00002.

Returns
this map scale value as a double value.

◆ operator!=()

bool luciad::MapScale::operator!= ( const MapScale other) const
inline

◆ operator<()

bool luciad::MapScale::operator< ( const MapScale other) const
inline

◆ operator<=()

bool luciad::MapScale::operator<= ( const MapScale other) const
inline

◆ operator==()

bool luciad::MapScale::operator== ( const MapScale other) const
inline

◆ operator>()

bool luciad::MapScale::operator> ( const MapScale other) const
inline

◆ operator>=()

bool luciad::MapScale::operator>= ( const MapScale other) const
inline

◆ zoomIn()

MapScale luciad::MapScale::zoomIn ( double  factor) const
inline

Creates a new MapScale which is zoomed in with a given factor.

For example, when applying this method on a 1:50000 scale, with a factor or 2, the resulting map scale will be 1:25000.

Parameters
factorthe factor using which to zoom in
Returns
a new map scale that is zoomed in using the given factor.

◆ zoomOut()

MapScale luciad::MapScale::zoomOut ( double  factor) const
inline

Creates a new MapScale which is zoomed outn with a given factor.

For example, when applying this method on a 1:50000 scale, with a factor or 2, the resulting map scale will be 1:100000.

Parameters
factorthe factor using which to zoom out
Returns
a new map scale that is zoomed out using the given factor.