@@ -27,14 +27,20 @@ class QgsComposition : QGraphicsScene
27
27
Dots,
28
28
Crosses
29
29
};
30
-
30
+
31
+ enum ZValueDirection
32
+ {
33
+ ZValueBelow,
34
+ ZValueAbove
35
+ };
36
+
31
37
/**Composition atlas modes*/
32
38
enum AtlasMode
33
39
{
34
40
AtlasOff, // Composition is not being controlled by an atlas
35
41
PreviewAtlas, // An atlas composition is being previewed in the app
36
42
ExportAtlas // The composition is being exported as an atlas
37
- };
43
+ };
38
44
39
45
QgsComposition( QgsMapRenderer* mapRenderer );
40
46
~QgsComposition();
@@ -55,23 +61,55 @@ class QgsComposition : QGraphicsScene
55
61
/**Note: added in version 1.9*/
56
62
int numPages() const;
57
63
64
+ /**Note: added in version 2.1*/
65
+ void setPageStyleSymbol( QgsFillSymbolV2* symbol /Transfer/ );
66
+ /**Note: added in version 2.1*/
67
+ QgsFillSymbolV2* pageStyleSymbol();
68
+
69
+ /**Returns the position within a page of a point in the composition
70
+ @note Added in QGIS 2.1
71
+ */
72
+ QPointF positionOnPage( const QPointF & position ) const;
73
+
74
+ /**Returns the page number corresponding to a point in the composition
75
+ @note Added in QGIS 2.1
76
+ */
77
+ int pageNumberForPoint( const QPointF & position ) const;
78
+
79
+ /**Sets the status bar message for the composer window
80
+ @note Added in QGIS 2.1
81
+ */
82
+ void setStatusMessage( const QString & message );
83
+
84
+ /**Refreshes the composition when composer related options change
85
+ *Note: added in version 2.1*/
86
+ void updateSettings();
87
+
58
88
void setSnapToGridEnabled( bool b );
59
89
bool snapToGridEnabled() const;
60
90
61
91
void setGridVisible( bool b );
62
92
bool gridVisible() const;
63
93
64
- /**Toggles state of smart guides*/
94
+ /**Hides / shows custom snap lines*/
95
+ void setSnapLinesVisible( bool visible );
96
+ bool snapLinesVisible() const;
97
+
98
+ void setAlignmentSnap( bool s );
99
+ bool alignmentSnap() const;
100
+
65
101
void setSmartGuidesEnabled( bool b );
66
- /**Returns true if smart guides are enabled*/
67
- bool smartGuidesEnabled() const;
68
-
102
+ bool smartGuidesEnabled() const;
103
+
69
104
/**Removes all snap lines*/
70
- void clearSnapLines();
105
+ void clearSnapLines();
71
106
72
107
void setSnapGridResolution( double r );
73
108
double snapGridResolution() const;
74
109
110
+ void setSnapGridTolerance( double tolerance );
111
+ double snapGridTolerance() const;
112
+
75
113
void setSnapGridOffsetX( double offset );
76
114
double snapGridOffsetX() const;
77
115
@@ -84,9 +122,6 @@ class QgsComposition : QGraphicsScene
84
122
void setGridStyle( GridStyle s );
85
123
GridStyle gridStyle() const;
86
124
87
- void setAlignmentSnap( bool s );
88
- bool alignmentSnap() const;
89
-
90
125
void setAlignmentSnapTolerance( double t );
91
126
double alignmentSnapTolerance() const;
92
127
@@ -96,6 +131,11 @@ class QgsComposition : QGraphicsScene
96
131
/**Returns the topmost composer item. Ignores mPaperItem*/
97
132
QgsComposerItem* composerItemAt( const QPointF & position );
98
133
134
+ /**Returns the highest composer item at a specified position which is below a specified item. Ignores mPaperItem
135
+ @note Added in QGIS 2.1
136
+ */
137
+ QgsComposerItem* composerItemAt( const QPointF & position, const QgsComposerItem* belowItem );
138
+
99
139
/** Returns the page number (0-bsaed) given a coordinate */
100
140
int pageNumberAt( const QPointF& position ) const;
101
141
@@ -145,19 +185,19 @@ class QgsComposition : QGraphicsScene
145
185
bool printAsRaster() const;
146
186
void setPrintAsRaster( bool enabled );
147
187
188
+ bool generateWorldFile() const;
189
+ void setGenerateWorldFile( bool enabled );
190
+
191
+ QgsComposerMap* worldFileMap();
192
+ void setWorldFileMap( QgsComposerMap* map );
193
+
148
194
/**Returns true if a composition should use advanced effects such as blend modes
149
195
@note added in 1.9*/
150
196
bool useAdvancedEffects() const;
151
197
/**Used to enable or disable advanced effects such as blend modes in a composition
152
198
@note: added in version 1.9*/
153
199
void setUseAdvancedEffects( bool effectsEnabled );
154
200
155
- bool generateWorldFile() const;
156
- void setGenerateWorldFile( bool enabled );
157
-
158
- QgsComposerMap* worldFileMap();
159
- void setWorldFileMap( QgsComposerMap* map );
160
-
161
201
/**Returns pointer to map renderer of qgis map canvas*/
162
202
QgsMapRenderer* mapRenderer();
163
203
@@ -214,6 +254,11 @@ class QgsComposition : QGraphicsScene
214
254
void moveSelectedItemsToBottom();
215
255
void moveItemToBottom( QgsComposerItem* item );
216
256
257
+ //functions to find items by their position in the z list
258
+ void selectNextByZOrder( ZValueDirection direction );
259
+ QgsComposerItem* getComposerItemBelow( QgsComposerItem* item );
260
+ QgsComposerItem* getComposerItemAbove( QgsComposerItem* item );
261
+
217
262
//functions to align selected items
218
263
void alignSelectedItemsLeft();
219
264
void alignSelectedItemsHCenter();
@@ -222,13 +267,25 @@ class QgsComposition : QGraphicsScene
222
267
void alignSelectedItemsVCenter();
223
268
void alignSelectedItemsBottom();
224
269
270
+ //functions to lock and unlock items
271
+ /**Lock the selected items*/
272
+ void lockSelectedItems();
273
+ /**Unlock all items*/
274
+ void unlockAllItems();
275
+
225
276
/**Sorts the zList. The only time where this function needs to be called is from QgsComposer
226
277
after reading all the items from xml file*/
227
278
void sortZList();
228
279
229
280
/**Snaps a scene coordinate point to grid*/
230
281
QPointF snapPointToGrid( const QPointF& scenePoint ) const;
231
282
283
+ /**Returns pointer to snap lines collection*/
284
+ QList< QGraphicsLineItem* >* snapLines();
285
+
286
+ /**Returns pointer to selection handles*/
287
+ // QgsComposerMouseHandles* selectionHandles();
288
+
232
289
/**Add a custom snap line (can be horizontal or vertical)*/
233
290
QGraphicsLineItem* addSnapLine();
234
291
/**Remove custom snap line (and delete the object)*/
@@ -237,10 +294,6 @@ class QgsComposition : QGraphicsScene
237
294
* @note not available in python bindings
238
295
*/
239
296
// QGraphicsLineItem* nearestSnapLine( bool horizontal, double x, double y, double tolerance, QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > >& snappedItems );
240
- /**Hides / shows custom snap lines*/
241
- void setSnapLinesVisible( bool visible );
242
- /**Returns visibility of custom snap lines*/
243
- bool snapLinesVisible() const;
244
297
245
298
/**Allocates new item command and saves initial state in it
246
299
@param item target item
@@ -286,6 +339,10 @@ class QgsComposition : QGraphicsScene
286
339
/**Convenience function to create a QgsAddRemoveItemCommand, connect its signals and push it to the undo stack*/
287
340
void pushAddRemoveCommand( QgsComposerItem* item, const QString& text, QgsAddRemoveItemCommand::State state = QgsAddRemoveItemCommand::Added );
288
341
342
+ /**If true, prevents any mouse cursor changes by the composition or by any composer items
343
+ Used by QgsComposer and QgsComposerView to prevent unwanted cursor changes*/
344
+ void setPreventCursorChange( bool preventChange );
345
+ bool preventCursorChange();
289
346
290
347
//printing
291
348
@@ -314,7 +371,12 @@ class QgsComposition : QGraphicsScene
314
371
void computeWorldFileParameters( double& a, double& b, double& c, double& d, double& e, double& f ) const;
315
372
316
373
QgsAtlasComposition& atlasComposition();
317
-
374
+
375
+ /**Resizes a QRectF relative to the change from boundsBefore to boundsAfter*/
376
+ static void relativeResizeRect( QRectF& rectToResize, const QRectF& boundsBefore, const QRectF& boundsAfter );
377
+ /**Returns a scaled position given a before and after range*/
378
+ static double relativePosition( double position, double beforeMin, double beforeMax, double afterMin, double afterMax );
379
+
318
380
/** Returns the current atlas mode of the composition */
319
381
QgsComposition::AtlasMode atlasMode() const;
320
382
/** Sets the current atlas mode of the composition. Returns false if the mode could not be changed. */
0 commit comments