/usr/include/marble/GeoDataLineString.h is in libmarble-dev 4:17.12.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 | //
// This file is part of the Marble Virtual Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2008-2009 Torsten Rahn <tackat@kde.org>
// Copyright 2009 Patrick Spendrin <ps_ml@gmx.de>
//
#ifndef MARBLE_GEODATALINESTRING_H
#define MARBLE_GEODATALINESTRING_H
#include <QVector>
#include <QMetaType>
#include "MarbleGlobal.h"
#include "geodata_export.h"
#include "GeoDataGeometry.h"
namespace Marble
{
class GeoDataCoordinates;
class GeoDataLineStringPrivate;
/*!
\class GeoDataLineString
\brief 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:
\li Not tessellated: A LineString that connects each two nodes directly and
straight in screen coordinate space.
\li 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").
\li 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.
*/
class GEODATA_EXPORT GeoDataLineString : public GeoDataGeometry
{
public:
typedef QVector<GeoDataCoordinates>::Iterator Iterator;
typedef QVector<GeoDataCoordinates>::ConstIterator ConstIterator;
typedef QVector<GeoDataCoordinates>::const_iterator const_iterator;
/*!
\brief Creates a new LineString.
*/
explicit GeoDataLineString( TessellationFlags f = NoTessellation );
/*!
\brief Creates a LineString from an existing geometry object.
*/
explicit GeoDataLineString( const GeoDataGeometry &other );
/*!
\brief Destroys a LineString.
*/
~GeoDataLineString() override;
const char *nodeType() const override;
EnumGeometryId geometryId() const override;
GeoDataGeometry *copy() const override;
/*!
\brief Returns whether a LineString is a closed polygon.
\return <code>false</code> if the LineString is not a LinearRing.
*/
virtual bool isClosed() const;
/*!
\brief Returns whether the LineString follows the earth's surface.
\return <code>true</code> if the LineString's line segments follow the
earth's surface and terrain along great circles.
*/
bool tessellate() const;
/*!
\brief Sets the tessellation property for the LineString.
If \a tessellate is <code>true</code> then the LineString's line segments
are bent and follow the earth's surface and terrain along great circles.
If \a tessellate is <code>false</code> then the LineString's line segments
are rendered as straight lines in screen coordinate space.
*/
void setTessellate( bool tessellate );
/*!
\brief Returns the tessellation flags for a LineString.
*/
TessellationFlags tessellationFlags() const;
/*!
\brief Sets the given tessellation flags for a LineString.
*/
void setTessellationFlags( TessellationFlags f );
/*!
\brief Reverses the LineString.
@since 0.26.0
*/
void reverse();
/*!
\brief Returns the smallest latLonAltBox that contains the LineString.
\see GeoDataLatLonAltBox
*/
const GeoDataLatLonAltBox& latLonAltBox() const override;
/**
* @brief 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.
* @param planetRadius radius of the sphere
* @param offset position of coordinate within LineString
*/
virtual qreal length( qreal planetRadius, int offset = 0 ) const;
/*!
\brief 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.
*/
virtual GeoDataLineString toRangeCorrected() const;
/*!
\brief The line string with nodes that have proper longitude/latitude ranges.
\return 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.
*/
virtual GeoDataLineString toNormalized() const;
/*!
\brief The line string with more generic pole values.
\return 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.
*/
virtual GeoDataLineString toPoleCorrected() const;
/*!
\brief The line string corrected for date line crossing.
\return 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.
*/
virtual QVector<GeoDataLineString*> toDateLineCorrected() const;
// "Reimplementation" of QVector API
/*!
\brief Returns whether the LineString has no nodes at all.
\return <code>true</code> if there are no nodes inside the line string.
*/
bool isEmpty() const;
/*!
\brief Returns the number of nodes in a LineString.
*/
int size() const;
/*!
\brief Returns a reference to the coordinates of a node at a given position.
This method detaches the returned coordinate object from the line string.
*/
GeoDataCoordinates& at( int pos );
/*!
\brief 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.
*/
const GeoDataCoordinates& at( int pos ) const;
/*!
\brief Returns a reference to the coordinates of a node at a given position.
This method detaches the returned coordinate object from the line string.
*/
GeoDataCoordinates& operator[]( int pos );
/**
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.
*/
GeoDataLineString mid(int pos, int length = -1) const;
/*!
\brief 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.
*/
const GeoDataCoordinates& operator[]( int pos ) const;
/*!
\brief Returns a reference to the first node in the LineString.
This method detaches the returned coordinate object from the line string.
*/
GeoDataCoordinates& first();
/*!
\brief Returns a reference to the first node in the LineString.
This method does not detach the returned coordinate object from the line string.
*/
const GeoDataCoordinates& first() const;
/*!
\brief Returns a reference to the last node in the LineString.
This method detaches the returned coordinate object from the line string.
*/
GeoDataCoordinates& last();
/*!
\brief Returns a reference to the last node in the LineString.
This method does not detach the returned coordinate object from the line string.
*/
const GeoDataCoordinates& last() const;
/*!
\brief Inserts a new node at the given index.
*/
void insert( int index, const GeoDataCoordinates& value );
/*!
\brief Attempts to allocate memory for at least \a size coordinates.
*/
void reserve(int size);
/*!
\brief Appends a given geodesic position as a new node to the LineString.
*/
void append ( const GeoDataCoordinates& value );
/*!
\brief Appends a given geodesic position as new nodes to the LineString.
*/
void append(const QVector<GeoDataCoordinates>& values);
/*!
\brief Appends a given geodesic position as a new node to the LineString.
*/
GeoDataLineString& operator << ( const GeoDataCoordinates& value );
/*!
\brief Appends a given LineString to the end of the LineString.
*/
GeoDataLineString& operator << ( const GeoDataLineString& lineString );
/*!
\brief Returns true/false depending on whether this and other are/are not equal.
*/
bool operator==( const GeoDataLineString &other ) const;
bool operator!=( const GeoDataLineString &other ) const;
/*!
\brief Returns an iterator that points to the begin of the LineString.
*/
QVector<GeoDataCoordinates>::Iterator begin();
QVector<GeoDataCoordinates>::ConstIterator begin() const;
/*!
\brief Returns an iterator that points to the end of the LineString.
*/
QVector<GeoDataCoordinates>::Iterator end();
QVector<GeoDataCoordinates>::ConstIterator end() const;
/*!
\brief Returns a const iterator that points to the begin of the LineString.
*/
QVector<GeoDataCoordinates>::ConstIterator constBegin() const;
/*!
\brief Returns a const iterator that points to the end of the LineString.
*/
QVector<GeoDataCoordinates>::ConstIterator constEnd() const;
/*!
\brief Destroys all nodes in a LineString.
*/
void clear();
/*!
\brief Removes the node at the given position and returns it.
*/
QVector<GeoDataCoordinates>::Iterator erase ( const QVector<GeoDataCoordinates>::Iterator& position );
/*!
\brief Removes the nodes within the given range and returns them.
*/
QVector<GeoDataCoordinates>::Iterator erase ( const QVector<GeoDataCoordinates>::Iterator& begin,
const QVector<GeoDataCoordinates>::Iterator& end );
/*!
\brief Removes the node at the given position and destroys it.
*/
void remove ( int i );
/*!
\brief Returns a linestring with detail values assigned to each node.
*/
GeoDataLineString optimized() const;
// Serialization
/*!
\brief Serialize the LineString to a stream.
\param stream the stream.
*/
void pack( QDataStream& stream ) const override;
/*!
\brief Unserialize the LineString from a stream.
\param stream the stream.
*/
void unpack( QDataStream& stream ) override;
protected:
explicit GeoDataLineString(GeoDataLineStringPrivate* priv);
private:
Q_DECLARE_PRIVATE(GeoDataLineString)
};
}
Q_DECLARE_METATYPE( Marble::GeoDataLineString )
#endif
|