Skip to content

Commit 370ac81

Browse files
authored
Introduction and implementation of the Bookmark tool (#533)
1 parent 9237fc0 commit 370ac81

File tree

27 files changed

+1131
-8
lines changed

27 files changed

+1131
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Added a `CONTRIBUTING.md`.
1010
* Added a `.clang-format` file.
1111
* Added vscode/spellchecking for documentation purposes.
12+
* (BookmarksView) Introduction of new Bookmark tool (C++/Quick, QML/Quick, Widget)
1213

1314
## 100.14
1415
* `toolkitwidgets.pri`, `toolkitqml.pri`, and `toolkitcpp.pri` now include `QT += ...` lines to account for needed dependencies.

uitools/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ In the [API Documentation](https://developers.arcgis.com/qt/toolkit/api-referenc
1111
|:--:|:--:|:--:|:--:|
1212
|Authentication view|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-authenticationview.html) | [](https://developers.arcgis.com/qt/toolkit/api-reference/qml-authenticationview.html) | [](https://developers.arcgis.com/qt/toolkit/api-reference/esri-arcgisruntime-toolkit-authenticationview.html) |
1313
|Basemap gallery|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-basemapgallery.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-basemapgallery.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/esri-arcgisruntime-toolkit-basemapgallery.html)|
14+
| Bookmarks view ||||
1415
|Callout|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-callout.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-callout.html)||
1516
|Coordinate conversion|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-coordinateconversion.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-coordinateconversion.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/esri-arcgisruntime-toolkit-coordinateconversion.html)|
1617
|Floor Filter|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-floorfilter.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/qml-floorfilter.html)|[](https://developers.arcgis.com/qt/toolkit/api-reference/esri-arcgisruntime-toolkit-floorfilter.html)|

uitools/common.pri

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ INCLUDEPATH += $$PWD/cpp $$CPPPATH
1919
HEADERS += $$CPPPATH/AuthenticationController.h \
2020
$$CPPPATH/BasemapGalleryController.h \
2121
$$CPPPATH/BasemapGalleryItem.h \
22+
$$CPPPATH/BookmarksViewController.h \
23+
$$CPPPATH/BookmarkListItem.h \
2224
$$CPPPATH/CoordinateConversionConstants.h \
2325
$$CPPPATH/CoordinateConversionController.h \
2426
$$CPPPATH/CoordinateConversionOption.h \
@@ -51,6 +53,8 @@ HEADERS += $$CPPPATH/AuthenticationController.h \
5153
SOURCES += $$CPPPATH/AuthenticationController.cpp \
5254
$$CPPPATH/BasemapGalleryController.cpp \
5355
$$CPPPATH/BasemapGalleryItem.cpp \
56+
$$CPPPATH/BookmarksViewController.cpp \
57+
$$CPPPATH/BookmarkListItem.cpp \
5458
$$CPPPATH/CoordinateConversionConstants.cpp \
5559
$$CPPPATH/CoordinateConversionController.cpp \
5660
$$CPPPATH/CoordinateConversionOption.cpp \
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*******************************************************************************
2+
* Copyright 2012-2022 Esri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
******************************************************************************/
16+
#include "BookmarkListItem.h"
17+
18+
// ArcGISRuntime headers
19+
#include <Bookmark.h>
20+
21+
namespace Esri {
22+
namespace ArcGISRuntime {
23+
namespace Toolkit {
24+
25+
/*!
26+
\inmodule EsriArcGISRuntimeToolkit
27+
\class Esri::ArcGISRuntime::Toolkit::BookmarkListItem
28+
\brief An item contained within \l BookmarksViewController::bookmarks. This class wraps
29+
a \c Bookmark for easy manipulation/inspection within an AbstractItemModel.
30+
*/
31+
32+
/*!
33+
\brief Constructs a new empty BookmarkListItem object with a given \a parent.
34+
*/
35+
BookmarkListItem::BookmarkListItem(QObject* parent) :
36+
BookmarkListItem(nullptr, parent)
37+
{
38+
}
39+
40+
/*!
41+
\brief Constructs a new BookmarkListItem object with a given \a bookmark and
42+
\a parent.
43+
*/
44+
BookmarkListItem::BookmarkListItem(Bookmark* bookmark, QObject* parent) :
45+
QObject(parent),
46+
m_bookmark(bookmark)
47+
{
48+
connect(this, &BookmarkListItem::bookmarkChanged, this, &BookmarkListItem::nameChanged);
49+
}
50+
51+
/*!
52+
\brief Destructor.
53+
*/
54+
BookmarkListItem::~BookmarkListItem() = default;
55+
56+
/*!
57+
\brief Change the underlying item to \a bookmark.
58+
*/
59+
void BookmarkListItem::setBookmark(Bookmark* bookmark)
60+
{
61+
if (m_bookmark == bookmark)
62+
{
63+
return;
64+
}
65+
66+
m_bookmark = bookmark;
67+
emit bookmarkChanged();
68+
}
69+
70+
/*!
71+
\brief Returns the current \c bookmark.
72+
*/
73+
Bookmark* BookmarkListItem::bookmark() const
74+
{
75+
return m_bookmark;
76+
}
77+
78+
/*!
79+
\property Esri::ArcGISRuntime::Toolkit::BookmarkListItem::name
80+
\brief Returns the name of the item.
81+
*/
82+
QString BookmarkListItem::name() const
83+
{
84+
return m_bookmark ? m_bookmark->name() : QString{};
85+
}
86+
87+
/*!
88+
\brief Sets the underlying item to \a name.
89+
*/
90+
void BookmarkListItem::setName(const QString& name)
91+
{
92+
if (m_bookmark && m_bookmark->name() != name)
93+
{
94+
m_bookmark->setName(name);
95+
emit nameChanged();
96+
}
97+
}
98+
99+
/*!
100+
\fn void Esri::ArcGISRuntime::Toolkit::BookmarkListItem::bookmarkChanged()
101+
\brief Signal emitted when the \l bookmark changes.
102+
*/
103+
104+
/*!
105+
\fn void Esri::ArcGISRuntime::Toolkit::BookmarkListItem::nameChanged()
106+
\brief Signal emitted when the \l bookmark name changes.
107+
*/
108+
109+
} // Toolkit
110+
} // ArcGISRuntime
111+
} // Esri
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*******************************************************************************
2+
* Copyright 2012-2022 Esri
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
******************************************************************************/
16+
#ifndef ESRI_ARCGISRUNTIME_TOOLKIT_BOOKMARKLISTITEM_H
17+
#define ESRI_ARCGISRUNTIME_TOOLKIT_BOOKMARKLISTITEM_H
18+
19+
// Qt headers
20+
#include <QObject>
21+
#include <QPointer>
22+
23+
namespace Esri {
24+
namespace ArcGISRuntime {
25+
class Bookmark;
26+
27+
namespace Toolkit {
28+
class BookmarkListItem : public QObject
29+
{
30+
Q_OBJECT
31+
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
32+
33+
public:
34+
Q_INVOKABLE explicit BookmarkListItem(QObject* parent = nullptr);
35+
Q_INVOKABLE explicit BookmarkListItem(Bookmark* bookmark, QObject* parent = nullptr);
36+
~BookmarkListItem() override;
37+
38+
void setBookmark(Bookmark* bookmark);
39+
Bookmark* bookmark() const;
40+
41+
QString name() const;
42+
void setName(const QString& name);
43+
44+
signals:
45+
void bookmarkChanged();
46+
void nameChanged();
47+
48+
private:
49+
QPointer<Bookmark> m_bookmark;
50+
};
51+
52+
} // Toolkit
53+
} // ArcGISRuntime
54+
} // Esri
55+
56+
#endif // ESRI_ARCGISRUNTIME_TOOLKIT_BOOKMARKLISTITEM_H

0 commit comments

Comments
 (0)