Skip to content

Commit

Permalink
Doxygen, spelling, sip fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Mar 26, 2020
1 parent bbc6af5 commit 617db59
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 10 deletions.
12 changes: 12 additions & 0 deletions python/core/auto_generated/qgstiles.sip.in
Expand Up @@ -67,9 +67,21 @@ Returns whether the range is valid (when all row/column numbers are not negative
%End

int startColumn() const;
%Docstring
Returns index of the first column in the range
%End
int endColumn() const;
%Docstring
Returns index of the last column in the range
%End
int startRow() const;
%Docstring
Returns index of the first row in the range
%End
int endRow() const;
%Docstring
Returns index of the last row in the range
%End

};

Expand Down
Expand Up @@ -37,8 +37,10 @@ zoom levels, or by disabling it.
%Docstring
Constructs a style object
%End

QgsVectorTileBasicRendererStyle( const QgsVectorTileBasicRendererStyle &other );
%Docstring
Constructs a style object as a copy of another style
%End

void setStyleName( const QString &name );
%Docstring
Expand Down
14 changes: 13 additions & 1 deletion src/core/qgsmbtilesreader.h
Expand Up @@ -24,22 +24,34 @@
class QImage;
class QgsRectangle;

/**
* \ingroup core
* Utility class for reading MBTiles files (which are SQLite3 databases).
*
* \since QGIS 3.14
*/
class CORE_EXPORT QgsMBTilesReader
{
public:
//! Contructs MBTiles reader (but it does not open the file yet)
explicit QgsMBTilesReader( const QString &filename );

//! Tries to open the file, returns true on success
bool open();

//! Returns whether the MBTiles file is currently opened
bool isOpen() const;

//! Requests metadata value for the given key
QString metadataValue( const QString &key );

//! given in WGS 84 (if available)
//! Returns bounding box from metadata, given in WGS 84 (if available)
QgsRectangle extent();

//! Returns raw tile data for given tile
QByteArray tileData( int z, int x, int y );

//! Returns tile decoded as a raster image (if stored in a known format like JPG or PNG)
QImage tileDataAsImage( int z, int x, int y );

private:
Expand Down
14 changes: 14 additions & 0 deletions src/core/qgstiles.cpp
@@ -1,3 +1,17 @@
/***************************************************************************
qgstiles.cpp
--------------------------------------
Date : March 2020
Copyright : (C) 2020 by Martin Dobias
Email : wonder dot sk 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 "qgstiles.h"

Expand Down
4 changes: 4 additions & 0 deletions src/core/qgstiles.h
Expand Up @@ -69,9 +69,13 @@ class CORE_EXPORT QgsTileRange
//! Returns whether the range is valid (when all row/column numbers are not negative)
bool isValid() const { return mStartColumn >= 0 && mEndColumn >= 0 && mStartRow >= 0 && mEndRow >= 0; }

//! Returns index of the first column in the range
int startColumn() const { return mStartColumn; }
//! Returns index of the last column in the range
int endColumn() const { return mEndColumn; }
//! Returns index of the first row in the range
int startRow() const { return mStartRow; }
//! Returns index of the last row in the range
int endRow() const { return mEndRow; }

private:
Expand Down
2 changes: 1 addition & 1 deletion src/core/vectortile/qgsvectortilebasicrenderer.h
Expand Up @@ -48,7 +48,7 @@ class CORE_EXPORT QgsVectorTileBasicRendererStyle
public:
//! Constructs a style object
QgsVectorTileBasicRendererStyle( const QString &stName = QString(), const QString &laName = QString(), QgsWkbTypes::GeometryType geomType = QgsWkbTypes::UnknownGeometry );

//! Constructs a style object as a copy of another style
QgsVectorTileBasicRendererStyle( const QgsVectorTileBasicRendererStyle &other );
QgsVectorTileBasicRendererStyle &operator=( const QgsVectorTileBasicRendererStyle &other );

Expand Down
2 changes: 1 addition & 1 deletion src/core/vectortile/qgsvectortilelayerrenderer.cpp
Expand Up @@ -112,7 +112,7 @@ bool QgsVectorTileLayerRenderer::render()
}
else
{
// Block until tiles are fetched and rendered. If the rendering gets cancelled at some point,
// Block until tiles are fetched and rendered. If the rendering gets canceled at some point,
// the async loader will catch the signal, abort requests and return from downloadBlocking()
asyncLoader->downloadBlocking();
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/vectortile/qgsvectortilelayerrenderer.h
Expand Up @@ -16,6 +16,8 @@
#ifndef QGSVECTORTILELAYERRENDERER_H
#define QGSVECTORTILELAYERRENDERER_H

#define SIP_NO_FILE

#include "qgsmaplayerrenderer.h"

class QgsVectorTileLayer;
Expand Down
8 changes: 5 additions & 3 deletions src/core/vectortile/qgsvectortileloader.cpp
Expand Up @@ -66,7 +66,7 @@ void QgsVectorTileLoader::downloadBlocking()

if ( mFeedback && mFeedback->isCanceled() )
{
qDebug() << "actually not - we were cancelled";
qDebug() << "actually not - we were canceled";
return; // nothing to do
}

Expand All @@ -81,7 +81,9 @@ void QgsVectorTileLoader::loadFromNetworkAsync( const QgsTileXYZ &id, const QStr
{
QString url = QgsVectorTileUtils::formatXYZUrlTemplate( requestUrl, id );
QNetworkRequest request( url );
// TODO: some extra headers? QgsSetRequestInitiatorClass / auth / "Accept" header
QgsSetRequestInitiatorClass( request, QStringLiteral( "QgsVectorTileLoader" ) );
QgsSetRequestInitiatorId( request, QStringLiteral( "X=%1 Y=%2 Z=%3" ).arg( id.column() ).arg( id.row() ).arg( id.zoomLevel() ) );

request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 1 ), id.column() );
request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 2 ), id.row() );
request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 3 ), id.zoomLevel() );
Expand Down Expand Up @@ -133,7 +135,7 @@ void QgsVectorTileLoader::tileReplyFinished()

void QgsVectorTileLoader::canceled()
{
qDebug() << "cancelling pending requests";
qDebug() << "canceling pending requests";
const QList<QNetworkReply *> replies = mReplies;
for ( QNetworkReply *reply : replies )
{
Expand Down
5 changes: 4 additions & 1 deletion src/core/vectortile/qgsvectortileloader.h
Expand Up @@ -16,6 +16,8 @@
#ifndef QGSVECTORTILELOADER_H
#define QGSVECTORTILELOADER_H

#define SIP_NO_FILE

class QByteArray;

#include "qgsvectortilerenderer.h"
Expand All @@ -29,6 +31,7 @@ class QByteArray;
class QgsVectorTileRawData
{
public:
//! Constructs a raw tile object
QgsVectorTileRawData( QgsTileXYZ tileID = QgsTileXYZ(), const QByteArray &raw = QByteArray() )
: id( tileID ), data( raw ) {}

Expand Down Expand Up @@ -60,7 +63,7 @@ class QgsVectorTileLoader : public QObject

//! Returns raw tile data for a single tile, doing a HTTP request. Block the caller until tile data are downloaded.
static QByteArray loadFromNetwork( const QgsTileXYZ &id, const QString &requestUrl );
//! Returns raw tile data for a signle tile loaded from MBTiles file
//! Returns raw tile data for a single tile loaded from MBTiles file
static QByteArray loadFromMBTiles( const QgsTileXYZ &id, QgsMBTilesReader &mbTileReader );
//! Decodes gzip byte stream, returns true on success
static bool decodeGzip( const QByteArray &bytesIn, QByteArray &bytesOut );
Expand Down
2 changes: 1 addition & 1 deletion src/core/vectortile/qgsvectortilemvtdecoder.cpp
Expand Up @@ -306,7 +306,7 @@ QgsVectorTileFeatures QgsVectorTileMVTDecoder::layerFeatures( const QMap<QString
}
}

f.setAttribute( "ty_pe", geomType );
f.setAttribute( "_geom_type", geomType );

layerFeatures.append( f );
}
Expand Down
2 changes: 2 additions & 0 deletions src/core/vectortile/qgsvectortilemvtdecoder.h
Expand Up @@ -16,6 +16,8 @@
#ifndef QGSVECTORTILEMVTDECODER_H
#define QGSVECTORTILEMVTDECODER_H

#define SIP_NO_FILE

class QgsFeature;

#include <QStringList>
Expand Down
2 changes: 1 addition & 1 deletion src/core/vectortile/qgsvectortileutils.cpp
Expand Up @@ -82,7 +82,7 @@ QgsVectorLayer *QgsVectorTileUtils::makeVectorLayerForTile( QgsVectorTileLayer *
decoder.decode( tileID, mvt->getRawTile( tileID ) );
qDebug() << decoder.layers();
QSet<QString> fieldNames = QSet<QString>::fromList( decoder.layerFieldNames( layerName ) );
fieldNames << "ty_pe"; // geom. type
fieldNames << "_geom_type";
QMap<QString, QgsFields> perLayerFields;
QgsFields fields = QgsVectorTileUtils::makeQgisFields( fieldNames );
perLayerFields[layerName] = fields;
Expand Down
2 changes: 2 additions & 0 deletions src/core/vectortile/qgsvectortileutils.h
Expand Up @@ -16,6 +16,8 @@
#ifndef QGSVECTORTILEUTILS_H
#define QGSVECTORTILEUTILS_H

#define SIP_NO_FILE

#include <QSet>

class QPointF;
Expand Down

0 comments on commit 617db59

Please sign in to comment.