QGIS API Documentation
2.4.0-Chugiak
|
Reads and writes project states. More...
#include <qgsproject.h>
Classes | |
struct | Imp |
Signals | |
void | readProject (const QDomDocument &) |
emitted when project is being read More... | |
void | writeProject (QDomDocument &) |
emitted when project is being written More... | |
void | readMapLayer (QgsMapLayer *mapLayer, const QDomElement &layerNode) |
Emitted, after the basic initialisation of a layer from the project file is done. More... | |
void | writeMapLayer (QgsMapLayer *mapLayer, QDomElement &layerElem, QDomDocument &doc) |
Emitted, when a layer is being saved. More... | |
void | projectSaved () |
emitted when the project file has been written and closed More... | |
void | oldProjectVersionWarning (QString) |
emitted when an old project file is read. More... | |
void | layerLoaded (int i, int n) |
emitted when a layer from a projects was read More... | |
void | loadingLayer (QString) |
void | snapSettingsChanged () |
Public Member Functions | |
~QgsProject () | |
void | clear () |
Clear the project. More... | |
bool | read (QDomNode &layerNode) |
read the layer described in the associated Dom node More... | |
void | clearProperties () |
syntactic sugar for property lists More... | |
bool | removeEntry (const QString &scope, const QString &key) |
remove the given key More... | |
QStringList | entryList (const QString &scope, const QString &key) const |
return keys with values – do not return keys that contain other keys More... | |
QStringList | subkeyList (const QString &scope, const QString &key) const |
return keys with keys – do not return keys that contain only values More... | |
void | dumpProperties () const |
dump out current project properties to stderr More... | |
QString | writePath (QString filename) const |
prepare a filename to save it to the project file More... | |
QString | readPath (QString filename) const |
turn filename read from the project file to an absolute path More... | |
QString | error () const |
Return error message from previous read/write. More... | |
void | setBadLayerHandler (QgsProjectBadLayerHandler *handler) |
Change handler for missing layers. More... | |
QString | layerIsEmbedded (const QString &id) const |
Returns project file path if layer is embedded from other project file. More... | |
bool | createEmbeddedLayer (const QString &layerId, const QString &projectFilePath, QList< QDomNode > &brokenNodes, QList< QPair< QgsVectorLayer *, QDomElement > > &vectorLayerList, bool saveFlag=true) |
Creates a maplayer instance defined in an arbitrary project file. More... | |
QgsLayerTreeGroup * | createEmbeddedGroup (const QString &groupName, const QString &projectFilePath) |
Create layer group instance defined in an arbitrary project file. More... | |
void | setSnapSettingsForLayer (const QString &layerId, bool enabled, QgsSnapper::SnappingType type, QgsTolerance::UnitType unit, double tolerance, bool avoidIntersection) |
Convenience function to set snap settings per layer. More... | |
bool | snapSettingsForLayer (const QString &layerId, bool &enabled, QgsSnapper::SnappingType &type, QgsTolerance::UnitType &units, double &tolerance, bool &avoidIntersection) const |
Convenience function to query snap settings of a layer. More... | |
void | setTopologicalEditing (bool enabled) |
Convenience function to set topological editing. More... | |
bool | topologicalEditing () const |
Convenience function to query topological editing status. More... | |
QString | homePath () const |
Return project's home path. More... | |
QgsRelationManager * | relationManager () const |
QgsLayerTreeGroup * | layerTreeRoot () const |
Return pointer to the root (invisible) node of the project's layer tree. More... | |
QgsLayerTreeRegistryBridge * | layerTreeRegistryBridge () const |
Return pointer to the helper class that synchronizes map layer registry with layer tree. More... | |
void | title (const QString &title) |
Every project has an associated title string. More... | |
void | setTitle (const QString &title) |
Set project title. More... | |
const QString & | title () const |
returns title More... | |
bool | isDirty () const |
the dirty flag is true if the project has been modified since the last write() More... | |
void | dirty (bool b) |
void | setDirty (bool b) |
Set project as dirty (modified). More... | |
void | setFileName (const QString &name) |
Every project has an associated file that contains its XML. More... | |
QString | fileName () const |
returns file name More... | |
bool | read (const QFileInfo &file) |
read project file More... | |
bool | read () |
presuming that the caller has already reset the map canvas, map registry, and legend More... | |
bool | write (const QFileInfo &file) |
write project file More... | |
bool | write () |
bool | writeEntry (const QString &scope, const QString &key, bool value) |
bool | writeEntry (const QString &scope, const QString &key, double value) |
bool | writeEntry (const QString &scope, const QString &key, int value) |
bool | writeEntry (const QString &scope, const QString &key, const QString &value) |
bool | writeEntry (const QString &scope, const QString &key, const QStringList &value) |
QStringList | readListEntry (const QString &scope, const QString &key, QStringList def=QStringList(), bool *ok=0) const |
key value accessors More... | |
QString | readEntry (const QString &scope, const QString &key, const QString &def=QString::null, bool *ok=0) const |
int | readNumEntry (const QString &scope, const QString &key, int def=0, bool *ok=0) const |
double | readDoubleEntry (const QString &scope, const QString &key, double def=0, bool *ok=0) const |
bool | readBoolEntry (const QString &scope, const QString &key, bool def=false, bool *ok=0) const |
Static Public Member Functions | |
static QgsProject * | instance () |
access to canonical QgsProject instance More... | |
Protected Member Functions | |
void | setError (QString errorMessage) |
Set error message from read/write operation. More... | |
void | clearError () |
Clear error message. More... | |
bool | addLayer (const QDomElement &layerElem, QList< QDomNode > &brokenNodes, QList< QPair< QgsVectorLayer *, QDomElement > > &vectorLayerList) |
void | initializeEmbeddedSubtree (const QString &projectFilePath, QgsLayerTreeGroup *group) |
void | loadEmbeddedNodes (QgsLayerTreeGroup *group) |
void | updateEmbeddedGroupsProjectPath (QgsLayerTreeGroup *group) |
Private Member Functions | |
QgsProject () | |
QgsProject (QgsProject const &) | |
QPair< bool, QList< QDomNode > > | _getMapLayers (QDomDocument const &doc) |
Read map layers from project file. More... | |
void | snapSettings (QStringList &layerIdList, QStringList &enabledList, QStringList &snapTypeList, QStringList &snapUnitList, QStringList &toleranceUnitList, QStringList &avoidIntersectionList) const |
Private Attributes | |
std::auto_ptr< Imp > | imp_ |
implementation handle More... | |
QString | mErrorMessage |
QgsProjectBadLayerHandler * | mBadLayerHandler |
QHash< QString, QPair< QString, bool > > | mEmbeddedLayers |
Embeded layers which are defined in other projects. More... | |
QgsRelationManager * | mRelationManager |
QgsLayerTreeGroup * | mRootGroup |
QgsLayerTreeRegistryBridge * | mLayerTreeRegistryBridge |
Static Private Attributes | |
static QgsProject * | theProject_ = 0 |
Reads and writes project states.
Has two general kinds of state to make persistent. (I.e., to read and write.) First, Qgis proprietary information. Second plug-in information.
A singleton since there shall only be one active project at a time; and provides canonical location for plug-ins and main app to find/set properties.
Might want to consider moving from Singleton; i.e., allowing more than one project. Just as the GIMP can have simultaneous multiple images, perhaps qgis can one day have simultaneous multiple projects.
Definition at line 67 of file qgsproject.h.
QgsProject::~QgsProject | ( | ) |
Definition at line 351 of file qgsproject.cpp.
References mBadLayerHandler, mRelationManager, and mRootGroup.
|
private |
Definition at line 334 of file qgsproject.cpp.
References clear(), mLayerTreeRegistryBridge, and mRootGroup.
Referenced by instance().
|
private |
|
private |
Read map layers from project file.
<maplayer type="vector"> <layername>Hydrop</layername> <datasource>/data/usgs/city_shp/hydrop.shp</datasource> <zorder>0</zorder> <provider>ogr</provider> <singlesymbol> <renderitem> <value>blabla</value> <symbol> <outlinecolor red="85" green="0" blue="255" /> <outlinestyle>SolidLine</outlinestyle> <outlinewidth>1</outlinewidth> <fillcolor red="0" green="170" blue="255" /> <fillpattern>SolidPattern</fillpattern> </symbol> <label>blabla</label> </renderitem> </singlesymbol> <label>0</label> <labelattributes> <label text="Label" field="" /> <family name="Sans Serif" field="" /> <size value="12" units="pt" field="" /> <bold on="0" field="" /> <italic on="0" field="" /> <underline on="0" field="" /> <color red="0" green="0" blue="0" field="" /> <x field="" /> <y field="" /> <offset units="pt" x="0" xfield="" y="0" yfield="" /> <angle value="0" field="" /> <alignment value="center" field="" /> </labelattributes> </maplayer>
Definition at line 674 of file qgsproject.cpp.
References addLayer(), createEmbeddedLayer(), layerLoaded(), loadingLayer(), readPath(), and tr.
Referenced by read().
|
protected |
Definition at line 747 of file qgsproject.cpp.
References QgsMapLayerRegistry::addMapLayers(), QgsPluginLayerRegistry::createLayer(), QgsMapLayerRegistry::instance(), QgsPluginLayerRegistry::instance(), QgsMapLayer::isValid(), QgsDebugMsg, QgsMapLayer::readLayerXML(), readMapLayer(), and QgsVectorLayer::vectorJoins().
Referenced by _getMapLayers(), createEmbeddedLayer(), and read().
void QgsProject::clear | ( | ) |
Clear the project.
Definition at line 422 of file qgsproject.cpp.
References QgsRelationManager::clear(), imp_, mEmbeddedLayers, mRelationManager, mRootGroup, setDirty(), and writeEntry().
Referenced by clearProperties(), QgsProject(), and read().
|
protected |
Clear error message.
Definition at line 1681 of file qgsproject.cpp.
References setError().
void QgsProject::clearProperties | ( | ) |
syntactic sugar for property lists
extra properties, typically added by plug-ins
This allows for extra properties to be associated with projects. Think of it as a registry bound to a project.
Properties are arbitrary values keyed by a name and associated with a scope. The scope would presumably refer to your plug-in. E.g., "openmodeller".
E.g., open modeller might use:
"QgsProject::instance()->properties("openmodeller")["foo"]
.
removes all project properties
Definition at line 1208 of file qgsproject.cpp.
QgsLayerTreeGroup * QgsProject::createEmbeddedGroup | ( | const QString & | groupName, |
const QString & | projectFilePath | ||
) |
Create layer group instance defined in an arbitrary project file.
Definition at line 1798 of file qgsproject.cpp.
References initializeEmbeddedSubtree(), instance(), mLayerTreeRegistryBridge, readListEntry(), and writeEntry().
Referenced by loadEmbeddedNodes().
bool QgsProject::createEmbeddedLayer | ( | const QString & | layerId, |
const QString & | projectFilePath, | ||
QList< QDomNode > & | brokenNodes, | ||
QList< QPair< QgsVectorLayer *, QDomElement > > & | vectorLayerList, | ||
bool | saveFlag = true |
||
) |
Creates a maplayer instance defined in an arbitrary project file.
Caller takes ownership
Definition at line 1702 of file qgsproject.cpp.
References addLayer(), mEmbeddedLayers, and QgsDataSourceURI::setDatabase().
Referenced by _getMapLayers(), initializeEmbeddedSubtree(), and loadEmbeddedNodes().
void QgsProject::dirty | ( | bool | b | ) |
Definition at line 396 of file qgsproject.cpp.
References imp_.
Referenced by QgsRelationManager::addRelation(), QgsComposition::alignSelectedItemsBottom(), QgsComposition::alignSelectedItemsHCenter(), QgsComposition::alignSelectedItemsLeft(), QgsComposition::alignSelectedItemsRight(), QgsComposition::alignSelectedItemsTop(), QgsComposition::alignSelectedItemsVCenter(), clearProperties(), QgsComposition::endCommand(), QgsComposition::endMultiFrameCommand(), QgsComposition::lockSelectedItems(), QgsComposerMouseHandles::mouseReleaseEvent(), QgsComposition::pushAddRemoveCommand(), read(), removeEntry(), QgsComposerMultiFrameCommand::restoreState(), QgsComposerItemCommand::restoreState(), setDirty(), setFileName(), QgsComposition::setNumPages(), QgsComposition::setPageStyleSymbol(), QgsComposition::setPaperSize(), QgsComposition::setPrintResolution(), QgsAddRemoveMultiFrameCommand::switchState(), QgsAddRemoveItemCommand::switchState(), title(), QgsComposition::unlockAllItems(), QgsComposition::updateZValues(), write(), and writeEntry().
void QgsProject::dumpProperties | ( | ) | const |
dump out current project properties to stderr
Definition at line 1466 of file qgsproject.cpp.
QStringList QgsProject::entryList | ( | const QString & | scope, |
const QString & | key | ||
) | const |
return keys with values – do not return keys that contain other keys
Definition at line 1428 of file qgsproject.cpp.
References QgsPropertyKey::entryList(), findKey_(), and imp_.
QString QgsProject::error | ( | ) | const |
Return error message from previous read/write.
Definition at line 1676 of file qgsproject.cpp.
References mErrorMessage.
QString QgsProject::fileName | ( | ) | const |
returns file name
Definition at line 417 of file qgsproject.cpp.
References imp_.
Referenced by homePath(), read(), readPath(), write(), and writePath().
QString QgsProject::homePath | ( | ) | const |
Return project's home path.
Definition at line 2033 of file qgsproject.cpp.
References fileName().
Referenced by readPath(), and QgsBrowserModel::updateProjectHome().
|
protected |
Definition at line 1872 of file qgsproject.cpp.
References createEmbeddedLayer().
Referenced by createEmbeddedGroup().
|
static |
access to canonical QgsProject instance
Definition at line 362 of file qgsproject.cpp.
References QgsProject(), and theProject_.
Referenced by QgsComposition::alignSelectedItemsBottom(), QgsComposition::alignSelectedItemsHCenter(), QgsComposition::alignSelectedItemsLeft(), QgsComposition::alignSelectedItemsRight(), QgsComposition::alignSelectedItemsTop(), QgsComposition::alignSelectedItemsVCenter(), QgsGeometry::avoidIntersections(), QgsPalLabeling::clearEngineSettings(), QgsOfflineEditing::convertToOfflineProject(), createEmbeddedGroup(), QgsAttributeForm::createWrappers(), QgsSymbolV2::defaultSymbol(), QgsComposition::endCommand(), QgsComposition::endMultiFrameCommand(), QgsMapToolIdentify::featureDerivedAttributes(), QgsProjectBadLayerGuiHandler::findMissingFile(), QgsMapToolIdentify::identify(), QgsAttributeForm::init(), QgsComposerMap::initGridAnnotationFormatFromProject(), QgsOfflineEditing::isOfflineProject(), QgsPalLabeling::loadEngineSettings(), QgsMapLayer::loadNamedStyle(), QgsComposition::lockSelectedItems(), QgsComposerScaleBar::mapWidth(), QgsComposerMouseHandles::mouseReleaseEvent(), QgsOWSSourceSelect::on_mChangeCRSButton_clicked(), QgsVectorLayer::onRelationsLoaded(), QgsOfflineEditing::openLoggingDb(), QgsComposition::pushAddRemoveCommand(), QgsBrowserModel::QgsBrowserModel(), QgsComposerMap::QgsComposerMap(), QgsMapCanvas::QgsMapCanvas(), QgsOWSSourceSelect::QgsOWSSourceSelect(), QgsVectorLayer::QgsVectorLayer(), QgsMapLayer::readLayerXML(), QgsVectorLayer::readSymbology(), QgsSvgAnnotationItem::readXML(), QgsComposerPicture::readXML(), QgsVectorLayer::referencingRelations(), QgsScaleRangeWidget::reloadProjectScales(), QgsMapRenderer::render(), QgsComposerMultiFrameCommand::restoreState(), QgsComposerItemCommand::restoreState(), QgsPalLabeling::saveEngineSettings(), QgsComposition::setNumPages(), QgsComposition::setPageStyleSymbol(), QgsComposition::setPaperSize(), QgsComposition::setPrintResolution(), setTopologicalEditing(), QgsMapCanvasSnapper::snapToBackgroundLayers(), QgsMapCanvasSnapper::snapToCurrentLayer(), QgsAddRemoveMultiFrameCommand::switchState(), QgsAddRemoveItemCommand::switchState(), QgsSymbolLayerV2Utils::symbolNameToPath(), QgsSymbolLayerV2Utils::symbolPathToName(), QgsOfflineEditing::synchronize(), topologicalEditing(), QgsComposition::unlockAllItems(), QgsBrowserModel::updateProjectHome(), QgsComposition::updateZValues(), QgsMapLayer::writeLayerXML(), QgsVectorLayer::writeSymbology(), QgsSvgAnnotationItem::writeXML(), and QgsComposerPicture::writeXML().
bool QgsProject::isDirty | ( | ) | const |
the dirty flag is true if the project has been modified since the last write()
Definition at line 390 of file qgsproject.cpp.
References imp_.
QString QgsProject::layerIsEmbedded | ( | const QString & | id | ) | const |
Returns project file path if layer is embedded from other project file.
Returns empty string if layer is not embedded
Definition at line 1692 of file qgsproject.cpp.
References mEmbeddedLayers.
Referenced by write().
|
signal |
emitted when a layer from a projects was read
Referenced by _getMapLayers().
|
inline |
Return pointer to the helper class that synchronizes map layer registry with layer tree.
Definition at line 342 of file qgsproject.h.
QgsLayerTreeGroup * QgsProject::layerTreeRoot | ( | ) | const |
Return pointer to the root (invisible) node of the project's layer tree.
Definition at line 2047 of file qgsproject.cpp.
References mRootGroup.
|
protected |
Definition at line 964 of file qgsproject.cpp.
References createEmbeddedGroup(), createEmbeddedLayer(), and readPath().
Referenced by read().
|
signal |
Referenced by _getMapLayers().
|
signal |
emitted when an old project file is read.
Referenced by read().
|
signal |
emitted when the project file has been written and closed
Referenced by write().
bool QgsProject::read | ( | const QFileInfo & | file | ) |
read project file
Please note that most of the contents were copied from qgsproject.
Definition at line 805 of file qgsproject.cpp.
Referenced by QgsProjectBadLayerGuiHandler::findMissingFile().
bool QgsProject::read | ( | ) |
presuming that the caller has already reset the map canvas, map registry, and legend
Shows a warning when an old project file is read.
Definition at line 817 of file qgsproject.cpp.
References _getMapLayers(), _getProperties(), _getTitle(), _getVersion(), clear(), clearError(), dirty(), dump_(), fileName(), QgsProjectBadLayerHandler::handleBadLayers(), imp_, loadEmbeddedNodes(), mBadLayerHandler, mLayerTreeRegistryBridge, mRootGroup, oldProjectVersionWarning(), QGis::QGIS_VERSION, QgsDebugMsg, readProject(), setError(), QgsProjectVersion::text(), tr, and QgsLogger::warning().
Referenced by read().
bool QgsProject::read | ( | QDomNode & | layerNode | ) |
read the layer described in the associated Dom node
layerNode | represents a QgsProject Dom node that maps to a specific layer. |
QgsProject raises an exception when one of the QgsProject::read() implementations fails. Since the read()s are invoked from qgisapp, then qgisapp handles the exception. It prompts the user for the new location of the data, if any. If there is a new location, the Dom node associated with the layer has its datasource tag corrected. Then that node is passed to this member function to be re-opened.
Definition at line 1025 of file qgsproject.cpp.
References addLayer().
bool QgsProject::readBoolEntry | ( | const QString & | scope, |
const QString & | key, | ||
bool | def = false , |
||
bool * | ok = 0 |
||
) | const |
Definition at line 1389 of file qgsproject.cpp.
References findKey_(), and imp_.
Referenced by QgsPalLabeling::loadEngineSettings(), readPath(), QgsScaleRangeWidget::reloadProjectScales(), and writePath().
double QgsProject::readDoubleEntry | ( | const QString & | scope, |
const QString & | key, | ||
double | def = 0 , |
||
bool * | ok = 0 |
||
) | const |
Definition at line 1359 of file qgsproject.cpp.
References findKey_(), and imp_.
QString QgsProject::readEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QString & | def = QString::null , |
||
bool * | ok = 0 |
||
) | const |
Definition at line 1299 of file qgsproject.cpp.
References findKey_(), and imp_.
Referenced by QgsSymbolV2::defaultSymbol(), QgsMapToolIdentify::featureDerivedAttributes(), QgsComposerMap::initGridAnnotationFormatFromProject(), QgsOfflineEditing::isOfflineProject(), QgsOWSSourceSelect::on_mChangeCRSButton_clicked(), and QgsOfflineEditing::openLoggingDb().
QStringList QgsProject::readListEntry | ( | const QString & | scope, |
const QString & | key, | ||
QStringList | def = QStringList() , |
||
bool * | ok = 0 |
||
) | const |
key value accessors
keys would be the familiar QSettings-like '/' delimited entries, implying a hierarchy of keys and corresponding values
Definition at line 1268 of file qgsproject.cpp.
References findKey_(), and imp_.
Referenced by QgsGeometry::avoidIntersections(), createEmbeddedGroup(), QgsMapToolIdentify::identify(), QgsScaleRangeWidget::reloadProjectScales(), snapSettings(), and QgsMapCanvasSnapper::snapToBackgroundLayers().
|
signal |
Emitted, after the basic initialisation of a layer from the project file is done.
You can use this signal to read additional information from the project file.
mapLayer | The map layer which is being initialized |
layerNode | The layer node from the project file |
Referenced by addLayer().
int QgsProject::readNumEntry | ( | const QString & | scope, |
const QString & | key, | ||
int | def = 0 , |
||
bool * | ok = 0 |
||
) | const |
Definition at line 1330 of file qgsproject.cpp.
References findKey_(), and imp_.
Referenced by QgsPalLabeling::loadEngineSettings(), QgsComposerMap::QgsComposerMap(), QgsOWSSourceSelect::QgsOWSSourceSelect(), QgsMapRenderer::render(), QgsMapCanvasSnapper::snapToBackgroundLayers(), QgsMapCanvasSnapper::snapToCurrentLayer(), and topologicalEditing().
QString QgsProject::readPath | ( | QString | filename | ) | const |
turn filename read from the project file to an absolute path
Definition at line 1473 of file qgsproject.cpp.
References fileName(), homePath(), qgsVsiPrefix(), and readBoolEntry().
Referenced by _getMapLayers(), loadEmbeddedNodes(), QgsMapLayer::readLayerXML(), QgsVectorLayer::readSymbology(), QgsSvgAnnotationItem::readXML(), and QgsComposerPicture::readXML().
|
signal |
emitted when project is being read
Referenced by read().
QgsRelationManager * QgsProject::relationManager | ( | ) | const |
Definition at line 2042 of file qgsproject.cpp.
References mRelationManager.
Referenced by QgsAttributeForm::createWrappers(), and QgsVectorLayer::referencingRelations().
bool QgsProject::removeEntry | ( | const QString & | scope, |
const QString & | key | ||
) |
remove the given key
Definition at line 1417 of file qgsproject.cpp.
References dirty(), findKey_(), imp_, and removeKey_().
Referenced by QgsPalLabeling::clearEngineSettings(), and QgsOfflineEditing::synchronize().
void QgsProject::setBadLayerHandler | ( | QgsProjectBadLayerHandler * | handler | ) |
Change handler for missing layers.
Deletes old handler and takes ownership of the new one.
Definition at line 1686 of file qgsproject.cpp.
References mBadLayerHandler.
void QgsProject::setDirty | ( | bool | b | ) |
Set project as dirty (modified).
Definition at line 401 of file qgsproject.cpp.
References dirty().
Referenced by clear().
|
protected |
Set error message from read/write operation.
Definition at line 1671 of file qgsproject.cpp.
References mErrorMessage.
Referenced by clearError(), read(), and write().
void QgsProject::setFileName | ( | const QString & | name | ) |
Every project has an associated file that contains its XML.
Definition at line 408 of file qgsproject.cpp.
void QgsProject::setSnapSettingsForLayer | ( | const QString & | layerId, |
bool | enabled, | ||
QgsSnapper::SnappingType | type, | ||
QgsTolerance::UnitType | unit, | ||
double | tolerance, | ||
bool | avoidIntersection | ||
) |
Convenience function to set snap settings per layer.
Definition at line 1893 of file qgsproject.cpp.
References QgsTolerance::Pixels, snapSettings(), snapSettingsChanged(), QgsSnapper::SnapToSegment, QgsSnapper::SnapToVertexAndSegment, and writeEntry().
void QgsProject::setTitle | ( | const QString & | title | ) |
Set project title.
Definition at line 378 of file qgsproject.cpp.
References title().
void QgsProject::setTopologicalEditing | ( | bool | enabled | ) |
Convenience function to set topological editing.
Definition at line 2017 of file qgsproject.cpp.
References instance(), snapSettingsChanged(), and writeEntry().
|
private |
Definition at line 2006 of file qgsproject.cpp.
References readListEntry().
Referenced by setSnapSettingsForLayer(), and snapSettingsForLayer().
|
signal |
Referenced by setSnapSettingsForLayer(), and setTopologicalEditing().
bool QgsProject::snapSettingsForLayer | ( | const QString & | layerId, |
bool & | enabled, | ||
QgsSnapper::SnappingType & | type, | ||
QgsTolerance::UnitType & | units, | ||
double & | tolerance, | ||
bool & | avoidIntersection | ||
) | const |
Convenience function to query snap settings of a layer.
Definition at line 1950 of file qgsproject.cpp.
References QgsTolerance::MapUnits, QgsTolerance::Pixels, snapSettings(), QgsSnapper::SnapToSegment, QgsSnapper::SnapToVertex, and QgsSnapper::SnapToVertexAndSegment.
QStringList QgsProject::subkeyList | ( | const QString & | scope, |
const QString & | key | ||
) | const |
return keys with keys – do not return keys that contain only values
Definition at line 1446 of file qgsproject.cpp.
References findKey_(), imp_, and QgsPropertyKey::subkeyList().
void QgsProject::title | ( | const QString & | title | ) |
Every project has an associated title string.
Definition at line 371 of file qgsproject.cpp.
References dirty(), imp_, and title().
Referenced by QgsOfflineEditing::convertToOfflineProject(), and QgsOfflineEditing::synchronize().
QString const & QgsProject::title | ( | ) | const |
returns title
Definition at line 384 of file qgsproject.cpp.
References imp_.
Referenced by setTitle(), title(), and write().
bool QgsProject::topologicalEditing | ( | ) | const |
Convenience function to query topological editing status.
Definition at line 2023 of file qgsproject.cpp.
References instance(), and readNumEntry().
|
protected |
Definition at line 1006 of file qgsproject.cpp.
References writePath().
Referenced by write().
bool QgsProject::write | ( | const QFileInfo & | file | ) |
write project file
XXX How to best get read access to Qgis state? Actually we can finagle that by searching for qgisapp in object hiearchy.
Definition at line 1034 of file qgsproject.cpp.
bool QgsProject::write | ( | ) |
Definition at line 1042 of file qgsproject.cpp.
References clearError(), dirty(), dump_(), fileName(), QgsMapLayer::id(), imp_, QgsMapLayerRegistry::instance(), layerIsEmbedded(), QgsMapLayerRegistry::mapLayers(), mEmbeddedLayers, mRootGroup, projectSaved(), QGis::QGIS_VERSION, QgsDebugMsg, setError(), title(), tr, updateEmbeddedGroupsProjectPath(), QgsMapLayer::writeLayerXML(), writeMapLayer(), writePath(), and writeProject().
Referenced by write().
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
bool | value | ||
) |
Definition at line 1218 of file qgsproject.cpp.
References addKey_(), dirty(), and imp_.
Referenced by clear(), QgsOfflineEditing::convertToOfflineProject(), createEmbeddedGroup(), QgsPalLabeling::saveEngineSettings(), setSnapSettingsForLayer(), and setTopologicalEditing().
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
double | value | ||
) |
Definition at line 1227 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
int | value | ||
) |
Definition at line 1237 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QString & | value | ||
) |
Definition at line 1246 of file qgsproject.cpp.
bool QgsProject::writeEntry | ( | const QString & | scope, |
const QString & | key, | ||
const QStringList & | value | ||
) |
Definition at line 1256 of file qgsproject.cpp.
|
signal |
Emitted, when a layer is being saved.
You can use this method to save additional information to the layer.
mapLayer | The map layer which is being initialized |
layerElem | The layer element from the project file |
doc | The document |
Referenced by write().
QString QgsProject::writePath | ( | QString | filename | ) | const |
prepare a filename to save it to the project file
Definition at line 1582 of file qgsproject.cpp.
References fileName(), qgsVsiPrefix(), and readBoolEntry().
Referenced by QgsSymbolLayerV2Utils::symbolPathToName(), updateEmbeddedGroupsProjectPath(), write(), and QgsMapLayer::writeLayerXML().
|
signal |
emitted when project is being written
Referenced by write().
|
private |
implementation handle
Definition at line 415 of file qgsproject.h.
Referenced by clear(), dirty(), dumpProperties(), entryList(), fileName(), isDirty(), read(), readBoolEntry(), readDoubleEntry(), readEntry(), readListEntry(), readNumEntry(), removeEntry(), setFileName(), subkeyList(), title(), write(), and writeEntry().
|
private |
Definition at line 426 of file qgsproject.h.
Referenced by read(), setBadLayerHandler(), and ~QgsProject().
|
private |
Embeded layers which are defined in other projects.
Key: layer id, value: pair< project file path, save layer yes / no (e.g. if the layer is part of an embedded group, loading/saving is done by the legend) If the project file path is empty, QgsProject is going to ignore the layer for saving (e.g. because it is part and managed by an embedded group)
Definition at line 431 of file qgsproject.h.
Referenced by clear(), createEmbeddedLayer(), layerIsEmbedded(), and write().
|
private |
Definition at line 424 of file qgsproject.h.
Referenced by error(), and setError().
|
private |
Definition at line 440 of file qgsproject.h.
Referenced by createEmbeddedGroup(), QgsProject(), and read().
|
private |
Definition at line 436 of file qgsproject.h.
Referenced by clear(), relationManager(), and ~QgsProject().
|
private |
Definition at line 438 of file qgsproject.h.
Referenced by clear(), layerTreeRoot(), QgsProject(), read(), write(), and ~QgsProject().
|
staticprivate |
Definition at line 420 of file qgsproject.h.
Referenced by instance().