Skip to content
Permalink
Browse files
Merge vector overlay branch (diagram plugin)
git-svn-id: http://svn.osgeo.org/qgis/trunk@10484 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Apr 6, 2009
1 parent 326f472 commit 846a43c6588bd54d9838dd7da1ab74d712e07f96
Showing with 19,566 additions and 73 deletions.
  1. +34 −50 python/plugins/plugin_installer/installer_gui.py
  2. +0 −2 src/app/qgisapp.cpp
  3. +37 −0 src/app/qgsoptions.cpp
  4. +12 −0 src/app/qgspluginregistry.cpp
  5. +3 −0 src/app/qgspluginregistry.h
  6. +0 −1 src/app/qgsprojectproperties.cpp
  7. +50 −0 src/app/qgsvectorlayerproperties.cpp
  8. +7 −0 src/app/qgsvectorlayerproperties.h
  9. +27 −0 src/core/CMakeLists.txt
  10. +839 −0 src/core/pal/feature.cpp
  11. +244 −0 src/core/pal/feature.h
  12. +558 −0 src/core/pal/geomfunction.cpp
  13. +177 −0 src/core/pal/geomfunction.h
  14. +270 −0 src/core/pal/hashtable.hpp
  15. +90 −0 src/core/pal/internalexception.h
  16. +95 −0 src/core/pal/label.cpp
  17. +130 −0 src/core/pal/label.h
  18. +546 −0 src/core/pal/labelposition.cpp
  19. +288 −0 src/core/pal/labelposition.h
  20. +581 −0 src/core/pal/layer.cpp
  21. +343 −0 src/core/pal/layer.h
  22. +256 −0 src/core/pal/linkedlist.hpp
  23. +1,193 −0 src/core/pal/pal.cpp
  24. +408 −0 src/core/pal/pal.h
  25. +104 −0 src/core/pal/palexception.h
  26. +87 −0 src/core/pal/palgeometry.h
  27. +97 −0 src/core/pal/palstat.cpp
  28. +101 −0 src/core/pal/palstat.h
  29. +1,567 −0 src/core/pal/pointset.cpp
  30. +242 −0 src/core/pal/pointset.h
  31. +306 −0 src/core/pal/priorityqueue.cpp
  32. +92 −0 src/core/pal/priorityqueue.h
  33. +3,056 −0 src/core/pal/problem.cpp
  34. +222 −0 src/core/pal/problem.h
  35. +1,397 −0 src/core/pal/rtree.hpp
  36. +87 −0 src/core/pal/simplemutex.h
  37. +567 −0 src/core/pal/util.cpp
  38. +273 −0 src/core/pal/util.h
  39. +242 −0 src/core/qgscentralpointpositionmanager.cpp
  40. +49 −0 src/core/qgscentralpointpositionmanager.h
  41. +12 −0 src/core/qgsgeometry.cpp
  42. +3 −0 src/core/qgsgeometry.h
  43. +91 −1 src/core/qgsmaprenderer.cpp
  44. +4 −0 src/core/qgsmaprenderer.h
  45. +76 −0 src/core/qgsoverlayobject.cpp
  46. +84 −0 src/core/qgsoverlayobject.h
  47. +44 −0 src/core/qgsoverlayobjectpositionmanager.h
  48. +188 −0 src/core/qgspalobjectpositionmanager.cpp
  49. +41 −0 src/core/qgspalobjectpositionmanager.h
  50. +1 −1 src/core/qgsrendercontext.h
  51. +44 −0 src/core/qgsvectorlayer.cpp
  52. +16 −0 src/core/qgsvectorlayer.h
  53. +39 −0 src/core/qgsvectoroverlay.cpp
  54. +87 −0 src/core/qgsvectoroverlay.h
  55. +2 −0 src/plugins/CMakeLists.txt
  56. +61 −0 src/plugins/diagram_overlay/CMakeLists.txt
  57. +161 −0 src/plugins/diagram_overlay/qgsbardiagramfactory.cpp
  58. +67 −0 src/plugins/diagram_overlay/qgsbardiagramfactory.h
  59. +29 −0 src/plugins/diagram_overlay/qgsdiagramcategory.cpp
  60. +56 −0 src/plugins/diagram_overlay/qgsdiagramcategory.h
  61. +348 −0 src/plugins/diagram_overlay/qgsdiagramdialog.cpp
  62. +53 −0 src/plugins/diagram_overlay/qgsdiagramdialog.h
  63. +110 −0 src/plugins/diagram_overlay/qgsdiagramdialogbase.ui
  64. +85 −0 src/plugins/diagram_overlay/qgsdiagramfactory.cpp
  65. +106 −0 src/plugins/diagram_overlay/qgsdiagramfactory.h
  66. +28 −0 src/plugins/diagram_overlay/qgsdiagramfactorywidget.cpp
  67. +37 −0 src/plugins/diagram_overlay/qgsdiagramfactorywidget.h
  68. +409 −0 src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
  69. +58 −0 src/plugins/diagram_overlay/qgsdiagramoverlay.h
  70. +156 −0 src/plugins/diagram_overlay/qgsdiagramoverlayplugin.cpp
  71. +47 −0 src/plugins/diagram_overlay/qgsdiagramoverlayplugin.h
  72. +331 −0 src/plugins/diagram_overlay/qgsdiagramrenderer.cpp
  73. +114 −0 src/plugins/diagram_overlay/qgsdiagramrenderer.h
  74. +33 −0 src/plugins/diagram_overlay/qgsdiagramrendererwidget.cpp
  75. +55 −0 src/plugins/diagram_overlay/qgsdiagramrendererwidget.h
  76. +106 −0 src/plugins/diagram_overlay/qgslinearlyscalingdialog.cpp
  77. +51 −0 src/plugins/diagram_overlay/qgslinearlyscalingdialog.h
  78. +65 −0 src/plugins/diagram_overlay/qgslinearlyscalingdialogbase.ui
  79. +116 −0 src/plugins/diagram_overlay/qgspiediagramfactory.cpp
  80. +61 −0 src/plugins/diagram_overlay/qgspiediagramfactory.h
  81. +136 −0 src/plugins/diagram_overlay/qgssvgdiagramfactory.cpp
  82. +70 −0 src/plugins/diagram_overlay/qgssvgdiagramfactory.h
  83. +246 −0 src/plugins/diagram_overlay/qgssvgdiagramfactorywidget.cpp
  84. +53 −0 src/plugins/diagram_overlay/qgssvgdiagramfactorywidget.h
  85. +153 −0 src/plugins/diagram_overlay/qgssvgdiagramfactorywidgetbase.ui
  86. +200 −0 src/plugins/diagram_overlay/qgswkndiagramfactory.cpp
  87. +79 −0 src/plugins/diagram_overlay/qgswkndiagramfactory.h
  88. +162 −0 src/plugins/diagram_overlay/qgswkndiagramfactorywidget.cpp
  89. +55 −0 src/plugins/diagram_overlay/qgswkndiagramfactorywidget.h
  90. +102 −0 src/plugins/diagram_overlay/qgswkndiagramfactorywidgetbase.ui
  91. +15 −0 src/plugins/interpolation/qgstininterpolator.cpp
  92. +2 −1 src/plugins/qgisplugin.h
  93. +31 −0 src/plugins/qgsapplydialog.h
  94. +1 −0 src/plugins/qgsvectoroverlayplugin.cpp
  95. +39 −0 src/plugins/qgsvectoroverlayplugin.h
  96. +63 −10 src/ui/qgsoptionsbase.ui
  97. +7 −7 src/ui/qgsprojectpropertiesbase.ui
@@ -571,6 +571,10 @@ def installPlugin(self):
if plugin["status"] == "newer" and not plugin["error"]: # ask for confirmation if user downgrades an usable plugin
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Are you sure you want to downgrade the plugin to the latest available version? The installed one is newer!"), QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
return
if plugin["status"] == "newer":
if QMessageBox.warning(self, self.tr("QGIS Python Plugin Installer"), self.tr("Are you sure you want to downgrade the plugin to the latest available version? The installed one is newer!"), QMessageBox.Yes, QMessageBox.No) == QMessageBox.No:
return

dlg = QgsPluginInstallerInstallingDialog(self,plugin)
dlg.exec_()

@@ -582,58 +586,38 @@ def installPlugin(self):
self.getAllAvailablePlugins()
QApplication.restoreOverrideCursor()
else:
try:
exec ("sys.path_importer_cache.clear()")
exec ("import %s" % plugin["localdir"])
exec ("reload (%s)" % plugin["localdir"])
except:
pass
plugins.updatePlugin(key, False)
plugin = plugins.all()[key]
if not plugin["error"]:
if previousStatus in ["not installed", "new"]:
infoString = (self.tr("Plugin installed successfully"),
self.tr("Python plugin installed.\nNow you need to enable it in Plugin Manager."))
else:
infoString = (self.tr("Plugin reinstalled successfully"),
self.tr("Python plugin reinstalled.\nYou need to restart Quantum GIS in order to reload it."))

path = QDir.cleanPath(QgsApplication.qgisSettingsDirPath() + "/python/plugins/" + key)
if not QDir(path).exists():
infoString = (self.tr("Plugin has disappeared"), self.tr("The plugin seems to have been installed but I don't know where. Probably the plugin package contained a wrong named directory.\nPlease search the list of installed plugins. I'm nearly sure you'll find the plugin there, but I just can't determine which of them it is. It also means that I won't be able to determine if this plugin is installed and inform you about available updates. However the plugin may work. Please contact the plugin author and submit this issue."))
QApplication.setOverrideCursor(Qt.WaitCursor)
self.getAllAvailablePlugins()
QApplication.restoreOverrideCursor()
else:
if plugin["error"] == "incompatible":
message = self.tr("The plugin is designed for a newer version of Quantum GIS. The minimum required version is:")
message += " <b>" + plugin["error_details"] + "</b>"
elif plugin["error"] == "dependent":
message = self.tr("The plugin depends on some components missing on your system. You need to install the following Python module in order to enable it:")
message += "<b> " + plugin["error_details"] + "</b>"
else:
message = self.tr("The plugin is broken. Python said:")
message += "<br><b>" + plugin["error_details"] + "</b>"
dlg = QgsPluginInstallerPluginErrorDialog(self,message)
dlg.exec_()
if dlg.result():
# revert installation
plugins.setPluginData(key, "status", "not installed")
plugins.setPluginData(key, "version_inst", "")
plugins.setPluginData(key, "desc_local", "")
plugins.setPluginData(key, "error", "")
plugins.setPluginData(key, "error_details", "")
pluginDir = QFileInfo(QgsApplication.qgisUserDbFilePath()).path() + "/python/plugins/" + plugin["localdir"]
removeDir(pluginDir)
if QDir(pluginDir).exists():
infoString = (self.tr("Plugin uninstall failed"), result)
try:
exec ("sys.path_importer_cache.clear()")
exec ("import %s" % plugin["localdir"])
exec ("reload (%s)" % plugin["localdir"])
except:
pass
plugins.updatePlugin(key, False)
try:
exec ("sys.path_importer_cache.clear()")
exec ("del sys.modules[%s]" % plugin["localdir"]) # remove old version if exist
except:
pass
try:
exec ("import %s" % plugin["localdir"])
exec ("reload (%s)" % plugin["localdir"])
if plugin["status"] == "not installed" or plugin["status"] == "new":
infoString = (self.tr("Plugin installed successfully"), self.tr("Python plugin installed.\nYou have to enable it in the Plugin Manager."))
else:
try:
exec ("del sys.modules[%s]" % plugin["localdir"])
except:
pass
if not plugin["repository"]:
plugins.remove(key)
infoString = (self.tr("Plugin installed successfully"),self.tr("Python plugin reinstalled.\nYou have to restart Quantum GIS to reload it."))
except Exception, error:
dlg = QgsPluginInstallerPluginErrorDialog(self,error.message)
dlg.exec_()
if dlg.result():
pluginDir = unicode(QFileInfo(QgsApplication.qgisUserDbFilePath()).path()+"/python/plugins/"+ str(plugin["localdir"]))
result = removeDir(pluginDir)
if result:
QMessageBox.warning(self, self.tr("Plugin uninstall failed"), result)
plugins.updatePlugin(key, False)
self.populatePluginTree()
return
plugins.updatePlugin(key, False)
self.populatePluginTree()
if infoString[0]:
QMessageBox.information(self, infoString[0], infoString[1])
@@ -4367,8 +4367,6 @@ void QgisApp::loadPythonSupport()
}
}



void QgisApp::checkQgisVersion()
{
QApplication::setOverrideCursor( Qt::WaitCursor );
@@ -241,6 +241,20 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WFlags fl ) :
#ifdef Q_WS_MAC //MH: disable incremental update on Mac for now to avoid problems with resizing
groupBox_5->setEnabled( false );
#endif //Q_WS_MAC

//overlay placement algorithm
mOverlayAlgorithmComboBox->insertItem(0, tr("Central point (fastest)"));
mOverlayAlgorithmComboBox->insertItem(1, tr("Chain (fast)"));
mOverlayAlgorithmComboBox->insertItem(2, tr("Popmusic tabu chain (slow)"));
mOverlayAlgorithmComboBox->insertItem(3, tr("Popmusic tabu (slow)"));
mOverlayAlgorithmComboBox->insertItem(4, tr("Popmusic chain (very slow)"));

QString overlayAlgorithmString = settings.value( "qgis/overlayPlacementAlgorithm", "Central point").toString();
if(overlayAlgorithmString == "Chain"){mOverlayAlgorithmComboBox->setCurrentIndex(1);}
else if(overlayAlgorithmString == "Popmusic tabu chain"){mOverlayAlgorithmComboBox->setCurrentIndex(2);}
else if(overlayAlgorithmString == "Popmusic tabu"){mOverlayAlgorithmComboBox->setCurrentIndex(3);}
else if(overlayAlgorithmString == "Popmusic chain"){mOverlayAlgorithmComboBox->setCurrentIndex(4);}
else{mOverlayAlgorithmComboBox->setCurrentIndex(0);} //default is central point
}

//! Destructor
@@ -330,6 +344,29 @@ void QgsOptions::saveOptions()
settings.setValue( "qgis/askToSaveProjectChanges", chbAskToSaveProjectChanges->isChecked() );
settings.setValue( "qgis/warnOldProjectVersion", chbWarnOldProjectVersion->isChecked() );

//overlay placement method
int overlayIndex = mOverlayAlgorithmComboBox->currentIndex();
if(overlayIndex == 1)
{
settings.setValue( "qgis/overlayPlacementAlgorithm", "Chain");
}
else if(overlayIndex == 2)
{
settings.setValue( "qgis/overlayPlacementAlgorithm", "Popmusic tabu chain");
}
else if(overlayIndex == 3)
{
settings.setValue( "qgis/overlayPlacementAlgorithm", "Popmusic tabu");
}
else if(overlayIndex == 4)
{
settings.setValue( "qgis/overlayPlacementAlgorithm", "Popmusic chain");
}
else
{
settings.setValue( "qgis/overlayPlacementAlgorithm", "Central point" );
}

if ( cmbTheme->currentText().length() == 0 )
{
settings.setValue( "/Themes", "default" );
@@ -269,6 +269,7 @@ void QgsPluginRegistry::loadCppPlugin( QString theFullPathName )
{
case QgisPlugin::RENDERER:
case QgisPlugin::UI:
case QgisPlugin::VECTOR_OVERLAY:
{
// UI only -- doesn't use mapcanvas
create_ui *cf = ( create_ui * ) cast_to_fptr( myLib.resolve( "classFactory" ) );
@@ -438,3 +439,14 @@ bool QgsPluginRegistry::isPythonPluginCompatible( QString packageName )
}
return true;
}

QList<QgsPluginMetadata*> QgsPluginRegistry::pluginData()
{
QList<QgsPluginMetadata*> resultList;
QMap<QString, QgsPluginMetadata>::iterator it = mPlugins.begin();
for(; it != mPlugins.end(); ++it)
{
resultList.push_back(&(it.value()));
}
return resultList;
}
@@ -84,6 +84,9 @@ class QgsPluginRegistry
//! Check whether plugin is compatible with current version of QGIS
bool isPythonPluginCompatible( QString packageName );

//! Returns metadata of all loaded plugins
QList<QgsPluginMetadata*> pluginData();

protected:
//! protected constructor
QgsPluginRegistry();
@@ -166,7 +166,6 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
mSnappingLayerSettings.insert( *idIter, newEntry );
}
}

}

QgsProjectProperties::~QgsProjectProperties()
@@ -22,6 +22,7 @@
#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgsattributeactiondialog.h"
#include "qgsapplydialog.h"
#include "qgscontexthelp.h"
#include "qgscontinuouscolordialog.h"
#include "qgscoordinatetransform.h"
@@ -30,13 +31,16 @@
#include "qgslabel.h"
#include "qgsgenericprojectionselector.h"
#include "qgslogger.h"
#include "qgspluginmetadata.h"
#include "qgspluginregistry.h"
#include "qgsproject.h"
#include "qgssinglesymboldialog.h"
#include "qgsuniquevaluedialog.h"
#include "qgsvectorlayer.h"
#include "qgsvectorlayerproperties.h"
#include "qgsconfig.h"
#include "qgsvectordataprovider.h"
#include "qgsvectoroverlayplugin.h"

#ifdef HAVE_POSTGRESQL
#include "qgspgquerybuilder.h"
@@ -120,6 +124,19 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(

connect( sliderTransparency, SIGNAL( valueChanged( int ) ), this, SLOT( sliderTransparency_valueChanged( int ) ) );

//for each overlay plugin create a new tab
int position;
QList<QgsVectorOverlayPlugin*> overlayPluginList = overlayPlugins();
QList<QgsVectorOverlayPlugin*>::const_iterator it = overlayPluginList.constBegin();

for(; it != overlayPluginList.constEnd(); ++it)
{
QgsApplyDialog* d = (*it)->dialog(lyr);
position = tabWidget->addTab(d, (*it)->name());
tabWidget->setCurrentIndex(position); //ugly, but otherwise the properties dialog is a mess
mOverlayDialogs.push_back(d);
}

tabWidget->setCurrentIndex( 0 );
} // QgsVectorLayerProperties ctor

@@ -598,6 +615,12 @@ void QgsVectorLayerProperties::apply()
}
layer->setTransparency( static_cast < unsigned int >( 255 - sliderTransparency->value() ) );

//apply overlay dialogs
for(QList<QgsApplyDialog*>::iterator it = mOverlayDialogs.begin(); it != mOverlayDialogs.end(); ++it)
{
(*it)->apply();
}

// update symbology
emit refreshLegend( layer->getLayerID(), false );

@@ -1026,3 +1049,30 @@ void QgsVectorLayerProperties::on_pbnSaveStyleAs_clicked()
myQSettings.setValue( "style/lastStyleDir", myFileDialog->directory().absolutePath() );
}
}

QList<QgsVectorOverlayPlugin*> QgsVectorLayerProperties::overlayPlugins() const
{
QList<QgsVectorOverlayPlugin*> pluginList;

QgisPlugin* thePlugin = 0;
QgsVectorOverlayPlugin* theOverlayPlugin = 0;

QList<QgsPluginMetadata*> pluginData = QgsPluginRegistry::instance()->pluginData();
for(QList<QgsPluginMetadata*>::iterator it = pluginData.begin(); it != pluginData.end(); ++it)
{
if(*it)
{
thePlugin = (*it)->plugin();
if(thePlugin && thePlugin->type() == QgisPlugin::VECTOR_OVERLAY)
{
theOverlayPlugin = dynamic_cast<QgsVectorOverlayPlugin*>(thePlugin);
if(theOverlayPlugin)
{
pluginList.push_back(theOverlayPlugin);
}
}
}
}

return pluginList;
}
@@ -30,8 +30,10 @@
class QgsMapLayer;

class QgsAttributeActionDialog;
class QgsApplyDialog;
class QgsLabelDialog;
class QgsVectorLayer;
class QgsVectorOverlayPlugin;

class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPropertiesBase
{
@@ -120,10 +122,15 @@ class QgsVectorLayerProperties : public QDialog, private Ui::QgsVectorLayerPrope
/**Actions dialog. If apply is pressed, the actions are stored for later use */
QgsAttributeActionDialog* actionDialog;

QList<QgsApplyDialog*> mOverlayDialogs;

void updateButtons();
void loadRows();
void setRow( int row, int idx, const QgsField &field );

/**Requests all overlay plugis from the plugin registry. Usefull for inserting their dialogs as new tabs*/
QList<QgsVectorOverlayPlugin*> overlayPlugins() const;

/**Buffer pixmap which takes the picture of renderers before they are assigned to the vector layer*/
//QPixmap bufferPixmap;
static const int context_id = 94000531;
@@ -7,6 +7,7 @@ SET(QGIS_CORE_SRCS
qgis.cpp
qgsapplication.cpp
qgsattributeaction.cpp
qgscentralpointpositionmanager.cpp
qgsclipper.cpp
qgscontexthelp.cpp
qgscoordinatetransform.cpp
@@ -25,6 +26,8 @@ SET(QGIS_CORE_SRCS
qgsmaprenderer.cpp
qgsmaptopixel.cpp
qgsmessageoutput.cpp
qgsoverlayobject.cpp
qgspalobjectpositionmanager.cpp
qgspoint.cpp
qgsproject.cpp
qgsprojectfiletransform.cpp
@@ -47,6 +50,7 @@ SET(QGIS_CORE_SRCS
qgsvectordataprovider.cpp
qgsvectorfilewriter.cpp
qgsvectorlayer.cpp
qgsvectoroverlay.cpp

composer/qgscomposeritem.cpp
composer/qgscomposeritemgroup.cpp
@@ -64,6 +68,21 @@ SET(QGIS_CORE_SRCS
composer/qgsticksscalebarstyle.cpp
composer/qgscomposition.cpp

pal/feature.cpp
pal/geomfunction.cpp
pal/label.cpp
pal/labelposition.cpp
pal/layer.cpp
pal/pal.cpp
pal/palstat.cpp
pal/pointset.cpp
pal/priorityqueue.cpp
pal/problem.cpp
pal/util.cpp
pal/linkedlist.hpp
pal/hashtable.hpp
pal/rtree.hpp

raster/qgscliptominmaxenhancement.cpp
raster/qgscolorrampshader.cpp
raster/qgscontrastenhancement.cpp
@@ -188,6 +207,7 @@ QT4_WRAP_CPP(QGIS_CORE_MOC_SRCS ${QGIS_CORE_MOC_HDRS})
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
composer
pal
raster
renderer
symbology
@@ -209,6 +229,13 @@ IF (WIN32)
ENDIF (MSVC)
ENDIF (WIN32)

#for PAL classes
IF (WIN32)
ADD_DEFINITIONS("-D_HAVE_WINDOWS_H_")
ELSE (WIN32)
ADD_DEFINITIONS("-D_HAVE_PTHREAD_")
ENDIF (WIN32)

#############################################################
# spatial indexing library

0 comments on commit 846a43c

Please sign in to comment.