Commit 6c6c085e authored by Bernhard Beschow's avatar Bernhard Beschow
Browse files

add support for quad trees

CCBUG: 240641
parent 61a11286
......@@ -5,7 +5,7 @@
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
// Copyright 2010,2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
//
// Own
......@@ -195,4 +195,38 @@ QString WmsServerLayout::epsgCode() const
return QString();
}
QuadTreeServerLayout::QuadTreeServerLayout( GeoSceneTexture *textureLayer )
: ServerLayout( textureLayer )
{
}
QUrl QuadTreeServerLayout::downloadUrl( const QUrl &prototypeUrl, const Marble::TileId &id ) const
{
QString urlStr = prototypeUrl.toString();
urlStr.replace( "{quadIndex}", encodeQuadTree( id ) );
return QUrl( urlStr );
}
QString QuadTreeServerLayout::name() const
{
return "QuadTree";
}
QString QuadTreeServerLayout::encodeQuadTree( const Marble::TileId &id )
{
QString tileNum;
for ( int i = id.zoomLevel(); i >= 0; i-- ) {
const int tileX = (id.x() >> i) % 2;
const int tileY = (id.y() >> i) % 2;
const int num = ( 2 * tileY ) + tileX;
tileNum += QString::number( num );
}
return tileNum;
}
}
......@@ -5,7 +5,7 @@
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2010 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
// Copyright 2010,2011 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
//
#ifndef MARBLE_SERVERLAYOUT_H
......@@ -114,6 +114,18 @@ private:
QString epsgCode() const;
};
class QuadTreeServerLayout : public ServerLayout
{
public:
QuadTreeServerLayout( GeoSceneTexture* textureLayer );
virtual QUrl downloadUrl( const QUrl &, const Marble::TileId & ) const;
virtual QString name() const;
private:
static QString encodeQuadTree( const Marble::TileId & );
};
}
#endif
......@@ -76,6 +76,8 @@ GeoNode* DgmlStorageLayoutTagHandler::parse(GeoParser& parser) const
serverLayout = new CustomServerLayout( texture );
else if ( modeStr == "WebMapService" )
serverLayout = new WmsServerLayout( texture );
else if ( modeStr == "QuadTree" )
serverLayout = new QuadTreeServerLayout( texture );
else {
storageLayout = GeoSceneTexture::Marble;
serverLayout = new MarbleServerLayout( texture );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment