![]() |
Mapper
0.9.0
API documentation
|
An Importer for geospatial vector data supported by OGR. More...
#include <ogr_file_format_p.h>
Public Types | |
enum | UnitType { UnitOnGround, UnitOnPaper } |
The unit type indicates the coordinate system the data units refers to. More... | |
using | MapCoordConstructor = MapCoord(OgrFileImport::*)(double, double) const |
A Pointer to a function which creates a MapCoordF from double coordinates. More... | |
Public Member Functions | |
OgrFileImport (const QString &path, Map *map, MapView *view, UnitType unit_type=UnitOnGround) | |
Constructs a new importer. More... | |
~OgrFileImport () override | |
bool | supportsQIODevice () const noexcept override |
Returns true when the importer/exporter supports QIODevice. More... | |
void | setGeoreferencingImportEnabled (bool enabled) |
Enables the import of georeferencing from the geospatial data. More... | |
![]() | |
Importer (const QString &path, Map *map, MapView *view) | |
Creates a new Importer with the given input path, map, and view. More... | |
~Importer () override | |
Destroys this Importer. More... | |
bool | loadSymbolsOnly () const noexcept |
Returns true if only symbols (and colors) are to be imported. More... | |
void | setLoadSymbolsOnly (bool value) |
If set to true, importers shall import only symbols (and colors). More... | |
bool | doImport () |
Imports the map and view. More... | |
![]() | |
ImportExport (QIODevice *device=nullptr) | |
Creates a new importer or exporter with the given IO device. More... | |
ImportExport (const ImportExport &)=delete | |
ImportExport (ImportExport &&)=delete | |
virtual | ~ImportExport () |
Destroys an importer or exporter. More... | |
QIODevice * | device () const noexcept |
Returns the input device if it has been set or created. More... | |
void | setDevice (QIODevice *device) |
Sets a custom input device to be used for import. More... | |
void | setOption (const QString &name, const QVariant &value) |
Sets an option in this importer or exporter. More... | |
QVariant | option (const QString &name) const |
Retrieves the value of an option in this instance. More... | |
void | addWarning (const QString &str) |
Adds a string to the current list of warnings. More... | |
const std::vector< QString > & | warnings () const noexcept |
Returns the current list of warnings collected by this object. More... | |
Static Public Member Functions | |
static bool | checkGeoreferencing (const QString &path, const Georeferencing &georef) |
Tests if the file's spatial references can be used with the given georeferencing. More... | |
static LatLon | calcAverageLatLon (const QString &path) |
Calculates the average geographic coordinates (WGS84) of the file. More... | |
Protected Types | |
using | ObjectList = std::vector< Object * > |
Protected Member Functions | |
ogr::unique_srs | srsFromMap () |
bool | importImplementation () override |
Actual implementation of the import. More... | |
ogr::unique_srs | importGeoreferencing (OGRDataSourceH data_source) |
void | importStyles (OGRDataSourceH data_source) |
void | importLayer (MapPart *map_part, OGRLayerH layer) |
void | importFeature (MapPart *map_part, OGRFeatureDefnH feature_definition, OGRFeatureH feature, OGRGeometryH geometry) |
ObjectList | importGeometry (OGRFeatureH feature, OGRGeometryH geometry) |
ObjectList | importGeometryCollection (OGRFeatureH feature, OGRGeometryH geometry) |
Object * | importPointGeometry (OGRFeatureH feature, OGRGeometryH geometry) |
PathObject * | importLineStringGeometry (OGRFeatureH feature, OGRGeometryH geometry) |
PathObject * | importPolygonGeometry (OGRFeatureH feature, OGRGeometryH geometry) |
Symbol * | getSymbol (Symbol::Type type, const char *raw_style_string) |
MapColor * | makeColor (OGRStyleToolH tool, const char *color_string) |
void | applyPenColor (OGRStyleToolH tool, LineSymbol *line_symbol) |
void | applyBrushColor (OGRStyleToolH tool, AreaSymbol *area_symbol) |
MapCoord | toMapCoord (double x, double y) const |
MapCoord | fromDrawing (double x, double y) const |
A MapCoordConstructor which interprets the given coordinates in millimeters on paper. More... | |
MapCoord | fromProjected (double x, double y) const |
A MapCoordConstructor which interprets the given coordinates as projected. More... | |
![]() | |
virtual void | prepare () |
Event handler called from doImport() to prepare the import process. More... | |
virtual void | validate () |
Event handler called from doImport() to complete to postprocess imported data. More... | |
virtual void | importFailed () |
Event handler called from doImport() to complete to cleanup a failed import attempt. More... | |
Static Protected Member Functions | |
static bool | checkGeoreferencing (OGRDataSourceH data_source, const Georeferencing &georef) |
Tests if the file's spatial references can be used with the given georeferencing. More... | |
static LatLon | calcAverageLatLon (OGRDataSourceH data_source) |
Additional Inherited Members | |
![]() | |
const QString | path |
The input path. More... | |
Map *const | map |
The Map to import or export. More... | |
MapView *const | view |
The MapView to import or export. More... | |
An Importer for geospatial vector data supported by OGR.
The option "separate_layers" will cause OGR layers to be imported as distinct map parts if set to true.
using OpenOrienteering::OgrFileImport::MapCoordConstructor = MapCoord (OgrFileImport::*)(double, double) const |
A Pointer to a function which creates a MapCoordF from double coordinates.
|
protected |
OpenOrienteering::OgrFileImport::OgrFileImport | ( | const QString & | path, |
Map * | map, | ||
MapView * | view, | ||
UnitType | unit_type = UnitOnGround |
||
) |
Constructs a new importer.
|
overridedefault |
|
protected |
|
protected |
Calculates the average geographic coordinates (WGS84) of the file.
|
staticprotected |
|
static |
Tests if the file's spatial references can be used with the given georeferencing.
This returns true only if all layers' spatial references can be transformed to the spatial reference systems represented by georef. It will always return false for a local or invalid Georeferencing.
|
staticprotected |
Tests if the file's spatial references can be used with the given georeferencing.
This returns true only if all layers' spatial references can be transformed to the spatial reference systems represented by georef. It will always return false for a local or invalid Georeferencing.
|
protected |
A MapCoordConstructor which interprets the given coordinates in millimeters on paper.
|
protected |
A MapCoordConstructor which interprets the given coordinates as projected.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
overrideprotectedvirtual |
Actual implementation of the import.
This function shall read the input and populate the map and view from it. Importers which support input from QIODevice should use the device(). They must not open or close this device.
If information might be lost in the process, a message shall be recorded by calling addWarning() with a translated, useful description of the issue. If a fatal error is encountered, then this method may either throw an exception, or log an error message with addWarning() and return false. The line between errors and warnings is somewhat of a judgement call on the part of the author, but generally an Importer should not succeed unless the map is populated sufficiently to be useful.
Implements OpenOrienteering::Importer.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
void OpenOrienteering::OgrFileImport::setGeoreferencingImportEnabled | ( | bool | enabled | ) |
Enables the import of georeferencing from the geospatial data.
If this import is not enabled, the georeferencing of the Map given to the constructor will be used instead.
|
protected |
|
overridevirtualnoexcept |
Returns true when the importer/exporter supports QIODevice.
The default implementation returns true
. Some exporters or importers might wish to use other ways of accessing the output/input path. In these cases, the default implementation should be overwritten to return false
.
Reimplemented from OpenOrienteering::ImportExport.
|
inlineprotected |