-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqgsdecorationscalebar.h
70 lines (56 loc) · 2.1 KB
/
qgsdecorationscalebar.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/***************************************************************************
plugin.cpp
Plugin to draw scale bar on map
Functions:
-------------------
begin : Jun 1, 2004
copyright : (C) 2004 by Peter Brewer
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSCALEBARPLUGIN
#define QGSCALEBARPLUGIN
#include "qgis.h"
#include "qgsdecorationitem.h"
class QPainter;
#include <QColor>
#include "qgis_app.h"
class APP_EXPORT QgsDecorationScaleBar: public QgsDecorationItem
{
Q_OBJECT
public:
//! Constructor
QgsDecorationScaleBar( QObject *parent = nullptr );
virtual ~ QgsDecorationScaleBar();
public slots:
//! set values on the gui when a project is read or the gui first loaded
void projectRead() override;
//! save values to the project
void saveToProject() override;
//! this does the meaty bit of the work
void render( QPainter * ) override;
//! Show the dialog box
void run() override;
private:
//! The size preferred size of the scale bar
int mPreferredSize;
//! Should we snap to integer times power of 10?
bool mSnapping;
//! Style of scale bar. An index and the translated text
int mStyleIndex;
QStringList mStyleLabels;
//! The scale bar color
QColor mColor;
//! Margin percentage values
int mMarginHorizontal;
int mMarginVertical;
friend class QgsDecorationScaleBarDialog;
};
#endif