#include <qgsprojectbadlayerguihandler.h>


Public Member Functions | |
| QgsProjectBadLayerGuiHandler () | |
| virtual void | handleBadLayers (QList< QDomNode > layers, QDomDocument projectDom) |
| implementation of the handler | |
Protected Types | |
| enum | DataType { IS_VECTOR, IS_RASTER, IS_BOGUS } |
| file data representation More... | |
| enum | ProviderType { IS_FILE, IS_DATABASE, IS_URL, IS_Unknown } |
| the three flavors for data More... | |
Protected Member Functions | |
| DataType | dataType (QDomNode &layerNode) |
| returns data type associated with the given QgsProject file Dom node | |
| QString | dataSource (QDomNode &layerNode) |
| return the data source for the given layer | |
| ProviderType | providerType (QDomNode &layerNode) |
| return the physical storage type associated with the given layer | |
| void | setDataSource (QDomNode &layerNode, QString const &dataSource) |
| set the datasource element to the new value | |
| bool | findMissingFile (QString const &fileFilters, QDomNode &layerNode) |
| this is used to locate files that have moved or otherwise are missing | |
| bool | findLayer (QString const &fileFilters, QDomNode const &constLayerNode) |
| find relocated data source for the given layer | |
| void | findLayers (QString const &fileFilters, QList< QDomNode > const &layerNodes) |
| find relocated data sources for given layers | |
Gives user a chance to select path to the missing layers.
Definition at line 13 of file qgsprojectbadlayerguihandler.h.
enum QgsProjectBadLayerGuiHandler::DataType [protected] |
enum QgsProjectBadLayerGuiHandler::ProviderType [protected] |
| QgsProjectBadLayerGuiHandler::QgsProjectBadLayerGuiHandler | ( | ) |
Definition at line 12 of file qgsprojectbadlayerguihandler.cpp.
| void QgsProjectBadLayerGuiHandler::handleBadLayers | ( | QList< QDomNode > | layers, | |
| QDomDocument | projectDom | |||
| ) | [virtual] |
implementation of the handler
Implements QgsProjectBadLayerHandler.
Definition at line 16 of file qgsprojectbadlayerguihandler.cpp.
References QgsProviderRegistry::fileVectorFilters(), findLayers(), QgsProviderRegistry::instance(), and QgsDebugMsg.
| QgsProjectBadLayerGuiHandler::DataType QgsProjectBadLayerGuiHandler::dataType | ( | QDomNode & | layerNode | ) | [protected] |
returns data type associated with the given QgsProject file Dom node
The Dom node should represent the state associated with a specific layer.
Definition at line 40 of file qgsprojectbadlayerguihandler.cpp.
References IS_BOGUS, IS_RASTER, IS_VECTOR, and QgsDebugMsg.
Referenced by findMissingFile(), and providerType().
| QString QgsProjectBadLayerGuiHandler::dataSource | ( | QDomNode & | layerNode | ) | [protected] |
return the data source for the given layer
The QDomNode is a QgsProject Dom node corresponding to a map layer state.
Essentially dumps datasource tag.
Definition at line 70 of file qgsprojectbadlayerguihandler.cpp.
References QgsDebugMsg.
Referenced by findMissingFile(), and providerType().
| QgsProjectBadLayerGuiHandler::ProviderType QgsProjectBadLayerGuiHandler::providerType | ( | QDomNode & | layerNode | ) | [protected] |
return the physical storage type associated with the given layer
The QDomNode is a QgsProject Dom node corresponding to a map layer state.
If the provider tag is "ogr", then it's a file type.
However, if the layer is a raster, then there won't be a provider tag. It will always have an associated file.
If the layer doesn't fall into either of the previous two categories, then it's either a database or URL. If the datasource tag has "url=", then it's URL based and if it has "dbname=">, then the layer data is in a database.
Definition at line 88 of file qgsprojectbadlayerguihandler.cpp.
References dataSource(), dataType(), IS_DATABASE, IS_FILE, IS_RASTER, IS_Unknown, IS_URL, IS_VECTOR, and QgsDebugMsg.
Referenced by findLayer().
| void QgsProjectBadLayerGuiHandler::setDataSource | ( | QDomNode & | layerNode, | |
| QString const & | dataSource | |||
| ) | [protected] |
set the datasource element to the new value
Definition at line 130 of file qgsprojectbadlayerguihandler.cpp.
References QgsDebugMsg.
Referenced by findMissingFile().
| bool QgsProjectBadLayerGuiHandler::findMissingFile | ( | QString const & | fileFilters, | |
| QDomNode & | layerNode | |||
| ) | [protected] |
this is used to locate files that have moved or otherwise are missing
Definition at line 146 of file qgsprojectbadlayerguihandler.cpp.
References dataSource(), dataType(), QgsProject::instance(), IS_RASTER, IS_VECTOR, QgisGui::openFilesRememberingFilter(), QgsDebugMsg, QgsProject::read(), and setDataSource().
Referenced by findLayer().
| bool QgsProjectBadLayerGuiHandler::findLayer | ( | QString const & | fileFilters, | |
| QDomNode const & | constLayerNode | |||
| ) | [protected] |
find relocated data source for the given layer
This QDom object represents a QgsProject node that maps to a specific layer.
| fileFilters | file filters to use | |
| constLayerNode | QDom node containing layer project information |
Definition at line 214 of file qgsprojectbadlayerguihandler.cpp.
References findMissingFile(), IS_DATABASE, IS_FILE, IS_Unknown, IS_URL, providerType(), and QgsDebugMsg.
Referenced by findLayers().
| void QgsProjectBadLayerGuiHandler::findLayers | ( | QString const & | fileFilters, | |
| QList< QDomNode > const & | layerNodes | |||
| ) | [protected] |
find relocated data sources for given layers
These QDom objects represent QgsProject nodes that map to specific layers.
Definition at line 246 of file qgsprojectbadlayerguihandler.cpp.
References findLayer().
Referenced by handleBadLayers().
1.5.6