Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
OpenOrienteering::OgrFileExport Class Reference

An Exporter to geospatial vector data supported by OGR. More...

#include <ogr_file_format_p.h>

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

Public Types

enum  OgrQuirk { GeorefOptional = 0x01, NeedsWgs84 = 0x02, SingleLayer = 0x04, UseLayerField = 0x08 }
 Quirks for OGR drivers. More...
 

Public Member Functions

 OgrFileExport (const QString &path, const Map *map, const MapView *view)
 A type which handles OR-combinations of OGR driver quirks. More...
 
 ~OgrFileExport () override
 
bool supportsQIODevice () const noexcept override
 Returns true when the importer/exporter supports QIODevice. More...
 
bool exportImplementation () override
 Actual implementation of the export. More...
 
- Public Member Functions inherited from OpenOrienteering::Exporter
 Exporter (const QString &path, const Map *map, const MapView *view)
 Creates a new Exporter with the given path, map, and view. More...
 
 ~Exporter () override
 Destroys the current Exporter. More...
 
bool doExport ()
 Exports the map and view. More...
 
- Public Member Functions inherited from OpenOrienteering::ImportExport
 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...
 
QIODevicedevice () 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...
 

Protected Member Functions

std::vector< const Symbol * > symbolsForExport () const
 
void addPointsToLayer (OGRLayerH layer, const std::function< bool(const Object *)> &condition)
 
void addTextToLayer (OGRLayerH layer, const std::function< bool(const Object *)> &condition)
 
void addLinesToLayer (OGRLayerH layer, const std::function< bool(const Object *)> &condition)
 
void addAreasToLayer (OGRLayerH layer, const std::function< bool(const Object *)> &condition)
 
OGRLayerH createLayer (const char *layer_name, OGRwkbGeometryType type)
 
void populateStyleTable (const std::vector< const Symbol *> &symbols)
 
void setupGeoreferencing (GDALDriverH po_driver)
 
void setupQuirks (GDALDriverH po_driver)
 

Static Protected Member Functions

static QByteArray symbolId (const Symbol *symbol)
 

Additional Inherited Members

- Protected Attributes inherited from OpenOrienteering::Exporter
const QString path
 The output path. More...
 
const Map *const map
 The Map to import or export. More...
 
const MapView *const view
 The MapView to import or export. More...
 

Detailed Description

An Exporter to geospatial vector data supported by OGR.

OGR needs to know the filename. As well, it doesn't use a QIODevice, but rather uses the filename directly.

Member Enumeration Documentation

◆ OgrQuirk

Quirks for OGR drivers.

Each quirk shall use a distinct bit so that they may be OR-combined.

Enumerator
GeorefOptional 

The driver does not need or use georeferencing.

NeedsWgs84 

The driver needs WGS84 geographic coordinates.

SingleLayer 

The driver supports just a single layer.

UseLayerField 

Write the symbol names to the layer field.

Constructor & Destructor Documentation

◆ OgrFileExport()

OpenOrienteering::OgrFileExport::OgrFileExport ( const QString path,
const Map map,
const MapView view 
)

A type which handles OR-combinations of OGR driver quirks.

◆ ~OgrFileExport()

OpenOrienteering::OgrFileExport::~OgrFileExport ( )
overridedefault

Member Function Documentation

◆ addAreasToLayer()

void OpenOrienteering::OgrFileExport::addAreasToLayer ( OGRLayerH  layer,
const std::function< bool(const Object *)> &  condition 
)
protected

◆ addLinesToLayer()

void OpenOrienteering::OgrFileExport::addLinesToLayer ( OGRLayerH  layer,
const std::function< bool(const Object *)> &  condition 
)
protected

◆ addPointsToLayer()

void OpenOrienteering::OgrFileExport::addPointsToLayer ( OGRLayerH  layer,
const std::function< bool(const Object *)> &  condition 
)
protected

◆ addTextToLayer()

void OpenOrienteering::OgrFileExport::addTextToLayer ( OGRLayerH  layer,
const std::function< bool(const Object *)> &  condition 
)
protected

◆ createLayer()

OGRLayerH OpenOrienteering::OgrFileExport::createLayer ( const char *  layer_name,
OGRwkbGeometryType  type 
)
protected

◆ exportImplementation()

bool OpenOrienteering::OgrFileExport::exportImplementation ( )
overridevirtual

Actual implementation of the export.

Exporters which support input from QIODevice shall use the device(). They must not open or close the device.

If information might be lost in the export, 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.

There is no default implementation.

Implements OpenOrienteering::Exporter.

◆ populateStyleTable()

void OpenOrienteering::OgrFileExport::populateStyleTable ( const std::vector< const Symbol *> &  symbols)
protected

◆ setupGeoreferencing()

void OpenOrienteering::OgrFileExport::setupGeoreferencing ( GDALDriverH  po_driver)
protected

Only certain drivers work without georeferencing info. GeorefOptional based on http://www.gdal.org/ogr_formats.html as of March 5, 2018

◆ setupQuirks()

void OpenOrienteering::OgrFileExport::setupQuirks ( GDALDriverH  po_driver)
protected

◆ supportsQIODevice()

bool OpenOrienteering::OgrFileExport::supportsQIODevice ( ) const
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.

◆ symbolId()

static QByteArray OpenOrienteering::OgrFileExport::symbolId ( const Symbol symbol)
inlinestaticprotected

◆ symbolsForExport()

std::vector< const Symbol * > OpenOrienteering::OgrFileExport::symbolsForExport ( ) const
protected

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