QGIS API Documentation
3.14.0-Pi (9f7028fd23)
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
w
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
z
Variables
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
c
e
f
g
h
k
l
m
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Related Functions
a
c
d
e
f
g
i
l
m
n
o
p
q
r
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
l
n
o
p
q
r
s
t
u
w
Typedefs
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
Enumerator
Macros
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
w
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
src
quickgui
qgsquickmaptransform.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsquickmaptransform.cpp
3
--------------------------------------
4
Date : 27.12.2014
5
Copyright : (C) 2014 by Matthias Kuhn
6
Email : matthias (at) opengis.ch
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
#include "
qgsquickmaptransform.h
"
17
#include "
qgsquickmapsettings.h
"
18
19
void
QgsQuickMapTransform::applyTo
( QMatrix4x4 *matrix )
const
20
{
21
*matrix *= mMatrix;
22
matrix->optimize();
23
}
24
25
QgsQuickMapSettings
*
QgsQuickMapTransform::mapSettings
()
const
26
{
27
return
mMapSettings;
28
}
29
30
void
QgsQuickMapTransform::setMapSettings
(
QgsQuickMapSettings
*mapSettings )
31
{
32
if
(
mapSettings
== mMapSettings )
33
return
;
34
35
if
( mMapSettings )
36
disconnect( mMapSettings, &
QgsQuickMapSettings::visibleExtentChanged
,
this
, &QgsQuickMapTransform::updateMatrix );
37
38
mMapSettings =
mapSettings
;
39
40
if
( mMapSettings )
41
connect( mMapSettings, &
QgsQuickMapSettings::visibleExtentChanged
,
this
, &QgsQuickMapTransform::updateMatrix );
42
43
updateMatrix();
44
45
emit
mapSettingsChanged
();
46
}
47
48
void
QgsQuickMapTransform::updateMatrix()
49
{
50
QMatrix4x4 matrix;
51
float
scaleFactor =
static_cast<
float
>
( 1.0 / mMapSettings->
mapUnitsPerPixel
() );
52
53
matrix.scale( scaleFactor, -scaleFactor );
54
matrix.translate(
static_cast<
float
>
( -mMapSettings->
visibleExtent
().
xMinimum
( ) ),
55
static_cast<
float
>
( -mMapSettings->
visibleExtent
().
yMaximum
() ) );
56
57
mMatrix = matrix;
58
update();
59
}
QgsQuickMapSettings::visibleExtent
QgsRectangle visibleExtent
Returns the actual extent derived from requested extent that takes takes output image size into accou...
Definition:
qgsquickmapsettings.h:69
QgsQuickMapSettings::mapUnitsPerPixel
double mapUnitsPerPixel
Returns the distance in geographical coordinates that equals to one pixel in the map.
Definition:
qgsquickmapsettings.h:71
QgsQuickMapTransform::setMapSettings
void setMapSettings(QgsQuickMapSettings *mapSettings)
Associated map settings.
Definition:
qgsquickmaptransform.cpp:30
QgsQuickMapTransform::mapSettingsChanged
void mapSettingsChanged()
Associated map settings.
qgsquickmaptransform.h
QgsQuickMapSettings
Definition:
qgsquickmapsettings.h:46
QgsRectangle::yMaximum
double yMaximum() const
Returns the y maximum value (top side of rectangle).
Definition:
qgsrectangle.h:172
QgsQuickMapTransform::applyTo
void applyTo(QMatrix4x4 *matrix) const
Applies transformation based on current map settings to a matrix.
Definition:
qgsquickmaptransform.cpp:19
QgsQuickMapTransform::mapSettings
QgsQuickMapSettings mapSettings
Associated map settings.
Definition:
qgsquickmaptransform.h:44
qgsquickmapsettings.h
QgsQuickMapSettings::visibleExtentChanged
void visibleExtentChanged()
Returns the actual extent derived from requested extent that takes takes output image size into accou...
QgsRectangle::xMinimum
double xMinimum() const
Returns the x minimum value (left side of rectangle).
Definition:
qgsrectangle.h:167
Generated on Mon Jun 22 2020 05:14:09 for QGIS API Documentation by
1.8.17