Skip to content
Permalink
Browse files

-Contribution of the eVis plugin, version 1.1.0, to the QGIS project

-Documentation folks can find our original user guide at http://biodiversityinformatics.amnh.org/open_source/evis/documentation.php
-Any questions can be sent to ersts at amnh dot org and horning at amnh dot org

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10995 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
ersts
ersts committed Jul 1, 2009
1 parent 9eec5dd commit 038a12e4272381a5f173fc4a6ff32e0288f7f3eb
Showing with 5,926 additions and 1 deletion.
  1. +2 −1 src/plugins/CMakeLists.txt
  2. +97 −0 src/plugins/evis/CMakeLists.txt
  3. +17 −0 src/plugins/evis/README.TXT
  4. +220 −0 src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp
  5. +130 −0 src/plugins/evis/databaseconnection/evisdatabaseconnection.h
  6. +533 −0 src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp
  7. +90 −0 src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h
  8. +102 −0 src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.cpp
  9. +59 −0 src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.h
  10. +44 −0 src/plugins/evis/databaseconnection/evisquerydefinition.cpp
  11. +151 −0 src/plugins/evis/databaseconnection/evisquerydefinition.h
  12. +179 −0 src/plugins/evis/eventbrowser/evisconfiguration.cpp
  13. +88 −0 src/plugins/evis/eventbrowser/evisconfiguration.h
  14. +1,210 −0 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  15. +184 −0 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h
  16. +308 −0 src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp
  17. +146 −0 src/plugins/evis/eventbrowser/evisimagedisplaywidget.h
  18. +247 −0 src/plugins/evis/evis.cpp
  19. +134 −0 src/plugins/evis/evis.h
  20. +116 −0 src/plugins/evis/idtool/eviseventidtool.cpp
  21. +65 −0 src/plugins/evis/idtool/eviseventidtool.h
  22. BIN src/plugins/evis/resources/eVisDatabaseConnection.png
  23. BIN src/plugins/evis/resources/eVisEventBrowser.png
  24. BIN src/plugins/evis/resources/eVisEventIdTool.png
  25. BIN src/plugins/evis/resources/eVisHighlightSymbol.png
  26. BIN src/plugins/evis/resources/eVisPointerSymbol.png
  27. +9 −0 src/plugins/evis/resources/evis.qrc
  28. +511 −0 src/plugins/evis/ui/evisdatabaseconnectionguibase.ui
  29. +132 −0 src/plugins/evis/ui/evisdatabaselayerfieldselectionguibase.ui
  30. +1,152 −0 src/plugins/evis/ui/evisgenericeventbrowserguibase.ui
@@ -26,9 +26,10 @@ INSTALL(FILES qgisplugin.h qgsrendererplugin.h DESTINATION ${QGIS_INCLUDE_DIR})

SUBDIRS (quick_print)


SUBDIRS (coordinate_capture dxf2shp_converter)

SUBDIRS (ogr_converter)

SUBDIRS (diagram_overlay)

SUBDIRS (evis)
@@ -0,0 +1,97 @@
IF (WIN32)
IF (MSVC)
ADD_DEFINITIONS("-DGUI_EXPORT=__declspec(dllimport)")
ADD_DEFINITIONS("-DCORE_EXPORT=__declspec(dllimport)")
ELSE (MSVC)
ADD_DEFINITIONS("\"-DGUI_EXPORT=__declspec(dllimport)\"")
ADD_DEFINITIONS("\"-DCORE_EXPORT=__declspec(dllimport)\"")
ENDIF (MSVC)
ELSE (WIN32)
ADD_DEFINITIONS(-DGUI_EXPORT=)
ADD_DEFINITIONS(-DCORE_EXPORT=)
ENDIF (WIN32)

########################################################
# Files

SET (evis_SRCS
evis.cpp

databaseconnection/evisdatabaseconnectiongui.cpp
databaseconnection/evisdatabaseconnection.cpp
databaseconnection/evisdatabaselayerfieldselectiongui.cpp
databaseconnection/evisquerydefinition.cpp

eventbrowser/evisconfiguration.cpp
eventbrowser/evisgenericeventbrowsergui.cpp
eventbrowser/evisimagedisplaywidget.cpp

idtool/eviseventidtool.cpp

)

SET (evis_UIS
ui/evisdatabaseconnectionguibase.ui
ui/evisdatabaselayerfieldselectionguibase.ui
ui/evisgenericeventbrowserguibase.ui
)

SET (evis_MOC_HDRS
evis.h

databaseconnection/evisdatabaseconnectiongui.h
databaseconnection/evisdatabaselayerfieldselectiongui.h

eventbrowser/evisgenericeventbrowsergui.h
eventbrowser/evisimagedisplaywidget.h
)

SET (evis_RCCS resources/evis.qrc)

SET (QT_USE_QT3SUPPORT FALSE)
SET (QT_USE_QTGUI TRUE)
SET (QT_USE_QTSQL TRUE)
SET (QT_USE_QTSVG TRUE)
SET (QT_USE_QTXML TRUE)
SET (QT_USE_QTNETWORK TRUE)
FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE( ${QT_USE_FILE} )
########################################################
# Build

QT4_WRAP_UI (evis_UIS_H ${evis_UIS})

QT4_WRAP_CPP (evis_MOC_SRCS ${evis_MOC_HDRS})

QT4_ADD_RESOURCES(evis_RCC_SRCS ${evis_RCCS})

ADD_LIBRARY (evis MODULE ${evis_SRCS} ${evis_MOC_SRCS} ${evis_RCC_SRCS} ${evis_UIS_H})

INCLUDE_DIRECTORIES(
${GDAL_INCLUDE_DIR}
${GEOS_INCLUDE_DIR}
${QT_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/databaseconnection
${CMAKE_CURRENT_SOURCE_DIR}/eventbrowser
${CMAKE_CURRENT_SOURCE_DIR}/idtool
${CMAKE_CURRENT_SOURCE_DIR}/../../gui
${CMAKE_CURRENT_SOURCE_DIR}/../../core
${CMAKE_CURRENT_SOURCE_DIR}/../../core/raster
${CMAKE_CURRENT_SOURCE_DIR}/..
)

TARGET_LINK_LIBRARIES(evis
${QT_LIBRARIES}
qgis_core
qgis_gui
)


########################################################
# Install

INSTALL(TARGETS evis
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
@@ -0,0 +1,17 @@
eVis - The Event Visualization Tool

Lead Developer: Peter J. Ersts
Concept and original documentation: Ned Horning and Kevin Koy

This plugin was originally written and distributed by the Center for Biodiversity and Conservation's Biodiversity Informtics Facility at the American Museum of Natural History -
http://biodiversityinformatics.amnh.org/open_source/evis/
eVis was contributed to the QGIS project on 2009-07-01.

eVis was started in 2007 with QGIS v0.7.0. It was our first experience with QGIS and QT. Since its early beginings, the QGIS API has under gone many changes and advances, and as a result there are still some old ideas in this code and much room for improvement. Were we to start this plugin now, we would have done it quite differently! There is still much room for imporovement. We hope the QGIS community will find eVis useful and extend its capabilities to make it even more robust.



A special "thank you" is extended to the following people who have contributed translations, comments, bug reports, and patches which have helped to make eVis a better tool:
Tim Sutton, Magnus Homann, John Tull, Agustin Lobo, Donald Schrupp, Muslim Bandishoev, Anousak Souphavanh, Ha Quy Quynh, Roberto García-Yunta, Tom Gottfried

This work was made possible through a grant by the the John D. and Catherine T. MacArthur Foundation. Additionally, these products were prepared by the American Museum of Natural History under award No. NA05SEC46391002 from the National Oceanic and Atmospheric Administration, U.S. Department of Commerce. The statements, findings, conclusions, and recommendations are those of the author(s) and do not necessarily reflect the views of the National Oceanic and Atmospheric Administration or the Department of Commerce.
@@ -0,0 +1,220 @@
/*
** File: evisdatabaseconnection.cpp
** Author: Peter J. Ersts ( ersts at amnh.org )
** Creation Date: 2007-03-07
**
** Copyright ( c ) 2007, American Museum of Natural History. All rights reserved.
**
** This library/program is free software; you can redistribute it
** and/or modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or ( at your option ) any later version.
**
** This library/program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Library General Public License for more details.
**
** This work was made possible through a grant by the the John D. and
** Catherine T. MacArthur Foundation. Additionally, this program was prepared by
** the American Museum of Natural History under award No. NA05SEC46391002
** from the National Oceanic and Atmospheric Administration, U.S. Department
** of Commerce. The statements, findings, conclusions, and recommendations
** are those of the author( s ) and do not necessarily reflect the views of the
** National Oceanic and Atmospheric Administration or the Department of Commerce.
**
**/
/* $Id: $ */
#include "evisdatabaseconnection.h"

#include <QStringList>

/**
* Constructor
* @param hostname - Host name of the database server
* @param port - The port number the database server is listening to
* @param databasename - The name of the database to connect to
* @param username - The username needed to access the database or database server
* @param password - The password associate witht he username needed to access the database or database server
* @param type - The type of database being connected to
*/
eVisDatabaseConnection::eVisDatabaseConnection( QString hostname, int port, QString databasename, QString username, QString password, DATABASE_TYPE type )
{
mHostName = hostname;
mPort = port;
mDatabaseName = databasename;
mUsername = username;
mPassword = password;
setDatabaseType( type );
mQuery.setForwardOnly( true );
}

/**
* Public method called to finalize a connection to a database
*/
bool eVisDatabaseConnection::connect( )
{
//If a database is currnently open close the connection
if( !mDatabase.isOpen( ) )
{
mDatabase.close( );
}

//Add the correct database to the list of database connections, Reuse a connection if the connection exists in the list already.
if( MSACCESS == databaseType( ) && !mDatabase.contains( "odbc" ) )
{
mDatabase = QSqlDatabase::addDatabase( "QODBC", "odbc" );
}
else if ( MSACCESS == databaseType( ) )
{
mDatabase = QSqlDatabase::database( "odbc" );
}
else if( QMYSQL == databaseType( ) && !mDatabase.contains( "mysql" ) )
{
mDatabase = QSqlDatabase::addDatabase( "QMYSQL", "mysql" );
}
else if ( QMYSQL == databaseType( ) )
{
mDatabase = QSqlDatabase::database( "mysql" );
}
else if( QODBC == databaseType( ) && !mDatabase.contains( "odbc" ) )
{
mDatabase = QSqlDatabase::addDatabase( "QODBC", "odbc" );
}
else if ( QODBC == databaseType( ) )
{
mDatabase = QSqlDatabase::database( "odbc" );
}
else if( QPSQL == databaseType( ) && !mDatabase.contains( "postgres" ) )
{
mDatabase = QSqlDatabase::addDatabase( "QPSQL", "postgres" );
}
else if( QPSQL == databaseType( ) )
{
mDatabase = QSqlDatabase::database( "postgres" );
}
else if( QSQLITE == databaseType( ) && !mDatabase.contains( "sqlite" ) )
{
mDatabase = QSqlDatabase::addDatabase( "QSQLITE", "sqlite" );
}
else if ( QSQLITE == databaseType( ) )
{
mDatabase = QSqlDatabase::database( "sqlite" );
}
else
{
setLastError( "No matching DATABASE_TYPE found" );
return false;
}

//Do a little extra validation of connection information
if( mHostName.isEmpty( ) && ( QMYSQL == databaseType( ) || QPSQL == databaseType( ) ) )
{
setLastError( "Host name was empty" );
return false;
}
else if( !mHostName.isEmpty( ) )
{
mDatabase.setHostName( mHostName );
}

if( mPort != 0 )
{
mDatabase.setPort( mPort );
}

if( mDatabaseName.isEmpty( ) )
{
setLastError( "Database name was empty" );
return false;
}
else if( MSACCESS == databaseType( ) )
{
mDatabase.setDatabaseName( "DRIVER = {Microsoft Access Driver ( *.mdb )};FIL = {MS Access};DBQ = "+mDatabaseName );
}
else
{
mDatabase.setDatabaseName( mDatabaseName );
}

if( !mUsername.isEmpty( ) )
{
mDatabase.setUserName( mUsername );
}

if( !mPassword.isEmpty( ) )
{
mDatabase.setPassword( mPassword );
}

//Try to actually open the database
if( !mDatabase.open( ) )
{
setLastError( mDatabase.lastError( ).text( ) );
return false;
}

return true;
}

/**
* Executes a query on the current active database connection
* @param sqlStatement - QString containing the sql statement to execute
*/
QSqlQuery* eVisDatabaseConnection::query( QString sqlStatement )
{
if( mDatabase.isOpen( ) )
{
//mQuery = QSqlQuery( sqlStatement, mDatabase ); //NOTE: A little against convention, the constructor also executes the query

//set forward only is required for OBDC on linux
mQuery = QSqlQuery( mDatabase );
mQuery.setForwardOnly( true );
mQuery.exec( sqlStatement );
if( mQuery.isActive( ) )
{
return &mQuery;
}
else
{
setLastError( mQuery.lastError( ).text( ) );
return 0;
}
}

setLastError( "Database connection was not open." );
return 0;
}

/**
* Reset the connection parameters
* @param hostname - Host name of the database server
* @param port - The port number the database server is listening to
* @param databasename - The name of the database to connect to
* @param username - The username needed to access the database or database server
* @param password - The password associate witht he username needed to access the database or database server
* @param type - The type of database being connected to
*/
void eVisDatabaseConnection::resetConnectionParameters( QString hostname, int port, QString databasename, QString username, QString password, DATABASE_TYPE type )
{
mHostName = hostname;
mPort = port;
mDatabaseName = databasename;
mUsername = username;
mPassword = password;
setDatabaseType( type );
}

/**
* Returns a list of tables for the current active database connection
*/
QStringList eVisDatabaseConnection::tables( )
{
if( mDatabase.isOpen( ) )
{
return mDatabase.tables( );
}

setLastError( "Database connection was not open." );
return QStringList( );
}

0 comments on commit 038a12e

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