-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add python bindings for composer command classes
git-svn-id: http://svn.osgeo.org/qgis/trunk@14827 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
mhugent
committed
Dec 2, 2010
1 parent
16f326f
commit 2ed7c94
Showing
6 changed files
with
135 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** \ingroup MapComposer | ||
A composer command class for adding / removing composer items. If mState == Removed, the command owns the item*/ | ||
class QgsAddRemoveItemCommand: QObject, QUndoCommand | ||
{ | ||
%TypeHeaderCode | ||
#include "qgsaddremoveitemcommand.h" | ||
%End | ||
public: | ||
|
||
enum State | ||
{ | ||
Added = 0, | ||
Removed | ||
}; | ||
|
||
QgsAddRemoveItemCommand( State s, QgsComposerItem* item, QgsComposition* c, const QString& text, QUndoCommand* parent = 0 ); | ||
~QgsAddRemoveItemCommand(); | ||
|
||
void redo(); | ||
void undo(); | ||
|
||
signals: | ||
void itemAdded( QgsComposerItem* item ); | ||
void itemRemoved( QgsComposerItem* item ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/**\ingroup MapComposer | ||
Undo command to undo/redo all composer item related changes*/ | ||
class QgsComposerItemCommand: QUndoCommand | ||
{ | ||
%TypeHeaderCode | ||
#include "qgscomposeritemcommand.h" | ||
%End | ||
public: | ||
QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = 0 ); | ||
virtual ~QgsComposerItemCommand(); | ||
|
||
/**Reverses the command*/ | ||
void undo(); | ||
/**Replays the command*/ | ||
void redo(); | ||
|
||
/**Saves current item state as previous state*/ | ||
void savePreviousState(); | ||
/**Saves current item state as after state*/ | ||
void saveAfterState(); | ||
|
||
QDomDocument previousState() const; | ||
QDomDocument afterState() const; | ||
|
||
/**Returns true if previous state and after state are valid and different*/ | ||
bool containsChange() const; | ||
}; | ||
|
||
/**\ingroup MapComposer | ||
A composer command that merges together with other commands having the same context (=id). Keeps the oldest previous state and uses the | ||
newest after state. The purpose is to avoid too many micro changes in the history*/ | ||
class QgsComposerMergeCommand: QgsComposerItemCommand | ||
{ | ||
%TypeHeaderCode | ||
#include "qgscomposeritemcommand.h" | ||
%End | ||
public: | ||
enum Context | ||
{ | ||
Unknown = 0, | ||
//composer label | ||
ComposerLabelSetText, | ||
//composer map | ||
ComposerMapRotation, | ||
ComposerMapAnnotationDistance, | ||
//composer legend | ||
ComposerLegendText, | ||
LegendSymbolWidth, | ||
LegendSymbolHeight, | ||
LegendLayerSpace, | ||
LegendSymbolSpace, | ||
LegendIconSymbolSpace, | ||
LegendBoxSpace, | ||
//composer picture | ||
ComposerPictureRotation, | ||
// composer scalebar | ||
ScaleBarLineWidth, | ||
ScaleBarHeight, | ||
ScaleBarSegmentSize, | ||
ScaleBarSegmentsLeft, | ||
ScaleBarNSegments, | ||
ScaleBarUnitText, | ||
ScaleBarMapUnitsSegment, | ||
ScaleBarLabelBarSize, | ||
ScaleBarBoxContentSpace, | ||
// composer table | ||
TableMaximumFeatures, | ||
TableMargin, | ||
TableGridStrokeWidth, | ||
//composer shape | ||
ShapeRotation, | ||
ShapeOutlineWidth, | ||
//composer arrow | ||
ArrowOutlineWidth, | ||
ArrowHeadWidth, | ||
//item | ||
ItemOutlineWidth | ||
}; | ||
|
||
QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text ); | ||
~QgsComposerMergeCommand(); | ||
|
||
bool mergeWith( const QUndoCommand * command ); | ||
int id() const; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters