Marble::GeoDataLineString

Search for usage in LXR

#include <GeoDataLineString.h>

Inheritance diagram for Marble::GeoDataLineString:

Public Types

using ConstIterator = QVector<GeoDataCoordinates>::ConstIterator
 
using Iterator = QVector<GeoDataCoordinates>::Iterator
 

Public Member Functions

 GeoDataLineString (const GeoDataGeometry &other)
 
 GeoDataLineString (TessellationFlags f=NoTessellation)
 
 ~GeoDataLineString () override
 
void append (const GeoDataCoordinates &value)
 
void append (const QVector< GeoDataCoordinates > &values)
 
GeoDataCoordinatesat (int pos)
 
const GeoDataCoordinatesat (int pos) const
 
QVector< GeoDataCoordinates >::Iterator begin ()
 
QVector< GeoDataCoordinates >::ConstIterator begin () const
 
void clear ()
 
QVector< GeoDataCoordinates >::ConstIterator constBegin () const
 
QVector< GeoDataCoordinates >::ConstIterator constEnd () const
 
GeoDataGeometrycopy () const override
 
QVector< GeoDataCoordinates >::Iterator end ()
 
QVector< GeoDataCoordinates >::ConstIterator end () const
 
QVector< GeoDataCoordinates >::Iterator erase (const QVector< GeoDataCoordinates >::Iterator &begin, const QVector< GeoDataCoordinates >::Iterator &end)
 
QVector< GeoDataCoordinates >::Iterator erase (const QVector< GeoDataCoordinates >::Iterator &position)
 
GeoDataCoordinatesfirst ()
 
const GeoDataCoordinatesfirst () const
 
EnumGeometryId geometryId () const override
 
void insert (int index, const GeoDataCoordinates &value)
 
virtual bool isClosed () const
 
bool isEmpty () const
 
GeoDataCoordinateslast ()
 
const GeoDataCoordinateslast () const
 
const GeoDataLatLonAltBoxlatLonAltBox () const override
 
virtual qreal length (qreal planetRadius, int offset=0) const
 
GeoDataLineString mid (int pos, int length=-1) const
 
const char * nodeType () const override
 
bool operator!= (const GeoDataLineString &other) const
 
GeoDataLineStringoperator<< (const GeoDataCoordinates &value)
 
GeoDataLineStringoperator<< (const GeoDataLineString &lineString)
 
bool operator== (const GeoDataLineString &other) const
 
GeoDataCoordinatesoperator[] (int pos)
 
const GeoDataCoordinatesoperator[] (int pos) const
 
GeoDataLineString optimized () const
 
void pack (QDataStream &stream) const override
 
void remove (int i)
 
void reserve (int size)
 
void reverse ()
 
void setTessellate (bool tessellate)
 
void setTessellationFlags (TessellationFlags f)
 
int size () const
 
bool tessellate () const
 
TessellationFlags tessellationFlags () const
 
virtual QVector< GeoDataLineString * > toDateLineCorrected () const
 
virtual GeoDataLineString toNormalized () const
 
virtual GeoDataLineString toPoleCorrected () const
 
virtual GeoDataLineString toRangeCorrected () const
 
QVariantList toVariantList () const
 
void unpack (QDataStream &stream) override
 
- Public Member Functions inherited from Marble::GeoDataGeometry
AltitudeMode altitudeMode () const
 
void detach ()
 
bool extrude () const
 
bool operator!= (const GeoDataGeometry &other) const
 
bool operator== (const GeoDataGeometry &other) const
 
void pack (QDataStream &stream) const override
 
void setAltitudeMode (const AltitudeMode altitudeMode)
 
void setExtrude (bool extrude)
 
void unpack (QDataStream &stream) override
 
- Public Member Functions inherited from Marble::GeoDataObject
 GeoDataObject (const GeoDataObject &)
 
QString id () const
 
GeoDataObjectoperator= (const GeoDataObject &)
 
void pack (QDataStream &stream) const override
 
GeoDataObjectparent ()
 
const GeoDataObjectparent () const
 
QString resolvePath (const QString &relativePath) const
 
void setId (const QString &value)
 
void setParent (GeoDataObject *parent)
 
void setTargetId (const QString &value)
 
QString targetId () const
 
void unpack (QDataStream &steam) override
 

Protected Member Functions

 GeoDataLineString (GeoDataLineStringPrivate *priv)
 
- Protected Member Functions inherited from Marble::GeoDataGeometry
 GeoDataGeometry (const GeoDataGeometry &other)
 
 GeoDataGeometry (GeoDataGeometryPrivate *priv)
 
bool equals (const GeoDataGeometry &other) const
 
virtual bool equals (const GeoDataObject &other) const
 
GeoDataGeometryoperator= (const GeoDataGeometry &other)
 

Additional Inherited Members

- Protected Attributes inherited from Marble::GeoDataGeometry
GeoDataGeometryPrivate * d_ptr
 

Detailed Description

A LineString that allows to store a contiguous set of line segments.

GeoDataLineString is a tool class that implements the LineString tag/class of the Open Geospatial Consortium standard KML 2.2.

GeoDataLineString extends GeoDataGeometry to store and edit LineStrings.

In the QPainter API "pure" LineStrings are also referred to as "polylines". As such they are similar to the outline of a non-closed QPolygon.

Whenever a LineString is painted GeoDataLineStyle should be used to assign a color and line width.

A GeoDataLineString consists of several (geodetic) nodes which are each connected through line segments. The nodes are stored as GeoDataCoordinates objects.

The API which provides access to the nodes is similar to the API of QVector.

GeoDataLineString allows LineStrings to be tessellated in order to make them follow the terrain and the curvature of the earth. The tessellation options allow for different ways of visualization:

  • Not tessellated: A LineString that connects each two nodes directly and straight in screen coordinate space.
  • A tessellated line: Each line segment is bent so that the LineString follows the curvature of the earth and its terrain. A tessellated line segment connects two nodes at the shortest possible distance ("along great circles").
  • A tessellated line that follows latitude circles whenever possible: In this case Latitude circles are followed as soon as two subsequent nodes have exactly the same amount of latitude. In all other places the line segments follow great circles.

Some convenience methods have been added that allow to calculate the geodesic bounding box or the length of a LineString.

Definition at line 67 of file GeoDataLineString.h.

Member Typedef Documentation

◆ ConstIterator

using Marble::GeoDataLineString::ConstIterator = QVector<GeoDataCoordinates>::ConstIterator

Definition at line 72 of file GeoDataLineString.h.

◆ Iterator

using Marble::GeoDataLineString::Iterator = QVector<GeoDataCoordinates>::Iterator

Definition at line 71 of file GeoDataLineString.h.

Constructor & Destructor Documentation

◆ GeoDataLineString() [1/3]

Marble::GeoDataLineString::GeoDataLineString ( TessellationFlags f = NoTessellation)
explicit

Creates a new LineString.

Definition at line 21 of file GeoDataLineString.cpp.

◆ GeoDataLineString() [2/3]

Marble::GeoDataLineString::GeoDataLineString ( const GeoDataGeometry & other)
explicit

Creates a LineString from an existing geometry object.

Definition at line 33 of file GeoDataLineString.cpp.

◆ ~GeoDataLineString()

Marble::GeoDataLineString::~GeoDataLineString ( )
override

Destroys a LineString.

Definition at line 39 of file GeoDataLineString.cpp.

◆ GeoDataLineString() [3/3]

Marble::GeoDataLineString::GeoDataLineString ( GeoDataLineStringPrivate * priv)
explicitprotected

Definition at line 27 of file GeoDataLineString.cpp.

Member Function Documentation

◆ append() [1/2]

void Marble::GeoDataLineString::append ( const GeoDataCoordinates & value)

Appends a given geodesic position as a new node to the LineString.

Definition at line 391 of file GeoDataLineString.cpp.

◆ append() [2/2]

void Marble::GeoDataLineString::append ( const QVector< GeoDataCoordinates > & values)

Appends a given geodesic position as new nodes to the LineString.

Definition at line 409 of file GeoDataLineString.cpp.

◆ at() [1/2]

GeoDataCoordinates & Marble::GeoDataLineString::at ( int pos)

Returns a reference to the coordinates of a node at a given position. This method detaches the returned coordinate object from the line string.

Definition at line 265 of file GeoDataLineString.cpp.

◆ at() [2/2]

const GeoDataCoordinates & Marble::GeoDataLineString::at ( int pos) const

Returns a reference to the coordinates of a node at a given position. This method does not detach the returned coordinate object from the line string.

Definition at line 275 of file GeoDataLineString.cpp.

◆ begin() [1/2]

QVector< GeoDataCoordinates >::Iterator Marble::GeoDataLineString::begin ( )

Returns an iterator that points to the begin of the LineString.

Definition at line 339 of file GeoDataLineString.cpp.

◆ begin() [2/2]

QVector< GeoDataCoordinates >::ConstIterator Marble::GeoDataLineString::begin ( ) const

Definition at line 347 of file GeoDataLineString.cpp.

◆ clear()

void Marble::GeoDataLineString::clear ( )

Destroys all nodes in a LineString.

Definition at line 487 of file GeoDataLineString.cpp.

◆ constBegin()

QVector< GeoDataCoordinates >::ConstIterator Marble::GeoDataLineString::constBegin ( ) const

Returns a const iterator that points to the begin of the LineString.

Definition at line 367 of file GeoDataLineString.cpp.

◆ constEnd()

QVector< GeoDataCoordinates >::ConstIterator Marble::GeoDataLineString::constEnd ( ) const

Returns a const iterator that points to the end of the LineString.

Definition at line 373 of file GeoDataLineString.cpp.

◆ copy()

GeoDataGeometry * Marble::GeoDataLineString::copy ( ) const
overridevirtual

Implements Marble::GeoDataGeometry.

Definition at line 56 of file GeoDataLineString.cpp.

◆ end() [1/2]

QVector< GeoDataCoordinates >::Iterator Marble::GeoDataLineString::end ( )

Returns an iterator that points to the end of the LineString.

Definition at line 353 of file GeoDataLineString.cpp.

◆ end() [2/2]

QVector< GeoDataCoordinates >::ConstIterator Marble::GeoDataLineString::end ( ) const

Definition at line 361 of file GeoDataLineString.cpp.

◆ erase() [1/2]

QVector< GeoDataCoordinates >::Iterator Marble::GeoDataLineString::erase ( const QVector< GeoDataCoordinates >::Iterator & begin,
const QVector< GeoDataCoordinates >::Iterator & end )

Removes the nodes within the given range and returns them.

Definition at line 841 of file GeoDataLineString.cpp.

◆ erase() [2/2]

QVector< GeoDataCoordinates >::Iterator Marble::GeoDataLineString::erase ( const QVector< GeoDataCoordinates >::Iterator & position)

Removes the node at the given position and returns it.

Definition at line 829 of file GeoDataLineString.cpp.

◆ first() [1/2]

GeoDataCoordinates & Marble::GeoDataLineString::first ( )

Returns a reference to the first node in the LineString. This method detaches the returned coordinate object from the line string.

Definition at line 319 of file GeoDataLineString.cpp.

◆ first() [2/2]

const GeoDataCoordinates & Marble::GeoDataLineString::first ( ) const

Returns a reference to the first node in the LineString. This method does not detach the returned coordinate object from the line string.

Definition at line 333 of file GeoDataLineString.cpp.

◆ geometryId()

EnumGeometryId Marble::GeoDataLineString::geometryId ( ) const
overridevirtual

Implements Marble::GeoDataGeometry.

Definition at line 51 of file GeoDataLineString.cpp.

◆ insert()

void Marble::GeoDataLineString::insert ( int index,
const GeoDataCoordinates & value )

Inserts a new node at the given index.

Definition at line 379 of file GeoDataLineString.cpp.

◆ isClosed()

bool Marble::GeoDataLineString::isClosed ( ) const
virtual

Returns whether a LineString is a closed polygon.

Returns
false if the LineString is not a LinearRing.

Reimplemented in Marble::GeoDataLinearRing.

Definition at line 500 of file GeoDataLineString.cpp.

◆ isEmpty()

bool Marble::GeoDataLineString::isEmpty ( ) const

Returns whether the LineString has no nodes at all.

Returns
true if there are no nodes inside the line string.

Definition at line 253 of file GeoDataLineString.cpp.

◆ last() [1/2]

GeoDataCoordinates & Marble::GeoDataLineString::last ( )

Returns a reference to the last node in the LineString. This method detaches the returned coordinate object from the line string.

Definition at line 309 of file GeoDataLineString.cpp.

◆ last() [2/2]

const GeoDataCoordinates & Marble::GeoDataLineString::last ( ) const

Returns a reference to the last node in the LineString. This method does not detach the returned coordinate object from the line string.

Definition at line 327 of file GeoDataLineString.cpp.

◆ latLonAltBox()

const GeoDataLatLonAltBox & Marble::GeoDataLineString::latLonAltBox ( ) const
overridevirtual

Returns the smallest latLonAltBox that contains the LineString.

See also
GeoDataLatLonAltBox

Reimplemented from Marble::GeoDataGeometry.

Definition at line 794 of file GeoDataLineString.cpp.

◆ length()

qreal Marble::GeoDataLineString::length ( qreal planetRadius,
int offset = 0 ) const
virtual

Returns the length of LineString across a sphere starting from a coordinate in LineString This method can be used as an approximation for distances along LineStrings.

The unit used for the resulting length matches the unit of the planet radius.

Parameters
planetRadiusradius of the sphere
offsetposition of coordinate within LineString

Reimplemented in Marble::GeoDataLinearRing.

Definition at line 810 of file GeoDataLineString.cpp.

◆ mid()

GeoDataLineString Marble::GeoDataLineString::mid ( int pos,
int length = -1 ) const

Returns a sub-string which contains elements from this vector, starting at position pos.

If length is -1 (the default), all elements after pos are included; otherwise length elements (or all remaining elements if there are less than length elements) are included.

Definition at line 291 of file GeoDataLineString.cpp.

◆ nodeType()

const char * Marble::GeoDataLineString::nodeType ( ) const
overridevirtual

Provides type information for downcasting a GeoNode.

Implements Marble::GeoNode.

Definition at line 46 of file GeoDataLineString.cpp.

◆ operator!=()

bool Marble::GeoDataLineString::operator!= ( const GeoDataLineString & other) const

Definition at line 482 of file GeoDataLineString.cpp.

◆ operator<<() [1/2]

GeoDataLineString & Marble::GeoDataLineString::operator<< ( const GeoDataCoordinates & value)

Appends a given geodesic position as a new node to the LineString.

Definition at line 422 of file GeoDataLineString.cpp.

◆ operator<<() [2/2]

GeoDataLineString & Marble::GeoDataLineString::operator<< ( const GeoDataLineString & lineString)

Appends a given LineString to the end of the LineString.

Definition at line 435 of file GeoDataLineString.cpp.

◆ operator==()

bool Marble::GeoDataLineString::operator== ( const GeoDataLineString & other) const

Returns true/false depending on whether this and other are/are not equal.

Definition at line 456 of file GeoDataLineString.cpp.

◆ operator[]() [1/2]

GeoDataCoordinates & Marble::GeoDataLineString::operator[] ( int pos)

Returns a reference to the coordinates of a node at a given position. This method detaches the returned coordinate object from the line string.

Definition at line 281 of file GeoDataLineString.cpp.

◆ operator[]() [2/2]

const GeoDataCoordinates & Marble::GeoDataLineString::operator[] ( int pos) const

Returns a reference to the coordinates of a node at a given position. This method does not detach the returned coordinate object from the line string.

Definition at line 303 of file GeoDataLineString.cpp.

◆ optimized()

GeoDataLineString Marble::GeoDataLineString::optimized ( ) const

Returns a linestring with detail values assigned to each node.

Definition at line 864 of file GeoDataLineString.cpp.

◆ pack()

void Marble::GeoDataLineString::pack ( QDataStream & stream) const
override

Serialize the LineString to a stream.

Parameters
streamthe stream.

Definition at line 903 of file GeoDataLineString.cpp.

◆ remove()

void Marble::GeoDataLineString::remove ( int i)

Removes the node at the given position and destroys it.

Definition at line 854 of file GeoDataLineString.cpp.

◆ reserve()

void Marble::GeoDataLineString::reserve ( int size)

Attempts to allocate memory for at least size coordinates.

Definition at line 403 of file GeoDataLineString.cpp.

◆ reverse()

void Marble::GeoDataLineString::reverse ( )

Reverses the LineString.

Since
0.26.0

Definition at line 542 of file GeoDataLineString.cpp.

◆ setTessellate()

void Marble::GeoDataLineString::setTessellate ( bool tessellate)

Sets the tessellation property for the LineString.

If tessellate is true then the LineString's line segments are bent and follow the earth's surface and terrain along great circles. If tessellate is false then the LineString's line segments are rendered as straight lines in screen coordinate space.

Definition at line 511 of file GeoDataLineString.cpp.

◆ setTessellationFlags()

void Marble::GeoDataLineString::setTessellationFlags ( TessellationFlags f)

Sets the given tessellation flags for a LineString.

Definition at line 534 of file GeoDataLineString.cpp.

◆ size()

int Marble::GeoDataLineString::size ( ) const

Returns the number of nodes in a LineString.

Definition at line 259 of file GeoDataLineString.cpp.

◆ tessellate()

bool Marble::GeoDataLineString::tessellate ( ) const

Returns whether the LineString follows the earth's surface.

Returns
true if the LineString's line segments follow the earth's surface and terrain along great circles.

Definition at line 505 of file GeoDataLineString.cpp.

◆ tessellationFlags()

TessellationFlags Marble::GeoDataLineString::tessellationFlags ( ) const

Returns the tessellation flags for a LineString.

Definition at line 528 of file GeoDataLineString.cpp.

◆ toDateLineCorrected()

QVector< GeoDataLineString * > Marble::GeoDataLineString::toDateLineCorrected ( ) const
virtual

The line string corrected for date line crossing.

Returns
A set of LineStrings that don't cross the dateline and which resemble the original linestring.

Deprecation Warning: This method will likely be removed from the public API.

Definition at line 604 of file GeoDataLineString.cpp.

◆ toNormalized()

GeoDataLineString Marble::GeoDataLineString::toNormalized ( ) const
virtual

The line string with nodes that have proper longitude/latitude ranges.

Returns
A LineString that resembles the original linestring with nodes that have longitude values between -180 and +180 deg and that feature latitude values between -90 and +90 deg.

Deprecation Warning: This method will likely be removed from the public API.

Definition at line 554 of file GeoDataLineString.cpp.

◆ toPoleCorrected()

GeoDataLineString Marble::GeoDataLineString::toPoleCorrected ( ) const
virtual

The line string with more generic pole values.

Returns
A LineString that resembles the original linestring. Nodes that represent one of the poles are duplicated to allow for a better visualization of flat projections.

Deprecation Warning: This method will likely be removed from the public API.

Definition at line 615 of file GeoDataLineString.cpp.

◆ toRangeCorrected()

GeoDataLineString Marble::GeoDataLineString::toRangeCorrected ( ) const
virtual

Provides a more generic representation of the LineString.

The LineString is normalized, and pole corrected.

Deprecation Warning: This method will likely be removed from the public API.

Definition at line 585 of file GeoDataLineString.cpp.

◆ toVariantList()

QVariantList Marble::GeoDataLineString::toVariantList ( ) const

Returns a javascript-style list (that can be used e.g. with the QML GeoPolyline element).

Definition at line 879 of file GeoDataLineString.cpp.

◆ unpack()

void Marble::GeoDataLineString::unpack ( QDataStream & stream)
override

Unserialize the LineString from a stream.

Parameters
streamthe stream.

Definition at line 923 of file GeoDataLineString.cpp.


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 Tue Mar 26 2024 11:18:18 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.