Skip to content

Commit

Permalink
Fixes to python bindings + some bits from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Mar 26, 2020
1 parent da57d93 commit bbc6af5
Show file tree
Hide file tree
Showing 12 changed files with 638 additions and 37 deletions.
1 change: 1 addition & 0 deletions doc/CMakeLists.txt
Expand Up @@ -99,6 +99,7 @@ IF(WITH_APIDOC)
${CMAKE_SOURCE_DIR}/src/core/scalebar
${CMAKE_SOURCE_DIR}/src/core/symbology
${CMAKE_SOURCE_DIR}/src/core/validity
${CMAKE_SOURCE_DIR}/src/core/vectortile
${CMAKE_SOURCE_DIR}/src/gui
${CMAKE_SOURCE_DIR}/src/gui/auth
${CMAKE_SOURCE_DIR}/src/gui/attributetable
Expand Down
114 changes: 114 additions & 0 deletions python/core/auto_generated/qgstiles.sip.in
@@ -0,0 +1,114 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgstiles.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/




class QgsTileXYZ
{
%Docstring
Stores coordinates of a tile in a tile matrix set. Tile matrix is identified
by the zoomLevel(), and the position within tile matrix is given by column()
and row().

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstiles.h"
%End
public:
QgsTileXYZ( int tc = -1, int tr = -1, int tz = -1 );
%Docstring
Constructs a tile identifier from given column, row and zoom level indices
%End

int column() const;
%Docstring
Returns tile's column index (X)
%End
int row() const;
%Docstring
Returns tile's row index (Y)
%End
int zoomLevel() const;
%Docstring
Returns tile's zoom level (Z)
%End

};


class QgsTileRange
{
%Docstring
Range of tiles in a tile matrix to be rendered. The selection is rectangular,
given by start/end row and column numbers.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgstiles.h"
%End
public:
QgsTileRange( int c1 = -1, int c2 = -1, int r1 = -1, int r2 = -1 );
%Docstring
Constructs a range of tiles from given span of columns and rows
%End
bool isValid() const;
%Docstring
Returns whether the range is valid (when all row/column numbers are not negative)
%End

int startColumn() const;
int endColumn() const;
int startRow() const;
int endRow() const;

};


struct QgsTileMatrix
{
public:

static QgsTileMatrix fromWebMercator( int mZoomLevel );
%Docstring
Returns a tile matrix for the usual web mercator
%End

QgsRectangle tileExtent( QgsTileXYZ id ) const;
%Docstring
Returns extent of the given tile in this matrix
%End

QgsPointXY tileCenter( QgsTileXYZ id ) const;
%Docstring
Returns center of the given tile in this matrix
%End

QgsTileRange tileRangeFromExtent( const QgsRectangle &mExtent );
%Docstring
Returns tile range that fully covers the given extent
%End

QPointF mapToTileCoordinates( const QgsPointXY &mapPoint ) const;
%Docstring
Returns row/column coordinates (floating point number) from the given point in map coordinates
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgstiles.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
@@ -0,0 +1,182 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vectortile/qgsvectortilebasicrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsVectorTileBasicRendererStyle
{
%Docstring
Definition of map rendering of a subset of vector tile data. The subset of data is defined by:
1. sub-layer name
2. geometry type (a single sub-layer may have multiple geometry types)
3. filter expression

Renering is determined by the associated symbol (QgsSymbol). Symbol has to be of the same
type as the chosen geometryType() - i.e. QgsMarkerSymbol for points, QgsLineSymbol for linestrings
and QgsFillSymbol for polygons.

It is possible to further constrain when this style is applied by setting a range of allowed
zoom levels, or by disabling it.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsvectortilebasicrenderer.h"
%End
public:
QgsVectorTileBasicRendererStyle( const QString &stName = QString(), const QString &laName = QString(), QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry );
%Docstring
Constructs a style object
%End

QgsVectorTileBasicRendererStyle( const QgsVectorTileBasicRendererStyle &other );

void setStyleName( const QString &name );
%Docstring
Sets human readable name of this style
%End
QString styleName() const;
%Docstring
Returns human readable name of this style
%End

void setLayerName( const QString &name );
%Docstring
Sets name of the sub-layer to render (empty layer means that all layers match)
%End
QString layerName() const;
%Docstring
Returns name of the sub-layer to render (empty layer means that all layers match)
%End

void setGeometryType( QgsWkbTypes::GeometryType geomType );
%Docstring
Sets type of the geometry that will be used (point / line / polygon)
%End
QgsWkbTypes::GeometryType geometryType() const;
%Docstring
Returns type of the geometry that will be used (point / line / polygon)
%End

void setFilterExpression( const QString &expr );
%Docstring
Sets filter expression (empty filter means that all features match)
%End
QString filterExpression() const;
%Docstring
Returns filter expression (empty filter means that all features match)
%End

void setSymbol( QgsSymbol *sym /Transfer/ );
%Docstring
Sets symbol for rendering. Takes ownership of the symbol.
%End
QgsSymbol *symbol() const;
%Docstring
Returns symbol for rendering
%End

void setEnabled( bool enabled );
%Docstring
Sets whether this style is enabled (used for rendering)
%End
bool isEnabled() const;
%Docstring
Returns whether this style is enabled (used for rendering)
%End

void setMinZoomLevel( int minZoom );
%Docstring
Sets minimum zoom level index (negative number means no limit)
%End
int minZoomLevel() const;
%Docstring
Returns minimum zoom level index (negative number means no limit)
%End

void setMaxZoomLevel( int maxZoom );
%Docstring
Sets maximum zoom level index (negative number means no limit)
%End
int maxZoomLevel() const;
%Docstring
Returns maxnimum zoom level index (negative number means no limit)
%End

bool isActive( int zoomLevel ) const;
%Docstring
Returns whether the style is active at given zoom level (also checks "enabled" flag)
%End

void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;
%Docstring
Writes object content to given DOM element
%End
void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
%Docstring
Reads object content from given DOM element
%End

};


class QgsVectorTileBasicRenderer : QgsVectorTileRenderer
{
%Docstring
The default vector tile renderer implementation. It has an ordered list of "styles",
each defines a rendering rule.

.. versionadded:: 3.14
%End

%TypeHeaderCode
#include "qgsvectortilebasicrenderer.h"
%End
public:
QgsVectorTileBasicRenderer();
%Docstring
Constructs renderer with some default styles
%End

virtual QString type() const;

virtual QgsVectorTileBasicRenderer *clone() const /Factory/;

virtual void startRender( QgsRenderContext &context, int tileZoom, const QgsTileRange &tileRange );

virtual void stopRender( QgsRenderContext &context );

virtual void renderTile( const QgsVectorTileRendererData &tile, QgsRenderContext &context );

virtual void writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const;

virtual void readXml( const QDomElement &elem, const QgsReadWriteContext &context );


void setStyles( const QList<QgsVectorTileBasicRendererStyle> &styles );
%Docstring
Sets list of styles of the renderer
%End
QList<QgsVectorTileBasicRendererStyle> styles() const;
%Docstring
Returns list of styles of the renderer
%End

};

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/vectortile/qgsvectortilebasicrenderer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/

0 comments on commit bbc6af5

Please sign in to comment.