QGIS/src/core/qgsgeometrycache.h
Martin Dobias 2fcf556c3c Do the rendering of map layers within special classes
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.
2013-11-20 16:01:12 +07:00

45 lines
1.2 KiB
C++

#ifndef QGSGEOMETRYCACHE_H
#define QGSGEOMETRYCACHE_H
#include "qgsgeometry.h"
#include "qgsfeature.h"
#include "qgsrectangle.h"
#include <QMap>
class CORE_EXPORT QgsGeometryCache
{
public:
QgsGeometryCache();
~QgsGeometryCache();
inline QgsGeometryMap& cachedGeometries() { return mCachedGeometries; }
//! fetch geometry from cache, return true if successful
bool geometry( QgsFeatureId fid, QgsGeometry& geometry );
//! store a geometry in the cache
void cacheGeometry( QgsFeatureId fid, const QgsGeometry& geom );
//! get rid of the cached geometry
void removeGeometry( QgsFeatureId fid ) { mCachedGeometries.remove( fid ); }
/** Deletes the geometries in mCachedGeometries */
void deleteCachedGeometries();
void setCachedGeometriesRect( const QgsRectangle& extent ) { mCachedGeometriesRect = extent; }
const QgsRectangle& cachedGeometriesRect() { return mCachedGeometriesRect; }
protected:
/** cache of the committed geometries retrieved *for the current display* */
QgsGeometryMap mCachedGeometries;
/** extent for which there are cached geometries */
QgsRectangle mCachedGeometriesRect;
};
#endif // QGSGEOMETRYCACHE_H