QGIS API Documentation
3.41.0-Master (d5b93354e9c)
Loading...
Searching...
No Matches
src
gui
qgssnaptogridcanvasitem.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgssnaptogridcanvasitem.h
3
----------------------
4
begin : August 2018
5
copyright : (C) Matthias Kuhn
6
email :
[email protected]
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSSNAPTOGRIDCANVASITEM_H
17
#define QGSSNAPTOGRIDCANVASITEM_H
18
19
#include <QObject>
20
#include <QPen>
21
22
#include "
qgscoordinatereferencesystem.h
"
23
#include "
qgsmapcanvasitem.h
"
24
#include "
qgscoordinatetransform.h
"
25
26
#ifdef SIP_RUN
27
//%ModuleHeaderCode
28
// For ConvertToSubClassCode.
29
#include <
qgssnaptogridcanvasitem.h
>
30
//%End
31
#endif
32
40
#ifndef SIP_RUN
41
class
GUI_EXPORT
QgsSnapToGridCanvasItem
:
public
QObject,
public
QgsMapCanvasItem
42
{
43
#else
44
class
GUI_EXPORT
QgsSnapToGridCanvasItem
:
public
QgsMapCanvasItem
45
{
46
#endif
47
48
Q_OBJECT
49
50
#ifdef SIP_RUN
51
SIP_CONVERT_TO_SUBCLASS_CODE
52
if
(
dynamic_cast<
QgsSnapToGridCanvasItem
*
>
( sipCpp ) )
53
{
54
sipType = sipType_QgsSnapToGridCanvasItem;
55
// We need to tweak the pointer as sip believes it is single inheritance
56
// from QgsMapCanvasItem, but the raw address of QgsSnapToGridCanvasItem (sipCpp)
57
// is actually a QObject
58
*sipCppRet =
dynamic_cast<
QgsSnapToGridCanvasItem
*
>
( sipCpp );
59
}
60
else
61
sipType =
nullptr
;
62
SIP_END
63
#endif
64
65
public
:
69
QgsSnapToGridCanvasItem
(
QgsMapCanvas
*mapCanvas
SIP_TRANSFERTHIS
);
70
71
void
paint( QPainter *painter )
override
;
72
78
QgsPointXY
point()
const
;
79
85
void
setPoint(
const
QgsPointXY
&point );
86
91
double
precision
()
const
;
92
97
void
setPrecision(
double
precision
);
98
104
QgsCoordinateReferenceSystem
crs
()
const
;
105
111
void
setCrs(
const
QgsCoordinateReferenceSystem
&
crs
);
112
116
bool
enabled()
const
;
117
121
void
setEnabled(
bool
enabled );
122
123
private
slots:
124
void
updateMapCanvasCrs();
125
126
void
updateZoomFactor();
127
128
private
:
129
QPen mGridPen = QPen( QColor( 127, 127, 127, 150 ) );
130
QPen mCurrentPointPen = QPen( QColor( 200, 200, 200, 150 ) );
131
132
bool
mEnabled =
true
;
133
bool
mAvailableByZoomFactor =
false
;
134
135
double
mPrecision = 0.0;
136
QgsCoordinateTransform
mTransform;
137
QgsPointXY
mPoint;
138
};
139
140
#endif
// QGSSNAPTOGRIDCANVASITEM_H
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:212
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition
qgscoordinatetransform.h:58
QgsMapCanvasItem
An abstract class for items that can be placed on the map canvas.
Definition
qgsmapcanvasitem.h:34
QgsMapCanvas
Map canvas is a class for displaying all GIS data types on a canvas.
Definition
qgsmapcanvas.h:93
QgsPointXY
A class to represent a 2D point.
Definition
qgspointxy.h:60
QgsSnapToGridCanvasItem
Shows a grid on the map canvas given a spatial resolution.
Definition
qgssnaptogridcanvasitem.h:42
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition
qgis_sip.h:191
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:53
SIP_END
#define SIP_END
Definition
qgis_sip.h:208
qgscoordinatereferencesystem.h
qgscoordinatetransform.h
qgsmapcanvasitem.h
qgssnaptogridcanvasitem.h
crs
const QgsCoordinateReferenceSystem & crs
Definition
qgswfsgetfeature.cpp:53
precision
int precision
Definition
qgswfsgetfeature.cpp:51
Generated on Sat Dec 7 2024 03:46:51 for QGIS API Documentation by
1.9.8