![]() |
Mapper
0.9.0
API documentation
|
A VirtualPath class represents a single path out of a sequence of coords and flags. More...
#include <virtual_path.h>
Public Types | |
using | size_type = VirtualCoordVector::size_type |
A reaonably sized unsigned integer type for coord vector sizes and indexes. More... | |
Public Member Functions | |
VirtualPath (const MapCoordVector &coords) | |
VirtualPath (const MapCoordVector &coords, size_type first, size_type last) | |
VirtualPath (const VirtualCoordVector &coords) | |
VirtualPath (const VirtualCoordVector &coords, size_type first, size_type last) | |
VirtualPath (const MapCoordVector &flags, const MapCoordVectorF &coords) | |
VirtualPath (const MapCoordVector &flags, const MapCoordVectorF &coords, size_type first, size_type last) | |
VirtualPath (const VirtualPath &)=default | |
VirtualPath (VirtualPath &&)=default | |
bool | empty () const |
Returns true if there are no nodes in this path. More... | |
size_type | size () const |
Returns the number of coordinates in this path. More... | |
size_type | countRegularNodes () const |
Calculates the number of regular nodes in this path. More... | |
bool | isClosed () const |
Returns true if the path is closed. More... | |
PathCoord::length_type | length () const |
Returns the length of the path. More... | |
double | calculateArea () const |
Calculates the area of this part. More... | |
QRectF | calculateExtent () const |
bool | intersectsBox (const QRectF &box) const |
bool | isPointInside (const MapCoordF &coord) const |
PathCoord | findClosestPointTo (MapCoordF coord, float &distance_squared, float distance_bound_squared, size_type start_index, size_type end_index) const |
size_type | prevCoordIndex (size_type base_index) const |
Determines the index of the previous regular coordinate. More... | |
size_type | nextCoordIndex (size_type base_index) const |
Determines the index of the next regular coordinate. More... | |
MapCoordF | calculateTangent (size_type i) const |
std::pair< MapCoordF, double > | calculateTangentScaling (size_type i) const |
MapCoordF | calculateTangent (size_type i, bool backward, bool &ok) const |
Calculates the path tangent at the given MapCoord index. More... | |
MapCoordF | calculateIncomingTangent (size_type i, bool &ok) const |
Similar to calculateTangent(). More... | |
MapCoordF | calculateOutgoingTangent (size_type i, bool &ok) const |
Similar to calculateTangent(). More... | |
void | copy (const SplitPathCoord &first, const SplitPathCoord &last, MapCoordVector &out_coords) const |
void | copy (const SplitPathCoord &first, const SplitPathCoord &last, MapCoordVector &out_flags, MapCoordVectorF &out_coords) const |
void | copyLengths (const SplitPathCoord &first, const SplitPathCoord &last, std::vector< PathCoord::length_type > &out_lengths) const |
Public Attributes | |
VirtualCoordVector | coords |
The underlying coordinates and flags. More... | |
PathCoordVector | path_coords |
The derived flattened coordinates and meta data. More... | |
size_type | first_index |
Index of first coordinate of this path in the coords. More... | |
size_type | last_index |
Index of the last coordinate of this part in the coords. More... | |
Protected Member Functions | |
VirtualPath & | operator= (const VirtualPath &)=default |
VirtualPath & | operator= (VirtualPath &&)=default |
A VirtualPath class represents a single path out of a sequence of coords and flags.
It provides a PathCoordVector which is is a polyline approximation of the path (i.e. no curves) and provides metadata such as length for each point of the path.
A reaonably sized unsigned integer type for coord vector sizes and indexes.
|
explicit |
OpenOrienteering::VirtualPath::VirtualPath | ( | const MapCoordVector & | coords, |
size_type | first, | ||
size_type | last | ||
) |
|
explicit |
OpenOrienteering::VirtualPath::VirtualPath | ( | const VirtualCoordVector & | coords, |
size_type | first, | ||
size_type | last | ||
) |
OpenOrienteering::VirtualPath::VirtualPath | ( | const MapCoordVector & | flags, |
const MapCoordVectorF & | coords | ||
) |
OpenOrienteering::VirtualPath::VirtualPath | ( | const MapCoordVector & | flags, |
const MapCoordVectorF & | coords, | ||
size_type | first, | ||
size_type | last | ||
) |
|
default |
|
default |
|
inline |
Calculates the area of this part.
|
inline |
Similar to calculateTangent().
Similar to calculateTangent().
MapCoordF OpenOrienteering::VirtualPath::calculateTangent | ( | size_type | i, |
bool | backward, | ||
bool & | ok | ||
) | const |
Calculates the path tangent at the given MapCoord index.
Takes care of cases where successive points are at equal positions.
i | Index of the coordinate where to query the tangent. |
backward | If false, returns the forward tangent, if true, returns the backward tangent. Makes a difference at sharp corners. |
ok | Is set to true if the tangent can be found correctly, false if failing to find the tangent. |
std::pair< MapCoordF, double > OpenOrienteering::VirtualPath::calculateTangentScaling | ( | size_type | i | ) | const |
void OpenOrienteering::VirtualPath::copy | ( | const SplitPathCoord & | first, |
const SplitPathCoord & | last, | ||
MapCoordVector & | out_coords | ||
) | const |
void OpenOrienteering::VirtualPath::copy | ( | const SplitPathCoord & | first, |
const SplitPathCoord & | last, | ||
MapCoordVector & | out_flags, | ||
MapCoordVectorF & | out_coords | ||
) | const |
void OpenOrienteering::VirtualPath::copyLengths | ( | const SplitPathCoord & | first, |
const SplitPathCoord & | last, | ||
std::vector< PathCoord::length_type > & | out_lengths | ||
) | const |
VirtualPath::size_type OpenOrienteering::VirtualPath::countRegularNodes | ( | ) | const |
Calculates the number of regular nodes in this path.
Regular nodes exclude close points and curve handles.
|
inline |
Returns true if there are no nodes in this path.
PathCoord OpenOrienteering::VirtualPath::findClosestPointTo | ( | MapCoordF | coord, |
float & | distance_squared, | ||
float | distance_bound_squared, | ||
size_type | start_index, | ||
size_type | end_index | ||
) | const |
bool OpenOrienteering::VirtualPath::isClosed | ( | ) | const |
Returns true if the path is closed.
For closed paths, the last coordinate is at the same position as the first coordinate of the path,and has the "close point" flag set. These coords will move together when moved by the user, appearing as just one coordinate.
Parts of PathObjects can be closed and opened with PathPart::setClosed() or PathPart::connectEnds().
Objects with area symbols must always be closed.
|
inline |
Returns the length of the path.
VirtualPath::size_type OpenOrienteering::VirtualPath::nextCoordIndex | ( | size_type | base_index | ) | const |
Determines the index of the next regular coordinate.
Regular coordinates exclude bezier control points and close points.
base_index | The index of a regular coordinate from which to start. |
|
protecteddefault |
|
protecteddefault |
VirtualPath::size_type OpenOrienteering::VirtualPath::prevCoordIndex | ( | size_type | base_index | ) | const |
Determines the index of the previous regular coordinate.
Regular coordinates exclude bezier control points and close points.
base_index | The index of a regular coordinate from which to start. |
|
inline |
Returns the number of coordinates in this path.
VirtualCoordVector OpenOrienteering::VirtualPath::coords |
The underlying coordinates and flags.
size_type OpenOrienteering::VirtualPath::first_index |
Index of first coordinate of this path in the coords.
size_type OpenOrienteering::VirtualPath::last_index |
Index of the last coordinate of this part in the coords.
PathCoordVector OpenOrienteering::VirtualPath::path_coords |
The derived flattened coordinates and meta data.