fix windows build (also syncs QgsComposition sip binding)

This commit is contained in:
Juergen E. Fischer 2014-01-08 09:46:16 +01:00
parent 4fd3b1fb07
commit b4d7e02d3a
3 changed files with 95 additions and 31 deletions

View File

@ -28,6 +28,12 @@ class QgsComposition : QGraphicsScene
Crosses Crosses
}; };
enum ZValueDirection
{
ZValueBelow,
ZValueAbove
};
/**Composition atlas modes*/ /**Composition atlas modes*/
enum AtlasMode enum AtlasMode
{ {
@ -55,15 +61,44 @@ class QgsComposition : QGraphicsScene
/**Note: added in version 1.9*/ /**Note: added in version 1.9*/
int numPages() const; int numPages() const;
/**Note: added in version 2.1*/
void setPageStyleSymbol( QgsFillSymbolV2* symbol /Transfer/ );
/**Note: added in version 2.1*/
QgsFillSymbolV2* pageStyleSymbol();
/**Returns the position within a page of a point in the composition
@note Added in QGIS 2.1
*/
QPointF positionOnPage( const QPointF & position ) const;
/**Returns the page number corresponding to a point in the composition
@note Added in QGIS 2.1
*/
int pageNumberForPoint( const QPointF & position ) const;
/**Sets the status bar message for the composer window
@note Added in QGIS 2.1
*/
void setStatusMessage( const QString & message );
/**Refreshes the composition when composer related options change
*Note: added in version 2.1*/
void updateSettings();
void setSnapToGridEnabled( bool b ); void setSnapToGridEnabled( bool b );
bool snapToGridEnabled() const; bool snapToGridEnabled() const;
void setGridVisible( bool b ); void setGridVisible( bool b );
bool gridVisible() const; bool gridVisible() const;
/**Toggles state of smart guides*/ /**Hides / shows custom snap lines*/
void setSnapLinesVisible( bool visible );
bool snapLinesVisible() const;
void setAlignmentSnap( bool s );
bool alignmentSnap() const;
void setSmartGuidesEnabled( bool b ); void setSmartGuidesEnabled( bool b );
/**Returns true if smart guides are enabled*/
bool smartGuidesEnabled() const; bool smartGuidesEnabled() const;
/**Removes all snap lines*/ /**Removes all snap lines*/
@ -72,6 +107,9 @@ class QgsComposition : QGraphicsScene
void setSnapGridResolution( double r ); void setSnapGridResolution( double r );
double snapGridResolution() const; double snapGridResolution() const;
void setSnapGridTolerance( double tolerance );
double snapGridTolerance() const;
void setSnapGridOffsetX( double offset ); void setSnapGridOffsetX( double offset );
double snapGridOffsetX() const; double snapGridOffsetX() const;
@ -84,9 +122,6 @@ class QgsComposition : QGraphicsScene
void setGridStyle( GridStyle s ); void setGridStyle( GridStyle s );
GridStyle gridStyle() const; GridStyle gridStyle() const;
void setAlignmentSnap( bool s );
bool alignmentSnap() const;
void setAlignmentSnapTolerance( double t ); void setAlignmentSnapTolerance( double t );
double alignmentSnapTolerance() const; double alignmentSnapTolerance() const;
@ -96,6 +131,11 @@ class QgsComposition : QGraphicsScene
/**Returns the topmost composer item. Ignores mPaperItem*/ /**Returns the topmost composer item. Ignores mPaperItem*/
QgsComposerItem* composerItemAt( const QPointF & position ); QgsComposerItem* composerItemAt( const QPointF & position );
/**Returns the highest composer item at a specified position which is below a specified item. Ignores mPaperItem
@note Added in QGIS 2.1
*/
QgsComposerItem* composerItemAt( const QPointF & position, const QgsComposerItem* belowItem );
/** Returns the page number (0-bsaed) given a coordinate */ /** Returns the page number (0-bsaed) given a coordinate */
int pageNumberAt( const QPointF& position ) const; int pageNumberAt( const QPointF& position ) const;
@ -145,6 +185,12 @@ class QgsComposition : QGraphicsScene
bool printAsRaster() const; bool printAsRaster() const;
void setPrintAsRaster( bool enabled ); void setPrintAsRaster( bool enabled );
bool generateWorldFile() const;
void setGenerateWorldFile( bool enabled );
QgsComposerMap* worldFileMap();
void setWorldFileMap( QgsComposerMap* map );
/**Returns true if a composition should use advanced effects such as blend modes /**Returns true if a composition should use advanced effects such as blend modes
@note added in 1.9*/ @note added in 1.9*/
bool useAdvancedEffects() const; bool useAdvancedEffects() const;
@ -152,12 +198,6 @@ class QgsComposition : QGraphicsScene
@note: added in version 1.9*/ @note: added in version 1.9*/
void setUseAdvancedEffects( bool effectsEnabled ); void setUseAdvancedEffects( bool effectsEnabled );
bool generateWorldFile() const;
void setGenerateWorldFile( bool enabled );
QgsComposerMap* worldFileMap();
void setWorldFileMap( QgsComposerMap* map );
/**Returns pointer to map renderer of qgis map canvas*/ /**Returns pointer to map renderer of qgis map canvas*/
QgsMapRenderer* mapRenderer(); QgsMapRenderer* mapRenderer();
@ -214,6 +254,11 @@ class QgsComposition : QGraphicsScene
void moveSelectedItemsToBottom(); void moveSelectedItemsToBottom();
void moveItemToBottom( QgsComposerItem* item ); void moveItemToBottom( QgsComposerItem* item );
//functions to find items by their position in the z list
void selectNextByZOrder( ZValueDirection direction );
QgsComposerItem* getComposerItemBelow( QgsComposerItem* item );
QgsComposerItem* getComposerItemAbove( QgsComposerItem* item );
//functions to align selected items //functions to align selected items
void alignSelectedItemsLeft(); void alignSelectedItemsLeft();
void alignSelectedItemsHCenter(); void alignSelectedItemsHCenter();
@ -222,6 +267,12 @@ class QgsComposition : QGraphicsScene
void alignSelectedItemsVCenter(); void alignSelectedItemsVCenter();
void alignSelectedItemsBottom(); void alignSelectedItemsBottom();
//functions to lock and unlock items
/**Lock the selected items*/
void lockSelectedItems();
/**Unlock all items*/
void unlockAllItems();
/**Sorts the zList. The only time where this function needs to be called is from QgsComposer /**Sorts the zList. The only time where this function needs to be called is from QgsComposer
after reading all the items from xml file*/ after reading all the items from xml file*/
void sortZList(); void sortZList();
@ -229,6 +280,12 @@ class QgsComposition : QGraphicsScene
/**Snaps a scene coordinate point to grid*/ /**Snaps a scene coordinate point to grid*/
QPointF snapPointToGrid( const QPointF& scenePoint ) const; QPointF snapPointToGrid( const QPointF& scenePoint ) const;
/**Returns pointer to snap lines collection*/
QList< QGraphicsLineItem* >* snapLines();
/**Returns pointer to selection handles*/
// QgsComposerMouseHandles* selectionHandles();
/**Add a custom snap line (can be horizontal or vertical)*/ /**Add a custom snap line (can be horizontal or vertical)*/
QGraphicsLineItem* addSnapLine(); QGraphicsLineItem* addSnapLine();
/**Remove custom snap line (and delete the object)*/ /**Remove custom snap line (and delete the object)*/
@ -237,10 +294,6 @@ class QgsComposition : QGraphicsScene
* @note not available in python bindings * @note not available in python bindings
*/ */
// QGraphicsLineItem* nearestSnapLine( bool horizontal, double x, double y, double tolerance, QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > >& snappedItems ); // 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 );
/**Returns visibility of custom snap lines*/
bool snapLinesVisible() const;
/**Allocates new item command and saves initial state in it /**Allocates new item command and saves initial state in it
@param item target item @param item target item
@ -286,6 +339,10 @@ class QgsComposition : QGraphicsScene
/**Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack*/ /**Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack*/
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added ); void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added );
/**If true, prevents any mouse cursor changes by the composition or by any composer items
Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes*/
void setPreventCursorChange( bool preventChange );
bool preventCursorChange();
//printing //printing
@ -315,6 +372,11 @@ class QgsComposition : QGraphicsScene
QgsAtlasComposition& atlasComposition(); QgsAtlasComposition& atlasComposition();
/**Resizes a QRectF relative to the change from boundsBefore to boundsAfter*/
static void relativeResizeRect( QRectF& rectToResize, const QRectF& boundsBefore, const QRectF& boundsAfter );
/**Returns a scaled position given a before and after range*/
static double relativePosition( double position, double beforeMin, double 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; QgsComposition::AtlasMode atlasMode() const;
/** Sets the current atlas mode of the composition. Returns false if the mode could not be changed. */ /** Sets the current atlas mode of the composition. Returns false if the mode could not be changed. */

View File

@ -259,7 +259,7 @@ void QgsComposerScaleBar::applyDefaultSize( QgsComposerScaleBar::ScaleBarUnits u
if ( mComposerMap ) if ( mComposerMap )
{ {
setUnits( u ); setUnits( u );
double upperMagnitudeMultiplier; double upperMagnitudeMultiplier = 1.0;
double widthInSelectedUnits = mapWidth(); double widthInSelectedUnits = mapWidth();
double initialUnitsPerSegment = widthInSelectedUnits / 10.0; //default scalebar width equals half the map width double initialUnitsPerSegment = widthInSelectedUnits / 10.0; //default scalebar width equals half the map width
setNumUnitsPerSegment( initialUnitsPerSegment ); setNumUnitsPerSegment( initialUnitsPerSegment );
@ -310,8 +310,8 @@ void QgsComposerScaleBar::applyDefaultSize( QgsComposerScaleBar::ScaleBarUnits u
double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier; double segmentWidth = initialUnitsPerSegment / upperMagnitudeMultiplier;
int segmentMagnitude = floor( log10( segmentWidth ) ); int segmentMagnitude = floor( log10( segmentWidth ) );
double unitsPerSegment = upperMagnitudeMultiplier * ( pow( 10, segmentMagnitude ) ); double unitsPerSegment = upperMagnitudeMultiplier * ( pow( 10.0, segmentMagnitude ) );
double multiplier = floor(( widthInSelectedUnits / ( unitsPerSegment * 10 ) ) / 2.5 ) * 2.5; double multiplier = floor(( widthInSelectedUnits / ( unitsPerSegment * 10.0 ) ) / 2.5 ) * 2.5;
if ( multiplier > 0 ) if ( multiplier > 0 )
{ {

View File

@ -154,7 +154,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
void setAlignmentSnap( bool s ) { mAlignmentSnap = s; } void setAlignmentSnap( bool s ) { mAlignmentSnap = s; }
bool alignmentSnap() const { return mAlignmentSnap; } bool alignmentSnap() const { return mAlignmentSnap; }
void setSmartGuidesEnabled( bool b ) { mSmartGuides = b; }; void setSmartGuidesEnabled( bool b ) { mSmartGuides = b; }
bool smartGuidesEnabled() const {return mSmartGuides;} bool smartGuidesEnabled() const {return mSmartGuides;}
/**Removes all snap lines*/ /**Removes all snap lines*/
@ -337,10 +337,12 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
QPointF snapPointToGrid( const QPointF& scenePoint ) const; QPointF snapPointToGrid( const QPointF& scenePoint ) const;
/**Returns pointer to snap lines collection*/ /**Returns pointer to snap lines collection*/
QList< QGraphicsLineItem* >* snapLines() {return &mSnapLines;}; QList< QGraphicsLineItem* >* snapLines() {return &mSnapLines;}
/**Returns pointer to selection handles*/ /**Returns pointer to selection handles
QgsComposerMouseHandles* selectionHandles() {return mSelectionHandles;}; * @note not available in python bindings
*/
QgsComposerMouseHandles* selectionHandles() {return mSelectionHandles;}
/**Add a custom snap line (can be horizontal or vertical)*/ /**Add a custom snap line (can be horizontal or vertical)*/
QGraphicsLineItem* addSnapLine(); QGraphicsLineItem* addSnapLine();
@ -397,8 +399,8 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
/**If true, prevents any mouse cursor changes by the composition or by any composer items /**If true, prevents any mouse cursor changes by the composition or by any composer items
Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes*/ Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes*/
void setPreventCursorChange( bool preventChange ) { mPreventCursorChange = preventChange; }; void setPreventCursorChange( bool preventChange ) { mPreventCursorChange = preventChange; }
bool preventCursorChange() { return mPreventCursorChange; }; bool preventCursorChange() { return mPreventCursorChange; }
//printing //printing
@ -426,7 +428,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene
/** Compute world file parameters */ /** Compute world file parameters */
void computeWorldFileParameters( double& a, double& b, double& c, double& d, double& e, double& f ) const; void computeWorldFileParameters( double& a, double& b, double& c, double& d, double& e, double& f ) const;
QgsAtlasComposition& atlasComposition() { return mAtlasComposition; }; QgsAtlasComposition& atlasComposition() { return mAtlasComposition; }
/**Resizes a QRectF relative to the change from boundsBefore to boundsAfter*/ /**Resizes a QRectF relative to the change from boundsBefore to boundsAfter*/
static void relativeResizeRect( QRectF& rectToResize, const QRectF& boundsBefore, const QRectF& boundsAfter ); static void relativeResizeRect( QRectF& rectToResize, const QRectF& boundsBefore, const QRectF& boundsAfter );