Skip to content

Commit

Permalink
revert debian unrelated part from r13438
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@13439 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed May 8, 2010
1 parent 8d89272 commit 9f81f1a
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 59 deletions.
21 changes: 9 additions & 12 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,8 @@
#include "qgsattributetabledialog.h"
#include "qgsvectorfilewriter.h"
#include "qgscredentialdialog.h"
#include "qgstilescalewidget.h"

#if QT_VERSION >= 0x40500
#include "qgsnetworkproxyfactory.h"
#endif
#include "qgstilescalewidget.h"

#ifdef HAVE_QWT
#include "qgsgpsinformationwidget.h"
Expand Down Expand Up @@ -365,6 +362,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
, mPythonUtils( NULL )
, mNAM( NULL )
, mpTileScaleWidget( NULL )
#if QT_VERSION >= 0x40500
, mProxyFactory( NULL )
#endif
#ifdef HAVE_QWT
, mpGpsWidget( NULL )
#endif
Expand Down Expand Up @@ -6627,17 +6627,14 @@ void QgisApp::namUpdate()
}

#if QT_VERSION >= 0x40500
if( !mNAM->proxyFactory() )
if ( !mProxyFactory )
{
mNAM->setProxyFactory( new QgsNetworkProxyFactory() );
}

QgsNetworkProxyFactory *pf = dynamic_cast<QgsNetworkProxyFactory *>( mNAM->proxyFactory() );
if( pf )
{
pf->setProxyAndExcludes( proxy, excludes );
mProxyFactory = new QgsNetworkProxyFactory();
mNAM->setProxyFactory( mProxyFactory );
}

mProxyFactory->setProxyAndExcludes( proxy, excludes );

QNetworkDiskCache *cache = qobject_cast<QNetworkDiskCache*>( nam()->cache() );
if ( !cache )
cache = new QNetworkDiskCache( this );
Expand Down
8 changes: 8 additions & 0 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class QgsGPSInformationWidget;
#include "qgsfeature.h"
#include "qgspoint.h"

#if QT_VERSION >= 0x40500
class QgsNetworkProxyFactory;
#endif

/*! \class QgisApp
* \brief Main window for the Qgis application
*/
Expand Down Expand Up @@ -1096,6 +1100,10 @@ class QgisApp : public QMainWindow
//! Persistent tile scale slider
QgsTileScaleWidget * mpTileScaleWidget;

#if QT_VERSION >= 0x40500
QgsNetworkProxyFactory *mProxyFactory;
#endif

int mLastComposerId;

#ifdef HAVE_QWT
Expand Down
18 changes: 9 additions & 9 deletions src/app/qgsmaptoolannotation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <QDialog>
#include <QMouseEvent>

QgsMapToolAnnotation::QgsMapToolAnnotation( QgsMapCanvas* canvas ): QgsMapTool( canvas ),
QgsMapToolAnnotation::QgsMapToolAnnotation( QgsMapCanvas* canvas ): QgsMapTool( canvas ), \
mActiveItem( 0 ), mCurrentMoveAction( QgsAnnotationItem::NoAction ), mLastMousePosition( 0, 0 )
{
mCursor = QCursor( Qt::ArrowCursor );
Expand Down Expand Up @@ -158,26 +158,26 @@ void QgsMapToolAnnotation::canvasMoveEvent( QMouseEvent * e )
double xmax = xmin + size.width();
double ymax = ymin + size.height();

if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRight ||
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRightDown ||
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRight || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRightDown || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRightUp )
{
xmax += e->posF().x() - mLastMousePosition.x();
}
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeft ||
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftDown ||
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeft || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftDown || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftUp )
{
xmin += e->posF().x() - mLastMousePosition.x();
}
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameUp ||
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftUp ||
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameUp || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftUp || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRightUp )
{
ymin += e->posF().y() - mLastMousePosition.y();
}
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameDown ||
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftDown ||
if ( mCurrentMoveAction == QgsAnnotationItem::ResizeFrameDown || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameLeftDown || \
mCurrentMoveAction == QgsAnnotationItem::ResizeFrameRightDown )
{
ymax += e->posF().y() - mLastMousePosition.y();
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsmaptoolrotatepointsymbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <QMessageBox>
#include <QMouseEvent>

QgsMapToolRotatePointSymbols::QgsMapToolRotatePointSymbols( QgsMapCanvas* canvas ): QgsMapToolEdit( canvas ),
mActiveLayer( 0 ), mFeatureNumber( 0 ), mCurrentMouseAzimut( 0.0 ), mCurrentRotationFeature( 0.0 ),
QgsMapToolRotatePointSymbols::QgsMapToolRotatePointSymbols( QgsMapCanvas* canvas ): QgsMapToolEdit( canvas ), \
mActiveLayer( 0 ), mFeatureNumber( 0 ), mCurrentMouseAzimut( 0.0 ), mCurrentRotationFeature( 0.0 ), \
mRotating( false ), mRotationItem( 0 ), mCtrlPressed( false )
{

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsmaptoolsimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool QgsMapToolSimplify::calculateSliderBoudaries()
{
count++;
if ( count == 30 && !maximized )
{ //special case when tolerance is too low to be correct so it's near 0
{ //special case when tolerance is tool low to be correct so it's similat to 0
// else in some special cases this algorithm would create infinite loop
found = true;
minTolerance = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsnetworkproxyfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ QList<QNetworkProxy> QgsNetworkProxyFactory::queryProxy( const QNetworkProxyQuer
}

QgsDebugMsg( QString("using user proxy for %1").arg( url ) );
return QList<QNetworkProxy>() << mProxy;
return QList<QNetworkProxy>() << mProxy;
}

#endif // QT_VERSION >= 0x40500
6 changes: 5 additions & 1 deletion src/app/qgsnetworkproxyfactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
#ifndef QGSNETWORKPROXYFACTORY_H
#define QGSNETWORKPROXYFACTORY_H

#if QT_VERSION >= 0x40500

#include <QNetworkProxyFactory>
#include <QStringList>

class QgsNetworkProxyFactory : public QObject, public QNetworkProxyFactory
class QgsNetworkProxyFactory : public QNetworkProxyFactory
{
public:
QgsNetworkProxyFactory();
Expand All @@ -35,4 +37,6 @@ class QgsNetworkProxyFactory : public QObject, public QNetworkProxyFactory
QNetworkProxy mProxy;
};

#endif // QT_VERSION >= 0x40500

#endif
2 changes: 0 additions & 2 deletions src/plugins/grass/qtermwidget/TerminalDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2423,8 +2423,6 @@ QVariant TerminalDisplay::inputMethodQuery( Qt::InputMethodQuery query ) const
case Qt::ImCurrentSelection:
return QString();
break;
default:
break;
}

return QVariant();
Expand Down
14 changes: 2 additions & 12 deletions src/plugins/spatialquery/qgsspatialquerydialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ void QgsSpatialQueryDialog::runQuery()
buttonBox->button( QDialogButtonBox::Close )->show();
buttonBox->button( QDialogButtonBox::Cancel )->hide();
buttonBox->button( QDialogButtonBox::Ok )->hide();
adjustSize();
} // void QgsSpatialQueryDialog::runQuery()

void QgsSpatialQueryDialog::setInputsVisible( bool show )
Expand Down Expand Up @@ -587,17 +586,8 @@ void QgsSpatialQueryDialog::on_buttonBox_accepted()

void QgsSpatialQueryDialog::on_buttonBox_rejected()
{
if ( grpResults->isHidden() )
reject();
else
{
grpResults->hide();
setInputsVisible( true );
progressBarStatus->show();
buttonBox->button( QDialogButtonBox::Close )->hide();
buttonBox->button( QDialogButtonBox::Cancel )->show();
buttonBox->button( QDialogButtonBox::Ok )->show();
}
reject();

} // void QgsSpatialQueryDialog::on_buttonBox_rejected()

void QgsSpatialQueryDialog::on_targetLayerComboBox_currentIndexChanged( int index )
Expand Down
18 changes: 18 additions & 0 deletions src/plugins/spatialquery/qgsspatialquerydialogbase.ui
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,22 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsSpatialQueryDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>288</x>
<y>438</y>
</hint>
<hint type="destinationlabel">
<x>292</x>
<y>459</y>
</hint>
</hints>
</connection>
</connections>
</ui>
33 changes: 14 additions & 19 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,8 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
}

double tres = mResolutions[i];
double dx = mTileWidth * tres;
double dy = mTileHeight * tres;

// clip view extent to layer extent
double xmin = std::max( viewExtent.xMinimum(), layerExtent.xMinimum() );
Expand All @@ -579,12 +581,12 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
double ymax = std::min( viewExtent.yMaximum(), layerExtent.yMaximum() );

// snap to tile coordinates
double x0 = floor(( xmin - layerExtent.xMinimum() ) / mTileWidth / tres ) * mTileWidth * tres + layerExtent.xMinimum();
double y0 = floor(( ymin - layerExtent.yMinimum() ) / mTileHeight / tres ) * mTileHeight * tres + layerExtent.yMinimum();
double x0 = floor(( xmin - layerExtent.xMinimum() ) / dx ) * dx + layerExtent.xMinimum();
double y0 = floor(( ymin - layerExtent.yMinimum() ) / dy ) * dy + layerExtent.yMinimum();

#ifdef QGISDEBUG
// calculate number of tiles
int n = ceil(( xmax - xmin ) / mTileWidth / tres ) * ceil(( ymax - ymin ) / mTileHeight / tres );
int n = ceil(( xmax - xmin ) / dx ) * ceil(( ymax - ymin ) / dy );
#endif

QgsDebugMsg( QString( "layer extent: %1,%2 %3x%4" )
Expand All @@ -602,13 +604,13 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
);
QgsDebugMsg( QString( "tile extent: %1,%2 %3x%4 pixel:%5x%6 res:%7" )
.arg( x0, 0, 'f' ).arg( y0, 0, 'f' )
.arg( mTileWidth * tres, 0, 'f' ).arg( mTileHeight * tres, 0, 'f' )
.arg( dx, 0, 'f' ).arg( dy, 0, 'f' )
.arg( mTileWidth ).arg( mTileHeight )
.arg( tres, 0, 'f' )
);
QgsDebugMsg( QString( "tile number: %1x%2 = %3" )
.arg( ceil(( xmax - xmin ) / mTileWidth / tres ) )
.arg( ceil(( ymax - ymin ) / mTileHeight / tres ) )
.arg( ceil(( xmax - xmin ) / dx ) )
.arg( ceil(( ymax - ymin ) / dy ) )
.arg( n )
);

Expand All @@ -633,40 +635,33 @@ QImage *QgsWmsProvider::draw( QgsRectangle const &viewExtent, int pixelWidth, i
urlargs += QString( "&FORMAT=%1" ).arg( imageMimeType );
urlargs += QString( "&TILED=true" );

i = 0;
int j = 0;
double y = y0;
while ( y < ymax )
for ( double y = y0; y < ymax; y += dy )
{
int k = 0;
double x = x0;
while ( x < xmax )
for ( double x = x0; x <= xmax; x += dx )
{
QString turl;
turl += url;
turl += QString( changeXY ? "&BBOX=%2,%1,%4,%3" : "&BBOX=%1,%2,%3,%4" )
.arg( x, 0, 'f' )
.arg( y, 0, 'f' )
.arg( x + mTileWidth * tres, 0, 'f' )
.arg( y + mTileHeight * tres, 0, 'f' );
.arg( x + dx, 0, 'f' )
.arg( y + dy, 0, 'f' );
turl += urlargs;

QNetworkRequest request( turl );
QgsDebugMsg( QString( "tileRequest %1 %2/%3: %4" ).arg( mTileReqNo ).arg( i++ ).arg( n ).arg( turl ) );
QgsDebugMsg( QString( "tileRequest %1 %2/%3: %4" ).arg( mTileReqNo ).arg( j++ ).arg( n ).arg( turl ) );
request.setAttribute( QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache );
request.setAttribute( QNetworkRequest::CacheSaveControlAttribute, true );
request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 0 ), mTileReqNo );
request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 1 ), j );
request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 2 ), QRectF( x, y, mTileWidth * tres, mTileHeight * tres ) );
request.setAttribute( static_cast<QNetworkRequest::Attribute>( QNetworkRequest::User + 2 ), QRectF( x, y, dx, dy ) );

QgsDebugMsg( QString( "gettile: %1" ).arg( turl ) );
QNetworkReply *reply = smNAM->get( request );
tileReplies << reply;
connect( reply, SIGNAL( finished() ), this, SLOT( tileReplyFinished() ) );

x = x0 + k++*mTileWidth * tres;
}
y = y0 + j++*mTileHeight * tres;
}

mWaiting = true;
Expand Down

0 comments on commit 9f81f1a

Please sign in to comment.