-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
44 changed files
with
919 additions
and
665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifndef QGSMAPLAYERRENDERER_H | ||
#define QGSMAPLAYERRENDERER_H | ||
|
||
#include <QList> | ||
|
||
/** | ||
* Base class for utility classes that encapsulate information necessary | ||
* for rendering of map layers. The rendering is typically done in a background | ||
* thread, so it is necessary to keep all structures required for rendering away | ||
* from the original map layer because it may change any time. | ||
* | ||
* Because the data needs to be copied (to avoid the need for locking), | ||
* is is highly desirable to use copy-on-write where possible. This way, | ||
* the overhead of copying (both memory and CPU) will be kept low. | ||
* Qt containers and various Qt classes use implicit sharing. | ||
* | ||
* The scenario will be: | ||
* 1. renderer job (doing preparation in the GUI thread) calls | ||
* QgsMapLayer::createMapRenderer() and gets instance of this class. | ||
* The instance is initialized at that point and should not need | ||
* additional calls to QgsVectorLayer. | ||
* 2. renderer job (still in GUI thread) stores the renderer for later use. | ||
* 3. renderer job (in worker thread) calls QgsMapLayerRenderer::render() | ||
* 4. renderer job (again in GUI thread) will check errors() and report them | ||
*/ | ||
class QgsMapLayerRenderer | ||
{ | ||
public: | ||
virtual ~QgsMapLayerRenderer() {} | ||
|
||
//! Do the rendering (based on data stored in the class) | ||
virtual bool render() = 0; | ||
|
||
//! Container for errors (@todo instead of simple message could have error codes + custom data) | ||
struct Error | ||
{ | ||
QString message; | ||
}; | ||
|
||
typedef QList<Error> ErrorList; | ||
|
||
//! Return list of errors (problems) that happened during the rendering | ||
ErrorList errors() const { return mErrors; } | ||
|
||
protected: | ||
ErrorList mErrors; | ||
}; | ||
|
||
#endif // QGSMAPLAYERRENDERER_H |
Oops, something went wrong.