QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgscadutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscadutils.h
3  -------------------
4  begin : September 2017
5  copyright : (C) 2017 by Martin Dobias
6  email : wonder dot sk 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 
17 #ifndef QGSCADUTILS_H
18 #define QGSCADUTILS_H
19 
20 #include "qgis_core.h"
21 
22 #include "qgspointlocator.h"
23 
24 class QgsSnappingUtils;
25 
32 class CORE_EXPORT QgsCadUtils
33 {
34  public:
35 
38  {
39  AlignMapPointConstraint( bool locked = false, bool relative = false, double value = 0 )
40  : locked( locked )
41  , relative( relative )
42  , value( value )
43  {}
44 
46  bool locked;
48  bool relative;
50  double value;
51  };
52 
55  {
57  QgsSnappingUtils *snappingUtils = nullptr;
60 
71 
77  QList<QgsPointXY> cadPointList;
78 
83  SIP_SKIP void dump() const;
84  };
85 
88  {
90  bool valid;
91 
94 
100 
106 
109  };
110 
116  static QgsCadUtils::AlignMapPointOutput alignMapPoint( const QgsPointXY &originalMapPoint, const QgsCadUtils::AlignMapPointContext &ctx );
117 
118 };
119 
120 #endif // QGSCADUTILS_H
The QgsCadUtils class provides routines for CAD editing.
Definition: qgscadutils.h:33
A class to represent a 2D point.
Definition: qgspointxy.h:59
This class has all the configuration of snapping and can return answers to snapping queries.
#define SIP_SKIP
Definition: qgis_sip.h:126
Structure with details of one constraint.
Definition: qgscadutils.h:38
AlignMapPointConstraint(bool locked=false, bool relative=false, double value=0)
Definition: qgscadutils.h:39
bool locked
Whether the constraint is active, i.e. should be considered.
Definition: qgscadutils.h:46
double value
Numeric value of the constraint (coordinate/distance in map units or angle in degrees)
Definition: qgscadutils.h:50
bool relative
Whether the value is relative to previous value.
Definition: qgscadutils.h:48
Structure defining all constraints for alignMapPoint() method.
Definition: qgscadutils.h:55
QgsCadUtils::AlignMapPointConstraint yConstraint
Constraint for Y coordinate.
Definition: qgscadutils.h:64
QgsCadUtils::AlignMapPointConstraint xConstraint
Constraint for X coordinate.
Definition: qgscadutils.h:62
double mapUnitsPerPixel
Map units/pixel ratio from map canvas. Needed for.
Definition: qgscadutils.h:59
QgsCadUtils::AlignMapPointConstraint distanceConstraint
Constraint for distance.
Definition: qgscadutils.h:66
QList< QgsPointXY > cadPointList
List of recent CAD points in map coordinates.
Definition: qgscadutils.h:77
QgsCadUtils::AlignMapPointConstraint commonAngleConstraint
Constraint for soft lock to a common angle.
Definition: qgscadutils.h:70
QgsCadUtils::AlignMapPointConstraint angleConstraint
Constraint for angle.
Definition: qgscadutils.h:68
Structure returned from alignMapPoint() method.
Definition: qgscadutils.h:88
QgsPointXY finalMapPoint
map point aligned according to the constraints
Definition: qgscadutils.h:93
bool valid
Whether the combination of constraints is actually valid.
Definition: qgscadutils.h:90
QgsPointLocator::Match snapMatch
Snapped point - only valid if actually used for something.
Definition: qgscadutils.h:99
QgsPointLocator::Match edgeMatch
Snapped segment - only valid if actually used for something.
Definition: qgscadutils.h:105
double softLockCommonAngle
Angle (in degrees) to which we have soft-locked ourselves (if not set it is -1)
Definition: qgscadutils.h:108