Skip to content

Commit

Permalink
extent check in tile source
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Jul 5, 2011
1 parent 169de3a commit 1a7a7ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/plugins/globe/globe.earth
@@ -1,6 +1,8 @@
<map name="QGIS Map" type="geocentric">

<!--
<loading_policy mode="preemptive"/>
-->

<image name="world" driver="gdal">
<url>/usr/share/osgearth/data/world.tif</url>
Expand Down
12 changes: 6 additions & 6 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -175,18 +175,19 @@ void GlobePlugin::layersChanged()
{
QgsDebugMsg(">>>>>>>>>> layersChanged");
if (mTileSource) {
/*
//viewer.getDatabasePager()->clear();
mMapNode->getTerrain()->incrementRevision();
/*
//mMapNode->getTerrain()->incrementRevision();
TileList tiles;
mMapNode->getTerrain()->getVersionedTiles( tiles );
for( TileList::iterator i = tiles.begin(); i != tiles.end(); i++ )
i->get()->markTileForRegeneration(); //updateImagery( mQgisMapLayer->getId(), mMapNode->getMap(), mMapNode->getEngine() );
for( TileList::iterator i = tiles.begin(); i != tiles.end(); i++ ) {
//i->get()->markTileForRegeneration();
i->get()->updateImagery( mQgisMapLayer->getId(), mMapNode->getMap(), mMapNode->getEngine() );
}
*/
}
if (mTileSource && mMapNode->getMap()->getImageMapLayers().size() > 1)
{
/*
QgsDebugMsg(">>>>>>>>>> removeMapLayer");
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
mMapNode->getMap()->removeMapLayer( mQgisMapLayer );
Expand All @@ -197,7 +198,6 @@ void GlobePlugin::layersChanged()
mQgisMapLayer = new ImageMapLayer( "QGIS", mTileSource );
mMapNode->getMap()->addMapLayer( mQgisMapLayer );
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
*/
}
}

Expand Down
13 changes: 2 additions & 11 deletions src/plugins/globe/qgsosgearthtilesource.cpp
Expand Up @@ -26,8 +26,6 @@
#include <QFile>
#include <QPainter>

#define QGIS_SCOPED_LOCK GDAL_SCOPED_LOCK

using namespace osgEarth;
using namespace osgEarth::Drivers;

Expand All @@ -39,15 +37,11 @@ QgsOsgEarthTileSource::QgsOsgEarthTileSource( QgisInterface* theQgisInterface )
void QgsOsgEarthTileSource::initialize( const std::string& referenceURI, const Profile* overrideProfile)
{
setProfile( osgEarth::Registry::instance()->getGlobalGeodeticProfile() );
// the top LOD is a 2x2 tile set.
//setProfile( Profile::create( "spherical-mercator", "", 2, 2 ) );
}

osg::Image* QgsOsgEarthTileSource::createImage( const TileKey* key,
ProgressCallback* progress )
{
QGIS_SCOPED_LOCK;

osg::ref_ptr<osg::Image> image;
if (intersects(key))
{
Expand Down Expand Up @@ -124,8 +118,6 @@ int QgsOsgEarthTileSource::configureMapRender( const QPaintDevice* paintDevice )

QgsCoordinateReferenceSystem outputCRS;

//wms spec says that CRS parameter is mandatory.
//we don't rejeict the request if it is not there but disable reprojection on the fly
if(true) //TODO
{
//disable on the fly projection
Expand Down Expand Up @@ -200,7 +192,6 @@ bool QgsOsgEarthTileSource::intersects(const TileKey* key)
//Get the native extents of the tile
double xmin, ymin, xmax, ymax;
key->getGeoExtent().getBounds(xmin, ymin, xmax, ymax);

//TODO: return ! ( xmin >= _extentsMax.x() || xmax <= _extentsMin.x() || ymin >= _extentsMax.y() || ymax <= _extentsMin.y() );
return true;
QgsRectangle extent = mQGisIface->mapCanvas()->fullExtent();
return ! ( xmin >= extent.xMaximum() || xmax <= extent.xMinimum() || ymin >= extent.yMaximum() || ymax <= extent.yMinimum() );
}

0 comments on commit 1a7a7ab

Please sign in to comment.