![]() |
Mapper
0.9.0
API documentation
|
Central class for an OpenOrienteering map. More...
#include <map.h>
Public Types | |
enum | ImportModeFlag { ObjectImport = 0x00, SymbolImport = 0x01, ColorImport = 0x02, GeorefImport = 0x10, MinimalImport = 0x20, MinimalSymbolImport = SymbolImport | MinimalImport, MinimalObjectImport = ObjectImport | MinimalImport, CompleteImport = ObjectImport | GeorefImport } |
Different strategies for importing elements from another map. More... | |
enum | SelectionVisibility { FullVisibility, PartialVisibility, IgnoreVisibilty } |
Options for zooming to visibility of selection. More... | |
typedef std::set< Object * > | ObjectSelection |
A set of selected objects represented by a std::set of object pointers. More... | |
Public Slots | |
void | updateSymbolIconZoom () |
Updates the symbol icon zoom from the current set of symbols. More... | |
Signals | |
void | hasUnsavedChanged (bool is_clean) |
Emitted when a the map enters or leaves the state which is saved on map. More... | |
void | colorAdded (int pos, const OpenOrienteering::MapColor *color) |
Emitted when a color is added to the map, gives the color's index and pointer. More... | |
void | colorChanged (int pos, const OpenOrienteering::MapColor *color) |
Emitted when a map color is changed, gives the color's index and pointer. More... | |
void | colorDeleted (int pos, const OpenOrienteering::MapColor *old_color) |
Emitted when a map color is deleted, gives the color's index and pointer. More... | |
void | spotColorPresenceChanged (bool has_spot_colors) const |
Emitted when the presence of spot colors in the map changes. More... | |
void | symbolAdded (int pos, const OpenOrienteering::Symbol *symbol) |
Emitted when a symbol is added to the map, gives the symbol's index and pointer. More... | |
void | symbolChanged (int pos, const OpenOrienteering::Symbol *new_symbol, const OpenOrienteering::Symbol *old_symbol) |
Emitted when a symbol in the map is changed. More... | |
void | symbolIconChanged (int pos) |
Emitted when the icon of the symbol with the given index changes. More... | |
void | symbolDeleted (int pos, const OpenOrienteering::Symbol *old_symbol) |
Emitted when a symbol in the map is deleted. More... | |
void | symbolIconZoomChanged () |
Emitted when the symbol icon zoom changes. More... | |
void | templateAdded (int pos, OpenOrienteering::Template *temp) |
Emitted when a template is added to the map, gives the template's index and pointer. More... | |
void | templateChanged (int pos, OpenOrienteering::Template *temp) |
Emitted when a template in the map is changed, gives the template's index and pointer. More... | |
void | templateDeleted (int pos, const OpenOrienteering::Template *old_temp) |
Emitted when a template in the map is deleted, gives the template's index and pointer. More... | |
void | closedTemplateAvailabilityChanged () |
Emitted when the number of closed templates changes between zero and one. More... | |
void | objectSelectionChanged () |
Emitted when the set of selected objects changes. More... | |
void | selectedObjectEdited () |
Emitted when at least one of the selected objects is edited in any way. More... | |
void | currentMapPartChanged (const OpenOrienteering::MapPart *part) |
Emitted when the map part currently used for drawing changes. More... | |
void | currentMapPartIndexChanged (std::size_t index) |
Emitted when the index of map part currently used for drawing changes. More... | |
void | mapPartAdded (std::size_t index, const OpenOrienteering::MapPart *part) |
Emitted when a part is added to the map. More... | |
void | mapPartChanged (std::size_t index, const OpenOrienteering::MapPart *part) |
Emitted when a part's properties are changed. More... | |
void | mapPartDeleted (std::size_t index, const OpenOrienteering::MapPart *part) |
Emitted when a part is removed from the map. More... | |
Public Member Functions | |
Map () | |
Creates a new, empty map. More... | |
~Map () override | |
Destroys the map. More... | |
void | clear () |
Deletes all map data. More... | |
void | init () |
Initializes an empty map. More... | |
void | reset () |
Deletes all map data, and reinitializes the empty map. More... | |
bool | loadFrom (const QString &path, MapView *view=nullptr) |
Attempts to load the map from the specified path. More... | |
QHash< const Symbol *, Symbol * > | importMap (const Map &imported_map, ImportMode mode, std::vector< bool > *filter=nullptr, int symbol_insert_pos=-1, bool merge_duplicate_symbols=true) |
Imports another map into this map. More... | |
QHash< const Symbol *, Symbol * > | importMap (const Map &imported_map, ImportMode mode, const QTransform &transform, std::vector< bool > *filter=nullptr, int symbol_insert_pos=-1, bool merge_duplicate_symbols=true) |
Imports another map into this map. More... | |
bool | exportToIODevice (QIODevice &device) const |
Serializes the map directly to the given IO device, in a fixed format. More... | |
bool | importFromIODevice (QIODevice &device) |
Loads the map directly from the given IO device. More... | |
void | draw (QPainter *painter, const RenderConfig &config) |
Draws the part of the map which is visible in the bounding box. More... | |
void | drawOverprintingSimulation (QPainter *painter, const RenderConfig &config) |
Draws a spot color overprinting simulation for the part of the map which is visible in the given bounding box. More... | |
void | drawColorSeparation (QPainter *painter, const RenderConfig &config, const MapColor *spot_color, bool use_color=false) |
Draws the separation for a particular spot color for the part of the map which is visible in the given bounding box. More... | |
void | drawGrid (QPainter *painter, const QRectF &bounding_box) |
Draws the map grid. More... | |
void | drawTemplates (QPainter *painter, const QRectF &bounding_box, int first_template, int last_template, const MapView *view, bool on_screen) const |
Draws the templates with indices first_template until last_template which are visible in the given bounding box. More... | |
void | updateObjects () |
Updates the renderables and extent of all objects which have changed. More... | |
QRectF | calculateExtent (bool include_helper_symbols=false, bool include_templates=false, const MapView *view=nullptr) const |
Calculates the extent of all map elements. More... | |
void | addMapWidget (MapWidget *widget) |
Must be called to notify the map of new widgets displaying it. More... | |
void | removeMapWidget (MapWidget *widget) |
Removes the map widget, see addMapWidget(). More... | |
void | updateAllMapWidgets () |
Redraws all map widgets completely - this can be slow! Try to avoid this and do partial redraws instead, if possible. More... | |
void | ensureVisibilityOfSelectedObjects (SelectionVisibility visibility) |
Makes sure that the selected object(s) are visible in all map widgets by moving the views in the widgets to the selected objects. More... | |
void | setDrawingBoundingBox (const QRectF &map_coords_rect, int pixel_border, bool do_update=true) |
Sets the rect (given in map coordinates) as "dirty rect" for every map widget showing this map, enlarged by the given pixel border. More... | |
void | clearDrawingBoundingBox () |
Removes the drawing bounding box and triggers a repaint. More... | |
void | setActivityBoundingBox (const QRectF &map_coords_rect, int pixel_border, bool do_update=true) |
This is the analogon to setDrawingBoundingBox() for activities. More... | |
void | clearActivityBoundingBox () |
This is the analogon to clearDrawingBoundingBox() for activities. More... | |
void | updateDrawing (const QRectF &map_coords_rect, int pixel_border) |
Updates all dynamic drawings at the given positions, i.e. More... | |
QString | translate (const QString &symbol_text) const |
Returns a translated symbol text (name or description), or the original text. More... | |
QString | raw_translation (const QString &symbol_text) const |
Returns a translated symbol text (name or description), or an empty string. More... | |
int | getNumColors () const |
Returns the number of map colors defined in this map. More... | |
const MapColor * | getMapColor (int i) const |
Returns a pointer to the MapColor identified by the non-negative priority i. More... | |
MapColor * | getMapColor (int i) |
Returns a pointer to the MapColor identified by the non-negative priority i. More... | |
const MapColor * | getColor (int i) const |
Returns a pointer to the const MapColor identified by the priority i. More... | |
void | setColor (MapColor *color, int pos) |
Replaces the color at index pos with the given color, updates dependent colors and symbol icons. More... | |
void | addColor (MapColor *color, int pos) |
Adds the given color as a new color at the given index. More... | |
void | deleteColor (int pos) |
Deletes the color at the given index. More... | |
int | findColorIndex (const MapColor *color) const |
Loops through the color list, looking for the given color pointer. More... | |
void | setColorsDirty () |
Marks the colors as "dirty", i.e. More... | |
void | useColorsFrom (Map *map) |
Makes this map use the color set from the given map. More... | |
bool | isColorUsedByASymbol (const MapColor *color) const |
Checks and returns if the given color is used by at least one symbol. More... | |
void | determineColorsInUse (const std::vector< bool > &by_which_symbols, std::vector< bool > &out) const |
Checks which colors are in use by the symbols in this map. More... | |
bool | hasSpotColors () const |
Returns true if the map contains spot colors. More... | |
bool | hasAlpha () const |
Returns true if any visible object uses a non-opaque color. More... | |
QString | symbolSetId () const |
Returns the symbol set ID. More... | |
void | setSymbolSetId (const QString &id) |
Sets the symbol set ID. More... | |
int | getNumSymbols () const |
Returns the number of symbols in this map. More... | |
const Symbol * | getSymbol (int i) const |
Returns a pointer to the i-th symbol. More... | |
Symbol * | getSymbol (int i) |
Returns a pointer to the i-th symbol. More... | |
void | setSymbol (Symbol *symbol, int pos) |
Replaces the symbol at the given index with another symbol. More... | |
void | addSymbol (Symbol *symbol, int pos) |
Adds the given symbol at the specified index. More... | |
void | moveSymbol (int from, int to) |
Moves a symbol from one index to another in the symbol list. More... | |
template<typename T > | |
void | sortSymbols (T compare) |
Sorts the symbol list using the given comparator. More... | |
void | deleteSymbol (int pos) |
Deletes the symbol at the given index. More... | |
int | findSymbolIndex (const Symbol *symbol) const |
Loops over all symbols, looking for the given symbol pointer. More... | |
void | setSymbolsDirty () |
Marks the symbols as "dirty", i.e. More... | |
void | updateSymbolIcons (const MapColor *color) |
Updates the icons of all symbols with the given color. More... | |
void | scaleAllSymbols (double factor) |
Scales all symbols by the given factor. More... | |
void | determineSymbolsInUse (std::vector< bool > &out) const |
Checks which symbols are in use in this map. More... | |
void | determineSymbolUseClosure (std::vector< bool > &symbol_bitfield) const |
Adds to the given symbol bitfield all other symbols which are needed to display the symbols indicated by the bitfield because of symbol dependencies. More... | |
qreal | symbolIconZoom () const |
Returns the scale factor to be used for default symbol icons. More... | |
int | getNumTemplates () const |
Returns the number of templates in this map. More... | |
const Template * | getTemplate (int i) const |
Returns the i-th template. More... | |
Template * | getTemplate (int i) |
Returns the i-th template. More... | |
void | setFirstFrontTemplate (int pos) |
Sets the template index which is the first (lowest) to be drawn in front of the map. More... | |
int | getFirstFrontTemplate () const |
Returns the template index which is the first (lowest) to be drawn in front of the map. More... | |
void | setTemplate (Template *temp, int pos) |
Replaces the template at the given index with another. More... | |
void | addTemplate (Template *temp, int pos) |
Adds a new template at the given index. More... | |
void | removeTemplate (int pos) |
Removes the template with the given index from the template list, but does not delete it. More... | |
void | deleteTemplate (int pos) |
Removes the template with the given position from the template list and deletes it. More... | |
void | setTemplateAreaDirty (Template *temp, const QRectF &area, int pixel_border) |
Marks the area defined by the given QRectF (in map coordinates) and pixel border as "dirty", i.e. More... | |
void | setTemplateAreaDirty (int i) |
Marks the whole area of the i-th template as "to be repainted". More... | |
int | findTemplateIndex (const Template *temp) const |
Loops over all templates in the map and looks for the given template pointer. More... | |
void | setTemplatesDirty () |
Marks the template settings as "dirty", i.e. More... | |
void | emitTemplateChanged (Template *temp) |
Emits templateChanged() for the given template. More... | |
int | getNumClosedTemplates () const |
Returns the number of manually closed templates for which the settings are still stored. More... | |
const Template * | getClosedTemplate (int i) const |
Returns the i-th closed template. More... | |
Template * | getClosedTemplate (int i) |
Returns the i-th closed template. More... | |
void | clearClosedTemplates () |
Empties the list of closed templates. More... | |
void | closeTemplate (int i) |
Removes the template with the given index from the normal template list, unloads the template file and adds the template to the closed template list. More... | |
bool | reloadClosedTemplate (int i, int target_pos, QWidget *dialog_parent, const QString &map_path=QString()) |
Removes the template with the given index from the closed template list, load the template file and adds the template to the normal template list again. More... | |
UndoManager & | undoManager () |
Returns the UndoManager instance for this map. More... | |
const UndoManager & | undoManager () const |
Returns the UndoManager instance for this map. More... | |
void | push (UndoStep *step) |
Pushes a new undo step to the map's undoManager. More... | |
int | getNumParts () const |
Returns the number of map parts in this map. More... | |
MapPart * | getPart (std::size_t i) const |
Returns the i-th map part. More... | |
void | addPart (MapPart *part, std::size_t index) |
Adds the new part at the given index. More... | |
void | removePart (std::size_t index) |
Removes the map part at position. More... | |
int | findPartIndex (const MapPart *part) const |
Loops over all map parts, looking for the given part pointer. More... | |
MapPart * | getCurrentPart () const |
Returns the current map part, i.e. More... | |
void | setCurrentPart (MapPart *part) |
Changes the current map part. More... | |
std::size_t | getCurrentPartIndex () const |
Returns the index of the current map part. More... | |
void | setCurrentPartIndex (std::size_t index) |
Changes the current map part. More... | |
int | reassignObjectsToMapPart (std::vector< int >::const_iterator first, std::vector< int >::const_iterator last, std::size_t source, std::size_t destination) |
Moves all specified objects from the source to the target map part. More... | |
int | mergeParts (std::size_t source, std::size_t destination) |
Merges the source part with the destination part. More... | |
int | getNumObjects () const |
Returns the total number of objects in this map (sum of all parts) More... | |
int | addObject (Object *object, int part_index=-1) |
Adds the object as new object in the part with the given index, or in the current part if the default -1 is passed. More... | |
void | deleteObject (Object *object, bool remove_only) |
Deletes the given object from the map. More... | |
void | setObjectsDirty () |
Marks the objects as "dirty", i.e. More... | |
void | setObjectAreaDirty (const QRectF &map_coords_rect) |
Marks the area given by map_coords_rect as "dirty" in all map widgets, i.e. More... | |
void | findObjectsAt (const MapCoordF &coord, float tolerance, bool treat_areas_as_paths, bool extended_selection, bool include_hidden_objects, bool include_protected_objects, SelectionInfoVector &out) const |
Finds and returns all objects at the given position in the current part. More... | |
void | findAllObjectsAt (const MapCoordF &coord, float tolerance, bool treat_areas_as_paths, bool extended_selection, bool include_hidden_objects, bool include_protected_objects, SelectionInfoVector &out) const |
Finds and returns all objects at the given position in all parts. More... | |
void | findObjectsAtBox (const MapCoordF &corner1, const MapCoordF &corner2, bool include_hidden_objects, bool include_protected_objects, std::vector< Object *> &out) const |
Finds and returns all objects intersecting the given box in the current part. More... | |
int | countObjectsInRect (const QRectF &map_coord_rect, bool include_hidden_objects) |
Counts the objects whose bounding boxes intersect the given rect. More... | |
bool | existsObject (const std::function< bool(const Object *)> &condition) const |
Applies a condition on all objects until the first match is found. More... | |
void | applyOnMatchingObjects (const std::function< void(Object *)> &operation, const std::function< bool(const Object *)> &condition) |
Applies an operation on all objects which match a particular condition. More... | |
void | applyOnMatchingObjects (const std::function< void(const Object *)> &operation, const std::function< bool(const Object *)> &condition) const |
Applies a function on all objects which match a particular condition. More... | |
void | applyOnMatchingObjects (const std::function< void(Object *, MapPart *, int)> &operation, const std::function< bool(const Object *)> &condition) |
Applies an operation on all objects which match a particular condition. More... | |
void | applyOnAllObjects (const std::function< void(Object *)> &operation) |
Applies an operation on all objects. More... | |
void | applyOnAllObjects (const std::function< void(const Object *)> &operation) const |
Applies an operation on all objects. More... | |
void | applyOnAllObjects (const std::function< void(Object *, MapPart *, int)> &operation) |
Applies an operation on all objects. More... | |
void | scaleAllObjects (double factor, const MapCoord &scaling_center) |
Scales all objects by the given factor. More... | |
void | rotateAllObjects (double rotation, const MapCoord ¢er) |
Rotates all objects by the given rotation angle (in radians). More... | |
void | updateAllObjects () |
Forces an update of all objects, i.e. More... | |
void | updateAllObjectsWithSymbol (const Symbol *symbol) |
Forces an update of all objects with the given symbol. More... | |
void | changeSymbolForAllObjects (const Symbol *old_symbol, const Symbol *new_symbol) |
For all symbols with old_symbol, replaces the symbol by new_symbol. More... | |
bool | deleteAllObjectsWithSymbol (const Symbol *symbol) |
Deletes all objects with the given symbol. More... | |
bool | existsObjectWithSymbol (const Symbol *symbol) const |
Returns if at least one object with the given symbol exists in the map. More... | |
void | removeRenderablesOfObject (const Object *object, bool mark_area_as_dirty) |
Removes the renderables of the given object from display (does not delete them!). More... | |
void | insertRenderablesOfObject (const Object *object) |
Inserts the renderables of the given object, so they will be displayed. More... | |
void | markAsIrregular (Object *object) |
Marks an object as irregular. More... | |
const std::set< Object * > | irregularObjects () const |
Returns the list of objects marked as irregular. More... | |
std::size_t | deleteIrregularObjects () |
Deletes the irregular objects. More... | |
const ObjectSelection & | selectedObjects () const |
int | getNumSelectedObjects () const |
Returns the number of selected objects. More... | |
ObjectSelection::const_iterator | selectedObjectsBegin () const |
Returns an iterator allowing to iterate over the selected objects. More... | |
ObjectSelection::const_iterator | selectedObjectsEnd () const |
Returns an end iterator allowing to iterate over the selected objects. More... | |
const Object * | getFirstSelectedObject () const |
Returns the object in the selection which was selected first by the user. More... | |
Object * | getFirstSelectedObject () |
Returns the object in the selection which was selected first by the user. More... | |
void | getSelectionToSymbolCompatibility (const Symbol *symbol, bool &out_compatible, bool &out_different) const |
Checks the selected objects for compatibility with the given symbol. More... | |
void | deleteSelectedObjects () |
Deletes the selected objects and creates an undo step for this action. More... | |
void | includeSelectionRect (QRectF &rect) const |
Enlarges the given rect to cover all selected objects. More... | |
void | drawSelection (QPainter *painter, bool force_min_size, MapWidget *widget, MapRenderables *replacement_renderables=nullptr, bool draw_normal=false) |
Draws the selected objects. More... | |
void | addObjectToSelection (Object *object, bool emit_selection_changed) |
Adds the given object to the selection. More... | |
void | removeObjectFromSelection (Object *object, bool emit_selection_changed) |
Removes the given object from the selection. More... | |
bool | removeSymbolFromSelection (const Symbol *symbol, bool emit_selection_changed) |
Removes from the selection all objects with the given symbol. More... | |
bool | isObjectSelected (const Object *object) const |
Returns true if the given object is selected. More... | |
bool | toggleObjectSelection (Object *object, bool emit_selection_changed) |
Toggles the selection of the given object. More... | |
void | clearObjectSelection (bool emit_selection_changed) |
Empties the object selection. More... | |
void | emitSelectionChanged () |
Emits objectSelectionChanged(). More... | |
void | emitSelectionEdited () |
Emits selectedObjectEdited(). More... | |
void | setScaleDenominator (unsigned int value) |
Sets the map's scale denominator. More... | |
unsigned int | getScaleDenominator () const |
Returns the map's scale denominator. More... | |
void | changeScale (unsigned int new_scale_denominator, const MapCoord &scaling_center, bool scale_symbols, bool scale_objects, bool scale_georeferencing, bool scale_templates) |
Changes the map's scale. More... | |
void | rotateMap (double rotation, const MapCoord ¢er, bool adjust_georeferencing, bool adjust_declination, bool adjust_templates) |
Rotate the map around a point. More... | |
const QString & | getMapNotes () const |
Returns the map notes string. More... | |
void | setMapNotes (const QString &text) |
Sets the map notes string. More... | |
const Georeferencing & | getGeoreferencing () const |
Returns the map's georeferencing object. More... | |
void | setGeoreferencing (const Georeferencing &georeferencing) |
Assigns georeferencing settings for the map from the given object and sets the map to have unsaved changes. More... | |
const MapGrid & | getGrid () const |
Returns the map's grid settings. More... | |
void | setGrid (const MapGrid &grid) |
Sets the map's grid settings from the given object and may set the map to have unsaved changes. More... | |
bool | isAreaHatchingEnabled () const |
TODO: These two options should really be view options, but are not due to a limitation: the current architecture makes it impossible to have different renderables of the same objects in different views! More... | |
void | setAreaHatchingEnabled (bool enabled) |
Sets if area hatching is enabled. More... | |
bool | isBaselineViewEnabled () const |
Returns if the baseline view is enabled. More... | |
void | setBaselineViewEnabled (bool enabled) |
Sets if the baseline view is enabled. More... | |
int | renderableOptions () const |
Returns the rendering options as an int representing Symbol::RenderableOptions. More... | |
bool | hasPrinterConfig () const noexcept |
Returns true if the map has a print configuration. More... | |
const MapPrinterConfig & | printerConfig () |
Returns a const reference to the current print configuration. More... | |
MapPrinterConfig | printerConfig () const |
Returns a copy of the current print configuration. More... | |
void | setPrinterConfig (const MapPrinterConfig &config) |
Sets the print configuration. More... | |
void | resetPrinterConfig () |
Clears the print configuration. More... | |
void | getImageTemplateDefaults (bool &use_meters_per_pixel, double &meters_per_pixel, double &dpi, double &scale) |
Returns the default parameters for loading of image templates. More... | |
void | setImageTemplateDefaults (bool use_meters_per_pixel, double meters_per_pixel, double dpi, double scale) |
Sets default parameters for loading of image templates. More... | |
bool | hasUnsavedChanges () const |
Returns whether there are unsaved changes in the map. More... | |
void | setHasUnsavedChanges (bool has_unsaved_changes) |
Do not use this in usual cases, see hasUnsavedChanged(). More... | |
bool | areColorsDirty () const |
Returns if there are unsaved changes to the colors. More... | |
bool | areSymbolsDirty () const |
Returns if there are unsaved changes to the symbols. More... | |
bool | areTemplatesDirty () const |
Returns if there are unsaved changes to the templates. More... | |
bool | areObjectsDirty () const |
Returns if there are unsaved changes to the objects. More... | |
bool | isOtherDirty () const |
Returns if there are unsaved changes to anything else than the above. More... | |
void | setOtherDirty () |
Marks something unspecific in the map as "dirty", i.e. More... | |
![]() | |
virtual const QMetaObject * | metaObject () const const |
QObject (QObject *parent) | |
virtual | ~QObject () |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
QString | objectName () const const |
void | setObjectName (const QString &name) |
bool | isWidgetType () const const |
bool | isWindowType () const const |
bool | signalsBlocked () const const |
bool | blockSignals (bool block) |
QThread * | thread () const const |
void | moveToThread (QThread *targetThread) |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType) |
void | killTimer (int id) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegExp ®Exp, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
const QObjectList & | children () const const |
void | setParent (QObject *parent) |
void | installEventFilter (QObject *filterObj) |
void | removeEventFilter (QObject *obj) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) const const |
bool | disconnect (const QObject *receiver, const char *method) const const |
void | dumpObjectTree () |
void | dumpObjectInfo () |
void | dumpObjectTree () const const |
void | dumpObjectInfo () const const |
bool | setProperty (const char *name, const QVariant &value) |
QVariant | property (const char *name) const const |
QList< QByteArray > | dynamicPropertyNames () const const |
void | destroyed (QObject *obj) |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
bool | inherits (const char *className) const const |
void | deleteLater () |
Q_DISABLE_COPY (Class) | |
Q_DISABLE_MOVE (Class) | |
Q_DISABLE_COPY_MOVE (Class) | |
T | qobject_cast (QObject *object) |
T | qobject_cast (const QObject *object) |
T | qFindChild (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QString &name) |
QList< T > | qFindChildren (const QObject *obj, const QRegExp ®Exp) |
Q_CLASSINFO (Name, Value) | |
Q_INTERFACES (...) | |
Q_PROPERTY (...) | |
Q_ENUMS (...) | |
Q_FLAGS (...) | |
Q_ENUM (...) | |
Q_FLAG (...) | |
Q_ENUM_NS (...) | |
Q_FLAG_NS (...) | |
Q_OBJECT Q_OBJECT | |
Q_GADGET Q_GADGET | |
Q_NAMESPACE Q_NAMESPACE | |
Q_SIGNALS Q_SIGNALS | |
Q_SIGNAL Q_SIGNAL | |
Q_SLOTS Q_SLOTS | |
Q_SLOT Q_SLOT | |
Q_EMIT Q_EMIT | |
Q_INVOKABLE Q_INVOKABLE | |
Q_REVISION Q_REVISION | |
Q_SET_OBJECT_NAME (Object) | |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
Static Public Member Functions | |
static const MapColor * | getCoveringRed () |
Returns the special covering red color. More... | |
static const MapColor * | getCoveringWhite () |
Returns the special covering white color. More... | |
static const MapColor * | getUndefinedColor () |
Returns the special covering gray color for "undefined" objects. More... | |
static const MapColor * | getRegistrationColor () |
Returns the special registration color. More... | |
static LineSymbol * | getCoveringWhiteLine () |
Returns the special covering white line symbol. More... | |
static LineSymbol * | getCoveringRedLine () |
Returns the special covering red line symbol. More... | |
static CombinedSymbol * | getCoveringCombinedLine () |
Returns the special covering combined symbol (white + red). More... | |
static LineSymbol * | getUndefinedLine () |
Returns the special gray "undefined" line symbol. More... | |
static PointSymbol * | getUndefinedPoint () |
Returns the special gray "undefined" point symbol. More... | |
static TextSymbol * | getUndefinedText () |
Returns the special gray "undefined" text symbol. More... | |
![]() | |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, Functor functor) |
QMetaObject::Connection | connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QMetaObject::Connection &connection) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
Protected Slots | |
void | checkSpotColorPresence () |
void | undoCleanChanged (bool is_clean) |
Friends | |
class | MapTest |
class | MapRenderables |
class | OCAD8FileImport |
class | XMLFileImporter |
class | XMLFileExporter |
Additional Inherited Members | |
![]() | |
typedef | QObjectList |
![]() | |
QObject * | sender () const const |
int | senderSignalIndex () const const |
int | receivers (const char *signal) const const |
bool | isSignalConnected (const QMetaMethod &signal) const const |
virtual void | timerEvent (QTimerEvent *event) |
virtual void | childEvent (QChildEvent *event) |
virtual void | customEvent (QEvent *event) |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
![]() | |
objectName | |
Central class for an OpenOrienteering map.
typedef std::set<Object*> OpenOrienteering::Map::ObjectSelection |
A set of selected objects represented by a std::set of object pointers.
Different strategies for importing elements from another map.
OpenOrienteering::Map::Map | ( | ) |
Creates a new, empty map.
|
override |
Destroys the map.
void OpenOrienteering::Map::addColor | ( | MapColor * | color, |
int | pos | ||
) |
Adds the given color as a new color at the given index.
Emits colorAdded().
void OpenOrienteering::Map::addMapWidget | ( | MapWidget * | widget | ) |
Must be called to notify the map of new widgets displaying it.
Useful to notify the widgets about which parts of the map have changed and need to be redrawn.
int OpenOrienteering::Map::addObject | ( | Object * | object, |
int | part_index = -1 |
||
) |
Adds the object as new object in the part with the given index, or in the current part if the default -1 is passed.
Returns the index of the added object in the part.
Adds the given object to the selection.
object | The object to add. |
emit_selection_changed | Set to true if objectSelectionChanged() should be emitted. Do this only for the last in a sequence of selection change oparations to prevent bad performance! |
void OpenOrienteering::Map::addPart | ( | MapPart * | part, |
std::size_t | index | ||
) |
Adds the new part at the given index.
void OpenOrienteering::Map::addSymbol | ( | Symbol * | symbol, |
int | pos | ||
) |
Adds the given symbol at the specified index.
Emits symbolAdded().
void OpenOrienteering::Map::addTemplate | ( | Template * | temp, |
int | pos | ||
) |
Adds a new template at the given index.
To place a template immediately below the map, adjust first_front_template manually with setFirstFrontTemplate()!
void OpenOrienteering::Map::applyOnAllObjects | ( | const std::function< void(Object *)> & | operation | ) |
Applies an operation on all objects.
void OpenOrienteering::Map::applyOnAllObjects | ( | const std::function< void(const Object *)> & | operation | ) | const |
Applies an operation on all objects.
void OpenOrienteering::Map::applyOnAllObjects | ( | const std::function< void(Object *, MapPart *, int)> & | operation | ) |
Applies an operation on all objects.
void OpenOrienteering::Map::applyOnMatchingObjects | ( | const std::function< void(Object *)> & | operation, |
const std::function< bool(const Object *)> & | condition | ||
) |
Applies an operation on all objects which match a particular condition.
void OpenOrienteering::Map::applyOnMatchingObjects | ( | const std::function< void(const Object *)> & | operation, |
const std::function< bool(const Object *)> & | condition | ||
) | const |
Applies a function on all objects which match a particular condition.
void OpenOrienteering::Map::applyOnMatchingObjects | ( | const std::function< void(Object *, MapPart *, int)> & | operation, |
const std::function< bool(const Object *)> & | condition | ||
) |
Applies an operation on all objects which match a particular condition.
|
inline |
Returns if there are unsaved changes to the colors.
|
inline |
Returns if there are unsaved changes to the objects.
|
inline |
Returns if there are unsaved changes to the symbols.
|
inline |
Returns if there are unsaved changes to the templates.
QRectF OpenOrienteering::Map::calculateExtent | ( | bool | include_helper_symbols = false , |
bool | include_templates = false , |
||
const MapView * | view = nullptr |
||
) | const |
Calculates the extent of all map elements.
If templates shall be included, view may either be nullptr to include all templates, or specify a MapView to take the template visibilities from.
void OpenOrienteering::Map::changeScale | ( | unsigned int | new_scale_denominator, |
const MapCoord & | scaling_center, | ||
bool | scale_symbols, | ||
bool | scale_objects, | ||
bool | scale_georeferencing, | ||
bool | scale_templates | ||
) |
Changes the map's scale.
new_scale_denominator | The new scale denominator. |
scaling_center | The coordinate to use as scaling center. |
scale_symbols | Whether to scale the map symbols. |
scale_objects | Whether to scale the map object coordinates. |
scale_georeferencing | Whether to adjust the map's georeferencing reference point. |
scale_templates | Whether to scale non-georeferenced templates. |
void OpenOrienteering::Map::changeSymbolForAllObjects | ( | const Symbol * | old_symbol, |
const Symbol * | new_symbol | ||
) |
For all symbols with old_symbol, replaces the symbol by new_symbol.
|
protectedslot |
void OpenOrienteering::Map::clear | ( | ) |
Deletes all map data.
The resulting map must not be modified before another init().
void OpenOrienteering::Map::clearActivityBoundingBox | ( | ) |
This is the analogon to clearDrawingBoundingBox() for activities.
void OpenOrienteering::Map::clearClosedTemplates | ( | ) |
Empties the list of closed templates.
void OpenOrienteering::Map::clearDrawingBoundingBox | ( | ) |
Removes the drawing bounding box and triggers a repaint.
Use this if the current drawing is hidden or erased.
void OpenOrienteering::Map::clearObjectSelection | ( | bool | emit_selection_changed | ) |
Empties the object selection.
emit_selection_changed | See addObjectToSelection(). |
|
signal |
Emitted when the number of closed templates changes between zero and one.
void OpenOrienteering::Map::closeTemplate | ( | int | i | ) |
Removes the template with the given index from the normal template list, unloads the template file and adds the template to the closed template list.
NOTE: if required, adjust first_front_template manually with setFirstFrontTemplate()!
|
signal |
Emitted when a color is added to the map, gives the color's index and pointer.
|
signal |
Emitted when a map color is changed, gives the color's index and pointer.
|
signal |
Emitted when a map color is deleted, gives the color's index and pointer.
int OpenOrienteering::Map::countObjectsInRect | ( | const QRectF & | map_coord_rect, |
bool | include_hidden_objects | ||
) |
Counts the objects whose bounding boxes intersect the given rect.
This may be inaccurate because the true object shapes usually differ from the bounding boxes.
map_coord_rect | The query rect. |
include_hidden_objects | Set to true if you want to find hidden objects. |
|
signal |
Emitted when the map part currently used for drawing changes.
|
signal |
Emitted when the index of map part currently used for drawing changes.
This signal may be emitted even when the current MapPart object does not change. This happens when the index changes due to addition or removal of map parts.
Deletes all objects with the given symbol.
void OpenOrienteering::Map::deleteColor | ( | int | pos | ) |
Deletes the color at the given index.
Emits colorDeleted().
std::size_t OpenOrienteering::Map::deleteIrregularObjects | ( | ) |
Deletes the irregular objects.
This function deletes the objects which were previously marked as irregular. Only objects which are actually member of map parts are deleted. Objects in undo steps or similar are ignored.
Deletes the given object from the map.
remove_only will remove the object from the map, but not call "delete object"; be sure to call removeObjectFromSelection() if necessary.
TODO: make a separate method "removeObject()", remove_only is misleading!
void OpenOrienteering::Map::deleteSelectedObjects | ( | ) |
Deletes the selected objects and creates an undo step for this action.
void OpenOrienteering::Map::deleteSymbol | ( | int | pos | ) |
Deletes the symbol at the given index.
Emits symbolDeleted().
void OpenOrienteering::Map::deleteTemplate | ( | int | pos | ) |
Removes the template with the given position from the template list and deletes it.
NOTE: if required, adjust first_front_template manually with setFirstFrontTemplate()!
void OpenOrienteering::Map::determineColorsInUse | ( | const std::vector< bool > & | by_which_symbols, |
std::vector< bool > & | out | ||
) | const |
Checks which colors are in use by the symbols in this map.
WARNING (FIXME): returns an empty list if the map does not contain symbols!
by_which_symbols | Must be of the same size as the symbol set. If set to false for a symbol, it will be disregarded. |
out | Output parameter: a vector of the same size as the color list, where each element is set to true if the color is used by at least one symbol. |
void OpenOrienteering::Map::determineSymbolsInUse | ( | std::vector< bool > & | out | ) | const |
Checks which symbols are in use in this map.
Returns a vector of the same size as the symbol list, where each element is set to true if there is at least one object which uses this symbol or a derived (combined) symbol.
void OpenOrienteering::Map::determineSymbolUseClosure | ( | std::vector< bool > & | symbol_bitfield | ) | const |
Adds to the given symbol bitfield all other symbols which are needed to display the symbols indicated by the bitfield because of symbol dependencies.
void OpenOrienteering::Map::draw | ( | QPainter * | painter, |
const RenderConfig & | config | ||
) |
Draws the part of the map which is visible in the bounding box.
painter | The QPainter used for drawing. |
config | The rendering configuration |
void OpenOrienteering::Map::drawColorSeparation | ( | QPainter * | painter, |
const RenderConfig & | config, | ||
const MapColor * | spot_color, | ||
bool | use_color = false |
||
) |
Draws the separation for a particular spot color for the part of the map which is visible in the given bounding box.
Separations are normally drawn in levels of gray where black means full tone of the spot color. The parameter use_color can be used to draw in the actual spot color instead.
painter | The QPainter used for drawing. |
config | The rendering configuration |
spot_color | The spot color to draw the separation for. |
use_color | If true, forces the separation to be drawn in its actual color. |
Draws the map grid.
painter | The QPainter used for drawing. |
bounding_box | Bounding box of area to draw, given in map coordinates. |
void OpenOrienteering::Map::drawOverprintingSimulation | ( | QPainter * | painter, |
const RenderConfig & | config | ||
) |
void OpenOrienteering::Map::drawSelection | ( | QPainter * | painter, |
bool | force_min_size, | ||
MapWidget * | widget, | ||
MapRenderables * | replacement_renderables = nullptr , |
||
bool | draw_normal = false |
||
) |
Draws the selected objects.
painter | The QPainter used for drawing. |
force_min_size | See draw(). |
widget | The widget in which the drawing happens. Used to get view and viewport information. |
replacement_renderables | If given, draws these renderables instead Of the selection renderables. TODO: HACK |
draw_normal | If set to true, draws the objects like normal objects, otherwise draws transparent highlights. |
void OpenOrienteering::Map::drawTemplates | ( | QPainter * | painter, |
const QRectF & | bounding_box, | ||
int | first_template, | ||
int | last_template, | ||
const MapView * | view, | ||
bool | on_screen | ||
) | const |
Draws the templates with indices first_template until last_template which are visible in the given bounding box.
view determines template visibility and can be nullptr to show all templates. The initial transform of the given QPainter must be the map-to-paintdevice transformation. If on_screen is set to true, some optimizations will be applied, leading to a possibly lower display quality.
painter | The QPainter used for drawing. |
bounding_box | Bounding box of area to draw, given in map coordinates. |
first_template | Lowest index of the template range to draw. |
last_template | Highest index of the template range to draw. |
view | Optional pointer to MapView object which is used to query template visibilities. |
on_screen | Potentially enables some drawing optimizations which decrease drawing quality. Should be enabled when drawing on-screen. |
void OpenOrienteering::Map::emitSelectionChanged | ( | ) |
Emits objectSelectionChanged().
Use this if setting emit_selection_changed in a selection change method is unfeasible.
void OpenOrienteering::Map::emitSelectionEdited | ( | ) |
Emits selectedObjectEdited().
Use this after making changes to a selected object.
void OpenOrienteering::Map::emitTemplateChanged | ( | Template * | temp | ) |
Emits templateChanged() for the given template.
void OpenOrienteering::Map::ensureVisibilityOfSelectedObjects | ( | SelectionVisibility | visibility | ) |
Makes sure that the selected object(s) are visible in all map widgets by moving the views in the widgets to the selected objects.
bool OpenOrienteering::Map::existsObject | ( | const std::function< bool(const Object *)> & | condition | ) | const |
Applies a condition on all objects until the first match is found.
Returns if at least one object with the given symbol exists in the map.
WARNING: Even if no objects exist directly, the symbol could still be required by another (combined) symbol used by an object!
Serializes the map directly to the given IO device, in a fixed format.
This can be imported again using importFromIODevice(). Returns true if successful.
void OpenOrienteering::Map::findAllObjectsAt | ( | const MapCoordF & | coord, |
float | tolerance, | ||
bool | treat_areas_as_paths, | ||
bool | extended_selection, | ||
bool | include_hidden_objects, | ||
bool | include_protected_objects, | ||
SelectionInfoVector & | out | ||
) | const |
Finds and returns all objects at the given position in all parts.
int OpenOrienteering::Map::findColorIndex | ( | const MapColor * | color | ) | const |
Loops through the color list, looking for the given color pointer.
Returns the index of the color, or -1 if it is not found.
void OpenOrienteering::Map::findObjectsAt | ( | const MapCoordF & | coord, |
float | tolerance, | ||
bool | treat_areas_as_paths, | ||
bool | extended_selection, | ||
bool | include_hidden_objects, | ||
bool | include_protected_objects, | ||
SelectionInfoVector & | out | ||
) | const |
Finds and returns all objects at the given position in the current part.
coord | Coordinate where to query objects. |
tolerance | Allowed distance from the query coordinate to the objects. |
treat_areas_as_paths | If set to true, areas will be treated as paths, i.e. they will be returned only if the query coordinate is close to their border, not in all cases where the query coordinate is inside the area. |
extended_selection | If set to true, more object than defined by the default behavior will be selected. For example, by default point objects will only be returned if the query coord is close to the point object coord. With extended_selection, they are also returned if the query coord is just inside the graphical extent of the point object. This can be used for a two-pass algorithm to find the most relevant objects first, and then query for all objects if no objects are found in the first pass. |
include_hidden_objects | Set to true if you want to find hidden objects. |
include_protected_objects | Set to true if you want to find protected objects. |
out | Output parameter. Will be filled with pairs of symbol types and corresponding objects. The symbol type describes the way in which an object has been found and is taken from Symbol::Type. This is e.g. important for combined symbols, which can be found from a line or an area. |
void OpenOrienteering::Map::findObjectsAtBox | ( | const MapCoordF & | corner1, |
const MapCoordF & | corner2, | ||
bool | include_hidden_objects, | ||
bool | include_protected_objects, | ||
std::vector< Object *> & | out | ||
) | const |
Finds and returns all objects intersecting the given box in the current part.
corner1 | First corner of the query box. |
corner2 | Second corner of the query box. |
include_hidden_objects | Set to true if you want to find hidden objects. |
include_protected_objects | Set to true if you want to find protected objects. |
out | Output parameter. Will be filled with an object list. |
int OpenOrienteering::Map::findPartIndex | ( | const MapPart * | part | ) | const |
Loops over all map parts, looking for the given part pointer.
Returns the part's index in the list. The part must be contained in the map, otherwise an assert will be triggered!
int OpenOrienteering::Map::findSymbolIndex | ( | const Symbol * | symbol | ) | const |
Loops over all symbols, looking for the given symbol pointer.
Returns the index of the symbol, or -1 if the symbol is not found. For the "undefined" symbols, returns special indices smaller than -1.
int OpenOrienteering::Map::findTemplateIndex | ( | const Template * | temp | ) | const |
Loops over all templates in the map and looks for the given template pointer.
Returns the index of the template. The template must be contained in the map, otherwise an assert will be triggered!
|
inline |
Returns the i-th closed template.
|
inline |
Returns the i-th closed template.
|
inline |
Returns a pointer to the const MapColor identified by the priority i.
Parameter i may also be negative for specifying special reserved colors. This is different from getMapColor();
Returns nullptr if the color is not defined.
|
inlinestatic |
Returns the special covering combined symbol (white + red).
|
inlinestatic |
Returns the special covering red color.
|
inlinestatic |
Returns the special covering red line symbol.
|
inlinestatic |
Returns the special covering white color.
|
inlinestatic |
Returns the special covering white line symbol.
|
inline |
Returns the current map part, i.e.
the part where edit operations happen.
|
inline |
Returns the index of the current map part.
|
inline |
Returns the template index which is the first (lowest) to be drawn in front of the map.
|
inline |
Returns the object in the selection which was selected first by the user.
If she later deselects it while other objects are still selected or if the selection is done as box selection, this "first" selected object is just a more or less random object from the selection.
|
inline |
Returns the object in the selection which was selected first by the user.
|
inline |
Returns the map's georeferencing object.
|
inline |
Returns the map's grid settings.
void OpenOrienteering::Map::getImageTemplateDefaults | ( | bool & | use_meters_per_pixel, |
double & | meters_per_pixel, | ||
double & | dpi, | ||
double & | scale | ||
) |
Returns the default parameters for loading of image templates.
|
inline |
Returns a pointer to the MapColor identified by the non-negative priority i.
Returns nullptr if the color is not defined, or if it is a special color (i.e i<0), i.e. only actual map colors are returned.
|
inline |
Returns a pointer to the MapColor identified by the non-negative priority i.
Returns nullptr if the color is not defined, or if it is a special color (i.e i<0), i.e. only actual map colors are returned.
|
inline |
Returns the map notes string.
|
inline |
Returns the number of manually closed templates for which the settings are still stored.
|
inline |
Returns the number of map colors defined in this map.
int OpenOrienteering::Map::getNumObjects | ( | ) | const |
Returns the total number of objects in this map (sum of all parts)
|
inline |
Returns the number of map parts in this map.
|
inline |
Returns the number of selected objects.
|
inline |
Returns the number of symbols in this map.
|
inline |
Returns the number of templates in this map.
|
inline |
Returns the i-th map part.
|
inlinestatic |
Returns the special registration color.
unsigned int OpenOrienteering::Map::getScaleDenominator | ( | ) | const |
Returns the map's scale denominator.
void OpenOrienteering::Map::getSelectionToSymbolCompatibility | ( | const Symbol * | symbol, |
bool & | out_compatible, | ||
bool & | out_different | ||
) | const |
Checks the selected objects for compatibility with the given symbol.
symbol | the symbol to check compatibility for |
out_compatible | returns if all selected objects are compatible to the given symbol |
out_different | returns if at least one of the selected objects' symbols is different to the given symbol |
const Symbol * OpenOrienteering::Map::getSymbol | ( | int | i | ) | const |
Returns a pointer to the i-th symbol.
Symbol * OpenOrienteering::Map::getSymbol | ( | int | i | ) |
Returns a pointer to the i-th symbol.
|
inline |
Returns the i-th template.
|
inline |
Returns the i-th template.
|
inlinestatic |
Returns the special covering gray color for "undefined" objects.
|
inlinestatic |
Returns the special gray "undefined" line symbol.
|
inlinestatic |
Returns the special gray "undefined" point symbol.
|
inlinestatic |
Returns the special gray "undefined" text symbol.
bool OpenOrienteering::Map::hasAlpha | ( | ) | const |
Returns true if any visible object uses a non-opaque color.
|
inlinenoexcept |
Returns true if the map has a print configuration.
bool OpenOrienteering::Map::hasSpotColors | ( | ) | const |
Returns true if the map contains spot colors.
|
signal |
Emitted when a the map enters or leaves the state which is saved on map.
|
inline |
Returns whether there are unsaved changes in the map.
To toggle this state, never use setHasUnsavedChanges() directly unless you know what you are doing, instead use setOtherDirty() or set one of the more specific 'dirty' flags. This is because a call to setHasUnsavedChanges() alone followed by a map change and an undo would result in no changed flag.
Loads the map directly from the given IO device.
The data must have been written by exportToIODevice() (or at least use the same format.) Returns true if successful.
QHash< const Symbol *, Symbol * > OpenOrienteering::Map::importMap | ( | const Map & | imported_map, |
ImportMode | mode, | ||
std::vector< bool > * | filter = nullptr , |
||
int | symbol_insert_pos = -1 , |
||
bool | merge_duplicate_symbols = true |
||
) |
Imports another map into this map.
If the Map::GeorefImport mode flag is set, this overload will attempt to calculate a transformation based on the maps' georeferencing. All further processing is delegated to the other overload.
QHash< const Symbol *, Symbol * > OpenOrienteering::Map::importMap | ( | const Map & | imported_map, |
ImportMode | mode, | ||
const QTransform & | transform, | ||
std::vector< bool > * | filter = nullptr , |
||
int | symbol_insert_pos = -1 , |
||
bool | merge_duplicate_symbols = true |
||
) |
Imports another map into this map.
The amount of imported elements is controlled by the mode argument which is a combination of an enumeration of basic modes (ColorImport, SymbolImport, ObjectImport) and the flags (MinimalImport).
This overload ignores the Map::GeorefImport mode flag. It only uses the given transformation. It is applied to all imported objects. No other adjustment of object positions and no scaling of symbol sizes (with respect to possible different map scales) is performed.
void OpenOrienteering::Map::includeSelectionRect | ( | QRectF & | rect | ) | const |
Enlarges the given rect to cover all selected objects.
void OpenOrienteering::Map::init | ( | ) |
Initializes an empty map.
A map is empty when it is newly constructed or after clear().
void OpenOrienteering::Map::insertRenderablesOfObject | ( | const Object * | object | ) |
Inserts the renderables of the given object, so they will be displayed.
const std::set< Object * > OpenOrienteering::Map::irregularObjects | ( | ) | const |
Returns the list of objects marked as irregular.
bool OpenOrienteering::Map::isAreaHatchingEnabled | ( | ) | const |
TODO: These two options should really be view options, but are not due to a limitation: the current architecture makes it impossible to have different renderables of the same objects in different views!
Returns if area hatching is enabled.
bool OpenOrienteering::Map::isBaselineViewEnabled | ( | ) | const |
Returns if the baseline view is enabled.
Checks and returns if the given color is used by at least one symbol.
Returns true if the given object is selected.
|
inline |
Returns if there are unsaved changes to anything else than the above.
Attempts to load the map from the specified path.
Returns true on success.
This is a convenience function used by tests. Normally, a importer should be used explicitly.
path | The file path to load the map from. |
view | If not nullptr, restores this map view. |
|
signal |
Emitted when a part is added to the map.
|
signal |
Emitted when a part's properties are changed.
|
signal |
Emitted when a part is removed from the map.
void OpenOrienteering::Map::markAsIrregular | ( | Object * | object | ) |
Marks an object as irregular.
int OpenOrienteering::Map::mergeParts | ( | std::size_t | source, |
std::size_t | destination | ||
) |
Merges the source part with the destination part.
Removes the source part unless it is identical with the destination part.
The objects will be continuously located at the end to the objects in the target part. Does not change the object selection.
Makes the destination part the current part when the source part is the current part.
void OpenOrienteering::Map::moveSymbol | ( | int | from, |
int | to | ||
) |
Moves a symbol from one index to another in the symbol list.
|
signal |
Emitted when the set of selected objects changes.
Also emitted when the symbol of a selected object changes (which is similar to selecting another object).
const MapPrinterConfig & OpenOrienteering::Map::printerConfig | ( | ) |
Returns a const reference to the current print configuration.
If the map does not have a print configuration, a default configuration is created first.
MapPrinterConfig OpenOrienteering::Map::printerConfig | ( | ) | const |
Returns a copy of the current print configuration.
If the map does not have a print configuration, the function will return a default configuration for this map.
void OpenOrienteering::Map::push | ( | UndoStep * | step | ) |
Pushes a new undo step to the map's undoManager.
Returns a translated symbol text (name or description), or an empty string.
int OpenOrienteering::Map::reassignObjectsToMapPart | ( | std::vector< int >::const_iterator | first, |
std::vector< int >::const_iterator | last, | ||
std::size_t | source, | ||
std::size_t | destination | ||
) |
Moves all specified objects from the source to the target map part.
Objects are processed one by one. This means that processing one object changes the index of following objects. Thus the given indices must normally be in descending order.
The objects will be continuously located at the end to the objects in the target part. Source object which were selected will be removed from the object selection.
bool OpenOrienteering::Map::reloadClosedTemplate | ( | int | i, |
int | target_pos, | ||
QWidget * | dialog_parent, | ||
const QString & | map_path = QString() |
||
) |
Removes the template with the given index from the closed template list, load the template file and adds the template to the normal template list again.
The template is made visible in the given view.
NOTE: if required, adjust first_front_template manually with setFirstFrontTemplate() before calling this method!
i | The index of the closed template to reload. |
target_pos | The desired index in the normal template list after loading. |
dialog_parent | Widget as parent for possible dialogs. |
map_path | Path where the map is saved currently. Used as possible search location to locate missing templates. |
void OpenOrienteering::Map::removeMapWidget | ( | MapWidget * | widget | ) |
Removes the map widget, see addMapWidget().
void OpenOrienteering::Map::removeObjectFromSelection | ( | Object * | object, |
bool | emit_selection_changed | ||
) |
Removes the given object from the selection.
object | The object to remove. |
emit_selection_changed | See addObjectToSelection(). |
void OpenOrienteering::Map::removePart | ( | std::size_t | index | ) |
Removes the map part at position.
void OpenOrienteering::Map::removeRenderablesOfObject | ( | const Object * | object, |
bool | mark_area_as_dirty | ||
) |
Removes the renderables of the given object from display (does not delete them!).
bool OpenOrienteering::Map::removeSymbolFromSelection | ( | const Symbol * | symbol, |
bool | emit_selection_changed | ||
) |
Removes from the selection all objects with the given symbol.
Returns true if at least one object has been removed.
symbol | The symbol of the objects to remove. |
emit_selection_changed | See addObjectToSelection(). |
void OpenOrienteering::Map::removeTemplate | ( | int | pos | ) |
Removes the template with the given index from the template list, but does not delete it.
NOTE: if required, adjust first_front_template manually with setFirstFrontTemplate()!
|
inline |
Returns the rendering options as an int representing Symbol::RenderableOptions.
void OpenOrienteering::Map::reset | ( | ) |
void OpenOrienteering::Map::resetPrinterConfig | ( | ) |
Clears the print configuration.
After calling this method, hasPrinterConfig() returns false.
void OpenOrienteering::Map::rotateAllObjects | ( | double | rotation, |
const MapCoord & | center | ||
) |
Rotates all objects by the given rotation angle (in radians).
void OpenOrienteering::Map::rotateMap | ( | double | rotation, |
const MapCoord & | center, | ||
bool | adjust_georeferencing, | ||
bool | adjust_declination, | ||
bool | adjust_templates | ||
) |
Rotate the map around a point.
rotation | The rotation angle (in radians). |
center | The rotation center point. |
adjust_georeferencing | Whether to adjust the georeferencing reference point. |
adjust_declination | Whether to adjust the georeferencing declination. |
adjust_templates | Whether to adjust non-georeferenced templates. |
void OpenOrienteering::Map::scaleAllObjects | ( | double | factor, |
const MapCoord & | scaling_center | ||
) |
Scales all objects by the given factor.
void OpenOrienteering::Map::scaleAllSymbols | ( | double | factor | ) |
Scales all symbols by the given factor.
|
signal |
Emitted when at least one of the selected objects is edited in any way.
For example, this includes the case where a symbol of one of the selected objects is edited, too.
|
inline |
|
inline |
Returns an iterator allowing to iterate over the selected objects.
|
inline |
Returns an end iterator allowing to iterate over the selected objects.
void OpenOrienteering::Map::setActivityBoundingBox | ( | const QRectF & | map_coords_rect, |
int | pixel_border, | ||
bool | do_update = true |
||
) |
This is the analogon to setDrawingBoundingBox() for activities.
void OpenOrienteering::Map::setAreaHatchingEnabled | ( | bool | enabled | ) |
Sets if area hatching is enabled.
void OpenOrienteering::Map::setBaselineViewEnabled | ( | bool | enabled | ) |
Sets if the baseline view is enabled.
void OpenOrienteering::Map::setColor | ( | MapColor * | color, |
int | pos | ||
) |
Replaces the color at index pos with the given color, updates dependent colors and symbol icons.
Emits colorChanged(). Does not delete the replaced color.
void OpenOrienteering::Map::setColorsDirty | ( | ) |
Marks the colors as "dirty", i.e.
as having unsaved changes. Emits hasUnsavedChanged(true) if the map did not have unsaved changed before.
|
inline |
Changes the current map part.
This is a convenience method which looks up the part's index and then calls setCurrentPartIndex.
void OpenOrienteering::Map::setCurrentPartIndex | ( | std::size_t | index | ) |
Changes the current map part.
void OpenOrienteering::Map::setDrawingBoundingBox | ( | const QRectF & | map_coords_rect, |
int | pixel_border, | ||
bool | do_update = true |
||
) |
Sets the rect (given in map coordinates) as "dirty rect" for every map widget showing this map, enlarged by the given pixel border.
This means that the area covered by the rect will be redrawn by the active tool. Use this if the current tool's display has changed.
map_coords_rect | Area covered by the current tool's drawing in map coords. |
pixel_border | Border around the map coords rect which is also covered, given in pixels. Allows to enlarge the area given by the map coords by some pixels which are independent from the zoom level. For example if a tool displays markers with a radius of 3 pixels, it would set the bounding box of all markers as map_coords_rect and 3 for pixel_border. |
do_update | Whether a repaint of the covered area should be triggered. |
|
inline |
Sets the template index which is the first (lowest) to be drawn in front of the map.
void OpenOrienteering::Map::setGeoreferencing | ( | const Georeferencing & | georeferencing | ) |
Assigns georeferencing settings for the map from the given object and sets the map to have unsaved changes.
void OpenOrienteering::Map::setGrid | ( | const MapGrid & | grid | ) |
Sets the map's grid settings from the given object and may set the map to have unsaved changes.
void OpenOrienteering::Map::setHasUnsavedChanges | ( | bool | has_unsaved_changes | ) |
Do not use this in usual cases, see hasUnsavedChanged().
void OpenOrienteering::Map::setImageTemplateDefaults | ( | bool | use_meters_per_pixel, |
double | meters_per_pixel, | ||
double | dpi, | ||
double | scale | ||
) |
Sets default parameters for loading of image templates.
TODO: put these into a struct.
void OpenOrienteering::Map::setMapNotes | ( | const QString & | text | ) |
Sets the map notes string.
NOTE: Set the map to dirty manually!
void OpenOrienteering::Map::setObjectAreaDirty | ( | const QRectF & | map_coords_rect | ) |
Marks the area given by map_coords_rect as "dirty" in all map widgets, i.e.
as needing to be redrawn because some object(s) changed there.
void OpenOrienteering::Map::setObjectsDirty | ( | ) |
Marks the objects as "dirty", i.e.
as having unsaved changes. Emits hasUnsavedChanged(true) if the map did not have unsaved changed before.
void OpenOrienteering::Map::setOtherDirty | ( | ) |
Marks something unspecific in the map as "dirty", i.e.
as having unsaved changes. Emits hasUnsavedChanged(true) if the map did not have unsaved changed before.
Use setColorsDirty(), setSymbolsDirty(), setTemplatesDirty() or setObjectsDirty() if you know more specifically what has changed.
void OpenOrienteering::Map::setPrinterConfig | ( | const MapPrinterConfig & | config | ) |
Sets the print configuration.
void OpenOrienteering::Map::setScaleDenominator | ( | unsigned int | value | ) |
Sets the map's scale denominator.
void OpenOrienteering::Map::setSymbol | ( | Symbol * | symbol, |
int | pos | ||
) |
Replaces the symbol at the given index with another symbol.
Emits symbolChanged() and possibly selectedObjectEdited().
void OpenOrienteering::Map::setSymbolsDirty | ( | ) |
Marks the symbols as "dirty", i.e.
as having unsaved changes. Emits hasUnsavedChanged(true) if the map did not have unsaved changed before.
void OpenOrienteering::Map::setSymbolSetId | ( | const QString & | id | ) |
Sets the symbol set ID.
void OpenOrienteering::Map::setTemplate | ( | Template * | temp, |
int | pos | ||
) |
Replaces the template at the given index with another.
Emits templateChanged().
void OpenOrienteering::Map::setTemplateAreaDirty | ( | Template * | temp, |
const QRectF & | area, | ||
int | pixel_border | ||
) |
Marks the area defined by the given QRectF (in map coordinates) and pixel border as "dirty", i.e.
as needing a repaint, for the given template in all map widgets.
For an explanation of the area and pixel border, see setDrawingBoundingBox().
Warning: does nothing if the template is not visible in a widget! So make sure to call this and showing/hiding a template in the correct order!
void OpenOrienteering::Map::setTemplateAreaDirty | ( | int | i | ) |
Marks the whole area of the i-th template as "to be repainted".
See setTemplateAreaDirty(). Does nothing for i == -1.
void OpenOrienteering::Map::setTemplatesDirty | ( | ) |
Marks the template settings as "dirty", i.e.
as having unsaved changes. Emits hasUnsavedChanged(true) if the map did not have unsaved changed before.
void OpenOrienteering::Map::sortSymbols | ( | T | compare | ) |
Sorts the symbol list using the given comparator.
|
signal |
Emitted when the presence of spot colors in the map changes.
|
signal |
Emitted when a symbol is added to the map, gives the symbol's index and pointer.
|
signal |
Emitted when a symbol in the map is changed.
|
signal |
Emitted when a symbol in the map is deleted.
|
signal |
Emitted when the icon of the symbol with the given index changes.
qreal OpenOrienteering::Map::symbolIconZoom | ( | ) | const |
Returns the scale factor to be used for default symbol icons.
The full icon size (width, height) is represented by 1.0.
|
signal |
Emitted when the symbol icon zoom changes.
|
inline |
Returns the symbol set ID.
|
signal |
Emitted when a template is added to the map, gives the template's index and pointer.
|
signal |
Emitted when a template in the map is changed, gives the template's index and pointer.
|
signal |
Emitted when a template in the map is deleted, gives the template's index and pointer.
Toggles the selection of the given object.
Returns true if the object was selected, false if deselected.
object | The object to select or deselect. |
emit_selection_changed | See addObjectToSelection(). |
Returns a translated symbol text (name or description), or the original text.
|
protectedslot |
|
inline |
Returns the UndoManager instance for this map.
|
inline |
Returns the UndoManager instance for this map.
void OpenOrienteering::Map::updateAllMapWidgets | ( | ) |
Redraws all map widgets completely - this can be slow! Try to avoid this and do partial redraws instead, if possible.
void OpenOrienteering::Map::updateAllObjects | ( | ) |
Forces an update of all objects, i.e.
calls update(true) on each map object.
void OpenOrienteering::Map::updateAllObjectsWithSymbol | ( | const Symbol * | symbol | ) |
Forces an update of all objects with the given symbol.
void OpenOrienteering::Map::updateDrawing | ( | const QRectF & | map_coords_rect, |
int | pixel_border | ||
) |
Updates all dynamic drawings at the given positions, i.e.
tool & activity drawings.
void OpenOrienteering::Map::updateObjects | ( | ) |
Updates the renderables and extent of all objects which have changed.
This is automatically called by draw(), you normally do not need to call it directly.
void OpenOrienteering::Map::updateSymbolIcons | ( | const MapColor * | color | ) |
Updates the icons of all symbols with the given color.
|
slot |
Updates the symbol icon zoom from the current set of symbols.
The symbol icon zoom is chosen so that most symbols fit into the full icon space, and the number of symbol below 10% size is kept low. For a map without symbols, this returns 1.0.
void OpenOrienteering::Map::useColorsFrom | ( | Map * | map | ) |
Makes this map use the color set from the given map.
Used to create the maps containing preview objects in the symbol editor.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |