Mapper  0.9.0
API documentation
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
OpenOrienteering::PathObject Class Reference

Object type which can be used for line, area and combined symbols. More...

#include <object.h>

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

Classes

struct  Intersection
 Returned by calcAllIntersectionsWith(). More...
 
class  Intersections
 std::vector of Intersection with the ability to sort them and remove duplicates. More...
 

Public Member Functions

 PathObject (const Symbol *symbol=nullptr)
 Constructs a PathObject, optionally assigning a symbol. More...
 
 PathObject (const Symbol *symbol, const MapCoordVector &coords, Map *map=nullptr)
 Constructs a PathObject, assigning initial coords and optionally the map pointer. More...
 
 PathObject (const Symbol *symbol, const PathObject &proto, MapCoordVector::size_type piece)
 Constructs a PathObject, assigning initial coords from a single piece of a line. More...
 
 PathObject (const PathPart &proto_part)
 Constructs a PathObject, initialized from the given part of another object. More...
 
PathObjectduplicate () const override
 Creates a duplicate of the path object. More...
 
PathObjectoperator= (const PathObject &other)=delete
 
void copyFrom (const Object &other) override
 Replaces this object's contents by those of the other. More...
 
bool validate () const override
 
void normalize ()
 Checks the path for valid flags, and makes corrections as necessary. More...
 
bool intersectsBox (const QRectF &box) const override
 Checks if a path point (excluding curve control points) is included in the given box. More...
 
MapCoordVector::size_type getCoordinateCount () const
 Returns the number of coordinates, including curve handles and close points. More...
 
MapCoord getCoordinate (MapCoordVector::size_type pos) const
 Returns the i-th coordinate. More...
 
MapCoordgetCoordinateRef (MapCoordVector::size_type pos)
 Returns a non-const reference to the i-th coordinate. More...
 
void setCoordinate (MapCoordVector::size_type pos, const MapCoord &c)
 Replaces the i-th coordinate with c. More...
 
void addCoordinate (MapCoordVector::size_type pos, const MapCoord &c)
 Adds the coordinate at the given index. More...
 
void addCoordinate (const MapCoord &c, bool start_new_part=false)
 Adds the coordinate at the end, optionally starting a new part. More...
 
void deleteCoordinate (MapCoordVector::size_type pos, bool adjust_other_coords, int delete_bezier_point_action=-1)
 Deletes a coordinate from the path. More...
 
void clearCoordinates ()
 Deletes all coordinates of the object. More...
 
void assignCoordinates (const PathObject &proto, MapCoordVector::size_type first, MapCoordVector::size_type last)
 Assigns the given prototype's coordinates subset to this object's coordinates. More...
 
PathPartVector::const_iterator findPartForIndex (MapCoordVector::size_type coords_index) const
 Finds the path part containing the given coord index. More...
 
PathPartVector::iterator findPartForIndex (MapCoordVector::size_type coords_index)
 Finds the path part containing the given coord index. More...
 
PathPartVector::size_type findPartIndexForIndex (MapCoordVector::size_type coords_index) const
 Finds the path part containing the given coord index. More...
 
PathCoord findPathCoordForIndex (MapCoordVector::size_type index) const
 Returns the path coordinate for the map coordinate with given index. More...
 
bool isCurveHandle (MapCoordVector::size_type index) const
 Returns true if the given index is a curve handle. More...
 
const PathPartVectorparts () const
 Returns the vector of path parts. More...
 
PathPartVectorparts ()
 Returns the vector of path parts. More...
 
void deletePart (PathPartVector::size_type part_index)
 Deletes the i-th path part. More...
 
void transform (const QTransform &t) override
 Transforms the coordinates and the pattern origin. More...
 
qreal getPatternRotation () const
 Returns the rotation of the object pattern. More...
 
void setPatternRotation (qreal rotation)
 Sets the rotation of the object pattern. More...
 
MapCoord getPatternOrigin () const
 Returns the origin of the object pattern. More...
 
void setPatternOrigin (const MapCoord &origin)
 Sets the origin of the object pattern. More...
 
void calcClosestPointOnPath (MapCoordF coord, float &out_distance_sq, PathCoord &out_path_coord, MapCoordVector::size_type start_index=0, MapCoordVector::size_type end_index=std::numeric_limits< PathPartVector::size_type >::max()) const
 Calculates the closest point on the path to the given coordinate, returns the squared distance of these points and PathCoord information for the point on the path. More...
 
void calcClosestCoordinate (MapCoordF coord, float &out_distance_sq, MapCoordVector::size_type &out_index) const
 Calculates the closest control point coordinate to the given coordinate, returns the squared distance of these points and the index of the control point. More...
 
MapCoordVector::size_type subdivide (const PathCoord &path_coord)
 Splits the path at the position given by path_coord. More...
 
MapCoordVector::size_type subdivide (MapCoordVector::size_type index, float param)
 Splits the path in the curve which starts at the given index. More...
 
bool canBeConnected (const PathObject *other, double connect_threshold_sq) const
 Returns if connectIfClose() would change something with the given parameters. More...
 
bool connectIfClose (PathObject *other, double connect_threshold_sq)
 Returns if the objects were connected (if so, you can delete the other object). More...
 
void connectPathParts (PathPartVector::size_type part_index, const PathObject *other, PathPartVector::size_type other_part_index, bool prepend, bool merge_ends=true)
 Connects the given parts, optionally merging the end coordinates at the center position, and copying over the coordindates from other. More...
 
std::vector< PathObject * > removeFromLine (PathPartVector::size_type part_index, PathCoord::length_type clen_begin, PathCoord::length_type clen_end) const
 Returns the result of removing the section between begin and end from the path. More...
 
std::vector< PathObject * > splitLineAt (const PathCoord &split_pos) const
 Returns the result of splitting the path at the given inner position. More...
 
void changePathBounds (PathPartVector::size_type part_index, PathCoord::length_type start_len, PathCoord::length_type end_len)
 Replaces the path with a non-empty range of it starting and ending at the given lengths. More...
 
void appendPath (const PathObject *other)
 Appends (copies) the coordinates of other to this path. More...
 
void appendPathPart (const PathPart &part)
 Appends (copies) the coordinates of a specific part to this path. More...
 
void reverse ()
 Reverses the object's coordinates, resulting in switching the start / end / mid / dash symbol direction for line symbols. More...
 
void closeAllParts ()
 Ensures that all parts are closed. More...
 
bool convertToCurves (PathObject **undo_duplicate=nullptr)
 Converts all polygonal sections in this path to splines. More...
 
PathPart::size_type convertRangeToCurves (const PathPart &part, PathPart::size_type start_index, PathPart::size_type end_index)
 Converts the given range of coordinates to a spline by inserting handles. More...
 
bool simplify (PathObject **undo_duplicate, double threshold)
 Tries to remove points while retaining the path shape as much as possible. More...
 
int isPointOnPath (MapCoordF coord, float tolerance, bool treat_areas_as_paths, bool extended_selection) const
 See Object::isPointOnObject() More...
 
bool isPointInsideArea (const MapCoordF &coord) const
 Returns true if the given coordinate is inside the area defined by this object, which must be closed. More...
 
double calcMaximumDistanceTo (MapCoordVector::size_type start_index, MapCoordVector::size_type end_index, const PathObject *other, MapCoordVector::size_type other_start_index, MapCoordVector::size_type other_end_index) const
 Calculates the maximum distance of the given coord ranges of two objects. More...
 
void calcAllIntersectionsWith (const PathObject *other, Intersections &out) const
 Calculates and adds all intersections with the other path to out. More...
 
void updatePathCoords () const
 Called by Object::update() More...
 
void recalculateParts ()
 Called by Object::load() More...
 
- Public Member Functions inherited from OpenOrienteering::Object
 Object (Type type, const Symbol *symbol=nullptr)
 Creates an empty object with the given type and (optional) symbol. More...
 
 Object (Type type, const Symbol *symbol, const MapCoordVector &coords, Map *map=nullptr)
 Creates an empty object with the given type, symbol, coords and (optional) map. More...
 
virtual ~Object ()
 Destructs the object. More...
 
Objectoperator= (const Object &other)=delete
 
bool equals (const Object *other, bool compare_symbol) const
 Checks for equality with another object. More...
 
Type getType () const
 Returns the object type determined by the subclass. More...
 
PointObjectasPoint ()
 Convenience cast to PointObject with type checking. More...
 
const PointObjectasPoint () const
 Convenience cast to PointObject with type checking. More...
 
PathObjectasPath ()
 Convenience cast to PathObject with type checking. More...
 
const PathObjectasPath () const
 Convenience cast to PathObject with type checking. More...
 
TextObjectasText ()
 Convenience cast to TextObject with type checking. More...
 
const TextObjectasText () const
 Convenience cast to TextObject with type checking. More...
 
void save (QXmlStreamWriter &xml) const
 Saves the object in xml format to the given stream. More...
 
qreal getRotation () const
 Returns the rotation for this object (in radians). More...
 
void setRotation (qreal new_rotation)
 Sets the object's rotation (in radians). More...
 
bool update () const
 If the output_dirty flag is set, regenerates output and extent, and updates the object's map (if set). More...
 
void forceUpdate () const
 Always regenerates output and extent, and updates the object's map (if set). More...
 
void move (qint32 dx, qint32 dy)
 Moves the whole object. More...
 
void move (const MapCoord &offset)
 Moves the whole object by the given offset. More...
 
virtual void scale (const MapCoordF &center, double factor)
 Scales all coordinates, with the given scaling center. More...
 
virtual void scale (double factor_x, double factor_y)
 Scales all coordinates, with the center (0, 0). More...
 
void rotateAround (const MapCoordF &center, qreal angle)
 Rotates the whole object around the center point. More...
 
void rotate (qreal angle)
 Rotates the whole object around the center (0, 0). More...
 
int isPointOnObject (const MapCoordF &coord, float tolerance, bool treat_areas_as_paths, bool extended_selection) const
 Checks if the given coord, with the given tolerance, is on this object. More...
 
void takeRenderables ()
 Takes ownership of the renderables. More...
 
void clearRenderables ()
 Deletes the renderables (and extent), undoing update() More...
 
const ObjectRenderablesrenderables () const
 Returns the renderables, read-only. More...
 
const MapCoordVectorgetRawCoordinateVector () const
 Returns the raw MapCoordVector of the object. More...
 
void setOutputDirty (bool dirty=true)
 Sets the object output's dirty state. More...
 
bool isOutputDirty () const
 Returns if the object's output must be regenerated. More...
 
bool setSymbol (const Symbol *new_symbol, bool no_checks)
 Changes the object's symbol, returns if successful. More...
 
const SymbolgetSymbol () const
 Returns the object's symbol. More...
 
const QRectFgetExtent () const
 NOTE: The extent is only valid after update() has been called! More...
 
void setMap (Map *map)
 Sets the object's map pointer. More...
 
MapgetMap () const
 Returns the object's map pointer. More...
 
const Tagstags () const
 Returns a const reference to the object's tags. More...
 
void setTags (const Tags &tags)
 Replaces the object's tags. More...
 
QString getTag (const QString &key) const
 Returns the value of the given tag key. More...
 
void setTag (const QString &key, const QString &value)
 Sets the given tag key to the value. More...
 
void removeTag (const QString &key)
 Removes the given tag key and its value. More...
 
void includeControlPointsRect (QRectF &rect) const
 Extends a rectangle to enclose all of the object's control points. More...
 

Protected Member Functions

 PathObject (const PathObject &proto)
 Constructs a PathObject, initialized from the given prototype. More...
 
void partSizeChanged (PathPartVector::iterator part, MapCoordVector::difference_type change)
 Adjusts the end index of the given part and the start/end indexes of the following parts. More...
 
void prepareDeleteBezierPoint (MapCoordVector::size_type pos, int delete_bezier_point_action)
 
void setClosingPoint (MapCoordVector::size_type index, const MapCoord &coord)
 Sets coord as the point which closes a part: sets the correct flags on it and replaces the coord at the given index by it. More...
 
void updateEvent () const override
 
void createRenderables (ObjectRenderables &output, Symbol::RenderableOptions options) const override
 
- Protected Member Functions inherited from OpenOrienteering::Object
 Object (const Object &proto)
 Constructs a Object, initialized from the given prototype. More...
 

Static Protected Member Functions

static void calcBezierPointDeletionRetainingShapeFactors (MapCoord p0, MapCoord p1, MapCoord p2, MapCoord q0, MapCoord q1, MapCoord q2, MapCoord q3, double &out_pfactor, double &out_qfactor)
 Calculates the factors which should be applied to the length of the remaining bezier curve handle vectors when deleting a point joining two bezier curves to try to retain the original curves' shape. More...
 
static void calcBezierPointDeletionRetainingShapeOptimization (MapCoord p0, MapCoord p1, MapCoord p2, MapCoord q0, MapCoord q1, MapCoord q2, MapCoord q3, double &out_pfactor, double &out_qfactor)
 Uses nonlinear optimization to improve the first result obtained by calcBezierPointDeletionRetainingShapeFactors(). More...
 
static float calcBezierPointDeletionRetainingShapeCost (MapCoord p0, MapCoordF p1, MapCoordF p2, MapCoord p3, PathObject *reference)
 Is used internally by calcBezierPointDeletionRetainingShapeOptimization() to calculate the current cost. More...
 

Friends

class PathPart
 

Additional Inherited Members

- Public Types inherited from OpenOrienteering::Object
enum  Type { Point = 0, Path = 1, Text = 4 }
 Enumeration of possible object types. More...
 
typedef QHash< QString, QStringTags
 Defines a type which maps keys to values, to be used for tagging objects. More...
 
- Static Public Member Functions inherited from OpenOrienteering::Object
static Objectload (QXmlStreamReader &xml, Map *map, const SymbolDictionary &symbol_dict, const Symbol *symbol=nullptr)
 Loads the object in xml format from the given stream. More...
 
static ObjectgetObjectForType (Type type, const Symbol *symbol=nullptr)
 Constructs an object of the given type with the given symbol. More...
 
- Protected Attributes inherited from OpenOrienteering::Object
Type type
 
const Symbolsymbol = nullptr
 
MapCoordVector coords
 
Mapmap = nullptr
 
Tags object_tags
 

Detailed Description

Object type which can be used for line, area and combined symbols.

Has a dynamic number of coordinates.

The coordinates are divided into one or multiple PathParts. A PathPart is ended by a coordinate with the "hole point" flag. For all types of flags which can be set, see the MapCoord documentation.

Constructor & Destructor Documentation

◆ PathObject() [1/5]

OpenOrienteering::PathObject::PathObject ( const Symbol symbol = nullptr)
explicit

Constructs a PathObject, optionally assigning a symbol.

◆ PathObject() [2/5]

OpenOrienteering::PathObject::PathObject ( const Symbol symbol,
const MapCoordVector coords,
Map map = nullptr 
)
explicit

Constructs a PathObject, assigning initial coords and optionally the map pointer.

◆ PathObject() [3/5]

OpenOrienteering::PathObject::PathObject ( const Symbol symbol,
const PathObject proto,
MapCoordVector::size_type  piece 
)
explicit

Constructs a PathObject, assigning initial coords from a single piece of a line.

"Piece" refers to a single straight or curved arc from the point identified by parameter piece to the immediate next point on the path.

If the path is not closed, and piece refers to the last element in the path (part), then the arc ending in the point referred to by piece is returned instead.

◆ PathObject() [4/5]

OpenOrienteering::PathObject::PathObject ( const PathObject proto)
explicitprotected

Constructs a PathObject, initialized from the given prototype.

◆ PathObject() [5/5]

OpenOrienteering::PathObject::PathObject ( const PathPart proto_part)
explicit

Constructs a PathObject, initialized from the given part of another object.

Member Function Documentation

◆ addCoordinate() [1/2]

void OpenOrienteering::PathObject::addCoordinate ( MapCoordVector::size_type  pos,
const MapCoord c 
)

Adds the coordinate at the given index.

◆ addCoordinate() [2/2]

void OpenOrienteering::PathObject::addCoordinate ( const MapCoord c,
bool  start_new_part = false 
)

Adds the coordinate at the end, optionally starting a new part.

If starting a new part, make sure that the last coord of the old part has the hole point flag!

◆ appendPath()

void OpenOrienteering::PathObject::appendPath ( const PathObject other)

Appends (copies) the coordinates of other to this path.

◆ appendPathPart()

void OpenOrienteering::PathObject::appendPathPart ( const PathPart part)

Appends (copies) the coordinates of a specific part to this path.

The other object is determined from the part's path property.

◆ assignCoordinates()

void OpenOrienteering::PathObject::assignCoordinates ( const PathObject proto,
MapCoordVector::size_type  first,
MapCoordVector::size_type  last 
)

Assigns the given prototype's coordinates subset to this object's coordinates.

The range must be within one part. Last may be smaller than first iff the path is closed.

◆ calcAllIntersectionsWith()

void OpenOrienteering::PathObject::calcAllIntersectionsWith ( const PathObject other,
PathObject::Intersections out 
) const

Calculates and adds all intersections with the other path to out.

Note: intersections are not sorted and may contain duplicates! To clean them up, call clean() on the Intersections object after adding all intersections with objects you are interested in.

Todo:
FIXME: part_index or other_part_index ???

◆ calcBezierPointDeletionRetainingShapeCost()

float OpenOrienteering::PathObject::calcBezierPointDeletionRetainingShapeCost ( MapCoord  p0,
MapCoordF  p1,
MapCoordF  p2,
MapCoord  p3,
PathObject reference 
)
staticprotected

Is used internally by calcBezierPointDeletionRetainingShapeOptimization() to calculate the current cost.

Evaluates the distance between p0 ... p3 and the reference path.

◆ calcBezierPointDeletionRetainingShapeFactors()

void OpenOrienteering::PathObject::calcBezierPointDeletionRetainingShapeFactors ( MapCoord  p0,
MapCoord  p1,
MapCoord  p2,
MapCoord  q0,
MapCoord  q1,
MapCoord  q2,
MapCoord  q3,
double &  out_pfactor,
double &  out_qfactor 
)
staticprotected

Calculates the factors which should be applied to the length of the remaining bezier curve handle vectors when deleting a point joining two bezier curves to try to retain the original curves' shape.

This is a simple version, the result should be optimized with calcBezierPointDeletionRetainingShapeOptimization().

p0, p1, p2, q0 make up the first original curve, q0, q1, q2, q3 make up the second original curve. out_pfactor is set to the factor to apply to the vector (p1 - p0), out_qfactor is set to the factor to apply to the vector (q2 - q3),

◆ calcBezierPointDeletionRetainingShapeOptimization()

void OpenOrienteering::PathObject::calcBezierPointDeletionRetainingShapeOptimization ( MapCoord  p0,
MapCoord  p1,
MapCoord  p2,
MapCoord  q0,
MapCoord  q1,
MapCoord  q2,
MapCoord  q3,
double &  out_pfactor,
double &  out_qfactor 
)
staticprotected

Uses nonlinear optimization to improve the first result obtained by calcBezierPointDeletionRetainingShapeFactors().

◆ calcClosestCoordinate()

void OpenOrienteering::PathObject::calcClosestCoordinate ( MapCoordF  coord,
float &  out_distance_sq,
MapCoordVector::size_type &  out_index 
) const

Calculates the closest control point coordinate to the given coordinate, returns the squared distance of these points and the index of the control point.

Todo:

Convert out_distance_sq to double (so avoiding conversions).

Return index rather than writing to the provided reference.

◆ calcClosestPointOnPath()

void OpenOrienteering::PathObject::calcClosestPointOnPath ( MapCoordF  coord,
float &  out_distance_sq,
PathCoord out_path_coord,
MapCoordVector::size_type  start_index = 0,
MapCoordVector::size_type  end_index = std::numeric_limits<PathPartVector::size_type>::max() 
) const

Calculates the closest point on the path to the given coordinate, returns the squared distance of these points and PathCoord information for the point on the path.

This does not need to be an existing path coordinate. This method is usually called to find the position on the path the user clicked on. part_index can be set to a valid part index to constrain searching to this specific path part.

Todo:

Convert out_distance_sq to double (so avoiding conversions).

Return PathCoord rather than writing to the provided reference.

Todo:
Legacy compatibility, review/remove

◆ calcMaximumDistanceTo()

double OpenOrienteering::PathObject::calcMaximumDistanceTo ( MapCoordVector::size_type  start_index,
MapCoordVector::size_type  end_index,
const PathObject other,
MapCoordVector::size_type  other_start_index,
MapCoordVector::size_type  other_end_index 
) const

Calculates the maximum distance of the given coord ranges of two objects.

◆ canBeConnected()

bool OpenOrienteering::PathObject::canBeConnected ( const PathObject other,
double  connect_threshold_sq 
) const

Returns if connectIfClose() would change something with the given parameters.

◆ changePathBounds()

void OpenOrienteering::PathObject::changePathBounds ( PathPartVector::size_type  part_index,
PathCoord::length_type  start_len,
PathCoord::length_type  end_len 
)

Replaces the path with a non-empty range of it starting and ending at the given lengths.

For open paths, the end length must be greater than the start length. For closed paths, an end length smaller than or equal to the start length will cause the resulting path to span the original start/end point.

◆ clearCoordinates()

void OpenOrienteering::PathObject::clearCoordinates ( )

Deletes all coordinates of the object.

◆ closeAllParts()

void OpenOrienteering::PathObject::closeAllParts ( )

Ensures that all parts are closed.

Useful for objects with area-only symbols.

◆ connectIfClose()

bool OpenOrienteering::PathObject::connectIfClose ( PathObject other,
double  connect_threshold_sq 
)

Returns if the objects were connected (if so, you can delete the other object).

If one of the paths has to be reversed, it is done for the "other" path. Otherwise, the "other" path is not changed.

Todo:
Review documentation, container usage,

◆ connectPathParts()

void OpenOrienteering::PathObject::connectPathParts ( PathPartVector::size_type  part_index,
const PathObject other,
PathPartVector::size_type  other_part_index,
bool  prepend,
bool  merge_ends = true 
)

Connects the given parts, optionally merging the end coordinates at the center position, and copying over the coordindates from other.

◆ convertRangeToCurves()

PathPart::size_type OpenOrienteering::PathObject::convertRangeToCurves ( const PathPart part,
PathPart::size_type  start_index,
PathPart::size_type  end_index 
)

Converts the given range of coordinates to a spline by inserting handles.

The range must consist of only polygonal segments before.

Returns
The new index of the end of the range.

◆ convertToCurves()

bool OpenOrienteering::PathObject::convertToCurves ( PathObject **  undo_duplicate = nullptr)

Converts all polygonal sections in this path to splines.

If at least one section is converted, returns true and returns an undo duplicate if the corresponding pointer is set.

◆ copyFrom()

void OpenOrienteering::PathObject::copyFrom ( const Object other)
overridevirtual

Replaces this object's contents by those of the other.

Reimplemented from OpenOrienteering::Object.

◆ createRenderables()

void OpenOrienteering::PathObject::createRenderables ( ObjectRenderables output,
Symbol::RenderableOptions  options 
) const
overrideprotectedvirtual

Reimplemented from OpenOrienteering::Object.

◆ deleteCoordinate()

void OpenOrienteering::PathObject::deleteCoordinate ( MapCoordVector::size_type  pos,
bool  adjust_other_coords,
int  delete_bezier_point_action = -1 
)

Deletes a coordinate from the path.

When requesting a control point of a bezier arc to be deleted, the other control point is deleted, too.

If the number of regular points in the coordinate's part is not more than two, the whole part is delete from the object.

Parameters
posIndex of the coordinate to delete.
adjust_other_coordsIf set and the deleted coordinate was joining two bezier curves, adapts the adjacent curves with a strategy defined by delete_bezier_point_action. adjust_other_coords does not work when deleting bezier curve handles!
delete_bezier_point_actionMust be an enum value from Settings::DeleteBezierPointAction if adjust_other_coords is set.

◆ deletePart()

void OpenOrienteering::PathObject::deletePart ( PathPartVector::size_type  part_index)

Deletes the i-th path part.

◆ duplicate()

PathObject * OpenOrienteering::PathObject::duplicate ( ) const
overridevirtual

Creates a duplicate of the path object.

Use asPath() on the result to obtain an object of type PathObject.

Implements OpenOrienteering::Object.

◆ findPartForIndex() [1/2]

PathPartVector::const_iterator OpenOrienteering::PathObject::findPartForIndex ( MapCoordVector::size_type  coords_index) const

Finds the path part containing the given coord index.

◆ findPartForIndex() [2/2]

PathPartVector::iterator OpenOrienteering::PathObject::findPartForIndex ( MapCoordVector::size_type  coords_index)

Finds the path part containing the given coord index.

◆ findPartIndexForIndex()

PathPartVector::size_type OpenOrienteering::PathObject::findPartIndexForIndex ( MapCoordVector::size_type  coords_index) const

Finds the path part containing the given coord index.

Todo:
Review where this signature can be replace by the one returning an iterator.

◆ findPathCoordForIndex()

PathCoord OpenOrienteering::PathObject::findPathCoordForIndex ( MapCoordVector::size_type  index) const

Returns the path coordinate for the map coordinate with given index.

Parameters
indexIndex of normal MapCoord for which to create the PathCoord.

◆ getCoordinate()

MapCoord OpenOrienteering::PathObject::getCoordinate ( MapCoordVector::size_type  pos) const
inline

Returns the i-th coordinate.

◆ getCoordinateCount()

MapCoordVector::size_type OpenOrienteering::PathObject::getCoordinateCount ( ) const
inline

Returns the number of coordinates, including curve handles and close points.

◆ getCoordinateRef()

MapCoord& OpenOrienteering::PathObject::getCoordinateRef ( MapCoordVector::size_type  pos)
inline

Returns a non-const reference to the i-th coordinate.

Normally you should modify coordinates via PathObject::setCoordinate. Unlike that function, modifying a coordinate directly via the reference will not keep the first and last point of a closed path in sync.

◆ getPatternOrigin()

MapCoord OpenOrienteering::PathObject::getPatternOrigin ( ) const
inline

Returns the origin of the object pattern.

Only has an effect in combination with a symbol interpreting this value.

◆ getPatternRotation()

qreal OpenOrienteering::PathObject::getPatternRotation ( ) const
inline

Returns the rotation of the object pattern.

Only has an effect in combination with a symbol interpreting this value.

◆ intersectsBox()

bool OpenOrienteering::PathObject::intersectsBox ( const QRectF box) const
overridevirtual

Checks if a path point (excluding curve control points) is included in the given box.

Implements OpenOrienteering::Object.

◆ isCurveHandle()

bool OpenOrienteering::PathObject::isCurveHandle ( MapCoordVector::size_type  index) const

Returns true if the given index is a curve handle.

◆ isPointInsideArea()

bool OpenOrienteering::PathObject::isPointInsideArea ( const MapCoordF coord) const

Returns true if the given coordinate is inside the area defined by this object, which must be closed.

◆ isPointOnPath()

int OpenOrienteering::PathObject::isPointOnPath ( MapCoordF  coord,
float  tolerance,
bool  treat_areas_as_paths,
bool  extended_selection 
) const

◆ normalize()

void OpenOrienteering::PathObject::normalize ( )

Checks the path for valid flags, and makes corrections as necessary.

◆ operator=()

PathObject& OpenOrienteering::PathObject::operator= ( const PathObject other)
delete

◆ parts() [1/2]

const PathPartVector & OpenOrienteering::PathObject::parts ( ) const
inline

Returns the vector of path parts.

◆ parts() [2/2]

PathPartVector & OpenOrienteering::PathObject::parts ( )
inline

Returns the vector of path parts.

Marks the output as dirty.

◆ partSizeChanged()

void OpenOrienteering::PathObject::partSizeChanged ( PathPartVector::iterator  part,
MapCoordVector::difference_type  change 
)
protected

Adjusts the end index of the given part and the start/end indexes of the following parts.

output_dirty must be set before calling this function.

◆ prepareDeleteBezierPoint()

void OpenOrienteering::PathObject::prepareDeleteBezierPoint ( MapCoordVector::size_type  pos,
int  delete_bezier_point_action 
)
protected

◆ recalculateParts()

void OpenOrienteering::PathObject::recalculateParts ( )

Called by Object::load()

◆ removeFromLine()

std::vector< PathObject * > OpenOrienteering::PathObject::removeFromLine ( PathPartVector::size_type  part_index,
PathCoord::length_type  clen_begin,
PathCoord::length_type  clen_end 
) const

Returns the result of removing the section between begin and end from the path.

begin and end must belong to the path part with the given part_index. However, objects with holes, and part_index values greater than 0, are not supported at the moment.

Returns an empty vector when nothing remains after removal.

◆ reverse()

void OpenOrienteering::PathObject::reverse ( )

Reverses the object's coordinates, resulting in switching the start / end / mid / dash symbol direction for line symbols.

◆ setClosingPoint()

void OpenOrienteering::PathObject::setClosingPoint ( MapCoordVector::size_type  index,
const MapCoord coord 
)
protected

Sets coord as the point which closes a part: sets the correct flags on it and replaces the coord at the given index by it.

TODO: make separate methods? Setting coords exists already.

◆ setCoordinate()

void OpenOrienteering::PathObject::setCoordinate ( MapCoordVector::size_type  pos,
const MapCoord c 
)

Replaces the i-th coordinate with c.

◆ setPatternOrigin()

void OpenOrienteering::PathObject::setPatternOrigin ( const MapCoord origin)

Sets the origin of the object pattern.

Only has an effect in combination with a symbol interpreting this value.

◆ setPatternRotation()

void OpenOrienteering::PathObject::setPatternRotation ( qreal  rotation)

Sets the rotation of the object pattern.

Only has an effect in combination with a symbol interpreting this value.

◆ simplify()

bool OpenOrienteering::PathObject::simplify ( PathObject **  undo_duplicate,
double  threshold 
)

Tries to remove points while retaining the path shape as much as possible.

If at least one point is changed, returns true and returns an undo duplicate if the corresponding pointer is set.

◆ splitLineAt()

std::vector< PathObject * > OpenOrienteering::PathObject::splitLineAt ( const PathCoord split_pos) const

Returns the result of splitting the path at the given inner position.

Returns an empty vector when the object is not changed by the split. This happens when the path is not closed and split_pos is the begin or end of the path, or when the object has got more than a single PathPart.

◆ subdivide() [1/2]

MapCoordVector::size_type OpenOrienteering::PathObject::subdivide ( const PathCoord path_coord)

Splits the path at the position given by path_coord.

Must not be called while isOutputDirty() returns true.

Returns the index of the added point.

◆ subdivide() [2/2]

MapCoordVector::size_type OpenOrienteering::PathObject::subdivide ( MapCoordVector::size_type  index,
float  param 
)

Splits the path in the curve which starts at the given index.

The second parameter determines the split position between begin and end of the curve (0.0 ... 1.0).

Must not be called while isOutputDirty() returns true.

Returns
The index of the added point.

◆ transform()

void OpenOrienteering::PathObject::transform ( const QTransform t)
overridevirtual

Transforms the coordinates and the pattern origin.

Implements OpenOrienteering::Object.

◆ updateEvent()

void OpenOrienteering::PathObject::updateEvent ( ) const
overrideprotectedvirtual

Reimplemented from OpenOrienteering::Object.

◆ updatePathCoords()

void OpenOrienteering::PathObject::updatePathCoords ( ) const

Called by Object::update()

◆ validate()

bool OpenOrienteering::PathObject::validate ( ) const
overridevirtual

Reimplemented from OpenOrienteering::Object.

Friends And Related Function Documentation

◆ PathPart

friend class PathPart
friend

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