~ubuntu-branches/ubuntu/trusty/qgis/trusty

« back to all changes in this revision

Viewing changes to python/core/qgscomposition.sip

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** \ingroup MapComposer
 
2
 * Graphics scene for map printing. The class manages the paper item which always
 
3
 * is the item in the back (z-value 0). It maintains the z-Values of the items and stores
 
4
 * them in a list in ascending z-Order. This list can be changed to lower/raise items one position
 
5
 * or to bring them to front/back.
 
6
 * */
 
7
class QgsComposition: QGraphicsScene
 
8
{
 
9
%TypeHeaderCode
 
10
#include <qgscomposition.h>
 
11
%End
 
12
  public:
 
13
 
 
14
    /** \brief Plot type */
 
15
    enum PlotStyle
 
16
    {
 
17
      Preview = 0, // Use cache etc
 
18
      Print,       // Render well
 
19
      Postscript   // Fonts need different scaling!
 
20
    };
 
21
 
 
22
    /**Style to draw the snapping grid*/
 
23
    enum GridStyle
 
24
    {
 
25
      Solid,
 
26
      Dots,
 
27
      Crosses
 
28
    };
 
29
 
 
30
    QgsComposition( QgsMapRenderer* mapRenderer );
 
31
    ~QgsComposition();
 
32
 
 
33
    /**Changes size of paper item*/
 
34
    void setPaperSize( double width, double height );
 
35
 
 
36
    /**Returns height of paper item*/
 
37
    double paperHeight() const;
 
38
 
 
39
    /**Returns width of paper item*/
 
40
    double paperWidth() const;
 
41
 
 
42
    void setSnapToGridEnabled( bool b );
 
43
    bool snapToGridEnabled() const;
 
44
 
 
45
    void setSnapGridResolution( double r );
 
46
    double snapGridResolution() const;
 
47
 
 
48
    void setSnapGridOffsetX( double offset );
 
49
    double snapGridOffsetX() const;
 
50
 
 
51
    void setSnapGridOffsetY( double offset );
 
52
    double snapGridOffsetY() const;
 
53
 
 
54
    void setGridPen( const QPen& p );
 
55
    const QPen& gridPen() const;
 
56
 
 
57
    void setGridStyle( GridStyle s );
 
58
    GridStyle gridStyle() const;
 
59
 
 
60
    /**Returns the topmose composer item. Ignores mPaperItem*/
 
61
    QgsComposerItem* composerItemAt( const QPointF & position );
 
62
 
 
63
    QList<QgsComposerItem*> selectedComposerItems();
 
64
 
 
65
    /**Returns pointers to all composer maps in the scene*/
 
66
    //todo: needs a new mapping for QList<const T*> ?
 
67
    //QList<const QgsComposerMap*> composerMapItems() const;
 
68
 
 
69
    /**Returns the composer map with specified id
 
70
     @return id or 0 pointer if the composer map item does not exist*/
 
71
    const QgsComposerMap* getComposerMapById( int id ) const;
 
72
 
 
73
    int printResolution() const;
 
74
    void setPrintResolution( int dpi );
 
75
 
 
76
    bool printAsRaster() const;
 
77
    void setPrintAsRaster(bool enabled);
 
78
 
 
79
    /**Returns pointer to map renderer of qgis map canvas*/
 
80
    QgsMapRenderer* mapRenderer();
 
81
 
 
82
    QgsComposition::PlotStyle plotStyle();
 
83
    void setPlotStyle( QgsComposition::PlotStyle style );
 
84
 
 
85
    /**Returns the pixel font size for a font that has point size set.
 
86
     The result depends on the resolution (dpi) and of the preview mode. Each item that sets
 
87
    a font should call this function before drawing text*/
 
88
    int pixelFontSize( double pointSize ) const;
 
89
 
 
90
    /**Does the inverse calculation and returns points for pixels (equals to mm in QgsComposition)*/
 
91
    double pointFontSize( int pixelSize ) const;
 
92
 
 
93
    /**Writes settings to xml (paper dimension)*/
 
94
    bool writeXML( QDomElement& composerElem, QDomDocument& doc );
 
95
 
 
96
    /**Reads settings from xml file*/
 
97
    bool readXML( const QDomElement& compositionElem, const QDomDocument& doc );
 
98
 
 
99
    /**Adds item to z list. Usually called from constructor of QgsComposerItem*/
 
100
    void addItemToZList( QgsComposerItem* item );
 
101
    /**Removes item from z list. Usually called from destructor of QgsComposerItem*/
 
102
    void removeItemFromZList( QgsComposerItem* item );
 
103
 
 
104
    //functions to move selected items in hierarchy
 
105
    void raiseSelectedItems();
 
106
    void raiseItem( QgsComposerItem* item );
 
107
    void lowerSelectedItems();
 
108
    void lowerItem( QgsComposerItem* item );
 
109
    void moveSelectedItemsToTop();
 
110
    void moveItemToTop( QgsComposerItem* item );
 
111
    void moveSelectedItemsToBottom();
 
112
    void moveItemToBottom( QgsComposerItem* item );
 
113
 
 
114
    //functions to align selected items
 
115
    void alignSelectedItemsLeft();
 
116
    void alignSelectedItemsHCenter();
 
117
    void alignSelectedItemsRight();
 
118
    void alignSelectedItemsTop();
 
119
    void alignSelectedItemsVCenter();
 
120
    void alignSelectedItemsBottom();
 
121
 
 
122
    /**Sorts the zList. The only time where this function needs to be called is from QgsComposer
 
123
     after reading all the items from xml file*/
 
124
    void sortZList();
 
125
 
 
126
    /**Snaps a scene coordinate point to grid*/
 
127
    QPointF snapPointToGrid( const QPointF& scenePoint ) const;
 
128
};