Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework vector joins so they do not use QgsProject::instance()
The basic idea is to split reading of XML definition and resolution of layer IDs into layers. Also includes some cleanups in QgsProject and improvements in QgsVectorLayerJoinInfo.
- Loading branch information
Showing
32 changed files
with
557 additions
and
523 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,49 @@ | |||
|
|||
class QgsVectorLayerJoinInfo | |||
{ | |||
%TypeHeaderCode | |||
#include "qgsvectorlayerjoininfo.h" | |||
%End | |||
|
|||
public: | |||
QgsVectorLayerJoinInfo(); | |||
|
|||
//! Sets weak reference to the joined layer | |||
void setJoinLayer( QgsVectorLayer* layer ); | |||
//! Returns joined layer (may be null if the reference was set by layer ID and not resolved yet) | |||
QgsVectorLayer* joinLayer() const; | |||
|
|||
//! Sets ID of the joined layer. It will need to be overwritten by setJoinLayer() to a reference to real layer | |||
void setJoinLayerId( const QString& layerId ); | |||
//! ID of the joined layer - may be used to resolve reference to the joined layer | |||
QString joinLayerId() const; | |||
|
|||
//! Sets name of the field of our layer that will be used for join | |||
void setTargetFieldName( const QString& fieldName ); | |||
//! Returns name of the field of our layer that will be used for join | |||
QString targetFieldName() const; | |||
|
|||
//! Sets name of the field of joined layer that will be used for join | |||
void setJoinFieldName( const QString& fieldName ); | |||
//! Returns name of the field of joined layer that will be used for join | |||
QString joinFieldName() const; | |||
|
|||
//! Sets prefix of fields from the joined layer. If null, joined layer's name will be used. | |||
void setPrefix( const QString& prefix ); | |||
//! Returns prefix of fields from the joined layer. If null, joined layer's name will be used. | |||
QString prefix() const; | |||
|
|||
//! Sets whether values from the joined layer should be cached in memory to speed up lookups | |||
void setUsingMemoryCache( bool enabled ); | |||
//! Returns whether values from the joined layer should be cached in memory to speed up lookups | |||
bool isUsingMemoryCache() const; | |||
|
|||
bool operator==( const QgsVectorLayerJoinInfo& other ) const; | |||
|
|||
/** Set subset of fields to be used from joined layer. Takes ownership of the passed pointer. Null pointer tells to use all fields. | |||
@note added in 2.6 */ | |||
void setJoinFieldNamesSubset( QStringList* fieldNamesSubset /Transfer/ ); | |||
/** Get subset of fields to be used from joined layer. All fields will be used if null is returned. | |||
@note added in 2.6 */ | |||
QStringList* joinFieldNamesSubset() const; | |||
}; |
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
Oops, something went wrong.