renamed misnamed QgsMapRender (verb) to QgsMapRenderer (noun) as part of cleanups for 1.0.0 release. Updated all related dependencies. Also removed some spurious debug messages

git-svn-id: http://svn.osgeo.org/qgis/trunk@8997 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2008-08-05 21:11:58 +00:00
parent 4bb5f678b4
commit fb674886b7
50 changed files with 482 additions and 753 deletions

View File

@ -29,7 +29,7 @@
%Include qgslogger.sip
%Include qgsmaplayer.sip
%Include qgsmaplayerregistry.sip
%Include qgsmaprender.sip
%Include qgsmaprenderer.sip
%Include qgsmaptopixel.sip
%Include qgsmarkercatalogue.sip
%Include qgsmessageoutput.sip

View File

@ -177,5 +177,19 @@ static void qtgui_UpdatePyArgv(PyObject *argvlist, int argc, char **argv)
//! Returns whether this machine uses big or little endian
static endian_t endian();
/** \brief get a standard css style sheet for reports.
* Typically you will use this method by doing:
* QString myStyle = QgsApplication::reportStyleSheet();
* textBrowserReport->document()->setDefaultStyleSheet(myStyle);
* @return QString containing the CSS 2.1 compliant stylesheet.
* @note you can use the special Qt extensions too, for example
* the gradient fills for backgrounds.
*/
static QString reportStyleSheet();
/** Convenience function to get a summary of the paths used in this
* application instance useful for debugging mainly.*/
static QString showSettings();
};

View File

@ -1,23 +1,23 @@
/**
* \class QgsMapRender
* \class QgsMapRenderer
* \brief Class for rendering map layer set
*
*/
class QgsMapRender : QObject
class QgsMapRenderer : QObject
{
%TypeHeaderCode
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
%End
public:
//! constructor
QgsMapRender();
QgsMapRenderer();
//! destructor
~QgsMapRender();
~QgsMapRenderer();
//! starts rendering
void render(QPainter* painter);

View File

@ -57,7 +57,7 @@ public:
ALL_RESULTS_WITHIN_GIVEN_TOLERANCES
};
QgsSnapper(QgsMapRender* mapRender);
QgsSnapper(QgsMapRenderer* mapRender);
~QgsSnapper();
/**Does the snapping operation
@param startPoint the start point for snapping (in pixel coordinates)

View File

@ -62,7 +62,7 @@ class QgsMapCanvas : QGraphicsView
QgsMapCanvasMap* map();
QgsMapRender* mapRender();
QgsMapRenderer* mapRender();
//! Accessor for the canvas pixmap
QPixmap& canvasPixmap();

View File

@ -23,7 +23,7 @@
#include "qgsmaplayer.h"
#include "qgsmaptopixel.h"
#include "qgsproject.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsrendercontext.h"
#include "qgsvectorlayer.h"
@ -138,27 +138,27 @@ void QgsComposerMap::draw ( QPainter *painter, const QgsRect& extent, const QSiz
return;
}
QgsMapRender* canvasMapRender = mMapCanvas->mapRender();
if(!canvasMapRender)
QgsMapRenderer* canvasMapRenderer = mMapCanvas->mapRender();
if(!canvasMapRenderer)
{
return;
}
QgsMapRender theMapRender;
theMapRender.setExtent(extent);
theMapRender.setOutputSize(size, dpi);
theMapRender.setLayerSet(canvasMapRender->layerSet());
theMapRender.setProjectionsEnabled(canvasMapRender->projectionsEnabled());
theMapRender.setDestinationSrs(canvasMapRender->destinationSrs());
QgsMapRenderer theMapRenderer;
theMapRenderer.setExtent(extent);
theMapRenderer.setOutputSize(size, dpi);
theMapRenderer.setLayerSet(canvasMapRenderer->layerSet());
theMapRenderer.setProjectionsEnabled(canvasMapRenderer->projectionsEnabled());
theMapRenderer.setDestinationSrs(canvasMapRenderer->destinationSrs());
QgsRenderContext* theRenderContext = theMapRender.renderContext();
QgsRenderContext* theRenderContext = theMapRenderer.renderContext();
if(theRenderContext)
{
theRenderContext->setDrawEditingInformation(false);
theRenderContext->setRenderingStopped(false);
}
theMapRender.render(painter);
theMapRenderer.render(painter);
mMapCanvas->freeze(false);
}

View File

@ -32,7 +32,7 @@
#include "qgsmapcanvasmap.h"
#include "qgsmaplayer.h"
#include "qgsmaplayerregistry.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsproject.h"
#include "qgsrasterlayer.h"
#include "qgsrasterlayerproperties.h"

View File

@ -106,7 +106,7 @@
#include "qgsmaplayerinterface.h"
#include "qgsmaplayerregistry.h"
#include "qgsmapoverviewcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmaptip.h"
#include "qgsmessageviewer.h"
#include "qgsoptions.h"
@ -268,9 +268,9 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
proj4String = QgsProject::instance()->readEntry("SpatialRefSys","//ProjectSRSProj4String",GEOPROJ4);
QgsSpatialRefSys defaultSRS;
if(defaultSRS.createFromProj4(proj4String))
{
mySelector->setSelectedSRSID(defaultSRS.srsid());
}
{
mySelector->setSelectedSRSID(defaultSRS.srsid());
}
if(mySelector->exec())
{
@ -328,6 +328,7 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
createStatusBar();
updateRecentProjectPaths();
createCanvas();
mMapCanvas->freeze();
createLegend();
createOverview();
createMapTips();
@ -361,44 +362,8 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
mSplash->showMessage(tr("Starting Python"), Qt::AlignHCenter | Qt::AlignBottom);
qApp->processEvents();
// try to load python support
QString pythonlibName("qgispython");
#ifdef Q_WS_MAC
pythonlibName.prepend(QgsApplication::prefixPath() + "/lib/");
#endif
QLibrary pythonlib(pythonlibName);
// It's necessary to set these two load hints, otherwise Python library won't work correctly
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
pythonlib.setLoadHints(QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint);
if (pythonlib.load())
{
QgsDebugMsg("Python support library loaded successfully.");
typedef QgsPythonUtils* (*inst)();
inst pythonlib_inst = (inst) pythonlib.resolve("instance");
if (pythonlib_inst)
{
QgsDebugMsg("Python support library's instance() symbol resolved.");
mPythonUtils = pythonlib_inst();
mPythonUtils->initPython(mQgisInterface);
}
else
{
QgsDebugMsg("Couldn't resolve python support library's instance() symbol.");
}
}
else
{
QgsDebugMsg("Couldn't load Python support library.");
}
if (mPythonUtils && mPythonUtils->isEnabled())
{
mActionShowPythonDialog = new QAction(tr("Python console"), this);
connect(mActionShowPythonDialog, SIGNAL(triggered()), this, SLOT(showPythonDialog()));
loadPythonSupport();
mPluginMenu->addAction(mActionShowPythonDialog);
QgsDebugMsg("Python support ENABLED :-)");
}
// Create the plugin registry and load plugins
// load any plugins that were running in the last session
@ -447,6 +412,7 @@ static void customSrsValidation_(QgsSpatialRefSys* srs)
qApp->processEvents();
//finally show all the application settings as initialised above
QgsApplication::showSettings();
mMapCanvas->freeze(false);
} // QgisApp ctor
@ -527,12 +493,6 @@ void QgisApp::readSettings()
// Add the recently accessed project file paths to the File menu
mRecentProjectPaths = settings.value("/UI/recentProjectsList").toStringList();
/*
// Set the behaviour when the map splitters are resized
bool splitterRedraw = settings.value("/qgis/splitterRedraw", true).toBool();
canvasLegendSplit->setOpaqueResize(splitterRedraw);
legendOverviewSplit->setOpaqueResize(splitterRedraw);
*/
}
@ -575,14 +535,6 @@ void QgisApp::createActions()
mActionSaveMapAsImage->setStatusTip(tr("Save map as image"));
connect(mActionSaveMapAsImage, SIGNAL(triggered()), this, SLOT(saveMapAsImage()));
//
// TODO: Remove the mActionExportMapServer related code once the mapserver export plugin
// is complete and tested.
/* mActionExportMapServer= new QAction(getThemeIcon("/mActionExportMapServer.png"), tr("Export to MapServer Map..."), this);
mActionExportMapServer->setShortcut(tr("M","Export as MapServer .map file"));
mActionExportMapServer->setStatusTip(tr("Export as MapServer .map file"));
connect(mActionExportMapServer, SIGNAL(triggered()), this, SLOT(exportMapServer()));
*/
//
mActionFileExit= new QAction(getThemeIcon("/mActionFileExit.png"), tr("Exit"), this);
mActionFileExit->setShortcut(tr("Ctrl+Q","Exit QGIS"));
mActionFileExit->setStatusTip(tr("Exit QGIS"));
@ -963,10 +915,6 @@ void QgisApp::createMenus()
mFileMenu->addAction(mActionFileSaveAs);
mFileMenu->addAction(mActionSaveMapAsImage);
mFileMenu->addSeparator();
// TODO: remove the addAction once the mapserver export plugin is complete and tested
/*
mFileMenu->addAction(mActionExportMapServer);
*/
mFileMenu->addAction(mActionFilePrint);
mFileMenu->addSeparator();
mFileMenu->addAction(mActionFileExit);
@ -1272,17 +1220,13 @@ void QgisApp::setTheme(QString theThemeName)
//
*/
QgsApplication::setThemeName(theThemeName);
QgsDebugMsg("Setting theme to \n" + theThemeName);
//QgsDebugMsg("Setting theme to \n" + theThemeName);
mActionFileNew->setIcon(getThemeIcon( "/mActionFileNew.png"));
mActionFileSave->setIcon(getThemeIcon( "/mActionFileSave.png"));
mActionFileSaveAs->setIcon(getThemeIcon( "/mActionFileSaveAs.png"));
mActionFileOpen->setIcon(getThemeIcon( "/mActionFileOpen.png"));
mActionFilePrint->setIcon(getThemeIcon( "/mActionFilePrint.png"));
mActionSaveMapAsImage->setIcon(getThemeIcon( "/mActionSaveMapAsImage.png"));
// TODO: Remove the mActionExportMapServer related code once the mapserver export plugin
/*
mActionExportMapServer->setIcon(getThemeIcon( "/mActionExportMapServer.png"));
*/
mActionFileExit->setIcon(getThemeIcon( "/mActionFileExit.png"));
mActionAddOgrLayer->setIcon(getThemeIcon( "/mActionAddOgrLayer.png"));
mActionAddRasterLayer->setIcon(getThemeIcon( "/mActionAddRasterLayer.png"));
@ -1574,8 +1518,6 @@ void QgisApp::saveWindowState()
// store window geometry
settings.setValue("/UI/geometry", saveGeometry());
// settings.setValue("/UI/canvasSplitterState", canvasLegendSplit->saveState());
// settings.setValue("/UI/legendSplitterState", legendOverviewSplit->saveState());
}
void QgisApp::restoreWindowState()
@ -1587,8 +1529,6 @@ void QgisApp::restoreWindowState()
// restore window geometry
restoreGeometry(settings.value("/UI/geometry").toByteArray());
// canvasLegendSplit->restoreState(settings.value("/UI/canvasSplitterState").toByteArray());
// legendOverviewSplit->restoreState(settings.value("/UI/legendSplitterState").toByteArray());
}
///////////// END OF GUI SETUP ROUTINES ///////////////
@ -1670,8 +1610,6 @@ void QgisApp::about()
void QgisApp::restoreSessionPlugins(QString thePluginDirString)
{
QSettings mySettings;
QgsDebugMsg("\n\n*************************************************");
QgsDebugMsg("Restoring plugins from last session " + thePluginDirString);
#ifdef WIN32
QString pluginExt = "*.dll";
@ -1686,14 +1624,11 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
{
QString myFullPath = thePluginDirString + "/" + myPluginDir[i];
QgsDebugMsg("Examining " + myFullPath);
QLibrary *myLib = new QLibrary(myFullPath);
bool loaded = myLib->load();
if (loaded)
{
//purposely leaving this one to stdout!
std::cout << "Loaded " << myLib->fileName().toLocal8Bit().data() << std::endl;
name_t * myName =(name_t *) myLib->resolve("name");
description_t * myDescription = (description_t *) myLib->resolve("description");
@ -1707,24 +1642,24 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
if (mySettings.value("/Plugins/" + myEntryName).toBool())
{
QgsDebugMsg("Loading plugin: " + myEntryName);
//QgsDebugMsg("Loading plugin: " + myEntryName);
loadPlugin(myName(), myDescription(), myFullPath);
}
else
{
QgsDebugMsg("Plugin was not active last session, leaving disabled: " + myEntryName);
//QgsDebugMsg("Plugin was not active last session, leaving disabled: " + myEntryName);
}
}
else
{
QgsDebugMsg("Failed to get name, description, or type for " + myLib->fileName());
//QgsDebugMsg("Failed to get name, description, or type for " + myLib->fileName());
}
}
else
{
QgsDebugMsg("Failed to load " + myLib->fileName());
QgsDebugMsg("Reason: " + myLib->errorString());
//QgsDebugMsg("Failed to load " + myLib->fileName());
//QgsDebugMsg("Reason: " + myLib->errorString());
}
delete myLib;
}
@ -1736,6 +1671,7 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
// check for python plugins system-wide
QStringList pluginList = mPythonUtils->pluginList();
std::cout << "Loading python plugins" << std::endl;
for (int i = 0; i < pluginList.size(); i++)
{
@ -1767,9 +1703,7 @@ void QgisApp::restoreSessionPlugins(QString thePluginDirString)
}
}
}
QgsDebugMsg("Loading plugins completed");
QgsDebugMsg("*************************************************\n\n");
std::cout << "Plugin loading completed";
}
@ -1924,7 +1858,7 @@ static void buildSupportedVectorFileFilter_(QString & fileFilters)
#endif // DEPRECATED
fileFilters = QgsProviderRegistry::instance()->fileVectorFilters();
QgsDebugMsg("Vector file filters: " + fileFilters);
//QgsDebugMsg("Vector file filters: " + fileFilters);
} // buildSupportedVectorFileFilter_()
@ -2550,7 +2484,7 @@ void QgisApp::fileNew(bool thePromptToSaveFlag)
}
}
QgsDebugMsg("erasing project");
//QgsDebugMsg("erasing project");
mMapCanvas->freeze(true);
QgsMapLayerRegistry::instance()->removeAllMapLayers();
@ -2589,11 +2523,9 @@ void QgisApp::fileNew(bool thePromptToSaveFlag)
setTitleBarText_( *this );
QgsDebugMsg("emiting new project signal");
//QgsDebugMsg("emiting new project signal");
//note by Tim: I did some casual egrepping and this signal doesnt actually
//seem to be connected to anything....why is it here? Just for future needs?
//note by Martin: actually QgsComposer does use it
//emit signal so QgsComposer knows we have a new project
emit newProject();
mMapCanvas->freeze(false);
@ -2611,9 +2543,9 @@ void QgisApp::newVectorLayer()
{
if(mMapCanvas && mMapCanvas->isDrawing())
{
return;
}
{
return;
}
QGis::WKBTYPE geometrytype;
QString fileformat;
@ -3344,10 +3276,10 @@ void QgisApp::stopRendering()
{
if(mMapCanvas)
{
QgsMapRender* mypMapRender = mMapCanvas->mapRender();
if(mypMapRender)
QgsMapRenderer* mypMapRenderer = mMapCanvas->mapRender();
if(mypMapRenderer)
{
QgsRenderContext* mypRenderContext = mypMapRender->renderContext();
QgsRenderContext* mypRenderContext = mypMapRenderer->renderContext();
if(mypRenderContext)
{
mypRenderContext->setRenderingStopped(true);
@ -3378,39 +3310,6 @@ void QgisApp::showAllLayers()
legend()->selectAll(true);
}
// TODO: remove the method once the mapserver export plugin is complete and tested
/*
void QgisApp::exportMapServer()
{
// check to see if there are any layers to export
// Possibly we may reinstate this in the future if we provide 'active project' export again
//if (mMapCanvas->layerCount() > 0)
//{
QString myMSExportPath = QgsApplication::msexportAppPath();
QProcess *process = new QProcess;
#ifdef WIN32
// quote the application path on windows
myMSExportPath = QString("\"") + myMSExportPath + QString("\"");
#endif
process->start(myMSExportPath);
// Delete this object if the process terminates
connect(process, SIGNAL(finished(int, QProcess::ExitStatus)),
SLOT(processExited()));
// Delete the process if the application quits
connect(qApp, SIGNAL(aboutToQuit()), process, SLOT(terminate()));
//}
//else
//{
// QMessageBox::warning(this, tr("No Map Layers"),
// tr("No layers to export. You must add at least one layer to the map in order to export the view."));
//}
}
*/
void QgisApp::zoomIn()
{
@ -3539,15 +3438,12 @@ void QgisApp::splitFeatures()
void QgisApp::capturePoint()
{
if(mMapCanvas && mMapCanvas->isDrawing())
{
return;
}
{
return;
}
// set current map tool to select
mMapCanvas->setMapTool(mMapTools.mCapturePoint);
// FIXME: is this still actual or something old that's not used anymore?
//connect(t, SIGNAL(xyClickCoordinates(QgsPoint &)), this, SLOT(showCapturePointCoordinate(QgsPoint &)));
}
void QgisApp::captureLine()
@ -3711,8 +3607,6 @@ void QgisApp::pasteTransformations()
void QgisApp::refreshMapCanvas()
{
QgsDebugMsg("called.");
mMapCanvas->refresh();
}
@ -3768,7 +3662,7 @@ void QgisApp::showMouseCoordinate(QgsPoint & p)
mpMaptip->clear ( mMapCanvas );
// don't start the timer if the mouse is not over the map canvas
mpMapTipsTimer->start();
QgsDebugMsg("Started maptips timer");
//QgsDebugMsg("Started maptips timer");
}
}
}
@ -3911,6 +3805,50 @@ void QgisApp::showPluginManager()
}
}
void QgisApp::loadPythonSupport()
{
QString pythonlibName("qgispython");
#ifdef Q_WS_MAC
pythonlibName.prepend(QgsApplication::prefixPath() + "/lib/");
#endif
QLibrary pythonlib(pythonlibName);
// It's necessary to set these two load hints, otherwise Python library won't work correctly
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
pythonlib.setLoadHints(QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint);
if (pythonlib.load())
{
//QgsDebugMsg("Python support library loaded successfully.");
typedef QgsPythonUtils* (*inst)();
inst pythonlib_inst = (inst) pythonlib.resolve("instance");
if (pythonlib_inst)
{
//QgsDebugMsg("Python support library's instance() symbol resolved.");
mPythonUtils = pythonlib_inst();
mPythonUtils->initPython(mQgisInterface);
}
else
{
//using stderr on purpose because we want end users to see this [TS]
std::cerr << "Couldn't resolve python support library's instance() symbol." << std::endl;
}
}
else
{
//using stderr on purpose because we want end users to see this [TS]
std::cerr << "Couldn't load Python support library." << std::endl;
}
if (mPythonUtils && mPythonUtils->isEnabled())
{
mActionShowPythonDialog = new QAction(tr("Python console"), this);
connect(mActionShowPythonDialog, SIGNAL(triggered()), this, SLOT(showPythonDialog()));
mPluginMenu->addAction(mActionShowPythonDialog);
// Purposely using stdout here [TS]
std::cout << "Python support ENABLED :-) " << std::endl;
}
}
void QgisApp::loadPythonPlugin(QString packageName, QString pluginName)
{
if (!mPythonUtils || !mPythonUtils->isEnabled())
@ -3919,7 +3857,6 @@ void QgisApp::loadPythonPlugin(QString packageName, QString pluginName)
return;
}
QgsDebugMsg("I should load python plugin: " + pluginName + " (package: " + packageName + ")");
QgsPluginRegistry *pRegistry = QgsPluginRegistry::instance();
@ -3937,6 +3874,8 @@ void QgisApp::loadPythonPlugin(QString packageName, QString pluginName)
// add to settings
QSettings settings;
settings.setValue("/PythonPlugins/" + packageName, true);
std::cout << "Loaded : " << pluginName.toLocal8Bit().constData() << " (package: "
<< packageName.toLocal8Bit().constData() << ")" << std::endl;
}
}
@ -3955,13 +3894,13 @@ void QgisApp::loadPlugin(QString name, QString description, QString theFullPathN
{
QLibrary *myLib = new QLibrary(theFullPathName);
QgsDebugMsg("Library name is " + myLib->fileName());
QString myError; //we will only show detailed diagnostics if something went wrong
myError +="Library name is " + myLib->fileName() + " " + QString(__LINE__) + " in " + QString(__FUNCTION__) + "\n";
bool loaded = myLib->load();
if (loaded)
{
QgsDebugMsg("Loaded test plugin library");
QgsDebugMsg("Attempting to resolve the classFactory function");
myError += "Attempting to resolve the classFactory function " + QString (__LINE__) + " in " + QString (__FUNCTION__ ) + "\n";
type_t *pType = (type_t *) myLib->resolve("type");
@ -3986,7 +3925,9 @@ void QgisApp::loadPlugin(QString name, QString description, QString theFullPathN
else
{
// something went wrong
QMessageBox::warning(this, tr("Error Loading Plugin"), tr("There was an error loading %1."));
QMessageBox::warning(this, tr("Error Loading Plugin"), tr("There was an error loading a plugin."
"The following diagnostic information may help the QGIS developers resolve the issue:\n%1.").arg
(myError));
//disable it to the qsettings file [ts]
settings.setValue("/Plugins/" + name, false);
}
@ -4033,181 +3974,12 @@ void QgisApp::loadPlugin(QString name, QString description, QString theFullPathN
QgsDebugMsg("Plugin " + theFullPathName + " did not return a valid type and cannot be loaded");
break;
}
/* }else{
QgsDebugMsg("Unable to find the class factory for " + mFullPathName);
} */
}
else
{
QgsDebugMsg("Failed to load " + theFullPathName);
}
delete myLib;
}
}
void QgisApp::testMapLayerPlugins()
{
#ifndef WIN32
// map layer plugins live in their own directory (somewhere to be determined)
QDir mlpDir("../plugins/maplayer", "*.so.1.0.0", QDir::Name | QDir::IgnoreCase, QDir::Files);
if (mlpDir.count() == 0)
{
QMessageBox::information(this, tr("No MapLayer Plugins"), tr("No MapLayer plugins in ../plugins/maplayer"));
}
else
{
for (unsigned i = 0; i < mlpDir.count(); i++)
{
QgsDebugMsg("Getting information for plugin: " + mlpDir[i]);
QgsDebugMsg("Attempting to load the plugin using dlopen");
// void *handle = dlopen("../plugins/maplayer/" + mlpDir[i], RTLD_LAZY);
void *handle = dlopen(("../plugins/maplayer/" + mlpDir[i]).toLocal8Bit().data(), RTLD_LAZY | RTLD_GLOBAL );
if (!handle)
{
QgsDebugMsg( QString("Error in dlopen: %1").arg( dlerror() ));
}
else
{
QgsDebugMsg("dlopen succeeded");
dlclose(handle);
}
QLibrary *myLib = new QLibrary("../plugins/maplayer/" + mlpDir[i]);
QgsDebugMsg("Library name is " + myLib->fileName());
bool loaded = myLib->load();
if (loaded)
{
QgsDebugMsg("Loaded test plugin library");
QgsDebugMsg("Attempting to resolve the classFactory function");
create_it *cf = (create_it *) myLib->resolve("classFactory");
if (cf)
{
QgsDebugMsg("Getting pointer to a MapLayerInterface object from the library");
QgsMapLayerInterface *pl = cf();
if (pl)
{
QgsDebugMsg("Instantiated the maplayer test plugin");
// set the main window pointer for the plugin
pl->setQgisMainWindow(this);
//the call to getInt is deprecated and this line should be removed
//QgsDebugMsg("getInt returned " + QString::number(pl->getInt()) + " from map layer plugin");
// set up the gui
pl->initGui();
}
else
{
QgsDebugMsg("Unable to instantiate the maplayer test plugin");
}
}
}
else
{
QgsDebugMsg("Failed to load " + mlpDir[i]);
}
}
}
#endif //#ifndef WIN32
}
void QgisApp::testPluginFunctions()
{
// test maplayer plugins first
testMapLayerPlugins();
if (false)
{
// try to load plugins from the plugin directory and test each one
QDir pluginDir("../plugins", "*.so*", QDir::Name | QDir::IgnoreCase, QDir::Files | QDir::NoSymLinks);
//pluginDir.setFilter(QDir::Files || QDir::NoSymLinks);
//pluginDir.setNameFilter("*.so*");
if (pluginDir.count() == 0)
{
QMessageBox::information(this, tr("No Plugins"),
tr("No plugins found in ../plugins. To test plugins, start qgis from the src directory"));
}
else
{
for (unsigned i = 0; i < pluginDir.count(); i++)
{
QgsDebugMsg("Getting information for plugin: " + pluginDir[i]);
QLibrary *myLib = new QLibrary("../plugins/" + pluginDir[i]); //"/home/gsherman/development/qgis/plugins/" + pluginDir[i]);
QgsDebugMsg("Library name is " + myLib->fileName());
//QLibrary myLib("../plugins/" + pluginDir[i]);
QgsDebugMsg("Attempting to load ../plugins/" + pluginDir[i]);
/* void *handle = dlopen("/home/gsherman/development/qgis/plugins/" + pluginDir[i], RTLD_LAZY);
if (!handle) {
std::cout << "Error in dlopen: " << dlerror() << std::endl;
}else{
std::cout << "dlopen suceeded" << std::endl;
dlclose(handle);
}
*/
bool loaded = myLib->load();
if (loaded)
{
QgsDebugMsg("Loaded test plugin library");
QgsDebugMsg("Getting the name of the plugin");
name_t *pName = (name_t *) myLib->resolve("name");
if (pName)
{
QMessageBox::information(this, tr("Name"), tr("Plugin %1 is named %2").arg(pluginDir[i]).arg(pName()));
}
QgsDebugMsg("Attempting to resolve the classFactory function");
create_t *cf = (create_t *) myLib->resolve("classFactory");
if (cf)
{
QgsDebugMsg("Getting pointer to a QgisPlugin object from the library");
QgisPlugin *pl = cf(mQgisInterface);
QgsDebugMsg("Displaying name, version, and description");
QgsDebugMsg("Plugin name: " + pl->name());
QgsDebugMsg("Plugin version: " + pl->version());
QgsDebugMsg("Plugin description: " + pl->description());
QMessageBox::information(this, tr("Plugin Information"), tr("QGis loaded the following plugin:") +
tr("Name: %1").arg(pl->name()) + "\n" + tr("Version: %1").arg(pl->version()) + "\n" +
tr("Description: %1").arg(pl->description()));
// unload the plugin (delete it)
QgsDebugMsg("Attempting to resolve the unload function");
/*
unload_t *ul = (unload_t *) myLib.resolve("unload");
if (ul) {
ul(pl);
std::cout << "Unloaded the plugin\n";
} else {
std::cout << "Unable to resolve unload function. Plugin was not unloaded\n";
}
*/
}
}
else
{
QMessageBox::warning(this, tr("Unable to Load Plugin"),
tr("QGIS was unable to load the plugin from: %1").arg(pluginDir[i]));
QgsDebugMsg("Unable to load library");
}
}
QgsDebugMsg("Failed to load " + theFullPathName);
}
delete myLib;
}
}
@ -4359,9 +4131,6 @@ void QgisApp::options()
double zoomFactor = mySettings.value("/qgis/zoom_factor", 2).toDouble();
mMapCanvas->setWheelAction((QgsMapCanvas::WheelAction) action, zoomFactor);
// bool splitterRedraw = mySettings.value("/qgis/splitterRedraw", true).toBool();
// canvasLegendSplit->setOpaqueResize(splitterRedraw);
// legendOverviewSplit->setOpaqueResize(splitterRedraw);
setupProxy();
}
}
@ -4529,9 +4298,9 @@ bool QgisApp::saveDirty()
QMessageBox::StandardButton answer(QMessageBox::Discard);
mMapCanvas->freeze(true);
QgsDebugMsg(QString("Layer count is %1").arg(mMapCanvas->layerCount()));
QgsDebugMsg(QString("Project is %1dirty").arg( QgsProject::instance()->dirty() ? "" : "not "));
QgsDebugMsg(QString("Map canvas is %1dirty").arg(mMapCanvas->isDirty() ? "" : "not "));
//QgsDebugMsg(QString("Layer count is %1").arg(mMapCanvas->layerCount()));
//QgsDebugMsg(QString("Project is %1dirty").arg( QgsProject::instance()->dirty() ? "" : "not "));
//QgsDebugMsg(QString("Map canvas is %1dirty").arg(mMapCanvas->isDirty() ? "" : "not "));
QSettings settings;
bool askThem = settings.value("qgis/askToSaveProjectChanges", true).toBool();
@ -4665,8 +4434,6 @@ void QgisApp::projectionsEnabled(bool theFlag)
// slot to update the progress bar in the status bar
void QgisApp::showProgress(int theProgress, int theTotalSteps)
{
QgsDebugMsg( QString("%1/%2").arg(theProgress).arg(theTotalSteps) );
if (theProgress==theTotalSteps)
{
mProgressBar->reset();
@ -4682,8 +4449,6 @@ void QgisApp::showProgress(int theProgress, int theTotalSteps)
mProgressBar->setMaximum(theTotalSteps);
mProgressBar->setValue(theProgress);
}
}
void QgisApp::mapToolChanged(QgsMapTool *tool)
@ -4733,8 +4498,6 @@ void QgisApp::updateMouseCoordinatePrecision()
void QgisApp::showStatusMessage(QString theMessage)
{
//QgsDebugMsg("message '" + theMessage + "'.");
statusBar()->showMessage(theMessage);
}
@ -4750,20 +4513,12 @@ void QgisApp::showMapTip()
{
QPoint myPointerPos = mMapCanvas->mouseLastXY();
// Following is debug stuff
QgsDebugMsg ( "Mouse IS over canvas" );
QgsDebugMsg ( "Maptips timer fired:" );
QgsDebugMsg ( mLastMapPosition.stringRep() );
QgsDebugMsg ( "Pixel coordinates of mouse position:" );
QgsDebugMsg ( QString::number ( myPointerPos.x() ) + "," + QString::number ( myPointerPos.y() ) );
// end debug stuff
// Make sure there is an active layer before proceeding
QgsMapLayer* mypLayer = mMapCanvas->currentLayer();
if ( mypLayer )
{
QgsDebugMsg("Current layer for maptip display is: " + mypLayer->source());
//QgsDebugMsg("Current layer for maptip display is: " + mypLayer->source());
// only process vector layers
if ( mypLayer->type() == QgsMapLayer::VECTOR )
{
@ -4776,7 +4531,7 @@ void QgisApp::showMapTip()
}
else
{
QgsDebugMsg ( "Maptips require an active layer" );
showStatusMessage(tr( "Maptips require an active layer" ));
}
}
}
@ -4817,7 +4572,7 @@ void QgisApp::projectProperties()
//pass any refresg signals off to canvases
//connect (pp,SIGNAL(refresh()), mMapCanvas, SLOT(refresh()));
QgsMapRender* myRender = mMapCanvas->mapRender();
QgsMapRenderer* myRender = mMapCanvas->mapRender();
bool wasProjected = myRender->projectionsEnabled();
long oldSRSID = myRender->destinationSrs().srsid();
@ -5047,41 +4802,6 @@ void QgisApp::activateDeactivateLayerRelatedActions(QgsMapLayer* layer)
}
//copy the click coord to clipboard and let the user know its there
void QgisApp::showCapturePointCoordinate(QgsPoint & theQgsPoint)
{
QgsDebugMsg("Capture point (clicked on map) at position " + theQgsPoint.stringRep(2));
QClipboard *myClipboard = QApplication::clipboard();
//if we are on x11 system put text into selection ready for middle button pasting
if (myClipboard->supportsSelection())
{
myClipboard->setText(theQgsPoint.stringRep(2),QClipboard::Selection);
QString myMessage = tr("Clipboard contents set to: ");
statusBar()->showMessage(myMessage + myClipboard->text(QClipboard::Selection));
}
else
{
//user has an inferior operating system....
myClipboard->setText(theQgsPoint.stringRep(2),QClipboard::Clipboard );
QString myMessage = tr("Clipboard contents set to: ");
statusBar()->showMessage(myMessage + myClipboard->text(QClipboard::Clipboard));
}
#ifdef QGISDEBUG
/* Well use this in ver 0.5 when we do digitising! */
/*
QgsVectorFileWriter myFileWriter("/tmp/test.shp", wkbPoint);
if (myFileWriter.initialise())
{
myFileWriter.createField("TestInt",OFTInteger,8,0);
myFileWriter.createField("TestRead",OFTReal,8,3);
myFileWriter.createField("TestStr",OFTString,255,0);
myFileWriter.writePoint(&theQgsPoint);
}
*/
#endif
}
/////////////////////////////////////////////////////////////////

View File

@ -58,6 +58,7 @@ class QgsVectorLayer;
#include <QMainWindow>
#include <QToolBar>
#include <QAbstractSocket>
#include <QPointer>
#include "qgsconfig.h"
#include <qgspoint.h>
@ -190,8 +191,6 @@ public slots:
void inOverview();
//! Slot to show the map coordinate position of the mouse cursor
void showMouseCoordinate(QgsPoint &);
//copy the click coord to clipboard and let the user know its there
void showCapturePointCoordinate(QgsPoint &);
//! Slot to show current map scale;
void showScale(double theScale);
//! Slot to handle user scale input;
@ -202,12 +201,10 @@ public slots:
void zoomToLayerExtent();
//! load any plugins used in the last qgis session
void restoreSessionPlugins(QString thePluginDirString);
//! test plugin functionality
void testPluginFunctions();
//! test maplayer plugins
void testMapLayerPlugins();
//! plugin manager
void showPluginManager();
//! load python support if possible
void loadPythonSupport();
//! plugin loader
void loadPlugin(QString name, QString description, QString mFullPath);
//! python plugin loader
@ -333,6 +330,7 @@ public slots:
Is called from the legend when the current legend item has changed*/
void activateDeactivateLayerRelatedActions(QgsMapLayer* layer);
public slots:
void showProgress(int theProgress, int theTotalSteps);
void showExtents();
@ -639,6 +637,8 @@ class Tools
QString mStartupPath;
//! full path name of the current map file (if it has been saved or loaded)
QString mFullPathName;
//! A dock to show the attribute table (user optional)
QPointer<QDockWidget> mpTableDockWidget;
//! interface to QgisApp for plugins
QgisAppInterface *mQgisInterface;

View File

@ -178,9 +178,9 @@ void QgsAttributeTableDisplay::startEditing()
//make the dialog modal when in editable
//otherwise map editing and table editing
//may disturb each other
hide();
setModal(true);
show();
//hide();
//setModal(true);
//show();
}
else
{

View File

@ -22,7 +22,7 @@
#include "qgsgeometry.h"
#include "qgsmaptoolcapture.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmaptopixel.h"
#include "qgsfeature.h"
#include "qgsproject.h"

View File

@ -16,7 +16,7 @@
#include "qgsmaptoolvertexedit.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmessageviewer.h"
#include "qgsvertexmarker.h"
#include "qgsvectorlayer.h"

View File

@ -21,7 +21,7 @@
#include "qgscontexthelp.h"
#include "qgsdistancearea.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsspatialrefsys.h"
#include <QCloseEvent>

View File

@ -17,7 +17,7 @@
#include "qgsdistancearea.h"
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmaptopixel.h"
#include "qgsrubberband.h"
@ -122,7 +122,7 @@ void QgsMeasureTool::updateProjection()
// mCalc->setEllipsoid(ellipsoid);
// set source SRS and projections enabled flag
// QgsMapRender* mapRender = mCanvas->mapRender();
// QgsMapRenderer* mapRender = mCanvas->mapRender();
// mCalc->setProjectionsEnabled(mapRender->projectionsEnabled());
// int srsid = mapRender->destinationSrs().srsid();
// mCalc->setSourceSRS(srsid);

View File

@ -26,7 +26,7 @@
#include "qgsmapcanvas.h"
#include "qgsmaplayer.h"
#include "qgsmaplayerregistry.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsproject.h"
#include "qgsrenderer.h"
#include "qgssnappingdialog.h"
@ -48,10 +48,10 @@ QgsProjectProperties::QgsProjectProperties(QgsMapCanvas* mapCanvas, QWidget *par
connect(this, SIGNAL(accepted()), this, SLOT(apply()));
///////////////////////////////////////////////////////////
// Properties stored in map canvas's QgsMapRender
// Properties stored in map canvas's QgsMapRenderer
// these ones are propagated to QgsProject by a signal
QgsMapRender* myRender = mMapCanvas->mapRender();
QgsMapRenderer* myRender = mMapCanvas->mapRender();
QGis::units myUnit = myRender->mapUnits();
setMapUnits(myUnit);
@ -235,7 +235,7 @@ void QgsProjectProperties::apply()
mapUnit=QGis::DEGREES;
}
QgsMapRender* myRender = mMapCanvas->mapRender();
QgsMapRenderer* myRender = mMapCanvas->mapRender();
myRender->setMapUnits(mapUnit);

View File

@ -23,7 +23,7 @@ SET(QGIS_CORE_SRCS
qgslogger.cpp
qgsmaplayer.cpp
qgsmaplayerregistry.cpp
qgsmaprender.cpp
qgsmaprenderer.cpp
qgsmaptopixel.cpp
qgsmessageoutput.cpp
qgspoint.cpp
@ -97,7 +97,7 @@ qgsdataprovider.h
qgshttptransaction.h
qgsmaplayer.h
qgsmaplayerregistry.h
qgsmaprender.h
qgsmaprenderer.h
qgsmessageoutput.h
qgsproject.h
qgsrunprocess.h
@ -222,7 +222,7 @@ qgsline.h
qgslogger.h
qgsmaplayer.h
qgsmaplayerregistry.h
qgsmaprender.h
qgsmaprenderer.h
qgsmaptopixel.h
qgsmessageoutput.h
qgspoint.h

View File

@ -22,7 +22,8 @@
#include <QPalette>
#include <qgsconfig.h>
#include <qgslogger.h>
#include <iostream>
// for htonl
#ifdef WIN32
@ -60,8 +61,6 @@ QgsApplication::QgsApplication(int & argc, char ** argv, bool GUIenabled)
QString myPrefix = myDir.absolutePath();
setPrefixPath(myPrefix, true);
#endif
//for debuggin
showSettings();
}
QgsApplication::~QgsApplication()
@ -267,18 +266,24 @@ void QgsApplication::exitQgis()
delete QgsProviderRegistry::instance();
}
void QgsApplication::showSettings()
QString QgsApplication::showSettings()
{
qDebug("\n**********************************");
qDebug("QgsApplication state:");
qDebug("Prefix :" + mPrefixPath.toLocal8Bit());
qDebug("Plugin Path :" + mPluginPath.toLocal8Bit());
qDebug("PkgData Path :" + mPkgDataPath.toLocal8Bit());
qDebug("Active Theme Name :" + themeName().toLocal8Bit());
qDebug("Active Theme Path :" + activeThemePath().toLocal8Bit());
qDebug("Default Theme Path :" + defaultThemePath().toLocal8Bit());
qDebug("User DB Path :" + qgisMasterDbFilePath().toLocal8Bit());
qDebug("**********************************\n");
QString myState = QString("Application state:\n"
"Prefix : %1\n"
"Plugin Path : %2\n"
"Package Data Path : %3\n"
"Active Theme Name : %4\n"
"Active Theme Path : %5\n"
"Default Theme Path : %6\n"
"User DB Path : %7\n")
.arg(mPrefixPath)
.arg(mPluginPath)
.arg(mPkgDataPath)
.arg(themeName())
.arg(activeThemePath())
.arg(defaultThemePath())
.arg(qgisMasterDbFilePath());
return myState;
}
QString QgsApplication::reportStyleSheet()

View File

@ -132,9 +132,9 @@ class CORE_EXPORT QgsApplication: public QApplication
* the gradient fills for backgrounds.
*/
static QString reportStyleSheet();
/** Print to stdout the paths used in this application instance.
* useful for debugging mainly.*/
static void showSettings();
/** Convenience function to get a summary of the paths used in this
* application instance useful for debugging mainly.*/
static QString showSettings();
private:
static QString mPrefixPath;
static QString mPluginPath;

View File

@ -3937,6 +3937,9 @@ bool QgsGeometry::exportWkbToGeos()
}
}
CATCH_GEOS(FALSE)
{
return false;
}
return TRUE;
}

View File

@ -42,14 +42,12 @@ QgsMapLayerRegistry *QgsMapLayerRegistry::instance()
QgsMapLayerRegistry::QgsMapLayerRegistry(QObject *parent) : QObject(parent)
{
QgsDebugMsg("QgsMapLayerRegistry created!");
// constructor does nothing
}
QgsMapLayerRegistry::~QgsMapLayerRegistry()
{
removeAllMapLayers();
QgsDebugMsg("QgsMapLayerRegistry is gone!");
}
// get the layer count (number of registered layers)
@ -68,7 +66,6 @@ QgsMapLayer * QgsMapLayerRegistry::mapLayer(QString theLayerId)
QgsMapLayer *
QgsMapLayerRegistry::addMapLayer( QgsMapLayer * theMapLayer, bool theEmitSignal )
{
QgsDebugMsg("QgsMapLayerRegistry::addMaplayer - '" + theMapLayer->name());
if( !theMapLayer->isValid() ) {
QgsDebugMsg("cannot add invalid layers");
return 0;
@ -88,7 +85,6 @@ QgsMapLayer *
}
else
{
QgsDebugMsg("addMaplayer - " + theMapLayer->name() + " already registered");
return 0;
}
} // QgsMapLayerRegistry::addMapLayer
@ -97,19 +93,14 @@ QgsMapLayer *
void QgsMapLayerRegistry::removeMapLayer(QString theLayerId, bool theEmitSignal)
{
QgsDebugMsg("QgsMapLayerRegistry::removemaplayer - emitting signal to notify all users of this layer to release it.");
if (theEmitSignal)
emit layerWillBeRemoved(theLayerId);
QgsDebugMsg("QgsMapLayerRegistry::removemaplayer - deleting map layer.");
delete mMapLayers[theLayerId];
QgsDebugMsg("QgsMapLayerRegistry::removemaplayer - unregistering map layer.");
mMapLayers.remove(theLayerId);
QgsDebugMsg("QgsMapLayerRegistry::removemaplayer - operation complete.");
}
void QgsMapLayerRegistry::removeAllMapLayers()
{
QgsDebugMsg("QgsMapLayerRegistry::removeAllMapLayers");
// moved before physically removing the layers
emit removedAll(); // now let all canvas Observers know to clear
@ -128,7 +119,6 @@ void QgsMapLayerRegistry::removeAllMapLayers()
QMap<QString,QgsMapLayer*> & QgsMapLayerRegistry::mapLayers()
{
QgsDebugMsg("QgsMapLayerRegistry::mapLayers");
return mMapLayers;
}
@ -136,5 +126,5 @@ QMap<QString,QgsMapLayer*> & QgsMapLayerRegistry::mapLayers()
void QgsMapLayerRegistry::connectNotify( const char * signal )
{
QgsDebugMsg("QgsMapLayerRegistry connected to " + QString(signal));
//QgsDebugMsg("QgsMapLayerRegistry connected to " + QString(signal));
} // QgsMapLayerRegistry::connectNotify

View File

@ -19,7 +19,7 @@
#include "qgscoordinatetransform.h"
#include "qgslogger.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsscalecalculator.h"
#include "qgsmaptopixel.h"
#include "qgsmaplayer.h"
@ -34,7 +34,7 @@
#include <QTime>
QgsMapRender::QgsMapRender()
QgsMapRenderer::QgsMapRenderer()
{
mScaleCalculator = new QgsScaleCalculator;
mDistArea = new QgsDistanceArea;
@ -51,7 +51,7 @@ QgsMapRender::QgsMapRender()
mDestSRS = new QgsSpatialRefSys(EPSGID, QgsSpatialRefSys::EPSG); //WGS 84
}
QgsMapRender::~QgsMapRender()
QgsMapRenderer::~QgsMapRenderer()
{
delete mScaleCalculator;
delete mDistArea;
@ -59,18 +59,18 @@ QgsMapRender::~QgsMapRender()
}
QgsRect QgsMapRender::extent()
QgsRect QgsMapRenderer::extent()
{
return mExtent;
}
void QgsMapRender::updateScale()
void QgsMapRenderer::updateScale()
{
mScale = mScaleCalculator->calculate(mExtent, mSize.width());
}
bool QgsMapRender::setExtent(const QgsRect& extent)
bool QgsMapRenderer::setExtent(const QgsRect& extent)
{
// Don't allow zooms where the current extent is so small that it
@ -110,22 +110,22 @@ bool QgsMapRender::setExtent(const QgsRect& extent)
void QgsMapRender::setOutputSize(QSize size, int dpi)
void QgsMapRenderer::setOutputSize(QSize size, int dpi)
{
mSize = size;
mScaleCalculator->setDpi(dpi);
adjustExtentToSize();
}
int QgsMapRender::outputDpi()
int QgsMapRenderer::outputDpi()
{
return mScaleCalculator->dpi();
}
QSize QgsMapRender::outputSize()
QSize QgsMapRenderer::outputSize()
{
return mSize;
}
void QgsMapRender::adjustExtentToSize()
void QgsMapRenderer::adjustExtentToSize()
{
int myHeight = mSize.height();
int myWidth = mSize.width();
@ -168,15 +168,13 @@ void QgsMapRender::adjustExtentToSize()
}
#ifdef QGISDEBUG
QgsDebugMsg("========== Current Scale ==========");
QgsDebugMsg("Current extent is " + mExtent.stringRep());
QgsLogger::debug("MuppX", muppX, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("MuppY", muppY, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Pixmap width", myWidth, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Pixmap height", myHeight, 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Extent width", mExtent.width(), 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("Extent height", mExtent.height(), 1, __FILE__, __FUNCTION__, __LINE__);
QgsLogger::debug("whitespace: ", whitespace, 1, __FILE__, __FUNCTION__, __LINE__);
QString myMessage = "+-------------------MapRenderer--------------------------------+\n";
myMessage += QString("Map units per pixel (x,y) : %1, %2\n").arg(muppX).arg(muppY);
myMessage += QString("Pixmap dimensions (x,y) : %1, %2\n").arg(myWidth).arg(myHeight);
myMessage += QString("Extent dimensions (x,y) : %1, %2\n").arg(mExtent.width()).arg(mExtent.height());
myMessage += mExtent.stringRep();
//purposely using std::cout [TS]
std::cout << myMessage.toLocal8Bit().constData() << std::endl;
#endif
@ -199,7 +197,7 @@ void QgsMapRender::adjustExtentToSize()
}
void QgsMapRender::render(QPainter* painter)
void QgsMapRenderer::render(QPainter* painter)
{
QgsDebugMsg("========== Rendering ==========");
@ -419,14 +417,14 @@ void QgsMapRender::render(QPainter* painter)
emit drawingProgress(1,1);
#ifdef QGISDEBUG
QgsDebugMsg("Rendering done in (seconds): " + QString("%1").arg(renderTime.elapsed() / 1000.0) );
QgsDebugMsg("Rendering completed in (seconds): " + QString("%1").arg(renderTime.elapsed() / 1000.0) );
#endif
mDrawing = false;
}
void QgsMapRender::setMapUnits(QGis::units u)
void QgsMapRenderer::setMapUnits(QGis::units u)
{
mScaleCalculator->setMapUnits(u);
@ -436,12 +434,12 @@ void QgsMapRender::setMapUnits(QGis::units u)
emit mapUnitsChanged();
}
QGis::units QgsMapRender::mapUnits() const
QGis::units QgsMapRenderer::mapUnits() const
{
return mScaleCalculator->mapUnits();
}
void QgsMapRender::onDrawingProgress(int current, int total)
void QgsMapRenderer::onDrawingProgress(int current, int total)
{
// TODO: emit signal with progress
//std::cout << "onDrawingProgress: " << current << " / " << total << std::endl;
@ -450,7 +448,7 @@ void QgsMapRender::onDrawingProgress(int current, int total)
void QgsMapRender::setProjectionsEnabled(bool enabled)
void QgsMapRenderer::setProjectionsEnabled(bool enabled)
{
if (mProjectionsEnabled != enabled)
{
@ -462,16 +460,15 @@ void QgsMapRender::setProjectionsEnabled(bool enabled)
}
}
bool QgsMapRender::projectionsEnabled()
bool QgsMapRenderer::projectionsEnabled()
{
return mProjectionsEnabled;
}
void QgsMapRender::setDestinationSrs(const QgsSpatialRefSys& srs)
void QgsMapRenderer::setDestinationSrs(const QgsSpatialRefSys& srs)
{
QgsDebugMsg("* Setting destSRS");
QgsDebugMsg("* Setting destSRS : = " + srs.proj4String());
QgsDebugMsg("* DestSRS.srsid() = " + QString::number(srs.srsid()));
QgsDebugMsg("* DestSRS.proj4() = " + srs.proj4String());
if (*mDestSRS != srs)
{
QgsDebugMsg("Setting DistArea SRS to " + QString::number(srs.srsid()));
@ -482,7 +479,7 @@ void QgsMapRender::setDestinationSrs(const QgsSpatialRefSys& srs)
}
}
const QgsSpatialRefSys& QgsMapRender::destinationSrs()
const QgsSpatialRefSys& QgsMapRenderer::destinationSrs()
{
QgsDebugMsg("* Returning destSRS");
QgsDebugMsg("* DestSRS.srsid() = " + QString::number(mDestSRS->srsid()));
@ -491,7 +488,7 @@ const QgsSpatialRefSys& QgsMapRender::destinationSrs()
}
bool QgsMapRender::splitLayersExtent(QgsMapLayer* layer, QgsRect& extent, QgsRect& r2)
bool QgsMapRenderer::splitLayersExtent(QgsMapLayer* layer, QgsRect& extent, QgsRect& r2)
{
bool split = false;
@ -502,8 +499,8 @@ bool QgsMapRender::splitLayersExtent(QgsMapLayer* layer, QgsRect& extent, QgsRec
QgsCoordinateTransform tr(layer->srs(), *mDestSRS);
#ifdef QGISDEBUG
QgsLogger::debug<QgsRect>("Getting extent of canvas in layers CS. Canvas is ", extent, __FILE__,\
__FUNCTION__, __LINE__);
// QgsLogger::debug<QgsRect>("Getting extent of canvas in layers CS. Canvas is ", extent, __FILE__,\
// __FUNCTION__, __LINE__);
#endif
// Split the extent into two if the source SRS is
// geographic and the extent crosses the split in
@ -550,7 +547,7 @@ bool QgsMapRender::splitLayersExtent(QgsMapLayer* layer, QgsRect& extent, QgsRec
}
QgsRect QgsMapRender::layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRect extent)
QgsRect QgsMapRenderer::layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRect extent)
{
if (projectionsEnabled())
{
@ -572,7 +569,7 @@ QgsRect QgsMapRender::layerExtentToOutputExtent(QgsMapLayer* theLayer, QgsRect e
return extent;
}
QgsPoint QgsMapRender::layerCoordsToOutputCoords(QgsMapLayer* theLayer, QgsPoint point)
QgsPoint QgsMapRenderer::layerCoordsToOutputCoords(QgsMapLayer* theLayer, QgsPoint point)
{
if (projectionsEnabled())
{
@ -593,7 +590,7 @@ QgsPoint QgsMapRender::layerCoordsToOutputCoords(QgsMapLayer* theLayer, QgsPoint
return point;
}
QgsPoint QgsMapRender::outputCoordsToLayerCoords(QgsMapLayer* theLayer, QgsPoint point)
QgsPoint QgsMapRenderer::outputCoordsToLayerCoords(QgsMapLayer* theLayer, QgsPoint point)
{
if (projectionsEnabled())
{
@ -615,7 +612,7 @@ QgsPoint QgsMapRender::outputCoordsToLayerCoords(QgsMapLayer* theLayer, QgsPoint
return point;
}
QgsRect QgsMapRender::outputCoordsToLayerCoords(QgsMapLayer* theLayer, QgsRect rect)
QgsRect QgsMapRenderer::outputCoordsToLayerCoords(QgsMapLayer* theLayer, QgsRect rect)
{
if (projectionsEnabled())
{
@ -634,9 +631,9 @@ QgsRect QgsMapRender::outputCoordsToLayerCoords(QgsMapLayer* theLayer, QgsRect r
}
void QgsMapRender::updateFullExtent()
void QgsMapRenderer::updateFullExtent()
{
QgsDebugMsg("QgsMapRender::updateFullExtent() called !");
QgsDebugMsg("QgsMapRenderer::updateFullExtent() called !");
QgsMapLayerRegistry* registry = QgsMapLayerRegistry::instance();
// reset the map canvas extent since the extent may now be smaller
@ -696,24 +693,24 @@ void QgsMapRender::updateFullExtent()
QgsDebugMsg("Full extent: " + mFullExtent.stringRep());
}
QgsRect QgsMapRender::fullExtent()
QgsRect QgsMapRenderer::fullExtent()
{
updateFullExtent();
return mFullExtent;
}
void QgsMapRender::setLayerSet(const QStringList& layers)
void QgsMapRenderer::setLayerSet(const QStringList& layers)
{
mLayerSet = layers;
updateFullExtent();
}
QStringList& QgsMapRender::layerSet()
QStringList& QgsMapRenderer::layerSet()
{
return mLayerSet;
}
bool QgsMapRender::readXML(QDomNode & theNode)
bool QgsMapRenderer::readXML(QDomNode & theNode)
{
QDomNode myNode = theNode.namedItem("units");
QDomElement element = myNode.toElement();
@ -785,7 +782,7 @@ bool QgsMapRender::readXML(QDomNode & theNode)
return true;
}
bool QgsMapRender::writeXML(QDomNode & theNode, QDomDocument & theDoc)
bool QgsMapRenderer::writeXML(QDomNode & theNode, QDomDocument & theDoc)
{
// units

View File

@ -35,22 +35,22 @@ class QgsSpatialRefSys;
class QgsDistanceArea;
/**
* \class QgsMapRender
* \class QgsMapRenderer
* \brief Class for rendering map layer set
*
*/
class CORE_EXPORT QgsMapRender : public QObject
class CORE_EXPORT QgsMapRenderer : public QObject
{
Q_OBJECT
public:
//! constructor
QgsMapRender();
QgsMapRenderer();
//! destructor
~QgsMapRender();
~QgsMapRenderer();
//! starts rendering
void render(QPainter* painter);

View File

@ -326,7 +326,7 @@ QgsProject * QgsProject::theProject_;
*/
void clear()
{
QgsDebugMsg( "Clearing project properties Impl->clear();" );
//QgsDebugMsg( "Clearing project properties Impl->clear();" );
properties_.clearKeys();
title = "";
@ -1034,7 +1034,7 @@ bool QgsProject::write()
void QgsProject::clearProperties()
{
QgsDebugMsg("Clearing project properties QgsProject::clearProperties()");
//QgsDebugMsg("Clearing project properties QgsProject::clearProperties()");
imp_->clear();

View File

@ -106,24 +106,23 @@ QgsProviderRegistry::QgsProviderRegistry(QString pluginPath)
QLibrary *myLib = new QLibrary( fi.filePath() );
bool loaded = myLib->load();
//we will build up a debug message and print on one line to avoid terminal spam
QString myMessage = "Checking " + myLib->fileName() + " : " ;
if (loaded)
{
#ifdef QGISDEBUG
QgsLogger::debug("Checking " + myLib->fileName(), 1, __FILE__, __FUNCTION__, __LINE__);
#endif
// get the description and the key for the provider plugin
isprovider_t *isProvider = (isprovider_t *) myLib->resolve("isProvider");
//MH: Added a further test to detect non-provider plugins linked to provider plugins.
//Only pure provider plugins have 'type' not defined
isprovider_t *hasType = (isprovider_t *) myLib->resolve("type");
//MH: Added a further test to detect non-provider plugins linked to provider plugins.
//Only pure provider plugins have 'type' not defined
isprovider_t *hasType = (isprovider_t *) myLib->resolve("type");
if (!hasType && isProvider)
{
// check to see if this is a provider plugin
if (isProvider())
{
{
// looks like a provider. get the key and description
description_t *pDesc = (description_t *) myLib->resolve("description");
providerkey_t *pKey = (providerkey_t *) myLib->resolve("providerKey");
@ -132,9 +131,7 @@ QgsProviderRegistry::QgsProviderRegistry(QString pluginPath)
// add this provider to the provider map
mProviders[pKey()] =
new QgsProviderMetadata(pKey(), pDesc(), myLib->fileName());
#ifdef QGISDEBUG
QgsDebugMsg("Loaded " + pDesc());
#endif
//myMessage += "Loaded " + QString(pDesc()) + " ok";
// now get vector file filters, if any
fileVectorFilters_t *pFileVectorFilters =
@ -144,7 +141,6 @@ QgsProviderRegistry::QgsProviderRegistry(QString pluginPath)
{
QString vectorFileFilters = pFileVectorFilters();
// now get vector file filters, if any
fileVectorFilters_t *pVectorFileFilters =
(fileVectorFilters_t *) myLib->resolve("fileVectorFilters");
@ -156,41 +152,47 @@ QgsProviderRegistry::QgsProviderRegistry(QString pluginPath)
if ( ! fileVectorFilters.isEmpty() )
{
mVectorFileFilters += fileVectorFilters;
myMessage += QString("... loaded ok (and with %1 file filters)").
arg(fileVectorFilters.split(";;").count());
}
else
{
QgsLogger::debug("No vector file filters for " + pKey(), 1, __FILE__, __FUNCTION__, __LINE__);
//myMessage += ", but it has no vector file filters for " + QString(pKey());
myMessage += "... loaded ok (0 file filters)";
}
}
}
else
{
QgsDebugMsg("Unable to invoke fileVectorFilters()");
//myMessage += ", but unable to invoke fileVectorFilters()";
myMessage += "... loaded ok (null file filters)";
}
}
else
{
QgsLogger::debug("Unable to find one of the required provider functions (providerKey() or description()) in " + myLib->fileName());
//myMessage += ", but unable to find one of the required provider functions (providerKey() or description()) in ";
myMessage += "...not usable";
}
}
else
{
QgsDebugMsg("Unable to invoke fileVectorFilters()");
//myMessage += ", but this is not a valid provider, skipping.";
myMessage += "..invalid";
}
}
else
{
#ifdef QGISDEBUG
QgsDebugMsg(myLib->fileName() + " is not a provider");
#endif
//myMessage += ", but this is not a valid provider or has no type, skipping.";
myMessage += "..invalid (no type)";
}
}
else
{
QgsDebugMsg("Couldn't load " + fi.filePath());
myMessage += "...invalid (lib not loadable)";
}
//++it;
QgsDebugMsg( myMessage );
delete myLib;
}
@ -356,8 +358,8 @@ QgsDataProvider* QgsProviderRegistry::getProvider( QString const & providerKey,
//XXX - This was a dynamic cast but that kills the Windows
// version big-time with an abnormal termination error
// QgsDataProvider* dataProvider = (QgsDataProvider*)
// (classFactory((const char*)(dataSource.utf8())));
// QgsDataProvider* dataProvider = (QgsDataProvider*)
// (classFactory((const char*)(dataSource.utf8())));
QgsDataProvider * dataProvider = (*classFactory)(&dataSource);
@ -365,21 +367,21 @@ QgsDataProvider* QgsProviderRegistry::getProvider( QString const & providerKey,
{
#ifdef QGISDEBUG
QgsDebugMsg( "Instantiated the data provider plugin" );
QgsDebugMsg("provider name: " + dataProvider->name());
QgsDebugMsg("provider name: " + dataProvider->name());
#endif
if (dataProvider->isValid())
{
delete myLib;
delete myLib;
return dataProvider;
}
else
{ // this is likely because the dataSource is invalid, and isn't
// necessarily a reflection on the data provider itself
QgsDebugMsg( "Invalid data provider" );
// necessarily a reflection on the data provider itself
QgsDebugMsg( "Invalid data provider" );
myLib->unload();
delete myLib;
return 0;
myLib->unload();
delete myLib;
return 0;
}
}
else
@ -387,7 +389,7 @@ QgsDataProvider* QgsProviderRegistry::getProvider( QString const & providerKey,
QgsLogger::warning( "Unable to instantiate the data provider plugin" );
myLib->unload();
delete myLib;
delete myLib;
return 0;
}
}

View File

@ -16,7 +16,7 @@
***************************************************************************/
#include "qgssnapper.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmaptopixel.h"
#include "qgsvectorlayer.h"
#include <QMultiMap>
@ -24,7 +24,7 @@
#include <cmath>
QgsSnapper::QgsSnapper(QgsMapRender* mapRender): mMapRender(mapRender)
QgsSnapper::QgsSnapper(QgsMapRenderer* mapRender): mMapRenderer(mapRender)
{
}
@ -57,7 +57,7 @@ int QgsSnapper::snapPoint(const QPoint& startPoint, QList<QgsSnappingResult>& sn
QMultiMap<double, QgsSnappingResult> currentResultList; //snapping results of examined layer
//start point in (output) map coordinates
QgsPoint mapCoordPoint = mMapRender->coordXForm()->toMapCoordinates(startPoint.x(), startPoint.y());
QgsPoint mapCoordPoint = mMapRenderer->coordXForm()->toMapCoordinates(startPoint.x(), startPoint.y());
QgsPoint layerCoordPoint; //start point in layer coordinates
QgsSnappingResult newResult;
@ -65,7 +65,7 @@ int QgsSnapper::snapPoint(const QPoint& startPoint, QList<QgsSnappingResult>& sn
for(; layerIt != mLayersToSnap.end(); ++layerIt, ++toleranceIt, ++snapToIt)
{
//transform point from map coordinates to layer coordinates
layerCoordPoint = mMapRender->outputCoordsToLayerCoords(*layerIt, mapCoordPoint);
layerCoordPoint = mMapRenderer->outputCoordsToLayerCoords(*layerIt, mapCoordPoint);
if( (*layerIt)->snapWithContext(layerCoordPoint, *toleranceIt, currentResultList, *snapToIt) != 0)
{
//error
@ -78,9 +78,9 @@ int QgsSnapper::snapPoint(const QPoint& startPoint, QList<QgsSnappingResult>& sn
//for each snapping result: transform start point, snap point and other points into map coordinates to find out distance
//store results in snapping result list
newResult = currentResultIt.value();
newResult.snappedVertex = mMapRender->layerCoordsToOutputCoords(*layerIt, currentResultIt.value().snappedVertex);
newResult.beforeVertex = mMapRender->layerCoordsToOutputCoords(*layerIt, currentResultIt.value().beforeVertex);
newResult.afterVertex = mMapRender->layerCoordsToOutputCoords(*layerIt, currentResultIt.value().afterVertex);
newResult.snappedVertex = mMapRenderer->layerCoordsToOutputCoords(*layerIt, currentResultIt.value().snappedVertex);
newResult.beforeVertex = mMapRenderer->layerCoordsToOutputCoords(*layerIt, currentResultIt.value().beforeVertex);
newResult.afterVertex = mMapRenderer->layerCoordsToOutputCoords(*layerIt, currentResultIt.value().afterVertex);
snappingResultList.insert(sqrt(newResult.snappedVertex.sqrDist(mapCoordPoint)), newResult);
}
}

View File

@ -22,7 +22,7 @@
#include <QList>
#include <QMultiMap>
class QgsMapRender;
class QgsMapRenderer;
class QgsVectorLayer;
class QPoint;
@ -76,7 +76,7 @@ class CORE_EXPORT QgsSnapper
ALL_RESULTS_WITHIN_GIVEN_TOLERANCES
};
QgsSnapper(QgsMapRender* mapRender);
QgsSnapper(QgsMapRenderer* mapRender);
~QgsSnapper();
/**Does the snapping operation
@param startPoint the start point for snapping (in pixel coordinates)
@ -100,7 +100,7 @@ class CORE_EXPORT QgsSnapper
/**The maprender object contains information about the output coordinate system
of the map and about the relationship between pixel space and map space*/
QgsMapRender* mMapRender;
QgsMapRenderer* mMapRenderer;
/**Snap mode to apply*/
QgsSnapper::SNAP_MODE mSnapMode;
/**The layers to which snapping is applied*/

View File

@ -260,11 +260,11 @@ bool QgsSpatialRefSys::createFromWkt(QString theWkt)
if (myInputResult != OGRERR_NONE)
{
QgsDebugMsg("vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv");
QgsDebugMsg("\n---------------------------------------------------------------");
QgsDebugMsg("QgsSpatialRefSys::createFromWkt(QString theWkt) ");
QgsDebugMsg("This SRS could *** NOT *** be set from the supplied WKT ");
QgsDebugMsg("INPUT: " + theWkt);
QgsDebugMsg("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
QgsDebugMsg("---------------------------------------------------------------\n");
return mIsValidFlag;
}
@ -289,10 +289,9 @@ bool QgsSpatialRefSys::createFromWkt(QString theWkt)
bool QgsSpatialRefSys::isValid() const
{
if (mIsValidFlag)
{
return true;
QgsDebugMsg("It's an invalid SRS without valid proj4 string");
}
return false;
}

View File

@ -44,7 +44,7 @@ email : sherman at mrcc.com
#include "qgsmaptoolzoom.h"
#include "qgsmaptopixel.h"
#include "qgsmapoverviewcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmessageviewer.h"
#include "qgsproject.h"
#include "qgsrubberband.h"
@ -100,7 +100,7 @@ class QgsMapCanvas::CanvasProperties
setMouseTracking(true);
setFocusPolicy(Qt::StrongFocus);
mMapRender = new QgsMapRender;
mMapRenderer = new QgsMapRenderer;
// create map canvas item which will show the map
mMap = new QgsMapCanvasMap(this);
@ -109,8 +109,8 @@ class QgsMapCanvas::CanvasProperties
moveCanvasContents(TRUE);
//connect(mMapRender, SIGNAL(updateMap()), this, SLOT(updateMap()));
connect(mMapRender, SIGNAL(drawError(QgsMapLayer*)), this, SLOT(showError(QgsMapLayer*)));
//connect(mMapRenderer, SIGNAL(updateMap()), this, SLOT(updateMap()));
connect(mMapRenderer, SIGNAL(drawError(QgsMapLayer*)), this, SLOT(showError(QgsMapLayer*)));
// project handling
connect(QgsProject::instance(), SIGNAL(readProject(const QDomDocument &)),
@ -144,7 +144,7 @@ QgsMapCanvas::~QgsMapCanvas()
delete mScene;
delete mMapRender;
delete mMapRenderer;
// mCanvasProperties auto-deleted via std::auto_ptr
// CanvasProperties struct has its own dtor for freeing resources
@ -167,15 +167,15 @@ QgsMapCanvasMap* QgsMapCanvas::map()
return mMap;
}
QgsMapRender* QgsMapCanvas::mapRender()
QgsMapRenderer* QgsMapCanvas::mapRender()
{
return mMapRender;
return mMapRenderer;
}
QgsMapLayer* QgsMapCanvas::getZpos(int index)
{
QStringList& layers = mMapRender->layerSet();
QStringList& layers = mMapRenderer->layerSet();
if (index >= 0 && index < (int) layers.size())
return QgsMapLayerRegistry::instance()->mapLayer(layers[index]);
else
@ -190,7 +190,7 @@ void QgsMapCanvas::setCurrentLayer(QgsMapLayer* layer)
double QgsMapCanvas::getScale()
{
return mMapRender->scale();
return mMapRenderer->scale();
} // getScale
void QgsMapCanvas::setDirty(bool dirty)
@ -215,7 +215,7 @@ bool QgsMapCanvas::isDrawing()
// device size
const QgsMapToPixel * QgsMapCanvas::getCoordinateTransform()
{
return mMapRender->coordXForm();
return mMapRenderer->coordXForm();
}
void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)
@ -242,7 +242,7 @@ void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)
}
}
QStringList& layerSetOld = mMapRender->layerSet();
QStringList& layerSetOld = mMapRenderer->layerSet();
bool layerSetChanged = (layerSetOld != layerSet);
@ -263,7 +263,7 @@ void QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>& layers)
}
}
mMapRender->setLayerSet(layerSet);
mMapRenderer->setLayerSet(layerSet);
for (i = 0; i < layerCount(); i++)
{
@ -311,9 +311,9 @@ void QgsMapCanvas::setOverview(QgsMapOverviewCanvas* overview)
if (mMapOverview)
{
// disconnect old map overview if exists
disconnect(mMapRender, SIGNAL(projectionsEnabled(bool)),
disconnect(mMapRenderer, SIGNAL(projectionsEnabled(bool)),
mMapOverview, SLOT(projectionsEnabled(bool)));
disconnect(mMapRender, SIGNAL(destinationSrsChanged()),
disconnect(mMapRenderer, SIGNAL(destinationSrsChanged()),
mMapOverview, SLOT(destinationSrsChanged()));
// map overview is not owned by map canvas so don't delete it...
@ -324,9 +324,9 @@ void QgsMapCanvas::setOverview(QgsMapOverviewCanvas* overview)
if (overview)
{
// connect to the map render to copy its projection settings
connect(mMapRender, SIGNAL(projectionsEnabled(bool)),
connect(mMapRenderer, SIGNAL(projectionsEnabled(bool)),
overview, SLOT(projectionsEnabled(bool)));
connect(mMapRender, SIGNAL(destinationSrsChanged()),
connect(mMapRenderer, SIGNAL(destinationSrsChanged()),
overview, SLOT(destinationSrsChanged()));
}
}
@ -402,7 +402,7 @@ void QgsMapCanvas::saveAsImage(QString theFileName, QPixmap * theQPixmap, QStrin
// render
QPainter painter;
painter.begin(theQPixmap);
mMapRender->render(&painter);
mMapRenderer->render(&painter);
painter.end();
theQPixmap->save(theFileName,theFormat.toLocal8Bit().data());
@ -417,12 +417,12 @@ void QgsMapCanvas::saveAsImage(QString theFileName, QPixmap * theQPixmap, QStrin
QgsRect QgsMapCanvas::extent() const
{
return mMapRender->extent();
return mMapRenderer->extent();
} // extent
QgsRect QgsMapCanvas::fullExtent() const
{
return mMapRender->fullExtent();
return mMapRenderer->fullExtent();
} // extent
void QgsMapCanvas::updateFullExtent()
@ -431,7 +431,7 @@ void QgsMapCanvas::updateFullExtent()
QgsDebugMsg("updating full extent");
mMapRender->updateFullExtent();
mMapRenderer->updateFullExtent();
if (mMapOverview)
{
mMapOverview->updateFullExtent(fullExtent());
@ -454,11 +454,11 @@ void QgsMapCanvas::setExtent(QgsRect const & r)
QgsDebugMsg("Empty extent - keeping old extent with new center!");
QgsRect e( QgsPoint( r.center().x()-current.width()/2.0, r.center().y()-current.height()/2.0 ),
QgsPoint( r.center().x()+current.width()/2.0, r.center().y()+current.height()/2.0 ) );
mMapRender->setExtent(e);
mMapRenderer->setExtent(e);
}
else
{
mMapRender->setExtent(r);
mMapRenderer->setExtent(r);
}
emit extentsChanged();
updateScale();
@ -474,7 +474,7 @@ void QgsMapCanvas::setExtent(QgsRect const & r)
void QgsMapCanvas::updateScale()
{
double scale = mMapRender->scale();
double scale = mMapRenderer->scale();
emit scaleChanged(scale);
}
@ -526,13 +526,13 @@ void QgsMapCanvas::zoomPreviousExtent()
bool QgsMapCanvas::projectionsEnabled()
{
return mMapRender->projectionsEnabled();
return mMapRenderer->projectionsEnabled();
}
void QgsMapCanvas::mapUnitsChanged()
{
// We assume that if the map units have changed, the changed value
// will be accessible from QgsMapRender
// will be accessible from QgsMapRenderer
// And then force a redraw of the scale number in the status bar
updateScale();
@ -558,7 +558,7 @@ void QgsMapCanvas::zoomToSelected()
if (lyr)
{
QgsRect rect = mMapRender->layerExtentToOutputExtent(lyr, lyr->boundingBoxOfSelected());
QgsRect rect = mMapRenderer->layerExtentToOutputExtent(lyr, lyr->boundingBoxOfSelected());
// no selected features, only one selected point feature
//or two point features with the same x- or y-coordinates
@ -582,7 +582,6 @@ void QgsMapCanvas::zoomToSelected()
void QgsMapCanvas::keyPressEvent(QKeyEvent * e)
{
QgsDebugMsg("keyPress event");
if(mDrawing)
{
@ -602,7 +601,7 @@ void QgsMapCanvas::keyPressEvent(QKeyEvent * e)
{
// Don't want to interfer with mouse events
QgsRect currentExtent = mMapRender->extent();
QgsRect currentExtent = mMapRenderer->extent();
double dx = fabs((currentExtent.xMax()- currentExtent.xMin()) / 4);
double dy = fabs((currentExtent.yMax()- currentExtent.yMin()) / 4);
@ -637,7 +636,7 @@ void QgsMapCanvas::keyPressEvent(QKeyEvent * e)
case Qt::Key_Down:
QgsDebugMsg("Pan down");
currentExtent.setYmax(currentExtent.yMax() - dy);
currentExtent.setYmin(currentExtent.yMin() - dy);
setExtent(currentExtent);
@ -657,13 +656,12 @@ void QgsMapCanvas::keyPressEvent(QKeyEvent * e)
default:
// Pass it on
if(mMapTool)
{
mMapTool->keyPressEvent(e);
}
if(mMapTool)
{
mMapTool->keyPressEvent(e);
}
e->ignore();
QgsDebugMsg("Ignoring key: " + QString::number(e->key()));
}
@ -684,7 +682,7 @@ void QgsMapCanvas::keyReleaseEvent(QKeyEvent * e)
case Qt::Key_Space:
if ( !e->isAutoRepeat() && mCanvasProperties->panSelectorDown)
{
QgsDebugMsg("Releaseing pan selector");
QgsDebugMsg("Releasing pan selector");
mCanvasProperties->panSelectorDown = false;
panActionEnd(mCanvasProperties->mouseLastXY);
@ -776,40 +774,40 @@ void QgsMapCanvas::resizeEvent(QResizeEvent * e)
{
static bool isAlreadyIn = false;
static QSize lastSize = QSize(-1,-1);
lastSize = e->size();
if (isAlreadyIn || mDrawing)
{
//cancel current render progress
if(mMapRenderer)
{
//cancel current render progress
if(mMapRender)
{
QgsRenderContext* theRenderContext = mMapRender->renderContext();
if(theRenderContext)
{
theRenderContext->setRenderingStopped(true);
}
}
return;
QgsRenderContext* theRenderContext = mMapRenderer->renderContext();
if(theRenderContext)
{
theRenderContext->setRenderingStopped(true);
}
}
return;
}
isAlreadyIn = true;
while (lastSize != QSize(-1,-1))
{
int width = lastSize.width();
int height = lastSize.height();
lastSize = QSize(-1,-1);
mScene->setSceneRect(QRectF(0,0,width, height));
mMap->resize(QSize(width,height));
// notify canvas items of change
updateCanvasItemsPositions();
updateScale();
refresh();
}
{
int width = lastSize.width();
int height = lastSize.height();
lastSize = QSize(-1,-1);
mScene->setSceneRect(QRectF(0,0,width, height));
mMap->resize(QSize(width,height));
// notify canvas items of change
updateCanvasItemsPositions();
updateScale();
refresh();
}
isAlreadyIn = false;
} // resizeEvent
@ -836,13 +834,13 @@ void QgsMapCanvas::wheelEvent(QWheelEvent *e)
{
// Zoom the map canvas in response to a mouse wheel event. Moving the
// wheel forward (away) from the user zooms in
QgsDebugMsg("Wheel event delta " + QString::number(e->delta()));
if(mDrawing)
{
return;
}
{
return;
}
switch (mWheelAction)
{
@ -857,22 +855,22 @@ void QgsMapCanvas::wheelEvent(QWheelEvent *e)
break;
case WheelZoomToMouseCursor:
{
// zoom map to mouse cursor
double scaleFactor = e->delta() > 0 ? 1 / mWheelZoomFactor : mWheelZoomFactor;
{
// zoom map to mouse cursor
double scaleFactor = e->delta() > 0 ? 1 / mWheelZoomFactor : mWheelZoomFactor;
QgsPoint oldCenter(mMapRender->extent().center());
QgsPoint mousePos(getCoordinateTransform()->toMapPoint(e->x(), e->y()));
QgsPoint newCenter(mousePos.x() + ((oldCenter.x() - mousePos.x()) * scaleFactor),
mousePos.y() + ((oldCenter.y() - mousePos.y()) * scaleFactor));
QgsPoint oldCenter(mMapRenderer->extent().center());
QgsPoint mousePos(getCoordinateTransform()->toMapPoint(e->x(), e->y()));
QgsPoint newCenter(mousePos.x() + ((oldCenter.x() - mousePos.x()) * scaleFactor),
mousePos.y() + ((oldCenter.y() - mousePos.y()) * scaleFactor));
// same as zoomWithCenter (no coordinate transformations are needed)
QgsRect extent = mMapRender->extent();
extent.scale(scaleFactor, &newCenter);
setExtent(extent);
refresh();
break;
}
// same as zoomWithCenter (no coordinate transformations are needed)
QgsRect extent = mMapRenderer->extent();
extent.scale(scaleFactor, &newCenter);
setExtent(extent);
refresh();
break;
}
case WheelNothing:
// well, nothing!
@ -890,7 +888,7 @@ void QgsMapCanvas::zoom(bool zoomIn)
{
double scaleFactor = (zoomIn ? 1/mWheelZoomFactor : mWheelZoomFactor);
QgsRect r = mMapRender->extent();
QgsRect r = mMapRenderer->extent();
r.scale(scaleFactor);
setExtent(r);
refresh();
@ -907,7 +905,7 @@ void QgsMapCanvas::zoomWithCenter(int x, int y, bool zoomIn)
// transform the mouse pos to map coordinates
QgsPoint center = getCoordinateTransform()->toMapPoint(x, y);
QgsRect r = mMapRender->extent();
QgsRect r = mMapRenderer->extent();
r.scale(scaleFactor, &center);
setExtent(r);
refresh();
@ -1008,7 +1006,7 @@ QColor QgsMapCanvas::canvasColor() const
int QgsMapCanvas::layerCount() const
{
return mMapRender->layerSet().size();
return mMapRenderer->layerSet().size();
} // layerCount
@ -1043,46 +1041,45 @@ QPixmap& QgsMapCanvas::canvasPixmap()
double QgsMapCanvas::mupp() const
{
return mMapRender->mupp();
return mMapRenderer->mupp();
} // mupp
void QgsMapCanvas::setMapUnits(QGis::units u)
{
QgsDebugMsg("Setting map units to " + QString::number(static_cast<int>(u)) );
mMapRender->setMapUnits(u);
mMapRenderer->setMapUnits(u);
}
QGis::units QgsMapCanvas::mapUnits() const
{
return mMapRender->mapUnits();
return mMapRenderer->mapUnits();
}
void QgsMapCanvas::setRenderFlag(bool theFlag)
{
mRenderFlag = theFlag;
if(mMapRender)
if(mMapRenderer)
{
QgsRenderContext* rc = mMapRenderer->renderContext();
if(rc)
{
QgsRenderContext* rc = mMapRender->renderContext();
if(rc)
{
rc->setRenderingStopped(!theFlag);
}
rc->setRenderingStopped(!theFlag);
}
}
if(mRenderFlag)
{
refresh();
}
{
refresh();
}
}
void QgsMapCanvas::connectNotify( const char * signal )
{
QgsDebugMsg("QgsMapCanvas connected to " + QString(signal));
} // QgsMapCanvas::connectNotify( const char * signal )
} //connectNotify
@ -1109,7 +1106,7 @@ void QgsMapCanvas::panActionEnd(QPoint releasePoint)
double dy = fabs(end.y() - start.y());
// modify the extent
QgsRect r = mMapRender->extent();
QgsRect r = mMapRenderer->extent();
if (end.x() < start.x())
{
@ -1224,7 +1221,7 @@ void QgsMapCanvas::readProject(const QDomDocument & doc)
if (nodes.count())
{
QDomNode node = nodes.item(0);
mMapRender->readXML(node);
mMapRenderer->readXML(node);
}
else
{
@ -1235,7 +1232,7 @@ void QgsMapCanvas::readProject(const QDomDocument & doc)
void QgsMapCanvas::writeProject(QDomDocument & doc)
{
// create node "mapcanvas" and call mMapRender->writeXML()
// create node "mapcanvas" and call mMapRenderer->writeXML()
QDomNodeList nl = doc.elementsByTagName("qgis");
if (!nl.count())
@ -1247,7 +1244,7 @@ void QgsMapCanvas::writeProject(QDomDocument & doc)
QDomElement mapcanvasNode = doc.createElement("mapcanvas");
qgisNode.appendChild(mapcanvasNode);
mMapRender->writeXML(mapcanvasNode, doc);
mMapRenderer->writeXML(mapcanvasNode, doc);
}
@ -1259,7 +1256,7 @@ void QgsMapCanvas::zoom(double scaleFactor)
return;
}
QgsRect r = mMapRender->extent();
QgsRect r = mMapRenderer->extent();
r.scale(scaleFactor);
setExtent(r);
refresh();

View File

@ -50,7 +50,7 @@ class QgsLegend;
class QgsLegendView;
class QgsRubberBand;
class QgsMapRender;
class QgsMapRenderer;
class QgsMapCanvasMap;
class QgsMapOverviewCanvas;
class QgsMapTool;
@ -113,7 +113,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
QgsMapCanvasMap* map();
QgsMapRender* mapRender();
QgsMapRenderer* mapRender();
//! Accessor for the canvas pixmap
QPixmap& canvasPixmap();
@ -350,7 +350,7 @@ private:
QgsMapCanvas( QgsMapCanvas const & );
//! all map rendering is done in this class
QgsMapRender* mMapRender;
QgsMapRenderer* mMapRenderer;
//! owns pixmap with rendered map and controls rendering
QgsMapCanvasMap* mMap;

View File

@ -17,7 +17,7 @@
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgsmapcanvasmap.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include <QPainter>

View File

@ -21,7 +21,7 @@
#include <QPixmap>
class QgsMapRender;
class QgsMapRenderer;
class QgsMapCanvas;
class GUI_EXPORT QgsMapCanvasMap : public QGraphicsRectItem
@ -38,7 +38,7 @@ class GUI_EXPORT QgsMapCanvasMap : public QGraphicsRectItem
void useQImageToRender(bool flag) { mUseQImageToRender = flag; }
//! renders map using QgsMapRender to mPixmap
//! renders map using QgsMapRenderer to mPixmap
void render();
void setBgColor(const QColor& color) { mBgColor = color; }
@ -67,7 +67,7 @@ class GUI_EXPORT QgsMapCanvasMap : public QGraphicsRectItem
QPixmap mPixmap;
QImage mImage;
//QgsMapRender* mRender;
//QgsMapRenderer* mRender;
QgsMapCanvas* mCanvas;
QColor mBgColor;

View File

@ -27,7 +27,7 @@ QgsMapCanvasSnapper::QgsMapCanvasSnapper(QgsMapCanvas* canvas): mMapCanvas(canva
{
if(canvas)
{
QgsMapRender* canvasRender = canvas->mapRender();
QgsMapRenderer* canvasRender = canvas->mapRender();
if(canvasRender)
{
mSnapper = new QgsSnapper(canvasRender);

View File

@ -18,7 +18,7 @@
/* $Id$ */
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsmapoverviewcanvas.h"
#include "qgsmaptopixel.h"
@ -70,21 +70,21 @@ QgsMapOverviewCanvas::QgsMapOverviewCanvas(QWidget * parent, QgsMapCanvas* mapCa
setObjectName("theOverviewCanvas");
mPanningWidget = new QgsPanningWidget(this);
mMapRender = new QgsMapRender;
mMapRender->setOverview();
mMapRenderer = new QgsMapRenderer;
mMapRenderer->setOverview();
setbgColor(palette().window().color());
}
QgsMapOverviewCanvas::~QgsMapOverviewCanvas()
{
delete mMapRender;
delete mMapRenderer;
}
void QgsMapOverviewCanvas::resizeEvent(QResizeEvent* e)
{
mPixmap = QPixmap(e->size());
mMapRender->setOutputSize(e->size(), mPixmap.logicalDpiX());
mMapRenderer->setOutputSize(e->size(), mPixmap.logicalDpiX());
refresh();
}
@ -100,7 +100,7 @@ void QgsMapOverviewCanvas::reflectChangedExtent()
return;
}
const QgsMapToPixel* cXf = mMapRender->coordXForm();
const QgsMapToPixel* cXf = mMapRenderer->coordXForm();
QgsPoint ll(extent.xMin(), extent.yMin());
QgsPoint ur(extent.xMax(), extent.yMax());
if(cXf)
@ -184,7 +184,7 @@ void QgsMapOverviewCanvas::mouseReleaseEvent(QMouseEvent * e)
if ((e->buttons() & Qt::LeftButton) == Qt::LeftButton)
{
// set new extent
const QgsMapToPixel* cXf = mMapRender->coordXForm();
const QgsMapToPixel* cXf = mMapRenderer->coordXForm();
QRect rect = mPanningWidget->geometry();
QgsPoint center = cXf->toMapCoordinates(rect.center());
@ -244,7 +244,7 @@ void QgsMapOverviewCanvas::refresh()
painter.setRenderHint(QPainter::Antialiasing);
// render image
mMapRender->render(&painter);
mMapRenderer->render(&painter);
painter.end();
@ -268,27 +268,27 @@ void QgsMapOverviewCanvas::setbgColor(const QColor& color)
void QgsMapOverviewCanvas::setLayerSet(const QStringList& layerSet)
{
mMapRender->setLayerSet(layerSet);
mMapRenderer->setLayerSet(layerSet);
}
void QgsMapOverviewCanvas::updateFullExtent(const QgsRect& rect)
{
mMapRender->setExtent(rect);
mMapRenderer->setExtent(rect);
reflectChangedExtent();
}
void QgsMapOverviewCanvas::projectionsEnabled(bool flag)
{
mMapRender->setProjectionsEnabled(flag);
mMapRenderer->setProjectionsEnabled(flag);
}
void QgsMapOverviewCanvas::destinationSrsChanged()
{
const QgsSpatialRefSys& srs = mMapCanvas->mapRender()->destinationSrs();
mMapRender->setDestinationSrs(srs);
mMapRenderer->setDestinationSrs(srs);
}
QStringList& QgsMapOverviewCanvas::layerSet()
{
return mMapRender->layerSet();
return mMapRenderer->layerSet();
}

View File

@ -28,7 +28,7 @@
#include <QPixmap>
class QgsMapCanvas;
class QgsMapRender;
class QgsMapRenderer;
class QgsPanningWidget; // defined in .cpp
class QgsRect;
@ -95,7 +95,7 @@ class GUI_EXPORT QgsMapOverviewCanvas : public QWidget
QgsMapCanvas* mMapCanvas;
//! for rendering overview
QgsMapRender* mMapRender;
QgsMapRenderer* mMapRenderer;
//! pixmap where the map is stored
QPixmap mPixmap;

View File

@ -17,8 +17,8 @@
#include "qgslogger.h"
#include "qgsmaptool.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaptopixel.h"
#include "qgsmaprenderer.h"
#include <QAction>
#include <QAbstractButton>

View File

@ -96,12 +96,12 @@ void QgsQuickPrint::setOutputPdf(QString theFileName)
}
void QgsQuickPrint::setMapCanvas(QgsMapCanvas * thepMapCanvas)
{
mpMapRender=thepMapCanvas->mapRender();
mpMapRenderer=thepMapCanvas->mapRender();
mMapBackgroundColour = thepMapCanvas->canvasColor();
}
void QgsQuickPrint::setMapRender(QgsMapRender * thepMapRender)
void QgsQuickPrint::setMapRenderer(QgsMapRenderer * thepMapRenderer)
{
mpMapRender=thepMapRender;
mpMapRenderer=thepMapRenderer;
}
void QgsQuickPrint::setMapBackgroundColor(QColor theColor)
{
@ -118,7 +118,7 @@ void QgsQuickPrint::printMap()
{
return;
}
if ( mpMapRender == NULL )
if ( mpMapRenderer == NULL )
{
return;
}
@ -226,10 +226,10 @@ void QgsQuickPrint::printMap()
// Remember the size and dpi of the maprender
// so we can restore it properly
//
int myOriginalDpi = mpMapRender->outputDpi();
int myOriginalDpi = mpMapRenderer->outputDpi();
//sensible default to prevent divide by zero
if (0==myOriginalDpi) myOriginalDpi=96;
QSize myOriginalSize = mpMapRender->outputSize();
QSize myOriginalSize = mpMapRenderer->outputSize();
int mySymbolScalingAmount = myPrintResolutionDpi / myOriginalDpi;
//define the font sizes and family
@ -346,11 +346,11 @@ void QgsQuickPrint::printMap()
QPainter myMapPainter;
myMapPainter.begin( &myMapPixmap );
// Now resize for print
mpMapRender->setOutputSize(
mpMapRenderer->setOutputSize(
QSize ( myMapDimensionX, myMapDimensionY ), myPrinter.resolution() );
scalePointSymbols(mySymbolScalingAmount, ScaleUp);
scaleTextLabels(mySymbolScalingAmount, ScaleUp);
mpMapRender->render( &myMapPainter );
mpMapRenderer->render( &myMapPainter );
myMapPainter.end();
//draw the map pixmap onto our pdf print device
@ -394,7 +394,7 @@ void QgsQuickPrint::printMap()
int myLegendVerticalSpacer = myLegendFontHeight/3; //for vertical between rows
int myIconWidth = myLegendFontHeight;
myPrintPainter.setFont( myLegendFont );
QStringList myLayerSet = mpMapRender->layerSet();
QStringList myLayerSet = mpMapRenderer->layerSet();
QStringListIterator myLayerIterator ( myLayerSet );
//second clause below is to prevent legend spilling out the bottom
while ( myLayerIterator.hasNext() &&
@ -656,7 +656,7 @@ void QgsQuickPrint::printMap()
myOriginY,
myOriginalViewport.width(),
myOriginalViewport.height());
renderPrintScaleBar(&myPrintPainter, mpMapRender, myLogoXDim);
renderPrintScaleBar(&myPrintPainter, mpMapRenderer, myLogoXDim);
myPrintPainter.setViewport(myOriginalViewport);
//
@ -679,7 +679,7 @@ void QgsQuickPrint::printMap()
//
// Restore the map render to its former glory
//
mpMapRender->setOutputSize( myOriginalSize, myOriginalDpi);
mpMapRenderer->setOutputSize( myOriginalSize, myOriginalDpi);
}
void QgsQuickPrint::scaleTextLabels( int theScaleFactor, SymbolScalingType theDirection)
@ -689,7 +689,7 @@ void QgsQuickPrint::scaleTextLabels( int theScaleFactor, SymbolScalingType theDi
QgsDebugMsg ("QgsQuickPrintGui::scaleTextLabels invalid scale factor");
return;
}
QStringList myLayerSet = mpMapRender->layerSet();
QStringList myLayerSet = mpMapRenderer->layerSet();
QStringListIterator myLayerIterator ( myLayerSet );
while ( myLayerIterator.hasNext() )
{
@ -729,7 +729,7 @@ void QgsQuickPrint::scalePointSymbols( int theScaleFactor, SymbolScalingType the
QgsDebugMsg ("QgsQuickPrintGui::scalePointSymbolsForPrint invalid scale factor");
return;
}
QStringList myLayerSet = mpMapRender->layerSet();
QStringList myLayerSet = mpMapRenderer->layerSet();
QStringListIterator myLayerIterator ( myLayerSet );
while ( myLayerIterator.hasNext() )
{
@ -790,7 +790,7 @@ void QgsQuickPrint::scalePointSymbols( int theScaleFactor, SymbolScalingType the
void QgsQuickPrint::renderPrintScaleBar(QPainter * thepPainter,
QgsMapRender * thepMapRender,
QgsMapRenderer * thepMapRenderer,
int theMaximumWidth)
{
//hard coding some options for now
@ -813,10 +813,10 @@ void QgsQuickPrint::renderPrintScaleBar(QPainter * thepPainter,
//Get map units per pixel. This can be negative at times (to do with
//projections) and that just confuses the rest of the code in this
//function, so force to a positive number.
double myMuppDouble = std::abs(thepMapRender->mupp());
double myMuppDouble = std::abs(thepMapRenderer->mupp());
//
// Exit if the canvas width is 0 or layercount is 0 or QGIS will freeze
int myLayerCount=thepMapRender->layerSet().count();
int myLayerCount=thepMapRenderer->layerSet().count();
if (!myLayerCount || !myMuppDouble) return;
//Calculate size of scale bar for preferred number of map units
@ -837,7 +837,7 @@ void QgsQuickPrint::renderPrintScaleBar(QPainter * thepPainter,
}
//Get type of map units and set scale bar unit label text
QGis::units myMapUnits=thepMapRender->mapUnits();
QGis::units myMapUnits=thepMapRenderer->mapUnits();
QString myScaleBarUnitLabel;
switch (myMapUnits)
{

View File

@ -25,7 +25,7 @@
#include <QPrinter>
//QGIS includes
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
#include <qgsmapcanvas.h>
@ -59,11 +59,11 @@ public slots:
//! This is just a convenience function to get the
//map render from the mapcanvas
void setMapCanvas(QgsMapCanvas * thepMapCanvas);
void setMapRender(QgsMapRender * thepMapRender);
void setMapRenderer(QgsMapRenderer * thepMapRenderer);
void setMapBackgroundColor(QColor theColor);
private:
void renderPrintScaleBar(QPainter * thepPainter,
QgsMapRender * thepMapRender,
QgsMapRenderer * thepMapRenderer,
int theMaximumWidth);
QStringList wordWrap(QString theString,
QFontMetrics theMetrics,
@ -101,7 +101,7 @@ private:
*/
void scaleTextLabels( int theScaleFactor, SymbolScalingType theDirection);
QgsMapRender * mpMapRender;
QgsMapRenderer * mpMapRenderer;
QString mTitleText;
QString mNameText;
QString mCopyrightText;

View File

@ -19,7 +19,7 @@
#include "qgsgeometry.h"
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include <QPainter>
/*!
@ -160,7 +160,7 @@ void QgsRubberBand::setToGeometry(QgsGeometry* geom, QgsVectorLayer& layer)
}
//maprender object of canvas
QgsMapRender* mr = mMapCanvas->mapRender();
QgsMapRenderer* mr = mMapCanvas->mapRender();
if(!mr)
{
return;

View File

@ -93,7 +93,7 @@ void QgsCopyrightLabelPlugin::initGui()
void QgsCopyrightLabelPlugin::projectRead()
{
#ifdef QGISDEBUG
std::cout << "+++++++++ Copyright plugin - project read slot called...." << std::endl;
//std::cout << "+++++++++ Copyright plugin - project read slot called...." << std::endl;
#endif //default text to start with - try to fetch it from qgsproject
QDate now;

View File

@ -50,7 +50,7 @@
#include "qgsmapcanvas.h"
#include "qgsmapcanvasitem.h"
#include "qgsmaplayer.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsvectorlayer.h"
#include "qgsdataprovider.h"
#include "qgsmaptoolpan.h"

View File

@ -268,7 +268,7 @@ void QgsGrassPlugin::mapsetChanged ()
void QgsGrassPlugin::saveMapset()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassPlugin::addVector()" << std::endl;
//std::cerr << "QgsGrassPlugin::addVector()" << std::endl;
#endif
// Save working mapset in project file
@ -286,7 +286,7 @@ void QgsGrassPlugin::saveMapset()
void QgsGrassPlugin::addVector()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassPlugin::addVector()" << std::endl;
//std::cerr << "QgsGrassPlugin::addVector()" << std::endl;
#endif
QString uri;
@ -296,15 +296,15 @@ void QgsGrassPlugin::addVector()
uri = sel->gisdbase + "/" + sel->location + "/" + sel->mapset + "/" + sel->map + "/" + sel->layer;
}
#ifdef QGISDEBUG
std::cerr << "plugin URI: " << uri.toLocal8Bit().data() << std::endl;
//std::cerr << "plugin URI: " << uri.toLocal8Bit().data() << std::endl;
#endif
if ( uri.length() == 0 )
{
std::cerr << "Nothing was selected" << std::endl;
//std::cerr << "Nothing was selected" << std::endl;
return;
} else {
#ifdef QGISDEBUG
std::cout << "Add new vector layer" << std::endl;
//std::cout << "Add new vector layer" << std::endl;
#endif
// create vector name: vector layer
@ -358,8 +358,10 @@ void QgsGrassPlugin::addVector()
}
Vect_close ( &map );
} else {
std::cerr << "Cannot open GRASS vector: " << QgsGrass::getErrorMessage().toLocal8Bit().data() << std::endl;
}
else
{
QMessageBox::warning( 0, tr("Warning"), "Cannot open GRASS vector:\n " + QgsGrass::getErrorMessage());
}
qGisInterface->addVectorLayer( uri, name, "grass");
@ -370,11 +372,11 @@ void QgsGrassPlugin::addVector()
void QgsGrassPlugin::addRaster()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassPlugin::addRaster()" << std::endl;
//std::cerr << "QgsGrassPlugin::addRaster()" << std::endl;
#endif
QString uri;
std::cerr << "QgsGrassPlugin::addRaster" << std::endl;
//std::cerr << "QgsGrassPlugin::addRaster" << std::endl;
QgsGrassSelect *sel = new QgsGrassSelect(QgsGrassSelect::RASTER );
if ( sel->exec() ) {
@ -388,14 +390,14 @@ void QgsGrassPlugin::addRaster()
uri = sel->gisdbase + "/" + sel->location + "/" + sel->mapset + "/" + element + "/" + sel->map;
}
#ifdef QGISDEBUG
std::cerr << "plugin URI: " << uri.toLocal8Bit().data() << std::endl;
//std::cerr << "plugin URI: " << uri.toLocal8Bit().data() << std::endl;
#endif
if ( uri.length() == 0 ) {
std::cerr << "Nothing was selected" << std::endl;
//std::cerr << "Nothing was selected" << std::endl;
return;
} else {
#ifdef QGISDEBUG
std::cout << "Add new raster layer" << std::endl;
//std::cout << "Add new raster layer" << std::endl;
#endif
// create raster name
int pos = uri.findRev('/');
@ -413,9 +415,9 @@ void QgsGrassPlugin::openTools()
if ( !mTools ) {
mTools = new QgsGrassTools ( qGisInterface, qGisInterface->getMainWindow(), 0, Qt::WType_Dialog );
std::cout << "connect = " <<
connect( mTools, SIGNAL( regionChanged() ), this, SLOT( redrawRegion()) )
<< "connect" << std::endl;
//std::cout << "connect = " <<
connect( mTools, SIGNAL( regionChanged() ), this, SLOT( redrawRegion()) );
// << "connect" << std::endl;
}
mTools->show();
@ -447,7 +449,7 @@ void QgsGrassPlugin::edit()
void QgsGrassPlugin::setEditAction()
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::setEditAction()" << std::endl;
//std::cout << "QgsGrassPlugin::setEditAction()" << std::endl;
#endif
QgsMapLayer *layer = (QgsMapLayer *) qGisInterface->activeLayer();
@ -465,7 +467,7 @@ void QgsGrassPlugin::setEditAction()
void QgsGrassPlugin::newVector()
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::newVector()" << std::endl;
//std::cout << "QgsGrassPlugin::newVector()" << std::endl;
#endif
if ( QgsGrassEdit::isRunning() ) {
@ -539,14 +541,14 @@ void QgsGrassPlugin::newVector()
void QgsGrassPlugin::postRender(QPainter *painter)
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::postRender()" << std::endl;
//std::cout << "QgsGrassPlugin::postRender()" << std::endl;
#endif
}
void QgsGrassPlugin::displayRegion()
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::displayRegion()" << std::endl;
//std::cout << "QgsGrassPlugin::displayRegion()" << std::endl;
#endif
mRegionBand->reset();
@ -592,7 +594,7 @@ void QgsGrassPlugin::displayRegion()
void QgsGrassPlugin::switchRegion(bool on)
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::switchRegion()" << std::endl;
//std::cout << "QgsGrassPlugin::switchRegion()" << std::endl;
#endif
QSettings settings;
@ -608,7 +610,7 @@ void QgsGrassPlugin::switchRegion(bool on)
void QgsGrassPlugin::redrawRegion()
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::redrawRegion()" << std::endl;
//std::cout << "QgsGrassPlugin::redrawRegion()" << std::endl;
#endif
if ( mRegionAction->isOn() )
{
@ -619,7 +621,7 @@ void QgsGrassPlugin::redrawRegion()
void QgsGrassPlugin::changeRegion(void)
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::changeRegion()" << std::endl;
//std::cout << "QgsGrassPlugin::changeRegion()" << std::endl;
#endif
if ( mRegion ) { // running
@ -660,7 +662,7 @@ void QgsGrassPlugin::setRegionPen(QPen & pen)
void QgsGrassPlugin::openMapset()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassPlugin::openMapset()" << std::endl;
//std::cerr << "QgsGrassPlugin::openMapset()" << std::endl;
#endif
QString element;
@ -685,7 +687,7 @@ void QgsGrassPlugin::openMapset()
void QgsGrassPlugin::closeMapset()
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassPlugin::closeMapset()" << std::endl;
//std::cerr << "QgsGrassPlugin::closeMapset()" << std::endl;
#endif
QString err = QgsGrass::closeMapset ();
@ -714,7 +716,7 @@ void QgsGrassPlugin::newMapset()
void QgsGrassPlugin::projectRead()
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::projectRead" << std::endl;
//std::cout << "QgsGrassPlugin::projectRead" << std::endl;
#endif
bool ok;
QString gisdbase = QgsProject::instance()->readEntry(
@ -767,7 +769,7 @@ void QgsGrassPlugin::projectRead()
void QgsGrassPlugin::newProject()
{
#ifdef QGISDEBUG
std::cout << "QgsGrassPlugin::newProject" << std::endl;
//std::cout << "QgsGrassPlugin::newProject" << std::endl;
#endif
}

View File

@ -30,7 +30,7 @@ email : tim@linfiniti.com
#include "qgsproject.h"
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgsmaprender.h"
#include "qgsmaprenderer.h"
#include "qgsapplication.h"
// qt includes

View File

@ -41,7 +41,7 @@
//QGIS includes
#include "qgisplugin.h"
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
#include <qgsmapcanvas.h>
//forward declarations

View File

@ -233,25 +233,25 @@ ELSE (APPLE)
ADD_TEST(qgis_rendererstest ${CMAKE_INSTALL_PREFIX}/bin/qgis_rendererstest)
ENDIF (APPLE)
#
# QgsMapRender test
# QgsMapRenderer test
#
SET(qgis_maprendertest_SRCS testqgsmaprender.cpp ${util_SRCS})
SET(qgis_maprendertest_MOC_CPPS testqgsmaprender.cpp)
QT4_WRAP_CPP(qgis_maprendertest_MOC_SRCS ${qgis_maprendertest_MOC_CPPS})
ADD_CUSTOM_TARGET(qgis_maprendertestmoc ALL DEPENDS ${qgis_maprendertest_MOC_SRCS})
ADD_EXECUTABLE(qgis_maprendertest ${qgis_maprendertest_SRCS})
ADD_DEPENDENCIES(qgis_maprendertest qgis_maprendertestmoc)
TARGET_LINK_LIBRARIES(qgis_maprendertest ${QT_LIBRARIES} qgis_core)
SET_TARGET_PROPERTIES(qgis_maprendertest
SET(qgis_maprenderertest_SRCS testqgsmaprenderer.cpp ${util_SRCS})
SET(qgis_maprenderertest_MOC_CPPS testqgsmaprenderer.cpp)
QT4_WRAP_CPP(qgis_maprenderertest_MOC_SRCS ${qgis_maprenderertest_MOC_CPPS})
ADD_CUSTOM_TARGET(qgis_maprenderertestmoc ALL DEPENDS ${qgis_maprenderertest_MOC_SRCS})
ADD_EXECUTABLE(qgis_maprenderertest ${qgis_maprenderertest_SRCS})
ADD_DEPENDENCIES(qgis_maprenderertest qgis_maprenderertestmoc)
TARGET_LINK_LIBRARIES(qgis_maprenderertest ${QT_LIBRARIES} qgis_core)
SET_TARGET_PROPERTIES(qgis_maprenderertest
PROPERTIES INSTALL_RPATH ${QGIS_LIB_DIR}
INSTALL_RPATH_USE_LINK_PATH true)
IF (APPLE)
# For Mac OS X, the executable must be at the root of the bundle's executable folder
INSTALL(TARGETS qgis_maprendertest RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
ADD_TEST(qgis_maprendertest ${CMAKE_INSTALL_PREFIX}/qgis_maprendertest)
INSTALL(TARGETS qgis_maprenderertest RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
ADD_TEST(qgis_maprenderertest ${CMAKE_INSTALL_PREFIX}/qgis_maprenderertest)
ELSE (APPLE)
INSTALL(TARGETS qgis_maprendertest RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
ADD_TEST(qgis_maprendertest ${CMAKE_INSTALL_PREFIX}/bin/qgis_maprendertest)
INSTALL(TARGETS qgis_maprenderertest RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
ADD_TEST(qgis_maprenderertest ${CMAKE_INSTALL_PREFIX}/bin/qgis_maprenderertest)
ENDIF (APPLE)
#
# QgsGeometry test

View File

@ -18,7 +18,7 @@
#define QGSRENDERCHECKER_H
#include <QString>
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
/** \ingroup UnitTests
@ -45,7 +45,7 @@ public:
void setElapsedTimeTarget(int theTarget) { mElapsedTimeTarget = theTarget; };
void setExpectedImage (QString theImageFileName) { mExpectedImageFile = theImageFileName; };
void setRenderedImage (QString theImageFileName) { mRenderedImageFile = theImageFileName; };
void setMapRenderer ( QgsMapRender * thepMapRenderer) { mpMapRenderer = thepMapRenderer; };
void setMapRenderer ( QgsMapRenderer * thepMapRenderer) { mpMapRenderer = thepMapRenderer; };
/**
* Test using renderer to generate the image to be compared.
* @param theTestName - to be used as the basis for writing a file to
@ -69,7 +69,7 @@ private:
unsigned int mMatchTarget;
int mElapsedTime;
int mElapsedTimeTarget;
QgsMapRender * mpMapRenderer;
QgsMapRenderer * mpMapRenderer;
}; // class QgsRenderChecker

View File

@ -32,7 +32,7 @@
#include <qgsrasterbandstats.h>
#include <qgsmaplayerregistry.h>
#include <qgsapplication.h>
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
//qgis unit test includes
#include <qgsrenderchecker.h>
@ -55,7 +55,7 @@ class Regression992: public QObject
bool render(QString theFileName);
QString mTestDataDir;
QgsRasterLayer * mpRasterLayer;
QgsMapRender * mpMapRenderer;
QgsMapRenderer * mpMapRenderer;
QString mReport;
};
@ -76,7 +76,7 @@ void Regression992::initTestCase()
// Register the layer with the registry
QgsMapLayerRegistry::instance()->addMapLayer(mpRasterLayer);
// add the test layer to the maprender
mpMapRenderer = new QgsMapRender();
mpMapRenderer = new QgsMapRenderer();
QStringList myLayers;
myLayers << mpRasterLayer->getLayerID();
mpMapRenderer->setLayerSet(myLayers);

View File

@ -35,7 +35,7 @@
#include <qgsapplication.h> //search path for srs.db
#include <qgsfield.h>
#include <qgis.h> //defines GEOWKT
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
#include <qgsmaplayer.h>
#include <qgsvectorlayer.h>
#include <qgsapplication.h>
@ -46,11 +46,11 @@
#include "qgsrenderchecker.h"
/** \ingroup UnitTests
* This is a unit test for the QgsMapRender class.
* This is a unit test for the QgsMapRenderer class.
* It will do some performance testing too
*
*/
class TestQgsMapRender: public QObject
class TestQgsMapRenderer: public QObject
{
Q_OBJECT;
private slots:
@ -67,12 +67,12 @@ class TestQgsMapRender: public QObject
QgsVectorFileWriter::WriterError mError;
QgsSpatialRefSys mSRS;
QgsFieldMap mFields;
QgsMapRender * mpMapRenderer;
QgsMapRenderer * mpMapRenderer;
QgsMapLayer * mpPolysLayer;
QString mReport;
};
void TestQgsMapRender::initTestCase()
void TestQgsMapRenderer::initTestCase()
{
//
// Runs once before any tests are run
@ -169,7 +169,7 @@ void TestQgsMapRender::initTestCase()
// Register the layer with the registry
QgsMapLayerRegistry::instance()->addMapLayer(mpPolysLayer);
// add the test layer to the maprender
mpMapRenderer = new QgsMapRender();
mpMapRenderer = new QgsMapRenderer();
QStringList myLayers;
myLayers << mpPolysLayer->getLayerID();
mpMapRenderer->setLayerSet(myLayers);
@ -177,7 +177,7 @@ void TestQgsMapRender::initTestCase()
}
void TestQgsMapRender::cleanupTestCase()
void TestQgsMapRenderer::cleanupTestCase()
{
QString myReportFile = QDir::tempPath() + QDir::separator() + "maprendertest.html";
QFile myFile ( myReportFile);
@ -193,7 +193,7 @@ void TestQgsMapRender::cleanupTestCase()
void TestQgsMapRender::performanceTest()
void TestQgsMapRenderer::performanceTest()
{
mpMapRenderer->setExtent(mpPolysLayer->extent());
QString myDataDir (TEST_DATA_DIR); //defined in CmakeLists.txt
@ -207,7 +207,7 @@ void TestQgsMapRender::performanceTest()
}
QTEST_MAIN(TestQgsMapRender)
#include "moc_testqgsmaprender.cxx"
QTEST_MAIN(TestQgsMapRenderer)
#include "moc_testqgsmaprenderer.cxx"

View File

@ -33,7 +33,7 @@
#include <qgsrasterbandstats.h>
#include <qgsmaplayerregistry.h>
#include <qgsapplication.h>
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
//qgis unit test includes
#include <qgsrenderchecker.h>
@ -63,7 +63,7 @@ class TestQgsRasterLayer: public QObject
QString mTestDataDir;
QgsRasterLayer * mpRasterLayer;
QgsRasterLayer * mpLandsatRasterLayer;
QgsMapRender * mpMapRenderer;
QgsMapRenderer * mpMapRenderer;
QString mReport;
};
@ -89,7 +89,7 @@ void TestQgsRasterLayer::initTestCase()
QgsMapLayerRegistry::instance()->addMapLayer(mpRasterLayer);
QgsMapLayerRegistry::instance()->addMapLayer(mpLandsatRasterLayer);
// add the test layer to the maprender
mpMapRenderer = new QgsMapRender();
mpMapRenderer = new QgsMapRenderer();
QStringList myLayers;
myLayers << mpRasterLayer->getLayerID();
mpMapRenderer->setLayerSet(myLayers);

View File

@ -24,7 +24,7 @@
#include <iostream>
//qgis includes...
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
#include <qgsmaplayer.h>
#include <qgsvectorlayer.h>
#include <qgsapplication.h>
@ -52,7 +52,7 @@ class TestQgsRenderers: public QObject
private:
bool setQml (QString theType); //uniquevalue / continuous / single /
bool imageCheck(QString theType); //as above
QgsMapRender * mpMapRenderer;
QgsMapRenderer * mpMapRenderer;
QgsMapLayer * mpPointsLayer;
QgsMapLayer * mpLinesLayer;
QgsMapLayer * mpPolysLayer;
@ -113,7 +113,7 @@ void TestQgsRenderers::initTestCase()
// since maprender does not require a qui
// and is more light weight
//
mpMapRenderer = new QgsMapRender();
mpMapRenderer = new QgsMapRenderer();
QStringList myLayers;
myLayers << mpPointsLayer->getLayerID();
myLayers << mpPolysLayer->getLayerID();

View File

@ -23,7 +23,7 @@
#include <iostream>
//qgis includes...
#include <qgsmaprender.h>
#include <qgsmaprenderer.h>
#include <qgsmaplayer.h>
#include <qgsvectorlayer.h>
#include <qgsapplication.h>
@ -48,7 +48,7 @@ class TestQgsQuickPrint: public QObject
void basicMapTest();
private:
bool imageCheck(QString theType); //as above
QgsMapRender * mpMapRenderer;
QgsMapRenderer * mpMapRenderer;
QgsMapLayer * mpPointsLayer;
QgsMapLayer * mpLinesLayer;
QgsMapLayer * mpPolysLayer;
@ -104,7 +104,7 @@ void TestQgsQuickPrint::initTestCase()
// since maprender does not require a qui
// and is more light weight
//
mpMapRenderer = new QgsMapRender();
mpMapRenderer = new QgsMapRenderer();
QStringList myLayers;
myLayers << mpPointsLayer->getLayerID();
myLayers << mpPolysLayer->getLayerID();
@ -141,7 +141,7 @@ void TestQgsQuickPrint::basicMapTest()
QgsQuickPrint myQuickPrint;
myQuickPrint.setMapBackgroundColor ( Qt::cyan );
myQuickPrint.setOutputPdf (QDir::tempPath() + QDir::separator() + "quickprinttest.pdf");
myQuickPrint.setMapRender (mpMapRenderer);
myQuickPrint.setMapRenderer (mpMapRenderer);
myQuickPrint.setTitle ("Map Title");
myQuickPrint.setName ("Map Name");
myQuickPrint.setCopyright ("Copyright Text");