QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | List of all members
QgsProjectBadLayerGuiHandler Class Reference

Handler for missing layers within project. More...

#include <qgsprojectbadlayerguihandler.h>

Inheritance diagram for QgsProjectBadLayerGuiHandler:
Inheritance graph
[legend]

Public Member Functions

 QgsProjectBadLayerGuiHandler ()
virtual void handleBadLayers (QList< QDomNode > layers, QDomDocument projectDom) override
 implementation of the handler
- Public Member Functions inherited from QgsProjectBadLayerHandler
virtual ~QgsProjectBadLayerHandler ()

Static Public Attributes

static bool mIgnore = false
 Flag to store the Ignore button press of MessageBox used by QgsLegend.

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

QString dataSource (QDomNode &layerNode)
 return the data source for the given layer
DataType dataType (QDomNode &layerNode)
 returns data type associated with the given QgsProject file Dom node
bool findLayer (const QString &fileFilters, const QDomNode &constLayerNode)
 find relocated data source for the given layer
void findLayers (const QString &fileFilters, const QList< QDomNode > &layerNodes)
 find relocated data sources for given layers
bool findMissingFile (const QString &fileFilters, QDomNode &layerNode)
 this is used to locate files that have moved or otherwise are missing
ProviderType providerType (QDomNode &layerNode)
 return the physical storage type associated with the given layer
void setDataSource (QDomNode &layerNode, const QString &dataSource)
 set the datasource element to the new value

Detailed Description

Handler for missing layers within project.

Gives user a chance to select path to the missing layers.

Definition at line 25 of file qgsprojectbadlayerguihandler.h.

Member Enumeration Documentation

file data representation

Enumerator:
IS_VECTOR 
IS_RASTER 
IS_BOGUS 

Definition at line 41 of file qgsprojectbadlayerguihandler.h.

the three flavors for data

Enumerator:
IS_FILE 
IS_DATABASE 
IS_URL 
IS_Unknown 

Definition at line 44 of file qgsprojectbadlayerguihandler.h.

Constructor & Destructor Documentation

QgsProjectBadLayerGuiHandler::QgsProjectBadLayerGuiHandler ( )

Definition at line 28 of file qgsprojectbadlayerguihandler.cpp.

Member Function Documentation

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 114 of file qgsprojectbadlayerguihandler.cpp.

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 84 of file qgsprojectbadlayerguihandler.cpp.

bool QgsProjectBadLayerGuiHandler::findLayer ( const QString &  fileFilters,
const QDomNode &  constLayerNode 
)
protected

find relocated data source for the given layer

This QDom object represents a QgsProject node that maps to a specific layer.

Parameters
fileFiltersfile filters to use
constLayerNodeQDom node containing layer project information
Todo:

XXX Only implemented for file based layers. It will need to be extended for XXX other data source types such as databases.

Definition at line 258 of file qgsprojectbadlayerguihandler.cpp.

void QgsProjectBadLayerGuiHandler::findLayers ( const QString &  fileFilters,
const QList< QDomNode > &  layerNodes 
)
protected

find relocated data sources for given layers

These QDom objects represent QgsProject nodes that map to specific layers.

Definition at line 290 of file qgsprojectbadlayerguihandler.cpp.

bool QgsProjectBadLayerGuiHandler::findMissingFile ( const QString &  fileFilters,
QDomNode &  layerNode 
)
protected

this is used to locate files that have moved or otherwise are missing

Definition at line 190 of file qgsprojectbadlayerguihandler.cpp.

void QgsProjectBadLayerGuiHandler::handleBadLayers ( QList< QDomNode >  layers,
QDomDocument  projectDom 
)
overridevirtual

implementation of the handler

Implements QgsProjectBadLayerHandler.

Definition at line 34 of file qgsprojectbadlayerguihandler.cpp.

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 132 of file qgsprojectbadlayerguihandler.cpp.

void QgsProjectBadLayerGuiHandler::setDataSource ( QDomNode &  layerNode,
const QString &  dataSource 
)
protected

set the datasource element to the new value

Definition at line 174 of file qgsprojectbadlayerguihandler.cpp.

Member Data Documentation

bool QgsProjectBadLayerGuiHandler::mIgnore = false
static

Flag to store the Ignore button press of MessageBox used by QgsLegend.

Definition at line 36 of file qgsprojectbadlayerguihandler.h.


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