Skip to content
Permalink
Browse files

HTTP Proxy support

  • Loading branch information
pka committed Nov 13, 2010
1 parent 32b0520 commit aab17ff97fcf6e6411ec9bc84542d9997ea92b34
Showing with 32 additions and 8 deletions.
  1. +29 −7 src/plugins/globe/globe_plugin.cpp
  2. +3 −1 src/plugins/globe/globe_plugin.h
@@ -112,6 +112,8 @@ void GlobePlugin::run()
osgViewer::Viewer viewer;
#endif

setupProxy();

// install the programmable manipulator.
osgEarthUtil::EarthManipulator* manip = new osgEarthUtil::EarthManipulator();
viewer.setCameraManipulator( manip );
@@ -187,16 +189,36 @@ void GlobePlugin::run()
#endif
}

void GlobePlugin::setupProxy()
{
QSettings settings;
settings.beginGroup( "proxy" );
if (settings.value("/proxyEnabled").toBool())
{
ProxySettings proxySettings(settings.value("/proxyHost").toString().toStdString(),
settings.value("/proxyPort").toInt());
if (!settings.value("/proxyUser").toString().isEmpty())
{
QString auth = settings.value("/proxyUser").toString() + ":" + settings.value("/proxyPassword").toString();
setenv("OSGEARTH_CURL_PROXYAUTH", auth.toStdString().c_str(), 0);
}
//TODO: settings.value("/proxyType")
//TODO: URL exlusions
HTTPClient::setProxySettings(proxySettings);
}
settings.endGroup();
}

void GlobePlugin::extentsChanged()
{
QgsDebugMsg(">>>>>>>>>> extentsChanged: " + mQGisIface->mapCanvas()->extent().toString());
QgsDebugMsg("extentsChanged: " + mQGisIface->mapCanvas()->extent().toString());
}

typedef std::list< osg::ref_ptr<VersionedTile> > TileList;

void GlobePlugin::layersChanged()
{
QgsDebugMsg(">>>>>>>>>> layersChanged");
QgsDebugMsg("layersChanged");
if (mTileSource) {
/*
//viewer.getDatabasePager()->clear();
@@ -211,16 +233,16 @@ void GlobePlugin::layersChanged()
}
if (mTileSource && mMapNode->getMap()->getImageMapLayers().size() > 1)
{
QgsDebugMsg(">>>>>>>>>> removeMapLayer");
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
QgsDebugMsg("removeMapLayer");
QgsDebugMsg(QString("getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
mMapNode->getMap()->removeMapLayer( mQgisMapLayer );
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
QgsDebugMsg(">>>>>>>>>> addMapLayer");
QgsDebugMsg(QString("getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
QgsDebugMsg("addMapLayer");
mTileSource = new QgsOsgEarthTileSource(mQGisIface);
mTileSource->initialize("", 0);
mQgisMapLayer = new ImageMapLayer( "QGIS", mTileSource );
mMapNode->getMap()->addMapLayer( mQgisMapLayer );
QgsDebugMsg(QString(">>>>>>>>>> getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
QgsDebugMsg(QString("getImageMapLayers().size = %1").arg(mMapNode->getMap()->getImageMapLayers().size() ));
}
}

@@ -50,7 +50,9 @@ class GlobePlugin : public QObject, public QgisPlugin
//! show the help document
void help();

//! Called when the main canvas is about to be rendered.
//! Set HTTP proxy settings
void setupProxy();
//! Called when the main canvas is about to be rendered
void renderStarting();
//! Called when the main canvas has rendered.
void renderComplete( QPainter * );

0 comments on commit aab17ff

Please sign in to comment.
You can’t perform that action at this time.