QGIS API Documentation  3.6.0-Noosa (5873452)
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 
97 
100  };
101 
107  static QgsCadUtils::AlignMapPointOutput alignMapPoint( const QgsPointXY &originalMapPoint, const QgsCadUtils::AlignMapPointContext &ctx );
108 
109 };
110 
111 #endif // QGSCADUTILS_H
QgsCadUtils::AlignMapPointConstraint yConstraint
Constraint for Y coordinate.
Definition: qgscadutils.h:64
Structure with details of one constraint.
Definition: qgscadutils.h:37
A class to represent a 2D point.
Definition: qgspointxy.h:43
QgsPointLocator::Match edgeMatch
Snapped segment - only valid if actually used for something.
Definition: qgscadutils.h:96
bool locked
Whether the constraint is active, i.e. should be considered.
Definition: qgscadutils.h:46
QgsCadUtils::AlignMapPointConstraint distanceConstraint
Constraint for distance.
Definition: qgscadutils.h:66
#define SIP_SKIP
Definition: qgis_sip.h:119
Structure defining all constraints for alignMapPoint() method.
Definition: qgscadutils.h:54
AlignMapPointConstraint(bool locked=false, bool relative=false, double value=0)
Definition: qgscadutils.h:39
QgsCadUtils::AlignMapPointConstraint commonAngleConstraint
Constraint for soft lock to a common angle.
Definition: qgscadutils.h:70
QgsPointXY finalMapPoint
map point aligned according to the constraints
Definition: qgscadutils.h:93
double value
Numeric value of the constraint (coordinate/distance in map units or angle in degrees) ...
Definition: qgscadutils.h:50
double softLockCommonAngle
Angle (in degrees) to which we have soft-locked ourselves (if not set it is -1)
Definition: qgscadutils.h:99
Structure returned from alignMapPoint() method.
Definition: qgscadutils.h:87
double mapUnitsPerPixel
Map units/pixel ratio from map canvas. Needed for.
Definition: qgscadutils.h:59
QgsCadUtils::AlignMapPointConstraint xConstraint
Constraint for X coordinate.
Definition: qgscadutils.h:62
QgsCadUtils::AlignMapPointConstraint angleConstraint
Constraint for angle.
Definition: qgscadutils.h:68
bool valid
Whether the combination of constraints is actually valid.
Definition: qgscadutils.h:90
This class has all the configuration of snapping and can return answers to snapping queries...
bool relative
Whether the value is relative to previous value.
Definition: qgscadutils.h:48
The QgsCadUtils class provides routines for CAD editing.
Definition: qgscadutils.h:32
QList< QgsPointXY > cadPointList
List of recent CAD points in map coordinates.
Definition: qgscadutils.h:77