Skip to content
Permalink
Browse files
Add flag for scale dependent bounding boes
  • Loading branch information
nyalldawson committed Aug 31, 2021
1 parent 83a4415 commit b4acffbb313cea9a49effe4f5f53db5e7023da9f
@@ -651,3 +651,8 @@
Qgis.MapLayerProperty.__doc__ = 'Generic map layer properties.\n\n.. versionadded:: 3.22\n\n' + '* ``UsersCannotToggleEditing``: ' + Qgis.MapLayerProperty.UsersCannotToggleEditing.__doc__
# --
Qgis.MapLayerProperty.baseClass = Qgis
# monkey patching scoped based enum
Qgis.AnnotationItemFlag.ScaleDependentBoundingBox.__doc__ = "Item's bounding box will vary depending on map scale"
Qgis.AnnotationItemFlag.__doc__ = 'Flags for annotation items.\n\n.. versionadded:: 3.22\n\n' + '* ``ScaleDependentBoundingBox``: ' + Qgis.AnnotationItemFlag.ScaleDependentBoundingBox.__doc__
# --
Qgis.AnnotationItemFlag.baseClass = Qgis
@@ -53,6 +53,13 @@ Constructor for an annotation item.

virtual ~QgsAnnotationItem();

virtual Qgis::AnnotationItemFlags flags() const;
%Docstring
Returns item flags.

.. versionadded:: 3.22
%End

virtual QgsAnnotationItem *clone() = 0 /Factory/;
%Docstring
Returns a clone of the item. Ownership is transferred to the caller.
@@ -467,6 +467,13 @@ The development version
typedef QFlags<Qgis::MapLayerProperty> MapLayerProperties;


enum class AnnotationItemFlag
{
ScaleDependentBoundingBox,
};
typedef QFlags<Qgis::AnnotationItemFlag> AnnotationItemFlags;


static const double DEFAULT_SEARCH_RADIUS_MM;

static const float DEFAULT_MAPTOPIXEL_THRESHOLD;
@@ -554,6 +561,8 @@ QFlags<Qgis::GeometryValidityFlag> operator|(Qgis::GeometryValidityFlag f1, QFla

QFlags<Qgis::FileOperationFlag> operator|(Qgis::FileOperationFlag f1, QFlags<Qgis::FileOperationFlag> f2);

QFlags<Qgis::AnnotationItemFlag> operator|(Qgis::AnnotationItemFlag f1, QFlags<Qgis::AnnotationItemFlag> f2);




@@ -174,6 +174,7 @@ set(QGIS_CORE_SRCS
auth/qgsauthmethodregistry.cpp

annotations/qgsannotation.cpp
annotations/qgsannotationitem.cpp
annotations/qgsannotationitemregistry.cpp
annotations/qgsannotationlayer.cpp
annotations/qgsannotationlayerrenderer.cpp
@@ -0,0 +1,23 @@
/***************************************************************************
qgsannotationitem.cpp
-----------------
begin : August 2021
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. *
* *
***************************************************************************/

#include "qgsannotationitem.h"

Qgis::AnnotationItemFlags QgsAnnotationItem::flags() const
{
return Qgis::AnnotationItemFlags();
}
@@ -79,6 +79,13 @@ class CORE_EXPORT QgsAnnotationItem

virtual ~QgsAnnotationItem() = default;

/**
* Returns item flags.
*
* \since QGIS 3.22
*/
virtual Qgis::AnnotationItemFlags flags() const;

/**
* Returns a clone of the item. Ownership is transferred to the caller.
*/
@@ -26,6 +26,11 @@ QgsAnnotationPointTextItem::QgsAnnotationPointTextItem( const QString &text, Qgs

}

Qgis::AnnotationItemFlags QgsAnnotationPointTextItem::flags() const
{
return Qgis::AnnotationItemFlag::ScaleDependentBoundingBox;
}

QgsAnnotationPointTextItem::~QgsAnnotationPointTextItem() = default;

QString QgsAnnotationPointTextItem::type() const
@@ -731,6 +731,18 @@ class CORE_EXPORT Qgis
Q_DECLARE_FLAGS( MapLayerProperties, MapLayerProperty )
Q_ENUM( MapLayerProperty )

/**
* Flags for annotation items.
*
* \since QGIS 3.22
*/
enum class AnnotationItemFlag : int
{
ScaleDependentBoundingBox = 1 << 0, //!< Item's bounding box will vary depending on map scale
};
Q_DECLARE_FLAGS( AnnotationItemFlags, AnnotationItemFlag )
Q_ENUM( AnnotationItemFlag )

/**
* Identify search radius in mm
* \since QGIS 2.3
@@ -855,6 +867,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::BabelFormatCapabilities )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::BabelCommandFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::GeometryValidityFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::FileOperationFlags )
Q_DECLARE_OPERATORS_FOR_FLAGS( Qgis::AnnotationItemFlags )

// hack to workaround warnings when casting void pointers
// retrieved from QLibrary::resolve to function pointers.

0 comments on commit b4acffb

Please sign in to comment.