-
-
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.
- Loading branch information
Showing
13 changed files
with
217 additions
and
19 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
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 "filter_parameter.hpp" | ||
|
||
#include "style_parameter.hpp" | ||
|
||
namespace QMapLibre { | ||
|
||
/*! | ||
\class FilterParameter | ||
\brief A helper utility to manage filter parameters for a layer. | ||
\ingroup QMapLibre | ||
\headerfile filter_parameter.hpp <QMapLibre/FilterParameter> | ||
*/ | ||
|
||
/*! | ||
\brief Default constructor | ||
*/ | ||
FilterParameter::FilterParameter(QObject *parent) | ||
: StyleParameter(parent) {} | ||
|
||
FilterParameter::~FilterParameter() = default; | ||
|
||
/*! | ||
\fn void FilterParameter::expressionUpdated() | ||
\brief Signal emitted when the filter expression is updated. | ||
*/ | ||
|
||
/*! | ||
\brief Filter expression. | ||
\return \c QVariantList. | ||
*/ | ||
QVariantList FilterParameter::expression() const { | ||
return m_expression; | ||
} | ||
|
||
/*! | ||
\brief Set the filter expression. | ||
\param expression Filter expression as \c QVariantList. | ||
\ref expressionUpdated() signal is emitted when the expression is updated. | ||
*/ | ||
void FilterParameter::setExpression(const QVariantList &expression) { | ||
if (m_expression == expression) { | ||
return; | ||
} | ||
|
||
m_expression = expression; | ||
|
||
Q_EMIT expressionUpdated(); | ||
} | ||
|
||
/*! | ||
\var FilterParameter::m_expression | ||
\brief Filter expression | ||
*/ | ||
|
||
} // 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,38 @@ | ||
// Copyright (C) 2023 MapLibre contributors | ||
|
||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#ifndef QMAPLIBRE_FILTER_PARAMETER_H | ||
#define QMAPLIBRE_FILTER_PARAMETER_H | ||
|
||
#include "style_parameter.hpp" | ||
|
||
#include <QMapLibre/Export> | ||
|
||
#include <QtCore/QObject> | ||
#include <QtCore/QString> | ||
#include <QtCore/QVariantList> | ||
|
||
namespace QMapLibre { | ||
|
||
class Q_MAPLIBRE_CORE_EXPORT FilterParameter : public StyleParameter { | ||
Q_OBJECT | ||
public: | ||
explicit FilterParameter(QObject *parent = nullptr); | ||
~FilterParameter() override; | ||
|
||
[[nodiscard]] QVariantList expression() const; | ||
void setExpression(const QVariantList &expression); | ||
|
||
Q_SIGNALS: | ||
void expressionUpdated(); | ||
|
||
protected: | ||
QVariantList m_expression; | ||
|
||
Q_DISABLE_COPY(FilterParameter) | ||
}; | ||
|
||
} // namespace QMapLibre | ||
|
||
#endif // QMAPLIBRE_FILTER_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
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_filter_parameter.hpp" | ||
|
||
namespace QMapLibre { | ||
|
||
DeclarativeFilterParameter::DeclarativeFilterParameter(QObject *parent) | ||
: FilterParameter(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/FilterParameter> | ||
|
||
#include <QtQml/QQmlEngine> | ||
#include <QtQml/QQmlParserStatus> | ||
|
||
namespace QMapLibre { | ||
|
||
class DeclarativeFilterParameter : public FilterParameter, public QQmlParserStatus { | ||
Q_OBJECT | ||
QML_NAMED_ELEMENT(FilterParameter) | ||
#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(QVariantList expression READ expression WRITE setExpression NOTIFY expressionUpdated) | ||
// this type must not declare any additional properties | ||
public: | ||
explicit DeclarativeFilterParameter(QObject *parent = nullptr); | ||
~DeclarativeFilterParameter() override = default; | ||
|
||
private: | ||
// QQmlParserStatus implementation | ||
MLN_DECLARATIVE_PARSER(DeclarativeFilterParameter) | ||
}; | ||
|
||
} // 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
Oops, something went wrong.