2017-04-30 16:52:10 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgsadvanceddigitizingdockwidget.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsAdvancedDigitizingDockWidget : QgsDockWidget
|
2015-09-11 09:10:35 +02:00
|
|
|
{
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The QgsAdvancedDigitizingDockWidget class is a dockable widget
|
|
|
|
used to handle the CAD tools on top of a selection of map tools.
|
|
|
|
It handles both the UI and the constraints. Constraints are applied
|
|
|
|
by implementing filters called from QgsMapToolAdvancedDigitizing.
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
%TypeHeaderCode
|
2017-04-30 16:52:10 +02:00
|
|
|
#include "qgsadvanceddigitizingdockwidget.h"
|
2015-09-11 09:10:35 +02:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum CadCapacity
|
|
|
|
{
|
2017-04-30 16:52:10 +02:00
|
|
|
AbsoluteAngle,
|
|
|
|
RelativeAngle,
|
|
|
|
RelativeCoordinates,
|
2015-09-11 09:10:35 +02:00
|
|
|
};
|
2017-04-30 16:52:10 +02:00
|
|
|
typedef QFlags<QgsAdvancedDigitizingDockWidget::CadCapacity> CadCapacities;
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
enum AdditionalConstraint
|
|
|
|
{
|
2017-04-30 16:52:10 +02:00
|
|
|
NoConstraint,
|
|
|
|
Perpendicular,
|
|
|
|
Parallel
|
2015-09-11 09:10:35 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class CadConstraint
|
2017-04-30 16:52:10 +02:00
|
|
|
{
|
|
|
|
%Docstring
|
|
|
|
The CadConstraint is an abstract class for all basic constraints (angle/distance/x/y).
|
|
|
|
It contains all values (locked, value, relative) and pointers to corresponding widgets.
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
Relative is not mandatory since it is not used for distance.
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgsadvanceddigitizingdockwidget.h"
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
public:
|
2017-04-30 16:52:10 +02:00
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
enum LockMode
|
|
|
|
{
|
|
|
|
NoLock,
|
|
|
|
SoftLock,
|
|
|
|
HardLock
|
|
|
|
};
|
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
CadConstraint( QLineEdit *lineEdit, QToolButton *lockerButton, QToolButton *relativeButton = 0, QToolButton *repeatingLockButton = 0 );
|
|
|
|
%Docstring
|
|
|
|
Constructor for CadConstraint.
|
|
|
|
\param lineEdit associated line edit for constraint value
|
|
|
|
\param lockerButton associated button for locking constraint
|
|
|
|
\param relativeButton optional button for toggling relative constraint mode
|
|
|
|
\param repeatingLockButton optional button for toggling repeating lock mode
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
LockMode lockMode() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The current lock mode of this constraint
|
|
|
|
:return: Lock mode
|
|
|
|
:rtype: LockMode
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
bool isLocked() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Is any kind of lock mode enabled
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-05-02 17:28:06 +10:00
|
|
|
|
|
|
|
bool isRepeatingLock() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Returns true if a repeating lock is set for the constraint. Repeating locks are not
|
|
|
|
automatically cleared after a new point is added.
|
|
|
|
.. versionadded:: 2.16
|
|
|
|
.. seealso:: setRepeatingLock()
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-05-02 17:28:06 +10:00
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
bool relative() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Is the constraint in relative mode
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
double value() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The value of the constraint
|
|
|
|
:rtype: float
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
QLineEdit *lineEdit() const;
|
|
|
|
%Docstring
|
|
|
|
The line edit that manages the value of the constraint
|
|
|
|
:rtype: QLineEdit
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
void setLockMode( LockMode mode );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Set the lock mode
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2016-05-02 17:28:06 +10:00
|
|
|
void setRepeatingLock( bool repeating );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Sets whether a repeating lock is set for the constraint. Repeating locks are not
|
|
|
|
automatically cleared after a new point is added.
|
|
|
|
\param repeating set to true to set the lock to repeat automatically
|
|
|
|
.. versionadded:: 2.16
|
|
|
|
.. seealso:: isRepeatingLock()
|
|
|
|
%End
|
2016-05-02 17:28:06 +10:00
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
void setRelative( bool relative );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Set if the constraint should be treated relative
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2016-05-02 16:21:40 +10:00
|
|
|
void setValue( double value, bool updateWidget = true );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Set the value of the constraint
|
|
|
|
\param value new value for constraint
|
|
|
|
\param updateWidget set to false to prevent automatically updating the associated widget's value
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
void toggleLocked();
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Toggle lock mode
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
void toggleRelative();
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Toggle relative mode
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
};
|
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
explicit QgsAdvancedDigitizingDockWidget( QgsMapCanvas *canvas, QWidget *parent = 0 );
|
|
|
|
%Docstring
|
|
|
|
Create an advanced digitizing dock widget
|
|
|
|
\param canvas The map canvas on which the widget operates
|
|
|
|
\param parent The parent
|
|
|
|
%End
|
|
|
|
|
|
|
|
virtual void hideEvent( QHideEvent * );
|
|
|
|
|
|
|
|
%Docstring
|
|
|
|
Disables the CAD tools when hiding the dock
|
|
|
|
%End
|
|
|
|
|
2017-09-07 12:07:01 +02:00
|
|
|
bool canvasKeyPressEventFilter( QKeyEvent *e );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
2017-09-07 12:07:01 +02:00
|
|
|
Filter key events to e.g. toggle construction mode or adapt constraints
|
2017-04-30 16:52:10 +02:00
|
|
|
|
|
|
|
\param e A mouse event (may be modified)
|
|
|
|
:return: If the event is hidden (construction mode hides events from the maptool)
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
|
|
|
|
2017-09-07 12:07:01 +02:00
|
|
|
bool applyConstraints( QgsMapMouseEvent *e );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
apply the CAD constraints. The will modify the position of the map event in map coordinates by applying the CAD constraints.
|
|
|
|
:return: false if no solution was found (invalid constraints)
|
2017-04-30 16:52:10 +02:00
|
|
|
:rtype: bool
|
|
|
|
%End
|
|
|
|
|
2017-09-07 12:07:01 +02:00
|
|
|
bool alignToSegment( QgsMapMouseEvent *e, QgsAdvancedDigitizingDockWidget::CadConstraint::LockMode lockMode = QgsAdvancedDigitizingDockWidget::CadConstraint::HardLock );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
align to segment for additional constraint.
|
|
|
|
If additional constraints are used, this will determine the angle to be locked depending on the snapped segment.
|
2017-09-07 12:07:01 +02:00
|
|
|
.. versionadded:: 3.0
|
2017-04-30 16:52:10 +02:00
|
|
|
:rtype: bool
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-09-07 12:07:01 +02:00
|
|
|
void releaseLocks( bool releaseRepeatingLocks = true );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
unlock all constraints
|
|
|
|
\param releaseRepeatingLocks set to false to preserve the lock for any constraints set to repeating lock mode
|
2017-09-07 12:07:01 +02:00
|
|
|
.. versionadded:: 3.0
|
2017-04-30 16:52:10 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
void clear();
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Clear any cached previous clicks and helper lines
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
virtual void keyPressEvent( QKeyEvent *e );
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
bool cadEnabled() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
determines if CAD tools are enabled or if map tools behaves "nomally"
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
bool constructionMode() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
construction mode is used to draw intermediate points. These points won't be given any further (i.e. to the map tools)
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
AdditionalConstraint additionalConstraint() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Additional constraints are used to place perpendicular/parallel segments to snapped segments on the canvas
|
|
|
|
:rtype: AdditionalConstraint
|
|
|
|
%End
|
|
|
|
const CadConstraint *constraintAngle() const;
|
|
|
|
%Docstring
|
|
|
|
Constraint on the angle
|
|
|
|
:rtype: CadConstraint
|
|
|
|
%End
|
|
|
|
const CadConstraint *constraintDistance() const;
|
|
|
|
%Docstring
|
|
|
|
Constraint on the distance
|
|
|
|
:rtype: CadConstraint
|
|
|
|
%End
|
|
|
|
const CadConstraint *constraintX() const;
|
|
|
|
%Docstring
|
|
|
|
Constraint on the X coordinate
|
|
|
|
:rtype: CadConstraint
|
|
|
|
%End
|
|
|
|
const CadConstraint *constraintY() const;
|
|
|
|
%Docstring
|
|
|
|
Constraint on the Y coordinate
|
|
|
|
:rtype: CadConstraint
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
bool commonAngleConstraint() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Constraint on a common angle
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
|
|
|
|
2017-08-29 20:42:16 +02:00
|
|
|
void clearPoints();
|
|
|
|
%Docstring
|
|
|
|
Removes all points from the CAD point list
|
|
|
|
.. versionadded:: 3.0
|
2017-09-07 12:07:01 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
void addPoint( const QgsPointXY &point );
|
|
|
|
%Docstring
|
|
|
|
Adds point to the CAD point list
|
|
|
|
.. versionadded:: 3.0
|
2017-08-29 20:42:16 +02:00
|
|
|
%End
|
|
|
|
|
2017-08-29 19:38:18 +02:00
|
|
|
void setPoints( const QList<QgsPointXY> &points );
|
|
|
|
%Docstring
|
|
|
|
Configures list of current CAD points
|
|
|
|
|
|
|
|
Some map tools may find it useful to override list of CAD points that is otherwise
|
|
|
|
automatically populated when user clicks with left mouse button on map canvas.
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY currentPoint( bool *exists = 0 ) const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The last point.
|
|
|
|
Helper for the CAD point list. The CAD point list is the list of points
|
|
|
|
currently digitized. It contains both "normal" points and intermediate points (construction mode).
|
2017-06-01 12:18:43 +02:00
|
|
|
:rtype: QgsPointXY
|
2017-04-30 16:52:10 +02:00
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY previousPoint( bool *exists = 0 ) const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The previous point.
|
|
|
|
Helper for the CAD point list. The CAD point list is the list of points
|
|
|
|
currently digitized. It contains both "normal" points and intermediate points (construction mode).
|
2017-06-01 12:18:43 +02:00
|
|
|
:rtype: QgsPointXY
|
2017-04-30 16:52:10 +02:00
|
|
|
%End
|
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QgsPointXY penultimatePoint( bool *exists = 0 ) const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The penultimate point.
|
|
|
|
Helper for the CAD point list. The CAD point list is the list of points
|
|
|
|
currently digitized. It contains both "normal" points and intermediate points (construction mode).
|
2017-06-01 12:18:43 +02:00
|
|
|
:rtype: QgsPointXY
|
2017-04-30 16:52:10 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
int pointsCount() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
The number of points in the CAD point helper list
|
|
|
|
:rtype: int
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
bool snappedToVertex() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Is it snapped to a vertex
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2016-02-14 03:50:23 +01:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
QList<QgsPointXY> snappedSegment() const;
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Snapped to a segment
|
2017-06-01 12:18:43 +02:00
|
|
|
:rtype: list of QgsPointXY
|
2017-04-30 16:52:10 +02:00
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
QAction *enableAction();
|
|
|
|
%Docstring
|
|
|
|
return the action used to enable/disable the tools
|
|
|
|
:rtype: QAction
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
void enable();
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Enables the tool (call this when an appropriate map tool is set and in the condition to make use of
|
|
|
|
cad digitizing)
|
|
|
|
Normally done automatically from QgsMapToolAdvancedDigitizing.activate() but may need to be fine tuned
|
|
|
|
if the map tool depends on preconditions like a feature selection.
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
void disable();
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Disable the widget. Normally done automatically from QgsMapToolAdvancedDigitizing.deactivate().
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-09-07 12:07:01 +02:00
|
|
|
void updateCadPaintItem();
|
|
|
|
%Docstring
|
2017-10-05 11:51:04 +10:00
|
|
|
Updates canvas item that displays constraints on the ma
|
2017-09-07 12:07:01 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2015-09-11 09:10:35 +02:00
|
|
|
signals:
|
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
void pushWarning( const QString &message );
|
|
|
|
%Docstring
|
|
|
|
Push a warning
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
\param message An informative message
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
void popWarning();
|
|
|
|
%Docstring
|
|
|
|
Remove any previously emitted warnings (if any)
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-06-01 12:18:43 +02:00
|
|
|
void pointChanged( const QgsPointXY &point );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
Sometimes a constraint may change the current point out of a mouse event. This happens normally
|
|
|
|
when a constraint is toggled.
|
2015-09-11 09:10:35 +02:00
|
|
|
|
2017-04-30 16:52:10 +02:00
|
|
|
\param point The last known digitizing point. Can be used to emulate a mouse event.
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
|
|
|
|
private:
|
2017-04-30 16:52:10 +02:00
|
|
|
//! event filter for line edits in the dock UI (angle/distance/x/y line edits)
|
2015-09-11 09:10:35 +02:00
|
|
|
bool eventFilter( QObject *obj, QEvent *event );
|
2017-04-30 16:52:10 +02:00
|
|
|
%Docstring
|
|
|
|
:rtype: bool
|
|
|
|
%End
|
2015-09-11 09:10:35 +02:00
|
|
|
};
|
2017-04-30 16:52:10 +02:00
|
|
|
|
|
|
|
QFlags<QgsAdvancedDigitizingDockWidget::CadCapacity> operator|(QgsAdvancedDigitizingDockWidget::CadCapacity f1, QFlags<QgsAdvancedDigitizingDockWidget::CadCapacity> f2);
|
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgsadvanceddigitizingdockwidget.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|