Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
OpenOrienteering::VirtualPath Class Reference

A VirtualPath class represents a single path out of a sequence of coords and flags. More...

#include <virtual_path.h>

Inheritance diagram for OpenOrienteering::VirtualPath:
Inheritance graph
[legend]
Collaboration diagram for OpenOrienteering::VirtualPath:
Collaboration graph
[legend]

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

VirtualPathoperator= (const VirtualPath &)=default
 
VirtualPathoperator= (VirtualPath &&)=default
 

Detailed Description

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.

Member Typedef Documentation

◆ size_type

A reaonably sized unsigned integer type for coord vector sizes and indexes.

Constructor & Destructor Documentation

◆ VirtualPath() [1/8]

OpenOrienteering::VirtualPath::VirtualPath ( const MapCoordVector coords)
explicit

◆ VirtualPath() [2/8]

OpenOrienteering::VirtualPath::VirtualPath ( const MapCoordVector coords,
size_type  first,
size_type  last 
)

◆ VirtualPath() [3/8]

OpenOrienteering::VirtualPath::VirtualPath ( const VirtualCoordVector coords)
explicit

◆ VirtualPath() [4/8]

OpenOrienteering::VirtualPath::VirtualPath ( const VirtualCoordVector coords,
size_type  first,
size_type  last 
)

◆ VirtualPath() [5/8]

OpenOrienteering::VirtualPath::VirtualPath ( const MapCoordVector flags,
const MapCoordVectorF coords 
)

◆ VirtualPath() [6/8]

OpenOrienteering::VirtualPath::VirtualPath ( const MapCoordVector flags,
const MapCoordVectorF coords,
size_type  first,
size_type  last 
)

◆ VirtualPath() [7/8]

OpenOrienteering::VirtualPath::VirtualPath ( const VirtualPath )
default

◆ VirtualPath() [8/8]

OpenOrienteering::VirtualPath::VirtualPath ( VirtualPath &&  )
default

Member Function Documentation

◆ calculateArea()

double OpenOrienteering::VirtualPath::calculateArea ( ) const
inline

Calculates the area of this part.

◆ calculateExtent()

QRectF OpenOrienteering::VirtualPath::calculateExtent ( ) const
inline

◆ calculateIncomingTangent()

MapCoordF OpenOrienteering::VirtualPath::calculateIncomingTangent ( size_type  i,
bool ok 
) const

Similar to calculateTangent().

Todo:
Implement unsigned

◆ calculateOutgoingTangent()

MapCoordF OpenOrienteering::VirtualPath::calculateOutgoingTangent ( size_type  i,
bool ok 
) const

Similar to calculateTangent().

◆ calculateTangent() [1/2]

MapCoordF OpenOrienteering::VirtualPath::calculateTangent ( size_type  i) const

◆ calculateTangent() [2/2]

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.

Parameters
iIndex of the coordinate where to query the tangent.
backwardIf false, returns the forward tangent, if true, returns the backward tangent. Makes a difference at sharp corners.
okIs set to true if the tangent can be found correctly, false if failing to find the tangent.

◆ calculateTangentScaling()

std::pair< MapCoordF, double > OpenOrienteering::VirtualPath::calculateTangentScaling ( size_type  i) const

◆ copy() [1/2]

void OpenOrienteering::VirtualPath::copy ( const SplitPathCoord first,
const SplitPathCoord last,
MapCoordVector out_coords 
) const

◆ copy() [2/2]

void OpenOrienteering::VirtualPath::copy ( const SplitPathCoord first,
const SplitPathCoord last,
MapCoordVector out_flags,
MapCoordVectorF out_coords 
) const

◆ copyLengths()

void OpenOrienteering::VirtualPath::copyLengths ( const SplitPathCoord first,
const SplitPathCoord last,
std::vector< PathCoord::length_type > &  out_lengths 
) const

◆ countRegularNodes()

VirtualPath::size_type OpenOrienteering::VirtualPath::countRegularNodes ( ) const

Calculates the number of regular nodes in this path.

Regular nodes exclude close points and curve handles.

◆ empty()

bool OpenOrienteering::VirtualPath::empty ( ) const
inline

Returns true if there are no nodes in this path.

◆ findClosestPointTo()

PathCoord OpenOrienteering::VirtualPath::findClosestPointTo ( MapCoordF  coord,
float &  distance_squared,
float  distance_bound_squared,
size_type  start_index,
size_type  end_index 
) const
Todo:
verify

◆ intersectsBox()

bool OpenOrienteering::VirtualPath::intersectsBox ( const QRectF box) const
inline

◆ isClosed()

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.

◆ isPointInside()

bool OpenOrienteering::VirtualPath::isPointInside ( const MapCoordF coord) const
inline

◆ length()

PathCoord::length_type OpenOrienteering::VirtualPath::length ( ) const
inline

Returns the length of the path.

◆ nextCoordIndex()

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.

Parameters
base_indexThe index of a regular coordinate from which to start.

◆ operator=() [1/2]

VirtualPath& OpenOrienteering::VirtualPath::operator= ( const VirtualPath )
protecteddefault

◆ operator=() [2/2]

VirtualPath& OpenOrienteering::VirtualPath::operator= ( VirtualPath &&  )
protecteddefault

◆ prevCoordIndex()

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.

Parameters
base_indexThe index of a regular coordinate from which to start.

◆ size()

VirtualPath::size_type OpenOrienteering::VirtualPath::size ( ) const
inline

Returns the number of coordinates in this path.

See also
countRegularNodes()

Member Data Documentation

◆ coords

VirtualCoordVector OpenOrienteering::VirtualPath::coords

The underlying coordinates and flags.

◆ first_index

size_type OpenOrienteering::VirtualPath::first_index

Index of first coordinate of this path in the coords.

◆ last_index

size_type OpenOrienteering::VirtualPath::last_index

Index of the last coordinate of this part in the coords.

◆ path_coords

PathCoordVector OpenOrienteering::VirtualPath::path_coords

The derived flattened coordinates and meta data.


The documentation for this class was generated from the following files: