Skip to content
Permalink
Browse files

[composer] Some api documentation improvements and fix ups

  • Loading branch information
nyalldawson committed Apr 28, 2014
1 parent 9f84e9f commit 7e977bcfd3f162f5ef2c12cce75cb507bfdaa05d
@@ -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
@@ -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;
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
*/
@@ -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
@@ -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();
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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;
@@ -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*/
@@ -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,
@@ -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;
@@ -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.
@@ -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 )

0 comments on commit 7e977bc

Please sign in to comment.
You can’t perform that action at this time.