| qgsatlascomposition.h | | qgsatlascomposition.h | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| | | | |
| class QgsComposerMap; | | class QgsComposerMap; | |
| class QgsComposition; | | class QgsComposition; | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
| class QgsExpression; | | class QgsExpression; | |
| | | | |
| /** \ingroup MapComposer | | /** \ingroup MapComposer | |
| * Class used to render an Atlas, iterating over geometry features. | | * Class used to render an Atlas, iterating over geometry features. | |
| * prepareForFeature() modifies the atlas map's extent to zoom on the given
feature. | | * prepareForFeature() modifies the atlas map's extent to zoom on the given
feature. | |
| * This class is used for printing, exporting to PDF and images. | | * This class is used for printing, exporting to PDF and images. | |
|
| * */ | | * @note This class should not be created directly. For the atlas to functi | |
| | | on correctly | |
| | | * the atlasComposition() property for QgsComposition should be used to ret | |
| | | rieve a | |
| | | * QgsAtlasComposition which is automatically created and attached to the c | |
| | | omposition. | |
| | | */ | |
| class CORE_EXPORT QgsAtlasComposition : public QObject | | class CORE_EXPORT QgsAtlasComposition : public QObject | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
| QgsAtlasComposition( QgsComposition* composition ); | | QgsAtlasComposition( QgsComposition* composition ); | |
| ~QgsAtlasComposition(); | | ~QgsAtlasComposition(); | |
| | | | |
|
| /** Is the atlas generation enabled ? */ | | /**Returns whether the atlas generation is enabled | |
| | | * @returns true if atlas is enabled | |
| | | * @see setEnabled | |
| | | */ | |
| bool enabled() const { return mEnabled; } | | bool enabled() const { return mEnabled; } | |
|
| void setEnabled( bool e ); | | | |
| | | /**Sets whether the atlas is enabled | |
| | | * @param enabled set to true to enable to atlas | |
| | | * @see enabled | |
| | | */ | |
| | | void setEnabled( bool enabled ); | |
| | | | |
| /**Returns the map used by the atlas | | /**Returns the map used by the atlas | |
| * @deprecated Use QgsComposerMap::atlasDriven() instead | | * @deprecated Use QgsComposerMap::atlasDriven() instead | |
| */ | | */ | |
|
| QgsComposerMap* composerMap() const; | | Q_DECL_DEPRECATED QgsComposerMap* composerMap() const; | |
| | | | |
| /**Sets the map used by the atlas | | /**Sets the map used by the atlas | |
| * @deprecated Use QgsComposerMap::setAtlasDriven( true ) instead | | * @deprecated Use QgsComposerMap::setAtlasDriven( true ) instead | |
| */ | | */ | |
|
| void setComposerMap( QgsComposerMap* map ); | | Q_DECL_DEPRECATED void setComposerMap( QgsComposerMap* map ); | |
| | | | |
|
| | | /**Returns true if the atlas is set to hide the coverage layer | |
| | | * @returns true if coverage layer is hidden | |
| | | * @see setHideCoverage | |
| | | */ | |
| bool hideCoverage() const { return mHideCoverage; } | | bool hideCoverage() const { return mHideCoverage; } | |
|
| | | | |
| | | /**Sets whether the coverage layer should be hidden in map items in the | |
| | | composition | |
| | | * @param hide set to true to hide the coverage layer | |
| | | * @see hideCoverage | |
| | | */ | |
| void setHideCoverage( bool hide ); | | void setHideCoverage( bool hide ); | |
| | | | |
| /**Returns whether the atlas map uses a fixed scale | | /**Returns whether the atlas map uses a fixed scale | |
|
| * @deprecated Use QgsComposerMap::atlasFixedScale() instead | | * @deprecated since 2.4 Use QgsComposerMap::atlasScalingMode() instead | |
| */ | | */ | |
|
| bool fixedScale() const; | | Q_DECL_DEPRECATED bool fixedScale() const; | |
| | | | |
| /**Sets whether the atlas map should use a fixed scale | | /**Sets whether the atlas map should use a fixed scale | |
|
| * @deprecated Use QgsComposerMap::setAtlasFixedScale( bool ) instead | | * @deprecated since 2.4 Use QgsComposerMap::setAtlasScalingMode() inst
ead | |
| */ | | */ | |
|
| void setFixedScale( bool fixed ); | | Q_DECL_DEPRECATED void setFixedScale( bool fixed ); | |
| | | | |
| /**Returns the margin for the atlas map | | /**Returns the margin for the atlas map | |
| * @deprecated Use QgsComposerMap::atlasMargin() instead | | * @deprecated Use QgsComposerMap::atlasMargin() instead | |
| */ | | */ | |
|
| float margin() const; | | Q_DECL_DEPRECATED float margin() const; | |
| | | | |
| /**Sets the margin for the atlas map | | /**Sets the margin for the atlas map | |
| * @deprecated Use QgsComposerMap::setAtlasMargin( double ) instead | | * @deprecated Use QgsComposerMap::setAtlasMargin( double ) instead | |
| */ | | */ | |
|
| void setMargin( float margin ); | | Q_DECL_DEPRECATED void setMargin( float margin ); | |
| | | | |
|
| | | /**Returns the filename expression used for generating output filenames | |
| | | for each | |
| | | * atlas page. | |
| | | * @returns filename pattern | |
| | | * @see setFilenamePattern | |
| | | * @see filenamePatternErrorString | |
| | | * @note This property has no effect when exporting to PDF if singleFil | |
| | | e() is true | |
| | | */ | |
| QString filenamePattern() const { return mFilenamePattern; } | | QString filenamePattern() const { return mFilenamePattern; } | |
|
| void setFilenamePattern( const QString& pattern ); | | | |
| | | | |
|
| | | /**Sets the filename expression used for generating output filenames fo | |
| | | r each | |
| | | * atlas page. | |
| | | * @returns true if filename expression could be successful set, false | |
| | | if expression is invalid | |
| | | * @param pattern expression to use for output filenames | |
| | | * @see filenamePattern | |
| | | * @see filenamePatternErrorString | |
| | | * @note This method has no effect when exporting to PDF if singleFile( | |
| | | ) is true | |
| | | */ | |
| | | bool setFilenamePattern( const QString& pattern ); | |
| | | | |
| | | /**Returns an error string from parsing the filename expression. | |
| | | * @returns filename pattern parser error | |
| | | * @see setFilenamePattern | |
| | | * @see filenamePattern | |
| | | */ | |
| | | QString filenamePatternErrorString() const { return mFilenameParserErro | |
| | | r; } | |
| | | | |
| | | /**Returns the coverage layer used for the atlas features | |
| | | * @returns atlas coverage layer | |
| | | * @see setCoverageLayer | |
| | | */ | |
| QgsVectorLayer* coverageLayer() const { return mCoverageLayer; } | | QgsVectorLayer* coverageLayer() const { return mCoverageLayer; } | |
|
| void setCoverageLayer( QgsVectorLayer* lmap ); | | | |
| | | | |
|
| | | /**Sets the coverage layer to use for the atlas features | |
| | | * @param layer vector coverage layer | |
| | | * @see coverageLayer | |
| | | */ | |
| | | void setCoverageLayer( QgsVectorLayer* layer ); | |
| | | | |
| | | /**Returns whether the atlas will be exported to a single file. This is | |
| | | only | |
| | | * applicable for PDF exports. | |
| | | * @returns true if atlas will be exported to a single file | |
| | | * @see setSingleFile | |
| | | * @note This property is only used for PDF exports. | |
| | | */ | |
| bool singleFile() const { return mSingleFile; } | | bool singleFile() const { return mSingleFile; } | |
|
| | | | |
| | | /**Sets whether the atlas should be exported to a single file. This is | |
| | | only | |
| | | * applicable for PDF exports. | |
| | | * @param single set to true to export atlas to a single file. | |
| | | * @see singleFile | |
| | | * @note This method is only used for PDF exports. | |
| | | */ | |
| void setSingleFile( bool single ) { mSingleFile = single; } | | void setSingleFile( bool single ) { mSingleFile = single; } | |
| | | | |
| bool sortFeatures() const { return mSortFeatures; } | | bool sortFeatures() const { return mSortFeatures; } | |
| void setSortFeatures( bool doSort ) { mSortFeatures = doSort; } | | void setSortFeatures( bool doSort ) { mSortFeatures = doSort; } | |
| | | | |
| bool sortAscending() const { return mSortAscending; } | | bool sortAscending() const { return mSortAscending; } | |
| void setSortAscending( bool ascending ) { mSortAscending = ascending; } | | void setSortAscending( bool ascending ) { mSortAscending = ascending; } | |
| | | | |
| bool filterFeatures() const { return mFilterFeatures; } | | bool filterFeatures() const { return mFilterFeatures; } | |
| void setFilterFeatures( bool doFilter ) { mFilterFeatures = doFilter; } | | void setFilterFeatures( bool doFilter ) { mFilterFeatures = doFilter; } | |
| | | | |
| QString featureFilter() const { return mFeatureFilter; } | | QString featureFilter() const { return mFeatureFilter; } | |
| void setFeatureFilter( const QString& expression ) { mFeatureFilter = e
xpression; } | | void setFeatureFilter( const QString& expression ) { mFeatureFilter = e
xpression; } | |
| | | | |
|
| int sortKeyAttributeIndex() const { return mSortKeyAttributeIdx; } | | /**Returns an error string from parsing the feature filter expression. | |
| void setSortKeyAttributeIndex( int idx ) { mSortKeyAttributeIdx = idx; | | * @returns filename pattern parser error | |
| } | | * @see setFilenamePattern | |
| | | * @see filenamePattern | |
| | | */ | |
| | | QString featureFilterErrorString() const { return mFilterParserError; } | |
| | | | |
| | | QString sortKeyAttributeName() const { return mSortKeyAttributeName; } | |
| | | void setSortKeyAttributeName( QString fieldName ) { mSortKeyAttributeNa | |
| | | me = fieldName; } | |
| | | | |
| | | Q_DECL_DEPRECATED int sortKeyAttributeIndex() const; | |
| | | Q_DECL_DEPRECATED void setSortKeyAttributeIndex( int idx ); | |
| | | | |
| | | /**Returns the current list of predefined scales for the atlas. This is | |
| | | used | |
| | | * for maps which are set to the predefined atlas scaling mode. | |
| | | * @returns a vector of doubles representing predefined scales | |
| | | * @see setPredefinedScales | |
| | | * @see QgsComposerMap::atlasScalingMode | |
| | | */ | |
| | | const QVector<double>& predefinedScales() const { return mPredefinedSca | |
| | | les; } | |
| | | | |
| | | /**Sets the list of predefined scales for the atlas. This is used | |
| | | * for maps which are set to the predefined atlas scaling mode. | |
| | | * @param scales a vector of doubles representing predefined scales | |
| | | * @see predefinedScales | |
| | | * @see QgsComposerMap::atlasScalingMode | |
| | | */ | |
| | | void setPredefinedScales( const QVector<double>& scales ); | |
| | | | |
| /** Begins the rendering. Returns true if successful, false if no match
ing atlas | | /** Begins the rendering. Returns true if successful, false if no match
ing atlas | |
| features found.*/ | | features found.*/ | |
| bool beginRender(); | | bool beginRender(); | |
| /** Ends the rendering. Restores original extent */ | | /** Ends the rendering. Restores original extent */ | |
| void endRender(); | | void endRender(); | |
| | | | |
| /** Returns the number of features in the coverage layer */ | | /** Returns the number of features in the coverage layer */ | |
| int numFeatures() const; | | int numFeatures() const; | |
| | | | |
|
| /** Prepare the atlas map for the given feature. Sets the extent and co | | /**Prepare the atlas map for the given feature. Sets the extent and con | |
| ntext variables */ | | text variables | |
| void prepareForFeature( int i ); | | * @returns true if feature was successfully prepared | |
| | | */ | |
| /** Prepare the atlas map for the given feature. Sets the extent and co | | bool prepareForFeature( int i ); | |
| ntext variables */ | | | |
| void prepareForFeature( QgsFeature * feat ); | | /**Prepare the atlas map for the given feature. Sets the extent and con | |
| | | text variables | |
| | | * @returns true if feature was successfully prepared | |
| | | */ | |
| | | bool prepareForFeature( QgsFeature * feat ); | |
| | | | |
| /** Returns the current filename. Must be called after prepareForFeatur
e( i ) */ | | /** Returns the current filename. Must be called after prepareForFeatur
e( i ) */ | |
| const QString& currentFilename() const; | | const QString& currentFilename() const; | |
| | | | |
| void writeXML( QDomElement& elem, QDomDocument& doc ) const; | | void writeXML( QDomElement& elem, QDomDocument& doc ) const; | |
| void readXML( const QDomElement& elem, const QDomDocument& doc ); | | void readXML( const QDomElement& elem, const QDomDocument& doc ); | |
| | | | |
| QgsComposition* composition() { return mComposition; } | | QgsComposition* composition() { return mComposition; } | |
| | | | |
| /** Requeries the current atlas coverage layer and applies filtering an
d sorting. Returns | | /** Requeries the current atlas coverage layer and applies filtering an
d sorting. Returns | |
| | | | |
| skipping to change at line 153 | | skipping to change at line 251 | |
| | | | |
| /** emitted when atlas is enabled or disabled */ | | /** emitted when atlas is enabled or disabled */ | |
| void toggled( bool ); | | void toggled( bool ); | |
| | | | |
| /**Is emitted when the atlas has an updated status bar message for the
composer window*/ | | /**Is emitted when the atlas has an updated status bar message for the
composer window*/ | |
| void statusMsgChanged( QString message ); | | void statusMsgChanged( QString message ); | |
| | | | |
| /**Is emitted when the coverage layer for an atlas changes*/ | | /**Is emitted when the coverage layer for an atlas changes*/ | |
| void coverageLayerChanged( QgsVectorLayer* layer ); | | void coverageLayerChanged( QgsVectorLayer* layer ); | |
| | | | |
|
| | | /**Is emitted when atlas rendering has begun*/ | |
| | | void renderBegun(); | |
| | | | |
| | | /**Is emitted when atlas rendering has ended*/ | |
| | | void renderEnded(); | |
| | | | |
| | | /**Is emitted when the current atlas feature changes*/ | |
| | | void featureChanged( QgsFeature* feature ); | |
| | | | |
| private: | | private: | |
|
| /**Updates the filename expression*/ | | /**Updates the filename expression. | |
| void updateFilenameExpression(); | | * @returns true if expression was successfully parsed, false if expres | |
| | | sion is invalid | |
| | | */ | |
| | | bool updateFilenameExpression(); | |
| | | | |
|
| /**Evaluates filename for current feature*/ | | /**Evaluates filename for current feature | |
| void evalFeatureFilename(); | | * @returns true if feature filename was successfully evaluated | |
| | | */ | |
| | | bool evalFeatureFilename(); | |
| | | | |
| QgsComposition* mComposition; | | QgsComposition* mComposition; | |
| | | | |
| bool mEnabled; | | bool mEnabled; | |
| bool mHideCoverage; | | bool mHideCoverage; | |
| QString mFilenamePattern; | | QString mFilenamePattern; | |
| QgsVectorLayer* mCoverageLayer; | | QgsVectorLayer* mCoverageLayer; | |
| bool mSingleFile; | | bool mSingleFile; | |
| | | | |
| QgsCoordinateTransform mTransform; | | QgsCoordinateTransform mTransform; | |
| | | | |
| skipping to change at line 185 | | skipping to change at line 296 | |
| // current atlas feature number | | // current atlas feature number | |
| int mCurrentFeatureNo; | | int mCurrentFeatureNo; | |
| | | | |
| public: | | public: | |
| typedef QMap< QgsFeatureId, QVariant > SorterKeys; | | typedef QMap< QgsFeatureId, QVariant > SorterKeys; | |
| | | | |
| private: | | private: | |
| // value of field that is used for ordering of features | | // value of field that is used for ordering of features | |
| SorterKeys mFeatureKeys; | | SorterKeys mFeatureKeys; | |
| // key (attribute index) used for ordering | | // key (attribute index) used for ordering | |
|
| int mSortKeyAttributeIdx; | | QString mSortKeyAttributeName; | |
| | | | |
| // feature filtering | | // feature filtering | |
| bool mFilterFeatures; | | bool mFilterFeatures; | |
| // feature expression filter | | // feature expression filter | |
| QString mFeatureFilter; | | QString mFeatureFilter; | |
| | | | |
| // id of each iterated feature (after filtering and sorting) | | // id of each iterated feature (after filtering and sorting) | |
| QVector<QgsFeatureId> mFeatureIds; | | QVector<QgsFeatureId> mFeatureIds; | |
| | | | |
| QgsFeature mCurrentFeature; | | QgsFeature mCurrentFeature; | |
| | | | |
| std::auto_ptr<QgsExpression> mFilenameExpr; | | std::auto_ptr<QgsExpression> mFilenameExpr; | |
| | | | |
| // bounding box of the current feature transformed into map crs | | // bounding box of the current feature transformed into map crs | |
| QgsRectangle mTransformedFeatureBounds; | | QgsRectangle mTransformedFeatureBounds; | |
| | | | |
|
| | | QString mFilenameParserError; | |
| | | QString mFilterParserError; | |
| | | | |
| //forces all atlas enabled maps to redraw | | //forces all atlas enabled maps to redraw | |
| void updateAtlasMaps(); | | void updateAtlasMaps(); | |
| | | | |
| //computes the extent of the current feature, in the crs of the specifi
ed map | | //computes the extent of the current feature, in the crs of the specifi
ed map | |
| void computeExtent( QgsComposerMap *map ); | | void computeExtent( QgsComposerMap *map ); | |
|
| | | | |
| | | //list of predefined scales | |
| | | QVector<double> mPredefinedScales; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 27 change blocks. |
| 28 lines changed or deleted | | 160 lines changed or added | |
|
| qgscomposerattributetable.h | | qgscomposerattributetable.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSCOMPOSERATTRIBUTETABLE_H | | #ifndef QGSCOMPOSERATTRIBUTETABLE_H | |
| #define QGSCOMPOSERATTRIBUTETABLE_H | | #define QGSCOMPOSERATTRIBUTETABLE_H | |
| | | | |
| #include "qgscomposertable.h" | | #include "qgscomposertable.h" | |
| | | | |
| class QgsComposerMap; | | class QgsComposerMap; | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
| | | | |
|
| /**Helper class for sorting, takes into account sorting column and ascendin
g / descending*/ | | /**Helper class for sorting tables, takes into account sorting column and a
scending / descending*/ | |
| class CORE_EXPORT QgsComposerAttributeTableCompare | | class CORE_EXPORT QgsComposerAttributeTableCompare | |
| { | | { | |
| public: | | public: | |
| QgsComposerAttributeTableCompare(); | | QgsComposerAttributeTableCompare(); | |
| bool operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 )
; | | bool operator()( const QgsAttributeMap& m1, const QgsAttributeMap& m2 )
; | |
|
| | | | |
| | | /**Sets column number to sort by | |
| | | * @param col column number for sorting | |
| | | */ | |
| void setSortColumn( int col ) { mCurrentSortColumn = col; } | | void setSortColumn( int col ) { mCurrentSortColumn = col; } | |
|
| | | | |
| | | /**Sets sort order for column sorting | |
| | | * @param asc set to true to sort in ascending order, false to sort in | |
| | | descending order | |
| | | */ | |
| void setAscending( bool asc ) { mAscending = asc; } | | void setAscending( bool asc ) { mAscending = asc; } | |
|
| | | | |
| private: | | private: | |
| int mCurrentSortColumn; | | int mCurrentSortColumn; | |
| bool mAscending; | | bool mAscending; | |
| }; | | }; | |
| | | | |
| /**A table class that displays a vector attribute table*/ | | /**A table class that displays a vector attribute table*/ | |
| class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable | | class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
| QgsComposerAttributeTable( QgsComposition* composition ); | | QgsComposerAttributeTable( QgsComposition* composition ); | |
| ~QgsComposerAttributeTable(); | | ~QgsComposerAttributeTable(); | |
| | | | |
| /** return correct graphics item type. Added in v1.7 */ | | /** return correct graphics item type. Added in v1.7 */ | |
| virtual int type() const { return ComposerAttributeTable; } | | virtual int type() const { return ComposerAttributeTable; } | |
| | | | |
| /** \brief Reimplementation of QCanvasItem::paint*/ | | /** \brief Reimplementation of QCanvasItem::paint*/ | |
| virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem*
itemStyle, QWidget* pWidget ); | | virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem*
itemStyle, QWidget* pWidget ); | |
| | | | |
|
| | | /**Writes properties specific to attribute tables | |
| | | * @param elem an existing QDomElement in which to store the attribute | |
| | | table's properties. | |
| | | * @param doc QDomDocument for the destination xml. | |
| | | * @see readXML | |
| | | */ | |
| bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | | bool writeXML( QDomElement& elem, QDomDocument & doc ) const; | |
|
| | | | |
| | | /**Reads the properties specific to an attribute table from xml. | |
| | | * @param itemElem a QDomElement holding the attribute table's desired | |
| | | properties. | |
| | | * @param doc QDomDocument for the source xml. | |
| | | * @see writeXML | |
| | | */ | |
| bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | | bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | |
| | | | |
|
| void setVectorLayer( QgsVectorLayer* vl ); | | /**Sets the vector layer from which to display feature attributes | |
| const QgsVectorLayer* vectorLayer() const { return mVectorLayer; } | | * @param layer Vector layer for attribute table | |
| | | * @see vectorLayer | |
| | | */ | |
| | | void setVectorLayer( QgsVectorLayer* layer ); | |
| | | | |
| | | /**Returns the vector layer the attribute table is currently using | |
| | | * @returns attribute table's current vector layer | |
| | | * @see setVectorLayer | |
| | | */ | |
| | | QgsVectorLayer* vectorLayer() const { return mVectorLayer; } | |
| | | | |
|
| | | /**Resets the attribute table's columns to match the vector layer's fie | |
| | | lds | |
| | | * @note added in 2.3 | |
| | | * @see setVectorLayer | |
| | | */ | |
| | | void resetColumns(); | |
| | | | |
| | | /**Sets the composer map to use to limit the extent of features shown i | |
| | | n the | |
| | | * attribute table. This setting only has an effect if setDisplayOnlyVi | |
| | | sibleFeatures is | |
| | | * set to true. Changing the composer map forces the table to refetch f | |
| | | eatures from its | |
| | | * vector layer, and may result in the table changing size to accommoda | |
| | | te the new displayed | |
| | | * feature attributes. | |
| | | * @param map QgsComposerMap which drives the extents of the table's fe | |
| | | atures | |
| | | * @see composerMap | |
| | | * @see setDisplayOnlyVisibleFeatures | |
| | | */ | |
| void setComposerMap( const QgsComposerMap* map ); | | void setComposerMap( const QgsComposerMap* map ); | |
|
| | | | |
| | | /**Returns the composer map whose extents are controlling the features | |
| | | shown in the | |
| | | * table. The extents of the map are only used if displayOnlyVisibleFea | |
| | | tures() is true. | |
| | | * @returns composer map controlling the attribute table | |
| | | * @see setComposerMap | |
| | | * @see displayOnlyVisibleFeatures | |
| | | */ | |
| const QgsComposerMap* composerMap() const { return mComposerMap; } | | const QgsComposerMap* composerMap() const { return mComposerMap; } | |
| | | | |
|
| void setMaximumNumberOfFeatures( int nr ) { mMaximumNumberOfFeatures = | | /**Sets the maximum number of features shown by the table. Changing thi | |
| nr; } | | s setting may result | |
| | | * in the attribute table changing its size to accommodate the new numb | |
| | | er of rows, and requires | |
| | | * the table to refetch features from its vector layer. | |
| | | * @param features maximum number of features to show in the table | |
| | | * @see maximumNumberOfFeatures | |
| | | */ | |
| | | void setMaximumNumberOfFeatures( int features ); | |
| | | | |
| | | /**Returns the maximum number of features to be shown by the table. | |
| | | * @returns maximum number of features | |
| | | * @see setMaximumNumberOfFeatures | |
| | | */ | |
| int maximumNumberOfFeatures() const { return mMaximumNumberOfFeatures;
} | | int maximumNumberOfFeatures() const { return mMaximumNumberOfFeatures;
} | |
| | | | |
|
| void setDisplayOnlyVisibleFeatures( bool b ) { mShowOnlyVisibleFeatures | | /**Sets attribute table to only show features which are visible in a co | |
| = b; } | | mposer map item. Changing | |
| | | * this setting forces the table to refetch features from its vector la | |
| | | yer, and may result in | |
| | | * the table changing size to accommodate the new displayed feature att | |
| | | ributes. | |
| | | * @param visibleOnly set to true to show only visible features | |
| | | * @see displayOnlyVisibleFeatures | |
| | | * @see setComposerMap | |
| | | */ | |
| | | void setDisplayOnlyVisibleFeatures( bool visibleOnly ); | |
| | | | |
| | | /**Returns true if the table is set to show only features visible on a | |
| | | corresponding | |
| | | * composer map item. | |
| | | * @returns true if table only shows visible features | |
| | | * @see composerMap | |
| | | * @see setDisplayOnlyVisibleFeatures | |
| | | */ | |
| bool displayOnlyVisibleFeatures() const { return mShowOnlyVisibleFeatur
es; } | | bool displayOnlyVisibleFeatures() const { return mShowOnlyVisibleFeatur
es; } | |
| | | | |
|
| QSet<int> displayAttributes() const { return mDisplayAttributes; } | | /**Returns true if a feature filter is active on the attribute table | |
| void setDisplayAttributes( const QSet<int>& attr ) { mDisplayAttributes | | * @returns bool state of the feature filter | |
| = attr; } | | * @note added in 2.3 | |
| | | * @see setFilterFeatures | |
| | | * @see featureFilter | |
| | | */ | |
| | | bool filterFeatures() const { return mFilterFeatures; } | |
| | | | |
| | | /**Sets whether the feature filter is active for the attribute table. C | |
| | | hanging | |
| | | * this setting forces the table to refetch features from its vector la | |
| | | yer, and may result in | |
| | | * the table changing size to accommodate the new displayed feature att | |
| | | ributes. | |
| | | * @param filter Set to true to enable the feature filter | |
| | | * @note added in 2.3 | |
| | | * @see filterFeatures | |
| | | * @see setFeatureFilter | |
| | | */ | |
| | | void setFilterFeatures( bool filter ); | |
| | | | |
| | | /**Returns the current expression used to filter features for the table | |
| | | . The filter is only | |
| | | * active if filterFeatures() is true. | |
| | | * @returns feature filter expression | |
| | | * @note added in 2.3 | |
| | | * @see setFeatureFilter | |
| | | * @see filterFeatures | |
| | | */ | |
| | | QString featureFilter() const { return mFeatureFilter; } | |
| | | | |
| | | /**Sets the expression used for filtering features in the table. The fi | |
| | | lter is only | |
| | | * active if filterFeatures() is set to true. Changing this setting for | |
| | | ces the table | |
| | | * to refetch features from its vector layer, and may result in | |
| | | * the table changing size to accommodate the new displayed feature att | |
| | | ributes. | |
| | | * @param expression filter to use for selecting which features to disp | |
| | | lay in the table | |
| | | * @note added in 2.3 | |
| | | * @see featureFilter | |
| | | * @see setFilterFeatures | |
| | | */ | |
| | | void setFeatureFilter( const QString& expression ); | |
| | | | |
| | | /**Returns the attributes fields which are shown by the table. | |
| | | * @returns a QSet of integers refering to the attributes in the vector | |
| | | layer. If | |
| | | * result is an empty QSet than all feature attributes will be shown. | |
| | | * @see setDisplayAttributes | |
| | | * @deprecated use QgsComposerTable::columns() instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED QSet<int> displayAttributes() const; | |
| | | | |
| | | /**Sets the attributes to display in the table. | |
| | | * @param attr QSet of integer values refering to the attributes from t | |
| | | he vector layer to show. | |
| | | * Set to an empty QSet to show all feature attributes. | |
| | | * @param refresh set to true to force the table to refetch features fr | |
| | | om its vector layer | |
| | | * and immediately update the display of the table. This may result in | |
| | | the table changing size | |
| | | * to accommodate the new displayed feature attributes. | |
| | | * @see displayAttributes | |
| | | */ | |
| | | void setDisplayAttributes( const QSet<int>& attr, bool refresh = true ) | |
| | | ; | |
| | | | |
|
| QMap<int, QString> fieldAliasMap() const { return mFieldAliasMap; } | | /**Returns the attribute field aliases, which control how fields are na | |
| void setFieldAliasMap( const QMap<int, QString>& map ) { mFieldAliasMap | | med in the table's | |
| = map; } | | * header row. | |
| | | * @returns a QMap of integers to strings, where the string is the fiel | |
| | | d's alias and the | |
| | | * integer is the field index from the associated vector layer. | |
| | | * @see setFieldAliasMap | |
| | | * @deprecated use QgsComposerTable::columns() instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED QMap<int, QString> fieldAliasMap() const; | |
| | | | |
|
| /**Adapts mMaximumNumberOfFeatures depending on the rectangle height*/ | | /**Sets the attribute field aliases, which control how fields are named | |
| | | in the table's | |
| | | * header row. | |
| | | * @param map QMap of integers to strings, where the string is the alia | |
| | | s to use for the | |
| | | * corresponding field, and the integer is the field index from the vec | |
| | | tor layer | |
| | | * @see fieldAliasMap | |
| | | * @deprecated use QgsComposerTable::columns() instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED void setFieldAliasMap( const QMap<int, QString>& map | |
| | | ); | |
| | | | |
| | | /**Adapts mMaximumNumberOfFeatures depending on the rectangle height. C | |
| | | alling this forces | |
| | | * the table to refetch features from its vector layer and immediately | |
| | | updates the display | |
| | | * of the table. | |
| | | * @see maximumNumberOfFeatures | |
| | | * @see setMaximumNumberOfFeatures | |
| | | */ | |
| void setSceneRect( const QRectF& rectangle ); | | void setSceneRect( const QRectF& rectangle ); | |
| | | | |
|
| // @note not available in python bindings | | /**Sets the attributes to use to sort the table's features. | |
| void setSortAttributes( const QList<QPair<int, bool> > att ) { mSortInf | | * @param att QList integers/bool pairs, where the integer refers to th | |
| ormation = att; } | | e attribute index and | |
| | | * the bool sets the sort order for the attribute. If true the attribut | |
| | | e is sorted ascending, | |
| | | * if false, the attribute is sorted in descending order. Note that fea | |
| | | tures are sorted | |
| | | * after the maximum number of displayed features have been fetched fro | |
| | | m the vector layer's | |
| | | * provider. | |
| | | * @see sortAttributes | |
| | | * @deprecated use QgsComposerTable::columns() instead | |
| | | * @note not available in python bindings | |
| | | */ | |
| | | Q_DECL_DEPRECATED void setSortAttributes( const QList<QPair<int, bool> | |
| | | > att ); | |
| | | | |
|
| // @note not available in python bindings | | /**Returns the attributes used to sort the table's features. | |
| QList<QPair<int, bool> > sortAttributes() const { return mSortInformati | | * @returns a QList of integer/bool pairs, where the integer refers to | |
| on; } | | the attribute index and | |
| | | * the bool to the sort order for the attribute. If true the attribute | |
| | | is sorted ascending, | |
| | | * if false, the attribute is sorted in descending order. | |
| | | * @note not available in python bindings | |
| | | */ | |
| | | QList<QPair<int, bool> > sortAttributes() const; | |
| | | | |
|
| protected: | | /**Queries the attribute table's vector layer for attributes to show in | |
| /**Retrieves feature attributes | | the table. | |
| | | * @param attributeMaps list of QgsAttributeMaps where the fetched feat | |
| | | ure attributes will be stored | |
| | | * @returns true if attributes were successfully fetched | |
| * @note not available in python bindings | | * @note not available in python bindings | |
| */ | | */ | |
| bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ); | | bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMaps ); | |
| | | | |
|
| //! @note not available in python bindings | | | |
| QMap<int, QString> getHeaderLabels() const; | | | |
| | | | |
| private: | | private: | |
| /**Associated vector layer*/ | | /**Associated vector layer*/ | |
| QgsVectorLayer* mVectorLayer; | | QgsVectorLayer* mVectorLayer; | |
| /**Associated composer map (used to display the visible features)*/ | | /**Associated composer map (used to display the visible features)*/ | |
| const QgsComposerMap* mComposerMap; | | const QgsComposerMap* mComposerMap; | |
| /**Maximum number of features that is displayed*/ | | /**Maximum number of features that is displayed*/ | |
| int mMaximumNumberOfFeatures; | | int mMaximumNumberOfFeatures; | |
| | | | |
| /**Shows only the features that are visible in the associated composer
map (true by default)*/ | | /**Shows only the features that are visible in the associated composer
map (true by default)*/ | |
| bool mShowOnlyVisibleFeatures; | | bool mShowOnlyVisibleFeatures; | |
| | | | |
|
| /**List of attribute indices to display (or all attributes if list is e | | /**True if feature filtering enabled*/ | |
| mpty)*/ | | bool mFilterFeatures; | |
| QSet<int> mDisplayAttributes; | | /**Feature filter expression*/ | |
| /**Map of attribute name aliases. The aliases might be different to tho | | QString mFeatureFilter; | |
| se of QgsVectorLayer (but those from the vector layer are the default)*/ | | | |
| QMap<int, QString> mFieldAliasMap; | | /**Returns a list of attribute indices corresponding to displayed field | |
| | | s in the table. | |
| /**Contains information about sort attribute index / ascending (true/fa | | * @note kept for compatibility with 2.0 api only | |
| lse). First entry has the highest priority*/ | | */ | |
| QList< QPair<int, bool> > mSortInformation; | | QList<int> fieldsToDisplay() const; | |
| | | | |
| /**Inserts aliases from vector layer as starting configuration to the a | | /**Restores a field alias map from a pre 2.4 format project file format | |
| lias map*/ | | * @param map QMap of integers to strings, where the string is the alia | |
| void initializeAliasMap(); | | s to use for the | |
| /**Returns the attribute name to display in the item (attribute name or | | * corresponding field, and the integer is the field index from the vec | |
| an alias if present)*/ | | tor layer | |
| QString attributeDisplayName( int attributeIndex, const QString& name ) | | */ | |
| const; | | void restoreFieldAliasMap( const QMap<int, QString>& map ); | |
| | | | |
| private slots: | | private slots: | |
| /**Checks if this vector layer will be removed (and sets mVectorLayer t
o 0 if yes) */ | | /**Checks if this vector layer will be removed (and sets mVectorLayer t
o 0 if yes) */ | |
| void removeLayer( QString layerId ); | | void removeLayer( QString layerId ); | |
| | | | |
| signals: | | signals: | |
| /**This signal is emitted if the maximum number of feature changes (int
eractively)*/ | | /**This signal is emitted if the maximum number of feature changes (int
eractively)*/ | |
| void maximumNumberOfFeaturesChanged( int n ); | | void maximumNumberOfFeaturesChanged( int n ); | |
| }; | | }; | |
| | | | |
| | | | |
End of changes. 19 change blocks. |
| 43 lines changed or deleted | | 245 lines changed or added | |
|
| qgscomposeritem.h | | qgscomposeritem.h | |
| | | | |
| skipping to change at line 136 | | skipping to change at line 136 | |
| @param dx move in x-direction (canvas coordinates) | | @param dx move in x-direction (canvas coordinates) | |
| @param dy move in y-direction(canvas coordinates)*/ | | @param dy move in y-direction(canvas coordinates)*/ | |
| virtual void moveContent( double dx, double dy ) { Q_UNUSED( dx ); Q_UN
USED( dy ); } | | virtual void moveContent( double dx, double dy ) { Q_UNUSED( dx ); Q_UN
USED( dy ); } | |
| | | | |
| /**Zoom content of item. Does nothing per default (but implemented in c
omposer map) | | /**Zoom content of item. Does nothing per default (but implemented in c
omposer map) | |
| @param delta value from wheel event that describes magnitude and dire
ction (positive /negative number) | | @param delta value from wheel event that describes magnitude and dire
ction (positive /negative number) | |
| @param x x-position of mouse cursor (in item coordinates) | | @param x x-position of mouse cursor (in item coordinates) | |
| @param y y-position of mouse cursor (in item coordinates)*/ | | @param y y-position of mouse cursor (in item coordinates)*/ | |
| virtual void zoomContent( int delta, double x, double y ) { Q_UNUSED( d
elta ); Q_UNUSED( x ); Q_UNUSED( y ); } | | virtual void zoomContent( int delta, double x, double y ) { Q_UNUSED( d
elta ); Q_UNUSED( x ); Q_UNUSED( y ); } | |
| | | | |
|
| | | /**Gets the page the item is currently on. | |
| | | * @returns page number for item | |
| | | * @see pagePos | |
| | | * @see updatePagePos | |
| | | * @note this method was added in version 2.4 | |
| | | */ | |
| | | int page() const; | |
| | | | |
| | | /**Returns the item's position relative to its current page. | |
| | | * @returns position relative to the page's top left corner. | |
| | | * @see page | |
| | | * @see updatePagePos | |
| | | * @note this method was added in version 2.4 | |
| | | */ | |
| | | QPointF pagePos() const; | |
| | | | |
| | | /**Moves the item so that it retains its relative position on the page | |
| | | * when the paper size changes. | |
| | | * @param newPageWidth new width of the page in mm | |
| | | * @param newPageHeight new height of the page in mm | |
| | | * @see page | |
| | | * @see pagePos | |
| | | * @note this method was added in version 2.4 | |
| | | */ | |
| | | void updatePagePos( double newPageWidth, double newPageHeight ); | |
| | | | |
| /**Moves the item to a new position (in canvas coordinates)*/ | | /**Moves the item to a new position (in canvas coordinates)*/ | |
|
| void setItemPosition( double x, double y, ItemPositionMode itemPoint =
UpperLeft ); | | void setItemPosition( double x, double y, ItemPositionMode itemPoint =
UpperLeft, int page = -1 ); | |
| | | | |
| /**Sets item position and width / height in one go | | /**Sets item position and width / height in one go | |
| @param x item position x | | @param x item position x | |
| @param y item position y | | @param y item position y | |
| @param width item width | | @param width item width | |
| @param height item height | | @param height item height | |
| @param itemPoint item position mode | | @param itemPoint item position mode | |
| @param posIncludesFrame set to true if the position and size argument
s include the item's frame border | | @param posIncludesFrame set to true if the position and size argument
s include the item's frame border | |
|
| | | @param page if page > 0, y is interpreted as relative to the origin o
f the specified page, if page <= 0, y is in absolute canvas coordinates | |
| @note: this method was added in version 1.6*/ | | @note: this method was added in version 1.6*/ | |
|
| void setItemPosition( double x, double y, double width, double height,
ItemPositionMode itemPoint = UpperLeft, bool posIncludesFrame = false ); | | void setItemPosition( double x, double y, double width, double height,
ItemPositionMode itemPoint = UpperLeft, bool posIncludesFrame = false, int
page = -1 ); | |
| | | | |
| /**Returns item's last used position mode. | | /**Returns item's last used position mode. | |
| @note: This property has no effect on actual's item position, which i
s always the top-left corner. | | @note: This property has no effect on actual's item position, which i
s always the top-left corner. | |
| @note: this method was added in version 2.0*/ | | @note: this method was added in version 2.0*/ | |
| ItemPositionMode lastUsedPositionMode() { return mLastUsedPositionMode;
} | | ItemPositionMode lastUsedPositionMode() { return mLastUsedPositionMode;
} | |
| | | | |
| /**Sets this items bound in scene coordinates such that 1 item size uni
ts | | /**Sets this items bound in scene coordinates such that 1 item size uni
ts | |
| corresponds to 1 scene size unit*/ | | corresponds to 1 scene size unit*/ | |
| virtual void setSceneRect( const QRectF& rectangle ); | | virtual void setSceneRect( const QRectF& rectangle ); | |
| | | | |
| | | | |
| skipping to change at line 200 | | skipping to change at line 226 | |
| void setFrameEnabled( bool drawFrame ); | | void setFrameEnabled( bool drawFrame ); | |
| | | | |
| /** Sets frame outline width | | /** Sets frame outline width | |
| * @param outlineWidth new width for outline frame | | * @param outlineWidth new width for outline frame | |
| * @returns nothing | | * @returns nothing | |
| * @note introduced in 2.2 | | * @note introduced in 2.2 | |
| * @see setFrameEnabled | | * @see setFrameEnabled | |
| */ | | */ | |
| virtual void setFrameOutlineWidth( double outlineWidth ); | | virtual void setFrameOutlineWidth( double outlineWidth ); | |
| | | | |
|
| | | /** Returns the frame's outline width. Only used if hasFrame is true. | |
| | | * @returns Frame outline width | |
| | | * @note introduced in 2.3 | |
| | | * @see hasFrame | |
| | | * @see setFrameOutlineWidth | |
| | | */ | |
| | | double frameOutlineWidth() const { return pen().widthF(); } | |
| | | | |
| | | /** Returns the join style used for drawing the item's frame | |
| | | * @returns Join style for outline frame | |
| | | * @note introduced in 2.3 | |
| | | * @see hasFrame | |
| | | * @see setFrameJoinStyle | |
| | | */ | |
| | | Qt::PenJoinStyle frameJoinStyle() const { return mFrameJoinStyle; } | |
| | | /** Sets join style used when drawing the item's frame | |
| | | * @param style Join style for outline frame | |
| | | * @returns nothing | |
| | | * @note introduced in 2.3 | |
| | | * @see setFrameEnabled | |
| | | * @see frameJoinStyle | |
| | | */ | |
| | | void setFrameJoinStyle( Qt::PenJoinStyle style ); | |
| | | | |
| /** Returns the estimated amount the item's frame bleeds outside the it
em's | | /** Returns the estimated amount the item's frame bleeds outside the it
em's | |
| * actual rectangle. For instance, if the item has a 2mm frame outline
, then | | * actual rectangle. For instance, if the item has a 2mm frame outline
, then | |
| * 1mm of this frame is drawn outside the item's rect. In this case th
e | | * 1mm of this frame is drawn outside the item's rect. In this case th
e | |
| * return value will be 1.0 | | * return value will be 1.0 | |
| * @note introduced in 2.2 | | * @note introduced in 2.2 | |
| */ | | */ | |
| virtual double estimatedFrameBleed() const; | | virtual double estimatedFrameBleed() const; | |
| | | | |
| /** Returns the item's rectangular bounds, including any bleed caused b
y the item's frame. | | /** Returns the item's rectangular bounds, including any bleed caused b
y the item's frame. | |
| * The bounds are returned in the item's coordinate system (see Qt's Q
GraphicsItem docs for | | * The bounds are returned in the item's coordinate system (see Qt's Q
GraphicsItem docs for | |
| | | | |
| skipping to change at line 231 | | skipping to change at line 281 | |
| * @see hasBackground | | * @see hasBackground | |
| */ | | */ | |
| bool hasBackground() const {return mBackground;} | | bool hasBackground() const {return mBackground;} | |
| | | | |
| /** Set whether this item has a Background drawn around it or not. | | /** Set whether this item has a Background drawn around it or not. | |
| * @param drawBackground draw Background | | * @param drawBackground draw Background | |
| * @returns nothing | | * @returns nothing | |
| * @note introduced in 2.0 | | * @note introduced in 2.0 | |
| * @see hasBackground | | * @see hasBackground | |
| */ | | */ | |
|
| void setBackgroundEnabled( bool drawBackground ) {mBackground = drawBac
kground;} | | void setBackgroundEnabled( bool drawBackground ) { mBackground = drawBa
ckground; } | |
| | | | |
| /** Gets the background color for this item | | /** Gets the background color for this item | |
| * @returns background color | | * @returns background color | |
| * @note introduced in 2.0 | | * @note introduced in 2.0 | |
| */ | | */ | |
| QColor backgroundColor() const { return mBackgroundColor; } | | QColor backgroundColor() const { return mBackgroundColor; } | |
| | | | |
| /** Sets the background color for this item | | /** Sets the background color for this item | |
| * @param backgroundColor new background color | | * @param backgroundColor new background color | |
| * @returns nothing | | * @returns nothing | |
| * @note introduced in 2.0 | | * @note introduced in 2.0 | |
| */ | | */ | |
| void setBackgroundColor( const QColor& backgroundColor ); | | void setBackgroundColor( const QColor& backgroundColor ); | |
| | | | |
| /** Returns the item's composition blending mode */ | | /** Returns the item's composition blending mode */ | |
|
| QPainter::CompositionMode blendMode() const {return mBlendMode;} | | QPainter::CompositionMode blendMode() const { return mBlendMode; } | |
| | | | |
| /** Sets the item's composition blending mode*/ | | /** Sets the item's composition blending mode*/ | |
| void setBlendMode( QPainter::CompositionMode blendMode ); | | void setBlendMode( QPainter::CompositionMode blendMode ); | |
| | | | |
| /** Returns the item's transparency */ | | /** Returns the item's transparency */ | |
|
| int transparency() const {return mTransparency;} | | int transparency() const { return mTransparency; } | |
| /** Sets the item's transparency */ | | /** Sets the item's transparency */ | |
| void setTransparency( int transparency ); | | void setTransparency( int transparency ); | |
| | | | |
| /** Returns true if effects (eg blend modes) are enabled for the item | | /** Returns true if effects (eg blend modes) are enabled for the item | |
| * @note introduced in 2.0 | | * @note introduced in 2.0 | |
| */ | | */ | |
|
| bool effectsEnabled() const {return mEffectsEnabled;} | | bool effectsEnabled() const { return mEffectsEnabled; } | |
| /** Sets whether effects (eg blend modes) are enabled for the item | | /** Sets whether effects (eg blend modes) are enabled for the item | |
| * @note introduced in 2.0 | | * @note introduced in 2.0 | |
| */ | | */ | |
| void setEffectsEnabled( bool effectsEnabled ); | | void setEffectsEnabled( bool effectsEnabled ); | |
| | | | |
| /**Composite operations for item groups do nothing per default*/ | | /**Composite operations for item groups do nothing per default*/ | |
| virtual void addItem( QgsComposerItem* item ) { Q_UNUSED( item ); } | | virtual void addItem( QgsComposerItem* item ) { Q_UNUSED( item ); } | |
| virtual void removeItems() {} | | virtual void removeItems() {} | |
| | | | |
|
| const QgsComposition* composition() const {return mComposition;} | | const QgsComposition* composition() const { return mComposition; } | |
| QgsComposition* composition() {return mComposition;} | | QgsComposition* composition() {return mComposition;} | |
| | | | |
| virtual void beginItemCommand( const QString& text ) { beginCommand( te
xt ); } | | virtual void beginItemCommand( const QString& text ) { beginCommand( te
xt ); } | |
| | | | |
| /**Starts new composer undo command | | /**Starts new composer undo command | |
| @param commandText command title | | @param commandText command title | |
| @param c context for mergeable commands (unknown for non-mergeable co
mmands*/ | | @param c context for mergeable commands (unknown for non-mergeable co
mmands*/ | |
| void beginCommand( const QString& commandText, QgsComposerMergeCommand:
:Context c = QgsComposerMergeCommand::Unknown ); | | void beginCommand( const QString& commandText, QgsComposerMergeCommand:
:Context c = QgsComposerMergeCommand::Unknown ); | |
| | | | |
| virtual void endItemCommand() { endCommand(); } | | virtual void endItemCommand() { endCommand(); } | |
| | | | |
| skipping to change at line 292 | | skipping to change at line 342 | |
| void endCommand(); | | void endCommand(); | |
| void cancelCommand(); | | void cancelCommand(); | |
| | | | |
| //functions that encapsulate the workaround for the Qt font bug (that i
s to scale the font size up and then scale the | | //functions that encapsulate the workaround for the Qt font bug (that i
s to scale the font size up and then scale the | |
| //painter down by the same factor for drawing | | //painter down by the same factor for drawing | |
| | | | |
| /**Draws Text. Takes care about all the composer specific issues (calcu
lation to pixel, scaling of font and painter | | /**Draws Text. Takes care about all the composer specific issues (calcu
lation to pixel, scaling of font and painter | |
| to work around the Qt font bug)*/ | | to work around the Qt font bug)*/ | |
| void drawText( QPainter* p, double x, double y, const QString& text, co
nst QFont& font ) const; | | void drawText( QPainter* p, double x, double y, const QString& text, co
nst QFont& font ) const; | |
| | | | |
|
| /**Like the above, but with a rectangle for multiline text*/ | | /**Like the above, but with a rectangle for multiline text | |
| void drawText( QPainter* p, const QRectF& rect, const QString& text, co | | * @param p painter to use | |
| nst QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::Alignmen | | * @param rect rectangle to draw into | |
| tFlag valignment = Qt::AlignTop ) const; | | * @param text text to draw | |
| | | * @param font font to use | |
| | | * @param halignment optional horizontal alignment | |
| | | * @param valignment optional vertical alignment | |
| | | * @param flags allows for passing Qt::TextFlags to control appearance | |
| | | of rendered text | |
| | | */ | |
| | | void drawText( QPainter* p, const QRectF& rect, const QString& text, co | |
| | | nst QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::Alignmen | |
| | | tFlag valignment = Qt::AlignTop, int flags = Qt::TextWordWrap ) const; | |
| | | | |
| /**Returns the font width in millimeters (considers upscaling and downs
caling with FONT_WORKAROUND_SCALE*/ | | /**Returns the font width in millimeters (considers upscaling and downs
caling with FONT_WORKAROUND_SCALE*/ | |
| double textWidthMillimeters( const QFont& font, const QString& text ) c
onst; | | double textWidthMillimeters( const QFont& font, const QString& text ) c
onst; | |
| | | | |
| /**Returns the font height of a character in millimeters | | /**Returns the font height of a character in millimeters | |
| @note this method was added in version 1.7*/ | | @note this method was added in version 1.7*/ | |
| double fontHeightCharacterMM( const QFont& font, const QChar& c ) const
; | | double fontHeightCharacterMM( const QFont& font, const QChar& c ) const
; | |
| | | | |
| /**Returns the font ascent in Millimeters (considers upscaling and down
scaling with FONT_WORKAROUND_SCALE*/ | | /**Returns the font ascent in Millimeters (considers upscaling and down
scaling with FONT_WORKAROUND_SCALE*/ | |
| double fontAscentMillimeters( const QFont& font ) const; | | double fontAscentMillimeters( const QFont& font ) const; | |
| | | | |
|
| /**Returns the font ascent in Millimeters (considers upscaling and down
scaling with FONT_WORKAROUND_SCALE*/ | | /**Returns the font descent in Millimeters (considers upscaling and dow
nscaling with FONT_WORKAROUND_SCALE*/ | |
| double fontDescentMillimeters( const QFont& font ) const; | | double fontDescentMillimeters( const QFont& font ) const; | |
| | | | |
|
| | | /**Returns the font height in Millimeters (considers upscaling and down | |
| | | scaling with FONT_WORKAROUND_SCALE. | |
| | | * Font height equals the font ascent+descent+1 (for baseline). | |
| | | * @note Added in version 2.4 | |
| | | */ | |
| | | double fontHeightMillimeters( const QFont& font ) const; | |
| | | | |
| /**Calculates font to from point size to pixel size*/ | | /**Calculates font to from point size to pixel size*/ | |
| double pixelFontSize( double pointSize ) const; | | double pixelFontSize( double pointSize ) const; | |
| | | | |
| /**Returns a font where size is in pixel and font size is upscaled with
FONT_WORKAROUND_SCALE*/ | | /**Returns a font where size is in pixel and font size is upscaled with
FONT_WORKAROUND_SCALE*/ | |
| QFont scaledFontPixelSize( const QFont& font ) const; | | QFont scaledFontPixelSize( const QFont& font ) const; | |
| | | | |
| /**Locks / unlocks the item position for mouse drags | | /**Locks / unlocks the item position for mouse drags | |
| @note this method was added in version 1.2*/ | | @note this method was added in version 1.2*/ | |
| void setPositionLock( bool lock ); | | void setPositionLock( bool lock ); | |
| | | | |
| /**Returns position lock for mouse drags (true means locked) | | /**Returns position lock for mouse drags (true means locked) | |
| @note this method was added in version 1.2*/ | | @note this method was added in version 1.2*/ | |
|
| bool positionLock() const {return mItemPositionLocked;} | | bool positionLock() const { return mItemPositionLocked; } | |
| | | | |
| /**Returns the rotation for the composer item | | /**Returns the rotation for the composer item | |
| @note this method was added in version 2.1*/ | | @note this method was added in version 2.1*/ | |
|
| double itemRotation() const {return mItemRotation;} | | double itemRotation() const { return mItemRotation; } | |
| | | | |
| /**Returns the rotation for the composer item | | /**Returns the rotation for the composer item | |
| * @deprecated Use itemRotation() | | * @deprecated Use itemRotation() | |
| * instead | | * instead | |
| */ | | */ | |
|
| double rotation() const {return mItemRotation;} | | Q_DECL_DEPRECATED double rotation() const { return mItemRotation; } | |
| | | | |
| /**Updates item, with the possibility to do custom update for subclasse
s*/ | | /**Updates item, with the possibility to do custom update for subclasse
s*/ | |
| virtual void updateItem() { QGraphicsRectItem::update(); } | | virtual void updateItem() { QGraphicsRectItem::update(); } | |
| | | | |
| /**Get item's id (which is not necessarly unique) | | /**Get item's id (which is not necessarly unique) | |
| @note this method was added in version 1.7*/ | | @note this method was added in version 1.7*/ | |
| QString id() const { return mId; } | | QString id() const { return mId; } | |
| | | | |
| /**Set item's id (which is not necessarly unique) | | /**Set item's id (which is not necessarly unique) | |
| @note this method was added in version 1.7*/ | | @note this method was added in version 1.7*/ | |
| virtual void setId( const QString& id ); | | virtual void setId( const QString& id ); | |
| | | | |
| /**Get item identification name | | /**Get item identification name | |
| @note this method was added in version 2.0 | | @note this method was added in version 2.0 | |
| @note there is not setter since one can't manually set the id*/ | | @note there is not setter since one can't manually set the id*/ | |
| QString uuid() const { return mUuid; } | | QString uuid() const { return mUuid; } | |
| | | | |
|
| | | /**Get the number of layers that this item requires for exporting as la | |
| | | yers | |
| | | * @returns 0 if this item is to be placed on the same layer as the pre | |
| | | vious item, | |
| | | * 1 if it should be placed on its own layer, and >1 if it requires mul | |
| | | tiple export layers | |
| | | * @note this method was added in version 2.4 | |
| | | */ | |
| | | virtual int numberExportLayers() const { return 0; } | |
| | | | |
| | | /**Sets the current layer to draw for exporting | |
| | | * @param layerIdx can be set to -1 to draw all item layers, and must b | |
| | | e less than numberExportLayers() | |
| | | * @note this method was added in version 2.4 | |
| | | */ | |
| | | virtual void setCurrentExportLayer( int layerIdx = -1 ) { mCurrentExpor | |
| | | tLayer = layerIdx; } | |
| | | | |
| public slots: | | public slots: | |
| /**Sets the item rotation | | /**Sets the item rotation | |
| * @deprecated Use setItemRotation( double rotation ) instead | | * @deprecated Use setItemRotation( double rotation ) instead | |
| */ | | */ | |
| virtual void setRotation( double r ); | | virtual void setRotation( double r ); | |
| | | | |
| /**Sets the item rotation | | /**Sets the item rotation | |
| @param r item rotation in degrees | | @param r item rotation in degrees | |
| @param adjustPosition set to true if item should be shifted so that r
otation occurs | | @param adjustPosition set to true if item should be shifted so that r
otation occurs | |
| around item center. If false, rotation occurs around item origin | | around item center. If false, rotation occurs around item origin | |
| | | | |
| skipping to change at line 385 | | skipping to change at line 462 | |
| QGraphicsRectItem* mBoundingResizeRectangle; | | QGraphicsRectItem* mBoundingResizeRectangle; | |
| QGraphicsLineItem* mHAlignSnapItem; | | QGraphicsLineItem* mHAlignSnapItem; | |
| QGraphicsLineItem* mVAlignSnapItem; | | QGraphicsLineItem* mVAlignSnapItem; | |
| | | | |
| /**True if item fram needs to be painted*/ | | /**True if item fram needs to be painted*/ | |
| bool mFrame; | | bool mFrame; | |
| /**True if item background needs to be painted*/ | | /**True if item background needs to be painted*/ | |
| bool mBackground; | | bool mBackground; | |
| /**Background color*/ | | /**Background color*/ | |
| QColor mBackgroundColor; | | QColor mBackgroundColor; | |
|
| | | /**Frame join style*/ | |
| | | Qt::PenJoinStyle mFrameJoinStyle; | |
| | | | |
| /**True if item position and size cannot be changed with mouse move | | /**True if item position and size cannot be changed with mouse move | |
| @note: this member was added in version 1.2*/ | | @note: this member was added in version 1.2*/ | |
| bool mItemPositionLocked; | | bool mItemPositionLocked; | |
| | | | |
| /**Backup to restore item appearance if no view scale factor is availab
le*/ | | /**Backup to restore item appearance if no view scale factor is availab
le*/ | |
| mutable double mLastValidViewScaleFactor; | | mutable double mLastValidViewScaleFactor; | |
| | | | |
| /**Item rotation in degrees, clockwise*/ | | /**Item rotation in degrees, clockwise*/ | |
| double mItemRotation; | | double mItemRotation; | |
| | | | |
| skipping to change at line 408 | | skipping to change at line 487 | |
| bool mEffectsEnabled; | | bool mEffectsEnabled; | |
| QgsComposerEffect *mEffect; | | QgsComposerEffect *mEffect; | |
| | | | |
| /**Item transparency*/ | | /**Item transparency*/ | |
| int mTransparency; | | int mTransparency; | |
| | | | |
| /**The item's position mode | | /**The item's position mode | |
| @note: this member was added in version 2.0*/ | | @note: this member was added in version 2.0*/ | |
| ItemPositionMode mLastUsedPositionMode; | | ItemPositionMode mLastUsedPositionMode; | |
| | | | |
|
| | | /**The layer that needs to be exported | |
| | | @note: if -1, all layers are to be exported | |
| | | @note: this member was added in version 2.4*/ | |
| | | int mCurrentExportLayer; | |
| | | | |
| /**Draw selection boxes around item*/ | | /**Draw selection boxes around item*/ | |
| virtual void drawSelectionBoxes( QPainter* p ); | | virtual void drawSelectionBoxes( QPainter* p ); | |
| | | | |
| /**Draw black frame around item*/ | | /**Draw black frame around item*/ | |
| virtual void drawFrame( QPainter* p ); | | virtual void drawFrame( QPainter* p ); | |
| | | | |
| /**Draw background*/ | | /**Draw background*/ | |
| virtual void drawBackground( QPainter* p ); | | virtual void drawBackground( QPainter* p ); | |
| | | | |
| /**Draws arrowhead*/ | | /**Draws arrowhead*/ | |
| | | | |
| skipping to change at line 444 | | skipping to change at line 528 | |
| double horizontalViewScaleFactor() const; | | double horizontalViewScaleFactor() const; | |
| | | | |
| //some utility functions | | //some utility functions | |
| | | | |
| /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation*/ | | /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation*/ | |
| bool imageSizeConsideringRotation( double& width, double& height, doubl
e rotation ) const; | | bool imageSizeConsideringRotation( double& width, double& height, doubl
e rotation ) const; | |
| /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation | | /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation | |
| * @deprecated Use bool imageSizeConsideringRotation( double& width, do
uble& height, double rotation ) | | * @deprecated Use bool imageSizeConsideringRotation( double& width, do
uble& height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| bool imageSizeConsideringRotation( double& width, double& height ) cons
t; | | Q_DECL_DEPRECATED bool imageSizeConsideringRotation( double& width, dou
ble& height ) const; | |
| | | | |
| /**Calculates the largest scaled version of originalRect which fits wit
hin boundsRect, when it is rotated by | | /**Calculates the largest scaled version of originalRect which fits wit
hin boundsRect, when it is rotated by | |
| * a specified amount | | * a specified amount | |
| @param originalRect QRectF to be rotated and scaled | | @param originalRect QRectF to be rotated and scaled | |
| @param boundsRect QRectF specifying the bounds which the rotated an
d scaled rectangle must fit within | | @param boundsRect QRectF specifying the bounds which the rotated an
d scaled rectangle must fit within | |
| @param rotation the rotation in degrees to be applied to the rectan
gle | | @param rotation the rotation in degrees to be applied to the rectan
gle | |
| */ | | */ | |
| QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boun
dsRect, double rotation ) const; | | QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boun
dsRect, double rotation ) const; | |
| | | | |
| /**Calculates corner point after rotation and scaling*/ | | /**Calculates corner point after rotation and scaling*/ | |
| bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi
dth, double height, double rotation ) const; | | bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi
dth, double height, double rotation ) const; | |
| /**Calculates corner point after rotation and scaling | | /**Calculates corner point after rotation and scaling | |
| * @deprecated Use bool cornerPointOnRotatedAndScaledRect( double& x, d
ouble& y, double width, double height, double rotation ) | | * @deprecated Use bool cornerPointOnRotatedAndScaledRect( double& x, d
ouble& y, double width, double height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi
dth, double height ) const; | | Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect( double& x, do
uble& y, double width, double height ) const; | |
| | | | |
| /**Calculates width / height of the bounding box of a rotated rectangle
*/ | | /**Calculates width / height of the bounding box of a rotated rectangle
*/ | |
| void sizeChangedByRotation( double& width, double& height, double rotat
ion ); | | void sizeChangedByRotation( double& width, double& height, double rotat
ion ); | |
| /**Calculates width / height of the bounding box of a rotated rectangle | | /**Calculates width / height of the bounding box of a rotated rectangle | |
| * @deprecated Use void sizeChangedByRotation( double& width, double& he
ight, double rotation ) | | * @deprecated Use void sizeChangedByRotation( double& width, double& he
ight, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| void sizeChangedByRotation( double& width, double& height ); | | Q_DECL_DEPRECATED void sizeChangedByRotation( double& width, double& he
ight ); | |
| | | | |
| /**Rotates a point / vector | | /**Rotates a point / vector | |
| @param angle rotation angle in degrees, counterclockwise | | @param angle rotation angle in degrees, counterclockwise | |
| @param x in/out: x coordinate before / after the rotation | | @param x in/out: x coordinate before / after the rotation | |
| @param y in/out: y cooreinate before / after the rotation*/ | | @param y in/out: y cooreinate before / after the rotation*/ | |
| void rotate( double angle, double& x, double& y ) const; | | void rotate( double angle, double& x, double& y ) const; | |
| | | | |
| /**Return horizontal align snap item. Creates a new graphics line if 0*
/ | | /**Return horizontal align snap item. Creates a new graphics line if 0*
/ | |
| QGraphicsLineItem* hAlignSnapItem(); | | QGraphicsLineItem* hAlignSnapItem(); | |
| void deleteHAlignSnapItem(); | | void deleteHAlignSnapItem(); | |
| | | | |
End of changes. 22 change blocks. |
| 19 lines changed or deleted | | 110 lines changed or added | |
|
| qgscomposermap.h | | qgscomposermap.h | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 95 | |
| enum GridAnnotationFormat | | enum GridAnnotationFormat | |
| { | | { | |
| Decimal = 0, | | Decimal = 0, | |
| DegreeMinute, | | DegreeMinute, | |
| DegreeMinuteSecond | | DegreeMinuteSecond | |
| }; | | }; | |
| | | | |
| enum GridFrameStyle | | enum GridFrameStyle | |
| { | | { | |
| NoGridFrame = 0, | | NoGridFrame = 0, | |
|
| Zebra //black / white pattern | | Zebra // black/white pattern | |
| }; | | }; | |
| | | | |
| /**Enum for different frame borders*/ | | /**Enum for different frame borders*/ | |
| enum Border | | enum Border | |
| { | | { | |
| Left, | | Left, | |
| Right, | | Right, | |
| Bottom, | | Bottom, | |
| Top | | Top | |
| }; | | }; | |
| | | | |
|
| | | /** Scaling modes used for the serial rendering (atlas) | |
| | | */ | |
| | | enum AtlasScalingMode | |
| | | { | |
| | | Fixed, /*< The current scale of the map is used for each feature | |
| | | of the atlas */ | |
| | | Predefined, /*< A scale is chosen from the predefined scales. The sma | |
| | | llest scale from | |
| | | the list of scales where the atlas feature is fully vis | |
| | | ible is chosen. | |
| | | @see QgsAtlasComposition::setPredefinedScales. | |
| | | @note This mode is only valid for polygon or line atlas | |
| | | coverage layers | |
| | | */ | |
| | | Auto /*< The extent is adjusted so that each feature is fully | |
| | | visible. | |
| | | A margin is applied around the center @see setAtlasMarg | |
| | | in | |
| | | @note This mode is only valid for polygon or line atlas | |
| | | coverage layers*/ | |
| | | }; | |
| | | | |
| /** \brief Draw to paint device | | /** \brief Draw to paint device | |
| @param painter painter | | @param painter painter | |
| @param extent map extent | | @param extent map extent | |
| @param size size in scene coordinates | | @param size size in scene coordinates | |
| @param dpi scene dpi | | @param dpi scene dpi | |
| @param forceWidthScale force wysiwyg line widths / marker sizes | | @param forceWidthScale force wysiwyg line widths / marker sizes | |
| */ | | */ | |
| void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF&
size, double dpi, double* forceWidthScale = 0 ); | | void draw( QPainter *painter, const QgsRectangle& extent, const QSizeF&
size, double dpi, double* forceWidthScale = 0 ); | |
| | | | |
| /** \brief Reimplementation of QCanvasItem::paint - draw on canvas */ | | /** \brief Reimplementation of QCanvasItem::paint - draw on canvas */ | |
| | | | |
| skipping to change at line 163 | | skipping to change at line 178 | |
| | | | |
| /**Sets new Extent for the current atlas preview and changes width, hei
ght (and implicitely also scale). | | /**Sets new Extent for the current atlas preview and changes width, hei
ght (and implicitely also scale). | |
| Atlas preview extents are only temporary, and are regenerated wheneve
r the atlas feature changes | | Atlas preview extents are only temporary, and are regenerated wheneve
r the atlas feature changes | |
| */ | | */ | |
| void setNewAtlasFeatureExtent( const QgsRectangle& extent ); | | void setNewAtlasFeatureExtent( const QgsRectangle& extent ); | |
| | | | |
| /**Called when atlas preview is toggled, to force map item to update it
s extent and redraw*/ | | /**Called when atlas preview is toggled, to force map item to update it
s extent and redraw*/ | |
| void toggleAtlasPreview(); | | void toggleAtlasPreview(); | |
| | | | |
| /**Returns a pointer to the current map extent, which is either the ori
ginal user specified | | /**Returns a pointer to the current map extent, which is either the ori
ginal user specified | |
|
| extent or the temporary atlas-driven feature extent depending on the | | * extent or the temporary atlas-driven feature extent depending on the | |
| current atlas state of the composition. | | current atlas state | |
| Both a const and non-const version are included.*/ | | * of the composition. Both a const and non-const version are included. | |
| | | * @returns pointer to current map extent | |
| | | * @see visibleExtentPolygon | |
| | | */ | |
| QgsRectangle* currentMapExtent(); | | QgsRectangle* currentMapExtent(); | |
| const QgsRectangle* currentMapExtent() const; | | const QgsRectangle* currentMapExtent() const; | |
| | | | |
| PreviewMode previewMode() const {return mPreviewMode;} | | PreviewMode previewMode() const {return mPreviewMode;} | |
| void setPreviewMode( PreviewMode m ); | | void setPreviewMode( PreviewMode m ); | |
| | | | |
| /**Getter for flag that determines if the stored layer set should be us
ed or the current layer set of the qgis mapcanvas | | /**Getter for flag that determines if the stored layer set should be us
ed or the current layer set of the qgis mapcanvas | |
| @note this function was added in version 1.2*/ | | @note this function was added in version 1.2*/ | |
| bool keepLayerSet() const {return mKeepLayerSet;} | | bool keepLayerSet() const {return mKeepLayerSet;} | |
| /**Setter for flag that determines if the stored layer set should be us
ed or the current layer set of the qgis mapcanvas | | /**Setter for flag that determines if the stored layer set should be us
ed or the current layer set of the qgis mapcanvas | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 210 | |
| @note this function was added in version 1.2*/ | | @note this function was added in version 1.2*/ | |
| void setLayerSet( const QStringList& layerSet ) {mLayerSet = layerSet;} | | void setLayerSet( const QStringList& layerSet ) {mLayerSet = layerSet;} | |
| /**Stores the current layer set of the qgis mapcanvas in mLayerSet*/ | | /**Stores the current layer set of the qgis mapcanvas in mLayerSet*/ | |
| void storeCurrentLayerSet(); | | void storeCurrentLayerSet(); | |
| | | | |
| // Set cache outdated | | // Set cache outdated | |
| void setCacheUpdated( bool u = false ); | | void setCacheUpdated( bool u = false ); | |
| | | | |
| QgsRectangle extent() const {return mExtent;} | | QgsRectangle extent() const {return mExtent;} | |
| | | | |
|
| const QgsMapRenderer* mapRenderer() const {return mMapRenderer;} | | //! @deprecated since 2.4 - use mapSettings() - may return 0 if not ini | |
| | | tialized with QgsMapRenderer | |
| | | Q_DECL_DEPRECATED const QgsMapRenderer* mapRenderer() const; | |
| | | | |
| /**Sets offset values to shift image (useful for live updates when movi
ng item content)*/ | | /**Sets offset values to shift image (useful for live updates when movi
ng item content)*/ | |
| void setOffset( double xOffset, double yOffset ); | | void setOffset( double xOffset, double yOffset ); | |
| | | | |
| /**True if composer map renders a WMS layer*/ | | /**True if composer map renders a WMS layer*/ | |
| bool containsWMSLayer() const; | | bool containsWMSLayer() const; | |
| | | | |
| /**True if composer map contains layers with blend modes or flattened l
ayers for vectors */ | | /**True if composer map contains layers with blend modes or flattened l
ayers for vectors */ | |
| bool containsAdvancedEffects() const; | | bool containsAdvancedEffects() const; | |
| | | | |
| | | | |
| skipping to change at line 349 | | skipping to change at line 368 | |
| | | | |
| /**Sets length of the cros segments (if grid style is cross) | | /**Sets length of the cros segments (if grid style is cross) | |
| @note this function was added in version 1.4*/ | | @note this function was added in version 1.4*/ | |
| void setCrossLength( double l ) {mCrossLength = l;} | | void setCrossLength( double l ) {mCrossLength = l;} | |
| double crossLength() {return mCrossLength;} | | double crossLength() {return mCrossLength;} | |
| | | | |
| /**Sets rotation for the map - this does not affect the composer item s
hape, only the | | /**Sets rotation for the map - this does not affect the composer item s
hape, only the | |
| way the map is drawn within the item | | way the map is drawn within the item | |
| * @deprecated Use setMapRotation( double rotation ) instead | | * @deprecated Use setMapRotation( double rotation ) instead | |
| */ | | */ | |
|
| void setRotation( double r ); | | Q_DECL_DEPRECATED void setRotation( double r ); | |
| | | | |
| /**Returns the rotation used for drawing the map within the composer it
em | | /**Returns the rotation used for drawing the map within the composer it
em | |
| * @deprecated Use mapRotation() instead | | * @deprecated Use mapRotation() instead | |
| */ | | */ | |
|
| double rotation() const { return mMapRotation;}; | | Q_DECL_DEPRECATED double rotation() const { return mMapRotation;}; | |
| | | | |
| /**Sets rotation for the map - this does not affect the composer item s
hape, only the | | /**Sets rotation for the map - this does not affect the composer item s
hape, only the | |
| way the map is drawn within the item | | way the map is drawn within the item | |
| @note this function was added in version 2.1*/ | | @note this function was added in version 2.1*/ | |
| void setMapRotation( double r ); | | void setMapRotation( double r ); | |
| /**Returns the rotation used for drawing the map within the composer it
em*/ | | /**Returns the rotation used for drawing the map within the composer it
em*/ | |
| double mapRotation() const { return mMapRotation;}; | | double mapRotation() const { return mMapRotation;}; | |
| | | | |
| void updateItem(); | | void updateItem(); | |
| | | | |
| | | | |
| skipping to change at line 414 | | skipping to change at line 434 | |
| void setGridBlendMode( QPainter::CompositionMode blendMode ); | | void setGridBlendMode( QPainter::CompositionMode blendMode ); | |
| | | | |
| /**Sets mId to a number not yet used in the composition. mId is kept if
it is not in use. | | /**Sets mId to a number not yet used in the composition. mId is kept if
it is not in use. | |
| Usually, this function is called before adding the composer map to
the composition*/ | | Usually, this function is called before adding the composer map to
the composition*/ | |
| void assignFreeId(); | | void assignFreeId(); | |
| | | | |
| /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation | | /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation | |
| * @deprecated Use bool QgsComposerItem::imageSizeConsideringRotation(
double& width, double& height, double rotation ) | | * @deprecated Use bool QgsComposerItem::imageSizeConsideringRotation(
double& width, double& height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| bool imageSizeConsideringRotation( double& width, double& height ) cons
t; | | Q_DECL_DEPRECATED bool imageSizeConsideringRotation( double& width, dou
ble& height ) const; | |
| /**Calculates corner point after rotation and scaling | | /**Calculates corner point after rotation and scaling | |
| * @deprecated Use QgsComposerItem::cornerPointOnRotatedAndScaledRect(
double& x, double& y, double width, double height, double rotation ) | | * @deprecated Use QgsComposerItem::cornerPointOnRotatedAndScaledRect(
double& x, double& y, double width, double height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi
dth, double height ) const; | | Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect( double& x, do
uble& y, double width, double height ) const; | |
| /**Calculates width / height of the bounding box of a rotated rectangle | | /**Calculates width / height of the bounding box of a rotated rectangle | |
| * @deprecated Use QgsComposerItem::sizeChangedByRotation( double& width
, double& height, double rotation ) | | * @deprecated Use QgsComposerItem::sizeChangedByRotation( double& width
, double& height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| void sizeChangedByRotation( double& width, double& height ); | | Q_DECL_DEPRECATED void sizeChangedByRotation( double& width, double& he
ight ); | |
| | | | |
|
| /** Returns true if the map extent is set to follow the current atlas f | | /**Returns whether the map extent is set to follow the current atlas fe | |
| eature */ | | ature. | |
| | | * @returns true if map will follow the current atlas feature. | |
| | | * @see setAtlasDriven | |
| | | * @see atlasScalingMode | |
| | | */ | |
| bool atlasDriven() const { return mAtlasDriven; } | | bool atlasDriven() const { return mAtlasDriven; } | |
|
| /** Set to true if the map extents should be set by the current atlas f | | | |
| eature */ | | /**Sets whether the map extent will follow the current atlas feature. | |
| | | * @param enabled set to true if the map extents should be set by the c | |
| | | urrent atlas feature. | |
| | | * @see atlasDriven | |
| | | * @see setAtlasScalingMode | |
| | | */ | |
| void setAtlasDriven( bool enabled ) { mAtlasDriven = enabled; } | | void setAtlasDriven( bool enabled ) { mAtlasDriven = enabled; } | |
| | | | |
|
| /** Returns true if the map uses a fixed scale when in atlas mode */ | | /**Returns true if the map uses a fixed scale when in atlas mode | |
| bool atlasFixedScale() const { return mAtlasFixedScale; } | | * @deprecated since 2.4 Use atlasScalingMode() instead | |
| /** Set to true if the map should use a fixed scale when in atlas mode | | */ | |
| */ | | Q_DECL_DEPRECATED bool atlasFixedScale() const; | |
| void setAtlasFixedScale( bool fixed ) { mAtlasFixedScale = fixed; } | | | |
| | | /**Set to true if the map should use a fixed scale when in atlas mode | |
| | | * @deprecated since 2.4 Use setAtlasScalingMode() instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED void setAtlasFixedScale( bool fixed ); | |
| | | | |
| | | /**Returns the current atlas scaling mode. This controls how the map's | |
| | | extents | |
| | | * are calculated for the current atlas feature when an atlas compositi | |
| | | on | |
| | | * is enabled. | |
| | | * @returns the current scaling mode | |
| | | * @note this parameter is only used if atlasDriven() is true | |
| | | * @see setAtlasScalingMode | |
| | | * @see atlasDriven | |
| | | */ | |
| | | AtlasScalingMode atlasScalingMode() const { return mAtlasScalingMode; } | |
| | | | |
| | | /**Sets the current atlas scaling mode. This controls how the map's ext | |
| | | ents | |
| | | * are calculated for the current atlas feature when an atlas compositi | |
| | | on | |
| | | * is enabled. | |
| | | * @param mode atlas scaling mode to set | |
| | | * @note this parameter is only used if atlasDriven() is true | |
| | | * @see atlasScalingMode | |
| | | * @see atlasDriven | |
| | | */ | |
| | | void setAtlasScalingMode( AtlasScalingMode mode ) { mAtlasScalingMode = | |
| | | mode; } | |
| | | | |
|
| /** Returns the margin size (percentage) used when the map is in atlas | | /**Returns the margin size (percentage) used when the map is in atlas m | |
| mode */ | | ode. | |
| | | * @returns margin size in percentage to leave around the atlas feature | |
| | | 's extent | |
| | | * @note this is only used if atlasScalingMode() is Auto. | |
| | | * @see atlasScalingMode | |
| | | * @see setAtlasMargin | |
| | | */ | |
| double atlasMargin() const { return mAtlasMargin; } | | double atlasMargin() const { return mAtlasMargin; } | |
|
| /** Sets the margin size (percentage) used when the map is in atlas mod | | | |
| e */ | | /**Sets the margin size (percentage) used when the map is in atlas mode | |
| | | . | |
| | | * @param margin size in percentage to leave around the atlas feature's | |
| | | extent | |
| | | * @note this is only used if atlasScalingMode() is Auto. | |
| | | * @see atlasScalingMode | |
| | | * @see atlasMargin | |
| | | */ | |
| void setAtlasMargin( double margin ) { mAtlasMargin = margin; } | | void setAtlasMargin( double margin ) { mAtlasMargin = margin; } | |
| | | | |
|
| | | /** Sets whether updates to the composer map are enabled. */ | |
| | | void setUpdatesEnabled( bool enabled ) { mUpdatesEnabled = enabled; } | |
| | | | |
| | | /** Returns whether updates to the composer map are enabled. */ | |
| | | bool updatesEnabled() const { return mUpdatesEnabled; } | |
| | | | |
| | | /**Get the number of layers that this item requires for exporting as la | |
| | | yers | |
| | | * @returns 0 if this item is to be placed on the same layer as the pre | |
| | | vious item, | |
| | | * 1 if it should be placed on its own layer, and >1 if it requires mul | |
| | | tiple export layers | |
| | | * @note this method was added in version 2.4 | |
| | | */ | |
| | | int numberExportLayers() const; | |
| | | | |
| | | /**Returns a polygon representing the current visible map extent, consi | |
| | | dering map extents and rotation. | |
| | | * If the map rotation is 0, the result is the same as currentMapExtent | |
| | | * @returns polygon with the four corner points representing the visibl | |
| | | e map extent. The points are | |
| | | * clockwise, starting at the top-left point | |
| | | * @see currentMapExtent | |
| | | */ | |
| | | QPolygonF visibleExtentPolygon() const; | |
| | | | |
| signals: | | signals: | |
| void extentChanged(); | | void extentChanged(); | |
| | | | |
| /**Is emitted on rotation change to notify north arrow pictures*/ | | /**Is emitted on rotation change to notify north arrow pictures*/ | |
| void mapRotationChanged( double newRotation ); | | void mapRotationChanged( double newRotation ); | |
| | | | |
|
| | | /**Is emitted when the map has been prepared for atlas rendering, just | |
| | | before actual rendering*/ | |
| | | void preparedForAtlas(); | |
| | | | |
| public slots: | | public slots: | |
| | | | |
| /**Called if map canvas has changed*/ | | /**Called if map canvas has changed*/ | |
| void updateCachedImage( ); | | void updateCachedImage( ); | |
| /**Call updateCachedImage if item is in render mode*/ | | /**Call updateCachedImage if item is in render mode*/ | |
| void renderModeUpdateCachedImage(); | | void renderModeUpdateCachedImage(); | |
| | | | |
| void overviewExtentChanged(); | | void overviewExtentChanged(); | |
| | | | |
| private: | | private: | |
| | | | |
| enum AnnotationCoordinate | | enum AnnotationCoordinate | |
| { | | { | |
| Longitude = 0, | | Longitude = 0, | |
| Latitude | | Latitude | |
| }; | | }; | |
| | | | |
|
| // Pointer to map renderer of the QGIS main map. Note that QgsComposerM | | | |
| ap uses a different map renderer, | | | |
| //it just copies some properties from the main map renderer. | | | |
| QgsMapRenderer *mMapRenderer; | | | |
| | | | |
| /**Unique identifier*/ | | /**Unique identifier*/ | |
| int mId; | | int mId; | |
| | | | |
| // Map region in map units realy used for rendering | | // Map region in map units realy used for rendering | |
| // It can be the same as mUserExtent, but it can be bigger in on dimens
ion if mCalculate==Scale, | | // It can be the same as mUserExtent, but it can be bigger in on dimens
ion if mCalculate==Scale, | |
| // so that full rectangle in paper is used. | | // so that full rectangle in paper is used. | |
| QgsRectangle mExtent; | | QgsRectangle mExtent; | |
| | | | |
| // Current temporary map region in map units. This is overwritten when
atlas feature changes. It's also | | // Current temporary map region in map units. This is overwritten when
atlas feature changes. It's also | |
| // used when the user changes the map extent and an atlas preview is en
abled. This allows the user | | // used when the user changes the map extent and an atlas preview is en
abled. This allows the user | |
| | | | |
| skipping to change at line 521 | | skipping to change at line 606 | |
| int mOverviewFrameMapId; | | int mOverviewFrameMapId; | |
| /**Drawing style for overview farme*/ | | /**Drawing style for overview farme*/ | |
| QgsFillSymbolV2* mOverviewFrameMapSymbol; | | QgsFillSymbolV2* mOverviewFrameMapSymbol; | |
| QgsLineSymbolV2* mGridLineSymbol; | | QgsLineSymbolV2* mGridLineSymbol; | |
| /**Blend mode for overview*/ | | /**Blend mode for overview*/ | |
| QPainter::CompositionMode mOverviewBlendMode; | | QPainter::CompositionMode mOverviewBlendMode; | |
| bool mOverviewInverted; | | bool mOverviewInverted; | |
| /** Centering mode for overview */ | | /** Centering mode for overview */ | |
| bool mOverviewCentered; | | bool mOverviewCentered; | |
| | | | |
|
| | | /** Whether updates to the map are enabled */ | |
| | | bool mUpdatesEnabled; | |
| | | | |
| /**Establishes signal/slot connection for update in case of layer chang
e*/ | | /**Establishes signal/slot connection for update in case of layer chang
e*/ | |
| void connectUpdateSlot(); | | void connectUpdateSlot(); | |
| | | | |
| /**Removes layer ids from mLayerSet that are no longer present in the q
gis main map*/ | | /**Removes layer ids from mLayerSet that are no longer present in the q
gis main map*/ | |
| void syncLayerSet(); | | void syncLayerSet(); | |
| | | | |
| /**True if coordinate grid has to be displayed*/ | | /**True if coordinate grid has to be displayed*/ | |
| bool mGridEnabled; | | bool mGridEnabled; | |
| /**Solid or crosses*/ | | /**Solid or crosses*/ | |
| GridStyle mGridStyle; | | GridStyle mGridStyle; | |
| | | | |
| skipping to change at line 594 | | skipping to change at line 682 | |
| QGraphicsView* mMapCanvas; | | QGraphicsView* mMapCanvas; | |
| /**True if annotation items, rubber band, etc. from the main canvas sho
uld be displayed*/ | | /**True if annotation items, rubber band, etc. from the main canvas sho
uld be displayed*/ | |
| bool mDrawCanvasItems; | | bool mDrawCanvasItems; | |
| | | | |
| /**Adjusts an extent rectangle to match the provided item width and hei
ght, so that extent | | /**Adjusts an extent rectangle to match the provided item width and hei
ght, so that extent | |
| * center of extent remains the same */ | | * center of extent remains the same */ | |
| void adjustExtentToItemShape( double itemWidth, double itemHeight, QgsR
ectangle& extent ) const; | | void adjustExtentToItemShape( double itemWidth, double itemHeight, QgsR
ectangle& extent ) const; | |
| | | | |
| /**True if map is being controlled by an atlas*/ | | /**True if map is being controlled by an atlas*/ | |
| bool mAtlasDriven; | | bool mAtlasDriven; | |
|
| /**True if map uses a fixed scale when controlled by an atlas*/ | | /**Current atlas scaling mode*/ | |
| bool mAtlasFixedScale; | | AtlasScalingMode mAtlasScalingMode; | |
| /**Margin size for atlas driven extents (percentage of feature size)*/ | | /**Margin size for atlas driven extents (percentage of feature size) - | |
| | | when in auto scaling mode*/ | |
| double mAtlasMargin; | | double mAtlasMargin; | |
| | | | |
| /**Returns a list of the layers to render for this map item*/ | | /**Returns a list of the layers to render for this map item*/ | |
|
| QStringList layersToRender(); | | QStringList layersToRender() const; | |
| | | | |
| /**Draws the map grid*/ | | /**Draws the map grid*/ | |
| void drawGrid( QPainter* p ); | | void drawGrid( QPainter* p ); | |
| void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >
& hLines, const QList< QPair< double, QLineF > >& vLines ); | | void drawGridFrame( QPainter* p, const QList< QPair< double, QLineF > >
& hLines, const QList< QPair< double, QLineF > >& vLines ); | |
| /**Draw coordinates for mGridAnnotationType Coordinate | | /**Draw coordinates for mGridAnnotationType Coordinate | |
| @param p drawing painter | | @param p drawing painter | |
| @param hLines horizontal coordinate lines in item coordinates | | @param hLines horizontal coordinate lines in item coordinates | |
| @param vLines vertical coordinate lines in item coordinates*/ | | @param vLines vertical coordinate lines in item coordinates*/ | |
| void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double
, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ); | | void drawCoordinateAnnotations( QPainter* p, const QList< QPair< double
, QLineF > >& hLines, const QList< QPair< double, QLineF > >& vLines ); | |
| void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString
annotationString ); | | void drawCoordinateAnnotation( QPainter* p, const QPointF& pos, QString
annotationString ); | |
| | | | |
| skipping to change at line 629 | | skipping to change at line 717 | |
| @return 0 in case of success*/ | | @return 0 in case of success*/ | |
| int xGridLines( QList< QPair< double, QLineF > >& lines ) const; | | int xGridLines( QList< QPair< double, QLineF > >& lines ) const; | |
| /**Returns the grid lines for the y-coordinates. Not vertical in case o
f rotation | | /**Returns the grid lines for the y-coordinates. Not vertical in case o
f rotation | |
| @return 0 in case of success*/ | | @return 0 in case of success*/ | |
| int yGridLines( QList< QPair< double, QLineF > >& lines ) const; | | int yGridLines( QList< QPair< double, QLineF > >& lines ) const; | |
| /**Returns extent that considers mOffsetX / mOffsetY (during content mo
ve)*/ | | /**Returns extent that considers mOffsetX / mOffsetY (during content mo
ve)*/ | |
| QgsRectangle transformedExtent() const; | | QgsRectangle transformedExtent() const; | |
| /**Returns extent that considers rotation and shift with mOffsetX / mOf
fsetY*/ | | /**Returns extent that considers rotation and shift with mOffsetX / mOf
fsetY*/ | |
| QPolygonF transformedMapPolygon() const; | | QPolygonF transformedMapPolygon() const; | |
| double maxExtension() const; | | double maxExtension() const; | |
|
| /**Returns the polygon of the map extent. If rotation == 0, the result | | | |
| is the same as mExtent | | | |
| @param poly out: the result polygon with the four corner points. The po | | | |
| ints are clockwise, starting at the top-left point | | | |
| @return true in case of success*/ | | | |
| void mapPolygon( QPolygonF& poly ) const; | | | |
| /** mapPolygon variant using a given extent */ | | /** mapPolygon variant using a given extent */ | |
| void mapPolygon( const QgsRectangle& extent, QPolygonF& poly ) const; | | void mapPolygon( const QgsRectangle& extent, QPolygonF& poly ) const; | |
| | | | |
| /**Calculates the extent to request and the yShift of the top-left poin
t in case of rotation.*/ | | /**Calculates the extent to request and the yShift of the top-left poin
t in case of rotation.*/ | |
| void requestedExtent( QgsRectangle& extent ) const; | | void requestedExtent( QgsRectangle& extent ) const; | |
| /**Scales a composer map shift (in MM) and rotates it by mRotation | | /**Scales a composer map shift (in MM) and rotates it by mRotation | |
| @param xShift in: shift in x direction (in item units), out: xShift
in map units | | @param xShift in: shift in x direction (in item units), out: xShift
in map units | |
| @param yShift in: shift in y direction (in item units), out: yShift
in map units*/ | | @param yShift in: shift in y direction (in item units), out: yShift
in map units*/ | |
| void transformShift( double& xShift, double& yShift ) const; | | void transformShift( double& xShift, double& yShift ) const; | |
| /**Transforms map coordinates to item coordinates (considering rotation
and move offset)*/ | | /**Transforms map coordinates to item coordinates (considering rotation
and move offset)*/ | |
| QPointF mapToItemCoords( const QPointF& mapCoords ) const; | | QPointF mapToItemCoords( const QPointF& mapCoords ) const; | |
| /**Returns the item border of a point (in item coordinates)*/ | | /**Returns the item border of a point (in item coordinates)*/ | |
| Border borderForLineCoord( const QPointF& p ) const; | | Border borderForLineCoord( const QPointF& p ) const; | |
| | | | |
| void drawCanvasItems( QPainter* painter, const QStyleOptionGraphicsItem
* itemStyle ); | | void drawCanvasItems( QPainter* painter, const QStyleOptionGraphicsItem
* itemStyle ); | |
| void drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QSty
leOptionGraphicsItem* itemStyle ); | | void drawCanvasItem( QGraphicsItem* item, QPainter* painter, const QSty
leOptionGraphicsItem* itemStyle ); | |
| QPointF composerMapPosForItem( const QGraphicsItem* item ) const; | | QPointF composerMapPosForItem( const QGraphicsItem* item ) const; | |
| void sortGridLinesOnBorders( const QList< QPair< double, QLineF > >& hL
ines, const QList< QPair< double, QLineF > >& vLines, QMap< double, double
>& leftFrameEntries, | | void sortGridLinesOnBorders( const QList< QPair< double, QLineF > >& hL
ines, const QList< QPair< double, QLineF > >& vLines, QMap< double, double
>& leftFrameEntries, | |
| QMap< double, double >& rightFrameEntries,
QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFra
meEntries ) const; | | QMap< double, double >& rightFrameEntries,
QMap< double, double >& topFrameEntries, QMap< double, double >& bottomFra
meEntries ) const; | |
| void drawGridFrameBorder( QPainter* p, const QMap< double, double >& bo
rderPos, Border border ); | | void drawGridFrameBorder( QPainter* p, const QMap< double, double >& bo
rderPos, Border border ); | |
|
| void drawGridLine( const QLineF& line, QPainter* p ); | | void drawGridLine( const QLineF& line, QgsRenderContext& context ); | |
| void drawOverviewMapExtent( QPainter* p ); | | void drawOverviewMapExtent( QPainter* p ); | |
| void createDefaultOverviewFrameSymbol(); | | void createDefaultOverviewFrameSymbol(); | |
| void createDefaultGridLineSymbol(); | | void createDefaultGridLineSymbol(); | |
| void initGridAnnotationFormatFromProject(); | | void initGridAnnotationFormatFromProject(); | |
| | | | |
|
| | | enum PartType | |
| | | { | |
| | | Background, | |
| | | Layer, | |
| | | Grid, | |
| | | OverviewMapExtent, | |
| | | Frame, | |
| | | SelectionBoxes | |
| | | }; | |
| | | | |
| | | /**Test if a part of the copmosermap needs to be drawn, considering mCu | |
| | | rrentExportLayer*/ | |
| | | bool shouldDrawPart( PartType part ) const; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 23 change blocks. |
| 39 lines changed or deleted | | 155 lines changed or added | |
|
| qgscomposerpicture.h | | qgscomposerpicture.h | |
| | | | |
| skipping to change at line 26 | | skipping to change at line 26 | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| #ifndef QGSCOMPOSERPICTURE_H | | #ifndef QGSCOMPOSERPICTURE_H | |
| #define QGSCOMPOSERPICTURE_H | | #define QGSCOMPOSERPICTURE_H | |
| | | | |
| #include "qgscomposeritem.h" | | #include "qgscomposeritem.h" | |
| #include <QFile> | | #include <QFile> | |
| #include <QImage> | | #include <QImage> | |
| #include <QSvgRenderer> | | #include <QSvgRenderer> | |
| | | | |
| class QgsComposerMap; | | class QgsComposerMap; | |
|
| | | class QgsExpression; | |
| | | | |
| /** \ingroup MapComposer | | /** \ingroup MapComposer | |
| * A composer class that displays svg files or raster format (jpg, png, ...
) | | * A composer class that displays svg files or raster format (jpg, png, ...
) | |
| * */ | | * */ | |
| class CORE_EXPORT QgsComposerPicture: public QgsComposerItem | | class CORE_EXPORT QgsComposerPicture: public QgsComposerItem | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
|
| | | | |
| | | /*! Controls how pictures are scaled within the item's frame | |
| | | */ | |
| | | enum ResizeMode | |
| | | { | |
| | | Zoom, /*!< enlarges image to fit frame while maintaining aspect ratio | |
| | | of picture */ | |
| | | Stretch, /*!< stretches image to fit frame, ignores aspect ratio */ | |
| | | Clip, /*!< draws image at original size and clips any portion which f | |
| | | alls outside frame */ | |
| | | ZoomResizeFrame, /*!< enlarges image to fit frame, then resizes frame | |
| | | to fit resultant image */ | |
| | | FrameToImageSize /*!< sets size of frame to match original size of im | |
| | | age without scaling */ | |
| | | }; | |
| | | | |
| | | /*! Format of source image | |
| | | */ | |
| | | enum Mode | |
| | | { | |
| | | SVG, | |
| | | RASTER, | |
| | | Unknown | |
| | | }; | |
| | | | |
| QgsComposerPicture( QgsComposition *composition ); | | QgsComposerPicture( QgsComposition *composition ); | |
| ~QgsComposerPicture(); | | ~QgsComposerPicture(); | |
| | | | |
| /** return correct graphics item type. Added in v1.7 */ | | /** return correct graphics item type. Added in v1.7 */ | |
| virtual int type() const { return ComposerPicture; } | | virtual int type() const { return ComposerPicture; } | |
| | | | |
| /**Reimplementation of QCanvasItem::paint*/ | | /**Reimplementation of QCanvasItem::paint*/ | |
| void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl
e, QWidget* pWidget ); | | void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyl
e, QWidget* pWidget ); | |
| | | | |
|
| /**Sets the source file of the image (may be svg or a raster format)*/ | | /**Sets the source file of the image (may be svg or a raster format). T | |
| | | his is only used if | |
| | | * usePictureExpression() is false. | |
| | | * @param path full path to the source image | |
| | | * @see usePictureExpression | |
| | | * @see pictureFile | |
| | | */ | |
| void setPictureFile( const QString& path ); | | void setPictureFile( const QString& path ); | |
|
| | | | |
| | | /**Returns the path of the source image file. This is only used if | |
| | | * usePictureExpression() is false. | |
| | | * @returns path to the source image | |
| | | * @see usePictureExpression | |
| | | * @see setPictureFile | |
| | | */ | |
| QString pictureFile() const; | | QString pictureFile() const; | |
| | | | |
| /**Sets this items bound in scene coordinates such that 1 item size uni
ts | | /**Sets this items bound in scene coordinates such that 1 item size uni
ts | |
| corresponds to 1 scene size unit and resizes the svg symbol / image*
/ | | corresponds to 1 scene size unit and resizes the svg symbol / image*
/ | |
| void setSceneRect( const QRectF& rectangle ); | | void setSceneRect( const QRectF& rectangle ); | |
| | | | |
| /** stores state in Dom element | | /** stores state in Dom element | |
| * @param elem is Dom element corresponding to 'Composer' tag | | * @param elem is Dom element corresponding to 'Composer' tag | |
| * @param doc is Dom document | | * @param doc is Dom document | |
| */ | | */ | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 100 | |
| | | | |
| /** sets state from Dom document | | /** sets state from Dom document | |
| * @param itemElem is Dom node corresponding to item tag | | * @param itemElem is Dom node corresponding to item tag | |
| * @param doc is Dom document | | * @param doc is Dom document | |
| */ | | */ | |
| bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | | bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); | |
| | | | |
| /**Returns the rotation used for drawing the picture within the compose
r item | | /**Returns the rotation used for drawing the picture within the compose
r item | |
| * @deprecated Use pictureRotation() instead | | * @deprecated Use pictureRotation() instead | |
| */ | | */ | |
|
| double rotation() const { return mPictureRotation;}; | | Q_DECL_DEPRECATED double rotation() const { return mPictureRotation; } | |
| | | | |
|
| /**Returns the rotation used for drawing the picture within the item | | /**Returns the rotation used for drawing the picture within the item's | |
| @note this function was added in version 2.1*/ | | frame | |
| double pictureRotation() const { return mPictureRotation;}; | | * @returns picture rotation in degrees | |
| | | * @note added in 2.2 | |
| | | * @see setPictureRotation | |
| | | * @see rotationMap | |
| | | */ | |
| | | double pictureRotation() const { return mPictureRotation; } | |
| | | | |
|
| /**Sets the map object for rotation (by id). A value of -1 disables the | | /**Sets the map object for rotation (by id). A value of -1 disables the | |
| map rotation*/ | | map | |
| | | * rotation. If this is set then the picture will be rotated by the sa | |
| | | me | |
| | | * amount as the specified map object. This is useful especially for | |
| | | * syncing north arrows with a map item. | |
| | | * @param composerMapId composer map id to sync rotation with | |
| | | * @see setPictureRotation | |
| | | * @see rotationMap | |
| | | */ | |
| void setRotationMap( int composerMapId ); | | void setRotationMap( int composerMapId ); | |
|
| /**Returns the id of the rotation map*/ | | | |
| | | /**Returns the id of the rotation map. A value of -1 means map rotatio | |
| | | n is | |
| | | * disabled. If this is set then the picture is rotated by the same am | |
| | | ount | |
| | | * as the specified map object. | |
| | | * @returns id of map object | |
| | | * @see setRotationMap | |
| | | * @see useRotationMap | |
| | | */ | |
| int rotationMap() const; | | int rotationMap() const; | |
|
| /**True if the rotation is taken from a map item*/ | | | |
| bool useRotationMap() const {return mRotationMap;} | | /**True if the picture rotation is matched to a map item. | |
| | | * @returns true if rotation map is in use | |
| | | * @see rotationMap | |
| | | * @see setRotationMap | |
| | | */ | |
| | | bool useRotationMap() const { return mRotationMap; } | |
| | | | |
| | | /**Returns the resize mode used for drawing the picture within the comp | |
| | | oser | |
| | | * item's frame. | |
| | | * @returns resize mode of picture | |
| | | * @note added in 2.3 | |
| | | * @see setResizeMode | |
| | | */ | |
| | | ResizeMode resizeMode() const { return mResizeMode; } | |
| | | | |
| | | /**Sets the picture's anchor point, which controls how it is placed | |
| | | * within the picture item's frame. | |
| | | * @param anchor anchor point for picture | |
| | | * @note added in 2.3 | |
| | | * @see pictureAnchor | |
| | | */ | |
| | | void setPictureAnchor( QgsComposerItem::ItemPositionMode anchor ); | |
| | | | |
| | | /**Returns the picture's current anchor, which controls how it is place | |
| | | d | |
| | | * within the picture item's frame. | |
| | | * @returns anchor point for picture | |
| | | * @note added in 2.3 | |
| | | * @see setPictureAnchor | |
| | | */ | |
| | | ItemPositionMode pictureAnchor() const { return mPictureAnchor; } | |
| | | | |
| | | /**Returns whether the picture item is using an expression for the imag | |
| | | e source. | |
| | | * @returns true if the picture is using an expression for the source, | |
| | | false if | |
| | | * it is using a single static file path for the source. | |
| | | * @note added in 2.3 | |
| | | * @see setUsePictureExpression | |
| | | * @see pictureFile | |
| | | * @see pictureExpression | |
| | | */ | |
| | | bool usePictureExpression() const { return mUseSourceExpression; } | |
| | | | |
| | | /**Returns the expression the item is using for the picture source. Thi | |
| | | s is only | |
| | | * used if usePictureExpression() is true. | |
| | | * @returns expression for the picture item's image path | |
| | | * @note added in 2.3 | |
| | | * @see setPictureExpression | |
| | | * @see usePictureExpression | |
| | | */ | |
| | | QString pictureExpression() const { return mSourceExpression; } | |
| | | | |
| /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation | | /**Calculates width and hight of the picture (in mm) such that it fits
into the item frame with the given rotation | |
| * @deprecated Use bool QgsComposerItem::imageSizeConsideringRotation(
double& width, double& height, double rotation ) | | * @deprecated Use bool QgsComposerItem::imageSizeConsideringRotation(
double& width, double& height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| bool imageSizeConsideringRotation( double& width, double& height ) cons
t; | | Q_DECL_DEPRECATED bool imageSizeConsideringRotation( double& width, dou
ble& height ) const; | |
| /**Calculates corner point after rotation and scaling | | /**Calculates corner point after rotation and scaling | |
| * @deprecated Use QgsComposerItem::cornerPointOnRotatedAndScaledRect(
double& x, double& y, double width, double height, double rotation ) | | * @deprecated Use QgsComposerItem::cornerPointOnRotatedAndScaledRect(
double& x, double& y, double width, double height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
|
| bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double wi
dth, double height ) const; | | Q_DECL_DEPRECATED bool cornerPointOnRotatedAndScaledRect( double& x, do
uble& y, double width, double height ) const; | |
| /**Calculates width / height of the bounding box of a rotated rectangle | | /**Calculates width / height of the bounding box of a rotated rectangle | |
|
| * @deprecated Use QgsComposerItem::sizeChangedByRotation( double& width | | * @deprecated Use QgsComposerItem::sizeChangedByRotation( double& widt | |
| , double& height, double rotation ) | | h, double& height, double rotation ) | |
| * instead | | * instead | |
| */ | | */ | |
| void sizeChangedByRotation( double& width, double& height ); | | Q_DECL_DEPRECATED void sizeChangedByRotation( double& width, double& he | |
| | | ight ); | |
| | | | |
| | | /**Returns the current picture mode (image format). | |
| | | * @returns picture mode | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | Mode mode() const { return mMode; } | |
| | | | |
| public slots: | | public slots: | |
|
| /**Sets the picture rotation within the item bounds. This does not affe | | /**Sets the picture rotation within the item bounds. This does not affe | |
| ct the item rectangle, | | ct | |
| only the way the picture is drawn within the item. | | * the item rectangle, only the way the picture is drawn within the ite | |
| | | m. | |
| * @deprecated Use setPictureRotation( double rotation ) instead | | * @deprecated Use setPictureRotation( double rotation ) instead | |
| */ | | */ | |
| virtual void setRotation( double r ); | | virtual void setRotation( double r ); | |
| | | | |
|
| /**Sets the picture rotation within the item bounds. This does not affe | | /**Sets the picture rotation within the item bounds. This does not affe | |
| ct the item rectangle, | | ct | |
| only the way the picture is drawn within the item. | | * the item's frame, only the way the picture is drawn within the item. | |
| @note this function was added in version 2.1*/ | | * @param r rotation in degrees clockwise | |
| | | * @see pictureRotation | |
| | | * @note added in 2.2 | |
| | | */ | |
| virtual void setPictureRotation( double r ); | | virtual void setPictureRotation( double r ); | |
| | | | |
|
| | | /**Sets the resize mode used for drawing the picture within the item bo | |
| | | unds. | |
| | | * @param mode ResizeMode to use for image file | |
| | | * @note added in 2.3 | |
| | | * @see resizeMode | |
| | | */ | |
| | | virtual void setResizeMode( ResizeMode mode ); | |
| | | | |
| | | /**Sets whether the picture should use an expression based image source | |
| | | path | |
| | | * @param useExpression set to true to use an expression based image so | |
| | | urce, | |
| | | * set to false to use a single image source path | |
| | | * @note added in 2.3 | |
| | | * @see usePictureExpression | |
| | | * @see setPictureFile | |
| | | * @see setPictureExpression | |
| | | */ | |
| | | virtual void setUsePictureExpression( bool useExpression ); | |
| | | | |
| | | /**Sets an expression to use for the picture source. This expression is | |
| | | only | |
| | | * used if usePictureExpression() is true. | |
| | | * @param expression to use for picture path | |
| | | * @note added in 2.3 | |
| | | * @see setUsePictureExpression | |
| | | * @see pictureExpression | |
| | | */ | |
| | | virtual void setPictureExpression( QString expression ); | |
| | | | |
| | | /**Recalculates the source image (if using an expression for picture's | |
| | | source) | |
| | | * and reloads and redraws the picture. | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | void refreshPicture(); | |
| | | | |
| | | /**Prepares the picture's source expression after it is altered or the | |
| | | compositions | |
| | | * atlas coverage layer changes. | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | void updatePictureExpression(); | |
| | | | |
| | | /**Forces a recalculation of the picture's frame size | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | void recalculateSize(); | |
| | | | |
| signals: | | signals: | |
| /**Is emitted on picture rotation change*/ | | /**Is emitted on picture rotation change*/ | |
| void pictureRotationChanged( double newRotation ); | | void pictureRotationChanged( double newRotation ); | |
| | | | |
| private: | | private: | |
| | | | |
|
| enum Mode //SVG or raster graphic format | | | |
| { | | | |
| SVG, | | | |
| RASTER, | | | |
| Unknown | | | |
| }; | | | |
| | | | |
| //default constructor is forbidden | | //default constructor is forbidden | |
| QgsComposerPicture(); | | QgsComposerPicture(); | |
| /**Calculates bounding rect for svg file (mSourcefile) such that aspect
ratio is correct*/ | | /**Calculates bounding rect for svg file (mSourcefile) such that aspect
ratio is correct*/ | |
| QRectF boundedSVGRect( double deviceWidth, double deviceHeight ); | | QRectF boundedSVGRect( double deviceWidth, double deviceHeight ); | |
| /**Calculates bounding rect for image such that aspect ratio is correct
*/ | | /**Calculates bounding rect for image such that aspect ratio is correct
*/ | |
| QRectF boundedImageRect( double deviceWidth, double deviceHeight ); | | QRectF boundedImageRect( double deviceWidth, double deviceHeight ); | |
| | | | |
| /**Returns size of current raster or svg picture */ | | /**Returns size of current raster or svg picture */ | |
| QSizeF pictureSize(); | | QSizeF pictureSize(); | |
| | | | |
| QImage mImage; | | QImage mImage; | |
| QSvgRenderer mSVG; | | QSvgRenderer mSVG; | |
| QFile mSourceFile; | | QFile mSourceFile; | |
| Mode mMode; | | Mode mMode; | |
|
| | | bool mUseSourceExpression; | |
| | | QString mSourceExpression; | |
| | | | |
| QSize mDefaultSvgSize; | | QSize mDefaultSvgSize; | |
| | | | |
| /**Image rotation*/ | | /**Image rotation*/ | |
| double mPictureRotation; | | double mPictureRotation; | |
| /**Map that sets the rotation (or 0 if this picture uses map independen
t rotation)*/ | | /**Map that sets the rotation (or 0 if this picture uses map independen
t rotation)*/ | |
| const QgsComposerMap* mRotationMap; | | const QgsComposerMap* mRotationMap; | |
| /**Width of the picture (in mm)*/ | | /**Width of the picture (in mm)*/ | |
| double mPictureWidth; | | double mPictureWidth; | |
| /**Height of the picture (in mm)*/ | | /**Height of the picture (in mm)*/ | |
| double mPictureHeight; | | double mPictureHeight; | |
|
| | | | |
| | | ResizeMode mResizeMode; | |
| | | QgsComposerItem::ItemPositionMode mPictureAnchor; | |
| | | | |
| | | QgsExpression* mPictureExpr; | |
| | | | |
| | | /**loads an image file into the picture item and redraws the item*/ | |
| | | void loadPicture( const QFile &file ); | |
| | | | |
| | | /**evaluates the picture expression and returns the calculated image pa | |
| | | th*/ | |
| | | QString evalPictureExpression(); | |
| | | | |
| | | /**sets up the picture item and connects to relevant signals*/ | |
| | | void init(); | |
| | | | |
| | | /**Returns part of a raster image which will be shown, given current pi | |
| | | cture | |
| | | * anchor settings | |
| | | */ | |
| | | QRect clippedImageRect( double &boundRectWidthMM, double &boundRectHeig | |
| | | htMM, QSize imageRectPixels ); | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 18 change blocks. |
| 31 lines changed or deleted | | 222 lines changed or added | |
|
| qgscomposertable.h | | qgscomposertable.h | |
| | | | |
| skipping to change at line 25 | | skipping to change at line 25 | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSCOMPOSERTABLE_H | | #ifndef QGSCOMPOSERTABLE_H | |
| #define QGSCOMPOSERTABLE_H | | #define QGSCOMPOSERTABLE_H | |
| | | | |
| #include "qgscomposeritem.h" | | #include "qgscomposeritem.h" | |
| #include "qgscomposition.h" | | #include "qgscomposition.h" | |
| #include "qgsfeature.h" | | #include "qgsfeature.h" | |
| #include <QSet> | | #include <QSet> | |
|
| | | #include <QObject> | |
| | | | |
| | | class QgsComposerTableColumn; | |
| | | | |
| /**A class to display feature attributes in the print composer*/ | | /**A class to display feature attributes in the print composer*/ | |
| class CORE_EXPORT QgsComposerTable: public QgsComposerItem | | class CORE_EXPORT QgsComposerTable: public QgsComposerItem | |
| { | | { | |
|
| | | Q_OBJECT | |
| | | | |
| public: | | public: | |
|
| | | | |
| | | /*! Controls how headers are horizontally aligned in a table | |
| | | */ | |
| | | enum HeaderHAlignment | |
| | | { | |
| | | FollowColumn, /*!< header uses the same alignment as the column */ | |
| | | HeaderLeft, /*!< align headers left */ | |
| | | HeaderCenter, /*!< align headers to center */ | |
| | | HeaderRight /*!< align headers right */ | |
| | | }; | |
| | | | |
| QgsComposerTable( QgsComposition* composition ); | | QgsComposerTable( QgsComposition* composition ); | |
| virtual ~QgsComposerTable(); | | virtual ~QgsComposerTable(); | |
| | | | |
| /** return correct graphics item type. Added in v1.7 */ | | /** return correct graphics item type. Added in v1.7 */ | |
| virtual int type() const { return ComposerTable; } | | virtual int type() const { return ComposerTable; } | |
| | | | |
| /** \brief Reimplementation of QCanvasItem::paint*/ | | /** \brief Reimplementation of QCanvasItem::paint*/ | |
| virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem*
itemStyle, QWidget* pWidget ); | | virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem*
itemStyle, QWidget* pWidget ); | |
| | | | |
| virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const =
0; | | virtual bool writeXML( QDomElement& elem, QDomDocument & doc ) const =
0; | |
| virtual bool readXML( const QDomElement& itemElem, const QDomDocument&
doc ) = 0; | | virtual bool readXML( const QDomElement& itemElem, const QDomDocument&
doc ) = 0; | |
| | | | |
|
| void setLineTextDistance( double d ) { mLineTextDistance = d; } | | /**Sets the margin distance between cell borders and their contents. | |
| | | * @param d margin for cell contents | |
| | | * @see lineTextDistance | |
| | | */ | |
| | | void setLineTextDistance( double d ); | |
| | | | |
| | | /**Returns the margin distance between cell borders and their contents. | |
| | | * @returns margin for cell contents | |
| | | * @see setLineTextDistance | |
| | | */ | |
| double lineTextDistance() const { return mLineTextDistance; } | | double lineTextDistance() const { return mLineTextDistance; } | |
| | | | |
|
| void setHeaderFont( const QFont& f ) { mHeaderFont = f;} | | /**Sets the font used to draw header text in the table. | |
| | | * @param f font for header cells | |
| | | * @see headerFont | |
| | | * @see setContentFont | |
| | | */ | |
| | | void setHeaderFont( const QFont& f ); | |
| | | | |
| | | /**Returns the font used to draw header text in the table. | |
| | | * @returns font for header cells | |
| | | * @see setHeaderFont | |
| | | * @see contentFont | |
| | | */ | |
| QFont headerFont() const { return mHeaderFont; } | | QFont headerFont() const { return mHeaderFont; } | |
| | | | |
|
| void setContentFont( const QFont& f ) { mContentFont = f; } | | /**Sets the horizontal alignment for table headers | |
| | | * @param alignment Horizontal alignment for table header cells | |
| | | * @note added in 2.3 | |
| | | * @see headerHAlignment | |
| | | */ | |
| | | void setHeaderHAlignment( const HeaderHAlignment alignment ); | |
| | | | |
| | | /**Returns the horizontal alignment for table headers | |
| | | * @returns Horizontal alignment for table header cells | |
| | | * @note added in 2.3 | |
| | | * @see setHeaderHAlignment | |
| | | */ | |
| | | HeaderHAlignment headerHAlignment() const { return mHeaderHAlignment; } | |
| | | | |
| | | /**Sets the font used to draw text in table body cells. | |
| | | * @param f font for table cells | |
| | | * @see contentFont | |
| | | * @see setHeaderFont | |
| | | */ | |
| | | void setContentFont( const QFont& f ); | |
| | | | |
| | | /**Returns the font used to draw text in table body cells. | |
| | | * @returns font for table cells | |
| | | * @see setContentFont | |
| | | * @see headerFont | |
| | | */ | |
| QFont contentFont() const { return mContentFont; } | | QFont contentFont() const { return mContentFont; } | |
| | | | |
|
| void setShowGrid( bool show ) { mShowGrid = show;} | | /**Sets whether grid lines should be drawn in the table | |
| | | * @param show set to true to show grid lines | |
| | | * @see showGrid | |
| | | * @see setGridStrokeWidth | |
| | | * @see setGridColor | |
| | | */ | |
| | | void setShowGrid( bool show ); | |
| | | | |
| | | /**Returns whether grid lines are drawn in the table | |
| | | * @returns true if grid lines are shown | |
| | | * @see setShowGrid | |
| | | * @see gridStrokeWidth | |
| | | * @see gridColor | |
| | | */ | |
| bool showGrid() const { return mShowGrid; } | | bool showGrid() const { return mShowGrid; } | |
| | | | |
|
| void setGridStrokeWidth( double w ) { mGridStrokeWidth = w; } | | /**Sets the width for grid lines in the table. | |
| | | * @param w grid line width | |
| | | * @see gridStrokeWidth | |
| | | * @see setShowGrid | |
| | | * @see setGridColor | |
| | | */ | |
| | | void setGridStrokeWidth( double w ); | |
| | | | |
| | | /**Returns the width of grid lines in the table. | |
| | | * @returns grid line width | |
| | | * @see setGridStrokeWidth | |
| | | * @see showGrid | |
| | | * @see gridColor | |
| | | */ | |
| double gridStrokeWidth() const { return mGridStrokeWidth; } | | double gridStrokeWidth() const { return mGridStrokeWidth; } | |
| | | | |
|
| | | /**Sets color used for grid lines in the table. | |
| | | * @param c grid line color | |
| | | * @see gridColor | |
| | | * @see setShowGrid | |
| | | * @see setGridStrokeWidth | |
| | | */ | |
| void setGridColor( const QColor& c ) { mGridColor = c; } | | void setGridColor( const QColor& c ) { mGridColor = c; } | |
|
| | | | |
| | | /**Returns the color used for grid lines in the table. | |
| | | * @returns grid line color | |
| | | * @see setGridColor | |
| | | * @see showGrid | |
| | | * @see gridStrokeWidth | |
| | | */ | |
| QColor gridColor() const { return mGridColor; } | | QColor gridColor() const { return mGridColor; } | |
| | | | |
|
| /**Adapts the size of the frame to match the content. This is normally | | /**Returns the text used in the column headers for the table. | |
| done in the paint method, but sometimes | | * @returns QMap of int to QString, where the int is the column index ( | |
| it needs to be done before the first render*/ | | starting at 0), | |
| void adjustFrameToSize(); | | * and the string is the text to use for the column's header | |
| | | * @note added in 2.3 | |
| | | * @note not available in python bindings | |
| | | */ | |
| | | virtual QMap<int, QString> headerLabels() const; | |
| | | | |
| | | //TODO - make this more generic for next API break, eg rename as getRow | |
| | | Values, use QStringList rather than | |
| | | //QgsAttributeMap | |
| | | | |
| | | /**Fetches the text used for the rows of the table. | |
| | | * @returns true if attribute text was successfully retrieved. | |
| | | * @param attributeMaps QList of QgsAttributeMap to store retrieved row | |
| | | data in | |
| | | * @note not available in python bindings | |
| | | */ | |
| | | virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMap | |
| | | s ) { Q_UNUSED( attributeMaps ); return false; } | |
| | | | |
| | | /**Returns a pointer to the list of QgsComposerTableColumns shown in th | |
| | | e table | |
| | | * @returns pointer to list of columns in table | |
| | | * @note added in 2.3 | |
| | | * @see setColumns | |
| | | */ | |
| | | QList<QgsComposerTableColumn*>* columns() { return &mColumns; } | |
| | | | |
| | | /**Replaces the columns in the table with a specified list of QgsCompos | |
| | | erTableColumns. | |
| | | * @param columns list of QgsComposerTableColumns to show in table | |
| | | * @note added in 2.3 | |
| | | * @see columns | |
| | | */ | |
| | | void setColumns( QList<QgsComposerTableColumn*> columns ); | |
| | | | |
| | | public slots: | |
| | | | |
| | | /**Refreshes the attributes shown in the table by querying the vector l | |
| | | ayer for new data. | |
| | | * This also causes the column widths and size of the table to change t | |
| | | o accommodate the | |
| | | * new data. | |
| | | * @note added in 2.3 | |
| | | * @see adjustFrameToSize | |
| | | */ | |
| | | virtual void refreshAttributes(); | |
| | | | |
| | | /**Adapts the size of the frame to match the content. First, the optima | |
| | | l width of the columns | |
| | | * is recalculated by checking the maximum width of attributes shown in | |
| | | the table. Then, the | |
| | | * table is resized to fit its contents. This slot utilises the table's | |
| | | attribute cache so | |
| | | * that a re-query of the vector layer is not required. | |
| | | * @note added in 2.3 | |
| | | * @see refreshAttributes | |
| | | */ | |
| | | virtual void adjustFrameToSize(); | |
| | | | |
| protected: | | protected: | |
| /**Distance between table lines and text*/ | | /**Distance between table lines and text*/ | |
| double mLineTextDistance; | | double mLineTextDistance; | |
| | | | |
| QFont mHeaderFont; | | QFont mHeaderFont; | |
| QFont mContentFont; | | QFont mContentFont; | |
| | | | |
|
| | | HeaderHAlignment mHeaderHAlignment; | |
| | | | |
| bool mShowGrid; | | bool mShowGrid; | |
| double mGridStrokeWidth; | | double mGridStrokeWidth; | |
| QColor mGridColor; | | QColor mGridColor; | |
| | | | |
|
| /**Retrieves feature attributes*/ | | QList<QgsAttributeMap> mAttributeMaps; | |
| //! @note not available in python bindings | | QMap<int, double> mMaxColumnWidthMap; | |
| virtual bool getFeatureAttributes( QList<QgsAttributeMap>& attributeMap | | | |
| s ) { Q_UNUSED( attributeMaps ); return false; } | | QList<QgsComposerTableColumn*> mColumns; | |
| virtual QMap<int, QString> getHeaderLabels() const { return QMap<int, Q | | | |
| String>(); } //= 0; | | /**Calculates the maximum width of text shown in columns. | |
| /**Calculate the maximum width values of the vector attributes*/ | | * @param maxWidthMap QMap of int to double in which to store the maxim | |
| | | um widths. The int will be filled | |
| | | * with the column number and the double with the maximum width of text | |
| | | present in the column. | |
| | | * @param attributeMaps list of attribute values for each row shown in | |
| | | the table | |
| | | * @note not available in python bindings | |
| | | * @see adaptItemFrame | |
| | | */ | |
| virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap,
const QList<QgsAttributeMap>& attributeMaps ) const; | | virtual bool calculateMaxColumnWidths( QMap<int, double>& maxWidthMap,
const QList<QgsAttributeMap>& attributeMaps ) const; | |
|
| /**Adapts the size of the item frame to match the content*/ | | | |
| //! @note not available in python bindings | | /**Adapts the size of the item frame to match the table's content. | |
| | | * @param maxWidthMap QMap of int to double, where the int contains the | |
| | | column number and the double is the | |
| | | * maximum width of text present in the column. | |
| | | * @param attributeMaps list of attribute values for each row shown in | |
| | | the table | |
| | | * @note not available in python bindings | |
| | | * @see calculateMaxColumnWidths | |
| | | */ | |
| void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList<
QgsAttributeMap>& attributeMaps ); | | void adaptItemFrame( const QMap<int, double>& maxWidthMap, const QList<
QgsAttributeMap>& attributeMaps ); | |
|
| | | | |
| | | /**Draws the horizontal grid lines for the table. | |
| | | * @param p destination painter for grid lines | |
| | | * @param nAttributes number of attribute rows shown in table | |
| | | * @see drawVerticalGridLines | |
| | | */ | |
| void drawHorizontalGridLines( QPainter* p, int nAttributes ); | | void drawHorizontalGridLines( QPainter* p, int nAttributes ); | |
|
| //! @note not available in python bindings | | | |
| | | /**Draws the vertical grid lines for the table. | |
| | | * @param p destination painter for grid lines | |
| | | * @param maxWidthMap QMap of int to double, where the int contains the | |
| | | column number and the double is the | |
| | | * maximum width of text present in the column. | |
| | | * @note not available in python bindings | |
| | | * @see drawVerticalGridLines | |
| | | * @see calculateMaxColumnWidths | |
| | | */ | |
| void drawVerticalGridLines( QPainter* p, const QMap<int, double>& maxWi
dthMap ); | | void drawVerticalGridLines( QPainter* p, const QMap<int, double>& maxWi
dthMap ); | |
| | | | |
|
| | | /**Writes common table properties to xml for storage. | |
| | | * @param itemElem an existing QDomElement in which to store the table' | |
| | | s properties. | |
| | | * @param doc QDomDocument for the destination xml. | |
| | | * @see tableReadXML | |
| | | * @see writeXML | |
| | | */ | |
| bool tableWriteXML( QDomElement& itemElem, QDomDocument& doc ) const; | | bool tableWriteXML( QDomElement& itemElem, QDomDocument& doc ) const; | |
|
| | | | |
| | | /**Reads the table's common properties from xml. | |
| | | * @param itemElem a QDomElement holding the table's desired properties | |
| | | . | |
| | | * @param doc QDomDocument for the source xml. | |
| | | * @see tableWriteXML | |
| | | * @see readXML | |
| | | */ | |
| bool tableReadXML( const QDomElement& itemElem, const QDomDocument& doc
); | | bool tableReadXML( const QDomElement& itemElem, const QDomDocument& doc
); | |
| }; | | }; | |
| | | | |
| #endif // QGSCOMPOSERTABLE_H | | #endif // QGSCOMPOSERTABLE_H | |
| | | | |
End of changes. 18 change blocks. |
| 19 lines changed or deleted | | 224 lines changed or added | |
|
| qgscomposition.h | | qgscomposition.h | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #include <QList> | | #include <QList> | |
| #include <QPair> | | #include <QPair> | |
| #include <QSet> | | #include <QSet> | |
| #include <QUndoStack> | | #include <QUndoStack> | |
| #include <QPrinter> | | #include <QPrinter> | |
| #include <QPainter> | | #include <QPainter> | |
| | | | |
| #include "qgsaddremoveitemcommand.h" | | #include "qgsaddremoveitemcommand.h" | |
| #include "qgscomposeritemcommand.h" | | #include "qgscomposeritemcommand.h" | |
| #include "qgsatlascomposition.h" | | #include "qgsatlascomposition.h" | |
|
| | | #include "qgspaperitem.h" | |
| | | | |
| class QgisApp; | | class QgisApp; | |
| class QgsComposerFrame; | | class QgsComposerFrame; | |
| class QgsComposerMap; | | class QgsComposerMap; | |
|
| class QgsPaperItem; | | | |
| class QGraphicsRectItem; | | class QGraphicsRectItem; | |
| class QgsMapRenderer; | | class QgsMapRenderer; | |
| class QDomElement; | | class QDomElement; | |
| class QgsComposerArrow; | | class QgsComposerArrow; | |
| class QgsComposerMouseHandles; | | class QgsComposerMouseHandles; | |
| class QgsComposerHtml; | | class QgsComposerHtml; | |
| class QgsComposerItem; | | class QgsComposerItem; | |
| class QgsComposerLabel; | | class QgsComposerLabel; | |
| class QgsComposerLegend; | | class QgsComposerLegend; | |
| class QgsComposerMap; | | class QgsComposerMap; | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 93 | |
| Dots, | | Dots, | |
| Crosses | | Crosses | |
| }; | | }; | |
| | | | |
| enum ZValueDirection | | enum ZValueDirection | |
| { | | { | |
| ZValueBelow, | | ZValueBelow, | |
| ZValueAbove | | ZValueAbove | |
| }; | | }; | |
| | | | |
|
| | | //! @deprecated since 2.4 - use the constructor with QgsMapSettings | |
| | | Q_DECL_DEPRECATED QgsComposition( QgsMapRenderer* mapRenderer ); | |
| | | explicit QgsComposition( const QgsMapSettings& mapSettings ); | |
| | | | |
| /**Composition atlas modes*/ | | /**Composition atlas modes*/ | |
| enum AtlasMode | | enum AtlasMode | |
| { | | { | |
| AtlasOff, // Composition is not being controlled by an atlas | | AtlasOff, // Composition is not being controlled by an atlas | |
| PreviewAtlas, // An atlas composition is being previewed in the app | | PreviewAtlas, // An atlas composition is being previewed in the app | |
| ExportAtlas // The composition is being exported as an atlas | | ExportAtlas // The composition is being exported as an atlas | |
| }; | | }; | |
| | | | |
|
| QgsComposition( QgsMapRenderer* mapRenderer ); | | | |
| ~QgsComposition(); | | ~QgsComposition(); | |
| | | | |
|
| /**Changes size of paper item*/ | | /**Changes size of paper item. Also moves all items so that they retain | |
| | | * their same relative position to the top left corner of their current | |
| | | page. | |
| | | */ | |
| void setPaperSize( double width, double height ); | | void setPaperSize( double width, double height ); | |
| | | | |
| /**Returns height of paper item*/ | | /**Returns height of paper item*/ | |
| double paperHeight() const; | | double paperHeight() const; | |
| | | | |
| /**Returns width of paper item*/ | | /**Returns width of paper item*/ | |
| double paperWidth() const; | | double paperWidth() const; | |
| | | | |
| double spaceBetweenPages() const { return mSpaceBetweenPages; } | | double spaceBetweenPages() const { return mSpaceBetweenPages; } | |
| | | | |
| | | | |
| skipping to change at line 217 | | skipping to change at line 222 | |
| | | | |
| /**Return composer items of a specific type | | /**Return composer items of a specific type | |
| @note not available in python bindings | | @note not available in python bindings | |
| */ | | */ | |
| template<class T> void composerItems( QList<T*>& itemList ); | | template<class T> void composerItems( QList<T*>& itemList ); | |
| | | | |
| /**Returns the composer map with specified id | | /**Returns the composer map with specified id | |
| @return QgsComposerMap or 0 pointer if the composer map item does not
exist*/ | | @return QgsComposerMap or 0 pointer if the composer map item does not
exist*/ | |
| const QgsComposerMap* getComposerMapById( int id ) const; | | const QgsComposerMap* getComposerMapById( int id ) const; | |
| | | | |
|
| /*Returns the composer html with specified id (a string as named in the | | /**Returns the composer html with specified id (a string as named in th
e | |
| composer user interface item properties). | | composer user interface item properties). | |
| @note Added in QGIS 2.0 | | @note Added in QGIS 2.0 | |
|
| @param id - A QString representing the id of the item. | | @param item the item. | |
| @return QgsComposerHtml pointer or 0 pointer if no such item exists. | | @return QgsComposerHtml pointer or 0 pointer if no such item exists. | |
|
| */ | | */ | |
| const QgsComposerHtml* getComposerHtmlByItem( QgsComposerItem *item ) c
onst; | | const QgsComposerHtml* getComposerHtmlByItem( QgsComposerItem *item ) c
onst; | |
| | | | |
| /**Returns a composer item given its text identifier. | | /**Returns a composer item given its text identifier. | |
| Ids are not necessarely unique, but this function returns only one e
lement. | | Ids are not necessarely unique, but this function returns only one e
lement. | |
| @note added in 2.0 | | @note added in 2.0 | |
| @param theId - A QString representing the identifier of the item to | | @param theId - A QString representing the identifier of the item to | |
| retrieve. | | retrieve. | |
| @return QgsComposerItem pointer or 0 pointer if no such item exists. | | @return QgsComposerItem pointer or 0 pointer if no such item exists. | |
|
| **/ | | */ | |
| const QgsComposerItem* getComposerItemById( QString theId ) const; | | const QgsComposerItem* getComposerItemById( QString theId ) const; | |
| | | | |
| /**Returns a composer item given its unique identifier. | | /**Returns a composer item given its unique identifier. | |
| @note added in 2.0 | | @note added in 2.0 | |
| @param theUuid A QString representing the UUID of the item to | | @param theUuid A QString representing the UUID of the item to | |
| **/ | | **/ | |
| const QgsComposerItem* getComposerItemByUuid( QString theUuid ) const; | | const QgsComposerItem* getComposerItemByUuid( QString theUuid ) const; | |
| | | | |
| int printResolution() const {return mPrintResolution;} | | int printResolution() const {return mPrintResolution;} | |
|
| void setPrintResolution( int dpi ) {mPrintResolution = dpi;} | | void setPrintResolution( int dpi ); | |
| | | | |
| bool printAsRaster() const {return mPrintAsRaster;} | | bool printAsRaster() const {return mPrintAsRaster;} | |
| void setPrintAsRaster( bool enabled ) { mPrintAsRaster = enabled; } | | void setPrintAsRaster( bool enabled ) { mPrintAsRaster = enabled; } | |
| | | | |
| bool generateWorldFile() const { return mGenerateWorldFile; } | | bool generateWorldFile() const { return mGenerateWorldFile; } | |
| void setGenerateWorldFile( bool enabled ) { mGenerateWorldFile = enable
d; } | | void setGenerateWorldFile( bool enabled ) { mGenerateWorldFile = enable
d; } | |
| | | | |
| QgsComposerMap* worldFileMap() const { return mWorldFileMap; } | | QgsComposerMap* worldFileMap() const { return mWorldFileMap; } | |
| void setWorldFileMap( QgsComposerMap* map ) { mWorldFileMap = map; } | | void setWorldFileMap( QgsComposerMap* map ) { mWorldFileMap = map; } | |
| | | | |
| /**Returns true if a composition should use advanced effects such as bl
end modes | | /**Returns true if a composition should use advanced effects such as bl
end modes | |
| @note added in 1.9*/ | | @note added in 1.9*/ | |
| bool useAdvancedEffects() const {return mUseAdvancedEffects;} | | bool useAdvancedEffects() const {return mUseAdvancedEffects;} | |
| /**Used to enable or disable advanced effects such as blend modes in a
composition | | /**Used to enable or disable advanced effects such as blend modes in a
composition | |
| @note: added in version 1.9*/ | | @note: added in version 1.9*/ | |
| void setUseAdvancedEffects( bool effectsEnabled ); | | void setUseAdvancedEffects( bool effectsEnabled ); | |
| | | | |
| /**Returns pointer to map renderer of qgis map canvas*/ | | /**Returns pointer to map renderer of qgis map canvas*/ | |
|
| QgsMapRenderer* mapRenderer() {return mMapRenderer;} | | //! @deprecated since 2.4 - use mapSettings() instead. May return null | |
| | | if not initialized with QgsMapRenderer | |
| | | Q_DECL_DEPRECATED QgsMapRenderer* mapRenderer() {return mMapRenderer;} | |
| | | | |
| | | //! Return setting of QGIS map canvas | |
| | | //! @note added in 2.4 | |
| | | const QgsMapSettings& mapSettings() const { return mMapSettings; } | |
| | | | |
| QgsComposition::PlotStyle plotStyle() const {return mPlotStyle;} | | QgsComposition::PlotStyle plotStyle() const {return mPlotStyle;} | |
| void setPlotStyle( QgsComposition::PlotStyle style ) {mPlotStyle = styl
e;} | | void setPlotStyle( QgsComposition::PlotStyle style ) {mPlotStyle = styl
e;} | |
| | | | |
| /**Returns the pixel font size for a font that has point size set. | | /**Returns the pixel font size for a font that has point size set. | |
| The result depends on the resolution (dpi) and of the preview mode. Ea
ch item that sets | | The result depends on the resolution (dpi) and of the preview mode. Ea
ch item that sets | |
| a font should call this function before drawing text*/ | | a font should call this function before drawing text*/ | |
| int pixelFontSize( double pointSize ) const; | | int pixelFontSize( double pointSize ) const; | |
| | | | |
| /**Does the inverse calculation and returns points for pixels (equals t
o mm in QgsComposition)*/ | | /**Does the inverse calculation and returns points for pixels (equals t
o mm in QgsComposition)*/ | |
| | | | |
| skipping to change at line 417 | | skipping to change at line 427 | |
| | | | |
| //printing | | //printing | |
| | | | |
| /** Prepare the printer for printing */ | | /** Prepare the printer for printing */ | |
| void beginPrint( QPrinter& printer ); | | void beginPrint( QPrinter& printer ); | |
| /** Prepare the printer for printing in a PDF */ | | /** Prepare the printer for printing in a PDF */ | |
| void beginPrintAsPDF( QPrinter& printer, const QString& file ); | | void beginPrintAsPDF( QPrinter& printer, const QString& file ); | |
| /** Print on a preconfigured printer */ | | /** Print on a preconfigured printer */ | |
| void doPrint( QPrinter& printer, QPainter& painter ); | | void doPrint( QPrinter& printer, QPainter& painter ); | |
| | | | |
|
| /** Convenience function that prepares the printer and prints */ | | /**Convenience function that prepares the printer and prints | |
| void print( QPrinter &printer ); | | * @returns true if print was successful | |
| | | */ | |
| | | bool print( QPrinter &printer ); | |
| | | | |
|
| /** Convenience function that prepares the printer for printing in PDF | | /**Convenience function that prepares the printer for printing in PDF a | |
| and prints */ | | nd prints | |
| void exportAsPDF( const QString& file ); | | * @returns true if export was successful | |
| | | */ | |
| | | bool exportAsPDF( const QString& file ); | |
| | | | |
| //! print composer page to image | | //! print composer page to image | |
| //! If the image does not fit into memory, a null image is returned | | //! If the image does not fit into memory, a null image is returned | |
| QImage printPageAsRaster( int page ); | | QImage printPageAsRaster( int page ); | |
| | | | |
| /**Render a page to a paint device | | /**Render a page to a paint device | |
| @note added in version 1.9*/ | | @note added in version 1.9*/ | |
| void renderPage( QPainter* p, int page ); | | void renderPage( QPainter* p, int page ); | |
| | | | |
| /** Compute world file parameters */ | | /** Compute world file parameters */ | |
| | | | |
| skipping to change at line 446 | | skipping to change at line 460 | |
| /**Resizes a QRectF relative to the change from boundsBefore to boundsA
fter*/ | | /**Resizes a QRectF relative to the change from boundsBefore to boundsA
fter*/ | |
| static void relativeResizeRect( QRectF& rectToResize, const QRectF& bou
ndsBefore, const QRectF& boundsAfter ); | | static void relativeResizeRect( QRectF& rectToResize, const QRectF& bou
ndsBefore, const QRectF& boundsAfter ); | |
| /**Returns a scaled position given a before and after range*/ | | /**Returns a scaled position given a before and after range*/ | |
| static double relativePosition( double position, double beforeMin, doub
le beforeMax, double afterMin, double afterMax ); | | static double relativePosition( double position, double beforeMin, doub
le beforeMax, double afterMin, double afterMax ); | |
| | | | |
| /** Returns the current atlas mode of the composition */ | | /** Returns the current atlas mode of the composition */ | |
| QgsComposition::AtlasMode atlasMode() const { return mAtlasMode; } | | QgsComposition::AtlasMode atlasMode() const { return mAtlasMode; } | |
| /** Sets the current atlas mode of the composition. Returns false if th
e mode could not be changed. */ | | /** Sets the current atlas mode of the composition. Returns false if th
e mode could not be changed. */ | |
| bool setAtlasMode( QgsComposition::AtlasMode mode ); | | bool setAtlasMode( QgsComposition::AtlasMode mode ); | |
| | | | |
|
| | | /** Return pages in the correct order | |
| | | @note composerItems(QList< QgsPaperItem* > &) may not return pages in | |
| | | the correct order | |
| | | @note added in version 2.4*/ | |
| | | QList< QgsPaperItem* > pages() { return mPages; } | |
| | | | |
| public slots: | | public slots: | |
| /**Casts object to the proper subclass type and calls corresponding ite
mAdded signal*/ | | /**Casts object to the proper subclass type and calls corresponding ite
mAdded signal*/ | |
| void sendItemAddedSignal( QgsComposerItem* item ); | | void sendItemAddedSignal( QgsComposerItem* item ); | |
| | | | |
| /**Updates the scene bounds of the composition | | /**Updates the scene bounds of the composition | |
| @note added in version 2.2*/ | | @note added in version 2.2*/ | |
| void updateBounds(); | | void updateBounds(); | |
| | | | |
|
| | | /**Forces items in the composition to refresh. For instance, this cause | |
| | | s maps to redraw | |
| | | * and rebuild cached images, html items to reload their source url, an | |
| | | d attribute tables | |
| | | * to refresh their contents. | |
| | | @note added in version 2.3*/ | |
| | | void refreshItems(); | |
| | | | |
| | | /**Clears any selected items and sets an item as the current selection. | |
| | | * @param item item to set as selected | |
| | | * @note added in version 2.3*/ | |
| | | void setSelectedItem( QgsComposerItem* item ); | |
| | | | |
| | | protected: | |
| | | void init(); | |
| | | | |
| private: | | private: | |
| /**Pointer to map renderer of QGIS main map*/ | | /**Pointer to map renderer of QGIS main map*/ | |
| QgsMapRenderer* mMapRenderer; | | QgsMapRenderer* mMapRenderer; | |
|
| | | const QgsMapSettings& mMapSettings; | |
| | | | |
| QgsComposition::PlotStyle mPlotStyle; | | QgsComposition::PlotStyle mPlotStyle; | |
| double mPageWidth; | | double mPageWidth; | |
| double mPageHeight; | | double mPageHeight; | |
| QList< QgsPaperItem* > mPages; | | QList< QgsPaperItem* > mPages; | |
| double mSpaceBetweenPages; //space in preview between pages | | double mSpaceBetweenPages; //space in preview between pages | |
| | | | |
| /**Drawing style for page*/ | | /**Drawing style for page*/ | |
| QgsFillSymbolV2* mPageStyleSymbol; | | QgsFillSymbolV2* mPageStyleSymbol; | |
| void createDefaultPageStyleSymbol(); | | void createDefaultPageStyleSymbol(); | |
| | | | |
| | | | |
| skipping to change at line 554 | | skipping to change at line 589 | |
| void deleteAndRemoveMultiFrames(); | | void deleteAndRemoveMultiFrames(); | |
| | | | |
| static QString encodeStringForXML( const QString& str ); | | static QString encodeStringForXML( const QString& str ); | |
| | | | |
| bool mPreventCursorChange; | | bool mPreventCursorChange; | |
| | | | |
| signals: | | signals: | |
| void paperSizeChanged(); | | void paperSizeChanged(); | |
| void nPagesChanged(); | | void nPagesChanged(); | |
| | | | |
|
| | | /**Is emitted when the compositions print resolution changes*/ | |
| | | void printResolutionChanged(); | |
| | | | |
| /**Is emitted when selected item changed. If 0, no item is selected*/ | | /**Is emitted when selected item changed. If 0, no item is selected*/ | |
| void selectedItemChanged( QgsComposerItem* selected ); | | void selectedItemChanged( QgsComposerItem* selected ); | |
| /**Is emitted when new composer arrow has been added to the view*/ | | /**Is emitted when new composer arrow has been added to the view*/ | |
| void composerArrowAdded( QgsComposerArrow* arrow ); | | void composerArrowAdded( QgsComposerArrow* arrow ); | |
| /**Is emitted when a new composer html has been added to the view*/ | | /**Is emitted when a new composer html has been added to the view*/ | |
| void composerHtmlFrameAdded( QgsComposerHtml* html, QgsComposerFrame* f
rame ); | | void composerHtmlFrameAdded( QgsComposerHtml* html, QgsComposerFrame* f
rame ); | |
| /**Is emitted when new composer label has been added to the view*/ | | /**Is emitted when new composer label has been added to the view*/ | |
| void composerLabelAdded( QgsComposerLabel* label ); | | void composerLabelAdded( QgsComposerLabel* label ); | |
| /**Is emitted when new composer map has been added to the view*/ | | /**Is emitted when new composer map has been added to the view*/ | |
| void composerMapAdded( QgsComposerMap* map ); | | void composerMapAdded( QgsComposerMap* map ); | |
| | | | |
| skipping to change at line 577 | | skipping to change at line 615 | |
| void composerLegendAdded( QgsComposerLegend* legend ); | | void composerLegendAdded( QgsComposerLegend* legend ); | |
| /**Is emitted when a new composer picture has been added*/ | | /**Is emitted when a new composer picture has been added*/ | |
| void composerPictureAdded( QgsComposerPicture* picture ); | | void composerPictureAdded( QgsComposerPicture* picture ); | |
| /**Is emitted when a new composer shape has been added*/ | | /**Is emitted when a new composer shape has been added*/ | |
| void composerShapeAdded( QgsComposerShape* shape ); | | void composerShapeAdded( QgsComposerShape* shape ); | |
| /**Is emitted when a new composer table has been added*/ | | /**Is emitted when a new composer table has been added*/ | |
| void composerTableAdded( QgsComposerAttributeTable* table ); | | void composerTableAdded( QgsComposerAttributeTable* table ); | |
| /**Is emitted when a composer item has been removed from the scene*/ | | /**Is emitted when a composer item has been removed from the scene*/ | |
| void itemRemoved( QgsComposerItem* ); | | void itemRemoved( QgsComposerItem* ); | |
| | | | |
|
| | | /**Is emitted when item in the composition must be refreshed*/ | |
| | | void refreshItemsTriggered(); | |
| | | | |
| /**Is emitted when the composition has an updated status bar message fo
r the composer window*/ | | /**Is emitted when the composition has an updated status bar message fo
r the composer window*/ | |
| void statusMsgChanged( QString message ); | | void statusMsgChanged( QString message ); | |
| }; | | }; | |
| | | | |
| template<class T> void QgsComposition::composerItems( QList<T*>& itemList ) | | template<class T> void QgsComposition::composerItems( QList<T*>& itemList ) | |
| { | | { | |
| itemList.clear(); | | itemList.clear(); | |
| QList<QGraphicsItem *> graphicsItemList = items(); | | QList<QGraphicsItem *> graphicsItemList = items(); | |
| QList<QGraphicsItem *>::iterator itemIt = graphicsItemList.begin(); | | QList<QGraphicsItem *>::iterator itemIt = graphicsItemList.begin(); | |
| for ( ; itemIt != graphicsItemList.end(); ++itemIt ) | | for ( ; itemIt != graphicsItemList.end(); ++itemIt ) | |
| | | | |
End of changes. 18 change blocks. |
| 14 lines changed or deleted | | 60 lines changed or added | |
|
| qgsdualview.h | | qgsdualview.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| | | | |
| #include <QStackedWidget> | | #include <QStackedWidget> | |
| | | | |
| #include "ui_qgsdualviewbase.h" | | #include "ui_qgsdualviewbase.h" | |
| | | | |
| #include "qgsattributeeditorcontext.h" | | #include "qgsattributeeditorcontext.h" | |
| #include "qgsattributetablefiltermodel.h" | | #include "qgsattributetablefiltermodel.h" | |
| #include "qgscachedfeatureiterator.h" | | #include "qgscachedfeatureiterator.h" | |
| #include "qgsdistancearea.h" | | #include "qgsdistancearea.h" | |
| | | | |
|
| class QgsAttributeDialog; | | class QgsAttributeForm; | |
| class QgsFeatureRequest; | | class QgsFeatureRequest; | |
| class QSignalMapper; | | class QSignalMapper; | |
| class QgsMapLayerAction; | | class QgsMapLayerAction; | |
| | | | |
| /** | | /** | |
| * This widget is used to show the attributes of a set of features of a {@l
ink QgsVectorLayer}. | | * This widget is used to show the attributes of a set of features of a {@l
ink QgsVectorLayer}. | |
| * The attributes can be edited. | | * The attributes can be edited. | |
| * It supports two different layouts: the table layout, in which the attrib
utes for the features | | * It supports two different layouts: the table layout, in which the attrib
utes for the features | |
| * are shown in a table and the editor layout, where the features are shown
as a selectable list | | * are shown in a table and the editor layout, where the features are shown
as a selectable list | |
| * and the attributes for the currently selected feature are shown in a for
m. | | * and the attributes for the currently selected feature are shown in a for
m. | |
| | | | |
| skipping to change at line 72 | | skipping to change at line 72 | |
| * in the neighbouring frame. | | * in the neighbouring frame. | |
| */ | | */ | |
| AttributeEditor = 1 | | AttributeEditor = 1 | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * @brief Constructor | | * @brief Constructor | |
| * @param parent The parent widget | | * @param parent The parent widget | |
| */ | | */ | |
| explicit QgsDualView( QWidget* parent = 0 ); | | explicit QgsDualView( QWidget* parent = 0 ); | |
|
| virtual ~QgsDualView(); | | | |
| | | | |
| /** | | /** | |
| * Has to be called to initialize the dual view. | | * Has to be called to initialize the dual view. | |
| * | | * | |
| * @param layer The layer which should be used to fetch features | | * @param layer The layer which should be used to fetch features | |
| * @param mapCanvas The mapCanvas (used for the FilterMode | | * @param mapCanvas The mapCanvas (used for the FilterMode | |
| * {@link QgsAttributeTableFilterModel::ShowVisible} | | * {@link QgsAttributeTableFilterModel::ShowVisible} | |
| * @param request Use a modified request to limit the shown features | | * @param request Use a modified request to limit the shown features | |
| * @param context The context in which this view is shown | | * @param context The context in which this view is shown | |
| */ | | */ | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 98 | |
| */ | | */ | |
| void setView( ViewMode view ); | | void setView( ViewMode view ); | |
| | | | |
| /** | | /** | |
| * Set the filter mode | | * Set the filter mode | |
| * | | * | |
| * @param filterMode | | * @param filterMode | |
| */ | | */ | |
| void setFilterMode( QgsAttributeTableFilterModel::FilterMode filterMode
); | | void setFilterMode( QgsAttributeTableFilterModel::FilterMode filterMode
); | |
| | | | |
|
| | | QgsAttributeTableFilterModel::FilterMode filterMode() { return mFilterM | |
| | | odel->filterMode(); } | |
| | | | |
| /** | | /** | |
| * Toggle the selectedOnTop flag. If enabled, selected features will be
moved to top. | | * Toggle the selectedOnTop flag. If enabled, selected features will be
moved to top. | |
| * | | * | |
| * @param selectedOnTop True: Show selected features on top. | | * @param selectedOnTop True: Show selected features on top. | |
| * False: Use defined sorting column. | | * False: Use defined sorting column. | |
| */ | | */ | |
| void setSelectedOnTop( bool selectedOnTop ); | | void setSelectedOnTop( bool selectedOnTop ); | |
| | | | |
| /** | | /** | |
| * Returns the number of features on the layer. | | * Returns the number of features on the layer. | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 131 | |
| int filteredFeatureCount(); | | int filteredFeatureCount(); | |
| | | | |
| /** | | /** | |
| * Set a list of currently visible features | | * Set a list of currently visible features | |
| * | | * | |
| * @param filteredFeatures A list of feature ids | | * @param filteredFeatures A list of feature ids | |
| * | | * | |
| */ | | */ | |
| void setFilteredFeatures( QgsFeatureIds filteredFeatures ); | | void setFilteredFeatures( QgsFeatureIds filteredFeatures ); | |
| | | | |
|
| | | QgsFeatureIds filteredFeatures() { return mFilterModel->filteredFeature | |
| | | s(); } | |
| | | | |
| /** | | /** | |
| * Returns the model which has the information about all features (not
only filtered) | | * Returns the model which has the information about all features (not
only filtered) | |
| * | | * | |
| * @return The master model | | * @return The master model | |
| */ | | */ | |
| QgsAttributeTableModel* masterModel() const { return mMasterModel; } | | QgsAttributeTableModel* masterModel() const { return mMasterModel; } | |
| | | | |
| void setRequest( const QgsFeatureRequest& request ); | | void setRequest( const QgsFeatureRequest& request ); | |
| | | | |
| void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSe
lectionManager ); | | void setFeatureSelectionManager( QgsIFeatureSelectionManager* featureSe
lectionManager ); | |
| | | | |
| protected: | | protected: | |
| /** | | /** | |
| * Initializes widgets which depend on the attributes of this layer | | * Initializes widgets which depend on the attributes of this layer | |
| */ | | */ | |
| void columnBoxInit(); | | void columnBoxInit(); | |
| | | | |
|
| virtual void hideEvent( QHideEvent * ); | | | |
| virtual void focusOutEvent( QFocusEvent * ); | | | |
| | | | |
| public slots: | | public slots: | |
| /** | | /** | |
| * @brief Set the current edit selection in the {@link AttributeEditor}
mode. | | * @brief Set the current edit selection in the {@link AttributeEditor}
mode. | |
| * | | * | |
| * @param fids A list of edited features (Currently only one at a tim
e is supported) | | * @param fids A list of edited features (Currently only one at a tim
e is supported) | |
| */ | | */ | |
| void setCurrentEditSelection( const QgsFeatureIds& fids ); | | void setCurrentEditSelection( const QgsFeatureIds& fids ); | |
| | | | |
| /** | | /** | |
| * @brief saveEditChanges | | * @brief saveEditChanges | |
| * | | * | |
| * @return true if the saving was ok. false is possible due to connecte
d | | * @return true if the saving was ok. false is possible due to connecte
d | |
| * validation logic. | | * validation logic. | |
| */ | | */ | |
| bool saveEditChanges(); | | bool saveEditChanges(); | |
| | | | |
|
| /** | | | |
| * Update the shown feature if an attribute changed | | | |
| */ | | | |
| void reloadAttribute( const int& attribute ); | | | |
| | | | |
| signals: | | signals: | |
| /** | | /** | |
| * Is emitted, whenever the display expression is successfully changed | | * Is emitted, whenever the display expression is successfully changed | |
| * @param expression The expression that was applied | | * @param expression The expression that was applied | |
| */ | | */ | |
| void displayExpressionChanged( const QString expression ); | | void displayExpressionChanged( const QString expression ); | |
| | | | |
| /** | | /** | |
| * Is emitted, whenever the filter changes | | * Is emitted, whenever the filter changes | |
| */ | | */ | |
| void filterChanged(); | | void filterChanged(); | |
| | | | |
| private slots: | | private slots: | |
|
| | | | |
| | | void on_mFeatureList_aboutToChangeEditSelection( bool& ok ); | |
| | | | |
| /** | | /** | |
| * Changes the currently visible feature within the attribute editor | | * Changes the currently visible feature within the attribute editor | |
| * | | * | |
| * @param feat The newly visible feature | | * @param feat The newly visible feature | |
| */ | | */ | |
| void on_mFeatureList_currentEditSelectionChanged( const QgsFeature& fea
t ); | | void on_mFeatureList_currentEditSelectionChanged( const QgsFeature& fea
t ); | |
| | | | |
| void previewExpressionBuilder(); | | void previewExpressionBuilder(); | |
| | | | |
| void previewColumnChanged( QObject* previewAction ); | | void previewColumnChanged( QObject* previewAction ); | |
| | | | |
|
| void editingToggled(); | | | |
| | | | |
| void viewWillShowContextMenu( QMenu* menu, QModelIndex atIndex ); | | void viewWillShowContextMenu( QMenu* menu, QModelIndex atIndex ); | |
| | | | |
| void previewExpressionChanged( const QString expression ); | | void previewExpressionChanged( const QString expression ); | |
| | | | |
| /** | | /** | |
|
| * If an attribute on this layer is deleted, remove the field also for | | * Will be called whenever the currently shown feature form changes. | |
| open | | * Will forward this signal to the feature list to visually represent | |
| * attribute dialogs. | | * that there has been an edit event. | |
| * (as long as the attribute dialog is not able to handle this problem) | | | |
| * | | | |
| * @param attribute The attribute being deleted | | | |
| */ | | | |
| void attributeDeleted( int attribute ); | | | |
| | | | |
| /** | | | |
| * If an attribute on this layer is added, add the field also for open | | | |
| * attribute dialogs. | | | |
| * (as long as the attribute dialog is not able to handle this problem) | | | |
| * | | | |
| * @param attribute The attribute being added | | | |
| */ | | | |
| void attributeAdded( int attribute ); | | | |
| | | | |
| /** | | | |
| * Gets called when a feature is deleted. | | | |
| * So it can be removed from the feature form if required. | | | |
| * | | | |
| * @param fid The feature being deleted | | | |
| */ | | */ | |
|
| void featureDeleted( QgsFeatureId fid ); | | void featureFormAttributeChanged(); | |
| | | | |
| /** | | /** | |
| * Will be called periodically, when loading layers from slow data prov
iders. | | * Will be called periodically, when loading layers from slow data prov
iders. | |
| * | | * | |
| * @param i The number of features already loaded | | * @param i The number of features already loaded | |
| * @param cancel Set to true to cancel | | * @param cancel Set to true to cancel | |
| */ | | */ | |
| virtual void progress( int i, bool& cancel ); | | virtual void progress( int i, bool& cancel ); | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 249 | | skipping to change at line 226 | |
| virtual void finished(); | | virtual void finished(); | |
| | | | |
| private: | | private: | |
| void initLayerCache( QgsVectorLayer *layer ); | | void initLayerCache( QgsVectorLayer *layer ); | |
| void initModels( QgsMapCanvas* mapCanvas, const QgsFeatureRequest& requ
est ); | | void initModels( QgsMapCanvas* mapCanvas, const QgsFeatureRequest& requ
est ); | |
| | | | |
| QgsAttributeEditorContext mEditorContext; | | QgsAttributeEditorContext mEditorContext; | |
| QgsAttributeTableModel* mMasterModel; | | QgsAttributeTableModel* mMasterModel; | |
| QgsAttributeTableFilterModel* mFilterModel; | | QgsAttributeTableFilterModel* mFilterModel; | |
| QgsFeatureListModel* mFeatureListModel; | | QgsFeatureListModel* mFeatureListModel; | |
|
| QgsAttributeDialog* mAttributeDialog; | | QgsAttributeForm* mAttributeForm; | |
| QgsCachedFeatureIterator* mFeatureCache; | | QgsCachedFeatureIterator* mFeatureCache; | |
| QSignalMapper* mPreviewActionMapper; | | QSignalMapper* mPreviewActionMapper; | |
| QMenu* mPreviewColumnsMenu; | | QMenu* mPreviewColumnsMenu; | |
| QgsVectorLayerCache* mLayerCache; | | QgsVectorLayerCache* mLayerCache; | |
| QProgressDialog* mProgressDlg; | | QProgressDialog* mProgressDlg; | |
| QgsIFeatureSelectionManager* mFeatureSelectionManager; | | QgsIFeatureSelectionManager* mFeatureSelectionManager; | |
| QgsDistanceArea mDistanceArea; | | QgsDistanceArea mDistanceArea; | |
| | | | |
| friend class TestQgsDualView; | | friend class TestQgsDualView; | |
| }; | | }; | |
| | | | |
End of changes. 11 change blocks. |
| 37 lines changed or deleted | | 15 lines changed or added | |
|
| qgseditorwidgetwrapper.h | | qgseditorwidgetwrapper.h | |
| | | | |
| skipping to change at line 24 | | skipping to change at line 24 | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSEDITORWIDGETWRAPPER_H | | #ifndef QGSEDITORWIDGETWRAPPER_H | |
| #define QGSEDITORWIDGETWRAPPER_H | | #define QGSEDITORWIDGETWRAPPER_H | |
| | | | |
| #include <QObject> | | #include <QObject> | |
| #include <QMap> | | #include <QMap> | |
| #include <QVariant> | | #include <QVariant> | |
| | | | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
|
| | | class QgsField; | |
| | | | |
| #include "qgseditorwidgetconfig.h" | | #include "qgseditorwidgetconfig.h" | |
|
| | | #include "qgsattributeeditorcontext.h" | |
| | | #include "qgswidgetwrapper.h" | |
| | | | |
| /** | | /** | |
| * Manages an editor widget | | * Manages an editor widget | |
| * Widget and wrapper share the same parent | | * Widget and wrapper share the same parent | |
| * | | * | |
| * A wrapper controls one attribute editor widget and is able to create a d
efault | | * A wrapper controls one attribute editor widget and is able to create a d
efault | |
| * widget or use a pre-existent widget. It is able to set the widget to the
value implied | | * widget or use a pre-existent widget. It is able to set the widget to the
value implied | |
| * by a field of a vector layer, or return the value it currently holds. Ev
ery time it is changed | | * by a field of a vector layer, or return the value it currently holds. Ev
ery time it is changed | |
|
| * it has to emit a valueChanged signal (this does not yet mean, that the v | | * it has to emit a valueChanged signal. If it fails to do so, there is no | |
| alue is accepted). | | guarantee that the | |
| | | * changed status of the widget will be saved. | |
| * | | * | |
| */ | | */ | |
|
| class GUI_EXPORT QgsEditorWidgetWrapper : public QObject | | class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| public: | | public: | |
| /** | | /** | |
| * Create a new widget wrapper | | * Create a new widget wrapper | |
| * | | * | |
| * @param vl The layer on which the field is | | * @param vl The layer on which the field is | |
| * @param fieldIdx The field which will be controlled | | * @param fieldIdx The field which will be controlled | |
| * @param editor An editor widget. Can be NULL if one should be auto
generated. | | * @param editor An editor widget. Can be NULL if one should be auto
generated. | |
| * @param parent A parent widget for this widget wrapper and the cre
ated widget. | | * @param parent A parent widget for this widget wrapper and the cre
ated widget. | |
| */ | | */ | |
| explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWid
get* editor = 0, QWidget* parent = 0 ); | | explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWid
get* editor = 0, QWidget* parent = 0 ); | |
| | | | |
| /** | | /** | |
| * Will be used to access the widget's value. Read the value from the w
idget and | | * Will be used to access the widget's value. Read the value from the w
idget and | |
| * return it properly formatted to be saved in the attribute. | | * return it properly formatted to be saved in the attribute. | |
| * | | * | |
|
| | | * If an invalid variant is returned this will be interpreted as no cha | |
| | | nge. | |
| | | * Be sure to return a NULL QVariant if it should be set to NULL. | |
| | | * | |
| * @return The current value the widget represents | | * @return The current value the widget represents | |
| */ | | */ | |
| virtual QVariant value() = 0; | | virtual QVariant value() = 0; | |
| | | | |
| /** | | /** | |
|
| * @brief Access the widget managed by this wrapper | | * Access the field index. | |
| | | * | |
| | | * @return The index of the field you are working on | |
| * | | * | |
|
| * @return The widget | | * @see layer() | |
| */ | | */ | |
|
| QWidget* widget(); | | int fieldIdx(); | |
| | | | |
| /** | | /** | |
|
| * @brief Access the widget managed by this wrapper and cast it to a gi | | * Access the field. | |
| ven type | | * | |
| * Example: QPushButton* pb = wrapper->widget<QPushButton*>(); | | * @return The field you are working on | |
| * | | * | |
|
| * @return The widget as template type or NULL, if it cannot be cast to
this type. | | * @see layer() | |
| */ | | */ | |
|
| template <class T> | | QgsField field(); | |
| T* widget() { return dynamic_cast<T>( mWidget ); } | | | |
| | | | |
| /** | | /** | |
|
| * Will set the config of this wrapper to the specified config. | | * Will return a wrapper for a given widget | |
| * | | * @param widget The widget which was created by a wrapper | |
| * @param config The config for this wrapper | | * @return The wrapper for the widget or NULL | |
| */ | | */ | |
|
| void setConfig( const QgsEditorWidgetConfig& config ); | | static QgsEditorWidgetWrapper* fromWidget( QWidget* widget ); | |
| | | | |
| /** | | /** | |
|
| * Use this inside your overriden classes to access the configuration. | | * Is used to enable or disable the edit functionality of the managed w | |
| * | | idget. | |
| * @param key The configuration option you want to load | | * By default this will enable or disable the whole widget | |
| * @param defaultVal Default value | | | |
| * | | * | |
|
| * @return the value assigned to this configuration option | | * @param enabled Enable or Disable? | |
| */ | | */ | |
|
| QVariant config( QString key, QVariant defaultVal = QVariant() ); | | void setEnabled( bool enabled ); | |
| | | | |
|
| | | signals: | |
| /** | | /** | |
|
| * Returns the whole config | | * Emit this signal, whenever the value changed. | |
| * | | * | |
|
| * @return The configuration | | * @param value The new value | |
| */ | | */ | |
|
| const QgsEditorWidgetConfig config(); | | void valueChanged( const QVariant& value ); | |
| | | | |
|
| | | public slots: | |
| /** | | /** | |
|
| * Access the QgsVectorLayer, you are working on | | * Will be called when the feature changes | |
| * | | * | |
|
| * @return The layer | | * Is forwarded to the slot @link{setValue()} | |
| * | | * | |
|
| * @see field() | | * @param feature The new feature | |
| */ | | */ | |
|
| QgsVectorLayer* layer(); | | void setFeature( const QgsFeature& feature ); | |
| | | | |
| /** | | /** | |
|
| * Access the field index. | | * Is called, when the value of the widget needs to be changed. Update | |
| * | | the widget representation | |
| * @return The index of the field you are working on | | * to reflect the new value. | |
| * | | * | |
|
| * @see layer() | | * @param value The new value of the attribute | |
| */ | | */ | |
|
| int field(); | | virtual void setValue( const QVariant& value ) = 0; | |
| | | | |
|
| | | protected slots: | |
| /** | | /** | |
|
| * Will return a wrapper for a given widget | | * If you emit to this slot in your implementation, an appropriate chan | |
| * @param widget The widget which was created by a wrapper | | ge notification | |
| * @return The wrapper for the widget or NULL | | * will be broadcasted. Helper for string type widgets. | |
| | | * | |
| | | * @param value The value | |
| */ | | */ | |
|
| static QgsEditorWidgetWrapper* fromWidget( QWidget* widget ); | | void valueChanged( const QString& value ); | |
| | | | |
|
| protected: | | | |
| /** | | /** | |
|
| * This method should create a new widget with the provided parent. Thi | | * If you emit to this slot in your implementation, an appropriate chan | |
| s will only be called | | ge notification | |
| * if the form did not already provide a widget, so it is not guarantee | | * will be broadcasted. Helper for int type widgets. | |
| d to be called! | | | |
| * You should not do initialisation stuff, which also has to be done fo | | | |
| r custom editor | | | |
| * widgets inside this method. Things like filling comboboxes and assig | | | |
| ning other data which | | | |
| * will also be used to make widgets on forms created in the QtDesigner | | | |
| usable should be assigned | | | |
| * in {@link initWidget(QWidget*)}. | | | |
| * | | * | |
|
| * @param parent You should set this parent on the created widget. | | * @param value The value | |
| * @return A new widget | | * @note python name valueChangedInt | |
| */ | | */ | |
|
| virtual QWidget* createWidget( QWidget* parent ) = 0; | | void valueChanged( int value ); | |
| | | | |
| /** | | /** | |
|
| * This method should initialize the editor widget with runtime data. F | | * If you emit to this slot in your implementation, an appropriate chan | |
| ill your comboboxes here. | | ge notification | |
| | | * will be broadcasted. Helper for double type widgets. | |
| * | | * | |
|
| * @param editor The widget which will represent this attribute editor | | * @param value The value | |
| in a form. | | * @note python name valueChangedDouble | |
| */ | | */ | |
|
| virtual void initWidget( QWidget* editor ); | | void valueChanged( double value ); | |
| | | | |
|
| signals: | | | |
| /** | | /** | |
|
| * Emit this signal, whenever the value changed. | | * If you emit to this slot in your implementation, an appropriate chan | |
| | | ge notification | |
| | | * will be broadcasted. Helper for bool type widgets. | |
| * | | * | |
|
| * @param value The new value | | * @param value The value | |
| | | * @note python name valueChangedBool | |
| */ | | */ | |
|
| void valueChanged( const QVariant& value ); | | void valueChanged( bool value ); | |
| | | | |
|
| public slots: | | | |
| /** | | /** | |
|
| * Is called, when the value of the widget needs to be changed. Update | | * If you emit to this slot in your implementation, an appropriate chan | |
| the widget representation | | ge notification | |
| * to reflect the new value. | | * will be broadcasted. Helper for longlong type widgets. | |
| * | | * | |
|
| * @param value The new value of the attribute | | * @param value The value | |
| */ | | */ | |
|
| virtual void setValue( const QVariant& value ) = 0; | | void valueChanged( qlonglong value ); | |
| | | | |
| /** | | /** | |
|
| * Is used to enable or disable the edit functionality of the managed w | | * Will call the value() method to determine the emitted value | |
| idget. | | | |
| * By default this will enable or disable the whole widget | | | |
| * | | | |
| * @param enabled Enable or Disable? | | | |
| */ | | */ | |
|
| virtual void setEnabled( bool enabled ); | | void valueChanged(); | |
| | | | |
| private: | | private: | |
|
| QgsEditorWidgetConfig mConfig; | | int mFieldIdx; | |
| QWidget* mWidget; | | | |
| QWidget* mParent; | | | |
| QgsVectorLayer* mLayer; | | | |
| int mField; | | | |
| }; | | }; | |
| | | | |
| // We'll use this class inside a QVariant in the widgets properties | | // We'll use this class inside a QVariant in the widgets properties | |
| Q_DECLARE_METATYPE( QgsEditorWidgetWrapper* ) | | Q_DECLARE_METATYPE( QgsEditorWidgetWrapper* ) | |
| | | | |
| #endif // QGSEDITORWIDGETWRAPPER_H | | #endif // QGSEDITORWIDGETWRAPPER_H | |
| | | | |
End of changes. 49 change blocks. |
| 79 lines changed or deleted | | 77 lines changed or added | |
|
| qgsfillsymbollayerv2.h | | qgsfillsymbollayerv2.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
|
| qgsfillsymbollayerv2.h | | qgsfillsymbollayerv2.h | |
| --------------------- | | --------------------- | |
| begin : November 2009 | | begin : November 2009 | |
| copyright : (C) 2009 by Martin Dobias | | copyright : (C) 2009 by Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSFILLSYMBOLLAYERV2_H | | #ifndef QGSFILLSYMBOLLAYERV2_H | |
| #define QGSFILLSYMBOLLAYERV2_H | | #define QGSFILLSYMBOLLAYERV2_H | |
| | | | |
| #include "qgssymbollayerv2.h" | | #include "qgssymbollayerv2.h" | |
| | | | |
| #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255) | | #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255) | |
| #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern | | #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern | |
| #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor(0,0,0) | | #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor(0,0,0) | |
| #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine | | #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine | |
| #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH | | #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH | |
|
| | | #define DEFAULT_SIMPLEFILL_JOINSTYLE Qt::BevelJoin | |
| | | | |
| | | #define INF 1E20 | |
| | | | |
| #include <QPen> | | #include <QPen> | |
| #include <QBrush> | | #include <QBrush> | |
| | | | |
| class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2 | | class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2 | |
| { | | { | |
| public: | | public: | |
| QgsSimpleFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, | | QgsSimpleFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, | |
| Qt::BrushStyle style = DEFAULT_SIMPLEFILL_S
TYLE, | | Qt::BrushStyle style = DEFAULT_SIMPLEFILL_S
TYLE, | |
| QColor borderColor = DEFAULT_SIMPLEFILL_BOR
DERCOLOR, | | QColor borderColor = DEFAULT_SIMPLEFILL_BOR
DERCOLOR, | |
| Qt::PenStyle borderStyle = DEFAULT_SIMPLEFI
LL_BORDERSTYLE, | | Qt::PenStyle borderStyle = DEFAULT_SIMPLEFI
LL_BORDERSTYLE, | |
|
| double borderWidth = DEFAULT_SIMPLEFILL_BOR | | double borderWidth = DEFAULT_SIMPLEFILL_BOR | |
| DERWIDTH ); | | DERWIDTH, | |
| | | Qt::PenJoinStyle penJoinStyle = DEFAULT_SIM | |
| | | PLEFILL_JOINSTYLE | |
| | | ); | |
| | | | |
| // static stuff | | // static stuff | |
| | | | |
| static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt
ringMap() ); | | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt
ringMap() ); | |
| static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | | static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | |
| | | | |
| // implemented from base classes | | // implemented from base classes | |
| | | | |
| QString layerType() const; | | QString layerType() const; | |
| | | | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 93 | |
| /** Set fill color. | | /** Set fill color. | |
| * @note added in 2.1 */ | | * @note added in 2.1 */ | |
| void setFillColor( const QColor& color ) { setColor( color ); } | | void setFillColor( const QColor& color ) { setColor( color ); } | |
| | | | |
| Qt::PenStyle borderStyle() const { return mBorderStyle; } | | Qt::PenStyle borderStyle() const { return mBorderStyle; } | |
| void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = border
Style; } | | void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = border
Style; } | |
| | | | |
| double borderWidth() const { return mBorderWidth; } | | double borderWidth() const { return mBorderWidth; } | |
| void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth;
} | | void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth;
} | |
| | | | |
|
| | | Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; } | |
| | | void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; | |
| | | } | |
| | | | |
| void setOffset( QPointF offset ) { mOffset = offset; } | | void setOffset( QPointF offset ) { mOffset = offset; } | |
| QPointF offset() { return mOffset; } | | QPointF offset() { return mOffset; } | |
| | | | |
| void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit ) { mBorderWidthU
nit = unit; } | | void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit ) { mBorderWidthU
nit = unit; } | |
| QgsSymbolV2::OutputUnit borderWidthUnit() const { return mBorderWidthUn
it; } | | QgsSymbolV2::OutputUnit borderWidthUnit() const { return mBorderWidthUn
it; } | |
| | | | |
|
| | | void setBorderWidthMapUnitScale( const QgsMapUnitScale& scale ) { mBord | |
| | | erWidthMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& borderWidthMapUnitScale() const { return mBorder | |
| | | WidthMapUnitScale; } | |
| | | | |
| void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | |
| QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
|
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| double estimateMaxBleed() const; | | double estimateMaxBleed() const; | |
| | | | |
| double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext&
context ) const; | | double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext&
context ) const; | |
| QColor dxfColor( const QgsSymbolV2RenderContext& context ) const; | | QColor dxfColor( const QgsSymbolV2RenderContext& context ) const; | |
| Qt::PenStyle dxfPenStyle() const; | | Qt::PenStyle dxfPenStyle() const; | |
| | | | |
| protected: | | protected: | |
| QBrush mBrush; | | QBrush mBrush; | |
| QBrush mSelBrush; | | QBrush mSelBrush; | |
| Qt::BrushStyle mBrushStyle; | | Qt::BrushStyle mBrushStyle; | |
| QColor mBorderColor; | | QColor mBorderColor; | |
| Qt::PenStyle mBorderStyle; | | Qt::PenStyle mBorderStyle; | |
| double mBorderWidth; | | double mBorderWidth; | |
| QgsSymbolV2::OutputUnit mBorderWidthUnit; | | QgsSymbolV2::OutputUnit mBorderWidthUnit; | |
|
| | | QgsMapUnitScale mBorderWidthMapUnitScale; | |
| | | Qt::PenJoinStyle mPenJoinStyle; | |
| QPen mPen; | | QPen mPen; | |
| QPen mSelPen; | | QPen mSelPen; | |
| | | | |
| QPointF mOffset; | | QPointF mOffset; | |
| QgsSymbolV2::OutputUnit mOffsetUnit; | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
|
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| | | | |
| private: | | private: | |
| //helper functions for data defined symbology | | //helper functions for data defined symbology | |
| void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QBru
sh& brush, QPen& pen, QPen& selPen ); | | void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QBru
sh& brush, QPen& pen, QPen& selPen ); | |
| }; | | }; | |
| | | | |
| class QgsVectorColorRampV2; | | class QgsVectorColorRampV2; | |
| | | | |
| class CORE_EXPORT QgsGradientFillSymbolLayerV2 : public QgsFillSymbolLayerV
2 | | class CORE_EXPORT QgsGradientFillSymbolLayerV2 : public QgsFillSymbolLayerV
2 | |
| { | | { | |
| | | | |
| skipping to change at line 188 | | skipping to change at line 208 | |
| | | | |
| void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q
gsSymbolV2RenderContext& context ); | | void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q
gsSymbolV2RenderContext& context ); | |
| | | | |
| QgsStringMap properties() const; | | QgsStringMap properties() const; | |
| | | | |
| QgsSymbolLayerV2* clone() const; | | QgsSymbolLayerV2* clone() const; | |
| | | | |
| double estimateMaxBleed() const; | | double estimateMaxBleed() const; | |
| | | | |
| /**Type of gradient, eg linear or radial*/ | | /**Type of gradient, eg linear or radial*/ | |
|
| GradientType gradientType() const { return mGradientType; }; | | GradientType gradientType() const { return mGradientType; } | |
| void setGradientType( GradientType gradientType ) { mGradientType = gra | | void setGradientType( GradientType gradientType ) { mGradientType = gra | |
| dientType; }; | | dientType; } | |
| | | | |
| /**Gradient color mode, controls how gradient color stops are created*/ | | /**Gradient color mode, controls how gradient color stops are created*/ | |
|
| GradientColorType gradientColorType() const { return mGradientColorType | | GradientColorType gradientColorType() const { return mGradientColorType | |
| ; }; | | ; } | |
| void setGradientColorType( GradientColorType gradientColorType ) { mGra | | void setGradientColorType( GradientColorType gradientColorType ) { mGra | |
| dientColorType = gradientColorType; }; | | dientColorType = gradientColorType; } | |
| | | | |
| /**Color ramp used for the gradient fill, only used if the gradient col
or type is set to ColorRamp*/ | | /**Color ramp used for the gradient fill, only used if the gradient col
or type is set to ColorRamp*/ | |
|
| QgsVectorColorRampV2* colorRamp() { return mGradientRamp; }; | | QgsVectorColorRampV2* colorRamp() { return mGradientRamp; } | |
| void setColorRamp( QgsVectorColorRampV2* ramp ); | | void setColorRamp( QgsVectorColorRampV2* ramp ); | |
| | | | |
| /**Color for endpoint of gradient, only used if the gradient color type
is set to SimpleTwoColor*/ | | /**Color for endpoint of gradient, only used if the gradient color type
is set to SimpleTwoColor*/ | |
|
| QColor color2() const { return mColor2; }; | | QColor color2() const { return mColor2; } | |
| void setColor2( QColor color2 ) { mColor2 = color2; }; | | void setColor2( QColor color2 ) { mColor2 = color2; } | |
| | | | |
| /**Coordinate mode for gradient. Controls how the gradient stops are po
sitioned.*/ | | /**Coordinate mode for gradient. Controls how the gradient stops are po
sitioned.*/ | |
|
| GradientCoordinateMode coordinateMode() const { return mCoordinateMode; | | GradientCoordinateMode coordinateMode() const { return mCoordinateMode; | |
| }; | | } | |
| void setCoordinateMode( GradientCoordinateMode coordinateMode ) { mCoor | | void setCoordinateMode( GradientCoordinateMode coordinateMode ) { mCoor | |
| dinateMode = coordinateMode; }; | | dinateMode = coordinateMode; } | |
| | | | |
| /**Gradient spread mode. Controls how the gradient behaves outside of t
he predefined stops*/ | | /**Gradient spread mode. Controls how the gradient behaves outside of t
he predefined stops*/ | |
|
| GradientSpread gradientSpread() const { return mGradientSpread; }; | | GradientSpread gradientSpread() const { return mGradientSpread; } | |
| void setGradientSpread( GradientSpread gradientSpread ) { mGradientSpre | | void setGradientSpread( GradientSpread gradientSpread ) { mGradientSpre | |
| ad = gradientSpread; }; | | ad = gradientSpread; } | |
| | | | |
| /**Starting point of gradient fill, in the range [0,0] - [1,1]*/ | | /**Starting point of gradient fill, in the range [0,0] - [1,1]*/ | |
|
| void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = | | void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = | |
| referencePoint; }; | | referencePoint; } | |
| QPointF referencePoint1() const { return mReferencePoint1; }; | | QPointF referencePoint1() const { return mReferencePoint1; } | |
| | | | |
| /**Sets the starting point of the gradient to be the feature centroid*/ | | /**Sets the starting point of the gradient to be the feature centroid*/ | |
|
| void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1 | | void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1 | |
| IsCentroid = isCentroid; }; | | IsCentroid = isCentroid; } | |
| bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentr | | bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentr | |
| oid; }; | | oid; } | |
| | | | |
| /**End point of gradient fill, in the range [0,0] - [1,1]*/ | | /**End point of gradient fill, in the range [0,0] - [1,1]*/ | |
|
| void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = | | void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = | |
| referencePoint; }; | | referencePoint; } | |
| QPointF referencePoint2() const { return mReferencePoint2; }; | | QPointF referencePoint2() const { return mReferencePoint2; } | |
| | | | |
| /**Sets the end point of the gradient to be the feature centroid*/ | | /**Sets the end point of the gradient to be the feature centroid*/ | |
|
| void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2 | | void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2 | |
| IsCentroid = isCentroid; }; | | IsCentroid = isCentroid; } | |
| bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentr | | bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentr | |
| oid; }; | | oid; } | |
| | | | |
| /**Rotation angle for gradient fill. Can be used to rotate a gradient a
round its centre point*/ | | /**Rotation angle for gradient fill. Can be used to rotate a gradient a
round its centre point*/ | |
|
| void setAngle( double angle ) { mAngle = angle; }; | | void setAngle( double angle ) { mAngle = angle; } | |
| double angle() const { return mAngle; }; | | double angle() const { return mAngle; } | |
| | | | |
| /**Offset for gradient fill*/ | | /**Offset for gradient fill*/ | |
|
| void setOffset( QPointF offset ) { mOffset = offset; }; | | void setOffset( QPointF offset ) { mOffset = offset; } | |
| QPointF offset() const { return mOffset; }; | | QPointF offset() const { return mOffset; } | |
| | | | |
| /**Units for gradient fill offset*/ | | /**Units for gradient fill offset*/ | |
|
| void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | |
| ; }; | | ; } | |
| QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }; | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| protected: | | protected: | |
| QBrush mBrush; | | QBrush mBrush; | |
| QBrush mSelBrush; | | QBrush mSelBrush; | |
| | | | |
| GradientColorType mGradientColorType; | | GradientColorType mGradientColorType; | |
| QColor mColor2; | | QColor mColor2; | |
| QgsVectorColorRampV2* mGradientRamp; | | QgsVectorColorRampV2* mGradientRamp; | |
| GradientType mGradientType; | | GradientType mGradientType; | |
| GradientCoordinateMode mCoordinateMode; | | GradientCoordinateMode mCoordinateMode; | |
| GradientSpread mGradientSpread; | | GradientSpread mGradientSpread; | |
| | | | |
| QPointF mReferencePoint1; | | QPointF mReferencePoint1; | |
| bool mReferencePoint1IsCentroid; | | bool mReferencePoint1IsCentroid; | |
| QPointF mReferencePoint2; | | QPointF mReferencePoint2; | |
| bool mReferencePoint2IsCentroid; | | bool mReferencePoint2IsCentroid; | |
| double mAngle; | | double mAngle; | |
| | | | |
| QPointF mOffset; | | QPointF mOffset; | |
| QgsSymbolV2::OutputUnit mOffsetUnit; | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
|
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| | | | |
| private: | | private: | |
| | | | |
| //helper functions for data defined symbology | | //helper functions for data defined symbology | |
| void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, cons
t QPolygonF& points ); | | void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, cons
t QPolygonF& points ); | |
| | | | |
| /**Applies the gradient to a brush*/ | | /**Applies the gradient to a brush*/ | |
| void applyGradient( const QgsSymbolV2RenderContext& context, QBrush& br
ush, const QColor& color, const QColor& color2, | | void applyGradient( const QgsSymbolV2RenderContext& context, QBrush& br
ush, const QColor& color, const QColor& color2, | |
| const GradientColorType &gradientColorType, QgsVect
orColorRampV2 *gradientRamp, const GradientType &gradientType, | | const GradientColorType &gradientColorType, QgsVect
orColorRampV2 *gradientRamp, const GradientType &gradientType, | |
| const GradientCoordinateMode &coordinateMode, const
GradientSpread &gradientSpread, | | const GradientCoordinateMode &coordinateMode, const
GradientSpread &gradientSpread, | |
| const QPointF &referencePoint1, const QPointF &refe
rencePoint2, const double angle ); | | const QPointF &referencePoint1, const QPointF &refe
rencePoint2, const double angle ); | |
| | | | |
| /**rotates a reference point by a specified angle around the point (0.5
, 0.5)*/ | | /**rotates a reference point by a specified angle around the point (0.5
, 0.5)*/ | |
| QPointF rotateReferencePoint( const QPointF & refPoint, double angle ); | | QPointF rotateReferencePoint( const QPointF & refPoint, double angle ); | |
| }; | | }; | |
| | | | |
|
| | | class CORE_EXPORT QgsShapeburstFillSymbolLayerV2 : public QgsFillSymbolLaye | |
| | | rV2 | |
| | | { | |
| | | public: | |
| | | | |
| | | enum ShapeburstColorType | |
| | | { | |
| | | SimpleTwoColor, | |
| | | ColorRamp | |
| | | }; | |
| | | | |
| | | QgsShapeburstFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR | |
| | | , QColor color2 = Qt::white, | |
| | | ShapeburstColorType colorType = SimpleT | |
| | | woColor, | |
| | | int blurRadius = 0, bool useWholeShape | |
| | | = true, double maxDistance = 5 ); | |
| | | | |
| | | virtual ~QgsShapeburstFillSymbolLayerV2(); | |
| | | | |
| | | // static stuff | |
| | | | |
| | | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt | |
| | | ringMap() ); | |
| | | | |
| | | // implemented from base classes | |
| | | | |
| | | QString layerType() const; | |
| | | | |
| | | void startRender( QgsSymbolV2RenderContext& context ); | |
| | | | |
| | | void stopRender( QgsSymbolV2RenderContext& context ); | |
| | | | |
| | | void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q | |
| | | gsSymbolV2RenderContext& context ); | |
| | | | |
| | | QgsStringMap properties() const; | |
| | | | |
| | | QgsSymbolLayerV2* clone() const; | |
| | | | |
| | | double estimateMaxBleed() const; | |
| | | | |
| | | /**Sets the blur radius, which controls the amount of blurring applied | |
| | | to the fill. | |
| | | * @param blurRadius Radius for fill blur. Values between 0 - 17 are va | |
| | | lid, where higher values results in a stronger blur. Set to 0 to disable bl | |
| | | ur. | |
| | | * @note added in 2.3 | |
| | | * @see blurRadius | |
| | | */ | |
| | | void setBlurRadius( int blurRadius ) { mBlurRadius = blurRadius; } | |
| | | /**Returns the blur radius, which controls the amount of blurring appli | |
| | | ed to the fill. | |
| | | * @returns Integer representing the radius for fill blur. Higher value | |
| | | s indicate a stronger blur. A 0 value indicates that blurring is disabled. | |
| | | * @note added in 2.3 | |
| | | * @see setBlurRadius | |
| | | */ | |
| | | int blurRadius() const { return mBlurRadius; } | |
| | | | |
| | | /**Sets whether the shapeburst fill should be drawn using the entire sh | |
| | | ape. | |
| | | * @param useWholeShape Set to true if shapeburst should cover entire s | |
| | | hape. If false, setMaxDistance is used to calculate how far from the bounda | |
| | | ry of the shape should | |
| | | * be shaded | |
| | | * @note added in 2.3 | |
| | | * @see useWholeShape | |
| | | * @see setMaxDistance | |
| | | */ | |
| | | void setUseWholeShape( double useWholeShape ) { mUseWholeShape = useWho | |
| | | leShape; } | |
| | | /**Returns whether the shapeburst fill is set to cover the entire shape | |
| | | . | |
| | | * @returns True if shapeburst fill will cover the entire shape. If fal | |
| | | se, shapeburst is drawn to a distance of maxDistance from the polygon's bou | |
| | | ndary. | |
| | | * @note added in 2.3 | |
| | | * @see setUseWholeShape | |
| | | * @see maxDistance | |
| | | */ | |
| | | double useWholeShape() const { return mUseWholeShape; } | |
| | | | |
| | | /**Sets the maximum distance to shape inside of the shape from the poly | |
| | | gon's boundary. | |
| | | * @param maxDistance distance from boundary to shade. setUseWholeShape | |
| | | must be set to false for this parameter to take effect. Distance unit is c | |
| | | ontrolled by setDistanceUnit. | |
| | | * @note added in 2.3 | |
| | | * @see maxDistance | |
| | | * @see setUseWholeShape | |
| | | * @see setDistanceUnit | |
| | | */ | |
| | | void setMaxDistance( double maxDistance ) { mMaxDistance = maxDistance; | |
| | | } | |
| | | /**Returns the maximum distance from the shape's boundary which is shad | |
| | | ed. This parameter is only effective if useWholeShape is false. | |
| | | * @returns the maximum distance from the polygon's boundary which is s | |
| | | haded. Distance units are indicated by distanceUnit. | |
| | | * @note added in 2.3 | |
| | | * @see useWholeShape | |
| | | * @see setMaxDistance | |
| | | * @see distanceUnit | |
| | | */ | |
| | | double maxDistance() const { return mMaxDistance; } | |
| | | | |
| | | /**Sets the unit for the maximum distance to shade inside of the shape | |
| | | from the polygon's boundary. | |
| | | * @param unit distance unit for the maximum distance | |
| | | * @note added in 2.3 | |
| | | * @see setMaxDistance | |
| | | * @see distanceUnit | |
| | | */ | |
| | | void setDistanceUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceUnit = | |
| | | unit; } | |
| | | /**Returns the unit for the maximum distance to shade inside of the sha | |
| | | pe from the polygon's boundary. | |
| | | * @returns distance unit for the maximum distance | |
| | | * @note added in 2.3 | |
| | | * @see maxDistance | |
| | | * @see setDistanceUnit | |
| | | */ | |
| | | QgsSymbolV2::OutputUnit distanceUnit() const { return mDistanceUnit; } | |
| | | | |
| | | void setDistanceMapUnitScale( const QgsMapUnitScale& scale ) { mDistanc | |
| | | eMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& distanceMapUnitScale() const { return mDistanceM | |
| | | apUnitScale; } | |
| | | | |
| | | /**Sets the color mode to use for the shapeburst fill. Shapeburst can e | |
| | | ither be drawn using a QgsVectorColorRampV2 color ramp | |
| | | * or by simply specificing a start and end color. setColorType is used | |
| | | to specify which mode to use for the fill. | |
| | | * @param colorType color type to use for shapeburst fill | |
| | | * @note added in 2.3 | |
| | | * @see colorType | |
| | | * @see setColor | |
| | | * @see setColor2 | |
| | | * @see setColorRamp | |
| | | */ | |
| | | void setColorType( ShapeburstColorType colorType ) { mColorType = color | |
| | | Type; } | |
| | | /**Returns the color mode used for the shapeburst fill. Shapeburst can | |
| | | either be drawn using a QgsVectorColorRampV2 color ramp | |
| | | * or by simply specificing a start and end color. | |
| | | * @returns current color mode used for the shapeburst fill | |
| | | * @note added in 2.3 | |
| | | * @see setColorType | |
| | | * @see color | |
| | | * @see color2 | |
| | | * @see colorRamp | |
| | | */ | |
| | | ShapeburstColorType colorType() const { return mColorType; } | |
| | | | |
| | | /**Sets the color ramp used to draw the shapeburst fill. Color ramps ar | |
| | | e only used if setColorType is set ShapeburstColorType::ColorRamp. | |
| | | * @param ramp color ramp to use for shapeburst fill | |
| | | * @note added in 2.3 | |
| | | * @see setColorType | |
| | | * @see colorRamp | |
| | | */ | |
| | | void setColorRamp( QgsVectorColorRampV2* ramp ); | |
| | | /**Returns the color ramp used for the shapeburst fill. The color ramp | |
| | | is only used if the colorType is set to ShapeburstColorType::ColorRamp | |
| | | * @returns a QgsVectorColorRampV2 color ramp | |
| | | * @note added in 2.3 | |
| | | * @see setColorRamp | |
| | | * @see colorType | |
| | | */ | |
| | | QgsVectorColorRampV2* colorRamp() { return mGradientRamp; } | |
| | | | |
| | | /**Sets the color for the endpoint of the shapeburst fill. This color i | |
| | | s only used if setColorType is set ShapeburstColorType::SimpleTwoColor. | |
| | | * @param color2 QColor to use for endpoint of gradient | |
| | | * @note added in 2.3 | |
| | | * @see setColorType | |
| | | * @see color2 | |
| | | */ | |
| | | void setColor2( QColor color2 ) { mColor2 = color2; } | |
| | | /**Returns the color used for the endpoint of the shapeburst fill. This | |
| | | color is only used if the colorType is set to ShapeburstColorType::SimpleT | |
| | | woColor | |
| | | * @returns a QColor indicating the color of the endpoint of the gradie | |
| | | nt | |
| | | * @note added in 2.3 | |
| | | * @see setColor2 | |
| | | * @see colorType | |
| | | */ | |
| | | QColor color2() const { return mColor2; } | |
| | | | |
| | | /**Sets whether the shapeburst fill should ignore polygon rings when ca | |
| | | lculating | |
| | | * the buffered shading. | |
| | | * @param ignoreRings Set to true if buffers should ignore interior rin | |
| | | gs for polygons. | |
| | | * @note added in 2.3 | |
| | | * @see ignoreRings | |
| | | */ | |
| | | void setIgnoreRings( double ignoreRings ) { mIgnoreRings = ignoreRings; | |
| | | } | |
| | | /**Returns whether the shapeburst fill is set to ignore polygon interio | |
| | | r rings. | |
| | | * @returns True if the shapeburst fill will ignore interior rings when | |
| | | calculating buffered shading. | |
| | | * @note added in 2.3 | |
| | | * @see setIgnoreRings | |
| | | */ | |
| | | double ignoreRings() const { return mIgnoreRings; } | |
| | | | |
| | | /**Sets the offset for the shapeburst fill. | |
| | | * @param offset QPointF indicating the horizontal/vertical offset amou | |
| | | nt | |
| | | * @note added in 2.3 | |
| | | * @see offset | |
| | | * @see setOffsetUnit | |
| | | */ | |
| | | void setOffset( QPointF offset ) { mOffset = offset; } | |
| | | /**Returns the offset for the shapeburst fill. | |
| | | * @returns a QPointF indicating the horizontal/vertical offset amount | |
| | | * @note added in 2.3 | |
| | | * @see setOffset | |
| | | * @see offsetUnit | |
| | | */ | |
| | | QPointF offset() const { return mOffset; } | |
| | | | |
| | | /**Sets the units used for the offset for the shapeburst fill. | |
| | | * @param unit units for fill offset | |
| | | * @note added in 2.3 | |
| | | * @see setOffset | |
| | | * @see offsetUnit | |
| | | */ | |
| | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit | |
| | | ; } | |
| | | /**Returns the units used for the offset of the shapeburst fill. | |
| | | * @returns units used for the fill offset | |
| | | * @note added in 2.3 | |
| | | * @see offset | |
| | | * @see setOffsetUnit | |
| | | */ | |
| | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| | | protected: | |
| | | QBrush mBrush; | |
| | | QBrush mSelBrush; | |
| | | | |
| | | int mBlurRadius; | |
| | | | |
| | | bool mUseWholeShape; | |
| | | double mMaxDistance; | |
| | | QgsSymbolV2::OutputUnit mDistanceUnit; | |
| | | QgsMapUnitScale mDistanceMapUnitScale; | |
| | | | |
| | | ShapeburstColorType mColorType; | |
| | | QColor mColor2; | |
| | | QgsVectorColorRampV2* mGradientRamp; | |
| | | QgsVectorColorRampV2* mTwoColorGradientRamp; | |
| | | | |
| | | bool mIgnoreRings; | |
| | | | |
| | | QPointF mOffset; | |
| | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| | | | |
| | | private: | |
| | | | |
| | | //helper functions for data defined symbology | |
| | | void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QCol | |
| | | or& color, QColor& color2, int& blurRadius, bool& useWholeShape, | |
| | | double& maxDistance , bool &ignoreRings | |
| | | ); | |
| | | | |
| | | /* distance transform of a 1d function using squared distance */ | |
| | | void distanceTransform1d( double *f, int n, int *v, double *z, double * | |
| | | d ); | |
| | | /* distance transform of 2d function using squared distance */ | |
| | | void distanceTransform2d( double * im, int width, int height ); | |
| | | /* distance transform of a binary QImage */ | |
| | | double * distanceTransform( QImage * im ); | |
| | | | |
| | | /* fills a QImage with values from an array of doubles containing squar | |
| | | ed distance transform values */ | |
| | | void dtArrayToQImage( double * array, QImage *im, QgsVectorColorRampV2* | |
| | | ramp, double layerAlpha = 1, bool useWholeShape = true, int maxPixelDistan | |
| | | ce = 0 ); | |
| | | }; | |
| | | | |
| /**Base class for polygon renderers generating texture images*/ | | /**Base class for polygon renderers generating texture images*/ | |
| class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2 | | class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2 | |
| { | | { | |
| public: | | public: | |
| QgsImageFillSymbolLayer(); | | QgsImageFillSymbolLayer(); | |
| virtual ~QgsImageFillSymbolLayer(); | | virtual ~QgsImageFillSymbolLayer(); | |
| void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q
gsSymbolV2RenderContext& context ); | | void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, Q
gsSymbolV2RenderContext& context ); | |
| | | | |
| virtual QgsSymbolV2* subSymbol() { return mOutline; } | | virtual QgsSymbolV2* subSymbol() { return mOutline; } | |
| virtual bool setSubSymbol( QgsSymbolV2* symbol ); | | virtual bool setSubSymbol( QgsSymbolV2* symbol ); | |
| | | | |
| void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidt
hUnit = unit; } | | void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidt
hUnit = unit; } | |
| QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidth
Unit; } | | QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidth
Unit; } | |
| | | | |
|
| | | void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mOut | |
| | | lineWidthMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& outlineWidthMapUnitScale() const { return mOutli | |
| | | neWidthMapUnitScale; } | |
| | | | |
| | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
| | | void setMapUnitScale( const QgsMapUnitScale& scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| virtual double estimateMaxBleed() const; | | virtual double estimateMaxBleed() const; | |
| | | | |
| virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2Render
Context& context ) const; | | virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2Render
Context& context ) const; | |
| virtual QColor dxfColor( const QgsSymbolV2RenderContext& context ) cons
t; | | virtual QColor dxfColor( const QgsSymbolV2RenderContext& context ) cons
t; | |
| virtual Qt::PenStyle dxfPenStyle() const; | | virtual Qt::PenStyle dxfPenStyle() const; | |
| | | | |
| protected: | | protected: | |
| QBrush mBrush; | | QBrush mBrush; | |
| double mNextAngle; // mAngle / data defined angle | | double mNextAngle; // mAngle / data defined angle | |
| | | | |
| /**Outline width*/ | | /**Outline width*/ | |
| double mOutlineWidth; | | double mOutlineWidth; | |
| QgsSymbolV2::OutputUnit mOutlineWidthUnit; | | QgsSymbolV2::OutputUnit mOutlineWidthUnit; | |
|
| | | QgsMapUnitScale mOutlineWidthMapUnitScale; | |
| | | | |
| /**Custom outline*/ | | /**Custom outline*/ | |
| QgsLineSymbolV2* mOutline; | | QgsLineSymbolV2* mOutline; | |
| | | | |
| virtual void applyDataDefinedSettings( const QgsSymbolV2RenderContext&
context ) { Q_UNUSED( context ); } | | virtual void applyDataDefinedSettings( const QgsSymbolV2RenderContext&
context ) { Q_UNUSED( context ); } | |
| }; | | }; | |
| | | | |
| /**A class for svg fill patterns. The class automatically scales the patter
n to | | /**A class for svg fill patterns. The class automatically scales the patter
n to | |
| the appropriate pixel dimensions of the output device*/ | | the appropriate pixel dimensions of the output device*/ | |
| class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer | | class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer | |
| | | | |
| skipping to change at line 349 | | skipping to change at line 632 | |
| void setSvgFillColor( const QColor& c ) { mSvgFillColor = c; } | | void setSvgFillColor( const QColor& c ) { mSvgFillColor = c; } | |
| QColor svgFillColor() const { return mSvgFillColor; } | | QColor svgFillColor() const { return mSvgFillColor; } | |
| void setSvgOutlineColor( const QColor& c ) { mSvgOutlineColor = c; } | | void setSvgOutlineColor( const QColor& c ) { mSvgOutlineColor = c; } | |
| QColor svgOutlineColor() const { return mSvgOutlineColor; } | | QColor svgOutlineColor() const { return mSvgOutlineColor; } | |
| void setSvgOutlineWidth( double w ) { mSvgOutlineWidth = w; } | | void setSvgOutlineWidth( double w ) { mSvgOutlineWidth = w; } | |
| double svgOutlineWidth() const { return mSvgOutlineWidth; } | | double svgOutlineWidth() const { return mSvgOutlineWidth; } | |
| | | | |
| void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit ) { mPatternWidt
hUnit = unit; } | | void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit ) { mPatternWidt
hUnit = unit; } | |
| QgsSymbolV2::OutputUnit patternWidthUnit() const { return mPatternWidth
Unit; } | | QgsSymbolV2::OutputUnit patternWidthUnit() const { return mPatternWidth
Unit; } | |
| | | | |
|
| | | void setPatternWidthMapUnitScale( const QgsMapUnitScale& scale ) { mPat | |
| | | ternWidthMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& patternWidthMapUnitScale() const { return mPatte | |
| | | rnWidthMapUnitScale; } | |
| | | | |
| void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSvgOutli
neWidthUnit = unit; } | | void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSvgOutli
neWidthUnit = unit; } | |
| QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const { return mSvgOutlin
eWidthUnit; } | | QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const { return mSvgOutlin
eWidthUnit; } | |
| | | | |
|
| | | void setSvgOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { m | |
| | | SvgOutlineWidthMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& svgOutlineWidthMapUnitScale() const { return mSv | |
| | | gOutlineWidthMapUnitScale; } | |
| | | | |
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| protected: | | protected: | |
| /**Width of the pattern (in output units)*/ | | /**Width of the pattern (in output units)*/ | |
| double mPatternWidth; | | double mPatternWidth; | |
| QgsSymbolV2::OutputUnit mPatternWidthUnit; | | QgsSymbolV2::OutputUnit mPatternWidthUnit; | |
|
| | | QgsMapUnitScale mPatternWidthMapUnitScale; | |
| | | | |
| /**SVG data*/ | | /**SVG data*/ | |
| QByteArray mSvgData; | | QByteArray mSvgData; | |
| /**Path to the svg file (or empty if constructed directly from data)*/ | | /**Path to the svg file (or empty if constructed directly from data)*/ | |
| QString mSvgFilePath; | | QString mSvgFilePath; | |
| /**SVG view box (to keep the aspect ratio */ | | /**SVG view box (to keep the aspect ratio */ | |
| QRectF mSvgViewBox; | | QRectF mSvgViewBox; | |
| /** SVG pattern image | | /** SVG pattern image | |
| * @note added in 1.9 */ | | * @note added in 1.9 */ | |
| QImage* mSvgPattern; | | QImage* mSvgPattern; | |
| | | | |
| //param(fill), param(outline), param(outline-width) are going | | //param(fill), param(outline), param(outline-width) are going | |
| //to be replaced in memory | | //to be replaced in memory | |
| QColor mSvgFillColor; | | QColor mSvgFillColor; | |
| QColor mSvgOutlineColor; | | QColor mSvgOutlineColor; | |
| double mSvgOutlineWidth; | | double mSvgOutlineWidth; | |
| QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit; | | QgsSymbolV2::OutputUnit mSvgOutlineWidthUnit; | |
|
| | | QgsMapUnitScale mSvgOutlineWidthMapUnitScale; | |
| | | | |
| void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context
); | | void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context
); | |
| | | | |
| private: | | private: | |
| /**Helper function that gets the view box from the byte array*/ | | /**Helper function that gets the view box from the byte array*/ | |
| void storeViewBox(); | | void storeViewBox(); | |
| void setDefaultSvgParams(); //fills mSvgFillColor, mSvgOutlineColor, mS
vgOutlineWidth with default values for mSvgFilePath | | void setDefaultSvgParams(); //fills mSvgFillColor, mSvgOutlineColor, mS
vgOutlineWidth with default values for mSvgFilePath | |
| | | | |
| /**Applies the svg pattern to the brush*/ | | /**Applies the svg pattern to the brush*/ | |
| void applyPattern( QBrush& brush, const QString& svgFilePath, double pa
tternWidth, QgsSymbolV2::OutputUnit patternWidthUnit, const QColor& svgFill
Color, const QColor& svgOutlineColor, | | void applyPattern( QBrush& brush, const QString& svgFilePath, double pa
tternWidth, QgsSymbolV2::OutputUnit patternWidthUnit, const QColor& svgFill
Color, const QColor& svgOutlineColor, | |
|
| double svgOutlineWidth, QgsSymbolV2::OutputUnit svgO
utlineWidthUnit, const QgsSymbolV2RenderContext& context ); | | double svgOutlineWidth, QgsSymbolV2::OutputUnit svgO
utlineWidthUnit, const QgsSymbolV2RenderContext& context, const QgsMapUnitS
cale& patternWidthMapUnitScale , const QgsMapUnitScale &svgOutlineWidthMapU
nitScale ); | |
| }; | | }; | |
| | | | |
| class CORE_EXPORT QgsLinePatternFillSymbolLayer: public QgsImageFillSymbolL
ayer | | class CORE_EXPORT QgsLinePatternFillSymbolLayer: public QgsImageFillSymbolL
ayer | |
| { | | { | |
| public: | | public: | |
| QgsLinePatternFillSymbolLayer(); | | QgsLinePatternFillSymbolLayer(); | |
| ~QgsLinePatternFillSymbolLayer(); | | ~QgsLinePatternFillSymbolLayer(); | |
| | | | |
| static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt
ringMap() ); | | static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsSt
ringMap() ); | |
| static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | | static QgsSymbolLayerV2* createFromSld( QDomElement &element ); | |
| | | | |
| skipping to change at line 429 | | skipping to change at line 723 | |
| void setLineWidth( double w ); | | void setLineWidth( double w ); | |
| double lineWidth() const { return mLineWidth; } | | double lineWidth() const { return mLineWidth; } | |
| void setColor( const QColor& c ); | | void setColor( const QColor& c ); | |
| QColor color() const { return mColor; } | | QColor color() const { return mColor; } | |
| void setOffset( double offset ) { mOffset = offset; } | | void setOffset( double offset ) { mOffset = offset; } | |
| double offset() const { return mOffset; } | | double offset() const { return mOffset; } | |
| | | | |
| void setDistanceUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceUnit =
unit; } | | void setDistanceUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceUnit =
unit; } | |
| QgsSymbolV2::OutputUnit distanceUnit() const { return mDistanceUnit; } | | QgsSymbolV2::OutputUnit distanceUnit() const { return mDistanceUnit; } | |
| | | | |
|
| | | void setDistanceMapUnitScale( const QgsMapUnitScale& scale ) { mDistanc | |
| | | eMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& distanceMapUnitScale() const { return mDistanceM | |
| | | apUnitScale; } | |
| | | | |
| void setLineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mLineWidthUnit
= unit; } | | void setLineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mLineWidthUnit
= unit; } | |
| QgsSymbolV2::OutputUnit lineWidthUnit() const { return mLineWidthUnit;
} | | QgsSymbolV2::OutputUnit lineWidthUnit() const { return mLineWidthUnit;
} | |
| | | | |
|
| | | void setLineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mLineWi | |
| | | dthMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& lineWidthMapUnitScale() const { return mLineWidt | |
| | | hMapUnitScale; } | |
| | | | |
| void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | |
| QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
|
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale& scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| bool setSubSymbol( QgsSymbolV2* symbol ); | | bool setSubSymbol( QgsSymbolV2* symbol ); | |
| QgsSymbolV2* subSymbol(); | | QgsSymbolV2* subSymbol(); | |
| | | | |
| protected: | | protected: | |
| /**Distance (in mm or map units) between lines*/ | | /**Distance (in mm or map units) between lines*/ | |
| double mDistance; | | double mDistance; | |
| QgsSymbolV2::OutputUnit mDistanceUnit; | | QgsSymbolV2::OutputUnit mDistanceUnit; | |
|
| | | QgsMapUnitScale mDistanceMapUnitScale; | |
| /**Line width (in mm or map units)*/ | | /**Line width (in mm or map units)*/ | |
| double mLineWidth; | | double mLineWidth; | |
| QgsSymbolV2::OutputUnit mLineWidthUnit; | | QgsSymbolV2::OutputUnit mLineWidthUnit; | |
|
| | | QgsMapUnitScale mLineWidthMapUnitScale; | |
| QColor mColor; | | QColor mColor; | |
| /**Vector line angle in degrees (0 = horizontal, counterclockwise)*/ | | /**Vector line angle in degrees (0 = horizontal, counterclockwise)*/ | |
| double mLineAngle; | | double mLineAngle; | |
| /**Offset perpendicular to line direction*/ | | /**Offset perpendicular to line direction*/ | |
| double mOffset; | | double mOffset; | |
| QgsSymbolV2::OutputUnit mOffsetUnit; | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
|
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| | | | |
| void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context
); | | void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context
); | |
| | | | |
| private: | | private: | |
| /**Applies the svg pattern to the brush*/ | | /**Applies the svg pattern to the brush*/ | |
| void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& bru
sh, double lineAngle, double distance, double lineWidth, const QColor& colo
r ); | | void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& bru
sh, double lineAngle, double distance, double lineWidth, const QColor& colo
r ); | |
| | | | |
| /**Fill line*/ | | /**Fill line*/ | |
| QgsLineSymbolV2* mFillLineSymbol; | | QgsLineSymbolV2* mFillLineSymbol; | |
| }; | | }; | |
| | | | |
| skipping to change at line 507 | | skipping to change at line 816 | |
| | | | |
| double displacementY() const { return mDisplacementY; } | | double displacementY() const { return mDisplacementY; } | |
| void setDisplacementY( double d ) { mDisplacementY = d; } | | void setDisplacementY( double d ) { mDisplacementY = d; } | |
| | | | |
| bool setSubSymbol( QgsSymbolV2* symbol ); | | bool setSubSymbol( QgsSymbolV2* symbol ); | |
| virtual QgsSymbolV2* subSymbol() { return mMarkerSymbol; } | | virtual QgsSymbolV2* subSymbol() { return mMarkerSymbol; } | |
| | | | |
| void setDistanceXUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceXUnit
= unit; } | | void setDistanceXUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceXUnit
= unit; } | |
| QgsSymbolV2::OutputUnit distanceXUnit() const { return mDistanceXUnit;
} | | QgsSymbolV2::OutputUnit distanceXUnit() const { return mDistanceXUnit;
} | |
| | | | |
|
| | | void setDistanceXMapUnitScale( const QgsMapUnitScale& scale ) { mDistan | |
| | | ceXMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& distanceXMapUnitScale() const { return mDistance | |
| | | XMapUnitScale; } | |
| | | | |
| void setDistanceYUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceYUnit
= unit; } | | void setDistanceYUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceYUnit
= unit; } | |
| QgsSymbolV2::OutputUnit distanceYUnit() const { return mDistanceYUnit;
} | | QgsSymbolV2::OutputUnit distanceYUnit() const { return mDistanceYUnit;
} | |
| | | | |
|
| | | void setDistanceYMapUnitScale( const QgsMapUnitScale& scale ) { mDistan | |
| | | ceYMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& distanceYMapUnitScale() const { return mDistance | |
| | | YMapUnitScale; } | |
| | | | |
| void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit ) { mDisplaceme
ntXUnit = unit; } | | void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit ) { mDisplaceme
ntXUnit = unit; } | |
| QgsSymbolV2::OutputUnit displacementXUnit() const { return mDisplacemen
tXUnit; } | | QgsSymbolV2::OutputUnit displacementXUnit() const { return mDisplacemen
tXUnit; } | |
| | | | |
|
| | | void setDisplacementXMapUnitScale( const QgsMapUnitScale& scale ) { mDi | |
| | | splacementXMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& displacementXMapUnitScale() const { return mDisp | |
| | | lacementXMapUnitScale; } | |
| | | | |
| void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit ) { mDisplaceme
ntYUnit = unit; } | | void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit ) { mDisplaceme
ntYUnit = unit; } | |
| QgsSymbolV2::OutputUnit displacementYUnit() const { return mDisplacemen
tYUnit; } | | QgsSymbolV2::OutputUnit displacementYUnit() const { return mDisplacemen
tYUnit; } | |
| | | | |
|
| | | void setDisplacementYMapUnitScale( const QgsMapUnitScale& scale ) { mDi | |
| | | splacementYMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& displacementYMapUnitScale() const { return mDisp | |
| | | lacementYMapUnitScale; } | |
| | | | |
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| virtual QSet<QString> usedAttributes() const; | | virtual QSet<QString> usedAttributes() const; | |
| | | | |
| protected: | | protected: | |
| QgsMarkerSymbolV2* mMarkerSymbol; | | QgsMarkerSymbolV2* mMarkerSymbol; | |
| double mDistanceX; | | double mDistanceX; | |
| QgsSymbolV2::OutputUnit mDistanceXUnit; | | QgsSymbolV2::OutputUnit mDistanceXUnit; | |
|
| | | QgsMapUnitScale mDistanceXMapUnitScale; | |
| double mDistanceY; | | double mDistanceY; | |
| QgsSymbolV2::OutputUnit mDistanceYUnit; | | QgsSymbolV2::OutputUnit mDistanceYUnit; | |
|
| | | QgsMapUnitScale mDistanceYMapUnitScale; | |
| double mDisplacementX; | | double mDisplacementX; | |
| QgsSymbolV2::OutputUnit mDisplacementXUnit; | | QgsSymbolV2::OutputUnit mDisplacementXUnit; | |
|
| | | QgsMapUnitScale mDisplacementXMapUnitScale; | |
| double mDisplacementY; | | double mDisplacementY; | |
| QgsSymbolV2::OutputUnit mDisplacementYUnit; | | QgsSymbolV2::OutputUnit mDisplacementYUnit; | |
|
| | | QgsMapUnitScale mDisplacementYMapUnitScale; | |
| | | | |
| void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context
); | | void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context
); | |
| | | | |
| private: | | private: | |
| void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& bru
sh, double distanceX, double distanceY, | | void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& bru
sh, double distanceX, double distanceY, | |
| double displacementX, double displacementY ); | | double displacementX, double displacementY ); | |
| }; | | }; | |
| | | | |
| class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV
2 | | class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV
2 | |
| { | | { | |
| | | | |
| skipping to change at line 571 | | skipping to change at line 899 | |
| | | | |
| QgsSymbolLayerV2* clone() const; | | QgsSymbolLayerV2* clone() const; | |
| | | | |
| void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props
) const; | | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props
) const; | |
| | | | |
| void setColor( const QColor& color ); | | void setColor( const QColor& color ); | |
| | | | |
| QgsSymbolV2* subSymbol(); | | QgsSymbolV2* subSymbol(); | |
| bool setSubSymbol( QgsSymbolV2* symbol ); | | bool setSubSymbol( QgsSymbolV2* symbol ); | |
| | | | |
|
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ) { Q_UNUSED( unit );
} | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| virtual QSet<QString> usedAttributes() const; | | virtual QSet<QString> usedAttributes() const; | |
| | | | |
|
| | | void setPointOnSurface( bool pointOnSurface ) { mPointOnSurface = point | |
| | | OnSurface; } | |
| | | bool pointOnSurface() const { return mPointOnSurface; } | |
| | | | |
| protected: | | protected: | |
| QgsMarkerSymbolV2* mMarker; | | QgsMarkerSymbolV2* mMarker; | |
|
| | | bool mPointOnSurface; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 52 change blocks. |
| 47 lines changed or deleted | | 465 lines changed or added | |
|
| qgsgeometry.h | | qgsgeometry.h | |
| | | | |
| skipping to change at line 358 | | skipping to change at line 358 | |
| bool within( const QgsGeometry* geometry ) const; | | bool within( const QgsGeometry* geometry ) const; | |
| | | | |
| /** Test for if geometry crosses another (uses GEOS) | | /** Test for if geometry crosses another (uses GEOS) | |
| * @note added in 1.5 */ | | * @note added in 1.5 */ | |
| bool crosses( const QgsGeometry* geometry ) const; | | bool crosses( const QgsGeometry* geometry ) const; | |
| | | | |
| /** Returns a buffer region around this geometry having the given width
and with a specified number | | /** Returns a buffer region around this geometry having the given width
and with a specified number | |
| of segments used to approximate curves */ | | of segments used to approximate curves */ | |
| QgsGeometry* buffer( double distance, int segments ); | | QgsGeometry* buffer( double distance, int segments ); | |
| | | | |
|
| | | /** Returns a buffer region around the geometry, with additional style | |
| | | options. | |
| | | * @param distance buffer distance | |
| | | * @param segments For round joins, number of segments to approximat | |
| | | e quarter-circle | |
| | | * @param endCapStyle Round (1) / Flat (2) / Square (3) end cap style | |
| | | * @param joinStyle Round (1) / Mitre (2) / Bevel (3) join style | |
| | | * @param mitreLimit Limit on the mitre ratio used for very sharp corn | |
| | | ers | |
| | | * @note added in 2.4 | |
| | | * @note needs GEOS >= 3.3 - otherwise always returns 0 | |
| | | */ | |
| | | QgsGeometry* buffer( double distance, int segments, int endCapStyle, in | |
| | | t joinStyle, double mitreLimit ); | |
| | | | |
| | | /** Returns an offset line at a given distance and side from an input l | |
| | | ine. | |
| | | * See buffer() method for details on parameters. | |
| | | * @note added in 2.4 | |
| | | * @note needs GEOS >= 3.3 - otherwise always returns 0 | |
| | | */ | |
| | | QgsGeometry* offsetCurve( double distance, int segments, int joinStyle, | |
| | | double mitreLimit ); | |
| | | | |
| /** Returns a simplified version of this geometry using a specified tol
erance value */ | | /** Returns a simplified version of this geometry using a specified tol
erance value */ | |
| QgsGeometry* simplify( double tolerance ); | | QgsGeometry* simplify( double tolerance ); | |
| | | | |
| /** Returns the center of mass of a geometry | | /** Returns the center of mass of a geometry | |
| * @note for line based geometries, the center point of the line is retu
rned, | | * @note for line based geometries, the center point of the line is retu
rned, | |
| * and for point based geometries, the point itself is returned */ | | * and for point based geometries, the point itself is returned */ | |
| QgsGeometry* centroid(); | | QgsGeometry* centroid(); | |
| | | | |
|
| | | /** Returns a point within a geometry */ | |
| | | QgsGeometry* pointOnSurface(); | |
| | | | |
| /** Returns the smallest convex polygon that contains all the points in
the geometry. */ | | /** Returns the smallest convex polygon that contains all the points in
the geometry. */ | |
| QgsGeometry* convexHull(); | | QgsGeometry* convexHull(); | |
| | | | |
| /* Return interpolated point on line at distance | | /* Return interpolated point on line at distance | |
| * @note added in 1.9 | | * @note added in 1.9 | |
| */ | | */ | |
| QgsGeometry* interpolate( double distance ); | | QgsGeometry* interpolate( double distance ); | |
| | | | |
| /** Returns a geometry representing the points shared by this geometry
and other. */ | | /** Returns a geometry representing the points shared by this geometry
and other. */ | |
| QgsGeometry* intersection( QgsGeometry* geometry ); | | QgsGeometry* intersection( QgsGeometry* geometry ); | |
| | | | |
| skipping to change at line 400 | | skipping to change at line 421 | |
| */ | | */ | |
| QString exportToWkt() const; | | QString exportToWkt() const; | |
| | | | |
| /** Exports the geometry to mGeoJSON | | /** Exports the geometry to mGeoJSON | |
| * @return true in case of success and false else | | * @return true in case of success and false else | |
| * @note added in 1.8 | | * @note added in 1.8 | |
| * @note python binding added in 1.9 | | * @note python binding added in 1.9 | |
| */ | | */ | |
| QString exportToGeoJSON() const; | | QString exportToGeoJSON() const; | |
| | | | |
|
| | | /** try to convert the geometry to the requested type | |
| | | * @param destType the geometry type to be converted to | |
| | | * @param destMultipart determines if the output geometry will be multi | |
| | | part or not | |
| | | * @return the converted geometry or NULL pointer if the conversion fai | |
| | | ls. | |
| | | * @note added in 2.2 | |
| | | */ | |
| | | QgsGeometry* convertToType( QGis::GeometryType destType, bool destMulti | |
| | | part = false ); | |
| | | | |
| /* Accessor functions for getting geometry data */ | | /* Accessor functions for getting geometry data */ | |
| | | | |
| /** return contents of the geometry as a point | | /** return contents of the geometry as a point | |
| if wkbType is WKBPoint, otherwise returns [0,0] */ | | if wkbType is WKBPoint, otherwise returns [0,0] */ | |
| QgsPoint asPoint() const; | | QgsPoint asPoint() const; | |
| | | | |
| /** return contents of the geometry as a polyline | | /** return contents of the geometry as a polyline | |
| if wkbType is WKBLineString, otherwise an empty list */ | | if wkbType is WKBLineString, otherwise an empty list */ | |
| QgsPolyline asPolyline() const; | | QgsPolyline asPolyline() const; | |
| | | | |
| | | | |
| skipping to change at line 477 | | skipping to change at line 506 | |
| QgsPoint where() { return location; } | | QgsPoint where() { return location; } | |
| bool hasWhere() { return hasLocation; } | | bool hasWhere() { return hasLocation; } | |
| }; | | }; | |
| | | | |
| /** Validate geometry and produce a list of geometry errors | | /** Validate geometry and produce a list of geometry errors | |
| * @note added in 1.5 | | * @note added in 1.5 | |
| * @note python binding added in 1.6 | | * @note python binding added in 1.6 | |
| **/ | | **/ | |
| void validateGeometry( QList<Error> &errors ); | | void validateGeometry( QList<Error> &errors ); | |
| | | | |
|
| | | /** compute the unary union on a list of geometries. May be faster than | |
| | | an iterative union on a set of geometries. | |
| | | @param geometryList a list of QgsGeometry* as input | |
| | | @returns the new computed QgsGeometry, or null | |
| | | */ | |
| | | static QgsGeometry *unaryUnion( const QList<QgsGeometry*>& geometryList | |
| | | ); | |
| | | | |
| private: | | private: | |
| // Private variables | | // Private variables | |
| | | | |
| // All of these are mutable since there may be on-the-fly | | // All of these are mutable since there may be on-the-fly | |
| // conversions between WKB, GEOS and Wkt; | | // conversions between WKB, GEOS and Wkt; | |
| // However the intent is the const functions do not | | // However the intent is the const functions do not | |
| // semantically change the value that this object represents. | | // semantically change the value that this object represents. | |
| | | | |
| /** pointer to geometry in binary WKB format | | /** pointer to geometry in binary WKB format | |
| This is the class' native implementation | | This is the class' native implementation | |
| | | | |
| skipping to change at line 555 | | skipping to change at line 590 | |
| //helper functions for geometry splitting | | //helper functions for geometry splitting | |
| | | | |
| /**Splits line/multiline geometries | | /**Splits line/multiline geometries | |
| @param splitLine the line that splits the feature | | @param splitLine the line that splits the feature | |
| @param newGeometries new geometries if splitting was successful | | @param newGeometries new geometries if splitting was successful | |
| @return 0 in case of success, 1 if geometry has not been split, error
else*/ | | @return 0 in case of success, 1 if geometry has not been split, error
else*/ | |
| int splitLinearGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>&
newGeometries ); | | int splitLinearGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>&
newGeometries ); | |
| /**Splits polygon/multipolygon geometries | | /**Splits polygon/multipolygon geometries | |
| @return 0 in case of success, 1 if geometry has not been split, erro
r else*/ | | @return 0 in case of success, 1 if geometry has not been split, erro
r else*/ | |
| int splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>&
newGeometries ); | | int splitPolygonGeometry( GEOSGeometry *splitLine, QList<QgsGeometry*>&
newGeometries ); | |
|
| | | /**Splits line/multiline geometries following a single point*/ | |
| | | GEOSGeometry* linePointDifference( GEOSGeometry* GEOSsplitPoint ); | |
| | | | |
| /**Finds out the points that need to be tested for topological correctn
es if this geometry will be split | | /**Finds out the points that need to be tested for topological correctn
es if this geometry will be split | |
| @return 0 in case of success*/ | | @return 0 in case of success*/ | |
| int topologicalTestPointsSplit( const GEOSGeometry* splitLine, QList<Qg
sPoint>& testPoints ) const; | | int topologicalTestPointsSplit( const GEOSGeometry* splitLine, QList<Qg
sPoint>& testPoints ) const; | |
| | | | |
| /**Creates a new line from an original line and a reshape line. The par
t of the input line from the first to the last intersection with the | | /**Creates a new line from an original line and a reshape line. The par
t of the input line from the first to the last intersection with the | |
| reshape line will be replaced. The calling function takes ownership
of the result. | | reshape line will be replaced. The calling function takes ownership
of the result. | |
| @param origLine the original line | | @param origLine the original line | |
| @param reshapeLineGeos the reshape line | | @param reshapeLineGeos the reshape line | |
| @return the reshaped line or 0 in case of error*/ | | @return the reshaped line or 0 in case of error*/ | |
| static GEOSGeometry* reshapeLine( const GEOSGeometry* origLine, const G
EOSGeometry* reshapeLineGeos ); | | static GEOSGeometry* reshapeLine( const GEOSGeometry* origLine, const G
EOSGeometry* reshapeLineGeos ); | |
| | | | |
| skipping to change at line 587 | | skipping to change at line 625 | |
| /**Tests if line1 is completely contained in line2. This method works w
ith a very small buffer around line2 and therefore is less prone | | /**Tests if line1 is completely contained in line2. This method works w
ith a very small buffer around line2 and therefore is less prone | |
| to numerical errors as the corresponding geos method*/ | | to numerical errors as the corresponding geos method*/ | |
| static int lineContainedInLine( const GEOSGeometry* line1, const GEOSGe
ometry* line2 ); | | static int lineContainedInLine( const GEOSGeometry* line1, const GEOSGe
ometry* line2 ); | |
| | | | |
| /**Tests if a point is on a line. This method works with a very small b
uffer and is thus less prone to numerical problems as the direct geos funct
ions. | | /**Tests if a point is on a line. This method works with a very small b
uffer and is thus less prone to numerical problems as the direct geos funct
ions. | |
| @param point the point to test | | @param point the point to test | |
| @param line line to test | | @param line line to test | |
| @return 0 not contained, 1 if contained, <0 in case of error*/ | | @return 0 not contained, 1 if contained, <0 in case of error*/ | |
| static int pointContainedInLine( const GEOSGeometry* point, const GEOSG
eometry* line ); | | static int pointContainedInLine( const GEOSGeometry* point, const GEOSG
eometry* line ); | |
| | | | |
|
| /**Tests if geom bounding rect is within -180 <= x <= 180, -90 <= y <= | | /** Determines the maximum number of digits before the dot */ | |
| 90. Other methods may use more accurate tolerances if this is true*/ | | static int geomDigits( const GEOSGeometry* geom ); | |
| static bool geomInDegrees( const GEOSGeometry* geom ); | | | |
| | | | |
| /**Returns number of single geometry in a geos geometry. Is save for ge
os 2 and 3*/ | | /**Returns number of single geometry in a geos geometry. Is save for ge
os 2 and 3*/ | |
| int numberOfGeometries( GEOSGeometry* g ) const; | | int numberOfGeometries( GEOSGeometry* g ) const; | |
| | | | |
| int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult
); | | int mergeGeometriesMultiTypeSplit( QVector<GEOSGeometry*>& splitResult
); | |
| | | | |
| /** return point from wkb */ | | /** return point from wkb */ | |
| QgsPoint asPoint( QgsConstWkbPtr &wkbPtr, bool hasZValue ) const; | | QgsPoint asPoint( QgsConstWkbPtr &wkbPtr, bool hasZValue ) const; | |
| | | | |
| /** return polyline from wkb */ | | /** return polyline from wkb */ | |
| | | | |
| skipping to change at line 611 | | skipping to change at line 649 | |
| /** return polygon from wkb */ | | /** return polygon from wkb */ | |
| QgsPolygon asPolygon( QgsConstWkbPtr &wkbPtr, bool hasZValue ) const; | | QgsPolygon asPolygon( QgsConstWkbPtr &wkbPtr, bool hasZValue ) const; | |
| | | | |
| static bool geosRelOp( char( *op )( const GEOSGeometry*, const GEOSGeom
etry * ), | | static bool geosRelOp( char( *op )( const GEOSGeometry*, const GEOSGeom
etry * ), | |
| const QgsGeometry* a, const QgsGeometry* b ); | | const QgsGeometry* a, const QgsGeometry* b ); | |
| | | | |
| /**Returns < 0 if point(x/y) is left of the line x1,y1 -> x1,y2*/ | | /**Returns < 0 if point(x/y) is left of the line x1,y1 -> x1,y2*/ | |
| double leftOf( double x, double y, double& x1, double& y1, double& x2,
double& y2 ); | | double leftOf( double x, double y, double& x1, double& y1, double& x2,
double& y2 ); | |
| | | | |
| static inline bool moveVertex( QgsWkbPtr &wkbPtr, const double &x, cons
t double &y, int atVertex, bool hasZValue, int &pointIndex, bool isRing ); | | static inline bool moveVertex( QgsWkbPtr &wkbPtr, const double &x, cons
t double &y, int atVertex, bool hasZValue, int &pointIndex, bool isRing ); | |
|
| static inline bool deleteVertex( QgsConstWkbPtr &srcPtr, QgsWkbPtr &dst
Ptr, int atVertex, bool hasZValue, int &pointIndex, bool isRing, bool lastI
tem ); | | static inline int deleteVertex( QgsConstWkbPtr &srcPtr, QgsWkbPtr &dstP
tr, int atVertex, bool hasZValue, int &pointIndex, bool isRing, bool lastIt
em ); | |
| static inline bool insertVertex( QgsConstWkbPtr &srcPtr, QgsWkbPtr &dst
Ptr, int beforeVertex, const double &x, const double &y, bool hasZValue, in
t &pointIndex, bool isRing ); | | static inline bool insertVertex( QgsConstWkbPtr &srcPtr, QgsWkbPtr &dst
Ptr, int beforeVertex, const double &x, const double &y, bool hasZValue, in
t &pointIndex, bool isRing ); | |
|
| | | | |
| | | /** try to convert the geometry to a point */ | |
| | | QgsGeometry* convertToPoint( bool destMultipart ); | |
| | | /** try to convert the geometry to a line */ | |
| | | QgsGeometry* convertToLine( bool destMultipart ); | |
| | | /** try to convert the geometry to a polygon */ | |
| | | QgsGeometry* convertToPolygon( bool destMultipart ); | |
| }; // class QgsGeometry | | }; // class QgsGeometry | |
| | | | |
| Q_DECLARE_METATYPE( QgsGeometry ); | | Q_DECLARE_METATYPE( QgsGeometry ); | |
| | | | |
| class CORE_EXPORT QgsWkbPtr | | class CORE_EXPORT QgsWkbPtr | |
| { | | { | |
| mutable unsigned char *mP; | | mutable unsigned char *mP; | |
| | | | |
| public: | | public: | |
| QgsWkbPtr( unsigned char *p ) { mP = p; } | | QgsWkbPtr( unsigned char *p ) { mP = p; } | |
| | | | |
End of changes. 8 change blocks. |
| 4 lines changed or deleted | | 59 lines changed or added | |
|
| qgslinesymbollayerv2.h | | qgslinesymbollayerv2.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
|
| qgslinesymbollayerv2.h | | qgslinesymbollayerv2.h | |
| --------------------- | | --------------------- | |
| begin : November 2009 | | begin : November 2009 | |
| copyright : (C) 2009 by Martin Dobias | | copyright : (C) 2009 by Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSLINESYMBOLLAYERV2_H | | #ifndef QGSLINESYMBOLLAYERV2_H | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| // implemented from base classes | | // implemented from base classes | |
| | | | |
| QString layerType() const; | | QString layerType() const; | |
| | | | |
| void startRender( QgsSymbolV2RenderContext& context ); | | void startRender( QgsSymbolV2RenderContext& context ); | |
| | | | |
| void stopRender( QgsSymbolV2RenderContext& context ); | | void stopRender( QgsSymbolV2RenderContext& context ); | |
| | | | |
| void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext&
context ); | | void renderPolyline( const QPolygonF& points, QgsSymbolV2RenderContext&
context ); | |
| | | | |
|
| | | //overriden so that clip path can be set when using draw inside polygon | |
| | | option | |
| | | void renderPolygonOutline( const QPolygonF& points, QList<QPolygonF>* r | |
| | | ings, QgsSymbolV2RenderContext& context ); | |
| | | | |
| QgsStringMap properties() const; | | QgsStringMap properties() const; | |
| | | | |
| QgsSymbolLayerV2* clone() const; | | QgsSymbolLayerV2* clone() const; | |
| | | | |
| void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props
) const; | | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props
) const; | |
| | | | |
| QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFacto
r ) const; | | QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFacto
r ) const; | |
| | | | |
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale &scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| double estimateMaxBleed() const; | | double estimateMaxBleed() const; | |
| | | | |
| // new stuff | | // new stuff | |
| | | | |
| Qt::PenStyle penStyle() const { return mPenStyle; } | | Qt::PenStyle penStyle() const { return mPenStyle; } | |
| void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; } | | void setPenStyle( Qt::PenStyle style ) { mPenStyle = style; } | |
| | | | |
| Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; } | | Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; } | |
| void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style;
} | | void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style;
} | |
| | | | |
| Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; } | | Qt::PenCapStyle penCapStyle() const { return mPenCapStyle; } | |
| void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; } | | void setPenCapStyle( Qt::PenCapStyle style ) { mPenCapStyle = style; } | |
| | | | |
| double offset() const { return mOffset; } | | double offset() const { return mOffset; } | |
| void setOffset( double offset ) { mOffset = offset; } | | void setOffset( double offset ) { mOffset = offset; } | |
| | | | |
|
| QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | | | |
| void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | |
|
| | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| bool useCustomDashPattern() const { return mUseCustomDashPattern; } | | bool useCustomDashPattern() const { return mUseCustomDashPattern; } | |
| void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; } | | void setUseCustomDashPattern( bool b ) { mUseCustomDashPattern = b; } | |
| | | | |
|
| QgsSymbolV2::OutputUnit customDashPatternUnit() const { return mCustomD
ashPatternUnit; } | | | |
| void setCustomDashPatternUnit( QgsSymbolV2::OutputUnit unit ) { mCustom
DashPatternUnit = unit; } | | void setCustomDashPatternUnit( QgsSymbolV2::OutputUnit unit ) { mCustom
DashPatternUnit = unit; } | |
|
| | | QgsSymbolV2::OutputUnit customDashPatternUnit() const { return mCustomD | |
| | | ashPatternUnit; } | |
| | | | |
| | | const QgsMapUnitScale& customDashPatternMapUnitScale() const { return m | |
| | | CustomDashPatternMapUnitScale; } | |
| | | void setCustomDashPatternMapUnitScale( const QgsMapUnitScale& scale ) { | |
| | | mCustomDashPatternMapUnitScale = scale; } | |
| | | | |
| QVector<qreal> customDashVector() const { return mCustomDashVector; } | | QVector<qreal> customDashVector() const { return mCustomDashVector; } | |
| void setCustomDashVector( const QVector<qreal>& vector ) { mCustomDashV
ector = vector; } | | void setCustomDashVector( const QVector<qreal>& vector ) { mCustomDashV
ector = vector; } | |
| | | | |
| //Returns true if the line should only be drawn inside the polygon | | //Returns true if the line should only be drawn inside the polygon | |
| bool drawInsidePolygon() const { return mDrawInsidePolygon; } | | bool drawInsidePolygon() const { return mDrawInsidePolygon; } | |
| //Set to true if the line should only be drawn inside the polygon | | //Set to true if the line should only be drawn inside the polygon | |
| void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygo
n = drawInsidePolygon; } | | void setDrawInsidePolygon( bool drawInsidePolygon ) { mDrawInsidePolygo
n = drawInsidePolygon; } | |
| | | | |
| QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) co
nst; | | QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) co
nst; | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 124 | |
| QColor dxfColor( const QgsSymbolV2RenderContext& context ) const; | | QColor dxfColor( const QgsSymbolV2RenderContext& context ) const; | |
| | | | |
| protected: | | protected: | |
| Qt::PenStyle mPenStyle; | | Qt::PenStyle mPenStyle; | |
| Qt::PenJoinStyle mPenJoinStyle; | | Qt::PenJoinStyle mPenJoinStyle; | |
| Qt::PenCapStyle mPenCapStyle; | | Qt::PenCapStyle mPenCapStyle; | |
| QPen mPen; | | QPen mPen; | |
| QPen mSelPen; | | QPen mSelPen; | |
| double mOffset; | | double mOffset; | |
| QgsSymbolV2::OutputUnit mOffsetUnit; | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
|
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| | | | |
| //use a custom dash dot pattern instead of the predefined ones | | //use a custom dash dot pattern instead of the predefined ones | |
| bool mUseCustomDashPattern; | | bool mUseCustomDashPattern; | |
| QgsSymbolV2::OutputUnit mCustomDashPatternUnit; | | QgsSymbolV2::OutputUnit mCustomDashPatternUnit; | |
|
| | | QgsMapUnitScale mCustomDashPatternMapUnitScale; | |
| | | | |
| /**Vector with an even number of entries for the */ | | /**Vector with an even number of entries for the */ | |
| QVector<qreal> mCustomDashVector; | | QVector<qreal> mCustomDashVector; | |
| | | | |
| bool mDrawInsidePolygon; | | bool mDrawInsidePolygon; | |
| | | | |
| private: | | private: | |
| //helper functions for data defined symbology | | //helper functions for data defined symbology | |
| void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QPen
& pen, QPen& selPen, double& offset ); | | void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QPen
& pen, QPen& selPen, double& offset ); | |
| }; | | }; | |
| | | | |
| skipping to change at line 194 | | skipping to change at line 208 | |
| | | | |
| double interval() const { return mInterval; } | | double interval() const { return mInterval; } | |
| void setInterval( double interval ) { mInterval = interval; } | | void setInterval( double interval ) { mInterval = interval; } | |
| | | | |
| double offset() const { return mOffset; } | | double offset() const { return mOffset; } | |
| void setOffset( double offset ) { mOffset = offset; } | | void setOffset( double offset ) { mOffset = offset; } | |
| | | | |
| Placement placement() const { return mPlacement; } | | Placement placement() const { return mPlacement; } | |
| void setPlacement( Placement p ) { mPlacement = p; } | | void setPlacement( Placement p ) { mPlacement = p; } | |
| | | | |
|
| QgsSymbolV2::OutputUnit intervalUnit() const { return mIntervalUnit; } | | /**Returns the offset along the line for the marker placement. For Inte | |
| | | rval placements, this is the distance | |
| | | * between the start of the line and the first marker. For FirstVertex | |
| | | and LastVertex placements, this is the | |
| | | * distance between the marker and the start of the line or the end of | |
| | | the line respectively. | |
| | | * This setting has no effect for Vertex or CentralPoint placements. | |
| | | * @returns The offset along the line. The unit for the offset is retri | |
| | | evable via offsetAlongLineUnit. | |
| | | * @note added in 2.3 | |
| | | * @see setOffsetAlongLine | |
| | | * @see offsetAlongLineUnit | |
| | | * @see placement | |
| | | */ | |
| | | double offsetAlongLine() const { return mOffsetAlongLine; } | |
| | | | |
| | | /**Sets the the offset along the line for the marker placement. For Int | |
| | | erval placements, this is the distance | |
| | | * between the start of the line and the first marker. For FirstVertex | |
| | | and LastVertex placements, this is the | |
| | | * distance between the marker and the start of the line or the end of | |
| | | the line respectively. | |
| | | * This setting has no effect for Vertex or CentralPoint placements. | |
| | | * @param offsetAlongLine Distance to offset markers along the line. Th | |
| | | e offset | |
| | | * unit is set via setOffsetAlongLineUnit. | |
| | | * @note added in 2.3 | |
| | | * @see offsetAlongLine | |
| | | * @see setOffsetAlongLineUnit | |
| | | * @see setPlacement | |
| | | */ | |
| | | void setOffsetAlongLine( double offsetAlongLine ) { mOffsetAlongLine = | |
| | | offsetAlongLine; } | |
| | | | |
| | | /**Returns the unit used for calculating the offset along line for mark | |
| | | ers. | |
| | | * @returns Offset along line unit type. | |
| | | * @see setOffsetAlongLineUnit | |
| | | * @see offsetAlongLine | |
| | | */ | |
| | | QgsSymbolV2::OutputUnit offsetAlongLineUnit() const { return mOffsetAlo | |
| | | ngLineUnit; } | |
| | | | |
| | | /**Sets the unit used for calculating the offset along line for markers | |
| | | . | |
| | | * @param unit Offset along line unit type. | |
| | | * @see offsetAlongLineUnit | |
| | | * @see setOffsetAlongLine | |
| | | */ | |
| | | void setOffsetAlongLineUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetAl | |
| | | ongLineUnit = unit; } | |
| | | | |
| | | /**Returns the map unit scale used for calculating the offset in map un | |
| | | its along line for markers. | |
| | | * @returns Offset along line map unit scale. | |
| | | */ | |
| | | const QgsMapUnitScale& offsetAlongLineMapUnitScale() const { return mOf | |
| | | fsetAlongLineMapUnitScale; } | |
| | | | |
| | | /**Sets the map unit scale used for calculating the offset in map units | |
| | | along line for markers. | |
| | | * @param scale Offset along line map unit scale. | |
| | | */ | |
| | | void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale& scale ) { m | |
| | | OffsetAlongLineMapUnitScale = scale; } | |
| | | | |
| void setIntervalUnit( QgsSymbolV2::OutputUnit unit ) { mIntervalUnit =
unit; } | | void setIntervalUnit( QgsSymbolV2::OutputUnit unit ) { mIntervalUnit =
unit; } | |
|
| | | QgsSymbolV2::OutputUnit intervalUnit() const { return mIntervalUnit; } | |
| | | | |
| | | void setIntervalMapUnitScale( const QgsMapUnitScale& scale ) { mInterva | |
| | | lMapUnitScale = scale; } | |
| | | const QgsMapUnitScale& intervalMapUnitScale() const { return mIntervalM | |
| | | apUnitScale; } | |
| | | | |
|
| QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | | | |
| void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | |
|
| | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
|
| | | void setMapUnitScale( const QgsMapUnitScale& scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| protected: | | protected: | |
| | | | |
| void renderPolylineInterval( const QPolygonF& points, QgsSymbolV2Render
Context& context ); | | void renderPolylineInterval( const QPolygonF& points, QgsSymbolV2Render
Context& context ); | |
| void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderCo
ntext& context, Placement placement = Vertex ); | | void renderPolylineVertex( const QPolygonF& points, QgsSymbolV2RenderCo
ntext& context, Placement placement = Vertex ); | |
| void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderC
ontext& context ); | | void renderPolylineCentral( const QPolygonF& points, QgsSymbolV2RenderC
ontext& context ); | |
| double markerAngle( const QPolygonF& points, bool isRing, int vertex ); | | double markerAngle( const QPolygonF& points, bool isRing, int vertex ); | |
| | | | |
| bool mRotateMarker; | | bool mRotateMarker; | |
| double mInterval; | | double mInterval; | |
| QgsSymbolV2::OutputUnit mIntervalUnit; | | QgsSymbolV2::OutputUnit mIntervalUnit; | |
|
| | | QgsMapUnitScale mIntervalMapUnitScale; | |
| QgsMarkerSymbolV2* mMarker; | | QgsMarkerSymbolV2* mMarker; | |
| double mOffset; | | double mOffset; | |
| QgsSymbolV2::OutputUnit mOffsetUnit; | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
|
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| Placement mPlacement; | | Placement mPlacement; | |
|
| | | double mOffsetAlongLine; //distance to offset along line before marker | |
| | | is drawn | |
| | | QgsSymbolV2::OutputUnit mOffsetAlongLineUnit; //unit for offset along l | |
| | | ine | |
| | | QgsMapUnitScale mOffsetAlongLineMapUnitScale; | |
| | | | |
| | | private: | |
| | | | |
| | | /**Renders a marker by offseting a vertex along the line by a specified | |
| | | distance. | |
| | | * @param points vertices making up the line | |
| | | * @param vertex vertex number to begin offset at | |
| | | * @param distance distance to offset from vertex. If distance is posit | |
| | | ive, offset is calculated | |
| | | * moving forward along the line. If distance is negative, offset is ca | |
| | | lculated moving backward | |
| | | * along the line's vertices. | |
| | | * @param context render context | |
| | | * @see setoffsetAlongLine | |
| | | * @see setOffsetAlongLineUnit | |
| | | */ | |
| | | void renderOffsetVertexAlongLine( const QPolygonF& points, int vertex, | |
| | | double distance , QgsSymbolV2RenderContext &context ); | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 17 change blocks. |
| 9 lines changed or deleted | | 134 lines changed or added | |
|
| qgsmapcanvas.h | | qgsmapcanvas.h | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| #include <deque> | | #include <deque> | |
| | | | |
| #include "qgsrectangle.h" | | #include "qgsrectangle.h" | |
| #include "qgspoint.h" | | #include "qgspoint.h" | |
| #include "qgis.h" | | #include "qgis.h" | |
| | | | |
| #include <QDomDocument> | | #include <QDomDocument> | |
| #include <QGraphicsView> | | #include <QGraphicsView> | |
| #include <QtCore> | | #include <QtCore> | |
| | | | |
|
| | | #include "qgsmapsettings.h" // TEMPORARY | |
| | | #include "qgsprevieweffect.h" //for QgsPreviewEffect::PreviewMode | |
| | | | |
| #ifdef HAVE_TOUCH | | #ifdef HAVE_TOUCH | |
| #include <QGestureEvent> | | #include <QGestureEvent> | |
| #endif | | #endif | |
| | | | |
| class QWheelEvent; | | class QWheelEvent; | |
| class QPixmap; | | class QPixmap; | |
| class QPaintEvent; | | class QPaintEvent; | |
| class QKeyEvent; | | class QKeyEvent; | |
| class ResizeEvent; | | class ResizeEvent; | |
| | | | |
| class QColor; | | class QColor; | |
| class QDomDocument; | | class QDomDocument; | |
| class QPaintDevice; | | class QPaintDevice; | |
| class QMouseEvent; | | class QMouseEvent; | |
| class QRubberBand; | | class QRubberBand; | |
| class QGraphicsScene; | | class QGraphicsScene; | |
| | | | |
| class QgsMapToPixel; | | class QgsMapToPixel; | |
| class QgsMapLayer; | | class QgsMapLayer; | |
|
| class QgsLegend; | | | |
| class QgsLegendView; | | | |
| class QgsHighlight; | | class QgsHighlight; | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
| | | | |
|
| | | class QgsLabelingResults; | |
| class QgsMapRenderer; | | class QgsMapRenderer; | |
|
| | | class QgsMapRendererCache; | |
| | | class QgsMapRendererQImageJob; | |
| | | class QgsMapSettings; | |
| class QgsMapCanvasMap; | | class QgsMapCanvasMap; | |
| class QgsMapOverviewCanvas; | | class QgsMapOverviewCanvas; | |
| class QgsMapTool; | | class QgsMapTool; | |
| | | | |
| /** \ingroup gui | | /** \ingroup gui | |
| * A class that stores visibility and presence in overview flags together | | * A class that stores visibility and presence in overview flags together | |
| * with pointer to the layer. | | * with pointer to the layer. | |
| * | | * | |
| */ | | */ | |
| class GUI_EXPORT QgsMapCanvasLayer | | class GUI_EXPORT QgsMapCanvasLayer | |
| | | | |
| skipping to change at line 116 | | skipping to change at line 121 | |
| //! Constructor | | //! Constructor | |
| QgsMapCanvas( QWidget * parent = 0, const char *name = 0 ); | | QgsMapCanvas( QWidget * parent = 0, const char *name = 0 ); | |
| | | | |
| //! Destructor | | //! Destructor | |
| ~QgsMapCanvas(); | | ~QgsMapCanvas(); | |
| | | | |
| void setLayerSet( QList<QgsMapCanvasLayer>& layers ); | | void setLayerSet( QList<QgsMapCanvasLayer>& layers ); | |
| | | | |
| void setCurrentLayer( QgsMapLayer* layer ); | | void setCurrentLayer( QgsMapLayer* layer ); | |
| | | | |
|
| | | // ### QGIS 3: make QgsMapCanvas independent from overview | |
| void updateOverview(); | | void updateOverview(); | |
| | | | |
|
| | | // ### QGIS 3: make QgsMapCanvas independent from overview | |
| void enableOverviewMode( QgsMapOverviewCanvas* overview ); | | void enableOverviewMode( QgsMapOverviewCanvas* overview ); | |
| | | | |
|
| | | //! Get access to properties used for map rendering | |
| | | //! @note added in 2.4 | |
| | | const QgsMapSettings& mapSettings() const; | |
| | | | |
| | | //! sets whether to use projections for this layer set | |
| | | //! @note added in 2.4 | |
| | | void setCrsTransformEnabled( bool enabled ); | |
| | | | |
| | | //! sets destination coordinate reference system | |
| | | //! @note added in 2.4 | |
| | | void setDestinationCrs( const QgsCoordinateReferenceSystem& crs ); | |
| | | | |
| | | //! Get access to the labeling results (may be null) | |
| | | //! @note added in 2.4 | |
| | | const QgsLabelingResults* labelingResults() const; | |
| | | | |
| | | //! Set whether to cache images of rendered layers | |
| | | //! @note added in 2.4 | |
| | | void setCachingEnabled( bool enabled ); | |
| | | | |
| | | //! Check whether images of rendered layers are curerently being cached | |
| | | //! @note added in 2.4 | |
| | | bool isCachingEnabled() const; | |
| | | | |
| | | //! Make sure to remove any rendered images from cache (does nothing if | |
| | | cache is not enabled) | |
| | | //! @note added in 2.4 | |
| | | void clearCache(); | |
| | | | |
| | | //! Set whether the layers are rendered in parallel or sequentially | |
| | | //! @note added in 2.4 | |
| | | void setParallelRenderingEnabled( bool enabled ); | |
| | | | |
| | | //! Check whether the layers are rendered in parallel or sequentially | |
| | | //! @note added in 2.4 | |
| | | bool isParallelRenderingEnabled() const; | |
| | | | |
| | | //! Set how often map preview should be updated while it is being rende | |
| | | red (in milliseconds) | |
| | | //! @note added in 2.4 | |
| | | void setMapUpdateInterval( int timeMiliseconds ); | |
| | | | |
| | | //! Find out how often map preview should be updated while it is being | |
| | | rendered (in milliseconds) | |
| | | //! @note added in 2.4 | |
| | | int mapUpdateInterval() const; | |
| | | | |
| | | //! @deprecated since 2.4 - there could be more than just one "map" ite | |
| | | ms | |
| QgsMapCanvasMap* map(); | | QgsMapCanvasMap* map(); | |
| | | | |
|
| QgsMapRenderer* mapRenderer(); | | //! @deprecated since 2.4 - use mapSettings() for anything related to c | |
| | | urrent renderer settings | |
| | | //// SIP: removed /Transfer/ because it crashes after few calls to ifac | |
| | | e.mapCanvas().mapRenderer().hasCrsTransformEnabled() | |
| | | //// and in fact there is no transfer of ownership from c++ to python! | |
| | | //// Actually the problem comes from the fact that "hasCrsTransformEnab | |
| | | led" is both a signal and a normal method | |
| | | //// /KeepReference/ is necessary because otherwise mapRenderer().hasCr | |
| | | sTransformEnabled() was crashing | |
| | | Q_DECL_DEPRECATED QgsMapRenderer* mapRenderer(); | |
| | | | |
| //! Accessor for the canvas paint device | | //! Accessor for the canvas paint device | |
|
| QPaintDevice &canvasPaintDevice(); | | //! @deprecated since 2.4 | |
| | | Q_DECL_DEPRECATED QPaintDevice &canvasPaintDevice(); | |
| | | | |
| //! Get the last reported scale of the canvas | | //! Get the last reported scale of the canvas | |
| double scale(); | | double scale(); | |
| | | | |
| //! Clear the map canvas | | //! Clear the map canvas | |
|
| void clear(); | | //! @deprecated since 2.4 - use refresh() - clear does the same thing | |
| | | Q_DECL_DEPRECATED void clear(); | |
| | | | |
| //! Returns the mapUnitsPerPixel (map units per pixel) for the canvas | | //! Returns the mapUnitsPerPixel (map units per pixel) for the canvas | |
| double mapUnitsPerPixel() const; | | double mapUnitsPerPixel() const; | |
| | | | |
| //! Returns the current zoom exent of the map canvas | | //! Returns the current zoom exent of the map canvas | |
| QgsRectangle extent() const; | | QgsRectangle extent() const; | |
| //! Returns the combined exent for all layers on the map canvas | | //! Returns the combined exent for all layers on the map canvas | |
| QgsRectangle fullExtent() const; | | QgsRectangle fullExtent() const; | |
| | | | |
| //! Set the extent of the map canvas | | //! Set the extent of the map canvas | |
| | | | |
| skipping to change at line 183 | | skipping to change at line 242 | |
| void unsetMapTool( QgsMapTool* mapTool ); | | void unsetMapTool( QgsMapTool* mapTool ); | |
| | | | |
| /**Returns the currently active tool*/ | | /**Returns the currently active tool*/ | |
| QgsMapTool* mapTool(); | | QgsMapTool* mapTool(); | |
| | | | |
| /** Write property of QColor bgColor. */ | | /** Write property of QColor bgColor. */ | |
| virtual void setCanvasColor( const QColor & _newVal ); | | virtual void setCanvasColor( const QColor & _newVal ); | |
| /** Read property of QColor bgColor. */ | | /** Read property of QColor bgColor. */ | |
| virtual QColor canvasColor() const; | | virtual QColor canvasColor() const; | |
| | | | |
|
| | | /** Set color of selected vector features */ | |
| | | //! @note added in 2.4 | |
| | | void setSelectionColor( const QColor& color ); | |
| | | | |
| /** Emits signal scaleChanged to update scale in main window */ | | /** Emits signal scaleChanged to update scale in main window */ | |
| void updateScale(); | | void updateScale(); | |
| | | | |
| /** Updates the full extent */ | | /** Updates the full extent */ | |
|
| void updateFullExtent(); | | //! @deprecated since v2.4 - does nothing | |
| | | Q_DECL_DEPRECATED void updateFullExtent() {} | |
| | | | |
| //! return the map layer at position index in the layer stack | | //! return the map layer at position index in the layer stack | |
| QgsMapLayer *layer( int index ); | | QgsMapLayer *layer( int index ); | |
| | | | |
| //! return number of layers on the map | | //! return number of layers on the map | |
| int layerCount() const; | | int layerCount() const; | |
| | | | |
| //! return list of layers within map canvas. Added in v1.5 | | //! return list of layers within map canvas. Added in v1.5 | |
| QList<QgsMapLayer*> layers() const; | | QList<QgsMapLayer*> layers() const; | |
| | | | |
| | | | |
| skipping to change at line 209 | | skipping to change at line 273 | |
| * responding to events while layers are being added/removed etc. | | * responding to events while layers are being added/removed etc. | |
| * @param frz Boolean specifying if the canvas should be frozen (true)
or | | * @param frz Boolean specifying if the canvas should be frozen (true)
or | |
| * thawed (false). Default is true. | | * thawed (false). Default is true. | |
| */ | | */ | |
| void freeze( bool frz = true ); | | void freeze( bool frz = true ); | |
| | | | |
| /*! Accessor for frozen status of canvas */ | | /*! Accessor for frozen status of canvas */ | |
| bool isFrozen(); | | bool isFrozen(); | |
| | | | |
| //! Flag the canvas as dirty and needed a refresh | | //! Flag the canvas as dirty and needed a refresh | |
|
| void setDirty( bool _dirty ); | | //! @deprecated since 2.4 - use refresh() to trigger a refresh (clients | |
| | | should not decide explicitly whether canvas is dirty or not) | |
| | | Q_DECL_DEPRECATED void setDirty( bool _dirty ); | |
| | | | |
| //! Return the state of the canvas (dirty or not) | | //! Return the state of the canvas (dirty or not) | |
|
| bool isDirty() const; | | //! @deprecated since 2.4 - dirty flag is not kept anymore - always ret | |
| | | urns false | |
| | | Q_DECL_DEPRECATED bool isDirty() const; | |
| | | | |
| //! Set map units (needed by project properties dialog) | | //! Set map units (needed by project properties dialog) | |
| void setMapUnits( QGis::UnitType mapUnits ); | | void setMapUnits( QGis::UnitType mapUnits ); | |
| //! Get the current canvas map units | | //! Get the current canvas map units | |
| | | | |
| QGis::UnitType mapUnits() const; | | QGis::UnitType mapUnits() const; | |
| | | | |
| //! Get the current coordinate transform | | //! Get the current coordinate transform | |
| const QgsMapToPixel* getCoordinateTransform(); | | const QgsMapToPixel* getCoordinateTransform(); | |
| | | | |
|
| //! true if canvas currently drawing | | //! Find out whether rendering is in progress | |
| bool isDrawing(); | | bool isDrawing(); | |
| | | | |
| //! returns current layer (set by legend widget) | | //! returns current layer (set by legend widget) | |
| QgsMapLayer* currentLayer(); | | QgsMapLayer* currentLayer(); | |
| | | | |
| //! set wheel action and zoom factor (should be greater than 1) | | //! set wheel action and zoom factor (should be greater than 1) | |
| void setWheelAction( WheelAction action, double factor = 2 ); | | void setWheelAction( WheelAction action, double factor = 2 ); | |
| | | | |
| //! Zoom in with fixed factor | | //! Zoom in with fixed factor | |
| void zoomIn( ); | | void zoomIn( ); | |
| | | | |
| skipping to change at line 252 | | skipping to change at line 318 | |
| //! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1)
zooms in | | //! Zoom with the factor supplied. Factor > 1 zooms out, interval (0,1)
zooms in | |
| void zoomByFactor( double scaleFactor ); | | void zoomByFactor( double scaleFactor ); | |
| | | | |
| //! Zooms in/out with a given center | | //! Zooms in/out with a given center | |
| void zoomWithCenter( int x, int y, bool zoomIn ); | | void zoomWithCenter( int x, int y, bool zoomIn ); | |
| | | | |
| //! used to determine if anti-aliasing is enabled or not | | //! used to determine if anti-aliasing is enabled or not | |
| void enableAntiAliasing( bool theFlag ); | | void enableAntiAliasing( bool theFlag ); | |
| | | | |
| //! true if antialising is enabled | | //! true if antialising is enabled | |
|
| bool antiAliasingEnabled() const { return mAntiAliasing; } | | bool antiAliasingEnabled() const { return mSettings.testFlag( QgsMapSet
tings::Antialiasing ); } | |
| | | | |
| //! Select which Qt class to render with | | //! Select which Qt class to render with | |
|
| void useImageToRender( bool theFlag ); | | //! @deprecated since 2.4 - does nothing because now we always render t | |
| | | o QImage | |
| | | Q_DECL_DEPRECATED void useImageToRender( bool theFlag ); | |
| | | | |
| // following 2 methods should be moved elsewhere or changed to private | | // following 2 methods should be moved elsewhere or changed to private | |
| // currently used by pan map tool | | // currently used by pan map tool | |
| //! Ends pan action and redraws the canvas. | | //! Ends pan action and redraws the canvas. | |
| void panActionEnd( QPoint releasePoint ); | | void panActionEnd( QPoint releasePoint ); | |
| | | | |
| //! Called when mouse is moving and pan is activated | | //! Called when mouse is moving and pan is activated | |
| void panAction( QMouseEvent * event ); | | void panAction( QMouseEvent * event ); | |
| | | | |
| //! returns last position of mouse cursor | | //! returns last position of mouse cursor | |
| QPoint mouseLastXY(); | | QPoint mouseLastXY(); | |
| | | | |
|
| | | /** Enables a preview mode for the map canvas | |
| | | * @param previewEnabled set to true to enable a preview mode | |
| | | * @see setPreviewMode | |
| | | * @note added in 2.3 */ | |
| | | void setPreviewModeEnabled( bool previewEnabled ); | |
| | | | |
| | | /** Returns whether a preview mode is enabled for the map canvas | |
| | | * @returns true if a preview mode is currently enabled | |
| | | * @see setPreviewModeEnabled | |
| | | * @see previewMode | |
| | | * @note added in 2.3 */ | |
| | | bool previewModeEnabled() const; | |
| | | | |
| | | /** Sets a preview mode for the map canvas. This setting only has an ef | |
| | | fect if | |
| | | * previewModeEnabled is true. | |
| | | * @param mode preview mode for the canvas | |
| | | * @see previewMode | |
| | | * @see setPreviewModeEnabled | |
| | | * @see previewModeEnabled | |
| | | * @note added in 2.3 */ | |
| | | void setPreviewMode( QgsPreviewEffect::PreviewMode mode ); | |
| | | | |
| | | /** Returns the current preview mode for the map canvas. This setting o | |
| | | nly has an effect if | |
| | | * previewModeEnabled is true. | |
| | | * @returns preview mode for map canvas | |
| | | * @see setPreviewMode | |
| | | * @see previewModeEnabled | |
| | | * @note added in 2.3 */ | |
| | | QgsPreviewEffect::PreviewMode previewMode() const; | |
| | | | |
| public slots: | | public slots: | |
| | | | |
| /**Repaints the canvas map*/ | | /**Repaints the canvas map*/ | |
| void refresh(); | | void refresh(); | |
| | | | |
| //! Receives signal about selection change, and pass it on with layer i
nfo | | //! Receives signal about selection change, and pass it on with layer i
nfo | |
| void selectionChangedSlot(); | | void selectionChangedSlot(); | |
| | | | |
| //! Save the convtents of the map canvas to disk as an image | | //! Save the convtents of the map canvas to disk as an image | |
| void saveAsImage( QString theFileName, QPixmap * QPixmap = 0, QString =
"PNG" ); | | void saveAsImage( QString theFileName, QPixmap * QPixmap = 0, QString =
"PNG" ); | |
| | | | |
| skipping to change at line 290 | | skipping to change at line 387 | |
| void layerStateChange(); | | void layerStateChange(); | |
| | | | |
| //! Whether to suppress rendering or not | | //! Whether to suppress rendering or not | |
| void setRenderFlag( bool theFlag ); | | void setRenderFlag( bool theFlag ); | |
| //! State of render suppression flag | | //! State of render suppression flag | |
| bool renderFlag() {return mRenderFlag;}; | | bool renderFlag() {return mRenderFlag;}; | |
| | | | |
| /** A simple helper method to find out if on the fly projections are en
abled or not */ | | /** A simple helper method to find out if on the fly projections are en
abled or not */ | |
| bool hasCrsTransformEnabled(); | | bool hasCrsTransformEnabled(); | |
| | | | |
|
| /** The map units may have changed, so cope with that */ | | //! @deprecated in 2.4 - does nothing - kept for API compatibility | |
| void mapUnitsChanged(); | | Q_DECL_DEPRECATED void updateMap(); | |
| | | | |
|
| /** updates pixmap on render progress */ | | //! stop rendering (if there is any right now) | |
| void updateMap(); | | //! @note added in 2.4 | |
| | | void stopRendering(); | |
| | | | |
|
| //! show whatever error is exposed by the QgsMapLayer. | | //! @deprecated since 2.4 - does nothing - errors are reported by diffe | |
| void showError( QgsMapLayer * mapLayer ); | | rent means | |
| | | Q_DECL_DEPRECATED void showError( QgsMapLayer * mapLayer ); | |
| | | | |
| //! called to read map canvas settings from project | | //! called to read map canvas settings from project | |
| void readProject( const QDomDocument & ); | | void readProject( const QDomDocument & ); | |
| | | | |
| //! called to write map canvas settings to project | | //! called to write map canvas settings to project | |
| void writeProject( QDomDocument & ); | | void writeProject( QDomDocument & ); | |
| | | | |
| //! ask user about datum transformation | | //! ask user about datum transformation | |
| void getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAu
thId, const QString& destAuthId ); | | void getDatumTransformInfo( const QgsMapLayer* ml, const QString& srcAu
thId, const QString& destAuthId ); | |
| | | | |
| private slots: | | private slots: | |
| //! called when current maptool is destroyed | | //! called when current maptool is destroyed | |
| void mapToolDestroyed(); | | void mapToolDestroyed(); | |
| | | | |
|
| | | //! called when a renderer job has finished successfully or when it was | |
| | | cancelled | |
| | | void rendererJobFinished(); | |
| | | | |
| | | void mapUpdateTimeout(); | |
| | | | |
| | | void refreshMap(); | |
| | | | |
| signals: | | signals: | |
| /** Let the owner know how far we are with render operations */ | | /** Let the owner know how far we are with render operations */ | |
|
| void setProgress( int, int ); | | //! @deprecated since 2.4 - already unused in 2.0 anyway | |
| | | Q_DECL_DEPRECATED void setProgress( int, int ); | |
| | | | |
| /** emits current mouse position | | /** emits current mouse position | |
| \note changed in 1.3 */ | | \note changed in 1.3 */ | |
| void xyCoordinates( const QgsPoint &p ); | | void xyCoordinates( const QgsPoint &p ); | |
| | | | |
| //! Emitted when the scale of the map changes | | //! Emitted when the scale of the map changes | |
| void scaleChanged( double ); | | void scaleChanged( double ); | |
| | | | |
| //! Emitted when the extents of the map change | | //! Emitted when the extents of the map change | |
| void extentsChanged(); | | void extentsChanged(); | |
| | | | |
| /** Emitted when the canvas has rendered. | | /** Emitted when the canvas has rendered. | |
| | | | |
| Passes a pointer to the painter on which the map was drawn. This is | | Passes a pointer to the painter on which the map was drawn. This is | |
| useful for plugins that wish to draw on the map after it has been | | useful for plugins that wish to draw on the map after it has been | |
| rendered. Passing the painter allows plugins to work when the map is | | rendered. Passing the painter allows plugins to work when the map is | |
| being rendered onto a pixmap other than the mapCanvas own pixmap membe
r. | | being rendered onto a pixmap other than the mapCanvas own pixmap membe
r. | |
| | | | |
| */ | | */ | |
|
| | | //! TODO: deprecate when decorations are reimplemented as map canvas it | |
| | | ems | |
| | | //! - anything related to rendering progress is not visible outside of | |
| | | map canvas | |
| | | //! - additional drawing shall be done directly within the renderer job | |
| | | or independently as a map canvas item | |
| void renderComplete( QPainter * ); | | void renderComplete( QPainter * ); | |
| | | | |
|
| | | // ### QGIS 3: renamte to mapRefreshFinished() | |
| /** Emitted when canvas finished a refresh request. | | /** Emitted when canvas finished a refresh request. | |
| \note Added in 2.0 */ | | \note Added in 2.0 */ | |
| void mapCanvasRefreshed(); | | void mapCanvasRefreshed(); | |
| | | | |
|
| | | // ### QGIS 3: rename to mapRefreshStarted() | |
| /** Emitted when the canvas is about to be rendered. | | /** Emitted when the canvas is about to be rendered. | |
| \note Added in 1.5 */ | | \note Added in 1.5 */ | |
| void renderStarting(); | | void renderStarting(); | |
| | | | |
| //! Emitted when a new set of layers has been received | | //! Emitted when a new set of layers has been received | |
| void layersChanged(); | | void layersChanged(); | |
| | | | |
| //! Emit key press event | | //! Emit key press event | |
| void keyPressed( QKeyEvent * e ); | | void keyPressed( QKeyEvent * e ); | |
| | | | |
| //! Emit key release event | | //! Emit key release event | |
| void keyReleased( QKeyEvent * e ); | | void keyReleased( QKeyEvent * e ); | |
| | | | |
| //! Emit map tool changed event | | //! Emit map tool changed event | |
| void mapToolSet( QgsMapTool *tool ); | | void mapToolSet( QgsMapTool *tool ); | |
| | | | |
|
| | | /** Emit map tool changed with the old tool | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | void mapToolSet( QgsMapTool *newTool, QgsMapTool* oldTool ); | |
| | | | |
| | | // ### QGIS 3: remove the signal | |
| //! Emitted when selection in any layer gets changed | | //! Emitted when selection in any layer gets changed | |
| void selectionChanged( QgsMapLayer * layer ); | | void selectionChanged( QgsMapLayer * layer ); | |
| | | | |
| //! Emitted when zoom last status changed | | //! Emitted when zoom last status changed | |
| //! @note: this signal was added in version 1.4 | | //! @note: this signal was added in version 1.4 | |
| void zoomLastStatusChanged( bool ); | | void zoomLastStatusChanged( bool ); | |
| | | | |
| //! Emitted when zoom next status changed | | //! Emitted when zoom next status changed | |
| //! @note: this signal was added in version 1.4 | | //! @note: this signal was added in version 1.4 | |
| void zoomNextStatusChanged( bool ); | | void zoomNextStatusChanged( bool ); | |
| | | | |
|
| | | //! Emitted when on-the-fly projection has been turned on/off | |
| | | //! @note added in 2.4 | |
| | | void hasCrsTransformEnabledChanged( bool flag ); | |
| | | | |
| | | //! Emitted when map CRS has changed | |
| | | //! @note added in 2.4 | |
| | | void destinationCrsChanged(); | |
| | | | |
| | | //! Emmitted when map units are changed | |
| | | //! @note added in 2.4 | |
| | | void mapUnitsChanged(); | |
| | | | |
| protected: | | protected: | |
| #ifdef HAVE_TOUCH | | #ifdef HAVE_TOUCH | |
| //! Overridden standard event to be gestures aware | | //! Overridden standard event to be gestures aware | |
| bool event( QEvent * e ); | | bool event( QEvent * e ); | |
| #endif | | #endif | |
| | | | |
| //! Overridden key press event | | //! Overridden key press event | |
| void keyPressEvent( QKeyEvent * e ); | | void keyPressEvent( QKeyEvent * e ); | |
| | | | |
| //! Overridden key release event | | //! Overridden key release event | |
| | | | |
| skipping to change at line 420 | | skipping to change at line 549 | |
| class CanvasProperties; | | class CanvasProperties; | |
| | | | |
| /// Handle pattern for implementation object | | /// Handle pattern for implementation object | |
| std::auto_ptr<CanvasProperties> mCanvasProperties; | | std::auto_ptr<CanvasProperties> mCanvasProperties; | |
| | | | |
| /**debugging member | | /**debugging member | |
| invoked when a connect() is made to this object | | invoked when a connect() is made to this object | |
| */ | | */ | |
| void connectNotify( const char * signal ); | | void connectNotify( const char * signal ); | |
| | | | |
|
| private slots: | | //! Make sure the datum transform store is properly populated | |
| void crsTransformEnabled( bool ); | | void updateDatumTransformEntries(); | |
| | | | |
| private: | | private: | |
| /// this class is non-copyable | | /// this class is non-copyable | |
| /** | | /** | |
| @note | | @note | |
| | | | |
| Otherwise std::auto_ptr would pass the object responsiblity on to th
e | | Otherwise std::auto_ptr would pass the object responsiblity on to th
e | |
| copy like a hot potato leaving the copyer in a weird state. | | copy like a hot potato leaving the copyer in a weird state. | |
| */ | | */ | |
| QgsMapCanvas( QgsMapCanvas const & ); | | QgsMapCanvas( QgsMapCanvas const & ); | |
| | | | |
|
| | | //! encompases all map settings necessary for map rendering | |
| | | QgsMapSettings mSettings; | |
| | | | |
| //! all map rendering is done in this class | | //! all map rendering is done in this class | |
| QgsMapRenderer* mMapRenderer; | | QgsMapRenderer* mMapRenderer; | |
| | | | |
| //! owns pixmap with rendered map and controls rendering | | //! owns pixmap with rendered map and controls rendering | |
| QgsMapCanvasMap* mMap; | | QgsMapCanvasMap* mMap; | |
| | | | |
| //! map overview widget - it's controlled by QgsMapCanvas | | //! map overview widget - it's controlled by QgsMapCanvas | |
| QgsMapOverviewCanvas* mMapOverview; | | QgsMapOverviewCanvas* mMapOverview; | |
| | | | |
|
| //! If backbuffering is currently enabled | | | |
| bool mBackbufferEnabled; | | | |
| //! Flag indicating a map refresh is in progress | | | |
| bool mDrawing; | | | |
| | | | |
| //! Flag indicating if the map canvas is frozen. | | //! Flag indicating if the map canvas is frozen. | |
| bool mFrozen; | | bool mFrozen; | |
| | | | |
|
| /*! \brief Flag to track the state of the Map canvas. | | //! Flag that allows squashing multiple refresh() calls into just one d | |
| * | | elayed rendering job | |
| * The canvas is | | bool mRefreshScheduled; | |
| * flagged as dirty by any operation that changes the state of | | | |
| * the layers or the view extent. If the canvas is not dirty, paint | | | |
| * events are handled by bit-blitting the stored canvas bitmap to | | | |
| * the canvas. This improves performance by not reading the data source | | | |
| * when no real change has occurred | | | |
| */ | | | |
| bool mDirty; | | | |
| | | | |
| //! determines whether user has requested to suppress rendering | | //! determines whether user has requested to suppress rendering | |
| bool mRenderFlag; | | bool mRenderFlag; | |
| | | | |
|
| /**Resize events that have been ignored because the canvas is busy with | | | |
| rendering may put their sizes into this list. The canvas then picks | | | |
| up | | | |
| the last entry in case a lot of resize events arrive in short time*/ | | | |
| QList< QPair<int, int> > mResizeQueue; | | | |
| | | | |
| //! current layer in legend | | //! current layer in legend | |
| QgsMapLayer* mCurrentLayer; | | QgsMapLayer* mCurrentLayer; | |
| | | | |
| //! graphics scene manages canvas items | | //! graphics scene manages canvas items | |
| QGraphicsScene* mScene; | | QGraphicsScene* mScene; | |
| | | | |
| //! pointer to current map tool | | //! pointer to current map tool | |
| QgsMapTool* mMapTool; | | QgsMapTool* mMapTool; | |
| | | | |
| //! previous tool if current is for zooming/panning | | //! previous tool if current is for zooming/panning | |
| | | | |
| skipping to change at line 491 | | skipping to change at line 605 | |
| //! recently used extent | | //! recently used extent | |
| QList <QgsRectangle> mLastExtent; | | QList <QgsRectangle> mLastExtent; | |
| int mLastExtentIndex; | | int mLastExtentIndex; | |
| | | | |
| //! Scale factor multiple for default zoom in/out | | //! Scale factor multiple for default zoom in/out | |
| double mWheelZoomFactor; | | double mWheelZoomFactor; | |
| | | | |
| //! Mouse wheel action | | //! Mouse wheel action | |
| WheelAction mWheelAction; | | WheelAction mWheelAction; | |
| | | | |
|
| //! resize canvas size | | //! Timer that periodically fires while map rendering is in progress to | |
| QSize mNewSize; | | update the visible map | |
| | | QTimer mMapUpdateTimer; | |
| | | | |
| | | //! Job that takes care of map rendering in background | |
| | | QgsMapRendererQImageJob* mJob; | |
| | | | |
|
| //! currently in paint event | | //! Flag determining whether the active job has been cancelled | |
| bool mPainting; | | bool mJobCancelled; | |
| | | | |
|
| //! indicates whether antialiasing will be used for rendering | | //! Labeling results from the recently rendered map | |
| bool mAntiAliasing; | | QgsLabelingResults* mLabelingResults; | |
| | | | |
| | | //! Whether layers are rendered sequentially or in parallel | |
| | | bool mUseParallelRendering; | |
| | | | |
| | | //! Whether to add rendering stats to the rendered image | |
| | | bool mDrawRenderingStats; | |
| | | | |
| | | //! Optionally use cache with rendered map layers for the current map s | |
| | | ettings | |
| | | QgsMapRendererCache* mCache; | |
| | | | |
| QTimer *mResizeTimer; | | QTimer *mResizeTimer; | |
|
| | | | |
| | | QgsPreviewEffect* mPreviewEffect; | |
| | | | |
| }; // class QgsMapCanvas | | }; // class QgsMapCanvas | |
| | | | |
|
| | | /** Class that does synchronization between QgsMapCanvas and its associated | |
| | | QgsMapRenderer: | |
| | | * - changes done in map canvas settings are pushed to map renderer | |
| | | * - changes done in map renderer are pushed to map canvas settings | |
| | | * | |
| | | * This class can be removed within API cleanup when QgsMapRenderer will no | |
| | | t be accessible from canvas API anymore. | |
| | | * Added in 2.4. This class is not a part of public API! | |
| | | */ | |
| | | class QgsMapCanvasRendererSync : public QObject | |
| | | { | |
| | | Q_OBJECT | |
| | | public: | |
| | | QgsMapCanvasRendererSync( QgsMapCanvas* canvas, QgsMapRenderer* rendere | |
| | | r ); | |
| | | | |
| | | protected slots: | |
| | | void onExtentC2R(); | |
| | | void onExtentR2C(); | |
| | | | |
| | | void onMapUnitsC2R(); | |
| | | void onMapUnitsR2C(); | |
| | | | |
| | | void onCrsTransformC2R(); | |
| | | void onCrsTransformR2C(); | |
| | | | |
| | | void onDestCrsC2R(); | |
| | | void onDestCrsR2C(); | |
| | | | |
| | | void onLayersC2R(); | |
| | | | |
| | | protected: | |
| | | QgsMapCanvas* mCanvas; | |
| | | QgsMapRenderer* mRenderer; | |
| | | | |
| | | bool mSyncingExtent; | |
| | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 38 change blocks. |
| 47 lines changed or deleted | | 234 lines changed or added | |
|
| qgsmaplayer.h | | qgsmaplayer.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| #include <QUndoStack> | | #include <QUndoStack> | |
| #include <QVariant> | | #include <QVariant> | |
| #include <QImage> | | #include <QImage> | |
| #include <QDomNode> | | #include <QDomNode> | |
| #include <QPainter> | | #include <QPainter> | |
| | | | |
| #include "qgis.h" | | #include "qgis.h" | |
| #include "qgserror.h" | | #include "qgserror.h" | |
| #include "qgsrectangle.h" | | #include "qgsrectangle.h" | |
| #include "qgsmaprenderer.h" | | #include "qgsmaprenderer.h" | |
|
| | | #include "qgsobjectcustomproperties.h" | |
| | | | |
| class QgsRenderContext; | | class QgsRenderContext; | |
| class QgsCoordinateReferenceSystem; | | class QgsCoordinateReferenceSystem; | |
|
| | | class QgsMapLayerRenderer; | |
| | | | |
| class QDomDocument; | | class QDomDocument; | |
| class QKeyEvent; | | class QKeyEvent; | |
| class QPainter; | | class QPainter; | |
| | | | |
| /** \ingroup core | | /** \ingroup core | |
| * Base class for all map layer types. | | * Base class for all map layer types. | |
| * This is the base class for all map layer types (vector, raster). | | * This is the base class for all map layer types (vector, raster). | |
| */ | | */ | |
| class CORE_EXPORT QgsMapLayer : public QObject | | class CORE_EXPORT QgsMapLayer : public QObject | |
| | | | |
| skipping to change at line 131 | | skipping to change at line 133 | |
| | | | |
| /* Set the blending mode used for rendering a layer */ | | /* Set the blending mode used for rendering a layer */ | |
| void setBlendMode( const QPainter::CompositionMode &blendMode ); | | void setBlendMode( const QPainter::CompositionMode &blendMode ); | |
| /* Returns the current blending mode for a layer */ | | /* Returns the current blending mode for a layer */ | |
| QPainter::CompositionMode blendMode() const; | | QPainter::CompositionMode blendMode() const; | |
| | | | |
| /**Synchronises with changes in the datasource | | /**Synchronises with changes in the datasource | |
| @note added in version 1.6*/ | | @note added in version 1.6*/ | |
| virtual void reload() {} | | virtual void reload() {} | |
| | | | |
|
| | | /** Return new instance of QgsMapLayerRenderer that will be used for re | |
| | | ndering of given context | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rende | |
| | | rerContext ) { Q_UNUSED( rendererContext ); return 0; } | |
| | | | |
| /** This is the method that does the actual work of | | /** This is the method that does the actual work of | |
| * drawing the layer onto a paint device. | | * drawing the layer onto a paint device. | |
| * @param rendererContext describes the extents, | | * @param rendererContext describes the extents, | |
| * resolumon etc. that should be used when rendering the | | * resolumon etc. that should be used when rendering the | |
| * layer. | | * layer. | |
| */ | | */ | |
| virtual bool draw( QgsRenderContext& rendererContext ); | | virtual bool draw( QgsRenderContext& rendererContext ); | |
| | | | |
| /** Draw labels | | /** Draw labels | |
| * @todo to be removed: used only in vector layers | | * @todo to be removed: used only in vector layers | |
| | | | |
| skipping to change at line 213 | | skipping to change at line 220 | |
| | | | |
| This, in turn, calls writeXml(), which is over-rideable by sub-class
es so | | This, in turn, calls writeXml(), which is over-rideable by sub-class
es so | |
| that they can write their own specific state to the given Dom node. | | that they can write their own specific state to the given Dom node. | |
| | | | |
| Invoked by QgsProject::write(). | | Invoked by QgsProject::write(). | |
| | | | |
| @returns true if successful | | @returns true if successful | |
| */ | | */ | |
| bool writeLayerXML( QDomElement& layerElement, QDomDocument& document )
; | | bool writeLayerXML( QDomElement& layerElement, QDomDocument& document )
; | |
| | | | |
|
| | | /** Returns the given layer as a layer definition document | |
| | | Layer definitions store the data source as well as styling and cust | |
| | | om properties. | |
| | | | |
| | | Layer definitions can be used to load a layer and styling all from | |
| | | a single file. | |
| | | */ | |
| | | static QDomDocument asLayerDefinition( QList<QgsMapLayer*> layers ); | |
| | | | |
| | | /** Creates a new layer from a layer defininition document | |
| | | */ | |
| | | static QList<QgsMapLayer*> fromLayerDefinition( QDomDocument& document | |
| | | ); | |
| | | static QList<QgsMapLayer*> fromLayerDefinitionFile( const QString qlrfi | |
| | | le ); | |
| | | | |
| /** Set a custom property for layer. Properties are stored in a map and
saved in project file. | | /** Set a custom property for layer. Properties are stored in a map and
saved in project file. | |
| * @note Added in v1.4 */ | | * @note Added in v1.4 */ | |
| void setCustomProperty( const QString& key, const QVariant& value ); | | void setCustomProperty( const QString& key, const QVariant& value ); | |
| /** Read a custom property from layer. Properties are stored in a map a
nd saved in project file. | | /** Read a custom property from layer. Properties are stored in a map a
nd saved in project file. | |
| * @note Added in v1.4 */ | | * @note Added in v1.4 */ | |
| QVariant customProperty( const QString& value, const QVariant& defaultV
alue = QVariant() ) const; | | QVariant customProperty( const QString& value, const QVariant& defaultV
alue = QVariant() ) const; | |
| /** Remove a custom property from layer. Properties are stored in a map
and saved in project file. | | /** Remove a custom property from layer. Properties are stored in a map
and saved in project file. | |
| * @note Added in v1.4 */ | | * @note Added in v1.4 */ | |
| void removeCustomProperty( const QString& key ); | | void removeCustomProperty( const QString& key ); | |
| | | | |
|
| /** | | //! @deprecated since 2.4 - returns empty string | |
| * If an operation returns 0 (e.g. draw()), this function | | Q_DECL_DEPRECATED virtual QString lastErrorTitle(); | |
| * returns the text of the error associated with the failure. | | | |
| * Interactive users of this provider can then, for example, | | | |
| * call a QMessageBox to display the contents. | | | |
| */ | | | |
| virtual QString lastErrorTitle(); | | | |
| | | | |
|
| /** | | //! @deprecated since 2.4 - returns empty string | |
| * If an operation returns 0 (e.g. draw()), this function | | Q_DECL_DEPRECATED virtual QString lastError(); | |
| * returns the text of the error associated with the failure. | | | |
| * Interactive users of this provider can then, for example, | | | |
| * call a QMessageBox to display the contents. | | | |
| */ | | | |
| virtual QString lastError(); | | | |
| | | | |
| /** Get current status error. This error describes some principal probl
em | | /** Get current status error. This error describes some principal probl
em | |
| * for which layer cannot work and thus is not valid. It is not last e
rror | | * for which layer cannot work and thus is not valid. It is not last e
rror | |
| * after accessing data by draw() etc. | | * after accessing data by draw() etc. | |
| */ | | */ | |
| virtual QgsError error() const { return mError; } | | virtual QgsError error() const { return mError; } | |
| | | | |
| /** Returns layer's spatial reference system | | /** Returns layer's spatial reference system | |
| @note This was introduced in QGIS 1.4 | | @note This was introduced in QGIS 1.4 | |
| */ | | */ | |
| | | | |
| skipping to change at line 359 | | skipping to change at line 368 | |
| * @param node the node that will have the style element added to it. | | * @param node the node that will have the style element added to it. | |
| * @param doc the document that will have the QDomNode added. | | * @param doc the document that will have the QDomNode added. | |
| * @param errorMessage reference to string that will be updated with a
ny error messages | | * @param errorMessage reference to string that will be updated with a
ny error messages | |
| * @return true in case of success. | | * @return true in case of success. | |
| */ | | */ | |
| virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString
& errorMessage ) const = 0; | | virtual bool writeSymbology( QDomNode &node, QDomDocument& doc, QString
& errorMessage ) const = 0; | |
| | | | |
| /** Return pointer to layer's undo stack */ | | /** Return pointer to layer's undo stack */ | |
| QUndoStack *undoStack(); | | QUndoStack *undoStack(); | |
| | | | |
|
| /** Get the QImage used for caching render operations | | /* Layer legendUrl information */ | |
| * @note This method was added in QGIS 1.4 **/ | | void setLegendUrl( const QString& legendUrl ) { mLegendUrl = legendUrl; | |
| QImage *cacheImage() { return mpCacheImage; } | | } | |
| /** Set the QImage used for caching render operations | | const QString& legendUrl() const { return mLegendUrl; } | |
| * @note This method was added in QGIS 1.4 **/ | | void setLegendUrlFormat( const QString& legendUrlFormat ) { mLegendUrlF | |
| void setCacheImage( QImage * thepImage ); | | ormat = legendUrlFormat; } | |
| | | const QString& legendUrlFormat() const { return mLegendUrlFormat; } | |
| /** | | | |
| * @brief Is called when the cache image is being deleted. Overwrite an | | /** @deprecated since 2.4 - returns NULL */ | |
| d use to clean up. | | Q_DECL_DEPRECATED QImage *cacheImage() { return 0; } | |
| * @note added in 2.0 | | /** @deprecated since 2.4 - caches listen to repaintRequested() signal | |
| */ | | to invalidate the cached image */ | |
| virtual void onCacheImageDelete() {} | | Q_DECL_DEPRECATED void setCacheImage( QImage * ); | |
| | | /** @deprecated since 2.4 - does nothing */ | |
| | | Q_DECL_DEPRECATED virtual void onCacheImageDelete() {} | |
| | | | |
| public slots: | | public slots: | |
| | | | |
| /** Event handler for when a coordinate transform fails due to bad vert
ex error */ | | /** Event handler for when a coordinate transform fails due to bad vert
ex error */ | |
| virtual void invalidTransformInput(); | | virtual void invalidTransformInput(); | |
| | | | |
| /** Accessor and mutator for the minimum scale denominator member */ | | /** Accessor and mutator for the minimum scale denominator member */ | |
| void setMinimumScale( float theMinScale ); | | void setMinimumScale( float theMinScale ); | |
| float minimumScale() const; | | float minimumScale() const; | |
| | | | |
| /** Accessor and mutator for the maximum scale denominator member */ | | /** Accessor and mutator for the maximum scale denominator member */ | |
| void setMaximumScale( float theMaxScale ); | | void setMaximumScale( float theMaxScale ); | |
| float maximumScale() const; | | float maximumScale() const; | |
| | | | |
| /** Accessor and mutator for the scale based visilibility flag */ | | /** Accessor and mutator for the scale based visilibility flag */ | |
| void toggleScaleBasedVisibility( bool theVisibilityFlag ); | | void toggleScaleBasedVisibility( bool theVisibilityFlag ); | |
| bool hasScaleBasedVisibility() const; | | bool hasScaleBasedVisibility() const; | |
| | | | |
| /** Clear cached image | | /** Clear cached image | |
|
| * added in 1.5 */ | | * @deprecated in 2.4 - caches listen to repaintRequested() signal to | |
| void clearCacheImage(); | | invalidate the cached image */ | |
| | | Q_DECL_DEPRECATED void clearCacheImage(); | |
| | | | |
| /** \brief Obtain Metadata for this layer */ | | /** \brief Obtain Metadata for this layer */ | |
| virtual QString metadata(); | | virtual QString metadata(); | |
| | | | |
| /** Time stamp of data source in the moment when data/metadata were loa
ded by provider */ | | /** Time stamp of data source in the moment when data/metadata were loa
ded by provider */ | |
| virtual QDateTime timestamp() const { return QDateTime() ; } | | virtual QDateTime timestamp() const { return QDateTime() ; } | |
| | | | |
| signals: | | signals: | |
| | | | |
|
| /** Emit a signal to notify of a progress event */ | | //! @deprecated in 2.4 - not emitted anymore | |
| void drawingProgress( int theProgress, int theTotalSteps ); | | void drawingProgress( int theProgress, int theTotalSteps ); | |
| | | | |
| /** Emit a signal with status (e.g. to be caught by QgisApp and display
a msg on status bar) */ | | /** Emit a signal with status (e.g. to be caught by QgisApp and display
a msg on status bar) */ | |
| void statusChanged( QString theStatus ); | | void statusChanged( QString theStatus ); | |
| | | | |
| /** Emit a signal that the layer name has been changed */ | | /** Emit a signal that the layer name has been changed */ | |
| void layerNameChanged(); | | void layerNameChanged(); | |
| | | | |
| /** Emit a signal that layer's CRS has been reset | | /** Emit a signal that layer's CRS has been reset | |
| added in 1.4 | | added in 1.4 | |
| */ | | */ | |
| void layerCrsChanged(); | | void layerCrsChanged(); | |
| | | | |
|
| /** This signal should be connected with the slot QgsMapCanvas::refresh | | /** By emitting this signal the layer tells that either appearance or c | |
| () | | ontent have been changed | |
| * \todo to be removed - GUI dependency | | * and any view showing the rendered layer should refresh itself. | |
| */ | | */ | |
| void repaintRequested(); | | void repaintRequested(); | |
| | | | |
|
| /**The layer emits this signal when a screen update is requested. | | //! \note Deprecated in 2.4 and not emitted anymore | |
| This signal should be connected with the slot QgsMapCanvas::updateMap( | | | |
| )*/ | | | |
| void screenUpdateRequested(); | | void screenUpdateRequested(); | |
| | | | |
| /** This is used to send a request that any mapcanvas using this layer
update its extents */ | | /** This is used to send a request that any mapcanvas using this layer
update its extents */ | |
| void recalculateExtents(); | | void recalculateExtents(); | |
| | | | |
| /** data of layer changed | | /** data of layer changed | |
| * added in 1.5 */ | | * added in 1.5 */ | |
| void dataChanged(); | | void dataChanged(); | |
| | | | |
| /** Signal emitted when the blend mode is changed, through QgsMapLayer:
:setBlendMode() */ | | /** Signal emitted when the blend mode is changed, through QgsMapLayer:
:setBlendMode() */ | |
| void blendModeChanged( const QPainter::CompositionMode &blendMode ); | | void blendModeChanged( const QPainter::CompositionMode &blendMode ); | |
| | | | |
|
| | | /** Signal emitted when renderer is changed */ | |
| | | void rendererChanged(); | |
| | | | |
| protected: | | protected: | |
| /** Set the extent */ | | /** Set the extent */ | |
| virtual void setExtent( const QgsRectangle &rect ); | | virtual void setExtent( const QgsRectangle &rect ); | |
| | | | |
| /** set whether layer is valid or not - should be used in constructor. | | /** set whether layer is valid or not - should be used in constructor. | |
| \note added in v1.5 */ | | \note added in v1.5 */ | |
| void setValid( bool valid ); | | void setValid( bool valid ); | |
| | | | |
| /** called by readLayerXML(), used by children to read state specific t
o them from | | /** called by readLayerXML(), used by children to read state specific t
o them from | |
| project files. | | project files. | |
| | | | |
| skipping to change at line 504 | | skipping to change at line 515 | |
| | | | |
| /**Attribution of the layer*/ | | /**Attribution of the layer*/ | |
| QString mAttribution; | | QString mAttribution; | |
| QString mAttributionUrl; | | QString mAttributionUrl; | |
| | | | |
| /**MetadataUrl of the layer*/ | | /**MetadataUrl of the layer*/ | |
| QString mMetadataUrl; | | QString mMetadataUrl; | |
| QString mMetadataUrlType; | | QString mMetadataUrlType; | |
| QString mMetadataUrlFormat; | | QString mMetadataUrlFormat; | |
| | | | |
|
| | | /**WMS legend*/ | |
| | | QString mLegendUrl; | |
| | | QString mLegendUrlFormat; | |
| | | | |
| /** \brief Error */ | | /** \brief Error */ | |
| QgsError mError; | | QgsError mError; | |
| | | | |
| private: | | private: | |
| /** layer's spatial reference system. | | /** layer's spatial reference system. | |
| private to make sure setCrs must be used and layerCrsChanged() is e
mitted */ | | private to make sure setCrs must be used and layerCrsChanged() is e
mitted */ | |
| QgsCoordinateReferenceSystem* mCRS; | | QgsCoordinateReferenceSystem* mCRS; | |
| | | | |
| /** private copy constructor - QgsMapLayer not copyable */ | | /** private copy constructor - QgsMapLayer not copyable */ | |
| QgsMapLayer( QgsMapLayer const & ); | | QgsMapLayer( QgsMapLayer const & ); | |
| | | | |
| skipping to change at line 540 | | skipping to change at line 555 | |
| /** Minimum scale denominator at which this layer should be displayed *
/ | | /** Minimum scale denominator at which this layer should be displayed *
/ | |
| float mMinScale; | | float mMinScale; | |
| /** Maximum scale denominator at which this layer should be displayed *
/ | | /** Maximum scale denominator at which this layer should be displayed *
/ | |
| float mMaxScale; | | float mMaxScale; | |
| /** A flag that tells us whether to use the above vars to restrict laye
r visibility */ | | /** A flag that tells us whether to use the above vars to restrict laye
r visibility */ | |
| bool mScaleBasedVisibility; | | bool mScaleBasedVisibility; | |
| | | | |
| /** Collection of undoable operations for this layer. **/ | | /** Collection of undoable operations for this layer. **/ | |
| QUndoStack mUndoStack; | | QUndoStack mUndoStack; | |
| | | | |
|
| QMap<QString, QVariant> mCustomProperties; | | //! Layer's persistent storage of additional properties (may be used by | |
| | | plugins) | |
| /**QImage for caching of rendering operations | | QgsObjectCustomProperties mCustomProperties; | |
| * @note This property was added in QGIS 1.4 **/ | | | |
| QImage * mpCacheImage; | | | |
| | | | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 14 change blocks. |
| 42 lines changed or deleted | | 62 lines changed or added | |
|
| qgsmaprenderer.h | | qgsmaprenderer.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| #include <QMutex> | | #include <QMutex> | |
| #include <QSize> | | #include <QSize> | |
| #include <QStringList> | | #include <QStringList> | |
| #include <QVector> | | #include <QVector> | |
| #include <QPainter> | | #include <QPainter> | |
| | | | |
| #include "qgis.h" | | #include "qgis.h" | |
| #include "qgsrectangle.h" | | #include "qgsrectangle.h" | |
| #include "qgsrendercontext.h" | | #include "qgsrendercontext.h" | |
| #include "qgsfeature.h" | | #include "qgsfeature.h" | |
|
| | | #include "qgsmapsettings.h" | |
| | | | |
| class QDomDocument; | | class QDomDocument; | |
| class QDomNode; | | class QDomNode; | |
| class QPainter; | | class QPainter; | |
| | | | |
| class QgsMapToPixel; | | class QgsMapToPixel; | |
| class QgsMapLayer; | | class QgsMapLayer; | |
| class QgsMapRenderer; | | class QgsMapRenderer; | |
| class QgsScaleCalculator; | | class QgsScaleCalculator; | |
| class QgsCoordinateReferenceSystem; | | class QgsCoordinateReferenceSystem; | |
| | | | |
| skipping to change at line 75 | | skipping to change at line 76 | |
| /** Labeling engine interface. | | /** Labeling engine interface. | |
| * \note Added in QGIS v1.4 | | * \note Added in QGIS v1.4 | |
| */ | | */ | |
| class CORE_EXPORT QgsLabelingEngineInterface | | class CORE_EXPORT QgsLabelingEngineInterface | |
| { | | { | |
| public: | | public: | |
| | | | |
| virtual ~QgsLabelingEngineInterface() {} | | virtual ~QgsLabelingEngineInterface() {} | |
| | | | |
| //! called when we're going to start with rendering | | //! called when we're going to start with rendering | |
|
| virtual void init( QgsMapRenderer* mp ) = 0; | | //! @deprecated since 2.4 - use override with QgsMapSettings | |
| | | Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mp ) = 0; | |
| | | //! called when we're going to start with rendering | |
| | | virtual void init( const QgsMapSettings& mapSettings ) = 0; | |
| //! called to find out whether the layer is used for labeling | | //! called to find out whether the layer is used for labeling | |
| virtual bool willUseLayer( QgsVectorLayer* layer ) = 0; | | virtual bool willUseLayer( QgsVectorLayer* layer ) = 0; | |
| //! clears all PAL layer settings for registered layers | | //! clears all PAL layer settings for registered layers | |
| //! @note: this method was added in version 1.9 | | //! @note: this method was added in version 1.9 | |
| virtual void clearActiveLayers() = 0; | | virtual void clearActiveLayers() = 0; | |
| //! clears data defined objects from PAL layer settings for a registere
d layer | | //! clears data defined objects from PAL layer settings for a registere
d layer | |
| //! @note: this method was added in version 1.9 | | //! @note: this method was added in version 1.9 | |
|
| virtual void clearActiveLayer( QgsVectorLayer* layer ) = 0; | | virtual void clearActiveLayer( const QString& layerID ) = 0; | |
| //! called when starting rendering of a layer | | //! called when starting rendering of a layer | |
| //! @note: this method was added in version 1.6 | | //! @note: this method was added in version 1.6 | |
|
| virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices
, QgsRenderContext& ctx ) = 0; | | virtual int prepareLayer( QgsVectorLayer* layer, QStringList& attrNames
, QgsRenderContext& ctx ) = 0; | |
| //! returns PAL layer settings for a registered layer | | //! returns PAL layer settings for a registered layer | |
| //! @note: this method was added in version 1.9 | | //! @note: this method was added in version 1.9 | |
| virtual QgsPalLayerSettings& layer( const QString& layerName ) = 0; | | virtual QgsPalLayerSettings& layer( const QString& layerName ) = 0; | |
| //! adds a diagram layer to the labeling engine | | //! adds a diagram layer to the labeling engine | |
|
| virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSett
ings* s ) | | virtual int addDiagramLayer( QgsVectorLayer* layer, const QgsDiagramLay
erSettings* s ) | |
| { Q_UNUSED( layer ); Q_UNUSED( s ); return 0; } | | { Q_UNUSED( layer ); Q_UNUSED( s ); return 0; } | |
| //! called for every feature | | //! called for every feature | |
|
| virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat,
const QgsRenderContext& context = QgsRenderContext() ) = 0; | | virtual void registerFeature( const QString& layerID, QgsFeature& feat,
const QgsRenderContext& context = QgsRenderContext() ) = 0; | |
| //! called for every diagram feature | | //! called for every diagram feature | |
|
| virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& | | virtual void registerDiagramFeature( const QString& layerID, QgsFeature | |
| feat, const QgsRenderContext& context = QgsRenderContext() ) | | & feat, const QgsRenderContext& context = QgsRenderContext() ) | |
| { Q_UNUSED( layer ); Q_UNUSED( feat ); Q_UNUSED( context ); } | | { Q_UNUSED( layerID ); Q_UNUSED( feat ); Q_UNUSED( context ); } | |
| //! called when the map is drawn and labels should be placed | | //! called when the map is drawn and labels should be placed | |
| virtual void drawLabeling( QgsRenderContext& context ) = 0; | | virtual void drawLabeling( QgsRenderContext& context ) = 0; | |
| //! called when we're done with rendering | | //! called when we're done with rendering | |
| virtual void exit() = 0; | | virtual void exit() = 0; | |
| //! return infos about labels at a given (map) position | | //! return infos about labels at a given (map) position | |
| //! @note: this method was added in version 1.7 | | //! @note: this method was added in version 1.7 | |
|
| virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) = | | //! @deprecated since 2.4 - use takeResults() and methods of QgsLabelin | |
| 0; | | gResults | |
| | | Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( con | |
| | | st QgsPoint& p ) = 0; | |
| //! return infos about labels within a given (map) rectangle | | //! return infos about labels within a given (map) rectangle | |
| //! @note: this method was added in version 1.9 | | //! @note: this method was added in version 1.9 | |
|
| virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r | | //! @deprecated since 2.4 - use takeResults() and methods of QgsLabelin | |
| ) = 0; | | gResults | |
| | | Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( con | |
| | | st QgsRectangle& r ) = 0; | |
| | | | |
| //! called when passing engine among map renderers | | //! called when passing engine among map renderers | |
| virtual QgsLabelingEngineInterface* clone() = 0; | | virtual QgsLabelingEngineInterface* clone() = 0; | |
| }; | | }; | |
| | | | |
| struct CORE_EXPORT QgsLayerCoordinateTransform | | struct CORE_EXPORT QgsLayerCoordinateTransform | |
| { | | { | |
| QString srcAuthId; | | QString srcAuthId; | |
| QString destAuthId; | | QString destAuthId; | |
| int srcDatumTransform; //-1 if unknown or not specified | | int srcDatumTransform; //-1 if unknown or not specified | |
| int destDatumTransform; | | int destDatumTransform; | |
| }; | | }; | |
| | | | |
|
| | | // ### QGIS 3: remove QgsMapRenderer in favor of QgsMapRendererJob | |
| | | | |
| /** \ingroup core | | /** \ingroup core | |
| * A non GUI class for rendering a map layer set onto a QPainter. | | * A non GUI class for rendering a map layer set onto a QPainter. | |
| */ | | */ | |
| | | | |
| class CORE_EXPORT QgsMapRenderer : public QObject | | class CORE_EXPORT QgsMapRenderer : public QObject | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
| | | | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 174 | |
| BlendSubtract | | BlendSubtract | |
| }; | | }; | |
| | | | |
| //! constructor | | //! constructor | |
| QgsMapRenderer(); | | QgsMapRenderer(); | |
| | | | |
| //! destructor | | //! destructor | |
| ~QgsMapRenderer(); | | ~QgsMapRenderer(); | |
| | | | |
| //! starts rendering | | //! starts rendering | |
|
| //! @ param forceWidthScale Force a specific scale factor for line widt | | //! @param painter painter to render to | |
| hs and marker sizes. Automatically calculated from output device DPI if 0 | | //! @param forceWidthScale Force a specific scale factor for line width | |
| | | s and marker sizes. Automatically calculated from output device DPI if 0 | |
| void render( QPainter* painter, double* forceWidthScale = 0 ); | | void render( QPainter* painter, double* forceWidthScale = 0 ); | |
| | | | |
| //! sets extent and checks whether suitable (returns false if not) | | //! sets extent and checks whether suitable (returns false if not) | |
| bool setExtent( const QgsRectangle& extent ); | | bool setExtent( const QgsRectangle& extent ); | |
| | | | |
| //! returns current extent | | //! returns current extent | |
| QgsRectangle extent() const; | | QgsRectangle extent() const; | |
| | | | |
| const QgsMapToPixel* coordinateTransform() { return &( mRenderContext.m
apToPixel() ); } | | const QgsMapToPixel* coordinateTransform() { return &( mRenderContext.m
apToPixel() ); } | |
| | | | |
| //! Scale denominator | | //! Scale denominator | |
| double scale() const { return mScale; } | | double scale() const { return mScale; } | |
| /**Sets scale for scale based visibility. Normally, the scale is calcul
ated automatically. This | | /**Sets scale for scale based visibility. Normally, the scale is calcul
ated automatically. This | |
| function is only used to force a preview scale (e.g. for print compose
r)*/ | | function is only used to force a preview scale (e.g. for print compose
r)*/ | |
| void setScale( double scale ) {mScale = scale;} | | void setScale( double scale ) {mScale = scale;} | |
| double mapUnitsPerPixel() const { return mMapUnitsPerPixel; } | | double mapUnitsPerPixel() const { return mMapUnitsPerPixel; } | |
| | | | |
|
| int width() const { return mSize.width(); }; | | int width() const { return ( int ) mSize.width(); } | |
| int height() const { return mSize.height(); }; | | int height() const { return ( int ) mSize.height(); } | |
| | | | |
| //! Recalculate the map scale | | //! Recalculate the map scale | |
| void updateScale(); | | void updateScale(); | |
| | | | |
| QGis::UnitType mapUnits() const; | | QGis::UnitType mapUnits() const; | |
| void setMapUnits( QGis::UnitType u ); | | void setMapUnits( QGis::UnitType u ); | |
| | | | |
| //! sets whether map image will be for overview | | //! sets whether map image will be for overview | |
| void enableOverviewMode( bool isOverview = true ) { mOverview = isOverv
iew; } | | void enableOverviewMode( bool isOverview = true ) { mOverview = isOverv
iew; } | |
| | | | |
| | | | |
| skipping to change at line 252 | | skipping to change at line 261 | |
| */ | | */ | |
| QgsRectangle mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRectangle
rect ); | | QgsRectangle mapToLayerCoordinates( QgsMapLayer* theLayer, QgsRectangle
rect ); | |
| | | | |
| //! sets whether to use projections for this layer set | | //! sets whether to use projections for this layer set | |
| void setProjectionsEnabled( bool enabled ); | | void setProjectionsEnabled( bool enabled ); | |
| | | | |
| //! returns true if projections are enabled for this layer set | | //! returns true if projections are enabled for this layer set | |
| bool hasCrsTransformEnabled() const; | | bool hasCrsTransformEnabled() const; | |
| | | | |
| //! sets destination coordinate reference system | | //! sets destination coordinate reference system | |
|
| void setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool r
efreshCoordinateTransformInfo = true ); | | void setDestinationCrs( const QgsCoordinateReferenceSystem& crs, bool r
efreshCoordinateTransformInfo = true, bool transformExtent = true ); | |
| | | | |
| //! returns CRS of destination coordinate reference system | | //! returns CRS of destination coordinate reference system | |
| const QgsCoordinateReferenceSystem& destinationCrs() const; | | const QgsCoordinateReferenceSystem& destinationCrs() const; | |
| | | | |
| void setOutputUnits( OutputUnits u ) {mOutputUnits = u;} | | void setOutputUnits( OutputUnits u ) {mOutputUnits = u;} | |
| | | | |
| OutputUnits outputUnits() const {return mOutputUnits;} | | OutputUnits outputUnits() const {return mOutputUnits;} | |
| | | | |
| //! returns current extent of layer set | | //! returns current extent of layer set | |
| QgsRectangle fullExtent(); | | QgsRectangle fullExtent(); | |
| | | | |
| skipping to change at line 303 | | skipping to change at line 312 | |
| static QPainter::CompositionMode getCompositionMode( const QgsMapRender
er::BlendMode &blendMode ); | | static QPainter::CompositionMode getCompositionMode( const QgsMapRender
er::BlendMode &blendMode ); | |
| //! Returns a BlendMode corresponding to a QPainter::CompositionMode | | //! Returns a BlendMode corresponding to a QPainter::CompositionMode | |
| //! Added in 1.9 | | //! Added in 1.9 | |
| static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::Comp
ositionMode &blendMode ); | | static QgsMapRenderer::BlendMode getBlendModeEnum( const QPainter::Comp
ositionMode &blendMode ); | |
| | | | |
| void addLayerCoordinateTransform( const QString& layerId, const QString
& srcAuthId, const QString& destAuthId, int srcDatumTransform = -1, int des
tDatumTransform = -1 ); | | void addLayerCoordinateTransform( const QString& layerId, const QString
& srcAuthId, const QString& destAuthId, int srcDatumTransform = -1, int des
tDatumTransform = -1 ); | |
| void clearLayerCoordinateTransforms(); | | void clearLayerCoordinateTransforms(); | |
| | | | |
| const QgsCoordinateTransform* transformation( const QgsMapLayer *layer
) const; | | const QgsCoordinateTransform* transformation( const QgsMapLayer *layer
) const; | |
| | | | |
|
| | | //! bridge to QgsMapSettings | |
| | | //! @note added in 2.4 | |
| | | const QgsMapSettings& mapSettings(); | |
| | | | |
| signals: | | signals: | |
| | | | |
|
| | | //! @deprecated in 2.4 - not emitted anymore | |
| void drawingProgress( int current, int total ); | | void drawingProgress( int current, int total ); | |
| | | | |
| /** This signal is emitted when CRS transformation is enabled/disabled. | | /** This signal is emitted when CRS transformation is enabled/disabled. | |
| * @param flag true if transformation is enabled. | | * @param flag true if transformation is enabled. | |
| * @deprecated Use hasCrsTransformEnabledChanged( bool flag ) | | * @deprecated Use hasCrsTransformEnabledChanged( bool flag ) | |
| * to avoid conflict with method of the same name). */ | | * to avoid conflict with method of the same name). */ | |
| #ifndef Q_MOC_RUN | | #ifndef Q_MOC_RUN | |
| Q_DECL_DEPRECATED | | Q_DECL_DEPRECATED | |
| #endif | | #endif | |
| void hasCrsTransformEnabled( bool flag ); | | void hasCrsTransformEnabled( bool flag ); | |
| | | | |
| /** This signal is emitted when CRS transformation is enabled/disabled. | | /** This signal is emitted when CRS transformation is enabled/disabled. | |
| * @param flag true if transformation is enabled. | | * @param flag true if transformation is enabled. | |
|
| * @note Added in 2.1 */ | | * @note Added in 2.4 */ | |
| void hasCrsTransformEnabledChanged( bool flag ); | | void hasCrsTransformEnabledChanged( bool flag ); | |
| | | | |
| void destinationSrsChanged(); | | void destinationSrsChanged(); | |
| | | | |
|
| | | //! @deprecated in 2.4 - not emitted anymore | |
| void updateMap(); | | void updateMap(); | |
| | | | |
| void mapUnitsChanged(); | | void mapUnitsChanged(); | |
| | | | |
| //! emitted when layer's draw() returned false | | //! emitted when layer's draw() returned false | |
| void drawError( QgsMapLayer* ); | | void drawError( QgsMapLayer* ); | |
| | | | |
|
| | | //! emitted when the current extent gets changed | |
| | | //! @note added in 2.4 | |
| | | void extentsChanged(); | |
| | | | |
| //! Notifies higher level components to show the datum transform dialog
and add a QgsLayerCoordinateTransformInfo for that layer | | //! Notifies higher level components to show the datum transform dialog
and add a QgsLayerCoordinateTransformInfo for that layer | |
| void datumTransformInfoRequested( const QgsMapLayer* ml, const QString&
srcAuthId, const QString& destAuthId ) const; | | void datumTransformInfoRequested( const QgsMapLayer* ml, const QString&
srcAuthId, const QString& destAuthId ) const; | |
| | | | |
| public slots: | | public slots: | |
| | | | |
|
| //! called by signal from layer current being drawn | | //! @deprecated in 2.4 - does nothing | |
| void onDrawingProgress( int current, int total ); | | Q_DECL_DEPRECATED void onDrawingProgress( int current, int total ); | |
| | | | |
| protected: | | protected: | |
| | | | |
| //! adjust extent to fit the pixmap size | | //! adjust extent to fit the pixmap size | |
| void adjustExtentToSize(); | | void adjustExtentToSize(); | |
| | | | |
| /** Convenience function to project an extent into the layer source | | /** Convenience function to project an extent into the layer source | |
| * CRS, but also split it into two extents if it crosses | | * CRS, but also split it into two extents if it crosses | |
| * the +/- 180 degree line. Modifies the given extent to be in the | | * the +/- 180 degree line. Modifies the given extent to be in the | |
| * source CRS coordinates, and if it was split, returns true, and | | * source CRS coordinates, and if it was split, returns true, and | |
| | | | |
| skipping to change at line 405 | | skipping to change at line 424 | |
| | | | |
| //!Output units | | //!Output units | |
| OutputUnits mOutputUnits; | | OutputUnits mOutputUnits; | |
| | | | |
| //! Labeling engine (NULL by default) | | //! Labeling engine (NULL by default) | |
| QgsLabelingEngineInterface* mLabelingEngine; | | QgsLabelingEngineInterface* mLabelingEngine; | |
| | | | |
| //! Locks rendering loop for concurrent draws | | //! Locks rendering loop for concurrent draws | |
| QMutex mRenderMutex; | | QMutex mRenderMutex; | |
| | | | |
|
| | | //! map settings - used only for export in mapSettings() for use in cla | |
| | | sses that deal with QgsMapSettings | |
| | | QgsMapSettings mMapSettings; | |
| | | | |
| QHash< QString, QgsLayerCoordinateTransform > mLayerCoordinateTransform
Info; | | QHash< QString, QgsLayerCoordinateTransform > mLayerCoordinateTransform
Info; | |
| | | | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 20 change blocks. |
| 20 lines changed or deleted | | 45 lines changed or added | |
|
| qgspallabeling.h | | qgspallabeling.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
| qgspallabeling.h | | qgspallabeling.h | |
| Smart labeling for vector layers | | Smart labeling for vector layers | |
| ------------------- | | ------------------- | |
|
| begin : June 2009 | | begin : June 2009 | |
| copyright : (C) Martin Dobias | | copyright : (C) Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| | | | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| | | | |
| class QFontMetricsF; | | class QFontMetricsF; | |
| class QPainter; | | class QPainter; | |
| class QPicture; | | class QPicture; | |
| class QgsGeometry; | | class QgsGeometry; | |
| class QgsMapRenderer; | | class QgsMapRenderer; | |
| class QgsRectangle; | | class QgsRectangle; | |
| class QgsCoordinateTransform; | | class QgsCoordinateTransform; | |
| class QgsLabelSearchTree; | | class QgsLabelSearchTree; | |
| | | | |
|
| | | class QgsMapSettings; | |
| | | | |
| #include <QString> | | #include <QString> | |
| #include <QFont> | | #include <QFont> | |
| #include <QFontDatabase> | | #include <QFontDatabase> | |
| #include <QColor> | | #include <QColor> | |
| #include <QHash> | | #include <QHash> | |
| #include <QList> | | #include <QList> | |
| #include <QRectF> | | #include <QRectF> | |
| | | | |
| namespace pal | | namespace pal | |
| { | | { | |
| | | | |
| skipping to change at line 57 | | skipping to change at line 59 | |
| | | | |
| class QgsMapToPixel; | | class QgsMapToPixel; | |
| class QgsFeature; | | class QgsFeature; | |
| | | | |
| #include "qgspoint.h" | | #include "qgspoint.h" | |
| #include "qgsrectangle.h" | | #include "qgsrectangle.h" | |
| #include "qgsmaprenderer.h" // definition of QgsLabelingEngineInterface | | #include "qgsmaprenderer.h" // definition of QgsLabelingEngineInterface | |
| #include "qgsexpression.h" | | #include "qgsexpression.h" | |
| #include "qgsdatadefined.h" | | #include "qgsdatadefined.h" | |
| #include "qgsdiagramrendererv2.h" | | #include "qgsdiagramrendererv2.h" | |
|
| | | #include "qgsmapunitscale.h" | |
| | | | |
| class QgsPalGeometry; | | class QgsPalGeometry; | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
| | | | |
| class CORE_EXPORT QgsPalLayerSettings | | class CORE_EXPORT QgsPalLayerSettings | |
| { | | { | |
| public: | | public: | |
| QgsPalLayerSettings(); | | QgsPalLayerSettings(); | |
| QgsPalLayerSettings( const QgsPalLayerSettings& s ); | | QgsPalLayerSettings( const QgsPalLayerSettings& s ); | |
| ~QgsPalLayerSettings(); | | ~QgsPalLayerSettings(); | |
| | | | |
|
| | | //! @note added in 2.4 | |
| | | static QgsPalLayerSettings fromLayer( QgsVectorLayer* layer ); | |
| | | | |
| enum Placement | | enum Placement | |
| { | | { | |
| AroundPoint, // Point / Polygon | | AroundPoint, // Point / Polygon | |
| OverPoint, // Point / Polygon | | OverPoint, // Point / Polygon | |
| Line, // Line / Polygon | | Line, // Line / Polygon | |
| Curved, // Line | | Curved, // Line | |
| Horizontal, // Polygon | | Horizontal, // Polygon | |
| Free // Polygon | | Free // Polygon | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 251 | | skipping to change at line 257 | |
| LabelDistance = 13, | | LabelDistance = 13, | |
| DistanceUnits = 81, | | DistanceUnits = 81, | |
| OffsetRotation = 82, | | OffsetRotation = 82, | |
| CurvedCharAngleInOut = 83, | | CurvedCharAngleInOut = 83, | |
| // (data defined only) | | // (data defined only) | |
| PositionX = 9, //x-coordinate data defined label position | | PositionX = 9, //x-coordinate data defined label position | |
| PositionY = 10, //y-coordinate data defined label position | | PositionY = 10, //y-coordinate data defined label position | |
| Hali = 11, //horizontal alignment for data defined label position (Le
ft, Center, Right) | | Hali = 11, //horizontal alignment for data defined label position (Le
ft, Center, Right) | |
| Vali = 12, //vertical alignment for data defined label position (Bott
om, Base, Half, Cap, Top) | | Vali = 12, //vertical alignment for data defined label position (Bott
om, Base, Half, Cap, Top) | |
| Rotation = 14, //data defined rotation | | Rotation = 14, //data defined rotation | |
|
| | | RepeatDistance = 84, | |
| | | RepeatDistanceUnit = 86, | |
| | | | |
| // rendering | | // rendering | |
| ScaleVisibility = 23, | | ScaleVisibility = 23, | |
| MinScale = 16, | | MinScale = 16, | |
| MaxScale = 17, | | MaxScale = 17, | |
| FontLimitPixel = 24, | | FontLimitPixel = 24, | |
| FontMinPixel = 25, | | FontMinPixel = 25, | |
| FontMaxPixel = 26, | | FontMaxPixel = 26, | |
| // (data defined only) | | // (data defined only) | |
| Show = 15, | | Show = 15, | |
| | | | |
| skipping to change at line 282 | | skipping to change at line 290 | |
| */ | | */ | |
| bool isExpression; | | bool isExpression; | |
| | | | |
| /** Returns the QgsExpression for this label settings. | | /** Returns the QgsExpression for this label settings. | |
| */ | | */ | |
| QgsExpression* getLabelExpression(); | | QgsExpression* getLabelExpression(); | |
| | | | |
| QFont textFont; | | QFont textFont; | |
| QString textNamedStyle; | | QString textNamedStyle; | |
| bool fontSizeInMapUnits; //true if font size is in map units (otherwise
in points) | | bool fontSizeInMapUnits; //true if font size is in map units (otherwise
in points) | |
|
| | | QgsMapUnitScale fontSizeMapUnitScale; // scale range for map units for
font size | |
| QColor textColor; | | QColor textColor; | |
| int textTransp; | | int textTransp; | |
| QPainter::CompositionMode blendMode; | | QPainter::CompositionMode blendMode; | |
| QColor previewBkgrdColor; | | QColor previewBkgrdColor; | |
| | | | |
| //-- text formatting | | //-- text formatting | |
| | | | |
| QString wrapChar; | | QString wrapChar; | |
| double multilineHeight; //0.0 to 10.0, leading between lines as multipl
yer of line height | | double multilineHeight; //0.0 to 10.0, leading between lines as multipl
yer of line height | |
| MultiLineAlign multilineAlign; // horizontal alignment of multi-line la
bels | | MultiLineAlign multilineAlign; // horizontal alignment of multi-line la
bels | |
| | | | |
| skipping to change at line 311 | | skipping to change at line 320 | |
| | | | |
| bool formatNumbers; | | bool formatNumbers; | |
| int decimals; | | int decimals; | |
| bool plusSign; | | bool plusSign; | |
| | | | |
| //-- text buffer | | //-- text buffer | |
| | | | |
| bool bufferDraw; | | bool bufferDraw; | |
| double bufferSize; // buffer size | | double bufferSize; // buffer size | |
| bool bufferSizeInMapUnits; //true if buffer is in map units (otherwise
in mm) | | bool bufferSizeInMapUnits; //true if buffer is in map units (otherwise
in mm) | |
|
| | | QgsMapUnitScale bufferSizeMapUnitScale; // scale range for map units fo
r buffer size | |
| QColor bufferColor; | | QColor bufferColor; | |
| bool bufferNoFill; //set interior of buffer to 100% transparent | | bool bufferNoFill; //set interior of buffer to 100% transparent | |
| int bufferTransp; | | int bufferTransp; | |
| Qt::PenJoinStyle bufferJoinStyle; | | Qt::PenJoinStyle bufferJoinStyle; | |
| QPainter::CompositionMode bufferBlendMode; | | QPainter::CompositionMode bufferBlendMode; | |
| | | | |
| //-- shape background | | //-- shape background | |
| | | | |
| bool shapeDraw; | | bool shapeDraw; | |
| ShapeType shapeType; | | ShapeType shapeType; | |
| QString shapeSVGFile; | | QString shapeSVGFile; | |
| SizeType shapeSizeType; | | SizeType shapeSizeType; | |
| QPointF shapeSize; | | QPointF shapeSize; | |
| SizeUnit shapeSizeUnits; | | SizeUnit shapeSizeUnits; | |
|
| | | QgsMapUnitScale shapeSizeMapUnitScale; | |
| RotationType shapeRotationType; | | RotationType shapeRotationType; | |
| double shapeRotation; | | double shapeRotation; | |
| QPointF shapeOffset; | | QPointF shapeOffset; | |
| SizeUnit shapeOffsetUnits; | | SizeUnit shapeOffsetUnits; | |
|
| | | QgsMapUnitScale shapeOffsetMapUnitScale; | |
| QPointF shapeRadii; | | QPointF shapeRadii; | |
| SizeUnit shapeRadiiUnits; | | SizeUnit shapeRadiiUnits; | |
|
| | | QgsMapUnitScale shapeRadiiMapUnitScale; | |
| int shapeTransparency; | | int shapeTransparency; | |
| QPainter::CompositionMode shapeBlendMode; | | QPainter::CompositionMode shapeBlendMode; | |
| QColor shapeFillColor; | | QColor shapeFillColor; | |
| QColor shapeBorderColor; | | QColor shapeBorderColor; | |
| double shapeBorderWidth; | | double shapeBorderWidth; | |
| SizeUnit shapeBorderWidthUnits; | | SizeUnit shapeBorderWidthUnits; | |
|
| | | QgsMapUnitScale shapeBorderWidthMapUnitScale; | |
| Qt::PenJoinStyle shapeJoinStyle; | | Qt::PenJoinStyle shapeJoinStyle; | |
| | | | |
| //-- drop shadow | | //-- drop shadow | |
| | | | |
| bool shadowDraw; | | bool shadowDraw; | |
| ShadowType shadowUnder; | | ShadowType shadowUnder; | |
| int shadowOffsetAngle; | | int shadowOffsetAngle; | |
| double shadowOffsetDist; | | double shadowOffsetDist; | |
| SizeUnit shadowOffsetUnits; | | SizeUnit shadowOffsetUnits; | |
|
| | | QgsMapUnitScale shadowOffsetMapUnitScale; | |
| bool shadowOffsetGlobal; | | bool shadowOffsetGlobal; | |
| double shadowRadius; | | double shadowRadius; | |
| SizeUnit shadowRadiusUnits; | | SizeUnit shadowRadiusUnits; | |
|
| | | QgsMapUnitScale shadowRadiusMapUnitScale; | |
| bool shadowRadiusAlphaOnly; | | bool shadowRadiusAlphaOnly; | |
| int shadowTransparency; | | int shadowTransparency; | |
| int shadowScale; | | int shadowScale; | |
| QColor shadowColor; | | QColor shadowColor; | |
| QPainter::CompositionMode shadowBlendMode; | | QPainter::CompositionMode shadowBlendMode; | |
| | | | |
| //-- placement | | //-- placement | |
| | | | |
| Placement placement; | | Placement placement; | |
| unsigned int placementFlags; | | unsigned int placementFlags; | |
| | | | |
| bool centroidWhole; // whether centroid calculated from whole or visibl
e polygon | | bool centroidWhole; // whether centroid calculated from whole or visibl
e polygon | |
|
| | | bool centroidInside; // whether centroid-point calculated must be insid
e polygon | |
| double dist; // distance from the feature (in mm) | | double dist; // distance from the feature (in mm) | |
| bool distInMapUnits; //true if distance is in map units (otherwise in m
m) | | bool distInMapUnits; //true if distance is in map units (otherwise in m
m) | |
|
| | | QgsMapUnitScale distMapUnitScale; | |
| | | | |
| | | double repeatDistance; | |
| | | SizeUnit repeatDistanceUnit; | |
| | | QgsMapUnitScale repeatDistanceMapUnitScale; | |
| | | | |
| // offset labels of point/centroid features default to center | | // offset labels of point/centroid features default to center | |
| // move label to quadrant: left/down, don't move, right/up (-1, 0, 1) | | // move label to quadrant: left/down, don't move, right/up (-1, 0, 1) | |
| QuadrantPosition quadOffset; | | QuadrantPosition quadOffset; | |
| | | | |
| double xOffset; // offset from point in mm or map units | | double xOffset; // offset from point in mm or map units | |
| double yOffset; // offset from point in mm or map units | | double yOffset; // offset from point in mm or map units | |
| bool labelOffsetInMapUnits; //true if label offset is in map units (oth
erwise in mm) | | bool labelOffsetInMapUnits; //true if label offset is in map units (oth
erwise in mm) | |
|
| | | QgsMapUnitScale labelOffsetMapUnitScale; | |
| double angleOffset; // rotation applied to offset labels | | double angleOffset; // rotation applied to offset labels | |
| bool preserveRotation; // preserve predefined rotation data during labe
l pin/unpin operations | | bool preserveRotation; // preserve predefined rotation data during labe
l pin/unpin operations | |
| | | | |
| double maxCurvedCharAngleIn; // maximum angle between inside curved lab
el characters (defaults to 20.0, range 20.0 to 60.0) | | double maxCurvedCharAngleIn; // maximum angle between inside curved lab
el characters (defaults to 20.0, range 20.0 to 60.0) | |
| double maxCurvedCharAngleOut; // maximum angle between outside curved l
abel characters (defaults to -20.0, range -20.0 to -95.0) | | double maxCurvedCharAngleOut; // maximum angle between outside curved l
abel characters (defaults to -20.0, range -20.0 to -95.0) | |
| | | | |
| int priority; // 0 = low, 10 = high | | int priority; // 0 = low, 10 = high | |
| | | | |
| //-- rendering | | //-- rendering | |
| | | | |
| | | | |
| skipping to change at line 409 | | skipping to change at line 432 | |
| bool obstacle; // whether features for layer are obstacles to labels of
other layers | | bool obstacle; // whether features for layer are obstacles to labels of
other layers | |
| | | | |
| //-- scale factors | | //-- scale factors | |
| double vectorScaleFactor; //scale factor painter units->pixels | | double vectorScaleFactor; //scale factor painter units->pixels | |
| double rasterCompressFactor; //pixel resolution scale factor | | double rasterCompressFactor; //pixel resolution scale factor | |
| | | | |
| // called from register feature hook | | // called from register feature hook | |
| void calculateLabelSize( const QFontMetricsF* fm, QString text, double&
labelX, double& labelY, QgsFeature* f = 0 ); | | void calculateLabelSize( const QFontMetricsF* fm, QString text, double&
labelX, double& labelY, QgsFeature* f = 0 ); | |
| | | | |
| // implementation of register feature hook | | // implementation of register feature hook | |
|
| void registerFeature( QgsVectorLayer* layer, QgsFeature& f, const QgsRe
nderContext& context ); | | void registerFeature( QgsFeature& f, const QgsRenderContext& context ); | |
| | | | |
| void readFromLayer( QgsVectorLayer* layer ); | | void readFromLayer( QgsVectorLayer* layer ); | |
| void writeToLayer( QgsVectorLayer* layer ); | | void writeToLayer( QgsVectorLayer* layer ); | |
| | | | |
| /** Get a data defined property pointer | | /** Get a data defined property pointer | |
| * @note added in 1.9, helpful for Python access | | * @note added in 1.9, helpful for Python access | |
| */ | | */ | |
| QgsDataDefined* dataDefinedProperty( QgsPalLayerSettings::DataDefinedPr
operties p ); | | QgsDataDefined* dataDefinedProperty( QgsPalLayerSettings::DataDefinedPr
operties p ); | |
| | | | |
| /** Set a property as data defined | | /** Set a property as data defined | |
| | | | |
| skipping to change at line 467 | | skipping to change at line 490 | |
| | | | |
| /** Map of current data defined properties | | /** Map of current data defined properties | |
| */ | | */ | |
| QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* > dat
aDefinedProperties; | | QMap< QgsPalLayerSettings::DataDefinedProperties, QgsDataDefined* > dat
aDefinedProperties; | |
| | | | |
| /** Calculates pixel size (considering output size should be in pixel o
r map units, scale factors and optionally oversampling) | | /** Calculates pixel size (considering output size should be in pixel o
r map units, scale factors and optionally oversampling) | |
| * @param size size to convert | | * @param size size to convert | |
| * @param c rendercontext | | * @param c rendercontext | |
| * @param unit SizeUnit enum value of size | | * @param unit SizeUnit enum value of size | |
| * @param rasterfactor whether to consider oversampling | | * @param rasterfactor whether to consider oversampling | |
|
| | | * @param mapUnitScale a mapUnitScale clamper | |
| * @return font pixel size | | * @return font pixel size | |
| */ | | */ | |
|
| int sizeToPixel( double size, const QgsRenderContext& c , SizeUnit unit
, bool rasterfactor = false ) const; | | int sizeToPixel( double size, const QgsRenderContext& c , SizeUnit unit
, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale = QgsMapUn
itScale() ) const; | |
| | | | |
| /** Calculates size (considering output size should be in pixel or map
units, scale factors and optionally oversampling) | | /** Calculates size (considering output size should be in pixel or map
units, scale factors and optionally oversampling) | |
| * @param size size to convert | | * @param size size to convert | |
| * @param c rendercontext | | * @param c rendercontext | |
| * @param unit SizeUnit enum value of size | | * @param unit SizeUnit enum value of size | |
| * @param rasterfactor whether to consider oversampling | | * @param rasterfactor whether to consider oversampling | |
|
| | | * @param mapUnitScale a mapUnitScale clamper | |
| * @return size that will render, as double | | * @return size that will render, as double | |
| * @note added in 1.9, as a better precision replacement for sizeToPixe
l | | * @note added in 1.9, as a better precision replacement for sizeToPixe
l | |
| */ | | */ | |
|
| double scaleToPixelContext( double size, const QgsRenderContext& c, Siz
eUnit unit, bool rasterfactor = false ) const; | | double scaleToPixelContext( double size, const QgsRenderContext& c, Siz
eUnit unit, bool rasterfactor = false, const QgsMapUnitScale& mapUnitScale
= QgsMapUnitScale() ) const; | |
| | | | |
| /** Map of data defined enum to names and old-style indecies | | /** Map of data defined enum to names and old-style indecies | |
| * The QPair contains a new string for layer property key, and a refere
nce to old-style numeric key (< QGIS 2.0) | | * The QPair contains a new string for layer property key, and a refere
nce to old-style numeric key (< QGIS 2.0) | |
| * @note not available in python bindings; added in 1.9 | | * @note not available in python bindings; added in 1.9 | |
| */ | | */ | |
| QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> >
dataDefinedNames() const { return mDataDefinedNames; } | | QMap<QgsPalLayerSettings::DataDefinedProperties, QPair<QString, int> >
dataDefinedNames() const { return mDataDefinedNames; } | |
| | | | |
| // temporary stuff: set when layer gets prepared or labeled | | // temporary stuff: set when layer gets prepared or labeled | |
| // NOTE: not in Python binding | | // NOTE: not in Python binding | |
| pal::Layer* palLayer; | | pal::Layer* palLayer; | |
| | | | |
| skipping to change at line 579 | | skipping to change at line 604 | |
| , mUseRotation( false ) | | , mUseRotation( false ) | |
| , mCenter( QgsPoint() ) | | , mCenter( QgsPoint() ) | |
| , mUseCenter( false ) | | , mUseCenter( false ) | |
| , mSize( QgsPoint() ) | | , mSize( QgsPoint() ) | |
| , mOffset( QgsPoint() ) | | , mOffset( QgsPoint() ) | |
| , mPicture( 0 ) | | , mPicture( 0 ) | |
| , mPictureBuffer( 0.0 ) | | , mPictureBuffer( 0.0 ) | |
| , mDpiRatio( 1.0 ) | | , mDpiRatio( 1.0 ) | |
| {} | | {} | |
| | | | |
|
| | | // methods | |
| | | | |
| const QString& text() { return mText; } | | const QString& text() { return mText; } | |
| void setText( const QString& text ) { mText = text; } | | void setText( const QString& text ) { mText = text; } | |
| | | | |
| const QgsPoint& origin() { return mOrigin; } | | const QgsPoint& origin() { return mOrigin; } | |
| void setOrigin( QgsPoint point ) { mOrigin = point; } | | void setOrigin( QgsPoint point ) { mOrigin = point; } | |
| | | | |
| bool useOrigin() const { return mUseOrigin; } | | bool useOrigin() const { return mUseOrigin; } | |
| void setUseOrigin( bool use ) { mUseOrigin = use; } | | void setUseOrigin( bool use ) { mUseOrigin = use; } | |
| | | | |
| double rotation() const { return mRotation; } | | double rotation() const { return mRotation; } | |
| | | | |
| skipping to change at line 651 | | skipping to change at line 678 | |
| // a stored QPicture of painting for the component | | // a stored QPicture of painting for the component | |
| QPicture* mPicture; | | QPicture* mPicture; | |
| // buffer for component to accommodate graphic items ignored by QPictur
e, | | // buffer for component to accommodate graphic items ignored by QPictur
e, | |
| // e.g. half-width of an applied QPen, which would extend beyond boundi
ngRect() of QPicture | | // e.g. half-width of an applied QPen, which would extend beyond boundi
ngRect() of QPicture | |
| double mPictureBuffer; | | double mPictureBuffer; | |
| | | | |
| // a ratio of native painter dpi and that of rendering context's painte
r | | // a ratio of native painter dpi and that of rendering context's painte
r | |
| double mDpiRatio; | | double mDpiRatio; | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * Class that stores computed placement from labeling engine. | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | class CORE_EXPORT QgsLabelingResults | |
| | | { | |
| | | public: | |
| | | QgsLabelingResults(); | |
| | | ~QgsLabelingResults(); | |
| | | | |
| | | //! return infos about labels at a given (map) position | |
| | | QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ) const; | |
| | | //! return infos about labels within a given (map) rectangle | |
| | | QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r ) const | |
| | | ; | |
| | | | |
| | | private: | |
| | | QgsLabelingResults( const QgsLabelingResults& ) {} // no copying allowe | |
| | | d | |
| | | | |
| | | QgsLabelSearchTree* mLabelSearchTree; | |
| | | | |
| | | friend class QgsPalLabeling; | |
| | | }; | |
| | | | |
| | | Q_NOWARN_DEPRECATED_PUSH | |
| class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface | | class CORE_EXPORT QgsPalLabeling : public QgsLabelingEngineInterface | |
| { | | { | |
| public: | | public: | |
| enum DrawLabelType | | enum DrawLabelType | |
| { | | { | |
| LabelText = 0, | | LabelText = 0, | |
| LabelBuffer, | | LabelBuffer, | |
| LabelShape, | | LabelShape, | |
| LabelSVG, | | LabelSVG, | |
| LabelShadow | | LabelShadow | |
| | | | |
| skipping to change at line 689 | | skipping to change at line 740 | |
| | | | |
| bool isShowingShadowRectangles() const { return mShowingShadowRects; } | | bool isShowingShadowRectangles() const { return mShowingShadowRects; } | |
| void setShowingShadowRectangles( bool showing ) { mShowingShadowRects =
showing; } | | void setShowingShadowRectangles( bool showing ) { mShowingShadowRects =
showing; } | |
| | | | |
| bool isShowingAllLabels() const { return mShowingAllLabels; } | | bool isShowingAllLabels() const { return mShowingAllLabels; } | |
| void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing;
} | | void setShowingAllLabels( bool showing ) { mShowingAllLabels = showing;
} | |
| | | | |
| bool isShowingPartialsLabels() const { return mShowingPartialsLabels; } | | bool isShowingPartialsLabels() const { return mShowingPartialsLabels; } | |
| void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels
= showing; } | | void setShowingPartialsLabels( bool showing ) { mShowingPartialsLabels
= showing; } | |
| | | | |
|
| | | //! @note added in 2.4 | |
| | | bool isDrawingOutlineLabels() const { return mDrawOutlineLabels; } | |
| | | void setDrawingOutlineLabels( bool outline ) { mDrawOutlineLabels = out | |
| | | line; } | |
| | | | |
| // implemented methods from labeling engine interface | | // implemented methods from labeling engine interface | |
| | | | |
| //! called when we're going to start with rendering | | //! called when we're going to start with rendering | |
|
| virtual void init( QgsMapRenderer* mr ); | | //! @deprecated since 2.4 - use override with QgsMapSettings | |
| | | Q_DECL_DEPRECATED virtual void init( QgsMapRenderer* mr ); | |
| | | //! called when we're going to start with rendering | |
| | | virtual void init( const QgsMapSettings& mapSettings ); | |
| //! called to find out whether the layer is used for labeling | | //! called to find out whether the layer is used for labeling | |
| virtual bool willUseLayer( QgsVectorLayer* layer ); | | virtual bool willUseLayer( QgsVectorLayer* layer ); | |
|
| | | | |
| | | //! called to find out whether the layer is used for labeling | |
| | | //! @note added in 2.4 | |
| | | static bool staticWillUseLayer( QgsVectorLayer* layer ); | |
| | | static bool staticWillUseLayer( const QString& layerID ); | |
| | | | |
| //! clears all PAL layer settings for registered layers | | //! clears all PAL layer settings for registered layers | |
| //! @note: this method was added in version 1.9 | | //! @note: this method was added in version 1.9 | |
| virtual void clearActiveLayers(); | | virtual void clearActiveLayers(); | |
| //! clears data defined objects from PAL layer settings for a registere
d layer | | //! clears data defined objects from PAL layer settings for a registere
d layer | |
| //! @note: this method was added in version 1.9 | | //! @note: this method was added in version 1.9 | |
|
| virtual void clearActiveLayer( QgsVectorLayer* layer ); | | virtual void clearActiveLayer( const QString& layerID ); | |
| //! hook called when drawing layer before issuing select() | | //! hook called when drawing layer before issuing select() | |
|
| virtual int prepareLayer( QgsVectorLayer* layer, QSet<int>& attrIndices
, QgsRenderContext& ctx ); | | virtual int prepareLayer( QgsVectorLayer* layer, QStringList &attrNames
, QgsRenderContext& ctx ); | |
| //! adds a diagram layer to the labeling engine | | //! adds a diagram layer to the labeling engine | |
|
| virtual int addDiagramLayer( QgsVectorLayer* layer, QgsDiagramLayerSett
ings *s ); | | virtual int addDiagramLayer( QgsVectorLayer* layer, const QgsDiagramLay
erSettings *s ); | |
| //! hook called when drawing for every feature in a layer | | //! hook called when drawing for every feature in a layer | |
|
| virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat, | | virtual void registerFeature( const QString& layerID, QgsFeature& feat, | |
| const QgsRenderContext& context = QgsRenderContext() ); | | const QgsRenderContext& context = QgsRenderContext() ); | |
| virtual void registerDiagramFeature( QgsVectorLayer* layer, QgsFeature& | | virtual void registerDiagramFeature( const QString& layerID, QgsFeature | |
| feat, const QgsRenderContext& context = QgsRenderContext() ); | | & feat, const QgsRenderContext& context = QgsRenderContext() ); | |
| //! called when the map is drawn and labels should be placed | | //! called when the map is drawn and labels should be placed | |
| virtual void drawLabeling( QgsRenderContext& context ); | | virtual void drawLabeling( QgsRenderContext& context ); | |
| //! called when we're done with rendering | | //! called when we're done with rendering | |
| virtual void exit(); | | virtual void exit(); | |
|
| | | | |
| //! return infos about labels at a given (map) position | | //! return infos about labels at a given (map) position | |
|
| virtual QList<QgsLabelPosition> labelsAtPosition( const QgsPoint& p ); | | //! @deprecated since 2.4 - use takeResults() and methods of QgsLabelin | |
| | | gResults | |
| | | Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsAtPosition( con | |
| | | st QgsPoint& p ); | |
| //! return infos about labels within a given (map) rectangle | | //! return infos about labels within a given (map) rectangle | |
|
| virtual QList<QgsLabelPosition> labelsWithinRect( const QgsRectangle& r | | //! @deprecated since 2.4 - use takeResults() and methods of QgsLabelin | |
| ); | | gResults | |
| | | Q_DECL_DEPRECATED virtual QList<QgsLabelPosition> labelsWithinRect( con | |
| | | st QgsRectangle& r ); | |
| | | | |
| | | //! Return pointer to recently computed results (in drawLabeling()) and | |
| | | pass the ownership of results to the caller | |
| | | //! @note added in 2.4 | |
| | | QgsLabelingResults* takeResults(); | |
| | | | |
| //! called when passing engine among map renderers | | //! called when passing engine among map renderers | |
| virtual QgsLabelingEngineInterface* clone(); | | virtual QgsLabelingEngineInterface* clone(); | |
| | | | |
| //! @note not available in python bindings | | //! @note not available in python bindings | |
| void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter,
const QgsMapToPixel* xform ); | | void drawLabelCandidateRect( pal::LabelPosition* lp, QPainter* painter,
const QgsMapToPixel* xform ); | |
| //!drawLabel | | //!drawLabel | |
| //! @note not available in python bindings | | //! @note not available in python bindings | |
| virtual void drawLabel( pal::LabelPosition* label, QgsRenderContext& co
ntext, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType, double dpiRatio
= 1.0 ); | | virtual void drawLabel( pal::LabelPosition* label, QgsRenderContext& co
ntext, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType, double dpiRatio
= 1.0 ); | |
| | | | |
| | | | |
| skipping to change at line 743 | | skipping to change at line 814 | |
| | | | |
| static void drawLabelShadow( QgsRenderContext& context, | | static void drawLabelShadow( QgsRenderContext& context, | |
| QgsLabelComponent component, | | QgsLabelComponent component, | |
| const QgsPalLayerSettings& tmpLyr ); | | const QgsPalLayerSettings& tmpLyr ); | |
| | | | |
| //! load/save engine settings to project file | | //! load/save engine settings to project file | |
| //! @note added in QGIS 1.9 | | //! @note added in QGIS 1.9 | |
| void loadEngineSettings(); | | void loadEngineSettings(); | |
| void saveEngineSettings(); | | void saveEngineSettings(); | |
| void clearEngineSettings(); | | void clearEngineSettings(); | |
|
| bool isStoredWithProject() const { return mSavedWithProject; } | | //! @deprecated since 2.4 - settings are always stored in project | |
| void setStoredWithProject( bool store ) { mSavedWithProject = store; } | | Q_DECL_DEPRECATED bool isStoredWithProject() const { return true; } | |
| | | //! @deprecated since 2.4 - settings are always stored in project | |
| | | Q_DECL_DEPRECATED void setStoredWithProject( bool store ) { Q_UNUSED( s | |
| | | tore ); } | |
| | | | |
| protected: | | protected: | |
| // update temporary QgsPalLayerSettings with any data defined text styl
e values | | // update temporary QgsPalLayerSettings with any data defined text styl
e values | |
| void dataDefinedTextStyle( QgsPalLayerSettings& tmpLyr, | | void dataDefinedTextStyle( QgsPalLayerSettings& tmpLyr, | |
| const QMap< QgsPalLayerSettings::DataDefined
Properties, QVariant >& ddValues ); | | const QMap< QgsPalLayerSettings::DataDefined
Properties, QVariant >& ddValues ); | |
| | | | |
| // update temporary QgsPalLayerSettings with any data defined text form
atting values | | // update temporary QgsPalLayerSettings with any data defined text form
atting values | |
| void dataDefinedTextFormatting( QgsPalLayerSettings& tmpLyr, | | void dataDefinedTextFormatting( QgsPalLayerSettings& tmpLyr, | |
| const QMap< QgsPalLayerSettings::DataDe
finedProperties, QVariant >& ddValues ); | | const QMap< QgsPalLayerSettings::DataDe
finedProperties, QVariant >& ddValues ); | |
| | | | |
| | | | |
| skipping to change at line 767 | | skipping to change at line 840 | |
| const QMap< QgsPalLayerSettings::DataDefine
dProperties, QVariant >& ddValues ); | | const QMap< QgsPalLayerSettings::DataDefine
dProperties, QVariant >& ddValues ); | |
| | | | |
| // update temporary QgsPalLayerSettings with any data defined shape bac
kground values | | // update temporary QgsPalLayerSettings with any data defined shape bac
kground values | |
| void dataDefinedShapeBackground( QgsPalLayerSettings& tmpLyr, | | void dataDefinedShapeBackground( QgsPalLayerSettings& tmpLyr, | |
| const QMap< QgsPalLayerSettings::DataD
efinedProperties, QVariant >& ddValues ); | | const QMap< QgsPalLayerSettings::DataD
efinedProperties, QVariant >& ddValues ); | |
| | | | |
| // update temporary QgsPalLayerSettings with any data defined drop shad
ow values | | // update temporary QgsPalLayerSettings with any data defined drop shad
ow values | |
| void dataDefinedDropShadow( QgsPalLayerSettings& tmpLyr, | | void dataDefinedDropShadow( QgsPalLayerSettings& tmpLyr, | |
| const QMap< QgsPalLayerSettings::DataDefine
dProperties, QVariant >& ddValues ); | | const QMap< QgsPalLayerSettings::DataDefine
dProperties, QVariant >& ddValues ); | |
| | | | |
|
| // hashtable of layer settings, being filled during labeling | | void deleteTemporaryData(); | |
| QHash<QgsVectorLayer*, QgsPalLayerSettings> mActiveLayers; | | | |
| // hashtable of active diagram layers | | // hashtable of layer settings, being filled during labeling (key = lay | |
| QHash<QgsVectorLayer*, QgsDiagramLayerSettings> mActiveDiagramLayers; | | er ID) | |
| | | QHash<QString, QgsPalLayerSettings> mActiveLayers; | |
| | | // hashtable of active diagram layers (key = layer ID) | |
| | | QHash<QString, QgsDiagramLayerSettings> mActiveDiagramLayers; | |
| QgsPalLayerSettings mInvalidLayerSettings; | | QgsPalLayerSettings mInvalidLayerSettings; | |
| | | | |
|
| QgsMapRenderer* mMapRenderer; | | const QgsMapSettings* mMapSettings; | |
| int mCandPoint, mCandLine, mCandPolygon; | | int mCandPoint, mCandLine, mCandPolygon; | |
| Search mSearch; | | Search mSearch; | |
| | | | |
| pal::Pal* mPal; | | pal::Pal* mPal; | |
| | | | |
| // list of candidates from last labeling | | // list of candidates from last labeling | |
| QList<QgsLabelCandidate> mCandidates; | | QList<QgsLabelCandidate> mCandidates; | |
| bool mShowingCandidates; | | bool mShowingCandidates; | |
| bool mShowingAllLabels; // whether to avoid collisions or not | | bool mShowingAllLabels; // whether to avoid collisions or not | |
|
| bool mSavedWithProject; // whether engine settings have been read from
project file | | | |
| bool mShowingShadowRects; // whether to show debugging rectangles for d
rop shadows | | bool mShowingShadowRects; // whether to show debugging rectangles for d
rop shadows | |
| bool mShowingPartialsLabels; // whether to avoid partials labels or not | | bool mShowingPartialsLabels; // whether to avoid partials labels or not | |
|
| | | bool mDrawOutlineLabels; // whether to draw labels as text or outlines | |
| | | | |
|
| QgsLabelSearchTree* mLabelSearchTree; | | QgsLabelingResults* mResults; | |
| }; | | }; | |
|
| | | Q_NOWARN_DEPRECATED_POP | |
| | | | |
| #endif // QGSPALLABELING_H | | #endif // QGSPALLABELING_H | |
| | | | |
End of changes. 40 change blocks. |
| 26 lines changed or deleted | | 111 lines changed or added | |
|
| qgspointdisplacementrenderer.h | | qgspointdisplacementrenderer.h | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| #ifndef QGSPOINTDISPLACEMENTRENDERER_H | | #ifndef QGSPOINTDISPLACEMENTRENDERER_H | |
| #define QGSPOINTDISPLACEMENTRENDERER_H | | #define QGSPOINTDISPLACEMENTRENDERER_H | |
| | | | |
| #include "qgsfeature.h" | | #include "qgsfeature.h" | |
| #include "qgssymbolv2.h" | | #include "qgssymbolv2.h" | |
| #include "qgspoint.h" | | #include "qgspoint.h" | |
| #include "qgsrendererv2.h" | | #include "qgsrendererv2.h" | |
| #include <QFont> | | #include <QFont> | |
| #include <QSet> | | #include <QSet> | |
| | | | |
|
| class QgsVectorLayer; | | class QgsSpatialIndex; | |
| | | | |
| /**A renderer that automatically displaces points with the same position*/ | | /**A renderer that automatically displaces points with the same position*/ | |
| class CORE_EXPORT QgsPointDisplacementRenderer: public QgsFeatureRendererV2 | | class CORE_EXPORT QgsPointDisplacementRenderer: public QgsFeatureRendererV2 | |
| { | | { | |
| public: | | public: | |
| QgsPointDisplacementRenderer( const QString& labelAttributeName = "" ); | | QgsPointDisplacementRenderer( const QString& labelAttributeName = "" ); | |
| ~QgsPointDisplacementRenderer(); | | ~QgsPointDisplacementRenderer(); | |
| | | | |
| QgsFeatureRendererV2* clone(); | | QgsFeatureRendererV2* clone(); | |
| | | | |
| virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | | virtual void toSld( QDomDocument& doc, QDomElement &element ) const; | |
| | | | |
| /**Reimplemented from QgsFeatureRendererV2*/ | | /**Reimplemented from QgsFeatureRendererV2*/ | |
| bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int
layer = -1, bool selected = false, bool drawVertexMarker = false ); | | bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int
layer = -1, bool selected = false, bool drawVertexMarker = false ); | |
| | | | |
| QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | | QgsSymbolV2* symbolForFeature( QgsFeature& feature ); | |
| | | | |
|
| void startRender( QgsRenderContext& context, const QgsVectorLayer *vlay
er ); | | void startRender( QgsRenderContext& context, const QgsFields& fields ); | |
| | | | |
| void stopRender( QgsRenderContext& context ); | | void stopRender( QgsRenderContext& context ); | |
| | | | |
| QList<QString> usedAttributes(); | | QList<QString> usedAttributes(); | |
| QgsSymbolV2List symbols(); | | QgsSymbolV2List symbols(); | |
| | | | |
| //! create a renderer from XML element | | //! create a renderer from XML element | |
| static QgsFeatureRendererV2* create( QDomElement& symbologyElem ); | | static QgsFeatureRendererV2* create( QDomElement& symbologyElem ); | |
| QDomElement save( QDomDocument& doc ); | | QDomElement save( QDomDocument& doc ); | |
| | | | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QS
tring rule = "" ); | | QgsLegendSymbolList legendSymbolItems( double scaleDenominator = -1, QS
tring rule = "" ); | |
| | | | |
| void setLabelAttributeName( const QString& name ) { mLabelAttributeName
= name; } | | void setLabelAttributeName( const QString& name ) { mLabelAttributeName
= name; } | |
| QString labelAttributeName() const { return mLabelAttributeName; } | | QString labelAttributeName() const { return mLabelAttributeName; } | |
| | | | |
| /**Sets embedded renderer (takes ownership)*/ | | /**Sets embedded renderer (takes ownership)*/ | |
| void setEmbeddedRenderer( QgsFeatureRendererV2* r ); | | void setEmbeddedRenderer( QgsFeatureRendererV2* r ); | |
| QgsFeatureRendererV2* embeddedRenderer() { return mRenderer;} | | QgsFeatureRendererV2* embeddedRenderer() { return mRenderer;} | |
| | | | |
| //! not available in python bindings | | //! not available in python bindings | |
|
| void setDisplacementGroups( const QList<QMap<QgsFeatureId, QgsFeature> | | //! @deprecated since 2.4 | |
| >& list ); | | Q_DECL_DEPRECATED void setDisplacementGroups( const QList<QMap<QgsFeatu | |
| | | reId, QgsFeature> >& list ) { Q_UNUSED( list ); } | |
| | | | |
| void setLabelFont( const QFont& f ) { mLabelFont = f; } | | void setLabelFont( const QFont& f ) { mLabelFont = f; } | |
| QFont labelFont() const { return mLabelFont;} | | QFont labelFont() const { return mLabelFont;} | |
| | | | |
| void setCircleWidth( double w ) { mCircleWidth = w; } | | void setCircleWidth( double w ) { mCircleWidth = w; } | |
| double circleWidth() const { return mCircleWidth; } | | double circleWidth() const { return mCircleWidth; } | |
| | | | |
| void setCircleColor( const QColor& c ) { mCircleColor = c; } | | void setCircleColor( const QColor& c ) { mCircleColor = c; } | |
| QColor circleColor() const { return mCircleColor; } | | QColor circleColor() const { return mCircleColor; } | |
| | | | |
| | | | |
| skipping to change at line 128 | | skipping to change at line 129 | |
| double mCircleWidth; | | double mCircleWidth; | |
| /**Color to draw the circle*/ | | /**Color to draw the circle*/ | |
| QColor mCircleColor; | | QColor mCircleColor; | |
| /**Addition to the default circle radius*/ | | /**Addition to the default circle radius*/ | |
| double mCircleRadiusAddition; | | double mCircleRadiusAddition; | |
| /**Is set internally from startRender() depending on scale denominator*
/ | | /**Is set internally from startRender() depending on scale denominator*
/ | |
| bool mDrawLabels; | | bool mDrawLabels; | |
| /**Maximum scale denominator for label display. Negative number means n
o scale limitation*/ | | /**Maximum scale denominator for label display. Negative number means n
o scale limitation*/ | |
| double mMaxLabelScaleDenominator; | | double mMaxLabelScaleDenominator; | |
| | | | |
|
| | | typedef QMap<QgsFeatureId, QgsFeature> DisplacementGroup; | |
| /**Groups of features that have the same position*/ | | /**Groups of features that have the same position*/ | |
|
| QList<QMap<QgsFeatureId, QgsFeature> > mDisplacementGroups; | | QList<DisplacementGroup> mDisplacementGroups; | |
| /**Set that contains all the ids the display groups (for quicker lookup | | /**Mapping from feature ID to its group index*/ | |
| )*/ | | QMap<QgsFeatureId, int> mGroupIndex; | |
| QSet<QgsFeatureId> mDisplacementIds; | | /**Spatial index for fast lookup of close points*/ | |
| | | QgsSpatialIndex* mSpatialIndex; | |
| | | /** keeps trask which features are selected */ | |
| | | QSet<QgsFeatureId> mSelectedFeatures; | |
| | | | |
|
| /**Create the displacement groups efficiently using a spatial index*/ | | | |
| void createDisplacementGroups( QgsVectorLayer *vlayer, const QgsRectang | | | |
| le& viewExtent ); | | | |
| /**Creates a search rectangle with mTolerance*/ | | /**Creates a search rectangle with mTolerance*/ | |
| QgsRectangle searchRect( const QgsPoint& p ) const; | | QgsRectangle searchRect( const QgsPoint& p ) const; | |
| /**This is a debugging function to check the entries in the displacemen
t groups*/ | | /**This is a debugging function to check the entries in the displacemen
t groups*/ | |
| void printInfoDisplacementGroups(); | | void printInfoDisplacementGroups(); | |
| | | | |
| /**Returns the label for a feature (using mLabelAttributeName as attrib
ute field)*/ | | /**Returns the label for a feature (using mLabelAttributeName as attrib
ute field)*/ | |
| QString getLabel( const QgsFeature& f ); | | QString getLabel( const QgsFeature& f ); | |
| | | | |
| //rendering methods | | //rendering methods | |
| void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& conte
xt, const QList<QgsMarkerSymbolV2*>& symbols, | | void renderPoint( const QPointF& point, QgsSymbolV2RenderContext& conte
xt, const QList<QgsMarkerSymbolV2*>& symbols, | |
| const QStringList& labels ); | | const QStringList& labels ); | |
| | | | |
| //helper functions | | //helper functions | |
| void calculateSymbolAndLabelPositions( const QPointF& centerPoint, int
nPosition, double radius, double symbolDiagonal, QList<QPointF>& symbolPosi
tions, QList<QPointF>& labelShifts ) const; | | void calculateSymbolAndLabelPositions( const QPointF& centerPoint, int
nPosition, double radius, double symbolDiagonal, QList<QPointF>& symbolPosi
tions, QList<QPointF>& labelShifts ) const; | |
|
| | | void drawGroup( const DisplacementGroup& group, QgsRenderContext& conte
xt ); | |
| void drawCircle( double radiusPainterUnits, QgsSymbolV2RenderContext& c
ontext, const QPointF& centerPoint, int nSymbols ); | | void drawCircle( double radiusPainterUnits, QgsSymbolV2RenderContext& c
ontext, const QPointF& centerPoint, int nSymbols ); | |
|
| void drawSymbols( QgsFeature& f, QgsRenderContext& context, const QList
<QgsMarkerSymbolV2*>& symbolList, const QList<QPointF>& symbolPositions, bo
ol selected = false ); | | void drawSymbols( const QgsFeature& f, QgsRenderContext& context, const
QList<QgsMarkerSymbolV2*>& symbolList, const QList<QPointF>& symbolPositio
ns, bool selected = false ); | |
| void drawLabels( const QPointF& centerPoint, QgsSymbolV2RenderContext&
context, const QList<QPointF>& labelShifts, const QStringList& labelList ); | | void drawLabels( const QPointF& centerPoint, QgsSymbolV2RenderContext&
context, const QList<QPointF>& labelShifts, const QStringList& labelList ); | |
| /**Returns first symbol for feature or 0 if none*/ | | /**Returns first symbol for feature or 0 if none*/ | |
| QgsSymbolV2* firstSymbolForFeature( QgsFeatureRendererV2* r, QgsFeature
& f ); | | QgsSymbolV2* firstSymbolForFeature( QgsFeatureRendererV2* r, QgsFeature
& f ); | |
| }; | | }; | |
| | | | |
| #endif // QGSPOINTDISPLACEMENTRENDERER_H | | #endif // QGSPOINTDISPLACEMENTRENDERER_H | |
| | | | |
End of changes. 8 change blocks. |
| 12 lines changed or deleted | | 15 lines changed or added | |
|
| qgsproject.h | | qgsproject.h | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| #include "qgssnapper.h" | | #include "qgssnapper.h" | |
| #include "qgstolerance.h" | | #include "qgstolerance.h" | |
| | | | |
| //#include <QDomDocument> | | //#include <QDomDocument> | |
| | | | |
| class QFileInfo; | | class QFileInfo; | |
| class QDomDocument; | | class QDomDocument; | |
| class QDomElement; | | class QDomElement; | |
| class QDomNode; | | class QDomNode; | |
| | | | |
|
| | | class QgsLayerTreeGroup; | |
| | | class QgsLayerTreeRegistryBridge; | |
| class QgsMapLayer; | | class QgsMapLayer; | |
| class QgsProjectBadLayerHandler; | | class QgsProjectBadLayerHandler; | |
| class QgsRelationManager; | | class QgsRelationManager; | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
| | | | |
| /** \ingroup core | | /** \ingroup core | |
| * Reads and writes project states. | | * Reads and writes project states. | |
| | | | |
| @note | | @note | |
| | | | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 83 | |
| @todo XXX Should have semantics for saving project if dirty as last
gasp? | | @todo XXX Should have semantics for saving project if dirty as last
gasp? | |
| */ | | */ | |
| ~QgsProject(); | | ~QgsProject(); | |
| | | | |
| /// access to canonical QgsProject instance | | /// access to canonical QgsProject instance | |
| static QgsProject * instance(); | | static QgsProject * instance(); | |
| | | | |
| /** | | /** | |
| Every project has an associated title string | | Every project has an associated title string | |
| | | | |
|
| @todo However current dialogs don't allow setting of it yet | | ### QGIS 3: remove in favor of setTitle(...) | |
| */ | | */ | |
| //@{ | | //@{ | |
| void title( const QString & title ); | | void title( const QString & title ); | |
| | | | |
|
| | | /** Set project title | |
| | | * @note added in 2.4 */ | |
| | | void setTitle( const QString& title ); | |
| | | | |
| /** returns title */ | | /** returns title */ | |
| const QString & title() const; | | const QString & title() const; | |
| //@} | | //@} | |
| | | | |
| /** | | /** | |
| the dirty flag is true if the project has been modified since the la
st | | the dirty flag is true if the project has been modified since the la
st | |
| write() | | write() | |
| */ | | */ | |
| //@{ | | //@{ | |
| bool isDirty() const; | | bool isDirty() const; | |
| | | | |
|
| | | // ### QGIS 3: remove in favor of setDirty(...) | |
| void dirty( bool b ); | | void dirty( bool b ); | |
|
| | | | |
| | | /** Set project as dirty (modified). | |
| | | * @note added in 2.4 */ | |
| | | void setDirty( bool b ); | |
| //@} | | //@} | |
| | | | |
| /** | | /** | |
| Every project has an associated file that contains its XML | | Every project has an associated file that contains its XML | |
| */ | | */ | |
| //@{ | | //@{ | |
| void setFileName( const QString & name ); | | void setFileName( const QString & name ); | |
| | | | |
| /** returns file name */ | | /** returns file name */ | |
| QString fileName() const; | | QString fileName() const; | |
| //@} | | //@} | |
| | | | |
|
| | | /** Clear the project | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | void clear(); | |
| | | | |
| /** read project file | | /** read project file | |
| | | | |
| @note Any current plug-in state is erased | | @note Any current plug-in state is erased | |
| | | | |
| @note dirty set to false after successful invocation | | @note dirty set to false after successful invocation | |
| | | | |
| @note file name argument implicitly sets file | | @note file name argument implicitly sets file | |
| | | | |
|
| (Is that really desirable behavior? Maybe prompt to save before | | | |
| reading new one?) | | | |
| | | | |
| Should we presume the file is opened elsewhere? Or do we open it | | | |
| ourselves? | | | |
| | | | |
| XXX How to best get modify access to Qgis state? Actually we can fi | | | |
| nagle | | | |
| that by searching for qgisapp in object hiearchy. | | | |
| | | | |
| @note | | @note | |
| | | | |
| - Gets the extents | | - Gets the extents | |
| - Creates maplayers | | - Creates maplayers | |
| - Registers maplayers | | - Registers maplayers | |
| | | | |
| @note it's presumed that the caller has already reset the map canvas
, map registry, and legend | | @note it's presumed that the caller has already reset the map canvas
, map registry, and legend | |
| */ | | */ | |
| //@{ | | //@{ | |
| bool read( const QFileInfo & file ); | | bool read( const QFileInfo & file ); | |
| | | | |
| skipping to change at line 198 | | skipping to change at line 205 | |
| the qgis specific state properites are different since they aren't | | the qgis specific state properites are different since they aren't | |
| accessible here. Actually, what if we make "qgis" yet another | | accessible here. Actually, what if we make "qgis" yet another | |
| scope that stores its state in the properties list? E.g., | | scope that stores its state in the properties list? E.g., | |
| QgsProject::instance()->properties()["qgis"]? | | QgsProject::instance()->properties()["qgis"]? | |
| | | | |
| */ | | */ | |
| // DEPRECATED Properties & properties( QString const & scope ); | | // DEPRECATED Properties & properties( QString const & scope ); | |
| | | | |
| /** | | /** | |
| removes all project properties | | removes all project properties | |
|
| | | | |
| | | ### QGIS 3: remove in favor of clear() | |
| */ | | */ | |
| void clearProperties(); | | void clearProperties(); | |
| | | | |
| /* key value mutators | | /* key value mutators | |
| | | | |
| keys would be the familiar QSettings-like '/' delimited entries, impl
ying | | keys would be the familiar QSettings-like '/' delimited entries, impl
ying | |
| a hierarchy of keys and corresponding values | | a hierarchy of keys and corresponding values | |
| | | | |
| @note The key string <em>must</em> include '/'s. E.g., "/foo" not "f
oo". | | @note The key string <em>must</em> include '/'s. E.g., "/foo" not "f
oo". | |
| */ | | */ | |
| | | | |
| skipping to change at line 279 | | skipping to change at line 288 | |
| Deletes old handler and takes ownership of the new one. | | Deletes old handler and takes ownership of the new one. | |
| @note added in 1.4 */ | | @note added in 1.4 */ | |
| void setBadLayerHandler( QgsProjectBadLayerHandler* handler ); | | void setBadLayerHandler( QgsProjectBadLayerHandler* handler ); | |
| | | | |
| /** Returns project file path if layer is embedded from other project f
ile. Returns empty string if layer is not embedded*/ | | /** Returns project file path if layer is embedded from other project f
ile. Returns empty string if layer is not embedded*/ | |
| QString layerIsEmbedded( const QString& id ) const; | | QString layerIsEmbedded( const QString& id ) const; | |
| | | | |
| /** Creates a maplayer instance defined in an arbitrary project file. C
aller takes ownership | | /** Creates a maplayer instance defined in an arbitrary project file. C
aller takes ownership | |
| @return the layer or 0 in case of error | | @return the layer or 0 in case of error | |
| @note: added in version 1.8 | | @note: added in version 1.8 | |
|
| @note not available in python bindings | | | |
| */ | | */ | |
| bool createEmbeddedLayer( const QString& layerId, const QString& projec
tFilePath, QList<QDomNode>& brokenNodes, | | bool createEmbeddedLayer( const QString& layerId, const QString& projec
tFilePath, QList<QDomNode>& brokenNodes, | |
| QList< QPair< QgsVectorLayer*, QDomElement >
>& vectorLayerList, bool saveFlag = true ); | | QList< QPair< QgsVectorLayer*, QDomElement >
>& vectorLayerList, bool saveFlag = true ); | |
| | | | |
|
| | | /** Create layer group instance defined in an arbitrary project file. | |
| | | * @note: added in version 2.4 | |
| | | */ | |
| | | QgsLayerTreeGroup* createEmbeddedGroup( const QString& groupName, const | |
| | | QString& projectFilePath ); | |
| | | | |
| /** Convenience function to set snap settings per layer | | /** Convenience function to set snap settings per layer | |
| @note added in version 1.9*/ | | @note added in version 1.9*/ | |
| void setSnapSettingsForLayer( const QString& layerId, bool enabled, Qgs
Snapper::SnappingType type, QgsTolerance::UnitType unit, double tolerance, | | void setSnapSettingsForLayer( const QString& layerId, bool enabled, Qgs
Snapper::SnappingType type, QgsTolerance::UnitType unit, double tolerance, | |
| bool avoidIntersection ); | | bool avoidIntersection ); | |
| | | | |
| /** Convenience function to query snap settings of a layer | | /** Convenience function to query snap settings of a layer | |
| @note added in version 1.9*/ | | @note added in version 1.9*/ | |
| bool snapSettingsForLayer( const QString& layerId, bool& enabled, QgsSn
apper::SnappingType& type, QgsTolerance::UnitType& units, double& tolerance
, | | bool snapSettingsForLayer( const QString& layerId, bool& enabled, QgsSn
apper::SnappingType& type, QgsTolerance::UnitType& units, double& tolerance
, | |
| bool& avoidIntersection ) const; | | bool& avoidIntersection ) const; | |
| | | | |
| | | | |
| skipping to change at line 309 | | skipping to change at line 322 | |
| @note added in version 1.9*/ | | @note added in version 1.9*/ | |
| bool topologicalEditing() const; | | bool topologicalEditing() const; | |
| | | | |
| /** Return project's home path | | /** Return project's home path | |
| @return home path of project (or QString::null if not set) | | @return home path of project (or QString::null if not set) | |
| @note added in version 2.0 */ | | @note added in version 2.0 */ | |
| QString homePath() const; | | QString homePath() const; | |
| | | | |
| QgsRelationManager* relationManager() const; | | QgsRelationManager* relationManager() const; | |
| | | | |
|
| | | /** Return pointer to the root (invisible) node of the project's layer | |
| | | tree | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | QgsLayerTreeGroup* layerTreeRoot() const; | |
| | | | |
| | | /** Return pointer to the helper class that synchronizes map layer regi | |
| | | stry with layer tree | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | QgsLayerTreeRegistryBridge* layerTreeRegistryBridge() const { return mL | |
| | | ayerTreeRegistryBridge; } | |
| | | | |
| protected: | | protected: | |
| | | | |
| /** Set error message from read/write operation | | /** Set error message from read/write operation | |
| @note added in 1.4 */ | | @note added in 1.4 */ | |
| void setError( QString errorMessage ); | | void setError( QString errorMessage ); | |
| | | | |
| /** Clear error message | | /** Clear error message | |
| @note added in 1.4 */ | | @note added in 1.4 */ | |
| void clearError(); | | void clearError(); | |
| | | | |
| //Creates layer and adds it to maplayer registry | | //Creates layer and adds it to maplayer registry | |
| //! @note not available in python bindings | | //! @note not available in python bindings | |
| bool addLayer( const QDomElement& layerElem, QList<QDomNode>& brokenNod
es, QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList ); | | bool addLayer( const QDomElement& layerElem, QList<QDomNode>& brokenNod
es, QList< QPair< QgsVectorLayer*, QDomElement > >& vectorLayerList ); | |
| | | | |
|
| | | //! @note not available in python bindings | |
| | | void initializeEmbeddedSubtree( const QString& projectFilePath, QgsLaye | |
| | | rTreeGroup* group ); | |
| | | | |
| | | //! @note not available in python bindings | |
| | | void loadEmbeddedNodes( QgsLayerTreeGroup* group ); | |
| | | | |
| | | //! @note not available in python bindings | |
| | | void updateEmbeddedGroupsProjectPath( QgsLayerTreeGroup* group ); | |
| | | | |
| signals: | | signals: | |
| //! emitted when project is being read | | //! emitted when project is being read | |
| void readProject( const QDomDocument & ); | | void readProject( const QDomDocument & ); | |
| | | | |
| //! emitted when project is being written | | //! emitted when project is being written | |
| void writeProject( QDomDocument & ); | | void writeProject( QDomDocument & ); | |
| | | | |
| /** | | /** | |
| * Emitted, after the basic initialisation of a layer from the project | | * Emitted, after the basic initialisation of a layer from the project | |
| * file is done. You can use this signal to read additional information | | * file is done. You can use this signal to read additional information | |
| | | | |
| skipping to change at line 394 | | skipping to change at line 426 | |
| /**Embeded layers which are defined in other projects. Key: layer id, | | /**Embeded layers which are defined in other projects. Key: layer id, | |
| value: pair< project file path, save layer yes / no (e.g. if the layer
is part of an embedded group, loading/saving is done by the legend) | | value: pair< project file path, save layer yes / no (e.g. if the layer
is part of an embedded group, loading/saving is done by the legend) | |
| If the project file path is empty, QgsProject is going to ignore the
layer for saving (e.g. because it is part and managed by an embedded group
)*/ | | If the project file path is empty, QgsProject is going to ignore the
layer for saving (e.g. because it is part and managed by an embedded group
)*/ | |
| QHash< QString, QPair< QString, bool> > mEmbeddedLayers; | | QHash< QString, QPair< QString, bool> > mEmbeddedLayers; | |
| | | | |
| void snapSettings( QStringList& layerIdList, QStringList& enabledList,
QStringList& snapTypeList, QStringList& snapUnitList, QStringList& toleranc
eUnitList, | | void snapSettings( QStringList& layerIdList, QStringList& enabledList,
QStringList& snapTypeList, QStringList& snapUnitList, QStringList& toleranc
eUnitList, | |
| QStringList& avoidIntersectionList ) const; | | QStringList& avoidIntersectionList ) const; | |
| | | | |
| QgsRelationManager* mRelationManager; | | QgsRelationManager* mRelationManager; | |
| | | | |
|
| | | QgsLayerTreeGroup* mRootGroup; | |
| | | | |
| | | QgsLayerTreeRegistryBridge* mLayerTreeRegistryBridge; | |
| | | | |
| }; // QgsProject | | }; // QgsProject | |
| | | | |
| /** Interface for classes that handle missing layer files when reading proj
ect file. | | /** Interface for classes that handle missing layer files when reading proj
ect file. | |
| @note added in 1.4 */ | | @note added in 1.4 */ | |
| class CORE_EXPORT QgsProjectBadLayerHandler | | class CORE_EXPORT QgsProjectBadLayerHandler | |
| { | | { | |
| public: | | public: | |
| virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument proj
ectDom ) = 0; | | virtual void handleBadLayers( QList<QDomNode> layers, QDomDocument proj
ectDom ) = 0; | |
| virtual ~QgsProjectBadLayerHandler() {} | | virtual ~QgsProjectBadLayerHandler() {} | |
| }; | | }; | |
| | | | |
End of changes. 13 change blocks. |
| 12 lines changed or deleted | | 52 lines changed or added | |
|
| qgsrasterdataprovider.h | | qgsrasterdataprovider.h | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| QgsRasterDataProvider( const QString & uri ); | | QgsRasterDataProvider( const QString & uri ); | |
| | | | |
| virtual ~QgsRasterDataProvider() {}; | | virtual ~QgsRasterDataProvider() {}; | |
| | | | |
| virtual QgsRasterInterface * clone() const = 0; | | virtual QgsRasterInterface * clone() const = 0; | |
| | | | |
| /* It makes no sense to set input on provider */ | | /* It makes no sense to set input on provider */ | |
| bool setInput( QgsRasterInterface* input ) { Q_UNUSED( input ); return
false; } | | bool setInput( QgsRasterInterface* input ) { Q_UNUSED( input ); return
false; } | |
| | | | |
| /** \brief Renders the layer as an image | | /** \brief Renders the layer as an image | |
|
| \note When render caching (/qgis/enable_render_caching) is on the wm | | \note When render caching (/qgis/enable_render_caching) is on the wms | |
| s | | provider doesn't wait for the reply of the getmap request or all | |
| provider doesn't wait for the reply of the getmap request or a | | tiles replies and can return incomplete images. | |
| ll | | Temporarily disable render caching if you require the complete | |
| tiles replies and can return incomplete images. | | wms image in the first call. | |
| Temporarily disable render caching if you require the complete | | | |
| wms image in the first call. | | | |
| */ | | */ | |
| virtual QImage* draw( const QgsRectangle & viewExtent, int pixelWidth,
int pixelHeight ) = 0; | | virtual QImage* draw( const QgsRectangle & viewExtent, int pixelWidth,
int pixelHeight ) = 0; | |
| | | | |
| /** Get the extent of the data source. | | /** Get the extent of the data source. | |
| * @return QgsRectangle containing the extent of the layer */ | | * @return QgsRectangle containing the extent of the layer */ | |
| virtual QgsRectangle extent() = 0; | | virtual QgsRectangle extent() = 0; | |
| | | | |
| /** Returns data type for the band specified by number */ | | /** Returns data type for the band specified by number */ | |
| virtual QGis::DataType dataType( int bandNo ) const = 0; | | virtual QGis::DataType dataType( int bandNo ) const = 0; | |
| | | | |
| | | | |
| skipping to change at line 164 | | skipping to change at line 164 | |
| } | | } | |
| } | | } | |
| /** Reload data (data could change) */ | | /** Reload data (data could change) */ | |
| virtual bool reload() { return true; } | | virtual bool reload() { return true; } | |
| | | | |
| virtual QString colorInterpretationName( int theBandNo ) const | | virtual QString colorInterpretationName( int theBandNo ) const | |
| { | | { | |
| return colorName( colorInterpretation( theBandNo ) ); | | return colorName( colorInterpretation( theBandNo ) ); | |
| } | | } | |
| | | | |
|
| | | /** Read band scale for raster value | |
| | | * @@note added in 2.3 */ | |
| | | virtual double bandScale( int bandNo ) const { Q_UNUSED( bandNo ); retu | |
| | | rn 1.0; } | |
| | | /** Read band offset for raster value | |
| | | * @@note added in 2.3 */ | |
| | | virtual double bandOffset( int bandNo ) const { Q_UNUSED( bandNo ); ret | |
| | | urn 0.0; } | |
| | | | |
| // TODO: remove or make protected all readBlock working with void* | | // TODO: remove or make protected all readBlock working with void* | |
| | | | |
| /** Read block of data using given extent and size. */ | | /** Read block of data using given extent and size. */ | |
| virtual QgsRasterBlock *block( int theBandNo, const QgsRectangle &theEx
tent, int theWidth, int theHeight ); | | virtual QgsRasterBlock *block( int theBandNo, const QgsRectangle &theEx
tent, int theWidth, int theHeight ); | |
| | | | |
| /* Return true if source band has no data value */ | | /* Return true if source band has no data value */ | |
| virtual bool srcHasNoDataValue( int bandNo ) const { return mSrcHasNoDa
taValue.value( bandNo -1 ); } | | virtual bool srcHasNoDataValue( int bandNo ) const { return mSrcHasNoDa
taValue.value( bandNo -1 ); } | |
| | | | |
| /** \brief Get source nodata value usage */ | | /** \brief Get source nodata value usage */ | |
| virtual bool useSrcNoDataValue( int bandNo ) const { return mUseSrcNoDa
taValue.value( bandNo -1 ); } | | virtual bool useSrcNoDataValue( int bandNo ) const { return mUseSrcNoDa
taValue.value( bandNo -1 ); } | |
| | | | |
| /** \brief Set source nodata value usage */ | | /** \brief Set source nodata value usage */ | |
| virtual void setUseSrcNoDataValue( int bandNo, bool use ); | | virtual void setUseSrcNoDataValue( int bandNo, bool use ); | |
| | | | |
| /** Value representing no data value. */ | | /** Value representing no data value. */ | |
| virtual double srcNoDataValue( int bandNo ) const { return mSrcNoDataVa
lue.value( bandNo -1 ); } | | virtual double srcNoDataValue( int bandNo ) const { return mSrcNoDataVa
lue.value( bandNo -1 ); } | |
| | | | |
| virtual void setUserNoDataValue( int bandNo, QgsRasterRangeList noData
); | | virtual void setUserNoDataValue( int bandNo, QgsRasterRangeList noData
); | |
| | | | |
| /** Get list of user no data value ranges */ | | /** Get list of user no data value ranges */ | |
|
| virtual QgsRasterRangeList userNoDataValues( int bandNo ) const { retu
rn mUserNoDataValue.value( bandNo -1 ); } | | virtual QgsRasterRangeList userNoDataValues( int bandNo ) const { retur
n mUserNoDataValue.value( bandNo -1 ); } | |
| | | | |
| virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo
) const | | virtual QList<QgsColorRampShader::ColorRampItem> colorTable( int bandNo
) const | |
| { Q_UNUSED( bandNo ); return QList<QgsColorRampShader::ColorRampItem>()
; } | | { Q_UNUSED( bandNo ); return QList<QgsColorRampShader::ColorRampItem>()
; } | |
| | | | |
| /** \brief Returns the sublayers of this layer - useful for providers t
hat manage | | /** \brief Returns the sublayers of this layer - useful for providers t
hat manage | |
| * their own layers, such as WMS */ | | * their own layers, such as WMS */ | |
| virtual QStringList subLayers() const | | virtual QStringList subLayers() const | |
| { | | { | |
| return QStringList(); | | return QStringList(); | |
| } | | } | |
| | | | |
| skipping to change at line 236 | | skipping to change at line 243 | |
| /** \brief Returns true if raster has at least one populated histogram.
*/ | | /** \brief Returns true if raster has at least one populated histogram.
*/ | |
| bool hasPyramids(); | | bool hasPyramids(); | |
| | | | |
| /** | | /** | |
| * Get metadata in a format suitable for feeding directly | | * Get metadata in a format suitable for feeding directly | |
| * into a subset of the GUI raster properties "Metadata" tab. | | * into a subset of the GUI raster properties "Metadata" tab. | |
| */ | | */ | |
| virtual QString metadata() = 0; | | virtual QString metadata() = 0; | |
| | | | |
| /** \brief Identify raster value(s) found on the point position. The co
ntext | | /** \brief Identify raster value(s) found on the point position. The co
ntext | |
|
| * parameters theExtent, theWidth and theHeigh are important to
identify | | * parameters theExtent, theWidth and theHeight are important t
o identify | |
| * on the same zoom level as a displayed map and to do effectiv
e | | * on the same zoom level as a displayed map and to do effectiv
e | |
| * caching (WCS). If context params are not specified the highe
st | | * caching (WCS). If context params are not specified the highe
st | |
| * resolution is used. capabilities() may be used to test if fo
rmat | | * resolution is used. capabilities() may be used to test if fo
rmat | |
| * is supported by provider. Values are set to 'no data' or emp
ty string | | * is supported by provider. Values are set to 'no data' or emp
ty string | |
| * if point is outside data source extent. | | * if point is outside data source extent. | |
| * | | * | |
| * \note The arbitraryness of the returned document is enforced by WMS
standards | | * \note The arbitraryness of the returned document is enforced by WMS
standards | |
| * up to at least v1.3.0 | | * up to at least v1.3.0 | |
| * @param thePoint coordinates in data source CRS | | * @param thePoint coordinates in data source CRS | |
| * @param theFormat result format | | * @param theFormat result format | |
| | | | |
| skipping to change at line 291 | | skipping to change at line 298 | |
| | | | |
| /** | | /** | |
| * \brief Returns the format of the error text for the last error in
this provider | | * \brief Returns the format of the error text for the last error in
this provider | |
| * | | * | |
| * \note added in 1.6 | | * \note added in 1.6 | |
| */ | | */ | |
| virtual QString lastErrorFormat(); | | virtual QString lastErrorFormat(); | |
| | | | |
| /**Returns the dpi of the output device. | | /**Returns the dpi of the output device. | |
| @note: this method was added in version 1.2*/ | | @note: this method was added in version 1.2*/ | |
|
| int dpi() const {return mDpi;} | | int dpi() const { return mDpi; } | |
| | | | |
| /**Sets the output device resolution. | | /**Sets the output device resolution. | |
| @note: this method was added in version 1.2*/ | | @note: this method was added in version 1.2*/ | |
|
| void setDpi( int dpi ) {mDpi = dpi;} | | void setDpi( int dpi ) { mDpi = dpi; } | |
| | | | |
| /** Time stamp of data source in the moment when data/metadata were loa
ded by provider */ | | /** Time stamp of data source in the moment when data/metadata were loa
ded by provider */ | |
| virtual QDateTime timestamp() const { return mTimestamp; } | | virtual QDateTime timestamp() const { return mTimestamp; } | |
| | | | |
| /** Current time stamp of data source */ | | /** Current time stamp of data source */ | |
| virtual QDateTime dataTimestamp() const { return QDateTime(); } | | virtual QDateTime dataTimestamp() const { return QDateTime(); } | |
| | | | |
| /**Writes into the provider datasource*/ | | /**Writes into the provider datasource*/ | |
| // TODO: add data type (may be defferent from band type) | | // TODO: add data type (may be defferent from band type) | |
| virtual bool write( void* data, int band, int width, int height, int xO
ffset, int yOffset ) | | virtual bool write( void* data, int band, int width, int height, int xO
ffset, int yOffset ) | |
| | | | |
| skipping to change at line 331 | | skipping to change at line 338 | |
| int width, int height, double* ge
oTransform, | | int width, int height, double* ge
oTransform, | |
| const QgsCoordinateReferenceSyste
m& crs, | | const QgsCoordinateReferenceSyste
m& crs, | |
| QStringList createOptions = QStri
ngList() ); | | QStringList createOptions = QStri
ngList() ); | |
| | | | |
| /** Set no data value on created dataset | | /** Set no data value on created dataset | |
| * @param bandNo band number | | * @param bandNo band number | |
| * @param noDataValue no data value | | * @param noDataValue no data value | |
| */ | | */ | |
| virtual bool setNoDataValue( int bandNo, double noDataValue ) { Q_UNUSE
D( bandNo ); Q_UNUSED( noDataValue ); return false; } | | virtual bool setNoDataValue( int bandNo, double noDataValue ) { Q_UNUSE
D( bandNo ); Q_UNUSED( noDataValue ); return false; } | |
| | | | |
|
| /** Returns the formats supported by create() */ | | | |
| // TODO: this should be static and call C functions in provider library | | | |
| //static QStringList createFormats(); | | | |
| | | | |
| /** Remove dataset*/ | | /** Remove dataset*/ | |
| virtual bool remove() { return false; } | | virtual bool remove() { return false; } | |
| | | | |
| /** Returns a list of pyramid resampling method name and label pairs | | /** Returns a list of pyramid resampling method name and label pairs | |
| * for given provider */ | | * for given provider */ | |
| static QList<QPair<QString, QString> > pyramidResamplingMethods( QStrin
g providerKey ); | | static QList<QPair<QString, QString> > pyramidResamplingMethods( QStrin
g providerKey ); | |
| | | | |
| /** Validates creation options for a specific dataset and destination f
ormat. | | /** Validates creation options for a specific dataset and destination f
ormat. | |
| * @note used by GDAL provider only | | * @note used by GDAL provider only | |
| * @note see also validateCreationOptionsFormat() in gdal provider for
validating options based on format only */ | | * @note see also validateCreationOptionsFormat() in gdal provider for
validating options based on format only */ | |
| | | | |
| skipping to change at line 379 | | skipping to change at line 382 | |
| { Q_UNUSED( bandNo ); Q_UNUSED( xBlock ); Q_UNUSED( yBlock ); Q_UNUSED(
data ); } | | { Q_UNUSED( bandNo ); Q_UNUSED( xBlock ); Q_UNUSED( yBlock ); Q_UNUSED(
data ); } | |
| | | | |
| /** Read block of data using give extent and size | | /** Read block of data using give extent and size | |
| * @note not available in python bindings */ | | * @note not available in python bindings */ | |
| virtual void readBlock( int bandNo, QgsRectangle const & viewExtent, i
nt width, int height, void *data ) | | virtual void readBlock( int bandNo, QgsRectangle const & viewExtent, i
nt width, int height, void *data ) | |
| { Q_UNUSED( bandNo ); Q_UNUSED( viewExtent ); Q_UNUSED( width ); Q_UNUS
ED( height ); Q_UNUSED( data ); } | | { Q_UNUSED( bandNo ); Q_UNUSED( viewExtent ); Q_UNUSED( width ); Q_UNUS
ED( height ); Q_UNUSED( data ); } | |
| | | | |
| /** Returns true if user no data contains value */ | | /** Returns true if user no data contains value */ | |
| bool userNoDataValuesContains( int bandNo, double value ) const; | | bool userNoDataValuesContains( int bandNo, double value ) const; | |
| | | | |
|
| | | /** Copy member variables from other raster data provider. Useful for i | |
| | | mplementation of clone() method in subclasses */ | |
| | | void copyBaseSettings( const QgsRasterDataProvider& other ); | |
| | | | |
| static QStringList cStringList2Q_( char ** stringList ); | | static QStringList cStringList2Q_( char ** stringList ); | |
| | | | |
| static QString makeTableCell( const QString & value ); | | static QString makeTableCell( const QString & value ); | |
| static QString makeTableCells( const QStringList & values ); | | static QString makeTableCells( const QStringList & values ); | |
| | | | |
| /** Dots per inch. Extended WMS (e.g. QGIS mapserver) support DPI depen
dent output and therefore | | /** Dots per inch. Extended WMS (e.g. QGIS mapserver) support DPI depen
dent output and therefore | |
| are suited for printing. A value of -1 means it has not been set | | are suited for printing. A value of -1 means it has not been set | |
| @note: this member has been added in version 1.2*/ | | @note: this member has been added in version 1.2*/ | |
| int mDpi; | | int mDpi; | |
| | | | |
| | | | |
End of changes. 8 change blocks. |
| 15 lines changed or deleted | | 22 lines changed or added | |
|
| qgsrasterlayer.h | | qgsrasterlayer.h | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| #include "qgsrasterviewport.h" | | #include "qgsrasterviewport.h" | |
| | | | |
| class QgsMapToPixel; | | class QgsMapToPixel; | |
| class QgsRasterRenderer; | | class QgsRasterRenderer; | |
| class QgsRectangle; | | class QgsRectangle; | |
| class QImage; | | class QImage; | |
| class QLibrary; | | class QLibrary; | |
| class QPixmap; | | class QPixmap; | |
| class QSlider; | | class QSlider; | |
| | | | |
|
| | | typedef QList < QPair< QString, QColor > > QgsLegendColorList; | |
| | | | |
| /** \ingroup core | | /** \ingroup core | |
| * This class provides qgis with the ability to render raster datasets | | * This class provides qgis with the ability to render raster datasets | |
| * onto the mapcanvas. | | * onto the mapcanvas. | |
| * | | * | |
| * The qgsrasterlayer class makes use of gdal for data io, and thus suppor
ts | | * The qgsrasterlayer class makes use of gdal for data io, and thus suppor
ts | |
| * any gdal supported format. The constructor attempts to infer what type
of | | * any gdal supported format. The constructor attempts to infer what type
of | |
| * file (LayerType) is being opened - not in terms of the file format (tif
, ascii grid etc.) | | * file (LayerType) is being opened - not in terms of the file format (tif
, ascii grid etc.) | |
| * but rather in terms of whether the image is a GRAYSCALE, PaletteD or Mu
ltiband, | | * but rather in terms of whether the image is a GRAYSCALE, PaletteD or Mu
ltiband, | |
| * | | * | |
| * Within the three allowable raster layer types, there are 8 permutations
of | | * Within the three allowable raster layer types, there are 8 permutations
of | |
| | | | |
| skipping to change at line 285 | | skipping to change at line 287 | |
| | | | |
| /** Returns the data provider in a const-correct manner | | /** Returns the data provider in a const-correct manner | |
| @note available in python bindings as constDataProvider() | | @note available in python bindings as constDataProvider() | |
| */ | | */ | |
| const QgsRasterDataProvider* dataProvider() const; | | const QgsRasterDataProvider* dataProvider() const; | |
| | | | |
| /**Synchronises with changes in the datasource | | /**Synchronises with changes in the datasource | |
| @note added in version 1.6*/ | | @note added in version 1.6*/ | |
| virtual void reload(); | | virtual void reload(); | |
| | | | |
|
| | | /** Return new instance of QgsMapLayerRenderer that will be used for re | |
| | | ndering of given context | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rende | |
| | | rerContext ); | |
| | | | |
| /** \brief This is called when the view on the raster layer needs to be
redrawn */ | | /** \brief This is called when the view on the raster layer needs to be
redrawn */ | |
| bool draw( QgsRenderContext& rendererContext ); | | bool draw( QgsRenderContext& rendererContext ); | |
| | | | |
| /** \brief This is an overloaded version of the draw() function that is
called by both draw() and thumbnailAsPixmap */ | | /** \brief This is an overloaded version of the draw() function that is
called by both draw() and thumbnailAsPixmap */ | |
| void draw( QPainter * theQPainter, | | void draw( QPainter * theQPainter, | |
| QgsRasterViewPort * myRasterViewPort, | | QgsRasterViewPort * myRasterViewPort, | |
| const QgsMapToPixel* theQgsMapToPixel = 0 ); | | const QgsMapToPixel* theQgsMapToPixel = 0 ); | |
| | | | |
|
| /** \brief [ data provider interface ] If an operation returns 0 (e.g. | | | |
| draw()), this function returns the text of the error associated with the fa | | | |
| ilure */ | | | |
| QString lastError(); | | | |
| | | | |
| /** \brief [ data provider interface ] If an operation returns 0 (e.g. | | | |
| draw()), this function returns the text of the error associated with the fa | | | |
| ilure */ | | | |
| QString lastErrorTitle(); | | | |
| | | | |
| /**Returns a list with classification items (Text and color) | | /**Returns a list with classification items (Text and color) | |
| @note this method was added in version 1.8*/ | | @note this method was added in version 1.8*/ | |
|
| QList< QPair< QString, QColor > > legendSymbologyItems() const; | | QgsLegendColorList legendSymbologyItems() const; | |
| | | | |
| /** \brief Obtain GDAL Metadata for this layer */ | | /** \brief Obtain GDAL Metadata for this layer */ | |
| QString metadata(); | | QString metadata(); | |
| | | | |
| /** \brief Get an 100x100 pixmap of the color palette. If the layer has
no palette a white pixmap will be returned */ | | /** \brief Get an 100x100 pixmap of the color palette. If the layer has
no palette a white pixmap will be returned */ | |
| QPixmap paletteAsPixmap( int theBandNumber = 1 ); | | QPixmap paletteAsPixmap( int theBandNumber = 1 ); | |
| | | | |
| /** \brief [ data provider interface ] Which provider is being used fo
r this Raster Layer? | | /** \brief [ data provider interface ] Which provider is being used fo
r this Raster Layer? | |
| * @note added in 2.0 | | * @note added in 2.0 | |
| */ | | */ | |
| | | | |
| skipping to change at line 343 | | skipping to change at line 344 | |
| | | | |
| /** \brief Overloaded version of the above function for convenience whe
n restoring from xml */ | | /** \brief Overloaded version of the above function for convenience whe
n restoring from xml */ | |
| void setDrawingStyle( const QString & theDrawingStyleQString ); | | void setDrawingStyle( const QString & theDrawingStyleQString ); | |
| | | | |
| /** \brief [ data provider interface ] A wrapper function to emit a pr
ogress update signal */ | | /** \brief [ data provider interface ] A wrapper function to emit a pr
ogress update signal */ | |
| void showProgress( int theValue ); | | void showProgress( int theValue ); | |
| | | | |
| /** \brief Returns the sublayers of this layer - Useful for providers t
hat manage their own layers, such as WMS */ | | /** \brief Returns the sublayers of this layer - Useful for providers t
hat manage their own layers, such as WMS */ | |
| virtual QStringList subLayers() const; | | virtual QStringList subLayers() const; | |
| | | | |
|
| /** \brief Draws a preview of the rasterlayer into a pixmap */ | | /** \brief Draws a preview of the rasterlayer into a pixmap | |
| QPixmap previewAsPixmap( QSize size, QColor bgColor = Qt::white ); | | @note - use previewAsImage() for rendering with QGIS>=2.4 */ | |
| | | Q_DECL_DEPRECATED QPixmap previewAsPixmap( QSize size, QColor bgColor = | |
| | | Qt::white ); | |
| | | | |
| | | /** \brief Draws a preview of the rasterlayer into a QImage | |
| | | @note added in 2.4 */ | |
| | | QImage previewAsImage( QSize size, QColor bgColor = Qt::white, | |
| | | QImage::Format format = QImage::Format_ARGB32_Pr | |
| | | emultiplied ); | |
| | | | |
| /** \brief Emit a signal asking for a repaint. (inherited from maplayer
) */ | | /** \brief Emit a signal asking for a repaint. (inherited from maplayer
) */ | |
| void triggerRepaint(); | | void triggerRepaint(); | |
| | | | |
| /** | | /** | |
| * Reorders the *previously selected* sublayers of this layer from bott
om to top | | * Reorders the *previously selected* sublayers of this layer from bott
om to top | |
| * | | * | |
| * (Useful for providers that manage their own layers, such as WMS) | | * (Useful for providers that manage their own layers, such as WMS) | |
| * | | * | |
| */ | | */ | |
| | | | |
| skipping to change at line 368 | | skipping to change at line 375 | |
| * Set the visibility of the given sublayer name | | * Set the visibility of the given sublayer name | |
| */ | | */ | |
| virtual void setSubLayerVisibility( QString name, bool vis ); | | virtual void setSubLayerVisibility( QString name, bool vis ); | |
| | | | |
| /** Time stamp of data source in the moment when data/metadata were loa
ded by provider */ | | /** Time stamp of data source in the moment when data/metadata were loa
ded by provider */ | |
| virtual QDateTime timestamp() const { return mDataProvider->timestamp()
; } | | virtual QDateTime timestamp() const { return mDataProvider->timestamp()
; } | |
| | | | |
| public slots: | | public slots: | |
| void showStatusMessage( const QString & theMessage ); | | void showStatusMessage( const QString & theMessage ); | |
| | | | |
|
| /** \brief Propagate progress updates from GDAL up to the parent app */ | | //! @deprecated in 2.4 - does nothing | |
| void updateProgress( int, int ); | | Q_DECL_DEPRECATED void updateProgress( int, int ); | |
| | | | |
| /** \brief receive progress signal from provider */ | | /** \brief receive progress signal from provider */ | |
| void onProgress( int, double, QString ); | | void onProgress( int, double, QString ); | |
| | | | |
| signals: | | signals: | |
| /** \brief Signal for notifying listeners of long running processes */ | | /** \brief Signal for notifying listeners of long running processes */ | |
| void progressUpdate( int theValue ); | | void progressUpdate( int theValue ); | |
| | | | |
| /** | | /** | |
| * This is emitted whenever data or metadata (e.g. color table, exten
t) has changed | | * This is emitted whenever data or metadata (e.g. color table, exten
t) has changed | |
| * @note added in 1.7 | | * @note added in 1.7 | |
| */ | | */ | |
| void dataChanged(); | | void dataChanged(); | |
| | | | |
|
| /** Signal emitted when the symbology changes, through call to setRende | | | |
| rer() */ | | | |
| void rendererChanged(); | | | |
| | | | |
| protected: | | protected: | |
| /** \brief Read the symbology for the current layer from the Dom node s
upplied */ | | /** \brief Read the symbology for the current layer from the Dom node s
upplied */ | |
| bool readSymbology( const QDomNode& node, QString& errorMessage ); | | bool readSymbology( const QDomNode& node, QString& errorMessage ); | |
| | | | |
| /** \brief Reads layer specific state from project file Dom node */ | | /** \brief Reads layer specific state from project file Dom node */ | |
| bool readXml( const QDomNode& layer_node ); | | bool readXml( const QDomNode& layer_node ); | |
| | | | |
| /** \brief Write the symbology for the layer into the docment provided
*/ | | /** \brief Write the symbology for the layer into the docment provided
*/ | |
| bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessag
e ) const; | | bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessag
e ) const; | |
| | | | |
| | | | |
| skipping to change at line 422 | | skipping to change at line 426 | |
| | | | |
| /** \brief Constant defining flag for XML and a constant that signals
property not used */ | | /** \brief Constant defining flag for XML and a constant that signals
property not used */ | |
| const QString QSTRING_NOT_SET; | | const QString QSTRING_NOT_SET; | |
| const QString TRSTRING_NOT_SET; | | const QString TRSTRING_NOT_SET; | |
| | | | |
| /** Pointer to data provider */ | | /** Pointer to data provider */ | |
| QgsRasterDataProvider* mDataProvider; | | QgsRasterDataProvider* mDataProvider; | |
| | | | |
| //DrawingStyle mDrawingStyle; | | //DrawingStyle mDrawingStyle; | |
| | | | |
|
| /** [ data provider interface ]The error message associated with the la | | | |
| st error */ | | | |
| QString mError; | | | |
| | | | |
| /** [ data provider interface ] The error caption associated with the l | | | |
| ast error */ | | | |
| QString mErrorCaption; | | | |
| | | | |
| /** [ data provider interface ] Timestamp, the last modified time of t
he data source when the layer was created */ | | /** [ data provider interface ] Timestamp, the last modified time of t
he data source when the layer was created */ | |
| QDateTime mLastModified; | | QDateTime mLastModified; | |
| | | | |
| QgsRasterViewPort mLastViewPort; | | QgsRasterViewPort mLastViewPort; | |
| | | | |
| /** [ data provider interface ] Data provider key */ | | /** [ data provider interface ] Data provider key */ | |
| QString mProviderKey; | | QString mProviderKey; | |
| | | | |
| LayerType mRasterType; | | LayerType mRasterType; | |
| | | | |
| | | | |
End of changes. 8 change blocks. |
| 27 lines changed or deleted | | 22 lines changed or added | |
|
| qgssymbollayerv2.h | | qgssymbollayerv2.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
|
| qgssymbollayerv2.h | | qgssymbollayerv2.h | |
| --------------------- | | --------------------- | |
| begin : November 2009 | | begin : November 2009 | |
| copyright : (C) 2009 by Martin Dobias | | copyright : (C) 2009 by Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| #ifndef QGSSYMBOLLAYERV2_H | | #ifndef QGSSYMBOLLAYERV2_H | |
| #define QGSSYMBOLLAYERV2_H | | #define QGSSYMBOLLAYERV2_H | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 101 | |
| | | | |
| /**Returns the estimated maximum distance which the layer style will bl
eed outside | | /**Returns the estimated maximum distance which the layer style will bl
eed outside | |
| the drawn shape. Eg, polygons drawn with an outline will draw half th
e width | | the drawn shape. Eg, polygons drawn with an outline will draw half th
e width | |
| of the outline outside of the polygon. This amount is estimated, sinc
e it may | | of the outline outside of the polygon. This amount is estimated, sinc
e it may | |
| be affected by data defined symbology rules.*/ | | be affected by data defined symbology rules.*/ | |
| virtual double estimateMaxBleed() const { return 0; } | | virtual double estimateMaxBleed() const { return 0; } | |
| | | | |
| virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit ) { Q_UNUSED(
unit ); } //= 0; | | virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit ) { Q_UNUSED(
unit ); } //= 0; | |
| virtual QgsSymbolV2::OutputUnit outputUnit() const { return QgsSymbolV2
::Mixed; } //= 0; | | virtual QgsSymbolV2::OutputUnit outputUnit() const { return QgsSymbolV2
::Mixed; } //= 0; | |
| | | | |
|
| | | virtual void setMapUnitScale( const QgsMapUnitScale& scale ) { Q_UNUSED | |
| | | ( scale ); } //= 0; | |
| | | virtual QgsMapUnitScale mapUnitScale() const { return QgsMapUnitScale() | |
| | | ; } //= 0; | |
| | | | |
| // used only with rending with symbol levels is turned on (0 = first pa
ss, 1 = second, ...) | | // used only with rending with symbol levels is turned on (0 = first pa
ss, 1 = second, ...) | |
| void setRenderingPass( int renderingPass ) { mRenderingPass = rendering
Pass; } | | void setRenderingPass( int renderingPass ) { mRenderingPass = rendering
Pass; } | |
| int renderingPass() const { return mRenderingPass; } | | int renderingPass() const { return mRenderingPass; } | |
| | | | |
| // symbol layers normally only use additional attributes to provide dat
a defined settings | | // symbol layers normally only use additional attributes to provide dat
a defined settings | |
| virtual QSet<QString> usedAttributes() const; | | virtual QSet<QString> usedAttributes() const; | |
| | | | |
| virtual const QgsExpression* dataDefinedProperty( const QString& proper
ty ) const; | | virtual const QgsExpression* dataDefinedProperty( const QString& proper
ty ) const; | |
| virtual QString dataDefinedPropertyString( const QString& property ) co
nst; | | virtual QString dataDefinedPropertyString( const QString& property ) co
nst; | |
| virtual void setDataDefinedProperty( const QString& property, const QSt
ring& expressionString ); | | virtual void setDataDefinedProperty( const QString& property, const QSt
ring& expressionString ); | |
| | | | |
| skipping to change at line 145 | | skipping to change at line 148 | |
| QColor mColor; | | QColor mColor; | |
| int mRenderingPass; | | int mRenderingPass; | |
| | | | |
| QMap< QString, QgsExpression* > mDataDefinedProperties; | | QMap< QString, QgsExpression* > mDataDefinedProperties; | |
| | | | |
| // Configuration of selected symbology implementation | | // Configuration of selected symbology implementation | |
| static const bool selectionIsOpaque = true; // Selection ignores symbo
l alpha | | static const bool selectionIsOpaque = true; // Selection ignores symbo
l alpha | |
| static const bool selectFillBorder = false; // Fill symbol layer also
selects border symbology | | static const bool selectFillBorder = false; // Fill symbol layer also
selects border symbology | |
| static const bool selectFillStyle = false; // Fill symbol uses symbol
layer style.. | | static const bool selectFillStyle = false; // Fill symbol uses symbol
layer style.. | |
| | | | |
|
| virtual void prepareExpressions( const QgsVectorLayer* vl, double scale
= -1.0 ); | | virtual void prepareExpressions( const QgsFields* fields, double scale
= -1.0 ); | |
| virtual QgsExpression* expression( const QString& property ) const; | | virtual QgsExpression* expression( const QString& property ) const; | |
| /**Saves data defined properties to string map*/ | | /**Saves data defined properties to string map*/ | |
| void saveDataDefinedProperties( QgsStringMap& stringMap ) const; | | void saveDataDefinedProperties( QgsStringMap& stringMap ) const; | |
| /**Copies data defined properties of this layer to another symbol layer
*/ | | /**Copies data defined properties of this layer to another symbol layer
*/ | |
| void copyDataDefinedProperties( QgsSymbolLayerV2* destLayer ) const; | | void copyDataDefinedProperties( QgsSymbolLayerV2* destLayer ) const; | |
| }; | | }; | |
| | | | |
| ////////////////////// | | ////////////////////// | |
| | | | |
| class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2 | | class CORE_EXPORT QgsMarkerSymbolLayerV2 : public QgsSymbolLayerV2 | |
| | | | |
| skipping to change at line 199 | | skipping to change at line 202 | |
| QPointF offset() { return mOffset; } | | QPointF offset() { return mOffset; } | |
| | | | |
| virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringM
ap props ) const; | | virtual void toSld( QDomDocument &doc, QDomElement &element, QgsStringM
ap props ) const; | |
| | | | |
| virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, Q
gsStringMap props ) const | | virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, Q
gsStringMap props ) const | |
| { Q_UNUSED( props ); element.appendChild( doc.createComment( QString( "
QgsMarkerSymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); } | | { Q_UNUSED( props ); element.appendChild( doc.createComment( QString( "
QgsMarkerSymbolLayerV2 %1 not implemented yet" ).arg( layerType() ) ) ); } | |
| | | | |
| void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | | void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit
; } | |
| QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | | QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; } | |
| | | | |
|
| | | void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMap | |
| | | UnitScale = scale; } | |
| | | const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUn | |
| | | itScale; } | |
| | | | |
| void setSizeUnit( QgsSymbolV2::OutputUnit unit ) { mSizeUnit = unit; } | | void setSizeUnit( QgsSymbolV2::OutputUnit unit ) { mSizeUnit = unit; } | |
| QgsSymbolV2::OutputUnit sizeUnit() const { return mSizeUnit; } | | QgsSymbolV2::OutputUnit sizeUnit() const { return mSizeUnit; } | |
| | | | |
|
| virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | | void setSizeMapUnitScale( const QgsMapUnitScale& scale ) { mSizeMapUnit | |
| virtual QgsSymbolV2::OutputUnit outputUnit() const; | | Scale = scale; } | |
| | | const QgsMapUnitScale& sizeMapUnitScale() const { return mSizeMapUnitSc | |
| | | ale; } | |
| | | | |
| | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
| | | void setMapUnitScale( const QgsMapUnitScale& scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| void setHorizontalAnchorPoint( HorizontalAnchorPoint h ) { mHorizontalA
nchorPoint = h; } | | void setHorizontalAnchorPoint( HorizontalAnchorPoint h ) { mHorizontalA
nchorPoint = h; } | |
| HorizontalAnchorPoint horizontalAnchorPoint() const { return mHorizonta
lAnchorPoint; } | | HorizontalAnchorPoint horizontalAnchorPoint() const { return mHorizonta
lAnchorPoint; } | |
| | | | |
| void setVerticalAnchorPoint( VerticalAnchorPoint v ) { mVerticalAnchorP
oint = v; } | | void setVerticalAnchorPoint( VerticalAnchorPoint v ) { mVerticalAnchorP
oint = v; } | |
| VerticalAnchorPoint verticalAnchorPoint() const { return mVerticalAncho
rPoint; } | | VerticalAnchorPoint verticalAnchorPoint() const { return mVerticalAncho
rPoint; } | |
| | | | |
| protected: | | protected: | |
| QgsMarkerSymbolLayerV2( bool locked = false ); | | QgsMarkerSymbolLayerV2( bool locked = false ); | |
| | | | |
| //handles marker offset and anchor point shift together | | //handles marker offset and anchor point shift together | |
| void markerOffset( const QgsSymbolV2RenderContext& context, double& off
setX, double& offsetY ) const; | | void markerOffset( const QgsSymbolV2RenderContext& context, double& off
setX, double& offsetY ) const; | |
| | | | |
|
| | | void markerOffset( const QgsSymbolV2RenderContext& context, double widt | |
| | | h, double height, double& offsetX, double& offsetY ) const; | |
| | | | |
| //! @note available in python bindings as markerOffset2 | | //! @note available in python bindings as markerOffset2 | |
| void markerOffset( const QgsSymbolV2RenderContext& context, double widt
h, double height, | | void markerOffset( const QgsSymbolV2RenderContext& context, double widt
h, double height, | |
| QgsSymbolV2::OutputUnit widthUnit, QgsSymbolV2::Outp
utUnit heightUnit, | | QgsSymbolV2::OutputUnit widthUnit, QgsSymbolV2::Outp
utUnit heightUnit, | |
|
| double& offsetX, double& offsetY ) const; | | double& offsetX, double& offsetY, | |
| | | const QgsMapUnitScale &widthMapUnitScale, const QgsM | |
| | | apUnitScale &heightMapUnitScale ) const; | |
| | | | |
| static QPointF _rotatedOffset( const QPointF& offset, double angle ); | | static QPointF _rotatedOffset( const QPointF& offset, double angle ); | |
| | | | |
| double mAngle; | | double mAngle; | |
| double mSize; | | double mSize; | |
| QgsSymbolV2::OutputUnit mSizeUnit; | | QgsSymbolV2::OutputUnit mSizeUnit; | |
|
| | | QgsMapUnitScale mSizeMapUnitScale; | |
| QPointF mOffset; | | QPointF mOffset; | |
| QgsSymbolV2::OutputUnit mOffsetUnit; | | QgsSymbolV2::OutputUnit mOffsetUnit; | |
|
| | | QgsMapUnitScale mOffsetMapUnitScale; | |
| QgsSymbolV2::ScaleMethod mScaleMethod; | | QgsSymbolV2::ScaleMethod mScaleMethod; | |
| HorizontalAnchorPoint mHorizontalAnchorPoint; | | HorizontalAnchorPoint mHorizontalAnchorPoint; | |
| VerticalAnchorPoint mVerticalAnchorPoint; | | VerticalAnchorPoint mVerticalAnchorPoint; | |
| | | | |
| private: | | private: | |
| static QgsMarkerSymbolLayerV2::HorizontalAnchorPoint decodeHorizontalAn
chorPoint( const QString& str ); | | static QgsMarkerSymbolLayerV2::HorizontalAnchorPoint decodeHorizontalAn
chorPoint( const QString& str ); | |
| static QgsMarkerSymbolLayerV2::VerticalAnchorPoint decodeVerticalAnchor
Point( const QString& str ); | | static QgsMarkerSymbolLayerV2::VerticalAnchorPoint decodeVerticalAnchor
Point( const QString& str ); | |
| | | | |
| QgsExpression* mOffsetExpression; | | QgsExpression* mOffsetExpression; | |
| QgsExpression* mHorizontalAnchorExpression; | | QgsExpression* mHorizontalAnchorExpression; | |
| | | | |
| skipping to change at line 256 | | skipping to change at line 273 | |
| | | | |
| //! @note added in v1.7 | | //! @note added in v1.7 | |
| virtual void renderPolygonOutline( const QPolygonF& points, QList<QPoly
gonF>* rings, QgsSymbolV2RenderContext& context ); | | virtual void renderPolygonOutline( const QPolygonF& points, QList<QPoly
gonF>* rings, QgsSymbolV2RenderContext& context ); | |
| | | | |
| virtual void setWidth( double width ) { mWidth = width; } | | virtual void setWidth( double width ) { mWidth = width; } | |
| virtual double width() const { return mWidth; } | | virtual double width() const { return mWidth; } | |
| | | | |
| void setWidthUnit( QgsSymbolV2::OutputUnit unit ) { mWidthUnit = unit;
} | | void setWidthUnit( QgsSymbolV2::OutputUnit unit ) { mWidthUnit = unit;
} | |
| QgsSymbolV2::OutputUnit widthUnit() const { return mWidthUnit; } | | QgsSymbolV2::OutputUnit widthUnit() const { return mWidthUnit; } | |
| | | | |
|
| | | void setWidthMapUnitScale( const QgsMapUnitScale& scale ) { mWidthMapUn | |
| | | itScale = scale; } | |
| | | const QgsMapUnitScale& widthMapUnitScale() const { return mWidthMapUnit | |
| | | Scale; } | |
| | | | |
| | | void setOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| | | | |
| | | void setMapUnitScale( const QgsMapUnitScale& scale ); | |
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | | |
| void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | | void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | |
| | | | |
| virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2Render
Context& context ) const; | | virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2Render
Context& context ) const; | |
| | | | |
| protected: | | protected: | |
| QgsLineSymbolLayerV2( bool locked = false ); | | QgsLineSymbolLayerV2( bool locked = false ); | |
| | | | |
| double mWidth; | | double mWidth; | |
| QgsSymbolV2::OutputUnit mWidthUnit; | | QgsSymbolV2::OutputUnit mWidthUnit; | |
|
| | | QgsMapUnitScale mWidthMapUnitScale; | |
| }; | | }; | |
| | | | |
| class CORE_EXPORT QgsFillSymbolLayerV2 : public QgsSymbolLayerV2 | | class CORE_EXPORT QgsFillSymbolLayerV2 : public QgsSymbolLayerV2 | |
| { | | { | |
| public: | | public: | |
| virtual void renderPolygon( const QPolygonF& points, QList<QPolygonF>*
rings, QgsSymbolV2RenderContext& context ) = 0; | | virtual void renderPolygon( const QPolygonF& points, QList<QPolygonF>*
rings, QgsSymbolV2RenderContext& context ) = 0; | |
| | | | |
| void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | | void drawPreviewIcon( QgsSymbolV2RenderContext& context, QSize size ); | |
| | | | |
| void setAngle( double angle ) { mAngle = angle; } | | void setAngle( double angle ) { mAngle = angle; } | |
| | | | |
End of changes. 11 change blocks. |
| 9 lines changed or deleted | | 46 lines changed or added | |
|
| qgssymbollayerv2utils.h | | qgssymbollayerv2utils.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
|
| qgssymbollayerv2utils.h | | qgssymbollayerv2utils.h | |
| --------------------- | | --------------------- | |
| begin : November 2009 | | begin : November 2009 | |
| copyright : (C) 2009 by Martin Dobias | | copyright : (C) 2009 by Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSSYMBOLLAYERV2UTILS_H | | #ifndef QGSSYMBOLLAYERV2UTILS_H | |
| #define QGSSYMBOLLAYERV2UTILS_H | | #define QGSSYMBOLLAYERV2UTILS_H | |
| | | | |
| #include <QMap> | | #include <QMap> | |
| #include <Qt> | | #include <Qt> | |
| #include <QtCore> | | #include <QtCore> | |
| #include <QFont> | | #include <QFont> | |
| #include <QColor> | | #include <QColor> | |
| #include "qgssymbolv2.h" | | #include "qgssymbolv2.h" | |
| #include "qgis.h" | | #include "qgis.h" | |
|
| | | #include "qgsmapunitscale.h" | |
| | | | |
| class QgsExpression; | | class QgsExpression; | |
| class QgsSymbolLayerV2; | | class QgsSymbolLayerV2; | |
| class QgsVectorColorRampV2; | | class QgsVectorColorRampV2; | |
| | | | |
| typedef QMap<QString, QString> QgsStringMap; | | typedef QMap<QString, QString> QgsStringMap; | |
| typedef QMap<QString, QgsSymbolV2* > QgsSymbolV2Map; | | typedef QMap<QString, QgsSymbolV2* > QgsSymbolV2Map; | |
| | | | |
| class QDomDocument; | | class QDomDocument; | |
| class QDomElement; | | class QDomElement; | |
| | | | |
| skipping to change at line 81 | | skipping to change at line 82 | |
| | | | |
| static QString encodeBrushStyle( Qt::BrushStyle style ); | | static QString encodeBrushStyle( Qt::BrushStyle style ); | |
| static Qt::BrushStyle decodeBrushStyle( QString str ); | | static Qt::BrushStyle decodeBrushStyle( QString str ); | |
| | | | |
| static QString encodeSldBrushStyle( Qt::BrushStyle style ); | | static QString encodeSldBrushStyle( Qt::BrushStyle style ); | |
| static Qt::BrushStyle decodeSldBrushStyle( QString str ); | | static Qt::BrushStyle decodeSldBrushStyle( QString str ); | |
| | | | |
| static QString encodePoint( QPointF point ); | | static QString encodePoint( QPointF point ); | |
| static QPointF decodePoint( QString str ); | | static QPointF decodePoint( QString str ); | |
| | | | |
|
| | | static QString encodeMapUnitScale( const QgsMapUnitScale& mapUnitScale | |
| | | ); | |
| | | static QgsMapUnitScale decodeMapUnitScale( const QString& str ); | |
| | | | |
| static QString encodeRealVector( const QVector<qreal>& v ); | | static QString encodeRealVector( const QVector<qreal>& v ); | |
| static QVector<qreal> decodeRealVector( const QString& s ); | | static QVector<qreal> decodeRealVector( const QString& s ); | |
| | | | |
| static QString encodeSldRealVector( const QVector<qreal>& v ); | | static QString encodeSldRealVector( const QVector<qreal>& v ); | |
| static QVector<qreal> decodeSldRealVector( const QString& s ); | | static QVector<qreal> decodeSldRealVector( const QString& s ); | |
| | | | |
| static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit ); | | static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit ); | |
| static QgsSymbolV2::OutputUnit decodeOutputUnit( QString str ); | | static QgsSymbolV2::OutputUnit decodeOutputUnit( QString str ); | |
| | | | |
| static QString encodeSldUom( QgsSymbolV2::OutputUnit unit, double *scal
eFactor ); | | static QString encodeSldUom( QgsSymbolV2::OutputUnit unit, double *scal
eFactor ); | |
| static QgsSymbolV2::OutputUnit decodeSldUom( QString str, double *scale
Factor ); | | static QgsSymbolV2::OutputUnit decodeSldUom( QString str, double *scale
Factor ); | |
| | | | |
| static QString encodeScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod
); | | static QString encodeScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod
); | |
| static QgsSymbolV2::ScaleMethod decodeScaleMethod( QString str ); | | static QgsSymbolV2::ScaleMethod decodeScaleMethod( QString str ); | |
| | | | |
| static QIcon symbolPreviewIcon( QgsSymbolV2* symbol, QSize size ); | | static QIcon symbolPreviewIcon( QgsSymbolV2* symbol, QSize size ); | |
|
| static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbol
V2::OutputUnit u, QSize size ); | | static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbol
V2::OutputUnit u, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScal
e() ); | |
| static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize si
ze ); | | static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize si
ze ); | |
| | | | |
| static void drawStippledBackround( QPainter* painter, QRect rect ); | | static void drawStippledBackround( QPainter* painter, QRect rect ); | |
| | | | |
| static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size ); | | static QPixmap symbolPreviewPixmap( QgsSymbolV2* symbol, QSize size ); | |
| static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSiz
e size ); | | static QPixmap colorRampPreviewPixmap( QgsVectorColorRampV2* ramp, QSiz
e size ); | |
| | | | |
| /**Returns the maximum estimated bleed for the symbol */ | | /**Returns the maximum estimated bleed for the symbol */ | |
| static double estimateMaxSymbolBleed( QgsSymbolV2* symbol ); | | static double estimateMaxSymbolBleed( QgsSymbolV2* symbol ); | |
| | | | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 188 | |
| static void labelTextToSld( QDomDocument &doc, QDomElement &element, QS
tring label, | | static void labelTextToSld( QDomDocument &doc, QDomElement &element, QS
tring label, | |
| QFont font, QColor color = QColor(), double
size = -1 ); | | QFont font, QColor color = QColor(), double
size = -1 ); | |
| | | | |
| /**Create ogr feature style string for pen */ | | /**Create ogr feature style string for pen */ | |
| static QString ogrFeatureStylePen( double width, double mmScaleFactor,
double mapUnitsScaleFactor, const QColor& c, | | static QString ogrFeatureStylePen( double width, double mmScaleFactor,
double mapUnitsScaleFactor, const QColor& c, | |
| Qt::PenJoinStyle joinStyle = Qt::Mit
erJoin, | | Qt::PenJoinStyle joinStyle = Qt::Mit
erJoin, | |
| Qt::PenCapStyle capStyle = Qt::FlatC
ap, | | Qt::PenCapStyle capStyle = Qt::FlatC
ap, | |
| double offset = 0.0, | | double offset = 0.0, | |
| const QVector<qreal>* dashPattern =
0 ); | | const QVector<qreal>* dashPattern =
0 ); | |
| /**Create ogr feature style string for brush | | /**Create ogr feature style string for brush | |
|
| @param fillColr fill color*/ | | @param fillColr fill color*/ | |
| static QString ogrFeatureStyleBrush( const QColor& fillColr ); | | static QString ogrFeatureStyleBrush( const QColor& fillColr ); | |
| | | | |
| static void createRotationElement( QDomDocument &doc, QDomElement &elem
ent, QString rotationFunc ); | | static void createRotationElement( QDomDocument &doc, QDomElement &elem
ent, QString rotationFunc ); | |
| static bool rotationFromSldElement( QDomElement &element, QString &rota
tionFunc ); | | static bool rotationFromSldElement( QDomElement &element, QString &rota
tionFunc ); | |
| | | | |
| static void createOpacityElement( QDomDocument &doc, QDomElement &eleme
nt, QString alphaFunc ); | | static void createOpacityElement( QDomDocument &doc, QDomElement &eleme
nt, QString alphaFunc ); | |
| static bool opacityFromSldElement( QDomElement &element, QString &alpha
Func ); | | static bool opacityFromSldElement( QDomElement &element, QString &alpha
Func ); | |
| | | | |
| static void createDisplacementElement( QDomDocument &doc, QDomElement &
element, QPointF offset ); | | static void createDisplacementElement( QDomDocument &doc, QDomElement &
element, QPointF offset ); | |
| static bool displacementFromSldElement( QDomElement &element, QPointF &
offset ); | | static bool displacementFromSldElement( QDomElement &element, QPointF &
offset ); | |
| | | | |
| skipping to change at line 222 | | skipping to change at line 226 | |
| static void saveProperties( QgsStringMap props, QDomDocument& doc, QDom
Element& element ); | | static void saveProperties( QgsStringMap props, QDomDocument& doc, QDom
Element& element ); | |
| | | | |
| static QgsSymbolV2Map loadSymbols( QDomElement& element ); | | static QgsSymbolV2Map loadSymbols( QDomElement& element ); | |
| static QDomElement saveSymbols( QgsSymbolV2Map& symbols, QString tagNam
e, QDomDocument& doc ); | | static QDomElement saveSymbols( QgsSymbolV2Map& symbols, QString tagNam
e, QDomDocument& doc ); | |
| | | | |
| static void clearSymbolMap( QgsSymbolV2Map& symbols ); | | static void clearSymbolMap( QgsSymbolV2Map& symbols ); | |
| | | | |
| static QgsVectorColorRampV2* loadColorRamp( QDomElement& element ); | | static QgsVectorColorRampV2* loadColorRamp( QDomElement& element ); | |
| static QDomElement saveColorRamp( QString name, QgsVectorColorRampV2* r
amp, QDomDocument& doc ); | | static QDomElement saveColorRamp( QString name, QgsVectorColorRampV2* r
amp, QDomDocument& doc ); | |
| | | | |
|
| /** parse color definition with format "rgb(0,0,0)" or "0,0,0" */ | | /** | |
| | | * Attempts to parse a string as a color using a variety of common form | |
| | | ats, including hex | |
| | | * codes, rgb and rgba strings. | |
| | | * @param colorStr string representing the color | |
| | | * @returns parsed color | |
| | | * @note added in 2.3 | |
| | | */ | |
| static QColor parseColor( QString colorStr ); | | static QColor parseColor( QString colorStr ); | |
| | | | |
|
| | | /** | |
| | | * Attempts to parse a string as a color using a variety of common form | |
| | | ats, including hex | |
| | | * codes, rgb and rgba strings. | |
| | | * @param colorStr string representing the color | |
| | | * @param containsAlpha if colorStr contains an explicit alpha value th | |
| | | en containsAlpha will be set to true | |
| | | * @returns parsed color | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | static QColor parseColorWithAlpha( const QString colorStr, bool &contai | |
| | | nsAlpha ); | |
| | | | |
| /**Returns the line width scale factor depending on the unit and the pa
int device*/ | | /**Returns the line width scale factor depending on the unit and the pa
int device*/ | |
|
| static double lineWidthScaleFactor( const QgsRenderContext& c, QgsSymbo
lV2::OutputUnit u ); | | static double lineWidthScaleFactor( const QgsRenderContext& c, QgsSymbo
lV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() ); | |
| /**Returns scale factor painter units -> pixel dimensions*/ | | /**Returns scale factor painter units -> pixel dimensions*/ | |
|
| static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbo
lV2::OutputUnit u ); | | static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbo
lV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() ); | |
| /**Creates a render context for a pixel based device*/ | | /**Creates a render context for a pixel based device*/ | |
| static QgsRenderContext createRenderContext( QPainter* p ); | | static QgsRenderContext createRenderContext( QPainter* p ); | |
| | | | |
| /**Multiplies opacity of image pixel values with a (global) transparenc
y value*/ | | /**Multiplies opacity of image pixel values with a (global) transparenc
y value*/ | |
| static void multiplyImageOpacity( QImage* image, qreal alpha ); | | static void multiplyImageOpacity( QImage* image, qreal alpha ); | |
| | | | |
| /** Blurs an image in place, e.g. creating Qt-independent drop shadows | | /** Blurs an image in place, e.g. creating Qt-independent drop shadows | |
| * @note added in 1.9 | | * @note added in 1.9 | |
| */ | | */ | |
| static void blurImageInPlace( QImage& image, const QRect& rect, int rad
ius, bool alphaOnly ); | | static void blurImageInPlace( QImage& image, const QRect& rect, int rad
ius, bool alphaOnly ); | |
| | | | |
|
| | | /** Converts a QColor into a premultiplied ARGB QColor value using a sp | |
| | | ecified alpha value | |
| | | * @note added in 2.3 | |
| | | */ | |
| | | static void premultiplyColor( QColor& rgb, int alpha ); | |
| | | | |
| /**Sorts the passed list in requested order*/ | | /**Sorts the passed list in requested order*/ | |
| static void sortVariantList( QList<QVariant>& list, Qt::SortOrder order
); | | static void sortVariantList( QList<QVariant>& list, Qt::SortOrder order
); | |
| /**Returns a point on the line from startPoint to directionPoint that i
s a certain distance away from the starting point*/ | | /**Returns a point on the line from startPoint to directionPoint that i
s a certain distance away from the starting point*/ | |
| static QPointF pointOnLineWithDistance( const QPointF& startPoint, cons
t QPointF& directionPoint, double distance ); | | static QPointF pointOnLineWithDistance( const QPointF& startPoint, cons
t QPointF& directionPoint, double distance ); | |
| | | | |
| //! Return a list of all available svg files | | //! Return a list of all available svg files | |
| static QStringList listSvgFiles(); | | static QStringList listSvgFiles(); | |
| | | | |
| //! Return a list of svg files at the specified directory | | //! Return a list of svg files at the specified directory | |
| static QStringList listSvgFilesAt( QString directory ); | | static QStringList listSvgFilesAt( QString directory ); | |
| | | | |
| skipping to change at line 263 | | skipping to change at line 288 | |
| * in settings svg/searchPathsForSVG. | | * in settings svg/searchPathsForSVG. | |
| */ | | */ | |
| static QString symbolNameToPath( QString name ); | | static QString symbolNameToPath( QString name ); | |
| | | | |
| //! Get symbols's name from its path | | //! Get symbols's name from its path | |
| static QString symbolPathToName( QString path ); | | static QString symbolPathToName( QString path ); | |
| | | | |
| //! Calculate the centroid point of a QPolygonF | | //! Calculate the centroid point of a QPolygonF | |
| static QPointF polygonCentroid( const QPolygonF& points ); | | static QPointF polygonCentroid( const QPolygonF& points ); | |
| | | | |
|
| | | //! Calculate a point within of a QPolygonF | |
| | | static QPointF polygonPointOnSurface( const QPolygonF& points ); | |
| | | | |
| | | //! Calculate whether a point is within of a QPolygonF | |
| | | static bool pointInPolygon( const QPolygonF &points, const QPointF &poi | |
| | | nt ); | |
| | | | |
| /** Return a new valid expression instance for given field or expressio
n string. | | /** Return a new valid expression instance for given field or expressio
n string. | |
| * If the input is not a valid expression, it is assumed that it is a f
ield name and gets properly quoted. | | * If the input is not a valid expression, it is assumed that it is a f
ield name and gets properly quoted. | |
| * If the string is empty, returns null pointer. | | * If the string is empty, returns null pointer. | |
| * This is useful when accepting input which could be either a non-quot
ed field name or expression. | | * This is useful when accepting input which could be either a non-quot
ed field name or expression. | |
| * @note added in 2.2 | | * @note added in 2.2 | |
| */ | | */ | |
| static QgsExpression* fieldOrExpressionToExpression( const QString& fie
ldOrExpression ); | | static QgsExpression* fieldOrExpressionToExpression( const QString& fie
ldOrExpression ); | |
| | | | |
| /** Return a field name if the whole expression is just a name of the f
ield . | | /** Return a field name if the whole expression is just a name of the f
ield . | |
| * Returns full expression string if the expression is more complex th
an just one field. | | * Returns full expression string if the expression is more complex th
an just one field. | |
| * Using just expression->expression() method may return quoted field
name, but that is not | | * Using just expression->expression() method may return quoted field
name, but that is not | |
| * wanted for saving (due to backward compatibility) or display in GUI
. | | * wanted for saving (due to backward compatibility) or display in GUI
. | |
| * @note added in 2.2 | | * @note added in 2.2 | |
| */ | | */ | |
| static QString fieldOrExpressionFromExpression( QgsExpression* expressi
on ); | | static QString fieldOrExpressionFromExpression( QgsExpression* expressi
on ); | |
| }; | | }; | |
| | | | |
| class QPolygonF; | | class QPolygonF; | |
| | | | |
|
| //! calculate line shifted by a specified distance | | //! @deprecated since 2.4 - calculate line shifted by a specified distance | |
| QPolygonF offsetLine( QPolygonF polyline, double dist ); | | QList<QPolygonF> offsetLine( QPolygonF polyline, double dist ); | |
| | | //! calculate geometry shifted by a specified distance | |
| | | QList<QPolygonF> offsetLine( QPolygonF polyline, double dist, QGis::Geometr | |
| | | yType geometryType ); | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 12 change blocks. |
| 12 lines changed or deleted | | 53 lines changed or added | |
|
| qgssymbollayerv2widget.h | | qgssymbollayerv2widget.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
|
| qgssymbollayerv2widget.h - symbol layer widgets | | qgssymbollayerv2widget.h - symbol layer widgets | |
| | | | |
|
| --------------------- | | --------------------- | |
| begin : November 2009 | | begin : November 2009 | |
| copyright : (C) 2009 by Martin Dobias | | copyright : (C) 2009 by Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSSYMBOLLAYERV2WIDGET_H | | #ifndef QGSSYMBOLLAYERV2WIDGET_H | |
| | | | |
| skipping to change at line 73 | | skipping to change at line 73 | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| public slots: | | public slots: | |
| void penWidthChanged(); | | void penWidthChanged(); | |
| void colorChanged( const QColor& color ); | | void colorChanged( const QColor& color ); | |
| void penStyleChanged(); | | void penStyleChanged(); | |
| void offsetChanged(); | | void offsetChanged(); | |
| void on_mCustomCheckBox_stateChanged( int state ); | | void on_mCustomCheckBox_stateChanged( int state ); | |
| void on_mChangePatternButton_clicked(); | | void on_mChangePatternButton_clicked(); | |
|
| void on_mPenWidthUnitComboBox_currentIndexChanged( int index ); | | void on_mPenWidthUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mDashPatternUnitComboBox_currentIndexChanged( int index ); | | void on_mDashPatternUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| void on_mDrawInsideCheckBox_stateChanged( int state ); | | void on_mDrawInsideCheckBox_stateChanged( int state ); | |
| | | | |
| protected: | | protected: | |
| QgsSimpleLineSymbolLayerV2* mLayer; | | QgsSimpleLineSymbolLayerV2* mLayer; | |
| | | | |
| //creates a new icon for the 'change pattern' button | | //creates a new icon for the 'change pattern' button | |
| void updatePatternIcon(); | | void updatePatternIcon(); | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 112 | | skipping to change at line 112 | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| public slots: | | public slots: | |
| void setName(); | | void setName(); | |
| void setColorBorder( const QColor& color ); | | void setColorBorder( const QColor& color ); | |
| void setColorFill( const QColor& color ); | | void setColorFill( const QColor& color ); | |
| void setSize(); | | void setSize(); | |
| void setAngle(); | | void setAngle(); | |
| void setOffset(); | | void setOffset(); | |
|
| void on_mSizeUnitComboBox_currentIndexChanged( int index ); | | void on_mSizeUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mOutlineWidthUnitComboBox_currentIndexChanged( int index ); | | void on_mOutlineWidthUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| void on_mOutlineStyleComboBox_currentIndexChanged( int index ); | | void on_mOutlineStyleComboBox_currentIndexChanged( int index ); | |
| void on_mOutlineWidthSpinBox_valueChanged( double d ); | | void on_mOutlineWidthSpinBox_valueChanged( double d ); | |
| void on_mHorizontalAnchorComboBox_currentIndexChanged( int index ); | | void on_mHorizontalAnchorComboBox_currentIndexChanged( int index ); | |
| void on_mVerticalAnchorComboBox_currentIndexChanged( int index ); | | void on_mVerticalAnchorComboBox_currentIndexChanged( int index ); | |
| | | | |
| protected: | | protected: | |
| QgsSimpleMarkerSymbolLayerV2* mLayer; | | QgsSimpleMarkerSymbolLayerV2* mLayer; | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 151 | | skipping to change at line 151 | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| public slots: | | public slots: | |
| void setColor( const QColor& color ); | | void setColor( const QColor& color ); | |
| void setBorderColor( const QColor& color ); | | void setBorderColor( const QColor& color ); | |
| void setBrushStyle(); | | void setBrushStyle(); | |
| void borderWidthChanged(); | | void borderWidthChanged(); | |
| void borderStyleChanged(); | | void borderStyleChanged(); | |
| void offsetChanged(); | | void offsetChanged(); | |
|
| void on_mBorderWidthUnitComboBox_currentIndexChanged( int index ); | | void on_mBorderWidthUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| | | | |
| protected: | | protected: | |
| QgsSimpleFillSymbolLayerV2* mLayer; | | QgsSimpleFillSymbolLayerV2* mLayer; | |
| }; | | }; | |
| | | | |
| /////////// | | /////////// | |
| | | | |
| #include "ui_widget_gradientfill.h" | | #include "ui_widget_gradientfill.h" | |
| | | | |
| | | | |
| skipping to change at line 187 | | skipping to change at line 187 | |
| | | | |
| public slots: | | public slots: | |
| void setColor( const QColor& color ); | | void setColor( const QColor& color ); | |
| void setColor2( const QColor& color ); | | void setColor2( const QColor& color ); | |
| void applyColorRamp(); | | void applyColorRamp(); | |
| void setGradientType( int index ); | | void setGradientType( int index ); | |
| void setCoordinateMode( int index ); | | void setCoordinateMode( int index ); | |
| void setGradientSpread( int index ); | | void setGradientSpread( int index ); | |
| void offsetChanged(); | | void offsetChanged(); | |
| void referencePointChanged(); | | void referencePointChanged(); | |
|
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| void colorModeChanged(); | | void colorModeChanged(); | |
| void on_mSpinAngle_valueChanged( double value ); | | void on_mSpinAngle_valueChanged( double value ); | |
| | | | |
| protected: | | protected: | |
| QgsGradientFillSymbolLayerV2* mLayer; | | QgsGradientFillSymbolLayerV2* mLayer; | |
| }; | | }; | |
| | | | |
| /////////// | | /////////// | |
| | | | |
|
| | | #include "ui_widget_shapeburstfill.h" | |
| | | | |
| | | class QgsShapeburstFillSymbolLayerV2; | |
| | | | |
| | | class GUI_EXPORT QgsShapeburstFillSymbolLayerV2Widget : public QgsSymbolLay | |
| | | erV2Widget, private Ui::WidgetShapeburstFill | |
| | | { | |
| | | Q_OBJECT | |
| | | | |
| | | public: | |
| | | QgsShapeburstFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget | |
| | | * parent = NULL ); | |
| | | | |
| | | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret | |
| | | urn new QgsShapeburstFillSymbolLayerV2Widget( vl ); } | |
| | | | |
| | | // from base class | |
| | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| | | public slots: | |
| | | void setColor( const QColor& color ); | |
| | | void setColor2( const QColor& color ); | |
| | | void colorModeChanged(); | |
| | | void on_mSpinBlurRadius_valueChanged( int value ); | |
| | | void on_mSpinMaxDistance_valueChanged( double value ); | |
| | | void on_mDistanceUnitWidget_changed( ); | |
| | | void on_mRadioUseWholeShape_toggled( bool value ); | |
| | | void applyColorRamp(); | |
| | | void offsetChanged(); | |
| | | void on_mOffsetUnitWidget_changed( ); | |
| | | void on_mDataDefinedPropertiesButton_clicked(); | |
| | | void on_mIgnoreRingsCheckBox_stateChanged( int state ); | |
| | | | |
| | | protected: | |
| | | QgsShapeburstFillSymbolLayerV2* mLayer; | |
| | | }; | |
| | | | |
| | | /////////// | |
| | | | |
| #include "ui_widget_markerline.h" | | #include "ui_widget_markerline.h" | |
| | | | |
| class QgsMarkerLineSymbolLayerV2; | | class QgsMarkerLineSymbolLayerV2; | |
| | | | |
| class GUI_EXPORT QgsMarkerLineSymbolLayerV2Widget : public QgsSymbolLayerV2
Widget, private Ui::WidgetMarkerLine | | class GUI_EXPORT QgsMarkerLineSymbolLayerV2Widget : public QgsSymbolLayerV2
Widget, private Ui::WidgetMarkerLine | |
| { | | { | |
| Q_OBJECT | | Q_OBJECT | |
| | | | |
| public: | | public: | |
| QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa
rent = NULL ); | | QgsMarkerLineSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget* pa
rent = NULL ); | |
| | | | |
| static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret
urn new QgsMarkerLineSymbolLayerV2Widget( vl ); } | | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret
urn new QgsMarkerLineSymbolLayerV2Widget( vl ); } | |
| | | | |
| // from base class | | // from base class | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| public slots: | | public slots: | |
| | | | |
| void setInterval( double val ); | | void setInterval( double val ); | |
|
| | | void setOffsetAlongLine( double val ); | |
| void setRotate(); | | void setRotate(); | |
| void setOffset(); | | void setOffset(); | |
| void setPlacement(); | | void setPlacement(); | |
|
| void on_mIntervalUnitComboBox_currentIndexChanged( int index ); | | void on_mIntervalUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| | | void on_mOffsetAlongLineUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| | | | |
| protected: | | protected: | |
| | | | |
| QgsMarkerLineSymbolLayerV2* mLayer; | | QgsMarkerLineSymbolLayerV2* mLayer; | |
| }; | | }; | |
| | | | |
| /////////// | | /////////// | |
| | | | |
| #include "ui_widget_svgmarker.h" | | #include "ui_widget_svgmarker.h" | |
| | | | |
| skipping to change at line 261 | | skipping to change at line 300 | |
| void populateIcons( const QModelIndex& idx ); | | void populateIcons( const QModelIndex& idx ); | |
| void setSize(); | | void setSize(); | |
| void setAngle(); | | void setAngle(); | |
| void setOffset(); | | void setOffset(); | |
| void on_mFileToolButton_clicked(); | | void on_mFileToolButton_clicked(); | |
| void on_mFileLineEdit_textEdited( const QString& text ); | | void on_mFileLineEdit_textEdited( const QString& text ); | |
| void on_mFileLineEdit_editingFinished(); | | void on_mFileLineEdit_editingFinished(); | |
| void on_mChangeColorButton_colorChanged( const QColor& color ); | | void on_mChangeColorButton_colorChanged( const QColor& color ); | |
| void on_mChangeBorderColorButton_colorChanged( const QColor& color ); | | void on_mChangeBorderColorButton_colorChanged( const QColor& color ); | |
| void on_mBorderWidthSpinBox_valueChanged( double d ); | | void on_mBorderWidthSpinBox_valueChanged( double d ); | |
|
| void on_mSizeUnitComboBox_currentIndexChanged( int index ); | | void on_mSizeUnitWidget_changed( ); | |
| void on_mBorderWidthUnitComboBox_currentIndexChanged( int index ); | | void on_mBorderWidthUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| void on_mHorizontalAnchorComboBox_currentIndexChanged( int index ); | | void on_mHorizontalAnchorComboBox_currentIndexChanged( int index ); | |
| void on_mVerticalAnchorComboBox_currentIndexChanged( int index ); | | void on_mVerticalAnchorComboBox_currentIndexChanged( int index ); | |
| | | | |
| protected: | | protected: | |
| | | | |
| void populateList(); | | void populateList(); | |
| //update gui for svg file (insert new path, update activation of gui el
ements for svg params) | | //update gui for svg file (insert new path, update activation of gui el
ements for svg params) | |
| void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer ); | | void setGuiForSvg( const QgsSvgMarkerSymbolLayerV2* layer ); | |
| | | | |
| | | | |
| skipping to change at line 299 | | skipping to change at line 338 | |
| | | | |
| static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret
urn new QgsSVGFillSymbolLayerWidget( vl ); } | | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret
urn new QgsSVGFillSymbolLayerWidget( vl ); } | |
| | | | |
| // from base class | | // from base class | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| protected: | | protected: | |
| QgsSVGFillSymbolLayer* mLayer; | | QgsSVGFillSymbolLayer* mLayer; | |
| void insertIcons(); | | void insertIcons(); | |
|
| void updateParamGui(); | | /**Enables or disables svg fill color, border color and border width ba | |
| | | sed on whether the | |
| | | * svg file supports custom parameters. | |
| | | * @param resetValues set to true to overwrite existing layer fill colo | |
| | | r, border color and border width | |
| | | * with default values from svg file | |
| | | */ | |
| | | void updateParamGui( bool resetValues = true ); | |
| | | | |
| private slots: | | private slots: | |
| void on_mBrowseToolButton_clicked(); | | void on_mBrowseToolButton_clicked(); | |
| void on_mTextureWidthSpinBox_valueChanged( double d ); | | void on_mTextureWidthSpinBox_valueChanged( double d ); | |
| void on_mSVGLineEdit_textEdited( const QString & text ); | | void on_mSVGLineEdit_textEdited( const QString & text ); | |
| void on_mSVGLineEdit_editingFinished(); | | void on_mSVGLineEdit_editingFinished(); | |
| void setFile( const QModelIndex& item ); | | void setFile( const QModelIndex& item ); | |
| void populateIcons( const QModelIndex& item ); | | void populateIcons( const QModelIndex& item ); | |
| void on_mRotationSpinBox_valueChanged( double d ); | | void on_mRotationSpinBox_valueChanged( double d ); | |
| void on_mChangeColorButton_colorChanged( const QColor& color ); | | void on_mChangeColorButton_colorChanged( const QColor& color ); | |
| void on_mChangeBorderColorButton_colorChanged( const QColor& color ); | | void on_mChangeBorderColorButton_colorChanged( const QColor& color ); | |
| void on_mBorderWidthSpinBox_valueChanged( double d ); | | void on_mBorderWidthSpinBox_valueChanged( double d ); | |
|
| void on_mTextureWidthUnitComboBox_currentIndexChanged( int index ); | | void on_mTextureWidthUnitWidget_changed( ); | |
| void on_mSvgOutlineWidthUnitComboBox_currentIndexChanged( int index ); | | void on_mSvgOutlineWidthUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| }; | | }; | |
| | | | |
| ////////// | | ////////// | |
| | | | |
| #include "ui_widget_linepatternfill.h" | | #include "ui_widget_linepatternfill.h" | |
| | | | |
| class QgsLinePatternFillSymbolLayer; | | class QgsLinePatternFillSymbolLayer; | |
| | | | |
| class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLaye
rV2Widget, private Ui::WidgetLinePatternFill | | class GUI_EXPORT QgsLinePatternFillSymbolLayerWidget : public QgsSymbolLaye
rV2Widget, private Ui::WidgetLinePatternFill | |
| | | | |
| skipping to change at line 342 | | skipping to change at line 386 | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| protected: | | protected: | |
| QgsLinePatternFillSymbolLayer* mLayer; | | QgsLinePatternFillSymbolLayer* mLayer; | |
| | | | |
| private slots: | | private slots: | |
| void on_mAngleSpinBox_valueChanged( double d ); | | void on_mAngleSpinBox_valueChanged( double d ); | |
| void on_mDistanceSpinBox_valueChanged( double d ); | | void on_mDistanceSpinBox_valueChanged( double d ); | |
| void on_mOffsetSpinBox_valueChanged( double d ); | | void on_mOffsetSpinBox_valueChanged( double d ); | |
|
| void on_mDistanceUnitComboBox_currentIndexChanged( int index ); | | void on_mDistanceUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| }; | | }; | |
| | | | |
| ////////// | | ////////// | |
| | | | |
| #include "ui_widget_pointpatternfill.h" | | #include "ui_widget_pointpatternfill.h" | |
| | | | |
| class QgsPointPatternFillSymbolLayer; | | class QgsPointPatternFillSymbolLayer; | |
| | | | |
| class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLaye
rV2Widget, private Ui::WidgetPointPatternFill | | class GUI_EXPORT QgsPointPatternFillSymbolLayerWidget: public QgsSymbolLaye
rV2Widget, private Ui::WidgetPointPatternFill | |
| | | | |
| skipping to change at line 372 | | skipping to change at line 416 | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| protected: | | protected: | |
| QgsPointPatternFillSymbolLayer* mLayer; | | QgsPointPatternFillSymbolLayer* mLayer; | |
| | | | |
| private slots: | | private slots: | |
| void on_mHorizontalDistanceSpinBox_valueChanged( double d ); | | void on_mHorizontalDistanceSpinBox_valueChanged( double d ); | |
| void on_mVerticalDistanceSpinBox_valueChanged( double d ); | | void on_mVerticalDistanceSpinBox_valueChanged( double d ); | |
| void on_mHorizontalDisplacementSpinBox_valueChanged( double d ); | | void on_mHorizontalDisplacementSpinBox_valueChanged( double d ); | |
| void on_mVerticalDisplacementSpinBox_valueChanged( double d ); | | void on_mVerticalDisplacementSpinBox_valueChanged( double d ); | |
|
| void on_mHorizontalDistanceUnitComboBox_currentIndexChanged( int index | | void on_mHorizontalDistanceUnitWidget_changed( ); | |
| ); | | void on_mVerticalDistanceUnitWidget_changed( ); | |
| void on_mVerticalDistanceUnitComboBox_currentIndexChanged( int index ); | | void on_mHorizontalDisplacementUnitWidget_changed( ); | |
| void on_mHorizontalDisplacementUnitComboBox_currentIndexChanged( int in | | void on_mVerticalDisplacementUnitWidget_changed( ); | |
| dex ); | | | |
| void on_mVerticalDisplacementUnitComboBox_currentIndexChanged( int inde | | | |
| x ); | | | |
| void on_mDataDefinedPropertiesButton_clicked(); | | void on_mDataDefinedPropertiesButton_clicked(); | |
| }; | | }; | |
| | | | |
| ///////// | | ///////// | |
| | | | |
| #include "ui_widget_fontmarker.h" | | #include "ui_widget_fontmarker.h" | |
| | | | |
| class QgsFontMarkerSymbolLayerV2; | | class QgsFontMarkerSymbolLayerV2; | |
| class CharacterWidget; | | class CharacterWidget; | |
| | | | |
| | | | |
| skipping to change at line 406 | | skipping to change at line 450 | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
| public slots: | | public slots: | |
| void setFontFamily( const QFont& font ); | | void setFontFamily( const QFont& font ); | |
| void setColor( const QColor& color ); | | void setColor( const QColor& color ); | |
| void setSize( double size ); | | void setSize( double size ); | |
| void setAngle( double angle ); | | void setAngle( double angle ); | |
| void setCharacter( const QChar& chr ); | | void setCharacter( const QChar& chr ); | |
| void setOffset(); | | void setOffset(); | |
|
| void on_mSizeUnitComboBox_currentIndexChanged( int index ); | | void on_mSizeUnitWidget_changed( ); | |
| void on_mOffsetUnitComboBox_currentIndexChanged( int index ); | | void on_mOffsetUnitWidget_changed( ); | |
| void on_mHorizontalAnchorComboBox_currentIndexChanged( int index ); | | void on_mHorizontalAnchorComboBox_currentIndexChanged( int index ); | |
| void on_mVerticalAnchorComboBox_currentIndexChanged( int index ); | | void on_mVerticalAnchorComboBox_currentIndexChanged( int index ); | |
| | | | |
| protected: | | protected: | |
| QgsFontMarkerSymbolLayerV2* mLayer; | | QgsFontMarkerSymbolLayerV2* mLayer; | |
| CharacterWidget* widgetChar; | | CharacterWidget* widgetChar; | |
| }; | | }; | |
| | | | |
| ////////// | | ////////// | |
| | | | |
| | | | |
| skipping to change at line 435 | | skipping to change at line 479 | |
| | | | |
| public: | | public: | |
| QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget*
parent = NULL ); | | QgsCentroidFillSymbolLayerV2Widget( const QgsVectorLayer* vl, QWidget*
parent = NULL ); | |
| | | | |
| static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret
urn new QgsCentroidFillSymbolLayerV2Widget( vl ); } | | static QgsSymbolLayerV2Widget* create( const QgsVectorLayer* vl ) { ret
urn new QgsCentroidFillSymbolLayerV2Widget( vl ); } | |
| | | | |
| // from base class | | // from base class | |
| virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | | virtual void setSymbolLayer( QgsSymbolLayerV2* layer ); | |
| virtual QgsSymbolLayerV2* symbolLayer(); | | virtual QgsSymbolLayerV2* symbolLayer(); | |
| | | | |
|
| | | public slots: | |
| | | void on_mDrawInsideCheckBox_stateChanged( int state ); | |
| | | | |
| protected: | | protected: | |
| QgsCentroidFillSymbolLayerV2* mLayer; | | QgsCentroidFillSymbolLayerV2* mLayer; | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 33 lines changed or deleted | | 82 lines changed or added | |
|
| qgssymbolv2.h | | qgssymbolv2.h | |
| /**************************************************************************
* | | /**************************************************************************
* | |
|
| qgssymbolv2.h | | qgssymbolv2.h | |
| --------------------- | | --------------------- | |
| begin : November 2009 | | begin : November 2009 | |
| copyright : (C) 2009 by Martin Dobias | | copyright : (C) 2009 by Martin Dobias | |
| email : wonder dot sk at gmail dot com | | email : wonder dot sk at gmail dot com | |
| **************************************************************************
* | | **************************************************************************
* | |
| *
* | | *
* | |
| * This program is free software; you can redistribute it and/or modify
* | | * This program is free software; you can redistribute it and/or modify
* | |
| * it under the terms of the GNU General Public License as published by
* | | * it under the terms of the GNU General Public License as published by
* | |
| * the Free Software Foundation; either version 2 of the License, or
* | | * the Free Software Foundation; either version 2 of the License, or
* | |
| * (at your option) any later version.
* | | * (at your option) any later version.
* | |
| *
* | | *
* | |
| **************************************************************************
*/ | | **************************************************************************
*/ | |
| | | | |
| #ifndef QGSSYMBOLV2_H | | #ifndef QGSSYMBOLV2_H | |
| #define QGSSYMBOLV2_H | | #define QGSSYMBOLV2_H | |
| | | | |
| #include "qgis.h" | | #include "qgis.h" | |
| #include <QList> | | #include <QList> | |
| #include <QMap> | | #include <QMap> | |
|
| | | #include "qgsmapunitscale.h" | |
| | | | |
| class QColor; | | class QColor; | |
| class QImage; | | class QImage; | |
| class QPainter; | | class QPainter; | |
| class QSize; | | class QSize; | |
| class QPointF; | | class QPointF; | |
| class QPolygonF; | | class QPolygonF; | |
| | | | |
| class QDomDocument; | | class QDomDocument; | |
| class QDomElement; | | class QDomElement; | |
| //class | | //class | |
| | | | |
| class QgsFeature; | | class QgsFeature; | |
|
| | | class QgsFields; | |
| class QgsSymbolLayerV2; | | class QgsSymbolLayerV2; | |
| class QgsRenderContext; | | class QgsRenderContext; | |
| class QgsVectorLayer; | | class QgsVectorLayer; | |
| | | | |
| typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List; | | typedef QList<QgsSymbolLayerV2*> QgsSymbolLayerV2List; | |
| | | | |
| class CORE_EXPORT QgsSymbolV2 | | class CORE_EXPORT QgsSymbolV2 | |
| { | | { | |
| public: | | public: | |
| | | | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 102 | |
| | | | |
| //! delete symbol layer at specified index | | //! delete symbol layer at specified index | |
| bool deleteSymbolLayer( int index ); | | bool deleteSymbolLayer( int index ); | |
| | | | |
| //! remove symbol layer from the list and return pointer to it | | //! remove symbol layer from the list and return pointer to it | |
| QgsSymbolLayerV2* takeSymbolLayer( int index ); | | QgsSymbolLayerV2* takeSymbolLayer( int index ); | |
| | | | |
| //! delete layer at specified index and set a new one | | //! delete layer at specified index and set a new one | |
| bool changeSymbolLayer( int index, QgsSymbolLayerV2 *layer ); | | bool changeSymbolLayer( int index, QgsSymbolLayerV2 *layer ); | |
| | | | |
|
| void startRender( QgsRenderContext& context, const QgsVectorLayer* laye
r = 0 ); | | void startRender( QgsRenderContext& context, const QgsFields* fields =
0 ); | |
| void stopRender( QgsRenderContext& context ); | | void stopRender( QgsRenderContext& context ); | |
| | | | |
| void setColor( const QColor& color ); | | void setColor( const QColor& color ); | |
| QColor color() const; | | QColor color() const; | |
| | | | |
| void drawPreviewIcon( QPainter* painter, QSize size ); | | void drawPreviewIcon( QPainter* painter, QSize size ); | |
| | | | |
| QImage bigSymbolPreviewImage(); | | QImage bigSymbolPreviewImage(); | |
| | | | |
| QString dump() const; | | QString dump() const; | |
| | | | |
| virtual QgsSymbolV2* clone() const = 0; | | virtual QgsSymbolV2* clone() const = 0; | |
| | | | |
| void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props
) const; | | void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props
) const; | |
| | | | |
| QgsSymbolV2::OutputUnit outputUnit() const; | | QgsSymbolV2::OutputUnit outputUnit() const; | |
| void setOutputUnit( QgsSymbolV2::OutputUnit u ); | | void setOutputUnit( QgsSymbolV2::OutputUnit u ); | |
| | | | |
|
| | | QgsMapUnitScale mapUnitScale() const; | |
| | | void setMapUnitScale( const QgsMapUnitScale& scale ); | |
| | | | |
| //! Get alpha transparency 1 for opaque, 0 for invisible | | //! Get alpha transparency 1 for opaque, 0 for invisible | |
| qreal alpha() const { return mAlpha; } | | qreal alpha() const { return mAlpha; } | |
| //! Set alpha transparency 1 for opaque, 0 for invisible | | //! Set alpha transparency 1 for opaque, 0 for invisible | |
| void setAlpha( qreal alpha ) { mAlpha = alpha; } | | void setAlpha( qreal alpha ) { mAlpha = alpha; } | |
| | | | |
| //! @note added in 1.5 | | //! @note added in 1.5 | |
| void setRenderHints( int hints ) { mRenderHints = hints; } | | void setRenderHints( int hints ) { mRenderHints = hints; } | |
| //! @note added in 1.5 | | //! @note added in 1.5 | |
| int renderHints() const { return mRenderHints; } | | int renderHints() const { return mRenderHints; } | |
| | | | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 165 | |
| int mRenderHints; | | int mRenderHints; | |
| | | | |
| const QgsVectorLayer* mLayer; //current vectorlayer | | const QgsVectorLayer* mLayer; //current vectorlayer | |
| }; | | }; | |
| | | | |
| /////////////////////// | | /////////////////////// | |
| | | | |
| class CORE_EXPORT QgsSymbolV2RenderContext | | class CORE_EXPORT QgsSymbolV2RenderContext | |
| { | | { | |
| public: | | public: | |
|
| QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit
u , qreal alpha = 1.0, bool selected = false, int renderHints = 0, const Qg
sFeature* f = 0 ); | | QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit
u , qreal alpha = 1.0, bool selected = false, int renderHints = 0, const Qg
sFeature* f = 0, const QgsFields* = 0, const QgsMapUnitScale& mapUnitScale
= QgsMapUnitScale() ); | |
| ~QgsSymbolV2RenderContext(); | | ~QgsSymbolV2RenderContext(); | |
| | | | |
| QgsRenderContext& renderContext() { return mRenderContext; } | | QgsRenderContext& renderContext() { return mRenderContext; } | |
| const QgsRenderContext& renderContext() const { return mRenderContext;
} | | const QgsRenderContext& renderContext() const { return mRenderContext;
} | |
| //void setRenderContext( QgsRenderContext& c ) { mRenderContext = c;} | | //void setRenderContext( QgsRenderContext& c ) { mRenderContext = c;} | |
| | | | |
| QgsSymbolV2::OutputUnit outputUnit() const { return mOutputUnit; } | | QgsSymbolV2::OutputUnit outputUnit() const { return mOutputUnit; } | |
| void setOutputUnit( QgsSymbolV2::OutputUnit u ) { mOutputUnit = u; } | | void setOutputUnit( QgsSymbolV2::OutputUnit u ) { mOutputUnit = u; } | |
| | | | |
|
| | | QgsMapUnitScale mapUnitScale() const { return mMapUnitScale; } | |
| | | void setMapUnitScale( const QgsMapUnitScale& scale ) { mMapUnitScale = | |
| | | scale; } | |
| | | | |
| //! Get alpha transparency 1 for opaque, 0 for invisible | | //! Get alpha transparency 1 for opaque, 0 for invisible | |
| qreal alpha() const { return mAlpha; } | | qreal alpha() const { return mAlpha; } | |
| //! Set alpha transparency 1 for opaque, 0 for invisible | | //! Set alpha transparency 1 for opaque, 0 for invisible | |
| void setAlpha( qreal alpha ) { mAlpha = alpha; } | | void setAlpha( qreal alpha ) { mAlpha = alpha; } | |
| | | | |
| bool selected() const { return mSelected; } | | bool selected() const { return mSelected; } | |
| void setSelected( bool selected ) { mSelected = selected; } | | void setSelected( bool selected ) { mSelected = selected; } | |
| | | | |
| //! @note added in 1.5 | | //! @note added in 1.5 | |
| int renderHints() const { return mRenderHints; } | | int renderHints() const { return mRenderHints; } | |
| //! @note added in 1.5 | | //! @note added in 1.5 | |
| void setRenderHints( int hints ) { mRenderHints = hints; } | | void setRenderHints( int hints ) { mRenderHints = hints; } | |
| | | | |
| void setFeature( const QgsFeature* f ) { mFeature = f; } | | void setFeature( const QgsFeature* f ) { mFeature = f; } | |
|
| | | //! Current feature being rendered - may be null | |
| const QgsFeature* feature() const { return mFeature; } | | const QgsFeature* feature() const { return mFeature; } | |
| | | | |
|
| void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; } | | //! Fields of the layer. Currently only available in startRender() call | |
| const QgsVectorLayer* layer() const { return mLayer; } | | s | |
| | | //! to allow symbols with data-defined properties prepare the expressio | |
| | | ns | |
| | | //! (other times fields() returns null) | |
| | | //! @note added in 2.4 | |
| | | const QgsFields* fields() const { return mFields; } | |
| | | | |
| double outputLineWidth( double width ) const; | | double outputLineWidth( double width ) const; | |
| double outputPixelSize( double size ) const; | | double outputPixelSize( double size ) const; | |
| | | | |
| // workaround for sip 4.7. Don't use assignment - will fail with assert
ion error | | // workaround for sip 4.7. Don't use assignment - will fail with assert
ion error | |
| QgsSymbolV2RenderContext& operator=( const QgsSymbolV2RenderContext& ); | | QgsSymbolV2RenderContext& operator=( const QgsSymbolV2RenderContext& ); | |
| | | | |
| private: | | private: | |
| QgsRenderContext& mRenderContext; | | QgsRenderContext& mRenderContext; | |
| QgsSymbolV2::OutputUnit mOutputUnit; | | QgsSymbolV2::OutputUnit mOutputUnit; | |
|
| | | QgsMapUnitScale mMapUnitScale; | |
| qreal mAlpha; | | qreal mAlpha; | |
| bool mSelected; | | bool mSelected; | |
| int mRenderHints; | | int mRenderHints; | |
| const QgsFeature* mFeature; //current feature | | const QgsFeature* mFeature; //current feature | |
|
| const QgsVectorLayer* mLayer; //current vectorlayer | | const QgsFields* mFields; | |
| }; | | }; | |
| | | | |
| ////////////////////// | | ////////////////////// | |
| | | | |
| class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2 | | class CORE_EXPORT QgsMarkerSymbolV2 : public QgsSymbolV2 | |
| { | | { | |
| public: | | public: | |
| /** Create a marker symbol with one symbol layer: SimpleMarker with spe
cified properties. | | /** Create a marker symbol with one symbol layer: SimpleMarker with spe
cified properties. | |
| This is a convenience method for easier creation of marker symbols. | | This is a convenience method for easier creation of marker symbols. | |
| \note added in v1.7 | | \note added in v1.7 | |
| | | | |
End of changes. 11 change blocks. |
| 10 lines changed or deleted | | 26 lines changed or added | |
|
| qgsvectorlayer.h | | qgsvectorlayer.h | |
| | | | |
| skipping to change at line 100 | | skipping to change at line 100 | |
| protected: | | protected: | |
| AttributeEditorType mType; | | AttributeEditorType mType; | |
| QString mName; | | QString mName; | |
| }; | | }; | |
| | | | |
| /** @note Added in 1.9 */ | | /** @note Added in 1.9 */ | |
| class CORE_EXPORT QgsAttributeEditorContainer : public QgsAttributeEditorEl
ement | | class CORE_EXPORT QgsAttributeEditorContainer : public QgsAttributeEditorEl
ement | |
| { | | { | |
| public: | | public: | |
| QgsAttributeEditorContainer( QString name, QObject *parent ) | | QgsAttributeEditorContainer( QString name, QObject *parent ) | |
|
| : QgsAttributeEditorElement( AeTypeContainer, name, parent ) {} | | : QgsAttributeEditorElement( AeTypeContainer, name, parent ) | |
| | | , mIsGroupBox( true ) | |
| | | {} | |
| | | | |
| ~QgsAttributeEditorContainer() {} | | ~QgsAttributeEditorContainer() {} | |
| | | | |
| virtual QDomElement toDomElement( QDomDocument& doc ) const; | | virtual QDomElement toDomElement( QDomDocument& doc ) const; | |
| virtual void addChildElement( QgsAttributeEditorElement *widget ); | | virtual void addChildElement( QgsAttributeEditorElement *widget ); | |
|
| virtual bool isGroupBox() const { return true; } | | virtual void setIsGroupBox( bool isGroupBox ) { mIsGroupBox = isGroupBo | |
| | | x; } | |
| | | virtual bool isGroupBox() const { return mIsGroupBox; } | |
| QList<QgsAttributeEditorElement*> children() const { return mChildren;
} | | QList<QgsAttributeEditorElement*> children() const { return mChildren;
} | |
| virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditor
Type type ) const; | | virtual QList<QgsAttributeEditorElement*> findElements( AttributeEditor
Type type ) const; | |
| | | | |
| private: | | private: | |
|
| | | bool mIsGroupBox; | |
| QList<QgsAttributeEditorElement*> mChildren; | | QList<QgsAttributeEditorElement*> mChildren; | |
| }; | | }; | |
| | | | |
| /** @note Added in 1.9 */ | | /** @note Added in 1.9 */ | |
| class CORE_EXPORT QgsAttributeEditorField : public QgsAttributeEditorElemen
t | | class CORE_EXPORT QgsAttributeEditorField : public QgsAttributeEditorElemen
t | |
| { | | { | |
| public: | | public: | |
| QgsAttributeEditorField( QString name , int idx, QObject *parent ) | | QgsAttributeEditorField( QString name , int idx, QObject *parent ) | |
| : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx
) {} | | : QgsAttributeEditorElement( AeTypeField, name, parent ), mIdx( idx
) {} | |
| | | | |
| | | | |
| skipping to change at line 463 | | skipping to change at line 467 | |
| | | | |
| public: | | public: | |
| /** The different types to layout the attribute editor. @note added in
1.9 */ | | /** The different types to layout the attribute editor. @note added in
1.9 */ | |
| enum EditorLayout | | enum EditorLayout | |
| { | | { | |
| GeneratedLayout = 0, | | GeneratedLayout = 0, | |
| TabLayout = 1, | | TabLayout = 1, | |
| UiFileLayout = 2 | | UiFileLayout = 2 | |
| }; | | }; | |
| | | | |
|
| | | /** | |
| | | * @deprecated Use the editorWidgetV2() system instead | |
| | | */ | |
| enum EditType | | enum EditType | |
| { | | { | |
| LineEdit, | | LineEdit, | |
| UniqueValues, | | UniqueValues, | |
| UniqueValuesEditable, | | UniqueValuesEditable, | |
| ValueMap, | | ValueMap, | |
| Classification, | | Classification, | |
| EditRange, | | EditRange, | |
| SliderRange, | | SliderRange, | |
| CheckBox, /**< @note added in 1.4 */ | | CheckBox, /**< @note added in 1.4 */ | |
| | | | |
| skipping to change at line 499 | | skipping to change at line 506 | |
| * @note added in 2.1 */ | | * @note added in 2.1 */ | |
| enum FeatureFormSuppress | | enum FeatureFormSuppress | |
| { | | { | |
| SuppressDefault = 0, // use the application-wide setting | | SuppressDefault = 0, // use the application-wide setting | |
| SuppressOn = 1, | | SuppressOn = 1, | |
| SuppressOff = 2 | | SuppressOff = 2 | |
| }; | | }; | |
| | | | |
| struct RangeData | | struct RangeData | |
| { | | { | |
|
| RangeData() {} | | RangeData() { mMin = QVariant( 0 ); mMax = QVariant( 5 ); mStep = QVa
riant( 1 );} | |
| RangeData( QVariant theMin, QVariant theMax, QVariant theStep ) | | RangeData( QVariant theMin, QVariant theMax, QVariant theStep ) | |
| : mMin( theMin ), mMax( theMax ), mStep( theStep ) {} | | : mMin( theMin ), mMax( theMax ), mStep( theStep ) {} | |
| | | | |
| QVariant mMin; | | QVariant mMin; | |
| QVariant mMax; | | QVariant mMax; | |
| QVariant mStep; | | QVariant mStep; | |
| }; | | }; | |
| | | | |
| struct ValueRelationData | | struct ValueRelationData | |
| { | | { | |
| | | | |
| skipping to change at line 729 | | skipping to change at line 736 | |
| const QgsDiagramLayerSettings *diagramLayerSettings() const { return mD
iagramLayerSettings; } | | const QgsDiagramLayerSettings *diagramLayerSettings() const { return mD
iagramLayerSettings; } | |
| | | | |
| /** Return renderer V2. | | /** Return renderer V2. | |
| * @note added in 1.4 */ | | * @note added in 1.4 */ | |
| QgsFeatureRendererV2* rendererV2(); | | QgsFeatureRendererV2* rendererV2(); | |
| /** Set renderer V2. | | /** Set renderer V2. | |
| * @note added in 1.4 | | * @note added in 1.4 | |
| */ | | */ | |
| void setRendererV2( QgsFeatureRendererV2* r ); | | void setRendererV2( QgsFeatureRendererV2* r ); | |
| | | | |
|
| /** Draw layer with renderer V2. QgsFeatureRenderer::startRender() need | | | |
| s to be called before using this method | | | |
| * @note added in 1.4 | | | |
| */ | | | |
| void drawRendererV2( QgsFeatureIterator &fit, QgsRenderContext& rendere | | | |
| rContext, bool labeling ); | | | |
| | | | |
| /** Draw layer with renderer V2 using symbol levels. QgsFeatureRenderer | | | |
| ::startRender() needs to be called before using this method | | | |
| * @note added in 1.4 | | | |
| */ | | | |
| void drawRendererV2Levels( QgsFeatureIterator &fit, QgsRenderContext& r | | | |
| endererContext, bool labeling ); | | | |
| | | | |
| /** Returns point, line or polygon */ | | /** Returns point, line or polygon */ | |
| QGis::GeometryType geometryType() const; | | QGis::GeometryType geometryType() const; | |
| | | | |
| /** Returns true if this is a geometry layer and false in case of NoGeo
metry (table only) or UnknownGeometry | | /** Returns true if this is a geometry layer and false in case of NoGeo
metry (table only) or UnknownGeometry | |
| * @note added in 1.7 | | * @note added in 1.7 | |
| */ | | */ | |
| bool hasGeometryType() const; | | bool hasGeometryType() const; | |
| | | | |
| /**Returns the WKBType or WKBUnknown in case of error*/ | | /**Returns the WKBType or WKBUnknown in case of error*/ | |
| QGis::WkbType wkbType() const; | | QGis::WkbType wkbType() const; | |
| | | | |
| skipping to change at line 1034 | | skipping to change at line 1031 | |
| */ | | */ | |
| int snapWithContext( const QgsPoint& startPoint, | | int snapWithContext( const QgsPoint& startPoint, | |
| double snappingTolerance, | | double snappingTolerance, | |
| QMultiMap < double, QgsSnappingResult > &snappingR
esults, | | QMultiMap < double, QgsSnappingResult > &snappingR
esults, | |
| QgsSnapper::SnappingType snap_to ); | | QgsSnapper::SnappingType snap_to ); | |
| | | | |
| /**Synchronises with changes in the datasource | | /**Synchronises with changes in the datasource | |
| @note added in version 1.6*/ | | @note added in version 1.6*/ | |
| virtual void reload(); | | virtual void reload(); | |
| | | | |
|
| | | /** Return new instance of QgsMapLayerRenderer that will be used for re | |
| | | ndering of given context | |
| | | * @note added in 2.4 | |
| | | */ | |
| | | virtual QgsMapLayerRenderer* createMapRenderer( QgsRenderContext& rende | |
| | | rerContext ); | |
| | | | |
| /** Draws the layer | | /** Draws the layer | |
| * @return false if an error occurred during drawing | | * @return false if an error occurred during drawing | |
| */ | | */ | |
| bool draw( QgsRenderContext& rendererContext ); | | bool draw( QgsRenderContext& rendererContext ); | |
| | | | |
| /** Draws the layer labels using coordinate transformation */ | | /** Draws the layer labels using coordinate transformation */ | |
| void drawLabels( QgsRenderContext& rendererContext ); | | void drawLabels( QgsRenderContext& rendererContext ); | |
| | | | |
| /** Return the extent of the layer as a QRect */ | | /** Return the extent of the layer as a QRect */ | |
| QgsRectangle extent(); | | QgsRectangle extent(); | |
| | | | |
| skipping to change at line 1116 | | skipping to change at line 1118 | |
| */ | | */ | |
| void addAttributeEditorWidget( QgsAttributeEditorElement* data ); | | void addAttributeEditorWidget( QgsAttributeEditorElement* data ); | |
| | | | |
| /** | | /** | |
| * Get the id for the editor widget used to represent the field at the
given index | | * Get the id for the editor widget used to represent the field at the
given index | |
| * | | * | |
| * @param fieldIdx The index of the field | | * @param fieldIdx The index of the field | |
| * | | * | |
| * @return The id for the editor widget or a NULL string if not applica
ble | | * @return The id for the editor widget or a NULL string if not applica
ble | |
| */ | | */ | |
|
| const QString editorWidgetV2( int fieldIdx ); | | const QString editorWidgetV2( int fieldIdx ) const; | |
| | | | |
| | | /** | |
| | | * Get the id for the editor widget used to represent the field at the | |
| | | given index | |
| | | * | |
| | | * @param fieldName The name of the field | |
| | | * | |
| | | * @return The id for the editor widget or a NULL string if not applica | |
| | | ble | |
| | | * | |
| | | * @note python method name editorWidgetV2ByName | |
| | | */ | |
| | | const QString editorWidgetV2( const QString& fieldName ) const; | |
| | | | |
| /** | | /** | |
| * Get the configuration for the editor widget used to represent the fi
eld at the given index | | * Get the configuration for the editor widget used to represent the fi
eld at the given index | |
| * | | * | |
| * @param fieldIdx The index of the field | | * @param fieldIdx The index of the field | |
| * | | * | |
|
| * @return The id for the editor widget or a NULL string if not configu
red | | * @return The configuration for the editor widget or an empty config i
f the field does not exist | |
| */ | | */ | |
|
| const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ); | | const QgsEditorWidgetConfig editorWidgetV2Config( int fieldIdx ) const; | |
| | | | |
| | | /** | |
| | | * Get the configuration for the editor widget used to represent the fi | |
| | | eld at the given index | |
| | | * | |
| | | * @param fieldName The name of the field | |
| | | * | |
| | | * @return The configuration for the editor widget or an empty config i | |
| | | f the field does not exist | |
| | | * | |
| | | * @note python method name is editorWidgetV2ConfigByName | |
| | | */ | |
| | | const QgsEditorWidgetConfig editorWidgetV2Config( const QString& fieldN | |
| | | ame ) const; | |
| | | | |
| /** | | /** | |
| * Returns a list of tabs holding groups and fields | | * Returns a list of tabs holding groups and fields | |
| * @note added in version 2.0 | | * @note added in version 2.0 | |
| */ | | */ | |
| QList< QgsAttributeEditorElement* > &attributeEditorElements(); | | QList< QgsAttributeEditorElement* > &attributeEditorElements(); | |
| /** | | /** | |
| * Clears all the tabs for the attribute editor form | | * Clears all the tabs for the attribute editor form | |
| * @note added in version 2.0 | | * @note added in version 2.0 | |
| */ | | */ | |
| | | | |
| skipping to change at line 1199 | | skipping to change at line 1223 | |
| that the user has some chance of repairing the damage cleanly. | | that the user has some chance of repairing the damage cleanly. | |
| */ | | */ | |
| bool commitChanges(); | | bool commitChanges(); | |
| const QStringList &commitErrors(); | | const QStringList &commitErrors(); | |
| | | | |
| /** Stop editing and discard the edits | | /** Stop editing and discard the edits | |
| * @param deleteBuffer whether to delete editing buffer (added in 1.9) | | * @param deleteBuffer whether to delete editing buffer (added in 1.9) | |
| */ | | */ | |
| bool rollBack( bool deleteBuffer = true ); | | bool rollBack( bool deleteBuffer = true ); | |
| | | | |
|
| /**get edit type*/ | | /** | |
| EditType editType( int idx ); | | * Get edit type | |
| | | * | |
| | | * @deprecated Use @see{editorWidgetV2} instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED EditType editType( int idx ); | |
| | | | |
|
| /**set edit type*/ | | /** | |
| void setEditType( int idx, EditType edit ); | | * Get edit type | |
| | | * | |
| | | * @deprecated Use @see{setEditorWidgetV2} instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED void setEditType( int idx, EditType edit ); | |
| | | | |
| /** get the active layout for the attribute editor for this layer (adde
d in 1.9) */ | | /** get the active layout for the attribute editor for this layer (adde
d in 1.9) */ | |
| EditorLayout editorLayout(); | | EditorLayout editorLayout(); | |
| | | | |
| /** set the active layout for the attribute editor for this layer (adde
d in 1.9) */ | | /** set the active layout for the attribute editor for this layer (adde
d in 1.9) */ | |
| void setEditorLayout( EditorLayout editorLayout ); | | void setEditorLayout( EditorLayout editorLayout ); | |
| | | | |
|
| | | /** | |
| | | * Set the editor widget type for a field | |
| | | * | |
| | | * @param attrIdx Index of the field | |
| | | * @param widgetType Type id of the editor widget to use | |
| | | */ | |
| void setEditorWidgetV2( int attrIdx, const QString& widgetType ); | | void setEditorWidgetV2( int attrIdx, const QString& widgetType ); | |
| | | | |
|
| void setEditorWidgetV2Config( int attrIdx, const QMap<QString, QVariant | | /** | |
| >& config ); | | * Set the editor widget config for a field | |
| | | * | |
| /** set string representing 'true' for a checkbox (added in 1.4) */ | | * @param attrIdx Index of the field | |
| void setCheckedState( int idx, QString checked, QString notChecked ); | | * @param config The config to set for this field | |
| | | */ | |
| | | void setEditorWidgetV2Config( int attrIdx, const QgsEditorWidgetConfig& | |
| | | config ); | |
| | | | |
|
| /** return string representing 'true' for a checkbox (added in 1.4) | | /** | |
| * @note not available in python bindings | | * Set string representing 'true' for a checkbox (added in 1.4) | |
| * FIXME: need SIP binding for QPair<QString, QString> | | * | |
| | | * @deprecated Use @see{setEditorWidgetV2Config} instead | |
| */ | | */ | |
|
| QPair<QString, QString> checkedState( int idx ); | | Q_DECL_DEPRECATED void setCheckedState( int idx, QString checked, QStri
ng notChecked ); | |
| | | | |
| /** get edit form (added in 1.4) */ | | /** get edit form (added in 1.4) */ | |
| QString editForm(); | | QString editForm(); | |
| | | | |
| /** set edit form (added in 1.4) */ | | /** set edit form (added in 1.4) */ | |
| void setEditForm( QString ui ); | | void setEditForm( QString ui ); | |
| | | | |
| /** Type of feature form pop-up suppression after feature creation (ove
rrides app setting) | | /** Type of feature form pop-up suppression after feature creation (ove
rrides app setting) | |
| * @note added in 2.1 */ | | * @note added in 2.1 */ | |
| QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { retur
n mFeatureFormSuppress; } | | QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const { retur
n mFeatureFormSuppress; } | |
| | | | |
| skipping to change at line 1250 | | skipping to change at line 1292 | |
| | | | |
| /** set annotation form for layer (added in 1.5)*/ | | /** set annotation form for layer (added in 1.5)*/ | |
| void setAnnotationForm( const QString& ui ); | | void setAnnotationForm( const QString& ui ); | |
| | | | |
| /** get python function for edit form initialization (added in 1.4) */ | | /** get python function for edit form initialization (added in 1.4) */ | |
| QString editFormInit(); | | QString editFormInit(); | |
| | | | |
| /** set python function for edit form initialization (added in 1.4) */ | | /** set python function for edit form initialization (added in 1.4) */ | |
| void setEditFormInit( QString function ); | | void setEditFormInit( QString function ); | |
| | | | |
|
| /**access value map*/ | | /** | |
| QMap<QString, QVariant> &valueMap( int idx ); | | * Access value map | |
| | | * @deprecated Use @see{editorWidgetV2Config} instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED QMap<QString, QVariant> valueMap( int idx ); | |
| | | | |
|
| /**access range */ | | /** | |
| RangeData &range( int idx ); | | * Access range widget config data | |
| | | * | |
| | | * @deprecated Use @see{editorWidgetV2Config} instead | |
| | | */ | |
| | | Q_DECL_DEPRECATED RangeData range( int idx ); | |
| | | | |
|
| /**access relations | | /** | |
| | | * Access value relation widget data | |
| | | * | |
| * @note added in 1.8 | | * @note added in 1.8 | |
|
| **/ | | */ | |
| ValueRelationData &valueRelation( int idx ); | | ValueRelationData valueRelation( int idx ); | |
| | | | |
| /** | | /** | |
| * Get relations, where the foreign key is on this layer | | * Get relations, where the foreign key is on this layer | |
| * | | * | |
| * @param idx Only get relations, where idx forms part of the foreign k
ey | | * @param idx Only get relations, where idx forms part of the foreign k
ey | |
| * @return A list of relations | | * @return A list of relations | |
| */ | | */ | |
| QList<QgsRelation> referencingRelations( int idx ); | | QList<QgsRelation> referencingRelations( int idx ); | |
| | | | |
|
| /**access date format | | /** | |
| | | * Access date format | |
| | | * | |
| * @note added in 1.9 | | * @note added in 1.9 | |
|
| | | * | |
| | | * @deprecated Use @see{setEditorWdigetV2Config} instead | |
| */ | | */ | |
|
| QString &dateFormat( int idx ); | | Q_DECL_DEPRECATED QString dateFormat( int idx ); | |
| | | | |
|
| /**access widget size for photo and webview widget | | /** | |
| | | * Access widget size for photo and webview widget | |
| | | * | |
| * @note added in 1.9 | | * @note added in 1.9 | |
|
| | | * | |
| | | * @deprecated Use @see{setEditorWdigetV2Config} instead | |
| */ | | */ | |
|
| QSize &widgetSize( int idx ); | | Q_DECL_DEPRECATED QSize widgetSize( int idx ); | |
| | | | |
| /**is edit widget editable | | /**is edit widget editable | |
| * @note added in 1.9 | | * @note added in 1.9 | |
| **/ | | **/ | |
| bool fieldEditable( int idx ); | | bool fieldEditable( int idx ); | |
| | | | |
| /**label widget on top | | /**label widget on top | |
| * @note added in 1.9 | | * @note added in 1.9 | |
| **/ | | **/ | |
| bool labelOnTop( int idx ); | | bool labelOnTop( int idx ); | |
| | | | |
| skipping to change at line 1448 | | skipping to change at line 1507 | |
| | | | |
| /** Update the extents for the layer. This is necessary if features are | | /** Update the extents for the layer. This is necessary if features are | |
| * added/deleted or the layer has been subsetted. | | * added/deleted or the layer has been subsetted. | |
| */ | | */ | |
| virtual void updateExtents(); | | virtual void updateExtents(); | |
| | | | |
| /** Check if there is a join with a layer that will be removed | | /** Check if there is a join with a layer that will be removed | |
| @note added in 1.7 */ | | @note added in 1.7 */ | |
| void checkJoinLayerRemove( QString theLayerId ); | | void checkJoinLayerRemove( QString theLayerId ); | |
| | | | |
|
| /** | | | |
| * @brief Is called when the cache image is being deleted. Overwrite an | | | |
| d use to clean up. | | | |
| * @note added in 2.0 | | | |
| */ | | | |
| virtual void onCacheImageDelete(); | | | |
| | | | |
| protected slots: | | protected slots: | |
| void invalidateSymbolCountedFlag(); | | void invalidateSymbolCountedFlag(); | |
| | | | |
| signals: | | signals: | |
| | | | |
| /** | | /** | |
| * This signal is emitted when selection was changed | | * This signal is emitted when selection was changed | |
| * | | * | |
| * @param selected Newly selected feature ids | | * @param selected Newly selected feature ids | |
| * @param deselected Ids of all features which have previously bee
n selected but are not any more | | * @param deselected Ids of all features which have previously bee
n selected but are not any more | |
| * @param clearAndSelect In case this is set to true, the old selectio
n was dismissed and the new selection corresponds to selected | | * @param clearAndSelect In case this is set to true, the old selectio
n was dismissed and the new selection corresponds to selected | |
| */ | | */ | |
| void selectionChanged( const QgsFeatureIds selected, const QgsFeatureId
s deselected, const bool clearAndSelect ); | | void selectionChanged( const QgsFeatureIds selected, const QgsFeatureId
s deselected, const bool clearAndSelect ); | |
| | | | |
| /** This signal is emitted when selection was changed */ | | /** This signal is emitted when selection was changed */ | |
| void selectionChanged(); | | void selectionChanged(); | |
| | | | |
| /** This signal is emitted when modifications has been done on layer */ | | /** This signal is emitted when modifications has been done on layer */ | |
| void layerModified(); | | void layerModified(); | |
| | | | |
|
| | | /** Is emitted, when layer is checked for modifications. Use for last-m | |
| | | inute additions */ | |
| | | void beforeModifiedCheck() const; | |
| | | | |
| /** Is emitted, when editing on this layer has started*/ | | /** Is emitted, when editing on this layer has started*/ | |
| void editingStarted(); | | void editingStarted(); | |
| | | | |
| /** Is emitted, when edited changes successfully have been written to t
he data provider */ | | /** Is emitted, when edited changes successfully have been written to t
he data provider */ | |
| void editingStopped(); | | void editingStopped(); | |
| | | | |
| /** Is emitted, before changes are commited to the data provider */ | | /** Is emitted, before changes are commited to the data provider */ | |
| void beforeCommitChanges(); | | void beforeCommitChanges(); | |
| | | | |
| /** Is emitted, before changes are rolled back*/ | | /** Is emitted, before changes are rolled back*/ | |
| | | | |
| skipping to change at line 1534 | | skipping to change at line 1590 | |
| void committedAttributeValuesChanges( const QString& layerId, const Qgs
ChangedAttributesMap& changedAttributesValues ); | | void committedAttributeValuesChanges( const QString& layerId, const Qgs
ChangedAttributesMap& changedAttributesValues ); | |
| void committedGeometriesChanges( const QString& layerId, const QgsGeome
tryMap& changedGeometries ); | | void committedGeometriesChanges( const QString& layerId, const QgsGeome
tryMap& changedGeometries ); | |
| | | | |
| void saveLayerToProject(); | | void saveLayerToProject(); | |
| | | | |
| /** Emitted when the font family defined for labeling layer is not foun
d on system | | /** Emitted when the font family defined for labeling layer is not foun
d on system | |
| * @note added in 1.9 | | * @note added in 1.9 | |
| */ | | */ | |
| void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfa
mily ); | | void labelingFontNotFound( QgsVectorLayer* layer, const QString& fontfa
mily ); | |
| | | | |
|
| /** Signal emitted on symbology changes, when setRendererV2() is called | | | |
| */ | | | |
| void rendererChanged(); | | | |
| | | | |
| /** Signal emitted when setFeatureBlendMode() is called */ | | /** Signal emitted when setFeatureBlendMode() is called */ | |
| void featureBlendModeChanged( const QPainter::CompositionMode &blendMod
e ); | | void featureBlendModeChanged( const QPainter::CompositionMode &blendMod
e ); | |
| | | | |
| /** Signal emitted when setLayerTransparency() is called */ | | /** Signal emitted when setLayerTransparency() is called */ | |
| void layerTransparencyChanged( int layerTransparency ); | | void layerTransparencyChanged( int layerTransparency ); | |
| | | | |
| /** | | /** | |
| * Signal emitted when a new edit command has been started | | * Signal emitted when a new edit command has been started | |
| * | | * | |
| * @param text Description for this edit command | | * @param text Description for this edit command | |
| | | | |
| skipping to change at line 1603 | | skipping to change at line 1656 | |
| @param snappingResults list to which the result is appended | | @param snappingResults list to which the result is appended | |
| @param snap_to snap to vertex or to segment | | @param snap_to snap to vertex or to segment | |
| */ | | */ | |
| void snapToGeometry( const QgsPoint& startPoint, | | void snapToGeometry( const QgsPoint& startPoint, | |
| QgsFeatureId featureId, | | QgsFeatureId featureId, | |
| QgsGeometry* geom, | | QgsGeometry* geom, | |
| double sqrSnappingTolerance, | | double sqrSnappingTolerance, | |
| QMultiMap<double, QgsSnappingResult>& snappingResu
lts, | | QMultiMap<double, QgsSnappingResult>& snappingResu
lts, | |
| QgsSnapper::SnappingType snap_to ) const; | | QgsSnapper::SnappingType snap_to ) const; | |
| | | | |
|
| /**Reads vertex marker type from settings*/ | | | |
| static QgsVectorLayer::VertexMarkerType currentVertexMarkerType(); | | | |
| | | | |
| /**Reads vertex marker size from settings*/ | | | |
| static int currentVertexMarkerSize(); | | | |
| | | | |
| /** Add joined attributes to a feature */ | | /** Add joined attributes to a feature */ | |
| //void addJoinedAttributes( QgsFeature& f, bool all = false ); | | //void addJoinedAttributes( QgsFeature& f, bool all = false ); | |
| | | | |
|
| /** Stop version 2 renderer and selected renderer (if required) */ | | | |
| void stopRendererV2( QgsRenderContext& rendererContext, QgsSingleSymbol | | | |
| RendererV2* selRenderer ); | | | |
| | | | |
| /**Registers label and diagram layer | | | |
| @param rendererContext render context | | | |
| @param attributes attributes needed for labeling and diagrams will be | | | |
| added to the list | | | |
| @param labeling out: true if there will be labeling (ng) for this lay | | | |
| er*/ | | | |
| void prepareLabelingAndDiagrams( QgsRenderContext& rendererContext, Qgs | | | |
| AttributeList& attributes, bool& labeling ); | | | |
| | | | |
| /** Read labeling from SLD */ | | /** Read labeling from SLD */ | |
| void readSldLabeling( const QDomNode& node ); | | void readSldLabeling( const QDomNode& node ); | |
| | | | |
| private: // Private attributes | | private: // Private attributes | |
| | | | |
|
| /** Update threshold for drawing features as they are read. A value of | | | |
| zero indicates | | | |
| * that no features will be drawn until all have been read | | | |
| */ | | | |
| int mUpdateThreshold; | | | |
| | | | |
| /** Enables backbuffering for the map window. This improves graphics pe | | | |
| rformance, | | | |
| * but the possibility to cancel rendering and incremental feature dra | | | |
| wing will be lost. | | | |
| * | | | |
| */ | | | |
| bool mEnableBackbuffer; | | | |
| | | | |
| /** Pointer to data provider derived from the abastract base class QgsD
ataProvider */ | | /** Pointer to data provider derived from the abastract base class QgsD
ataProvider */ | |
| QgsVectorDataProvider *mDataProvider; | | QgsVectorDataProvider *mDataProvider; | |
| | | | |
|
| QgsFeatureIterator mProviderIterator; | | | |
| | | | |
| /** index of the primary label field */ | | /** index of the primary label field */ | |
| QString mDisplayField; | | QString mDisplayField; | |
| | | | |
| /** the preview expression used to generate a human readable preview st
ring for features */ | | /** the preview expression used to generate a human readable preview st
ring for features */ | |
| QString mDisplayExpression; | | QString mDisplayExpression; | |
| | | | |
| /** Data provider key */ | | /** Data provider key */ | |
| QString mProviderKey; | | QString mProviderKey; | |
| | | | |
| /** The user-defined actions that are accessed from the Identify Result
s dialog box */ | | /** The user-defined actions that are accessed from the Identify Result
s dialog box */ | |
| | | | |
| skipping to change at line 1715 | | skipping to change at line 1740 | |
| QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType; | | QgsVectorLayer::VertexMarkerType mCurrentVertexMarkerType; | |
| | | | |
| /** The current size of editing marker */ | | /** The current size of editing marker */ | |
| int mCurrentVertexMarkerSize; | | int mCurrentVertexMarkerSize; | |
| | | | |
| /** Flag if the vertex markers should be drawn only for selection (true
) or for all features (false) */ | | /** Flag if the vertex markers should be drawn only for selection (true
) or for all features (false) */ | |
| bool mVertexMarkerOnlyForSelection; | | bool mVertexMarkerOnlyForSelection; | |
| | | | |
| QStringList mCommitErrors; | | QStringList mCommitErrors; | |
| | | | |
|
| QMap< QString, EditType > mEditTypes; | | | |
| QMap< QString, bool> mFieldEditables; | | QMap< QString, bool> mFieldEditables; | |
| QMap< QString, bool> mLabelOnTop; | | QMap< QString, bool> mLabelOnTop; | |
|
| QMap< QString, QMap<QString, QVariant> > mValueMaps; | | | |
| QMap< QString, RangeData > mRanges; | | | |
| QMap< QString, QPair<QString, QString> > mCheckedStates; | | | |
| QMap< QString, ValueRelationData > mValueRelations; | | | |
| QMap< QString, QString> mDateFormats; | | | |
| QMap< QString, QSize> mWidgetSize; | | | |
| | | | |
|
| QMap<int, QString> mEditorWidgetV2Types; | | QMap<QString, QString> mEditorWidgetV2Types; | |
| QMap<int, QMap<QString, QVariant> > mEditorWidgetV2Configs; | | QMap<QString, QgsEditorWidgetConfig > mEditorWidgetV2Configs; | |
| | | | |
| /** Defines the default layout to use for the attribute editor (Drag an
d drop, UI File, Generated) */ | | /** Defines the default layout to use for the attribute editor (Drag an
d drop, UI File, Generated) */ | |
| EditorLayout mEditorLayout; | | EditorLayout mEditorLayout; | |
| | | | |
| QString mEditForm, mEditFormInit; | | QString mEditForm, mEditFormInit; | |
| | | | |
| /** Type of feature form suppression after feature creation | | /** Type of feature form suppression after feature creation | |
| * @note added in 2.1 */ | | * @note added in 2.1 */ | |
| QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress; | | QgsVectorLayer::FeatureFormSuppress mFeatureFormSuppress; | |
| | | | |
| | | | |
| skipping to change at line 1765 | | skipping to change at line 1783 | |
| | | | |
| bool mValidExtent; | | bool mValidExtent; | |
| bool mLazyExtent; | | bool mLazyExtent; | |
| | | | |
| // Features in renderer classes counted | | // Features in renderer classes counted | |
| bool mSymbolFeatureCounted; | | bool mSymbolFeatureCounted; | |
| | | | |
| // Feature counts for each renderer symbol | | // Feature counts for each renderer symbol | |
| QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap; | | QMap<QgsSymbolV2*, long> mSymbolFeatureCountMap; | |
| | | | |
|
| QgsRenderContext *mCurrentRendererContext; | | friend class QgsVectorLayerFeatureSource; | |
| | | | |
| friend class QgsVectorLayerFeatureIterator; | | | |
| }; | | }; | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 37 change blocks. |
| 102 lines changed or deleted | | 114 lines changed or added | |
|