Skip to content
Permalink
Browse files

extent check in tile source

  • Loading branch information
pka committed Sep 3, 2010
1 parent 169de3a commit 1a7a7ab6bc8f55e2bcc8cbfd8ab6880c30d930e3
Showing with 10 additions and 17 deletions.
  1. +2 −0 src/plugins/globe/globe.earth
  2. +6 −6 src/plugins/globe/globe_plugin.cpp
  3. +2 −11 src/plugins/globe/qgsosgearthtilesource.cpp
@@ -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>
@@ -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 );
@@ -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() ));
*/
}
}

@@ -26,8 +26,6 @@
#include <QFile>
#include <QPainter>

#define QGIS_SCOPED_LOCK GDAL_SCOPED_LOCK

using namespace osgEarth;
using namespace osgEarth::Drivers;

@@ -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))
{
@@ -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
@@ -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.
You can’t perform that action at this time.