QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
processing
models
qgsmodelsnapper.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmodelsnapper.h
3
-------------------
4
begin : March 2020
5
copyright : (C) 2020 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
/***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
#ifndef QGSMODELSNAPPER_H
17
#define QGSMODELSNAPPER_H
18
19
#include "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
22
#include <QPen>
23
24
#define SIP_NO_FILE
25
33
class
GUI_EXPORT
QgsModelSnapper
34
{
35
public
:
39
QgsModelSnapper
();
40
45
void
setSnapTolerance
(
int
snapTolerance
);
46
51
int
snapTolerance
()
const
{
return
mTolerance; }
52
57
bool
snapToGrid
()
const
{
return
mSnapToGrid; }
58
63
void
setSnapToGrid(
bool
enabled );
64
81
QPointF snapPoint( QPointF point,
double
scaleFactor,
bool
&snapped
SIP_OUT
,
bool
snapHorizontal =
true
,
bool
snapVertical =
true
)
const
;
82
102
QRectF snapRect(
const
QRectF &rect,
double
scaleFactor,
bool
&snapped
SIP_OUT
,
bool
snapHorizontal =
true
,
bool
snapVertical =
true
)
const
;
103
120
QRectF snapRectWithResize(
const
QRectF &rect,
double
scaleFactor,
bool
&snapped
SIP_OUT
,
bool
snapHorizontal =
true
,
bool
snapVertical =
true
)
const
;
121
136
QPointF snapPointToGrid( QPointF point,
double
scaleFactor,
bool
&snappedX
SIP_OUT
,
bool
&snappedY
SIP_OUT
)
const
;
137
153
QPointF snapPointsToGrid(
const
QList<QPointF> &points,
double
scaleFactor,
bool
&snappedX
SIP_OUT
,
bool
&snappedY
SIP_OUT
)
const
;
154
155
private
:
156
int
mTolerance = 5;
157
bool
mSnapToGrid =
false
;
158
};
159
160
#endif
//QGSMODELSNAPPER_H
QgsModelSnapper::snapTolerance
int snapTolerance() const
Returns the snap tolerance (in pixels) to use when snapping.
Definition
qgsmodelsnapper.h:51
QgsModelSnapper::setSnapTolerance
void setSnapTolerance(int snapTolerance)
Sets the snap tolerance (in pixels) to use when snapping.
Definition
qgsmodelsnapper.cpp:33
QgsModelSnapper::QgsModelSnapper
QgsModelSnapper()
Constructor for QgsModelSnapper, attached to the specified layout.
Definition
qgsmodelsnapper.cpp:27
QgsModelSnapper::snapToGrid
bool snapToGrid() const
Returns true if snapping to grid is enabled.
Definition
qgsmodelsnapper.h:57
qgis_sip.h
SIP_OUT
#define SIP_OUT
Definition
qgis_sip.h:57
Generated on
for QGIS API Documentation by
1.17.0