Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump julianwachholz/flake8-action from 2.0.0 to 2.0.2 #3

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Run flake8
uses: julianwachholz/flake8-action@v2.0.0
uses: julianwachholz/flake8-action@v2.0.2
with:
checkName: 'Python Lint'
env:
Expand Down
5 changes: 5 additions & 0 deletions python/core/auto_additions/qgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,8 @@
Qgis.AnnotationItemFlag.__doc__ = 'Flags for annotation items.\n\n.. versionadded:: 3.22\n\n' + '* ``ScaleDependentBoundingBox``: ' + Qgis.AnnotationItemFlag.ScaleDependentBoundingBox.__doc__
# --
Qgis.AnnotationItemFlag.baseClass = Qgis
# monkey patching scoped based enum
Qgis.AnnotationItemNodeType.VertexHandle.__doc__ = "Node is a handle for manipulating vertices"
Qgis.AnnotationItemNodeType.__doc__ = 'Annotation item node types.\n\n.. versionadded:: 3.22\n\n' + '* ``VertexHandle``: ' + Qgis.AnnotationItemNodeType.VertexHandle.__doc__
# --
Qgis.AnnotationItemNodeType.baseClass = Qgis
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ Sets the item's z ``index``, which controls the order in which annotation items
are rendered in the layer.

.. seealso:: :py:func:`zIndex`
%End

virtual QList< QgsAnnotationItemNode > nodes() const;
%Docstring
Returns the nodes for the item, used for editing the item.

.. versionadded:: 3.22
%End

private:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/annotations/qgsannotationitemnode.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsAnnotationItemNode
{
%Docstring(signature="appended")
Contains information about a node used for editing an annotation item.

.. versionadded:: 3.22
%End

%TypeHeaderCode
#include "qgsannotationitemnode.h"
%End
public:

QgsAnnotationItemNode();
%Docstring
Default constructor
%End

QgsAnnotationItemNode( const QgsPointXY &point, Qgis::AnnotationItemNodeType type );
%Docstring
Constructor for QgsAnnotationItemNode, with the specified ``point`` and ``type``.
%End

QgsPointXY point() const;
%Docstring
Returns the node's position, in geographic coordinates.

The coordinates will match the annotation item's CRS.

.. seealso:: :py:func:`setPoint`
%End

void setPoint( QgsPointXY point );
%Docstring
Sets the node's position, in geographic coordinates.

The coordinates will match the annotation item's CRS.

.. seealso:: :py:func:`point`
%End

Qgis::AnnotationItemNodeType type() const;
%Docstring
Returns the node type.

.. seealso:: :py:func:`setType`
%End

void setType( Qgis::AnnotationItemNodeType type );
%Docstring
Sets the node type.

.. seealso:: :py:func:`type`
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/annotations/qgsannotationitemnode.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Constructor for QgsAnnotationLineItem, with the specified ``linestring``.

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;


static QgsAnnotationLineItem *create() /Factory/;
%Docstring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Creates a new text at point annotation item.

virtual QgsRectangle boundingBox( const QgsRenderContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;


QgsPointXY point() const;
%Docstring
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Constructor for QgsAnnotationPolygonItem, with the specified ``polygon`` geometr

virtual bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;

virtual QList< QgsAnnotationItemNode > nodes() const;


static QgsAnnotationPolygonItem *create() /Factory/;
%Docstring
Expand Down
5 changes: 5 additions & 0 deletions python/core/auto_generated/qgis.sip.in
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,11 @@ The development version
typedef QFlags<Qgis::AnnotationItemFlag> AnnotationItemFlags;


enum class AnnotationItemNodeType
{
VertexHandle,
};

static const double DEFAULT_SEARCH_RADIUS_MM;

static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
Expand Down
1 change: 1 addition & 0 deletions python/core/core_auto.sip
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
%Include auto_generated/./3d/qgsabstract3drenderer.sip
%Include auto_generated/annotations/qgsannotation.sip
%Include auto_generated/annotations/qgsannotationitem.sip
%Include auto_generated/annotations/qgsannotationitemnode.sip
%Include auto_generated/annotations/qgsannotationitemregistry.sip
%Include auto_generated/annotations/qgsannotationlayer.sip
%Include auto_generated/annotations/qgsannotationlineitem.sip
Expand Down
1 change: 1 addition & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,7 @@ set(QGIS_CORE_HDRS

annotations/qgsannotation.h
annotations/qgsannotationitem.h
annotations/qgsannotationitemnode.h
annotations/qgsannotationitemregistry.h
annotations/qgsannotationlayer.h
annotations/qgsannotationlayerrenderer.h
Expand Down
6 changes: 6 additions & 0 deletions src/core/annotations/qgsannotationitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
***************************************************************************/

#include "qgsannotationitem.h"
#include "qgsannotationitemnode.h"

Qgis::AnnotationItemFlags QgsAnnotationItem::flags() const
{
return Qgis::AnnotationItemFlags();
}

QList<QgsAnnotationItemNode> QgsAnnotationItem::nodes() const
{
return {};
}
8 changes: 8 additions & 0 deletions src/core/annotations/qgsannotationitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class QgsFeedback;
class QgsMarkerSymbol;
class QgsLineSymbol;
class QgsFillSymbol;
class QgsAnnotationItemNode;

/**
* \ingroup core
Expand Down Expand Up @@ -140,6 +141,13 @@ class CORE_EXPORT QgsAnnotationItem
*/
void setZIndex( int index ) { mZIndex = index; }

/**
* Returns the nodes for the item, used for editing the item.
*
* \since QGIS 3.22
*/
virtual QList< QgsAnnotationItemNode > nodes() const;

private:

int mZIndex = 0;
Expand Down
86 changes: 86 additions & 0 deletions src/core/annotations/qgsannotationitemnode.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/***************************************************************************
qgsannotationitemnode.h
----------------
copyright : (C) 2021 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

#ifndef QGSANNOTATIONITEMEDITNODE_H
#define QGSANNOTATIONITEMEDITNODE_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include "qgspointxy.h"
#include "qgis.h"

/**
* \ingroup core
* \brief Contains information about a node used for editing an annotation item.
* \since QGIS 3.22
*/
class CORE_EXPORT QgsAnnotationItemNode
{
public:

/**
* Default constructor
*/
QgsAnnotationItemNode() = default;

/**
* Constructor for QgsAnnotationItemNode, with the specified \a point and \a type.
*/
QgsAnnotationItemNode( const QgsPointXY &point, Qgis::AnnotationItemNodeType type )
: mPoint( point )
, mType( type )
{}

/**
* Returns the node's position, in geographic coordinates.
*
* The coordinates will match the annotation item's CRS.
*
* \see setPoint()
*/
QgsPointXY point() const { return mPoint; }

/**
* Sets the node's position, in geographic coordinates.
*
* The coordinates will match the annotation item's CRS.
*
* \see point()
*/
void setPoint( QgsPointXY point ) { mPoint = point; }

/**
* Returns the node type.
*
* \see setType()
*/
Qgis::AnnotationItemNodeType type() const { return mType; }

/**
* Sets the node type.
*
* \see type()
*/
void setType( Qgis::AnnotationItemNodeType type ) { mType = type; }

private:

QgsPointXY mPoint;
Qgis::AnnotationItemNodeType mType = Qgis::AnnotationItemNodeType::VertexHandle;

};

#endif // QGSANNOTATIONITEMEDITNODE_H
11 changes: 11 additions & 0 deletions src/core/annotations/qgsannotationlineitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgssymbol.h"
#include "qgssymbollayerutils.h"
#include "qgslinesymbol.h"
#include "qgsannotationitemnode.h"

QgsAnnotationLineItem::QgsAnnotationLineItem( QgsCurve *curve )
: QgsAnnotationItem()
Expand Down Expand Up @@ -80,6 +81,16 @@ bool QgsAnnotationLineItem::writeXml( QDomElement &element, QDomDocument &docume
return true;
}

QList<QgsAnnotationItemNode> QgsAnnotationLineItem::nodes() const
{
QList< QgsAnnotationItemNode > res;
for ( auto it = mCurve->vertices_begin(); it != mCurve->vertices_end(); ++it )
{
res.append( QgsAnnotationItemNode( QgsPointXY( ( *it ).x(), ( *it ).y() ), Qgis::AnnotationItemNodeType::VertexHandle ) );
}
return res;
}

QgsAnnotationLineItem *QgsAnnotationLineItem::create()
{
return new QgsAnnotationLineItem( new QgsLineString() );
Expand Down
1 change: 1 addition & 0 deletions src/core/annotations/qgsannotationlineitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class CORE_EXPORT QgsAnnotationLineItem : public QgsAnnotationItem
QString type() const override;
void render( QgsRenderContext &context, QgsFeedback *feedback ) override;
bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
QList< QgsAnnotationItemNode > nodes() const override;

/**
* Creates a new linestring annotation item.
Expand Down
6 changes: 6 additions & 0 deletions src/core/annotations/qgsannotationmarkeritem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "qgssymbol.h"
#include "qgssymbollayerutils.h"
#include "qgsmarkersymbol.h"
#include "qgsannotationitemnode.h"

QgsAnnotationMarkerItem::QgsAnnotationMarkerItem( const QgsPoint &point )
: QgsAnnotationItem()
Expand Down Expand Up @@ -67,6 +68,11 @@ bool QgsAnnotationMarkerItem::writeXml( QDomElement &element, QDomDocument &docu
return true;
}

QList<QgsAnnotationItemNode> QgsAnnotationMarkerItem::nodes() const
{
return { QgsAnnotationItemNode( mPoint, Qgis::AnnotationItemNodeType::VertexHandle )};
}

QgsAnnotationMarkerItem *QgsAnnotationMarkerItem::create()
{
return new QgsAnnotationMarkerItem( QgsPoint() );
Expand Down
1 change: 1 addition & 0 deletions src/core/annotations/qgsannotationmarkeritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class CORE_EXPORT QgsAnnotationMarkerItem : public QgsAnnotationItem
QString type() const override;
void render( QgsRenderContext &context, QgsFeedback *feedback ) override;
bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
QList< QgsAnnotationItemNode > nodes() const override;

/**
* Creates a new marker annotation item.
Expand Down
6 changes: 6 additions & 0 deletions src/core/annotations/qgsannotationpointtextitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

#include "qgsannotationpointtextitem.h"
#include "qgstextrenderer.h"
#include "qgsannotationitemnode.h"

QgsAnnotationPointTextItem::QgsAnnotationPointTextItem( const QString &text, QgsPointXY point )
: QgsAnnotationItem()
Expand Down Expand Up @@ -128,6 +129,11 @@ QgsRectangle QgsAnnotationPointTextItem::boundingBox( const QgsRenderContext &co
return QgsRectangle( mPoint.x(), mPoint.y(), mPoint.x() + widthInMapUnits, mPoint.y() + heightInMapUnits );
}

QList<QgsAnnotationItemNode> QgsAnnotationPointTextItem::nodes() const
{
return { QgsAnnotationItemNode( mPoint, Qgis::AnnotationItemNodeType::VertexHandle )};
}

QgsTextFormat QgsAnnotationPointTextItem::format() const
{
return mTextFormat;
Expand Down
1 change: 1 addition & 0 deletions src/core/annotations/qgsannotationpointtextitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class CORE_EXPORT QgsAnnotationPointTextItem : public QgsAnnotationItem
QgsAnnotationPointTextItem *clone() override SIP_FACTORY;
QgsRectangle boundingBox() const override;
QgsRectangle boundingBox( const QgsRenderContext &context ) const override;
QList< QgsAnnotationItemNode > nodes() const override;

/**
* Returns the point location of the text.
Expand Down
Loading