mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -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.
45 lines
1.2 KiB
C++
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
|