![]() |
Mapper
0.9.0
API documentation
|
Template displaying a map file. More...
#include <template_map.h>
Public Member Functions | |
TemplateMap (const QString &path, Map *map) | |
~TemplateMap () override | |
const char * | getTemplateType () const override |
Returns a string which should identify the type of the template uniquely: the class name. More... | |
bool | isRasterGraphics () const override |
Returns true if the template is raster graphics. More... | |
bool | loadTemplateFileImpl (bool configuring) override |
Hook for loading the actual template file non-interactively. More... | |
bool | postLoadConfiguration (QWidget *dialog_parent, bool &out_center_in_view) override |
Does configuration after the actual template is loaded. More... | |
void | unloadTemplateFileImpl () override |
Hook for unloading the template file. More... | |
void | drawTemplate (QPainter *painter, const QRectF &clip_rect, double scale, bool on_screen, float opacity) const override |
Draws the template using the given painter with the given opacity. More... | |
QRectF | getTemplateExtent () const override |
Returns the extent of the template in template coordinates. More... | |
bool | hasAlpha () const override |
Returns true if the template has elements which are not opaque. More... | |
const Map * | templateMap () const |
![]() | |
~Template () override | |
Template * | duplicate () const |
Creates a duplicate of the template. More... | |
QString | errorString () const |
Returns a description of the last error that occurred. More... | |
void | saveTemplateConfiguration (QXmlStreamWriter &xml, bool open, const QDir *map_dir=nullptr) const |
Saves template parameters. More... | |
virtual bool | saveTemplateFile () const |
Saves the template itself, returns true if successful. More... | |
void | switchTemplateFile (const QString &new_path, bool load_file) |
Changes a template's file without changing the parameters. More... | |
bool | execSwitchTemplateFileDialog (QWidget *dialog_parent) |
Shows the dialog to find a moved template. More... | |
bool | configureAndLoad (QWidget *dialog_parent, MapView *view) |
Does everything needed to load a template. More... | |
LookupResult | tryToFindTemplateFile (const QString &map_path) |
Tries to find the template file non-interactively. More... | |
bool | tryToFindAndReloadTemplateFile (const QString &map_path) |
Tries to find and load the template file non-interactively. More... | |
virtual bool | preLoadConfiguration (QWidget *dialog_parent) |
Does configuration before the actual template is loaded. More... | |
bool | loadTemplateFile (bool configuring) |
Loads the template file. More... | |
void | unloadTemplateFile () |
Unloads the template file. More... | |
virtual QRectF | calculateTemplateBoundingBox () const |
Calculates the template's bounding box in map coordinates. More... | |
virtual int | getTemplateBoundingBoxPixelBorder () |
Returns the extra extent of the template out of the bounding box. More... | |
virtual void | setTemplateAreaDirty () |
Marks the whole area of the template as needing a redraw. More... | |
virtual bool | canBeDrawnOnto () const |
Must return if freehand drawing onto the template is possible. More... | |
void | drawOntoTemplate (not_null< MapCoordF *> coords, int num_coords, QColor color, float width, QRectF map_bbox) |
Draws onto the template. More... | |
virtual void | drawOntoTemplateUndo (bool redo) |
Triggers an undo or redo action for template freehand drawing. More... | |
void | applyTemplateTransform (QPainter *painter) const |
Changes the painter's transformation so it can be used to draw in template coordinates. More... | |
void | scale (double factor, const MapCoord ¢er) |
Scales the template with the given scaling center. More... | |
void | rotate (double rotation, const MapCoord ¢er) |
Rotates the template around the given point. More... | |
MapCoordF | mapToTemplate (const MapCoordF &coords) const |
MapCoordF | mapToTemplateOther (const MapCoordF &coords) const |
MapCoordF | templateToMap (const QPointF &coords) const |
MapCoordF | templateToMapOther (const QPointF &coords) const |
const PassPointList & | getPassPointList () const |
PassPointList & | getPassPointList () |
int | getNumPassPoints () const |
PassPoint * | getPassPoint (int i) |
void | addPassPoint (const PassPoint &point, int pos) |
void | deletePassPoint (int pos) |
void | clearPassPoints () |
void | switchTransforms () |
Change from adjusted into original state or the other way round. More... | |
void | getTransform (TemplateTransform &out) const |
void | setTransform (const TemplateTransform &transform) |
void | getOtherTransform (TemplateTransform &out) const |
void | setOtherTransform (const TemplateTransform &transform) |
Map * | getMap () const |
const QString & | getTemplateFilename () const |
void | setTemplateFileInfo (const QFileInfo &file_info) |
Changes the path and filename only. Does not do any reloading etc. More... | |
const QString & | getTemplatePath () const |
void | setTemplatePath (const QString &value) |
Changes the path and filename only. Does not do any reloading etc. More... | |
const QString & | getTemplateRelativePath () const |
void | setTemplateRelativePath (const QString &value) |
State | getTemplateState () const |
void | setTemplateState (State state) |
int | getTemplateGroup () const |
void | setTemplateGroup (int value) |
bool | hasUnsavedChanges () const |
void | setHasUnsavedChanges (bool value) |
bool | isTemplateGeoreferenced () const |
virtual bool | canChangeTemplateGeoreferenced () |
Returns if the template allows the georefencing state to be changed at all. More... | |
virtual bool | trySetTemplateGeoreferenced (bool value, QWidget *dialog_parent) |
Tries to change the usage of georeferencing data. More... | |
MapCoord | templatePosition () const |
void | setTemplatePosition (const MapCoord &coord) |
MapCoord | templatePositionOffset () const |
void | setTemplatePositionOffset (const MapCoord &offset) |
void | applyTemplatePositionOffset () |
void | resetTemplatePositionOffset () |
qint64 | getTemplateX () const |
void | setTemplateX (qint64 x) |
qint64 | getTemplateY () const |
void | setTemplateY (qint64 y) |
double | getTemplateScaleX () const |
void | setTemplateScaleX (double scale_x) |
double | getTemplateScaleY () const |
void | setTemplateScaleY (double scale_y) |
double | getTemplateShear () const |
void | setTemplateShear (double shear) |
double | getTemplateRotation () const |
void | setTemplateRotation (double rotation) |
bool | isAdjustmentApplied () const |
bool | isAdjustmentDirty () const |
void | setAdjustmentDirty (bool value) |
![]() | |
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 std::vector< QByteArray > & | supportedExtensions () |
Returns the filename extensions supported by this template class. More... | |
![]() | |
static std::unique_ptr< Template > | loadTemplateConfiguration (QXmlStreamReader &xml, Map &map, bool &open) |
Creates and returns a template from the configuration in the XML stream. More... | |
static const std::vector< QByteArray > & | supportedExtensions () |
Returns the filename extensions supported by known subclasses. More... | |
static std::unique_ptr< Template > | templateForFile (const QString &path, Map *map) |
Creates a Template instance for the given path. 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 Member Functions | |
Template * | duplicateImpl () const override |
Derived classes must create a duplicate and transfer. More... | |
Map * | templateMap () |
void | setTemplateMap (std::unique_ptr< Map > &&map) |
void | calculateTransformation () |
![]() | |
Template (const QString &path, not_null< Map *> map) | |
Initializes the template as "Unloaded". More... | |
void | setErrorString (const QString &text) |
Sets the error description which will be returned by errorString(). More... | |
virtual void | saveTypeSpecificTemplateConfiguration (QXmlStreamWriter &xml) const |
Hook for saving parameters needed by the actual template type. More... | |
virtual bool | loadTypeSpecificTemplateConfiguration (QXmlStreamReader &xml) |
Hook for loading parameters needed by the actual template type. More... | |
virtual void | drawOntoTemplateImpl (MapCoordF *coords, int num_coords, QColor color, float width) |
Hook for drawing on the template. More... | |
void | updateTransformationMatrices () |
Must be called after direct changes to transform or other_transform. More... | |
![]() | |
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) |
Additional Inherited Members | |
![]() | |
enum | State { Loaded = 0, Unloaded, Invalid } |
States in the lifetime of a template. More... | |
enum | LookupResult { NotFound = 0, FoundInMapDir = 1, FoundByRelPath = 2, FoundByAbsPath = 3 } |
The result of template file lookup attempts. More... | |
template<typename T > | |
using | not_null = T |
Indicates arguments which must not be nullptr. More... | |
![]() | |
void | templateStateChanged () |
Emitted whenever template_state was changed. More... | |
![]() | |
typedef | QObjectList |
![]() | |
static bool | suppressAbsolutePaths = false |
A flag which disables the writing of absolute paths for template files. More... | |
![]() | |
Map * | map |
Map containing this template. More... | |
QString | template_file |
The filename of the template file (e.g. "map.bmp") More... | |
QString | template_path |
The complete path to the template file including the filename (e.g. "/home/me/map.bmp") More... | |
QString | template_relative_path |
The template path relative to the map file (e.g. More... | |
State | template_state |
The template lifetime state. More... | |
QString | error_string |
The description of the last error. More... | |
bool | has_unsaved_changes |
Does the template itself (not its transformation) have unsaved changes (e.g. GPS track has changed, image has been painted on) More... | |
bool | is_georeferenced |
Is the template in georeferenced mode? More... | |
TemplateTransform | transform |
Currently active transformation. NOTE: after direct changes here call updateTransformationMatrices() More... | |
TemplateTransform | other_transform |
Currently inactive transformation (adjusted or original). NOTE: after direct changes here call updateTransformationMatrices() More... | |
bool | adjusted |
If true, transform is the adjusted transformation, otherwise it is the original one. More... | |
bool | adjustment_dirty |
If true, the adjusted transformation has to be recalculated. More... | |
PassPointList | passpoints |
List of pass points for position adjustment. More... | |
int | template_group |
Number of the template group. If the template is not grouped, this is set to -1. More... | |
Matrix | map_to_template |
Matrix | template_to_map |
Matrix | template_to_map_other |
![]() | |
objectName | |
Template displaying a map file.
|
override |
|
protected |
|
overridevirtual |
Draws the template using the given painter with the given opacity.
The painter transformation is set to use template coordinates. The clip rect is in template coordinates. The scale is the combined view & template scale. It can be used to give a minimum size to elements.
Implements OpenOrienteering::Template.
|
overrideprotectedvirtual |
Derived classes must create a duplicate and transfer.
type specific information over to the copy here. This includes the content of the template file if it is loaded.
Implements OpenOrienteering::Template.
|
overridevirtual |
Returns the extent of the template in template coordinates.
The default implementation returns a "very big" rectangle.
Reimplemented from OpenOrienteering::Template.
|
overridevirtual |
Returns a string which should identify the type of the template uniquely: the class name.
Very simple RTTI feature.
Implements OpenOrienteering::Template.
|
overridevirtual |
Returns true if the template has elements which are not opaque.
The default implementation returns true when the template is loaded.
Reimplemented from OpenOrienteering::Template.
|
overridevirtual |
Returns true if the template is raster graphics.
Raster graphics cannot be printed in the foreground in vector mode.
Implements OpenOrienteering::Template.
Hook for loading the actual template file non-interactively.
Returns true if successful.
If configuring is true, a call to postLoadConfiguration() will follow if this returns true.
Implements OpenOrienteering::Template.
|
overridevirtual |
Does configuration after the actual template is loaded.
This function is called after the user chose the template file and after the chosen file was successfully loaded. Derived classes can show dialogs here to get user input which is needed to interpret the template file.
If the implementation returns false, loading the template is aborted.
By setting out_center_in_view, the implementation can decide if the template should be centered in the active view (only if it is not georeferenced.)
Reimplemented from OpenOrienteering::Template.
|
protected |
|
static |
Returns the filename extensions supported by this template class.
const Map * OpenOrienteering::TemplateMap::templateMap | ( | ) | const |
|
protected |
|
overridevirtual |
Hook for unloading the template file.
Implements OpenOrienteering::Template.