Skip to content

Commit 1a7a7ab

Browse files
committedJul 5, 2011
extent check in tile source
1 parent 169de3a commit 1a7a7ab

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed
 

‎src/plugins/globe/globe.earth

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<map name="QGIS Map" type="geocentric">
22

3+
<!--
34
<loading_policy mode="preemptive"/>
5+
-->
46

57
<image name="world" driver="gdal">
68
<url>/usr/share/osgearth/data/world.tif</url>

‎src/plugins/globe/globe_plugin.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,19 @@ void GlobePlugin::layersChanged()
175175
{
176176
QgsDebugMsg(">>>>>>>>>> layersChanged");
177177
if (mTileSource) {
178+
/*
178179
//viewer.getDatabasePager()->clear();
179-
mMapNode->getTerrain()->incrementRevision();
180-
/*
180+
//mMapNode->getTerrain()->incrementRevision();
181181
TileList tiles;
182182
mMapNode->getTerrain()->getVersionedTiles( tiles );
183-
for( TileList::iterator i = tiles.begin(); i != tiles.end(); i++ )
184-
i->get()->markTileForRegeneration(); //updateImagery( mQgisMapLayer->getId(), mMapNode->getMap(), mMapNode->getEngine() );
183+
for( TileList::iterator i = tiles.begin(); i != tiles.end(); i++ ) {
184+
//i->get()->markTileForRegeneration();
185+
i->get()->updateImagery( mQgisMapLayer->getId(), mMapNode->getMap(), mMapNode->getEngine() );
186+
}
185187
*/
186188
}
187189
if (mTileSource && mMapNode->getMap()->getImageMapLayers().size() > 1)
188190
{
189-
/*
190191
QgsDebugMsg(">>>>>>>>>> removeMapLayer");
191192
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
192193
mMapNode->getMap()->removeMapLayer( mQgisMapLayer );
@@ -197,7 +198,6 @@ void GlobePlugin::layersChanged()
197198
mQgisMapLayer = new ImageMapLayer( "QGIS", mTileSource );
198199
mMapNode->getMap()->addMapLayer( mQgisMapLayer );
199200
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
200-
*/
201201
}
202202
}
203203

‎src/plugins/globe/qgsosgearthtilesource.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <QFile>
2727
#include <QPainter>
2828

29-
#define QGIS_SCOPED_LOCK GDAL_SCOPED_LOCK
30-
3129
using namespace osgEarth;
3230
using namespace osgEarth::Drivers;
3331

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

4642
osg::Image* QgsOsgEarthTileSource::createImage( const TileKey* key,
4743
ProgressCallback* progress )
4844
{
49-
QGIS_SCOPED_LOCK;
50-
5145
osg::ref_ptr<osg::Image> image;
5246
if (intersects(key))
5347
{
@@ -124,8 +118,6 @@ int QgsOsgEarthTileSource::configureMapRender( const QPaintDevice* paintDevice )
124118

125119
QgsCoordinateReferenceSystem outputCRS;
126120

127-
//wms spec says that CRS parameter is mandatory.
128-
//we don't rejeict the request if it is not there but disable reprojection on the fly
129121
if(true) //TODO
130122
{
131123
//disable on the fly projection
@@ -200,7 +192,6 @@ bool QgsOsgEarthTileSource::intersects(const TileKey* key)
200192
//Get the native extents of the tile
201193
double xmin, ymin, xmax, ymax;
202194
key->getGeoExtent().getBounds(xmin, ymin, xmax, ymax);
203-
204-
//TODO: return ! ( xmin >= _extentsMax.x() || xmax <= _extentsMin.x() || ymin >= _extentsMax.y() || ymax <= _extentsMin.y() );
205-
return true;
195+
QgsRectangle extent = mQGisIface->mapCanvas()->fullExtent();
196+
return ! ( xmin >= extent.xMaximum() || xmax <= extent.xMinimum() || ymin >= extent.yMaximum() || ymax <= extent.yMinimum() );
206197
}

0 commit comments

Comments
 (0)
Please sign in to comment.