QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
georeferencing
qgsgcppoint.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsgcppoint.h
3
--------------------------------------
4
Date : February 2022
5
Copyright : (C) 2022 by Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
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
#include "
qgsgcppoint.h
"
16
17
#include "
qgscoordinatereferencesystem.h
"
18
#include "
qgscoordinatetransform.h
"
19
#include "
qgsexception.h
"
20
#include "
qgslogger.h
"
21
22
#include <QString>
23
24
using namespace
Qt::StringLiterals;
25
26
QgsGcpPoint::QgsGcpPoint
(
const
QgsPointXY
&
sourcePoint
,
const
QgsPointXY
&
destinationPoint
,
const
QgsCoordinateReferenceSystem
&
destinationPointCrs
,
bool
enabled )
27
: mSourcePoint(
sourcePoint
)
28
, mDestinationPoint(
destinationPoint
)
29
, mDestinationCrs(
destinationPointCrs
)
30
, mEnabled( enabled )
31
{}
32
33
QgsCoordinateReferenceSystem
QgsGcpPoint::destinationPointCrs
()
const
34
{
35
return
mDestinationCrs;
36
}
37
38
void
QgsGcpPoint::setDestinationPointCrs
(
const
QgsCoordinateReferenceSystem
&crs )
39
{
40
mDestinationCrs = crs;
41
}
42
43
QgsPointXY
QgsGcpPoint::transformedDestinationPoint
(
const
QgsCoordinateReferenceSystem
&targetCrs,
const
QgsCoordinateTransformContext
&context )
const
44
{
45
const
QgsCoordinateTransform
transform( mDestinationCrs, targetCrs, context );
46
try
47
{
48
return
transform.
transform
( mDestinationPoint );
49
}
50
catch
(
QgsCsException
& )
51
{
52
QgsDebugError
( u
"Error transforming destination point"
_s );
53
return
mDestinationPoint;
54
}
55
}
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsCoordinateTransform
Handles coordinate transforms between two coordinate systems.
Definition
qgscoordinatetransform.h:63
QgsCoordinateTransform::transform
QgsPointXY transform(const QgsPointXY &point, Qgis::TransformDirection direction=Qgis::TransformDirection::Forward) const
Transform the point from the source CRS to the destination CRS.
Definition
qgscoordinatetransform.cpp:304
QgsCsException
Custom exception class for Coordinate Reference System related exceptions.
Definition
qgsexception.h:60
QgsGcpPoint::QgsGcpPoint
QgsGcpPoint(const QgsPointXY &sourcePoint, const QgsPointXY &destinationPoint, const QgsCoordinateReferenceSystem &destinationPointCrs, bool enabled=true)
Constructor for QgsGcpPoint.
Definition
qgsgcppoint.cpp:26
QgsGcpPoint::transformedDestinationPoint
QgsPointXY transformedDestinationPoint(const QgsCoordinateReferenceSystem &targetCrs, const QgsCoordinateTransformContext &context) const
Returns the destinationPoint() transformed to the given target CRS.
Definition
qgsgcppoint.cpp:43
QgsGcpPoint::setDestinationPointCrs
void setDestinationPointCrs(const QgsCoordinateReferenceSystem &crs)
Sets the crs of the destination point.
Definition
qgsgcppoint.cpp:38
QgsGcpPoint::destinationPointCrs
QgsCoordinateReferenceSystem destinationPointCrs() const
Returns the CRS of the destination point.
Definition
qgsgcppoint.cpp:33
QgsGcpPoint::sourcePoint
QgsPointXY sourcePoint() const
Returns the source coordinates.
Definition
qgsgcppoint.h:57
QgsGcpPoint::destinationPoint
QgsPointXY destinationPoint() const
Returns the destination coordinates.
Definition
qgsgcppoint.h:73
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
qgscoordinatereferencesystem.h
qgscoordinatetransform.h
qgsexception.h
qgsgcppoint.h
qgslogger.h
QgsDebugError
#define QgsDebugError(str)
Definition
qgslogger.h:71
Generated on
for QGIS API Documentation by
1.17.0