1 /***************************************************************************
2                          qgsdxpaintdevice.h
3                          ------------------
4     begin                : November 2013
5     copyright            : (C) 2013 by Marco Hugentobler
6     email                : marco at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 #ifndef QGSDXFPAINTDEVICE_H
19 #define QGSDXFPAINTDEVICE_H
20 
21 #define SIP_NO_FILE
22 
23 #include <QPaintDevice>
24 
25 #include "qgis_core.h"
26 
27 class QgsDxfPaintEngine;
28 class QgsDxfExport;
29 class QPaintEngine;
30 
31 /**
32  * \ingroup core
33  * \brief A paint device for drawing into dxf files.
34  * \note not available in Python bindings
35 */
36 
37 class CORE_EXPORT QgsDxfPaintDevice: public QPaintDevice
38 {
39   public:
40     QgsDxfPaintDevice( QgsDxfExport *dxf );
41     ~QgsDxfPaintDevice() override;
42 
43     QPaintEngine *paintEngine() const override;
44 
setDrawingSize(QSizeF size)45     void setDrawingSize( QSizeF size ) { mDrawingSize = size; }
setOutputSize(const QRectF & r)46     void setOutputSize( const QRectF &r ) { mRectangle = r; }
47 
48     //! Returns scale factor for line width
49     double widthScaleFactor() const;
50 
51     //! Converts a point from device coordinates to dxf coordinates
52     QPointF dxfCoordinates( QPointF pt ) const;
53 
54     /*int height() const { return mDrawingSize.height(); }
55     int width() const { return mDrawingSize.width(); }*/
56 
57     int metric( PaintDeviceMetric metric ) const override;
58 
59     void setLayer( const QString &layer );
60 
61     void setShift( QPointF shift );
62 
63 
64   private:
65     QgsDxfPaintEngine *mPaintEngine = nullptr;
66 
67     QSizeF mDrawingSize; //size (in source coordinates)
68     QRectF mRectangle; //size (in dxf coordinates)
69 };
70 
71 #endif // QGSDXFPAINTDEVICE_H
72