OSM::Element

Search for usage in LXR

OSM::Element Class Reference

#include <element.h>

Public Member Functions

 Element (const Node *node)
 
 Element (const Relation *relation)
 
 Element (const Way *way)
 
BoundingBox boundingBox () const
 
Coordinate center () const
 
bool hasTag (TagKey key) const
 
bool hasTags () const
 
Id id () const
 
const Nodenode () const
 
 operator bool () const
 
bool operator!= (Element other) const
 
bool operator< (Element other) const
 
bool operator== (Element other) const
 
std::vector< const Node * > outerPath (const DataSet &dataSet) const
 
void recomputeBoundingBox (const DataSet &dataSet)
 
const Relationrelation () const
 
std::vector< Tag >::const_iterator tagsBegin () const
 
std::vector< Tag >::const_iterator tagsEnd () const
 
QByteArray tagValue (const char *keyName) const
 
QByteArray tagValue (const OSM::Languages &languages, const char *keyName) const
 
template<typename K , typename ... Args>
QByteArray tagValue (const OSM::Languages &languages, K key, Args... args) const
 
template<typename K , typename ... Args>
QByteArray tagValue (K key, Args... args) const
 
QByteArray tagValue (TagKey key) const
 
Type type () const
 
QString url () const
 
const Wayway () const
 

Detailed Description

A reference to any of OSM::Node/OSM::Way/OSM::Relation.

Lifetime of the referenced object needs to extend beyond the lifetime of this.

Definition at line 23 of file element.h.

Constructor & Destructor Documentation

◆ Element() [1/4]

OSM::Element::Element ( )
inlineconstexpr

Definition at line 26 of file element.h.

◆ Element() [2/4]

OSM::Element::Element ( const Node * node)
inline

Definition at line 27 of file element.h.

◆ Element() [3/4]

OSM::Element::Element ( const Way * way)
inline

Definition at line 28 of file element.h.

◆ Element() [4/4]

OSM::Element::Element ( const Relation * relation)
inline

Definition at line 29 of file element.h.

Member Function Documentation

◆ boundingBox()

BoundingBox Element::boundingBox ( ) const
nodiscard

Definition at line 46 of file element.cpp.

◆ center()

Coordinate Element::center ( ) const
nodiscard

Definition at line 29 of file element.cpp.

◆ hasTag()

bool Element::hasTag ( TagKey key) const
nodiscard

Returns true if this element has a tag with key key.

Definition at line 114 of file element.cpp.

◆ hasTags()

bool OSM::Element::hasTags ( ) const
inlinenodiscard

Returns whether or not this element has any tags set.

Definition at line 53 of file element.h.

◆ id()

Id Element::id ( ) const
nodiscard

Definition at line 12 of file element.cpp.

◆ node()

const Node * OSM::Element::node ( ) const
inlinenodiscard

Definition at line 37 of file element.h.

◆ operator bool()

OSM::Element::operator bool ( ) const
inlineexplicitnodiscard

Definition at line 34 of file element.h.

◆ operator!=()

bool OSM::Element::operator!= ( Element other) const
inlinenodiscard

Definition at line 32 of file element.h.

◆ operator<()

bool OSM::Element::operator< ( Element other) const
inlinenodiscard

Definition at line 33 of file element.h.

◆ operator==()

bool OSM::Element::operator== ( Element other) const
inlinenodiscard

Definition at line 31 of file element.h.

◆ outerPath()

std::vector< const Node * > Element::outerPath ( const DataSet & dataSet) const
nodiscard

Returns all nodes belonging to the outer path of this element.

In the simplest case that's a single closed polygon, but it can also be a sequence of multiple closed loop polygons, or a polyline.

Definition at line 166 of file element.cpp.

◆ recomputeBoundingBox()

void Element::recomputeBoundingBox ( const DataSet & dataSet)

Recompute the bounding box of this element.

We usually assume those to be provided by Overpass/osmconvert, but there seem to be cases where those aren't reliable.

Definition at line 207 of file element.cpp.

◆ relation()

const Relation * OSM::Element::relation ( ) const
inlinenodiscard

Definition at line 39 of file element.h.

◆ tagsBegin()

std::vector< Tag >::const_iterator OSM::Element::tagsBegin ( ) const
nodiscard

Definition at line 119 of file element.cpp.

◆ tagsEnd()

std::vector< Tag >::const_iterator OSM::Element::tagsEnd ( ) const
nodiscard

Definition at line 134 of file element.cpp.

◆ tagValue() [1/5]

QByteArray Element::tagValue ( const char * keyName) const
nodiscard

Definition at line 80 of file element.cpp.

◆ tagValue() [2/5]

QByteArray Element::tagValue ( const OSM::Languages & languages,
const char * keyName ) const
nodiscard

Definition at line 97 of file element.cpp.

◆ tagValue() [3/5]

template<typename K , typename ... Args>
QByteArray OSM::Element::tagValue ( const OSM::Languages & languages,
K key,
Args... args ) const
nodiscard

Definition at line 88 of file element.h.

◆ tagValue() [4/5]

template<typename K , typename ... Args>
QByteArray OSM::Element::tagValue ( K key,
Args... args ) const
nodiscard

Returns the value of the first non-empty tag.

Both OSM::TagKey (fast) and const char* (slow) keys are accepted.

Definition at line 78 of file element.h.

◆ tagValue() [5/5]

QByteArray Element::tagValue ( TagKey key) const
nodiscard

Definition at line 63 of file element.cpp.

◆ type()

Type OSM::Element::type ( ) const
inlinenodiscard

Definition at line 36 of file element.h.

◆ url()

QString Element::url ( ) const
nodiscard

Definition at line 149 of file element.cpp.

◆ way()

const Way * OSM::Element::way ( ) const
inlinenodiscard

Definition at line 38 of file element.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:17:55 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.