Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE]: Add point displacement renderer plugin
git-svn-id: http://svn.osgeo.org/qgis/trunk@13139 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
mhugent
committed
Mar 21, 2010
1 parent
00bdcdc
commit 7b578ed
Showing
9 changed files
with
1,501 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
######################################################## | ||
# Files | ||
|
||
SET (POINT_DISPLACEMENT_SRCS | ||
qgsdisplacementplugin.cpp | ||
qgspointdisplacementrenderer.cpp | ||
qgspointdisplacementrendererwidget.cpp | ||
) | ||
|
||
SET (POINT_DISPLACEMENT_UIS | ||
qgspointdisplacementrendererwidgetbase.ui | ||
) | ||
|
||
SET (POINT_DISPLACEMENT_MOC_HDRS | ||
qgspointdisplacementrendererwidget.h | ||
) | ||
|
||
######################################################## | ||
# Build | ||
|
||
QT4_WRAP_UI (POINT_DISPLACEMENT_UIS_H ${POINT_DISPLACEMENT_UIS}) | ||
|
||
QT4_WRAP_CPP (POINT_DISPLACEMENT_MOC_SRCS ${POINT_DISPLACEMENT_MOC_HDRS}) | ||
|
||
ADD_LIBRARY (displacementplugin MODULE | ||
${POINT_DISPLACEMENT_SRCS} | ||
${POINT_DISPLACEMENT_UIS_H} | ||
${POINT_DISPLACEMENT_MOC_SRCS} | ||
) | ||
|
||
INCLUDE_DIRECTORIES( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR}/../../ui | ||
../../core | ||
../../core/symbology-ng | ||
../../core/spatialindex | ||
../../gui | ||
../../gui/symbology-ng | ||
.. | ||
. | ||
) | ||
|
||
TARGET_LINK_LIBRARIES(displacementplugin | ||
qgis_core | ||
qgis_gui | ||
) | ||
|
||
|
||
######################################################## | ||
# Install | ||
|
||
INSTALL(TARGETS displacementplugin | ||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR} | ||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR} | ||
) |
86 changes: 86 additions & 0 deletions
86
src/plugins/point_displacement_renderer/qgsdisplacementplugin.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/*************************************************************************** | ||
qgsdisplacementplugin.cpp | ||
------------------------- | ||
begin : January 26, 2010 | ||
copyright : (C) 2010 by Marco Hugentobler | ||
email : marco at hugis dot net | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsdisplacementplugin.h" | ||
#include "qgisinterface.h" | ||
#include "qgspointdisplacementrenderer.h" | ||
#include "qgspointdisplacementrendererwidget.h" | ||
#include "qgsrendererv2registry.h" | ||
#include "qgssymbollayerv2registry.h" | ||
#include <QObject> | ||
|
||
static const QString name_ = QObject::tr( "Displacement plugin" ); | ||
static const QString description_ = QObject::tr( "Adds a new renderer that automatically handles point displacement in case they have the same position" ); | ||
static const QString version_ = QObject::tr( "Version 0.1" ); | ||
|
||
QgsDisplacementPlugin::QgsDisplacementPlugin( QgisInterface* iface ): mIface( iface ) | ||
{ | ||
|
||
} | ||
|
||
QgsDisplacementPlugin::~QgsDisplacementPlugin() | ||
{ | ||
|
||
} | ||
|
||
void QgsDisplacementPlugin::initGui() | ||
{ | ||
//Add new renderer to the registry | ||
|
||
QgsRendererV2Registry::instance()->addRenderer( new QgsRendererV2Metadata( "pointDisplacement", | ||
QObject::tr( "point Displacement" ), | ||
QgsPointDisplacementRenderer::create, QIcon(), | ||
QgsPointDisplacementRendererWidget::create ) ); | ||
} | ||
|
||
void QgsDisplacementPlugin::unload() | ||
{ | ||
//Remove renderer type from the registry | ||
QgsRendererV2Registry::instance()->removeRenderer( "pointDisplacement" ); | ||
} | ||
|
||
QGISEXTERN QgisPlugin * classFactory( QgisInterface * theQgisInterfacePointer ) | ||
{ | ||
return new QgsDisplacementPlugin( theQgisInterfacePointer ); | ||
} | ||
|
||
QGISEXTERN QString name() | ||
{ | ||
return name_; | ||
} | ||
|
||
QGISEXTERN QString description() | ||
{ | ||
return description_; | ||
} | ||
|
||
QGISEXTERN QString version() | ||
{ | ||
return version_; | ||
} | ||
|
||
QGISEXTERN int type() | ||
{ | ||
return QgisPlugin::UI; | ||
} | ||
|
||
QGISEXTERN void unload( QgisPlugin* thePluginPointer ) | ||
{ | ||
delete thePluginPointer; | ||
} | ||
|
||
|
40 changes: 40 additions & 0 deletions
40
src/plugins/point_displacement_renderer/qgsdisplacementplugin.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/*************************************************************************** | ||
qgsdisplacementplugin.h | ||
----------------------- | ||
begin : January 26, 2010 | ||
copyright : (C) 2010 by Marco Hugentobler | ||
email : marco at hugis dot net | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSDISPLACEMENTPLUGIN_H | ||
#define QGSDISPLACEMENTPLUGIN_H | ||
|
||
#include "qgisplugin.h" | ||
|
||
class QgisInterface; | ||
|
||
/**A plugin that adds a point displacement renderer to the symbol registry*/ | ||
class QgsDisplacementPlugin: public QgisPlugin | ||
{ | ||
public: | ||
QgsDisplacementPlugin( QgisInterface* iface ); | ||
~QgsDisplacementPlugin(); | ||
/**Adds renderer to the registry*/ | ||
void initGui(); | ||
/**Removes renderer from the registry*/ | ||
void unload(); | ||
|
||
private: | ||
QgisInterface* mIface; | ||
}; | ||
|
||
#endif // QGSDISPLACEMENTPLUGIN_H |
Oops, something went wrong.