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

Object type which can only be used for point symbols, and is also the only object which can be used with them. More...

#include <object.h>

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

Public Member Functions

 PointObject (const Symbol *symbol=nullptr)
 Constructs a PointObject, optionally assigning the symbol. More...
 
PointObject * duplicate () const override
 Creates a duplicate of the point. More...
 
PointObject & operator= (const PointObject &other)=delete
 
void copyFrom (const Object &other) override
 Replaces the content of this object by that of another. More...
 
void setPosition (qint32 x, qint32 y)
 Sets the point's position to a new position given in native map coordinates. More...
 
void setPosition (const MapCoord &coord)
 Changes the point's position. More...
 
void setPosition (const MapCoordF &coord)
 Changes the point's position. More...
 
MapCoordF getCoordF () const
 Returns the point's position as MapCoordF. More...
 
MapCoord getCoord () const
 Returns the point's coordinate. More...
 
void transform (const QTransform &t) override
 Transforms the position. More...
 
bool intersectsBox (const QRectF &box) const override
 Checks if a path point (excluding curve control points) is included in the given box. 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...
 
Object & operator= (const Object &other)=delete
 
bool equals (const Object *other, bool compare_symbol) const
 Checks for equality with another object. More...
 
virtual bool validate () const
 
Type getType () const
 Returns the object type determined by the subclass. More...
 
PointObject * asPoint ()
 Convenience cast to PointObject with type checking. More...
 
const PointObject * asPoint () const
 Convenience cast to PointObject with type checking. More...
 
PathObject * asPath ()
 Convenience cast to PathObject with type checking. More...
 
const PathObject * asPath () const
 Convenience cast to PathObject with type checking. More...
 
TextObject * asText ()
 Convenience cast to TextObject with type checking. More...
 
const TextObject * asText () 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 ObjectRenderables & renderables () const
 Returns the renderables, read-only. More...
 
const MapCoordVector & getRawCoordinateVector () 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 Symbol * getSymbol () const
 Returns the object's symbol. More...
 
const QRectF & getExtent () const
 NOTE: The extent is only valid after update() has been called! More...
 
void setMap (Map *map)
 Sets the object's map pointer. More...
 
Map * getMap () const
 Returns the object's map pointer. More...
 
const Tags & tags () 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

 PointObject (const PointObject &proto)
 Constructs a PointObject, initialized from the given prototype. More...
 
- Protected Member Functions inherited from OpenOrienteering::Object
 Object (const Object &proto)
 Constructs a Object, initialized from the given prototype. More...
 
virtual void updateEvent () const
 
virtual void createRenderables (ObjectRenderables &output, Symbol::RenderableOptions options) const
 

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, QString > Tags
 Defines a type which maps keys to values, to be used for tagging objects. More...
 
- Static Public Member Functions inherited from OpenOrienteering::Object
static Object * load (QXmlStreamReader &xml, Map *map, const SymbolDictionary &symbol_dict, const Symbol *symbol=nullptr)
 Loads the object in xml format from the given stream. More...
 
static Object * getObjectForType (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 Symbol * symbol = nullptr
 
MapCoordVector coords
 
Map * map = nullptr
 
Tags object_tags
 

Detailed Description

Object type which can only be used for point symbols, and is also the only object which can be used with them.

Has exactly one coordinate, and additionally a rotation parameter.

Constructor & Destructor Documentation

◆ PointObject() [1/2]

OpenOrienteering::PointObject::PointObject ( const Symbol *  symbol = nullptr)
explicit

Constructs a PointObject, optionally assigning the symbol.

◆ PointObject() [2/2]

OpenOrienteering::PointObject::PointObject ( const PointObject &  proto)
explicitprotecteddefault

Constructs a PointObject, initialized from the given prototype.

Member Function Documentation

◆ copyFrom()

void OpenOrienteering::PointObject::copyFrom ( const Object &  other)
overridevirtual

Replaces the content of this object by that of another.

Reimplemented from OpenOrienteering::Object.

◆ duplicate()

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

Creates a duplicate of the point.

Use asPoint() on the result to obtain an object of type PointObject.

Implements OpenOrienteering::Object.

◆ getCoord()

MapCoord OpenOrienteering::PointObject::getCoord ( ) const

Returns the point's coordinate.

◆ getCoordF()

MapCoordF OpenOrienteering::PointObject::getCoordF ( ) const

Returns the point's position as MapCoordF.

◆ intersectsBox()

bool OpenOrienteering::PointObject::intersectsBox ( const QRectF &  box) const
overridevirtual

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

Implements OpenOrienteering::Object.

◆ operator=()

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

◆ setPosition() [1/3]

void OpenOrienteering::PointObject::setPosition ( qint32  x,
qint32  y 
)

Sets the point's position to a new position given in native map coordinates.

◆ setPosition() [2/3]

void OpenOrienteering::PointObject::setPosition ( const MapCoord &  coord)

Changes the point's position.

◆ setPosition() [3/3]

void OpenOrienteering::PointObject::setPosition ( const MapCoordF &  coord)

Changes the point's position.

◆ transform()

void OpenOrienteering::PointObject::transform ( const QTransform &  t)
overridevirtual

Transforms the position.

Implements OpenOrienteering::Object.


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