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

Symbol for PointObjects. More...

#include <point_symbol.h>

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

Classes

struct  Element
 

Public Member Functions

 PointSymbol () noexcept
 Constructs an empty point symbol. More...
 
 ~PointSymbol () override
 
bool validate () const override
 
void createRenderables (const Object *object, const VirtualCoordVector &coords, ObjectRenderables &output, RenderableOptions options) const override
 
void createRenderablesScaled (const MapCoordF &coord, qreal rotation, ObjectRenderables &output, qreal coord_scale=1) const
 
void createRenderablesIfCenterInside (const MapCoordF &point_coord, qreal rotation, const QPainterPath *outline, ObjectRenderables &output) const
 
void createPrimitivesIfCompletelyInside (const MapCoordF &point_coord, const QPainterPath *outline, ObjectRenderables &output) const
 
void createRenderablesIfCompletelyInside (const MapCoordF &point_coord, qreal rotation, const QPainterPath *outline, ObjectRenderables &output) const
 
void createPrimitivesIfPartiallyInside (const MapCoordF &point_coord, const QPainterPath *outline, ObjectRenderables &output) const
 
void createRenderablesIfPartiallyInside (const MapCoordF &point_coord, qreal rotation, const QPainterPath *outline, ObjectRenderables &output) const
 
void colorDeletedEvent (const MapColor *color) override
 Called when a color is removed from the map. More...
 
bool containsColor (const MapColor *color) const override
 Returns if the given color is used by this symbol. More...
 
const MapColorguessDominantColor () const override
 Returns the dominant color of this symbol. More...
 
void replaceColors (const MapColorMap &color_map) override
 Replaces colors used by this symbol. More...
 
void scale (double factor) override
 Scales the symbol. More...
 
qreal dimensionForIcon () const override
 Returns the dimension which shall considered when scaling the icon. More...
 
int getNumElements () const
 Returns the number of contained elements. More...
 
void addElement (int pos, Object *object, Symbol *symbol)
 Adds a new element consisting of object and symbol at the given index. More...
 
ObjectgetElementObject (int pos)
 Returns the object of the i-th element. More...
 
const ObjectgetElementObject (int pos) const
 Returns the object of the i-th element. More...
 
SymbolgetElementSymbol (int pos)
 Returns the symbol of the i-th element. More...
 
const SymbolgetElementSymbol (int pos) const
 Returns the symbol of the i-th element. More...
 
void deleteElement (int pos)
 Deletes the i-th element. More...
 
bool isEmpty () const
 Returns true if the point contains no elements and does not create renderables itself. More...
 
bool isSymmetrical () const
 Checks if the contained elements are rotationally symmetrical around the origin (this means, only point elements at (0,0) are allowed). More...
 
int getInnerRadius () const
 
void setInnerRadius (int value)
 
const MapColorgetInnerColor () const
 
void setInnerColor (const MapColor *color)
 
int getOuterWidth () const
 
void setOuterWidth (int value)
 
const MapColorgetOuterColor () const
 
void setOuterColor (const MapColor *color)
 
SymbolPropertiesWidgetcreatePropertiesWidget (SymbolSettingDialog *dialog) override
 Creates a properties widget for the symbol. More...
 
- Public Member Functions inherited from OpenOrienteering::Symbol
 Symbol (Type type) noexcept
 
virtual ~Symbol ()
 
Symboloperator= (const Symbol &)=delete
 
Symboloperator= (Symbol &&)=delete
 
bool equals (const Symbol *other, Qt::CaseSensitivity case_sensitivity=Qt::CaseSensitive) const
 Checks for equality to the other symbol. More...
 
bool stateEquals (const Symbol *other) const
 Checks protected/hidden state for equality to the other symbol. More...
 
Type getType () const
 Returns the type of the symbol. More...
 
const PointSymbolasPoint () const
 Case to PointSymbol with type checking. More...
 
PointSymbolasPoint ()
 Case to PointSymbol with type checking. More...
 
const LineSymbolasLine () const
 Case to LineSymbol with type checking. More...
 
LineSymbolasLine ()
 Case to LineSymbol with type checking. More...
 
const AreaSymbolasArea () const
 Case to AreaSymbol with type checking. More...
 
AreaSymbolasArea ()
 Case to AreaSymbol with type checking. More...
 
const TextSymbolasText () const
 Case to TextSymbol with type checking. More...
 
TextSymbolasText ()
 Case to TextSymbol with type checking. More...
 
const CombinedSymbolasCombined () const
 Case to CombinedSymbol with type checking. More...
 
CombinedSymbolasCombined ()
 Case to CombinedSymbol with type checking. More...
 
virtual TypeCombination getContainedTypes () const
 Returns the combined bitmask of all symbol types this symbol contains. More...
 
bool isTypeCompatibleTo (const Object *object) const
 Checks if the symbol can be applied to the given object. More...
 
bool numberEquals (const Symbol *other) const
 Returns if the symbol numbers are exactly equal. More...
 
bool numberEqualsRelaxed (const Symbol *other) const
 Returns if the symbol numbers are equal, ignoring trailing zeros. More...
 
void save (QXmlStreamWriter &xml, const Map &map) const
 Saves the symbol in xml format. More...
 
virtual bool loadingFinishedEvent (Map *map)
 Called when loading the map is finished. More...
 
virtual void createRenderables (const Object *object, const VirtualCoordVector &coords, ObjectRenderables &output, Symbol::RenderableOptions options) const =0
 Creates renderables for a generic object. More...
 
virtual void createRenderables (const PathObject *object, const PathPartVector &path_parts, ObjectRenderables &output, Symbol::RenderableOptions options) const
 Creates renderables for a path object. More...
 
virtual void createBaselineRenderables (const PathObject *object, const PathPartVector &path_parts, ObjectRenderables &output, const MapColor *color) const
 Creates baseline renderables for a path object. More...
 
virtual bool symbolChangedEvent (const Symbol *old_symbol, const Symbol *new_symbol)
 Called when a symbol was changed, replaced, or removed. More...
 
virtual bool containsSymbol (const Symbol *symbol) const
 Returns true if the given symbol is referenced by this symbol. More...
 
QImage getCustomIcon () const
 Returns the custom symbol icon. More...
 
void setCustomIcon (const QImage &image)
 Sets a custom symbol icon. More...
 
QImage getIcon (const Map *map) const
 Returns the symbol's icon. More...
 
QImage createIcon (const Map &map, int side_length, bool antialiasing=true, qreal zoom=0) const
 Creates a symbol icon with the given side length (pixels). More...
 
void resetIcon ()
 Clear the symbol's cached icon. More...
 
virtual qreal calculateLargestLineExtent () const
 Returns the largest extent of all primitive lines which are part of the symbol. More...
 
const QStringgetName () const
 Returns the symbol name. More...
 
QString getPlainTextName () const
 Returns the symbol name with all HTML markup stripped. More...
 
void setName (const QString &new_name)
 Sets the symbol name. More...
 
QString getNumberAsString () const
 Returns the symbol number as string. More...
 
int getNumberComponent (int i) const
 Returns the i-th component of the symbol number as int. More...
 
void setNumberComponent (int i, int new_number)
 Sets the i-th component of the symbol number. More...
 
const QStringgetDescription () const
 Returns the symbol description. More...
 
void setDescription (const QString &new_description)
 Sets the symbol description. More...
 
bool isHelperSymbol () const
 Returns if this is a helper symbol (which is not printed in the final map). More...
 
void setIsHelperSymbol (bool value)
 Sets if this is a helper symbol, see isHelperSymbol(). More...
 
bool isHidden () const
 Returns if this symbol is hidden. More...
 
void setHidden (bool value)
 Sets the hidden state of this symbol. More...
 
bool isProtected () const
 Returns if this symbol is protected. More...
 
void setProtected (bool value)
 Sets the protected state of this symbol. More...
 
bool isRotatable () const
 Returns if objects with this symbol can be rotated in arbitrary directions. More...
 

Protected Member Functions

 PointSymbol (const PointSymbol &proto)
 
PointSymbolduplicate () const override
 
void saveImpl (QXmlStreamWriter &xml, const Map &map) const override
 Must be overridden to save type-specific symbol properties. More...
 
bool loadImpl (QXmlStreamReader &xml, const Map &map, SymbolDictionary &symbol_dict, int version) override
 Must be overridden to load type-specific symbol properties. More...
 
bool equalsImpl (const Symbol *other, Qt::CaseSensitivity case_sensitivity) const override
 Must be overridden to compare specific attributes. More...
 
- Protected Member Functions inherited from OpenOrienteering::Symbol
 Symbol (const Symbol &proto)
 
void setRotatable (bool value)
 Sets the rotatability state of the symbol. More...
 

Protected Attributes

std::vector< Elementelements
 
const MapColorinner_color
 
const MapColorouter_color
 
int inner_radius
 
int outer_width
 

Friends

class PointSymbolSettings
 
class PointSymbolEditorWidget
 
class OCAD8FileImport
 
class XMLImportExport
 

Additional Inherited Members

- Public Types inherited from OpenOrienteering::Symbol
enum  Type {
  Point = 1, Line = 2, Area = 4, Text = 8,
  Combined = 16, NoSymbol = 0, AllSymbols = Point | Line | Area | Text | Combined
}
 Enumeration of all possible symbol types. More...
 
enum  RenderableOption { RenderBaselines = 1 << 0, RenderAreasHatched = 1 << 1, RenderNormal = 0 }
 RenderableOptions denominate variations in painting symbols. More...
 
- Static Public Member Functions inherited from OpenOrienteering::Symbol
template<class S >
static std::unique_ptr< S > duplicate (const S &s)
 Duplicates a symbol. More...
 
static std::unique_ptr< Symbolload (QXmlStreamReader &xml, const Map &map, SymbolDictionary &symbol_dict, int version)
 Load the symbol in xml format. More...
 
static std::unique_ptr< SymbolmakeSymbolForType (Type type)
 Returns a newly created symbol of the given type. More...
 
static bool areTypesCompatible (Type a, Type b)
 Returns if the symbol types can be applied to the same object types. More...
 
static TypeCombination getCompatibleTypes (Type type)
 Returns a bitmask of all types which can be applied to the same objects as the given type. More...
 
static bool lessByNumber (const Symbol *s1, const Symbol *s2)
 Compares two symbols by number. More...
 
static bool lessByColorPriority (const Symbol *s1, const Symbol *s2)
 Compares two symbols by the dominant colors' priorities. More...
 
- Static Public Attributes inherited from OpenOrienteering::Symbol
static constexpr auto number_components = 3u
 Number of components of symbol numbers. More...
 

Detailed Description

Symbol for PointObjects.

Apart from its own settings which are presented to the user as "[Midpoint symbol]" in the point symbol editor, this class can contain a list of elements together with a symbol for each element. All elements and the PointObject's own settings make up the appearance of the point symbol. The reason the own settings are left in is just efficiency, as for some symbols like crop land, a really huge number of point objects may be generated.

Constructor & Destructor Documentation

◆ PointSymbol() [1/2]

OpenOrienteering::PointSymbol::PointSymbol ( )
noexcept

Constructs an empty point symbol.

◆ ~PointSymbol()

OpenOrienteering::PointSymbol::~PointSymbol ( )
overridedefault

◆ PointSymbol() [2/2]

OpenOrienteering::PointSymbol::PointSymbol ( const PointSymbol proto)
explicitprotected

Member Function Documentation

◆ addElement()

void OpenOrienteering::PointSymbol::addElement ( int  pos,
Object object,
Symbol symbol 
)

Adds a new element consisting of object and symbol at the given index.

◆ colorDeletedEvent()

void OpenOrienteering::PointSymbol::colorDeletedEvent ( const MapColor color)
overridevirtual

Called when a color is removed from the map.

Symbols need to remove all references to the given color when this event occurs.

Implements OpenOrienteering::Symbol.

◆ containsColor()

bool OpenOrienteering::PointSymbol::containsColor ( const MapColor color) const
overridevirtual

Returns if the given color is used by this symbol.

Implements OpenOrienteering::Symbol.

◆ createPrimitivesIfCompletelyInside()

void OpenOrienteering::PointSymbol::createPrimitivesIfCompletelyInside ( const MapCoordF point_coord,
const QPainterPath outline,
ObjectRenderables output 
) const

◆ createPrimitivesIfPartiallyInside()

void OpenOrienteering::PointSymbol::createPrimitivesIfPartiallyInside ( const MapCoordF point_coord,
const QPainterPath outline,
ObjectRenderables output 
) const

◆ createPropertiesWidget()

SymbolPropertiesWidget * OpenOrienteering::PointSymbol::createPropertiesWidget ( SymbolSettingDialog dialog)
overridevirtual

Creates a properties widget for the symbol.

Implements OpenOrienteering::Symbol.

◆ createRenderables()

void OpenOrienteering::PointSymbol::createRenderables ( const Object object,
const VirtualCoordVector coords,
ObjectRenderables output,
RenderableOptions  options 
) const
override

◆ createRenderablesIfCenterInside()

void OpenOrienteering::PointSymbol::createRenderablesIfCenterInside ( const MapCoordF point_coord,
qreal  rotation,
const QPainterPath outline,
ObjectRenderables output 
) const

◆ createRenderablesIfCompletelyInside()

void OpenOrienteering::PointSymbol::createRenderablesIfCompletelyInside ( const MapCoordF point_coord,
qreal  rotation,
const QPainterPath outline,
ObjectRenderables output 
) const

◆ createRenderablesIfPartiallyInside()

void OpenOrienteering::PointSymbol::createRenderablesIfPartiallyInside ( const MapCoordF point_coord,
qreal  rotation,
const QPainterPath outline,
ObjectRenderables output 
) const

◆ createRenderablesScaled()

void OpenOrienteering::PointSymbol::createRenderablesScaled ( const MapCoordF coord,
qreal  rotation,
ObjectRenderables output,
qreal  coord_scale = 1 
) const

◆ deleteElement()

void OpenOrienteering::PointSymbol::deleteElement ( int  pos)

Deletes the i-th element.

◆ dimensionForIcon()

qreal OpenOrienteering::PointSymbol::dimensionForIcon ( ) const
overridevirtual

Returns the dimension which shall considered when scaling the icon.

Reimplemented from OpenOrienteering::Symbol.

◆ duplicate()

PointSymbol * OpenOrienteering::PointSymbol::duplicate ( ) const
overrideprotectedvirtual

◆ equalsImpl()

bool OpenOrienteering::PointSymbol::equalsImpl ( const Symbol other,
Qt::CaseSensitivity  case_sensitivity 
) const
overrideprotectedvirtual

Must be overridden to compare specific attributes.

Implements OpenOrienteering::Symbol.

◆ getElementObject() [1/2]

Object * OpenOrienteering::PointSymbol::getElementObject ( int  pos)

Returns the object of the i-th element.

◆ getElementObject() [2/2]

const Object * OpenOrienteering::PointSymbol::getElementObject ( int  pos) const

Returns the object of the i-th element.

◆ getElementSymbol() [1/2]

Symbol * OpenOrienteering::PointSymbol::getElementSymbol ( int  pos)

Returns the symbol of the i-th element.

◆ getElementSymbol() [2/2]

const Symbol * OpenOrienteering::PointSymbol::getElementSymbol ( int  pos) const

Returns the symbol of the i-th element.

◆ getInnerColor()

const MapColor* OpenOrienteering::PointSymbol::getInnerColor ( ) const
inline

◆ getInnerRadius()

int OpenOrienteering::PointSymbol::getInnerRadius ( ) const
inline

◆ getNumElements()

int OpenOrienteering::PointSymbol::getNumElements ( ) const

Returns the number of contained elements.

◆ getOuterColor()

const MapColor* OpenOrienteering::PointSymbol::getOuterColor ( ) const
inline

◆ getOuterWidth()

int OpenOrienteering::PointSymbol::getOuterWidth ( ) const
inline

◆ guessDominantColor()

const MapColor * OpenOrienteering::PointSymbol::guessDominantColor ( ) const
overridevirtual

Returns the dominant color of this symbol.

If it is not possible to efficiently determine this color exactly, an appropriate heuristic should be used.

Implements OpenOrienteering::Symbol.

◆ isEmpty()

bool OpenOrienteering::PointSymbol::isEmpty ( ) const

Returns true if the point contains no elements and does not create renderables itself.

Useful to check if it can be deleted.

◆ isSymmetrical()

bool OpenOrienteering::PointSymbol::isSymmetrical ( ) const

Checks if the contained elements are rotationally symmetrical around the origin (this means, only point elements at (0,0) are allowed).

◆ loadImpl()

bool OpenOrienteering::PointSymbol::loadImpl ( QXmlStreamReader xml,
const Map map,
SymbolDictionary symbol_dict,
int  version 
)
overrideprotectedvirtual

Must be overridden to load type-specific symbol properties.

See also
saveImpl()

Returns false if the current xml tag does not belong to the symbol and should be skipped, true if the element has been read completely.

Implements OpenOrienteering::Symbol.

◆ replaceColors()

void OpenOrienteering::PointSymbol::replaceColors ( const MapColorMap color_map)
overridevirtual

Replaces colors used by this symbol.

Implements OpenOrienteering::Symbol.

◆ saveImpl()

void OpenOrienteering::PointSymbol::saveImpl ( QXmlStreamWriter xml,
const Map map 
) const
overrideprotectedvirtual

Must be overridden to save type-specific symbol properties.

The map pointer can be used to get persistent indices to any pointers on map data.

Implements OpenOrienteering::Symbol.

◆ scale()

void OpenOrienteering::PointSymbol::scale ( double  factor)
overridevirtual

Scales the symbol.

Implements OpenOrienteering::Symbol.

◆ setInnerColor()

void OpenOrienteering::PointSymbol::setInnerColor ( const MapColor color)
inline

◆ setInnerRadius()

void OpenOrienteering::PointSymbol::setInnerRadius ( int  value)
inline

◆ setOuterColor()

void OpenOrienteering::PointSymbol::setOuterColor ( const MapColor color)
inline

◆ setOuterWidth()

void OpenOrienteering::PointSymbol::setOuterWidth ( int  value)
inline

◆ validate()

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

Reimplemented from OpenOrienteering::Symbol.

Friends And Related Function Documentation

◆ OCAD8FileImport

friend class OCAD8FileImport
friend

◆ PointSymbolEditorWidget

friend class PointSymbolEditorWidget
friend

◆ PointSymbolSettings

friend class PointSymbolSettings
friend

◆ XMLImportExport

friend class XMLImportExport
friend

Member Data Documentation

◆ elements

std::vector<Element> OpenOrienteering::PointSymbol::elements
protected

◆ inner_color

const MapColor* OpenOrienteering::PointSymbol::inner_color
protected

◆ inner_radius

int OpenOrienteering::PointSymbol::inner_radius
protected

◆ outer_color

const MapColor* OpenOrienteering::PointSymbol::outer_color
protected

◆ outer_width

int OpenOrienteering::PointSymbol::outer_width
protected

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