1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsbookmarkmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsBookmark
{
%Docstring(signature="appended")
Represents a spatial bookmark, with a name, CRS and extent.
:py:class:`QgsBookmark` objects are typically used alongside the
:py:class:`QgsBookmarkManager` class, which handles storage of a set of
bookmarks.
.. versionadded:: 3.10
%End
%TypeHeaderCode
#include "qgsbookmarkmanager.h"
%End
public:
QgsBookmark();
%Docstring
Default constructor, creates an empty bookmark.
%End
QString id() const;
%Docstring
Returns the bookmark's unique ID.
.. seealso:: :py:func:`setId`
%End
void setId( const QString &id );
%Docstring
Sets the bookmark's unique ``id``.
.. seealso:: :py:func:`id`
%End
QString name() const;
%Docstring
Returns the bookmark's name, which is a user-visible string identifying
the bookmark.
.. seealso:: :py:func:`setName`
%End
void setName( const QString &name );
%Docstring
Sets the bookmark's ``name``, which is a user-visible string identifying
the bookmark.
.. seealso:: :py:func:`name`
%End
QString group() const;
%Docstring
Returns the bookmark's group, which is a user-visible string identifying
the bookmark's category.
.. seealso:: :py:func:`setGroup`
%End
void setGroup( const QString &group );
%Docstring
Sets the bookmark's ``group``, which is a user-visible string
identifying the bookmark's category.
.. seealso:: :py:func:`group`
%End
QgsReferencedRectangle extent() const;
%Docstring
Returns the bookmark's spatial extent.
.. seealso:: :py:func:`setExtent`
%End
void setExtent( const QgsReferencedRectangle &extent );
%Docstring
Sets the bookmark's spatial ``extent``.
.. seealso:: :py:func:`extent`
%End
double rotation() const;
%Docstring
Returns the bookmark's map rotation.
.. seealso:: :py:func:`setRotation`
.. versionadded:: 3.32
%End
void setRotation( double rotation );
%Docstring
Sets the bookmark's spatial map ``rotation``.
.. seealso:: :py:func:`rotation`
.. versionadded:: 3.32
%End
static QgsBookmark fromXml( const QDomElement &element, const QDomDocument &doc );
%Docstring
Creates a bookmark using the properties from a DOM ``element``.
.. seealso:: :py:func:`writeXml`
%End
QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Returns a DOM element representing the bookmark's properties.
.. seealso:: :py:func:`fromXml`
%End
SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsBookmark: '%1' (%2)>" )
.arg( sipCpp->name() )
.arg(
sipCpp->extent().isNull() ?
QStringLiteral( "EMPTY" ) :
QStringLiteral( "%1 - %2" )
.arg( sipCpp->extent().asWktCoordinates(), sipCpp->extent().crs().authid() )
);
sipRes = PyUnicode_FromString( str.toUtf8().constData() );
%End
bool operator==( const QgsBookmark &other ) const;
bool operator!=( const QgsBookmark &other ) const;
};
class QgsBookmarkManager : QObject
{
%Docstring(signature="appended")
Manages storage of a set of bookmarks.
:py:class:`QgsBookmarkManager` handles the storage, serializing and
deserializing of geographic bookmarks. Usually this class is not
constructed directly, but rather accessed through a
:py:class:`QgsProject` via :py:func:`QgsProject.bookmarkManager()`, or
via the application-wide bookmark store at
:py:func:`QgsApplication.bookmarkManager()`.
.. versionadded:: 3.10
%End
%TypeHeaderCode
#include "qgsbookmarkmanager.h"
%End
public:
static QgsBookmarkManager *createProjectBasedManager( QgsProject *project );
%Docstring
Returns a newly created QgsBookmarkManager using a project-based
bookmark store, linked to the specified ``project``.
The returned object is parented to the ``project``.
%End
explicit QgsBookmarkManager( QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsBookmarkManager, with the specified ``parent``
object.
This constructor creates a bookmark manager which stores bookmarks in an
XML file. A call to :py:func:`~QgsBookmarkManager.initialize` is
required to initialize the manager and set the corresponding file path.
%End
~QgsBookmarkManager();
void initialize( const QString &filePath );
%Docstring
Initializes the bookmark manager.
%End
QString addBookmark( const QgsBookmark &bookmark, bool *ok /Out/ = 0 );
%Docstring
Adds a ``bookmark`` to the manager.
:param bookmark: the bookmark to add
:return: - The bookmark's ID (or newly generated ID, if no ID was
originally set and one was automatically generated)
- ok: ``True`` if the bookmark was successfully added, or
``False`` if the bookmark could not be added (eg as a result
of a duplicate bookmark ID).
.. seealso:: :py:func:`removeBookmark`
.. seealso:: :py:func:`bookmarkAdded`
%End
bool removeBookmark( const QString &id );
%Docstring
Removes the bookmark with matching ``id`` from the manager.
Returns ``True`` if the removal was successful, or ``False`` if the
removal failed (eg as a result of removing a bookmark which is not
contained in the manager).
.. seealso:: :py:func:`addBookmark`
.. seealso:: :py:func:`bookmarkRemoved`
.. seealso:: :py:func:`bookmarkAboutToBeRemoved`
.. seealso:: :py:func:`clear`
%End
bool updateBookmark( const QgsBookmark &bookmark );
%Docstring
Updates the definition of a ``bookmark`` in the manager.
Replaces the current definition of the bookmark with matching ID in the
manager with a new definition (new bookmark name or extent).
Returns ``True`` if the bookmark was successfully updated, or ``False``
if the bookmark could not be updated (eg bookmark is not stored in the
manager).
.. seealso:: :py:func:`bookmarkChanged`
%End
void clear();
%Docstring
Removes and deletes all bookmarks from the manager.
.. seealso:: :py:func:`removeBookmark`
%End
QStringList groups() const;
%Docstring
Returns a list of all bookmark groups contained in the manager.
%End
void renameGroup( const QString &oldName, const QString &newName );
%Docstring
Renames an existing group from ``oldName`` to ``newName``. This updates
all existing bookmarks to reflect the new name.
%End
QList< QgsBookmark > bookmarks() const;
%Docstring
Returns a list of all bookmarks contained in the manager.
%End
QgsBookmark bookmarkById( const QString &id ) const;
%Docstring
Returns the bookmark with a matching ``id``, or an empty bookmark if no
matching bookmarks were found.
%End
QList< QgsBookmark > bookmarksByGroup( const QString &group );
%Docstring
Returns a list of bookmark with a matching ``group``, or an empty list
if no matching bookmarks were found.
%End
bool readXml( const QDomElement &element, const QDomDocument &doc );
%Docstring
Reads the manager's state from a DOM element, restoring all bookmarks
present in the XML document.
.. seealso:: :py:func:`writeXml`
%End
QDomElement writeXml( QDomDocument &doc ) const;
%Docstring
Returns a DOM element representing the state of the manager.
.. seealso:: :py:func:`readXml`
%End
bool moveBookmark( const QString &id, QgsBookmarkManager *destination );
%Docstring
Moves the bookmark with matching ``id`` from this manager to a
``destination`` manager.
Returns ``True`` if the bookmark was successfully moved.
%End
static bool exportToFile( const QString &path, const QList<const QgsBookmarkManager *> &managers, const QString &group = QString() );
%Docstring
Exports all bookmarks from a list of ``managers`` to an xml file at the
specified ``path``.
If ``group`` is set then only bookmarks from the matching group will be
exported.
Returns ``True`` if the export was successful.
.. seealso:: :py:func:`importFromFile`
%End
bool importFromFile( const QString &path );
%Docstring
Imports the bookmarks from an xml file at the specified ``path``.
Returns ``True`` if the import was successful.
.. seealso:: :py:func:`exportToFile`
%End
signals:
void bookmarkAboutToBeAdded( const QString &id );
%Docstring
Emitted when a bookmark is about to be added to the manager
%End
void bookmarkAdded( const QString &id );
%Docstring
Emitted when a bookmark has been added to the manager
%End
void bookmarkRemoved( const QString &id );
%Docstring
Emitted when a bookmark was removed from the manager
%End
void bookmarkAboutToBeRemoved( const QString &id );
%Docstring
Emitted when a bookmark is about to be removed from the manager
%End
void bookmarkChanged( const QString &id );
%Docstring
Emitted when a bookmark is changed
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsbookmarkmanager.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|