-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve GeoJSON and image source handling (#164)
- Loading branch information
Showing
16 changed files
with
293 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#include "image_parameter.hpp" | ||
|
||
#include "style_parameter.hpp" | ||
|
||
namespace QMapLibre { | ||
|
||
/*! | ||
\class ImageParameter | ||
\brief A helper utility to manage image sources. | ||
\ingroup QMapLibre | ||
\headerfile image_parameter.hpp <QMapLibre/ImageParameter> | ||
*/ | ||
|
||
/*! | ||
\brief Default constructor | ||
*/ | ||
ImageParameter::ImageParameter(QObject *parent) | ||
: StyleParameter(parent) {} | ||
|
||
ImageParameter::~ImageParameter() = default; | ||
|
||
/*! | ||
\fn void ImageParameter::sourceUpdated() | ||
\brief Signal emitted when the image source is updated. | ||
*/ | ||
|
||
/*! | ||
\brief Get the image source. | ||
\return image source as \c QString. | ||
*/ | ||
QString ImageParameter::source() const { | ||
return m_source; | ||
} | ||
|
||
/*! | ||
\brief Set the image source. | ||
\param source image source to set. | ||
\ref sourceUpdated() signal is emitted when the image source is updated. | ||
*/ | ||
void ImageParameter::setSource(const QString &source) { | ||
if (m_source == source) { | ||
return; | ||
} | ||
|
||
m_source = source; | ||
|
||
Q_EMIT sourceUpdated(); | ||
} | ||
|
||
/*! | ||
\var ImageParameter::m_source | ||
\brief image source | ||
*/ | ||
|
||
} // namespace QMapLibre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#ifndef QMAPLIBRE_IMAGE_PARAMETER_H | ||
#define QMAPLIBRE_IMAGE_PARAMETER_H | ||
|
||
#include "style_parameter.hpp" | ||
|
||
#include <QMapLibre/Export> | ||
|
||
#include <QtCore/QObject> | ||
#include <QtCore/QString> | ||
|
||
namespace QMapLibre { | ||
|
||
class Q_MAPLIBRE_CORE_EXPORT ImageParameter : public StyleParameter { | ||
Q_OBJECT | ||
public: | ||
explicit ImageParameter(QObject *parent = nullptr); | ||
~ImageParameter() override; | ||
|
||
[[nodiscard]] QString source() const; | ||
void setSource(const QString &source); | ||
|
||
Q_SIGNALS: | ||
void sourceUpdated(); | ||
|
||
protected: | ||
QString m_source; | ||
|
||
Q_DISABLE_COPY(ImageParameter) | ||
}; | ||
|
||
} // namespace QMapLibre | ||
|
||
#endif // QMAPLIBRE_IMAGE_PARAMETER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#include "declarative_image_parameter.hpp" | ||
|
||
namespace QMapLibre { | ||
|
||
DeclarativeImageParameter::DeclarativeImageParameter(QObject *parent) | ||
: ImageParameter(parent) {} | ||
|
||
} // namespace QMapLibre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#pragma once | ||
|
||
#include "declarative_style_parameter.hpp" | ||
|
||
#include <QMapLibre/ImageParameter> | ||
|
||
#include <QtQml/QQmlEngine> | ||
#include <QtQml/QQmlParserStatus> | ||
|
||
namespace QMapLibre { | ||
|
||
class DeclarativeImageParameter : public ImageParameter, public QQmlParserStatus { | ||
Q_OBJECT | ||
QML_NAMED_ELEMENT(ImageParameter) | ||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) | ||
QML_ADDED_IN_VERSION(3, 0) | ||
#endif | ||
Q_INTERFACES(QQmlParserStatus) | ||
// from base class | ||
Q_PROPERTY(QString styleId READ styleId WRITE setStyleId) | ||
Q_PROPERTY(QString source READ source WRITE setSource NOTIFY sourceUpdated) | ||
// this type must not declare any additional properties | ||
public: | ||
explicit DeclarativeImageParameter(QObject *parent = nullptr); | ||
~DeclarativeImageParameter() override = default; | ||
|
||
private: | ||
// QQmlParserStatus implementation | ||
MLN_DECLARATIVE_PARSER(DeclarativeImageParameter) | ||
}; | ||
|
||
} // namespace QMapLibre |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.