![]() |
Mapper
0.9.0
API documentation
|
Abstract base class for templates. More...
#include <template.h>
Classes | |
class | ScopedOffsetReversal |
Public Types | |
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... | |
Signals | |
void | templateStateChanged () |
Emitted whenever template_state was changed. More... | |
Public Member Functions | |
~Template () override | |
Template * | duplicate () const |
Creates a duplicate of the template. More... | |
virtual const char * | getTemplateType () const =0 |
Returns a string which should identify the type of the template uniquely: the class name. More... | |
QString | errorString () const |
Returns a description of the last error that occurred. More... | |
virtual bool | isRasterGraphics () const =0 |
Returns true if the template is raster graphics. 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... | |
virtual bool | postLoadConfiguration (QWidget *dialog_parent, bool &out_center_in_view) |
Does configuration after the actual template is loaded. More... | |
void | unloadTemplateFile () |
Unloads the template file. More... | |
virtual void | drawTemplate (QPainter *painter, const QRectF &clip_rect, double scale, bool on_screen, float opacity) const =0 |
Draws the template using the given painter with the given opacity. 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... | |
virtual QRectF | getTemplateExtent () const |
Returns the extent of the template 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 bool | hasAlpha () const |
Returns true if the template has elements which are not opaque. 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 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) |
Static Public Attributes | |
static bool | suppressAbsolutePaths = false |
A flag which disables the writing of absolute paths for template files. More... | |
Protected Member Functions | |
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 Template * | duplicateImpl () const =0 |
Derived classes must create a duplicate and transfer. 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 bool | loadTemplateFileImpl (bool configuring)=0 |
Hook for loading the actual template file non-interactively. More... | |
virtual void | unloadTemplateFileImpl ()=0 |
Hook for unloading the template file. 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) |
Protected Attributes | |
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 |
Additional Inherited Members | |
![]() | |
typedef | QObjectList |
![]() | |
objectName | |
Abstract base class for templates.
using OpenOrienteering::Template::not_null = T |
Indicates arguments which must not be nullptr.
States in the lifetime of a template.
Initializes the template as "Unloaded".
|
override |
void OpenOrienteering::Template::addPassPoint | ( | const PassPoint & | point, |
int | pos | ||
) |
void OpenOrienteering::Template::applyTemplatePositionOffset | ( | ) |
void OpenOrienteering::Template::applyTemplateTransform | ( | QPainter * | painter | ) | const |
Changes the painter's transformation so it can be used to draw in template coordinates.
The previous transformation of the painter must be the map transformation.
|
virtual |
Calculates the template's bounding box in map coordinates.
Reimplemented in OpenOrienteering::TemplateTrack.
|
virtual |
Must return if freehand drawing onto the template is possible.
Reimplemented in OpenOrienteering::TemplateImage.
|
virtual |
Returns if the template allows the georefencing state to be changed at all.
The default implementation returns false.
Reimplemented in OpenOrienteering::TemplateImage.
void OpenOrienteering::Template::clearPassPoints | ( | ) |
Does everything needed to load a template.
Calls preLoadConfiguration(), loadTemplateFile() and postLoadConfiguration(). Returns if the process was successful.
The passed-in view is used to center the template if needed.
void OpenOrienteering::Template::deletePassPoint | ( | int | pos | ) |
void OpenOrienteering::Template::drawOntoTemplate | ( | not_null< MapCoordF *> | coords, |
int | num_coords, | ||
QColor | color, | ||
float | width, | ||
QRectF | map_bbox | ||
) |
Draws onto the template.
This only works for templates for which canBeDrawnOnto() returns true.
coords is an array of points with which the drawn line is defined and must contain at least 2 points.
If map_bbox is an invalid rect, then the method will calculate it itself.
|
protectedvirtual |
Hook for drawing on the template.
Draws the polyline given by the points onto the template. Required if canBeDrawnOnto() returns true.
Reimplemented in OpenOrienteering::TemplateImage.
|
virtual |
Triggers an undo or redo action for template freehand drawing.
This only works for templates for which canBeDrawnOnto() returns true.
Reimplemented in OpenOrienteering::TemplateImage.
|
pure virtual |
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.
Implemented in OpenOrienteering::TemplateImage, OpenOrienteering::TemplateMap, and OpenOrienteering::TemplateTrack.
Template * OpenOrienteering::Template::duplicate | ( | ) | const |
Creates a duplicate of the template.
|
protectedpure virtual |
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.
Implemented in OpenOrienteering::TemplateImage, OpenOrienteering::TemplateTrack, OpenOrienteering::OgrTemplate, and OpenOrienteering::TemplateMap.
QString OpenOrienteering::Template::errorString | ( | ) | const |
Returns a description of the last error that occurred.
Shows the dialog to find a moved template.
If the user selects a new file, tries to switch to the selected template file using switchTemplateFile() and by trying to load the new file. Returns true if this succeeds; if not, reverts the switch and returns false. Also returns false if the dialog is aborted.
|
inline |
|
inline |
void OpenOrienteering::Template::getOtherTransform | ( | TemplateTransform & | out | ) | const |
|
inline |
|
inline |
|
inline |
|
inlinevirtual |
Returns the extra extent of the template out of the bounding box.
While the bounding box is defined in map coordinates, this border is given in pixels. This is useful for elements which stay the same size regardless of the zoom level so that a bounding box in map coords cannot be calculated.
Reimplemented in OpenOrienteering::TemplateTrack.
|
virtual |
Returns the extent of the template in template coordinates.
The default implementation returns a "very big" rectangle.
Reimplemented in OpenOrienteering::TemplateImage, OpenOrienteering::TemplateMap, and OpenOrienteering::TemplateTrack.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
pure virtual |
Returns a string which should identify the type of the template uniquely: the class name.
Very simple RTTI feature.
Implemented in OpenOrienteering::TemplateImage, OpenOrienteering::TemplateTrack, OpenOrienteering::TemplateMap, and OpenOrienteering::OgrTemplate.
|
inline |
|
inline |
void OpenOrienteering::Template::getTransform | ( | TemplateTransform & | out | ) | const |
|
virtual |
Returns true if the template has elements which are not opaque.
The default implementation returns true when the template is loaded.
Reimplemented in OpenOrienteering::TemplateMap, and OpenOrienteering::TemplateTrack.
|
inline |
|
inline |
|
inline |
|
pure virtual |
Returns true if the template is raster graphics.
Raster graphics cannot be printed in the foreground in vector mode.
Implemented in OpenOrienteering::TemplateImage, OpenOrienteering::TemplateTrack, and OpenOrienteering::TemplateMap.
|
inline |
|
static |
Creates and returns a template from the configuration in the XML stream.
Returns a null pointer in the case of error.
Loads the template file.
This function can be called if the template state is Invalid or Unloaded. It must not be called if the template file is already loaded. It returns true if the template is loaded successfully.
Set the configuring parameter to true if the template is currently being configured by the user (in contrast to the case where it is reloaded, e.g. when loaded while reopening an existing map file).
|
protectedpure virtual |
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.
Implemented in OpenOrienteering::TemplateImage, OpenOrienteering::OgrTemplate, OpenOrienteering::TemplateTrack, and OpenOrienteering::TemplateMap.
|
protectedvirtual |
Hook for loading parameters needed by the actual template type.
Returns true on success.
Reimplemented in OpenOrienteering::TemplateTrack, OpenOrienteering::OgrTemplate, and OpenOrienteering::TemplateImage.
|
virtual |
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 in OpenOrienteering::TemplateImage, OpenOrienteering::OgrTemplate, OpenOrienteering::TemplateTrack, and OpenOrienteering::TemplateMap.
Does configuration before the actual template is loaded.
This function is called after the user chooses the template file, but before it is 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.
Reimplemented in OpenOrienteering::OgrTemplate.
void OpenOrienteering::Template::resetTemplatePositionOffset | ( | ) |
void OpenOrienteering::Template::rotate | ( | double | rotation, |
const MapCoord & | center | ||
) |
Rotates the template around the given point.
void OpenOrienteering::Template::saveTemplateConfiguration | ( | QXmlStreamWriter & | xml, |
bool | open, | ||
const QDir * | map_dir = nullptr |
||
) | const |
Saves template parameters.
This method saves common properties such as filename, transformation, adjustment, etc., and it calls saveTypeSpecificTemplateConfiguration for saving type-specific parameters (e.g. filtering mode for images).
If a target directory is given via map_dir
, the relative template path is determined for this directory.
|
virtual |
Saves the template itself, returns true if successful.
This is called when saving the map if the template's hasUnsavedChanges() is true.
Reimplemented in OpenOrienteering::TemplateImage, and OpenOrienteering::TemplateTrack.
|
protectedvirtual |
Hook for saving parameters needed by the actual template type.
The default implementation does nothing.
Reimplemented in OpenOrienteering::TemplateTrack, OpenOrienteering::OgrTemplate, and OpenOrienteering::TemplateImage.
void OpenOrienteering::Template::scale | ( | double | factor, |
const MapCoord & | center | ||
) |
Scales the template with the given scaling center.
void OpenOrienteering::Template::setAdjustmentDirty | ( | bool | value | ) |
|
protected |
Sets the error description which will be returned by errorString().
void OpenOrienteering::Template::setHasUnsavedChanges | ( | bool | value | ) |
void OpenOrienteering::Template::setOtherTransform | ( | const TemplateTransform & | transform | ) |
|
virtual |
Marks the whole area of the template as needing a redraw.
Use this before and after modifications to the template transformation.
The default implementation marks everything as "to be redrawn" for georeferenced templates and uses the reported extent otherwise.
void OpenOrienteering::Template::setTemplateFileInfo | ( | const QFileInfo & | file_info | ) |
Changes the path and filename only. Does not do any reloading etc.
|
inline |
void OpenOrienteering::Template::setTemplatePath | ( | const QString & | value | ) |
Changes the path and filename only. Does not do any reloading etc.
void OpenOrienteering::Template::setTemplatePosition | ( | const MapCoord & | coord | ) |
void OpenOrienteering::Template::setTemplatePositionOffset | ( | const MapCoord & | offset | ) |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
void OpenOrienteering::Template::setTransform | ( | const TemplateTransform & | transform | ) |
|
static |
Returns the filename extensions supported by known subclasses.
Changes a template's file without changing the parameters.
Useful when a template file has been moved. If load_file is true, tries to load the given file.
void OpenOrienteering::Template::switchTransforms | ( | ) |
Change from adjusted into original state or the other way round.
|
static |
Creates a Template instance for the given path.
This function tries to find a matching template subclass by looking at the file extension. It may return nullptr if no subclass supports the extension.
MapCoord OpenOrienteering::Template::templatePosition | ( | ) | const |
MapCoord OpenOrienteering::Template::templatePositionOffset | ( | ) | const |
|
signal |
Emitted whenever template_state was changed.
|
virtual |
Tries to change the usage of georeferencing data.
If supported by the actual template, this function tries to switch the state between non-georeferenced and georeferenced. It returns the final state which may be the same as before if the change is not implemented or fails for other reasons.
The default implementation changes nothing, and it just returns the current state.
Reimplemented in OpenOrienteering::TemplateImage.
Tries to find and load the template file non-interactively.
Returns true if the template was loaded successful.
If out_loaded_from_map_dir is given, it is set to true if the template file is found using the template filename in the map's directory.
Template::LookupResult OpenOrienteering::Template::tryToFindTemplateFile | ( | const QString & | map_path | ) |
Tries to find the template file non-interactively.
Thus function updates the path and name variables, and the template state. If successful, changes the state from Invalid to Unloaded if necessary, and returns true. Otherwise, changes the state from Unloaded to Invalid if necessary, and returns false. (If the state is Loaded, it is left unchanged.) It returns an indication of its success.
This function searches for the template in the following locations:
map_path | Either the full filepath of the map, or an arbitrary directory which shall be regarded as the map directory. |
void OpenOrienteering::Template::unloadTemplateFile | ( | ) |
Unloads the template file.
Can be called if the template state is Loaded. Must not be called if the template file is already unloaded, or invalid.
|
protectedpure virtual |
Hook for unloading the template file.
Implemented in OpenOrienteering::TemplateImage, OpenOrienteering::TemplateMap, and OpenOrienteering::TemplateTrack.
|
protected |
Must be called after direct changes to transform or other_transform.
|
protected |
If true, transform is the adjusted transformation, otherwise it is the original one.
|
protected |
If true, the adjusted transformation has to be recalculated.
|
protected |
The description of the last error.
|
protected |
Does the template itself (not its transformation) have unsaved changes (e.g. GPS track has changed, image has been painted on)
|
protected |
Is the template in georeferenced mode?
|
protected |
|
protected |
Currently inactive transformation (adjusted or original). NOTE: after direct changes here call updateTransformationMatrices()
|
protected |
List of pass points for position adjustment.
|
static |
A flag which disables the writing of absolute paths for template files.
By default, class Template saves absolute paths. This behavior can be changed by setting this flag to true. This allows to hide local (or private) directory names.
This flag defaults to false.
|
protected |
The filename of the template file (e.g. "map.bmp")
|
protected |
Number of the template group. If the template is not grouped, this is set to -1.
|
protected |
The complete path to the template file including the filename (e.g. "/home/me/map.bmp")
|
protected |
The template path relative to the map file (e.g.
"../me/map.bmp"). Can be empty as long as the map file has not been saved yet.
|
protected |
The template lifetime state.
|
protected |
|
protected |
|
protected |
Currently active transformation. NOTE: after direct changes here call updateTransformationMatrices()