Navigation Menu

Skip to content

Commit

Permalink
Blank shell for Mapbox GL style converter
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Sep 6, 2020
1 parent 5cf027c commit fe7470c
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 0 deletions.
@@ -0,0 +1,53 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vectortile/qgsmapboxglstyleconverter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsMapBoxGlStyleConverter
{
%Docstring
Handles conversion of MapBox GL styles to QGIS vector tile renderers and labeling
settings.

.. versionadded:: 3.16
%End

%TypeHeaderCode
#include "qgsmapboxglstyleconverter.h"
%End
public:

QgsMapBoxGlStyleConverter( const QVariantMap &style );
%Docstring
Constructor for QgsMapBoxGlStyleConverter.

The specified MapBox GL ``style`` configuration will be converted.
%End

QgsVectorTileRenderer *renderer() const /Factory/;
%Docstring
Returns a new instance of a vector tile renderer representing the converted style,
or ``None`` if the style could not be converted successfully.
%End

QgsVectorTileLabeling *labeling() const /Factory/;
%Docstring
Returns a new instance of a vector tile labeling representing the converted style,
or ``None`` if the style could not be converted successfully.
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vectortile/qgsmapboxglstyleconverter.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -687,6 +687,7 @@ SET(QGIS_CORE_SRCS
validity/qgsvaliditycheckcontext.cpp
validity/qgsvaliditycheckregistry.cpp

vectortile/qgsmapboxglstyleconverter.cpp
vectortile/qgsvectortilebasiclabeling.cpp
vectortile/qgsvectortilebasicrenderer.cpp
vectortile/qgsvectortileconnection.cpp
Expand Down Expand Up @@ -1445,6 +1446,7 @@ SET(QGIS_CORE_HDRS
validity/qgsvaliditycheckcontext.h
validity/qgsvaliditycheckregistry.h

vectortile/qgsmapboxglstyleconverter.h
vectortile/qgsvectortilebasiclabeling.h
vectortile/qgsvectortilebasicrenderer.h
vectortile/qgsvectortileconnection.h
Expand Down
34 changes: 34 additions & 0 deletions src/core/vectortile/qgsmapboxglstyleconverter.cpp
@@ -0,0 +1,34 @@
/***************************************************************************
qgsmapboxglstyleconverter.cpp
--------------------------------------
Date : September 2020
Copyright : (C) 2020 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 "qgsmapboxglstyleconverter.h"
#include "qgsvectortilebasicrenderer.h"
#include "qgsvectortilebasiclabeling.h"

QgsMapBoxGlStyleConverter::QgsMapBoxGlStyleConverter( const QVariantMap &style )
: mStyle( style )
{

}

QgsVectorTileRenderer *QgsMapBoxGlStyleConverter::renderer() const
{
return mRenderer ? mRenderer->clone() : nullptr;
}

QgsVectorTileLabeling *QgsMapBoxGlStyleConverter::labeling() const
{
return mLabeling ? mLabeling->clone() : nullptr;
}
66 changes: 66 additions & 0 deletions src/core/vectortile/qgsmapboxglstyleconverter.h
@@ -0,0 +1,66 @@
/***************************************************************************
qgsmapboxglstyleconverter.h
--------------------------------------
Date : September 2020
Copyright : (C) 2020 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. *
* *
***************************************************************************/

#ifndef QGSMAPBOXGLSTYLECONVERTER_H
#define QGSMAPBOXGLSTYLECONVERTER_H

#include "qgis_core.h"
#include "qgis_sip.h"
#include <QVariantMap>
#include <memory>

class QgsVectorTileRenderer;
class QgsVectorTileLabeling;

/**
* \ingroup core
* Handles conversion of MapBox GL styles to QGIS vector tile renderers and labeling
* settings.
*
* \since QGIS 3.16
*/
class CORE_EXPORT QgsMapBoxGlStyleConverter
{
public:

/**
* Constructor for QgsMapBoxGlStyleConverter.
*
* The specified MapBox GL \a style configuration will be converted.
*/
QgsMapBoxGlStyleConverter( const QVariantMap &style );

/**
* Returns a new instance of a vector tile renderer representing the converted style,
* or NULLPTR if the style could not be converted successfully.
*/
QgsVectorTileRenderer *renderer() const SIP_FACTORY;

/**
* Returns a new instance of a vector tile labeling representing the converted style,
* or NULLPTR if the style could not be converted successfully.
*/
QgsVectorTileLabeling *labeling() const SIP_FACTORY;

private:

QVariantMap mStyle;

std::unique_ptr< QgsVectorTileRenderer > mRenderer;
std::unique_ptr< QgsVectorTileLabeling > mLabeling;

};

#endif // QGSMAPBOXGLSTYLECONVERTER_H

0 comments on commit fe7470c

Please sign in to comment.