Skip to content

Commit

Permalink
sip update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jun 23, 2013
1 parent b53e80b commit 3854086
Show file tree
Hide file tree
Showing 54 changed files with 611 additions and 276 deletions.
2 changes: 0 additions & 2 deletions python/analysis/network/qgsgraphanalyzer.sip
Expand Up @@ -51,5 +51,3 @@ class QgsGraphAnalyzer
*/
static QgsGraph* shortestTree( const QgsGraph* source, int startVertexIdx, int criterionNum );
};


5 changes: 4 additions & 1 deletion python/core/composer/qgsatlascomposition.sip
Expand Up @@ -44,6 +44,9 @@ public:
bool sortAscending() const;
void setSortAscending( bool ascending );

bool filterFeatures() const;
void setFilterFeatures( bool doFilter );

QString featureFilter() const;
void setFeatureFilter( const QString& expression );

Expand All @@ -69,7 +72,7 @@ public:

QgsComposition* composition();

signals:
signals:
/** emitted when one of the parameters changes */
void parameterChanged();
};
87 changes: 60 additions & 27 deletions python/core/composer/qgscomposeritem.sip
Expand Up @@ -5,8 +5,6 @@ class QgsComposerItem: QObject, QGraphicsRectItem
{
%TypeHeaderCode
#include <qgscomposeritem.h>
//#include <qgscomposerarrow.h>
//#include <qgscomposeritemgroup.h>
#include <qgscomposerlabel.h>
#include <qgscomposerlegend.h>
#include <qgscomposermap.h>
Expand All @@ -16,7 +14,6 @@ class QgsComposerItem: QObject, QGraphicsRectItem
#include <qgscomposershape.h>
#include <qgscomposertable.h>
#include <qgscomposerattributetable.h>
//#include <qgscomposertexttable.h>
%End

%ConvertToSubClassCode
Expand Down Expand Up @@ -231,6 +228,55 @@ class QgsComposerItem: QObject, QGraphicsRectItem
*/
void setFrameEnabled( bool drawFrame );


/** Whether this item has a Background or not.
* @returns true if there is a Background around this item, otherwise false.
* @note introduced since 2.0
* @see hasBackground
*/
bool hasBackground() const;

/** Set whether this item has a Background drawn around it or not.
* @param drawBackground draw Background
* @returns nothing
* @note introduced in 2.0
* @see hasBackground
*/
void setBackgroundEnabled( bool drawBackground );

/** Gets the background color for this item
* @returns background color
* @note introduced in 2.0
*/
QColor backgroundColor() const;

/** Sets the background color for this item
* @param backgroundColor new background color
* @returns nothing
* @note introduced in 2.0
*/
void setBackgroundColor( const QColor& backgroundColor );

/** Returns the item's composition blending mode */
QPainter::CompositionMode blendMode() const;

/** Sets the item's composition blending mode*/
void setBlendMode( QPainter::CompositionMode blendMode );

/** Returns the item's transparency */
int transparency() const;
/** Sets the item's transparency */
void setTransparency( int transparency );

/** Returns true if effects (eg blend modes) are enabled for the item
* @note introduced in 2.0
*/
bool effectsEnabled() const;
/** Sets whether effects (eg blend modes) are enabled for the item
* @note introduced in 2.0
*/
void setEffectsEnabled( bool effectsEnabled );

/**Composite operations for item groups do nothing per default*/
virtual void addItem( QgsComposerItem* item );
virtual void removeItems();
Expand Down Expand Up @@ -269,6 +315,9 @@ class QgsComposerItem: QObject, QGraphicsRectItem
/**Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double fontAscentMillimeters( const QFont& font ) const;

/**Returns the font ascent in Millimeters (considers upscaling and downscaling with FONT_WORKAROUND_SCALE*/
double fontDescentMillimeters( const QFont& font ) const;

/**Calculates font to from point size to pixel size*/
double pixelFontSize( double pointSize ) const;

Expand Down Expand Up @@ -304,30 +353,6 @@ class QgsComposerItem: QObject, QGraphicsRectItem
@note this method was added in version 2.0
@note there is not setter since one can't manually set the id*/
QString uuid() const;

/** Gets the background color for this item
* @note introduced in 2.0
*/
const QColor backgroundColor() const;

/** Sets the background color for this item
* @note introduced in 2.0
*/
void setBackgroundColor( const QColor& backgroundColor );

/* Returns the current blending mode for the composer item
@note added in version 1.9*/
const QPainter::CompositionMode blendMode() const;
/* Sets the composer item's blending mode
@note added in version 1.9*/
void setBlendMode( const QPainter::CompositionMode blendMode );

/** Returns the composer item's transparency
@note added in version 1.9*/
const int transparency() const;
/** Sets the composer item's transparency
@note added in version 1.9*/
void setTransparency( const int transparency );

public slots:
virtual void setRotation( double r );
Expand Down Expand Up @@ -401,6 +426,14 @@ class QgsComposerItem: QObject, QGraphicsRectItem
@param y in/out: y cooreinate before / after the rotation*/
void rotate( double angle, double& x, double& y ) const;

/**Return horizontal align snap item. Creates a new graphics line if 0*/
QGraphicsLineItem* hAlignSnapItem();
void deleteHAlignSnapItem();
/**Return vertical align snap item. Creates a new graphics line if 0*/
QGraphicsLineItem* vAlignSnapItem();
void deleteVAlignSnapItem();
void deleteAlignItems();

signals:
/**Is emitted on rotation change to notify north arrow pictures*/
void rotationChanged( double newRotation );
Expand Down
5 changes: 5 additions & 0 deletions python/core/composer/qgscomposeritemcommand.sip
Expand Up @@ -52,13 +52,18 @@ class QgsComposerMergeCommand : QgsComposerItemCommand
ComposerMapAnnotationDistance,
//composer legend
ComposerLegendText,
LegendColumnCount,
LegendSplitLayer,
LegendEqualColumnWidth,
LegendSymbolWidth,
LegendSymbolHeight,
LegendTitleSpaceBottom,
LegendGroupSpace,
LegendLayerSpace,
LegendSymbolSpace,
LegendIconSymbolSpace,
LegendBoxSpace,
LegendColumnSpace,
//composer picture
ComposerPictureRotation,
// composer scalebar
Expand Down
3 changes: 3 additions & 0 deletions python/core/composer/qgscomposerlabel.sip
Expand Up @@ -22,6 +22,9 @@ class QgsComposerLabel : QgsComposerItem
QString text();
void setText( const QString& text );

int htmlState();
void setHtmlState( int state );

/**Returns the text as it appears on screen (with replaced data field)
@note this function was added in version 1.2*/
QString displayText() const;
Expand Down
28 changes: 24 additions & 4 deletions python/core/composer/qgscomposerlegend.sip
Expand Up @@ -31,18 +31,29 @@ class QgsComposerLegend : QgsComposerItem
void setTitle( const QString& t );
QString title() const;

/*
QgsComposerLegendStyle style(QgsComposerLegendStyle::Style s) const;
void setStyle(QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle style);
/** Returns reference to modifiable style */
QgsComposerLegendStyle & rstyle( QgsComposerLegendStyle::Style s );
/** Returns style */
QgsComposerLegendStyle style( QgsComposerLegendStyle::Style s ) const;
void setStyle( QgsComposerLegendStyle::Style s, const QgsComposerLegendStyle style );

QFont styleFont( QgsComposerLegendStyle::Style s ) const;
/** Set style font */
void setStyleFont( QgsComposerLegendStyle::Style s, const QFont& f );

/** Set style margin*/
void setStyleMargin( QgsComposerLegendStyle::Style s, double margin );
void setStyleMargin( QgsComposerLegendStyle::Style s, QgsComposerLegendStyle::Side side, double margin );
*/

double boxSpace() const;
void setBoxSpace( double s );

double columnSpace() const;
void setColumnSpace( double s );

QColor fontColor() const;
void setFontColor( const QColor& c );

double symbolWidth() const;
void setSymbolWidth( double w );

Expand All @@ -52,6 +63,15 @@ class QgsComposerLegend : QgsComposerItem
void setWrapChar( const QString& t );
QString wrapChar() const;

int columnCount() const;
void setColumnCount( int c );

int splitLayer() const;
void setSplitLayer( bool s );

int equalColumnWidth() const;
void setEqualColumnWidth( bool s );

void setComposerMap( const QgsComposerMap* map );
const QgsComposerMap* composerMap() const;

Expand Down
15 changes: 14 additions & 1 deletion python/core/composer/qgscomposerlegenditem.sip
Expand Up @@ -15,7 +15,8 @@ class QgsComposerLegendItem : QStandardItem
GroupItem = QStandardItem::UserType,
LayerItem,
SymbologyV2Item,
RasterSymbolItem
RasterSymbolItem,
StyleItem
};

virtual void writeXML( QDomElement& elem, QDomDocument& doc ) const = 0;
Expand All @@ -27,6 +28,13 @@ class QgsComposerLegendItem : QStandardItem
virtual ItemType itemType() const = 0;
virtual QStandardItem* clone() const = 0;

QgsComposerLegendStyle::Style style() const;
void setStyle( QgsComposerLegendStyle::Style style );

// Get text defined by user
virtual QString userText() const;
// Set text defined by user
virtual void setUserText( const QString & text );
protected:
void writeXMLChildren( QDomElement& elem, QDomDocument& doc ) const;
};
Expand Down Expand Up @@ -99,6 +107,11 @@ class QgsComposerLayerItem : QgsComposerLegendItem

void setLayerID( const QString& id );
QString layerID() const;

void setShowFeatureCount( bool show );
bool showFeatureCount() const;

void setDefaultStyle();
};

class QgsComposerGroupItem : QgsComposerLegendItem
Expand Down
3 changes: 3 additions & 0 deletions python/core/composer/qgscomposerscalebar.sip
Expand Up @@ -53,6 +53,9 @@ class QgsComposerScaleBar: QgsComposerItem

QFont font() const;

QColor fontColor() const;
void setFontColor( const QColor& c );

void setFont( const QFont& font );

QPen pen() const;
Expand Down
7 changes: 7 additions & 0 deletions python/core/composer/qgscomposershape.sip
Expand Up @@ -46,4 +46,11 @@ class QgsComposerShape: QgsComposerItem
public slots:
/**Sets item rotation and resizes item bounds such that the shape always has the same size*/
virtual void setRotation( double r );


protected:
/* reimplement drawFrame, since it's not a rect, but a custom shape */
virtual void drawFrame( QPainter* p );
/* reimplement drawBackground, since it's not a rect, but a custom shape */
virtual void drawBackground( QPainter* p );
};
50 changes: 41 additions & 9 deletions python/core/composer/qgscomposition.sip
Expand Up @@ -106,23 +106,18 @@ class QgsComposition : QGraphicsScene
const QgsComposerHtml* getComposerHtmlByItem( QgsComposerItem *item ) const;

/**Returns a composer item given its text identifier.
Ids are not necessarely unique, but this function returns only one element.
Ids are not necessarely unique, but this function returns only one element.
@note added in 2.0
@param theId - A QString representing the identifier of the item to
retrieve.
@return QgsComposerItem pointer or 0 pointer if no such item exists.
**/
const QgsComposerItem* getComposerItemById( QString theId ) const;


/**Returns a composer item given its unique identifier.
Warning : ids are not necessarely unique, but this function returns only one element.
@note added in 2.0
@param theId - A QString representing the UUID of the item to retrieve.
@param inAllComposers - Whether the search should be done in all composers of the project
@return QgsComposerItem pointer or 0 pointer if no such item exists.
@param theUuid A QString representing the UUID of the item to
**/
//const QgsComposerItem* getComposerItemByUuid( QString theUuid, bool inAllComposers = false ) const;
const QgsComposerItem* getComposerItemByUuid( QString theUuid ) const;

int printResolution() const;
Expand All @@ -131,6 +126,13 @@ class QgsComposition : QGraphicsScene
bool printAsRaster() const;
void setPrintAsRaster( bool enabled );

/**Returns true if a composition should use advanced effects such as blend modes
@note added in 1.9*/
bool useAdvancedEffects() const;
/**Used to enable or disable advanced effects such as blend modes in a composition
@note: added in version 1.9*/
void setUseAdvancedEffects( bool effectsEnabled );

double selectionTolerance() const;
void setSelectionTolerance( double tol );

Expand Down Expand Up @@ -167,11 +169,12 @@ class QgsComposition : QGraphicsScene
@param mapsToRestore for reading from project file: set preview move 'rectangle' to all maps and save the preview states to show composer maps on demand
@param addUndoCommands insert AddItem commands if true (e.g. for copy/paste)
@param pos item position. Optional, take position from xml if 0
@param pasteInPlace whether the position should be kept but mapped to the page origin. (the page is the page under to the mouse cursor)
@note not available in python bindings
*/
/*
void addItemsFromXML( const QDomElement& elem, const QDomDocument& doc, QMap< QgsComposerMap*, int >* mapsToRestore = 0,
bool addUndoCommands = false, QPointF* pos = 0 );
bool addUndoCommands = false, QPointF* pos = 0, bool pasteInPlace = false );
*/

/**Adds item to z list. Usually called from constructor of QgsComposerItem*/
Expand Down Expand Up @@ -204,6 +207,34 @@ class QgsComposition : QGraphicsScene
/**Snaps a scene coordinate point to grid*/
QPointF snapPointToGrid( const QPointF& scenePoint ) const;

/**Snaps item position to align with other items (left / middle / right or top / middle / bottom
@param item current item
@param alignX x-coordinate of align or -1 if not aligned to x
@param alignY y-coordinate of align or -1 if not aligned to y
@param dx item shift in x direction
@param dy item shift in y direction
@return new upper left point after the align*/
QPointF alignItem( const QgsComposerItem* item, double& alignX, double& alignY, double dx = 0, double dy = 0 );

/**Snaps position to align with the boundaries of other items
@param pos position to snap
@param excludeItem item to exclude
@param alignX snapped x coordinate or -1 if not snapped
@param alignY snapped y coordinate or -1 if not snapped
@return snapped position or original position if no snap*/
QPointF alignPos( const QPointF& pos, const QgsComposerItem* excludeItem, double& alignX, double& alignY );

/**Add a custom snap line (can be horizontal or vertical)*/
QGraphicsLineItem* addSnapLine();
/**Remove custom snap line (and delete the object)*/
void removeSnapLine( QGraphicsLineItem* line );
/**Get nearest snap line
* @note not availabel in python bindings
*/
// QGraphicsLineItem* nearestSnapLine( bool horizontal, double x, double y, double tolerance, QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > >& snappedItems );
/**Hides / shows custom snap lines*/
void setSnapLinesVisible( bool visible );

/**Allocates new item command and saves initial state in it
@param item target item
@param commandText descriptive command text
Expand All @@ -222,7 +253,8 @@ class QgsComposition : QGraphicsScene
void addMultiFrame( QgsComposerMultiFrame* multiFrame );
/**Removes multi frame (but does not delete it)*/
void removeMultiFrame( QgsComposerMultiFrame* multiFrame );
/**Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)*/
/**Adds an arrow item to the graphics scene and advices composer to create a widget for it (through signal)
@note not available in python bindings*/
void addComposerArrow( QgsComposerArrow* arrow );
/**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerLabel( QgsComposerLabel* label );
Expand Down

0 comments on commit 3854086

Please sign in to comment.