Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[composer] Some api documentation improvements and fix ups
  • Loading branch information
nyalldawson committed Apr 28, 2014
1 parent 9f84e9f commit 7e977bc
Show file tree
Hide file tree
Showing 18 changed files with 238 additions and 98 deletions.
79 changes: 68 additions & 11 deletions python/core/composer/qgsatlascomposition.sip
Expand Up @@ -2,7 +2,10 @@
* Class used to render an Atlas, iterating over geometry features.
* prepareForFeature() modifies the atlas map's extent to zoom on the given feature.
* This class is used for printing, exporting to PDF and images.
* */
* @note This class should not be created directly. For the atlas to function correctly
* the atlasComposition() property for QgsComposition should be used to retrieve a
* QgsAtlasComposition which is automatically created and attached to the composition.
*/
class QgsAtlasComposition : QObject
{
%TypeHeaderCode
Expand All @@ -13,47 +16,101 @@ public:
QgsAtlasComposition( QgsComposition* composition );
~QgsAtlasComposition();

/** Is the atlas generation enabled ? */
/**Returns whether the atlas generation is enabled
* @returns true if atlas is enabled
* @see setEnabled
*/
bool enabled() const;
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
* @deprecated Use QgsComposerMap::atlasDriven() instead
*/
QgsComposerMap* composerMap() const;
QgsComposerMap* composerMap() const /Deprecated/;

/**Sets the map used by the atlas
* @deprecated Use QgsComposerMap::setAtlasDriven( true ) instead
*/
void setComposerMap( QgsComposerMap* map );
void setComposerMap( QgsComposerMap* map ) /Deprecated/;

/**Returns true if the atlas is set to hide the coverage layer
* @returns true if coverage layer is hidden
* @see setHideCoverage
*/
bool hideCoverage() const;

/**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 );

/**Returns whether the atlas map uses a fixed scale
* @deprecated Use QgsComposerMap::atlasFixedScale() instead
*/
bool fixedScale() const;
bool fixedScale() const /Deprecated/;
/**Sets whether the atlas map should use a fixed scale
* @deprecated Use QgsComposerMap::setAtlasFixedScale( bool ) instead
*/
void setFixedScale( bool fixed );
void setFixedScale( bool fixed ) /Deprecated/;

/**Returns the margin for the atlas map
* @deprecated Use QgsComposerMap::atlasMargin() instead
*/
float margin() const;
float margin() const /Deprecated/;

/**Sets the margin for the atlas map
* @deprecated Use QgsComposerMap::setAtlasMargin( double ) instead
*/
void setMargin( float margin );
void setMargin( float margin ) /Deprecated/;

/**Returns the filename expression used for generating output filenames for each
* atlas page.
* @returns filename pattern
* @see setFilenamePattern
* @note This property has no effect when exporting to PDF if singleFile() is true
*/
QString filenamePattern() const;

/**Sets the filename expression used for generating output filenames for each
* atlas page.
* @param pattern expression to use for output filenames
* @see filenamePattern
* @note This method has no effect when exporting to PDF if singleFile() is true
*/
void setFilenamePattern( const QString& pattern );

/**Returns the coverage layer used for the atlas features
* @returns atlas coverage layer
* @see setCoverageLayer
*/
QgsVectorLayer* coverageLayer() const;
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;

/**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 );

bool sortFeatures() const;
Expand Down
16 changes: 8 additions & 8 deletions python/core/composer/qgscomposerattributetable.sip
Expand Up @@ -42,7 +42,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setVectorLayer( QgsVectorLayer* layer );

/*Returns the vector layer the attribute table is currently using
/**Returns the vector layer the attribute table is currently using
* @returns attribute table's current vector layer
* @note added in 2.3
* @see setVectorLayer
Expand All @@ -61,7 +61,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setComposerMap( const QgsComposerMap* map /TransferThis/ );

/*Returns the composer map whose extents are controlling the features shown in the
/**Returns the composer map whose extents are controlling the features shown in the
* table. The extents of the map are only used if displayOnlyVisibleFeatures() is true.
* @returns composer map controlling the attribute table
* @note added in 2.3
Expand All @@ -79,7 +79,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setMaximumNumberOfFeatures( int features );

/*Returns the maximum number of features to be shown by the table.
/**Returns the maximum number of features to be shown by the table.
* @returns maximum number of features
* @note added in 2.3
* @see setMaximumNumberOfFeatures
Expand All @@ -96,7 +96,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setDisplayOnlyVisibleFeatures( bool b );

/*Returns true if the table is set to show only features visible on a corresponding
/**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
* @note added in 2.3
Expand All @@ -105,7 +105,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
bool displayOnlyVisibleFeatures() const;

/*Returns true if a feature filter is active on the attribute table
/**Returns true if a feature filter is active on the attribute table
* @returns bool state of the feature filter
* @note added in 2.3
* @see setFilterFeatures
Expand All @@ -123,7 +123,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setFilterFeatures( bool filter );

/*Returns the current expression used to filter features for the table. The filter is only
/**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
Expand All @@ -143,7 +143,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setFeatureFilter( const QString& expression );

/*Returns the attributes fields which are shown by the table.
/**Returns the attributes fields which are shown by the table.
* @returns a QSet of integers refering to the attributes in the vector layer
* @see setDisplayAttributes
*/
Expand All @@ -158,7 +158,7 @@ class QgsComposerAttributeTable : QgsComposerTable
*/
void setDisplayAttributes( const QSet<int>& attr );

/*Returns the attribute field aliases, which control how fields are named in the table's
/**Returns the attribute field aliases, which control how fields are named in the table's
* header row.
* @returns a QMap of integers to strings, where the string is the field's alias.
* @see setFieldAliasMap
Expand Down
11 changes: 7 additions & 4 deletions python/core/composer/qgscomposeritem.sip
Expand Up @@ -383,7 +383,7 @@ class QgsComposerItem : QObject, QGraphicsRectItem
* @deprecated Use itemRotation()
* instead
*/
double rotation() const;
double rotation() const /Deprecated/;

/**Updates item, with the possibility to do custom update for subclasses*/
virtual void updateItem();
Expand Down Expand Up @@ -471,11 +471,12 @@ class QgsComposerItem : QObject, QGraphicsRectItem

/**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, double rotation ) const;

/**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, double& height, double rotation )
* instead
*/
bool imageSizeConsideringRotation( double& width, double& height ) const;
bool imageSizeConsideringRotation( double& width, double& height ) const /Deprecated/;

/**Calculates the largest scaled version of originalRect which fits within boundsRect, when it is rotated by
* a specified amount
Expand All @@ -487,19 +488,21 @@ class QgsComposerItem : QObject, QGraphicsRectItem

/**Calculates corner point after rotation and scaling*/
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation ) const;

/**Calculates corner point after rotation and scaling
* @deprecated Use bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation )
* instead
*/
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const;
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const /Deprecated/;

/**Calculates width / height of the bounding box of a rotated rectangle*/

void sizeChangedByRotation( double& width, double& height, double rotation );
/**Calculates width / height of the bounding box of a rotated rectangle
* @deprecated Use void sizeChangedByRotation( double& width, double& height, double rotation )
* instead
*/
void sizeChangedByRotation( double& width, double& height );
void sizeChangedByRotation( double& width, double& height ) /Deprecated/;

/**Rotates a point / vector
@param angle rotation angle in degrees, counterclockwise
Expand Down
2 changes: 1 addition & 1 deletion python/core/composer/qgscomposerlegend.sip
Expand Up @@ -31,7 +31,7 @@ class QgsComposerLegend : QgsComposerItem
void setTitle( const QString& t );
QString title() const;

/*Returns the alignment of the legend title
/**Returns the alignment of the legend title
* @returns Qt::AlignmentFlag for the legend title
* @note added in 2.3
* @see setTitleAlignment
Expand Down
13 changes: 8 additions & 5 deletions python/core/composer/qgscomposermap.sip
Expand Up @@ -309,11 +309,12 @@ class QgsComposerMap : QgsComposerItem
way the map is drawn within the item
* @deprecated Use setMapRotation( double rotation ) instead
*/
void setRotation( double r );
void setRotation( double r ) /Deprecated/;

/**Returns the rotation used for drawing the map within the composer item
* @deprecated Use mapRotation() instead
*/
double rotation() const;
double rotation() const /Deprecated/;

/**Sets rotation for the map - this does not affect the composer item shape, only the
way the map is drawn within the item
Expand Down Expand Up @@ -374,17 +375,19 @@ class QgsComposerMap : QgsComposerItem
* @deprecated Use bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& height, double rotation )
* instead
*/
bool imageSizeConsideringRotation( double& width, double& height ) const;
bool imageSizeConsideringRotation( double& width, double& height ) const /Deprecated/;

/**Calculates corner point after rotation and scaling
* @deprecated Use QgsComposerItem::cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation )
* instead
*/
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const;
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const /Deprecated/;

/**Calculates width / height of the bounding box of a rotated rectangle
* @deprecated Use QgsComposerItem::sizeChangedByRotation( double& width, double& height, double rotation )
* instead
*/
void sizeChangedByRotation( double& width, double& height );
void sizeChangedByRotation( double& width, double& height ) /Deprecated/;

/** Returns true if the map extent is set to follow the current atlas feature */
bool atlasDriven() const;
Expand Down
8 changes: 4 additions & 4 deletions python/core/composer/qgscomposerpicture.sip
Expand Up @@ -41,7 +41,7 @@ class QgsComposerPicture: QgsComposerItem
/**Returns the rotation used for drawing the picture within the composer item
* @deprecated Use pictureRotation() instead
*/
double rotation() const;
double rotation() const /Deprecated/;

/**Returns the rotation used for drawing the picture within the item
@note this function was added in version 2.1*/
Expand All @@ -58,17 +58,17 @@ class QgsComposerPicture: QgsComposerItem
* @deprecated Use bool QgsComposerItem::imageSizeConsideringRotation( double& width, double& height, double rotation )
* instead
*/
bool imageSizeConsideringRotation( double& width, double& height ) const;
bool imageSizeConsideringRotation( double& width, double& height ) const /Deprecated/;
/**Calculates corner point after rotation and scaling
* @deprecated Use QgsComposerItem::cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height, double rotation )
* instead
*/
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const;
bool cornerPointOnRotatedAndScaledRect( double& x, double& y, double width, double height ) const /Deprecated/;
/**Calculates width / height of the bounding box of a rotated rectangle
* @deprecated Use QgsComposerItem::sizeChangedByRotation( double& width, double& height, double rotation )
* instead
*/
void sizeChangedByRotation( double& width, double& height );
void sizeChangedByRotation( double& width, double& height ) /Deprecated/;

public slots:
/**Sets the picture rotation within the item bounds. This does not affect the item rectangle,
Expand Down
15 changes: 13 additions & 2 deletions python/core/composer/qgscomposertexttable.sip
Expand Up @@ -9,8 +9,19 @@ class QgsComposerTextTable: QgsComposerTable

/** return correct graphics item type. Added in v1.7 */
virtual int type() const;

void setHeaderLabels( const QStringList& l );

/**Sets the text to use for the header row for the table
* @param labels list of strings to use for each column's header row
* @see headerLabels
*/
void setHeaderLabels( const QStringList& labels );

/**Adds a row to the table
* @param row list of strings to use for each cell's value in the newly added row
* @note If row is shorter than the number of columns in the table than blank cells
* will be inserted at the end of the row. If row contains more strings then the number
* of columns in the table then these extra strings will be ignored.
*/
void addRow( const QStringList& row );

bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
Expand Down
2 changes: 1 addition & 1 deletion python/core/composer/qgscomposition.sip
Expand Up @@ -161,7 +161,7 @@ class QgsComposition : QGraphicsScene
@return QgsComposerMap or 0 pointer if the composer map item does not exist*/
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 the
composer user interface item properties).
@note Added in QGIS 2.0
@param id - A QString representing the id of the item.
Expand Down
6 changes: 3 additions & 3 deletions src/core/composer/qgsatlascomposition.cpp
Expand Up @@ -50,11 +50,11 @@ QgsAtlasComposition::~QgsAtlasComposition()
{
}

void QgsAtlasComposition::setEnabled( bool e )
void QgsAtlasComposition::setEnabled( bool enabled )
{
mEnabled = e;
mEnabled = enabled;
mComposition->setAtlasMode( QgsComposition::AtlasOff );
emit toggled( e );
emit toggled( enabled );
}

void QgsAtlasComposition::setCoverageLayer( QgsVectorLayer* layer )
Expand Down

0 comments on commit 7e977bc

Please sign in to comment.