Mapper  0.9.0
API documentation
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
OpenOrienteering::PathPart Class Reference

Helper class with information about parts of paths. More...

#include <object.h>

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

Public Member Functions

 PathPart (PathObject &path, MapCoordVector::size_type start_index, MapCoordVector::size_type end_index)
 
 PathPart (const VirtualCoordVector &coords, MapCoordVector::size_type start_index, MapCoordVector::size_type end_index)
 
 PathPart (PathObject &path, const VirtualPath &virtual_path)
 
 ~PathPart ()=default
 
PathPartoperator= (const PathPart &rhs)
 
void setClosed (bool closed, bool may_use_existing_close_point=false)
 Closes or opens the sub-path. More...
 
void connectEnds ()
 Closes the subpath, merging the start and end point at their center. More...
 
void reverse ()
 Reverses the part's coordinates. More...
 
- Public Member Functions inherited from OpenOrienteering::VirtualPath
 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
 

Static Public Member Functions

static PathPartVector calculatePathParts (const VirtualCoordVector &coords)
 

Public Attributes

PathObjectpath = nullptr
 Pointer to path object containing this part. More...
 
- Public Attributes inherited from OpenOrienteering::VirtualPath
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...
 

Additional Inherited Members

- Public Types inherited from OpenOrienteering::VirtualPath
using size_type = VirtualCoordVector::size_type
 A reaonably sized unsigned integer type for coord vector sizes and indexes. More...
 
- Protected Member Functions inherited from OpenOrienteering::VirtualPath
VirtualPathoperator= (const VirtualPath &)=default
 
VirtualPathoperator= (VirtualPath &&)=default
 

Detailed Description

Helper class with information about parts of paths.

A part is a path segment which is separated from other parts by a hole point at its end.

Constructor & Destructor Documentation

◆ PathPart() [1/3]

OpenOrienteering::PathPart::PathPart ( PathObject path,
MapCoordVector::size_type  start_index,
MapCoordVector::size_type  end_index 
)
inline

◆ PathPart() [2/3]

OpenOrienteering::PathPart::PathPart ( const VirtualCoordVector coords,
MapCoordVector::size_type  start_index,
MapCoordVector::size_type  end_index 
)
inline

◆ PathPart() [3/3]

OpenOrienteering::PathPart::PathPart ( PathObject path,
const VirtualPath virtual_path 
)

◆ ~PathPart()

OpenOrienteering::PathPart::~PathPart ( )
default

Member Function Documentation

◆ calculatePathParts()

PathPartVector OpenOrienteering::PathPart::calculatePathParts ( const VirtualCoordVector coords)
static

◆ connectEnds()

void OpenOrienteering::PathPart::connectEnds ( )

Closes the subpath, merging the start and end point at their center.

See also
PathPart::setClosed()

◆ operator=()

PathPart & OpenOrienteering::PathPart::operator= ( const PathPart rhs)
inline

◆ reverse()

void OpenOrienteering::PathPart::reverse ( )

Reverses the part's coordinates.

Reversing the coordinates results in switching the start/end/mid/dash symbol direction for line symbols.

See also
PathObject::reverse()

◆ setClosed()

void OpenOrienteering::PathPart::setClosed ( bool  closed,
bool  may_use_existing_close_point = false 
)

Closes or opens the sub-path.

If closed == true and may_use_existing_close_point == false, a new point is added as closing point even if its coordinates are identical to the existing last point. Else, the last point may be reused.

Member Data Documentation

◆ path

PathObject* OpenOrienteering::PathPart::path = nullptr

Pointer to path object containing this part.


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