mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-12 00:06:43 -04:00
This is an important change: new class (QgsMapLayerRenderer) is introduced and it keeps all information from layer which is necessary for rendering. Thanks to that, any changes to map layer will have no impact on rendering that may be currently underway: if the user changes renderer, rendering will not crash because it is using a different instance. Work in progress: only vector layers, no labeling, no diagrams, iterator still uses some bits from QgsVectorLayer. Another change: QgsFeatureRendererV2, QgsSymbolV2 do not get access to QgsVectorLayer - only to fields they need. Point displacement renderer did more extensive use of QgsVectorLayer - currently it is not functional.
39 lines
874 B
C++
39 lines
874 B
C++
#include "qgsgeometrycache.h"
|
|
|
|
#include "qgsvectorlayereditbuffer.h"
|
|
|
|
QgsGeometryCache::QgsGeometryCache()
|
|
{
|
|
}
|
|
|
|
QgsGeometryCache::~QgsGeometryCache()
|
|
{
|
|
// Destroy any cached geometries and clear the references to them
|
|
deleteCachedGeometries();
|
|
}
|
|
|
|
bool QgsGeometryCache::geometry( QgsFeatureId fid, QgsGeometry& geometry )
|
|
{
|
|
// no need to check changed geometries because all changed geometries are also cached
|
|
|
|
// first time this geometry has changed since last commit
|
|
if ( !mCachedGeometries.contains( fid ) )
|
|
return false;
|
|
|
|
geometry = mCachedGeometries[fid];
|
|
return true;
|
|
}
|
|
|
|
void QgsGeometryCache::cacheGeometry( QgsFeatureId fid, const QgsGeometry& geom )
|
|
{
|
|
mCachedGeometries[fid] = geom;
|
|
}
|
|
|
|
|
|
void QgsGeometryCache::deleteCachedGeometries()
|
|
{
|
|
// Destroy any cached geometries
|
|
mCachedGeometries.clear();
|
|
mCachedGeometriesRect = QgsRectangle();
|
|
}
|