diff --git a/debian/qgis.install b/debian/qgis.install index 0d78bacb98e7..a76a5b0797c7 100644 --- a/debian/qgis.install +++ b/debian/qgis.install @@ -1,5 +1,4 @@ usr/lib/qgis/plugins/libcoordinatecaptureplugin.so -usr/lib/qgis/plugins/libevis.so usr/lib/qgis/plugins/libgeometrycheckerplugin.so usr/lib/qgis/plugins/libgeorefplugin.so usr/lib/qgis/plugins/libgpsimporterplugin.so diff --git a/ms-windows/osgeo4w/package.cmd b/ms-windows/osgeo4w/package.cmd index 68607f07052c..ba8cfe8f34e7 100644 --- a/ms-windows/osgeo4w/package.cmd +++ b/ms-windows/osgeo4w/package.cmd @@ -379,7 +379,6 @@ if not exist %ARCH%\release\qgis\%PACKAGENAME% mkdir %ARCH%\release\qgis\%PACKAG "apps/%PACKAGENAME%/icons/" ^ "apps/%PACKAGENAME%/images/" ^ "apps/%PACKAGENAME%/plugins/coordinatecaptureplugin.dll" ^ - "apps/%PACKAGENAME%/plugins/evis.dll" ^ "apps/%PACKAGENAME%/plugins/georefplugin.dll" ^ "apps/%PACKAGENAME%/plugins/gpsimporterplugin.dll" ^ "apps/%PACKAGENAME%/plugins/offlineeditingplugin.dll" ^ diff --git a/ms-windows/plugins.nsh b/ms-windows/plugins.nsh index e470c0a2a790..7ee91c2c1bc6 100644 --- a/ms-windows/plugins.nsh +++ b/ms-windows/plugins.nsh @@ -9,7 +9,6 @@ WriteRegStr HKEY_CURRENT_USER "Software\QGIS\QGIS3\Plugins" "coordinatecaptureplugin" "true" WriteRegStr HKEY_CURRENT_USER "Software\QGIS\QGIS3\Plugins" "diagramoverlay" "true" -WriteRegStr HKEY_CURRENT_USER "Software\QGIS\QGIS3\Plugins" "evis" "true" WriteRegStr HKEY_CURRENT_USER "Software\QGIS\QGIS3\Plugins" "georefplugin" "true" WriteRegStr HKEY_CURRENT_USER "Software\QGIS\QGIS3\Plugins" "globeplugin" "false" WriteRegStr HKEY_CURRENT_USER "Software\QGIS\QGIS3\Plugins" "gpsimporterplugin" "true" diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 31925f77620f..491b4c5ec971 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -7,7 +7,6 @@ SET (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDI SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_PLUGIN_SUBDIR}) ADD_SUBDIRECTORY(coordinate_capture) -ADD_SUBDIRECTORY(evis) ADD_SUBDIRECTORY(gps_importer) ADD_SUBDIRECTORY(topology) ADD_SUBDIRECTORY(offline_editing) diff --git a/src/plugins/evis/CMakeLists.txt b/src/plugins/evis/CMakeLists.txt deleted file mode 100644 index f4b54e0a85e2..000000000000 --- a/src/plugins/evis/CMakeLists.txt +++ /dev/null @@ -1,74 +0,0 @@ -######################################################## -# 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_RCCS resources/evis.qrc) - -######################################################## -# Build - -QT5_WRAP_UI (evis_UIS_H ${evis_UIS}) - -ADD_LIBRARY (evis MODULE ${evis_SRCS} ${evis_RCCS} ${evis_UIS_H}) - -INCLUDE_DIRECTORIES(SYSTEM - ${GDAL_INCLUDE_DIR} - ${QT_INCLUDE_DIR} -) -INCLUDE_DIRECTORIES( - ${CMAKE_CURRENT_SOURCE_DIR}/databaseconnection - ${CMAKE_CURRENT_SOURCE_DIR}/eventbrowser - ${CMAKE_CURRENT_SOURCE_DIR}/idtool - - ${CMAKE_SOURCE_DIR}/src/gui - ${CMAKE_SOURCE_DIR}/src/core - ${CMAKE_SOURCE_DIR}/src/core/expression - ${CMAKE_SOURCE_DIR}/src/core/geometry - ${CMAKE_SOURCE_DIR}/src/core/labeling - ${CMAKE_SOURCE_DIR}/src/core/layertree - ${CMAKE_SOURCE_DIR}/src/core/metadata - ${CMAKE_SOURCE_DIR}/src/core/raster - ${CMAKE_SOURCE_DIR}/src/core/symbology - ${CMAKE_SOURCE_DIR}/src/plugins - ${CMAKE_SOURCE_DIR}/external - ${CMAKE_SOURCE_DIR}/external/nlohmann - - ${CMAKE_BINARY_DIR}/src/core - ${CMAKE_BINARY_DIR}/src/gui - ${CMAKE_CURRENT_BINARY_DIR} -) - -TARGET_LINK_LIBRARIES(evis - qgis_core - qgis_gui - ${Qt5Sql_LIBRARIES} -) - - -######################################################## -# Install - -INSTALL(TARGETS evis - RUNTIME DESTINATION ${QGIS_PLUGIN_DIR} - LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}) diff --git a/src/plugins/evis/README.TXT b/src/plugins/evis/README.TXT deleted file mode 100644 index a7852e156965..000000000000 --- a/src/plugins/evis/README.TXT +++ /dev/null @@ -1,17 +0,0 @@ -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 beginnings, 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 improvement. 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 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. diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp b/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp deleted file mode 100644 index 570a1c78ca4f..000000000000 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnection.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/* -** 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 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. -** -**/ -#include "evisdatabaseconnection.h" - -#include - -/** -* 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 with the username needed to access the database or database server -* \param type - The type of database being connected to -*/ -eVisDatabaseConnection::eVisDatabaseConnection( const QString &hostname, int port, const QString &databasename, const QString &username, const QString &password, DatabaseType 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( QStringLiteral( "odbc" ) ) ) - { - mDatabase = QSqlDatabase::addDatabase( QStringLiteral( "QODBC" ), QStringLiteral( "odbc" ) ); - } - else if ( MSAccess == databaseType() ) - { - mDatabase = QSqlDatabase::database( QStringLiteral( "odbc" ) ); - } - else if ( QMySQL == databaseType() && !mDatabase.contains( QStringLiteral( "mysql" ) ) ) - { - mDatabase = QSqlDatabase::addDatabase( QStringLiteral( "QMYSQL" ), QStringLiteral( "mysql" ) ); - } - else if ( QMySQL == databaseType() ) - { - mDatabase = QSqlDatabase::database( QStringLiteral( "mysql" ) ); - } - else if ( QODBC == databaseType() && !mDatabase.contains( QStringLiteral( "odbc" ) ) ) - { - mDatabase = QSqlDatabase::addDatabase( QStringLiteral( "QODBC" ), QStringLiteral( "odbc" ) ); - } - else if ( QODBC == databaseType() ) - { - mDatabase = QSqlDatabase::database( QStringLiteral( "odbc" ) ); - } - else if ( QPSQL == databaseType() && !mDatabase.contains( QStringLiteral( "postgres" ) ) ) - { - mDatabase = QSqlDatabase::addDatabase( QStringLiteral( "QPSQL" ), QStringLiteral( "postgres" ) ); - } - else if ( QPSQL == databaseType() ) - { - mDatabase = QSqlDatabase::database( QStringLiteral( "postgres" ) ); - } - else if ( QSqlite == databaseType() && !mDatabase.contains( QStringLiteral( "sqlite" ) ) ) - { - mDatabase = QSqlDatabase::addDatabase( QStringLiteral( "QSQLITE" ), QStringLiteral( "sqlite" ) ); - } - else if ( QSqlite == databaseType() ) - { - mDatabase = QSqlDatabase::database( QStringLiteral( "sqlite" ) ); - } - else - { - setLastError( QStringLiteral( "No matching DATABASE_TYPE found" ) ); - return false; - } - - //Do a little extra validation of connection information - if ( mHostName.isEmpty() && ( QMySQL == databaseType() || QPSQL == databaseType() ) ) - { - setLastError( QStringLiteral( "Host name was empty" ) ); - return false; - } - else if ( !mHostName.isEmpty() ) - { - mDatabase.setHostName( mHostName ); - } - - if ( mPort != 0 ) - { - mDatabase.setPort( mPort ); - } - - if ( mDatabaseName.isEmpty() ) - { - setLastError( QStringLiteral( "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( const 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 ); - bool execOk = mQuery.exec( sqlStatement ); - if ( execOk && mQuery.isActive() ) - { - return &mQuery; - } - else - { - setLastError( mQuery.lastError().text() ); - return nullptr; - } - } - - setLastError( QStringLiteral( "Database connection was not open." ) ); - return nullptr; -} - -/** -* 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 with the username needed to access the database or database server -* \param type - The type of database being connected to -*/ -void eVisDatabaseConnection::resetConnectionParameters( const QString &hostname, int port, const QString &databasename, const QString &username, const QString &password, DatabaseType 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( QStringLiteral( "Database connection was not open." ) ); - return QStringList(); -} diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnection.h b/src/plugins/evis/databaseconnection/evisdatabaseconnection.h deleted file mode 100644 index aa07e70576d0..000000000000 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnection.h +++ /dev/null @@ -1,127 +0,0 @@ -/* -** File: evisdatabaseconnection.h -** 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 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. -** -**/ -#ifndef EVISDATABASECONNECTION_H -#define EVISDATABASECONNECTION_H - -#include -#include -#include -#include - -/** -* \class eVisDatabaseConnection -* \brief A class that provides the ability to connect to a variety of database types -* This class provides the ability to connect to a variety of database types -*/ -class eVisDatabaseConnection -{ - - public: - - //! \brief Enum containing the type of database supported by this class - enum DatabaseType - { - Undefined, - MSAccess, - QMySQL, - QPSQL, - QODBC, - QSqlite - } mDatabaseType; - - //! \brief Constructor - eVisDatabaseConnection( const QString &, int, const QString &, const QString &, const QString &, DatabaseType ); - - //! \brief Public method that finalizes a connection to a database - bool connect(); - - //! \brief Public method that passes an SQL statement to the database for execution - QSqlQuery *query( const QString & ); - - //! \brief Public method for resetting the database connection parameters - equivalent to re running the constructor - void resetConnectionParameters( const QString &, int, const QString &, const QString &, const QString &, DatabaseType ); - - //! \brief Returns a list of tables in the current database - QStringList tables(); - - //! \brief Accessor to the database type - DatabaseType databaseType() - { - return mDatabaseType; - } - - //! \brief Public method for closing the current database connection - void close() - { - mDatabase.close(); - } - - //! \brief Public method for requesting the last error reported by the database connect or query - QString lastError() - { - return mLastError; - } - - //! \brief Mutator for database type - void setDatabaseType( DatabaseType connectionType ) - { - mDatabaseType = connectionType; - } - - protected: - //! \brief Variable used to store the query results - QSqlQuery mQuery; - - private: - //! \brief Host name for the database server - QString mHostName; - - //! \brief Port number the database server is listenting to - int mPort; - - //! \brief Database name, can also be a filename in the case of SQLite or MSAccess - QString mDatabaseName; - - //! \brief Username for accessing the database - QString mUsername; - - //! \brief Password associated with the username for accessing the database - QString mPassword; - - //! \brief QString containing the last reported error message - QString mLastError; - - //! \brief The database object - QSqlDatabase mDatabase; - - //! Sets the error messages - void setLastError( const QString &error ) - { - mLastError = error; - } -}; -#endif diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp b/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp deleted file mode 100644 index b7b3ca07ee33..000000000000 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.cpp +++ /dev/null @@ -1,544 +0,0 @@ -/* -** File: evisdatabaseconnectiongui.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 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. -** -**/ -#include "evisdatabaseconnectiongui.h" - -#include "qgsapplication.h" -#include "qgsgui.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** -* Constructor -* \param parent - Pointer the to parent QWidget for modality -* \param fl - Windown flags -*/ -eVisDatabaseConnectionGui::eVisDatabaseConnectionGui( QList *temporaryFileList, QWidget *parent, Qt::WindowFlags fl ) - : QDialog( parent, fl ) -{ - setupUi( this ); - QgsGui::instance()->enableAutoGeometryRestore( this ); - - connect( buttonBox, &QDialogButtonBox::accepted, this, &eVisDatabaseConnectionGui::buttonBox_accepted ); - connect( cboxDatabaseType, static_cast( &QComboBox::currentIndexChanged ), this, &eVisDatabaseConnectionGui::cboxDatabaseType_currentIndexChanged ); - connect( cboxPredefinedQueryList, static_cast( &QComboBox::currentIndexChanged ), this, &eVisDatabaseConnectionGui::cboxPredefinedQueryList_currentIndexChanged ); - connect( pbtnConnect, &QPushButton::clicked, this, &eVisDatabaseConnectionGui::pbtnConnect_clicked ); - connect( pbtnLoadPredefinedQueries, &QPushButton::clicked, this, &eVisDatabaseConnectionGui::pbtnLoadPredefinedQueries_clicked ); - connect( pbtnOpenFile, &QPushButton::clicked, this, &eVisDatabaseConnectionGui::pbtnOpenFile_clicked ); - connect( pbtnRunQuery, &QPushButton::clicked, this, &eVisDatabaseConnectionGui::pbtnRunQuery_clicked ); - connect( buttonBox, &QDialogButtonBox::helpRequested, this, &eVisDatabaseConnectionGui::showHelp ); - - mTempOutputFileList = temporaryFileList; - - //Initialize variables - mQueryDefinitionMap = new QMap; - mDatabaseConnection = nullptr; - - //Create a new instance of the file selector - mDatabaseLayerFieldSelector = new eVisDatabaseLayerFieldSelectionGui( this, fl ); - connect( mDatabaseLayerFieldSelector, &eVisDatabaseLayerFieldSelectionGui::eVisDatabaseLayerFieldsSelected, this, &eVisDatabaseConnectionGui::drawNewVectorLayer ); - - //Populate gui components -#ifdef Q_OS_WIN - cboxDatabaseType->insertItem( 0, "MSAccess" ); -#endif - cboxDatabaseType->insertItem( 0, QStringLiteral( "MYSQL" ) ); - cboxDatabaseType->insertItem( 0, QStringLiteral( "ODBC" ) ); - cboxDatabaseType->insertItem( 0, QStringLiteral( "PostGreSQL" ) ); - cboxDatabaseType->insertItem( 0, QStringLiteral( "SQLITE" ) ); - cboxDatabaseType->insertItem( 0, tr( "Undefined" ) ); - cboxDatabaseType->setCurrentIndex( 0 ); - cboxPredefinedQueryList->insertItem( 0, tr( "No predefined queries loaded" ) ); - - //set icons - pbtnOpenFile->setIcon( QIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFolder.svg" ) ) ) ); - pbtnOpenFile->setToolTip( tr( "Open File" ) ); - pbtnLoadPredefinedQueries->setIcon( QIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionFolder.svg" ) ) ) ); - pbtnLoadPredefinedQueries->setToolTip( tr( "Open File" ) ); -} - -/* - * - * Public and Private Slots - * - */ - -/** -* Slot called after the user selects the x, y fields in the field selection gui component -* \param layerName - Name to display in the legend -* \param xCoordinate - Name of the field containing the x coordinate -* \param yCoordinate - Name of the field containing the y coordinate -*/ -void eVisDatabaseConnectionGui::drawNewVectorLayer( const QString &layerName, const QString &xCoordinate, const QString &yCoordinate ) -{ - //if coorindate fields are defined, load as a delimited text layer - if ( !xCoordinate.isEmpty() && !yCoordinate.isEmpty() && !mTempOutputFileList->isEmpty() ) - { - //fileName is only available if the file is open - //the last file in the list is always the newest - mTempOutputFileList->last()->open(); - QUrl url = QUrl::fromLocalFile( mTempOutputFileList->last()->fileName() ); - QUrlQuery query; - query.addQueryItem( QStringLiteral( "delimiter" ), QStringLiteral( "\t" ) ); - query.addQueryItem( QStringLiteral( "delimiterType" ), QStringLiteral( "regexp" ) ); - query.addQueryItem( QStringLiteral( "xField" ), xCoordinate ); - query.addQueryItem( QStringLiteral( "yField" ), yCoordinate ); - url.setQuery( query ); - emit drawVectorLayer( QString::fromLatin1( url.toEncoded() ), layerName, QStringLiteral( "delimitedtext" ) ); - mTempOutputFileList->last()->close(); - } -} - -/** -* Slot called when the accept button is pressed -*/ -void eVisDatabaseConnectionGui::buttonBox_accepted() -{ - //Deallocate memory, basically a predescructor - if ( mDatabaseConnection ) - { - mDatabaseConnection->close(); - delete ( mDatabaseConnection ); - } - - if ( mDatabaseLayerFieldSelector ) - { - delete ( mDatabaseLayerFieldSelector ); - } - - if ( mQueryDefinitionMap ) - { - mQueryDefinitionMap->clear(); - delete mQueryDefinitionMap; - } - - accept(); -} - -/** -* Slot called when the cboxDatabaseType combo box index changes -* \param currentIndex - The new index of the currently selected field -*/ -void eVisDatabaseConnectionGui::cboxDatabaseType_currentIndexChanged( int currentIndex ) -{ - Q_UNUSED( currentIndex ) - if ( cboxDatabaseType->currentText() == QLatin1String( "MYSQL" ) ) - { - lblDatabaseHost->setEnabled( true ); - leDatabaseHost->setEnabled( true ); - lblDatabasePort->setEnabled( true ); - leDatabasePort->setText( QStringLiteral( "3306" ) ); - leDatabasePort->setEnabled( true ); - pbtnOpenFile->setEnabled( false ); - lblDatabaseUsername->setEnabled( true ); - leDatabaseUsername->setEnabled( true ); - lblDatabasePassword->setEnabled( true ); - leDatabasePassword->setEnabled( true ); - leDatabaseName->clear(); - } - else if ( cboxDatabaseType->currentText() == QLatin1String( "PostGreSQL" ) ) - { - lblDatabaseHost->setEnabled( true ); - leDatabaseHost->setEnabled( true ); - lblDatabasePort->setEnabled( true ); - leDatabasePort->setText( QStringLiteral( "5432" ) ); - leDatabasePort->setEnabled( true ); - pbtnOpenFile->setEnabled( false ); - lblDatabaseUsername->setEnabled( true ); - leDatabaseUsername->setEnabled( true ); - lblDatabasePassword->setEnabled( true ); - leDatabasePassword->setEnabled( true ); - leDatabaseName->clear(); - } - else if ( cboxDatabaseType->currentText() == QLatin1String( "SQLITE" ) || cboxDatabaseType->currentText() == QLatin1String( "MSAccess" ) ) - { - lblDatabaseHost->setEnabled( false ); - leDatabaseHost->clear(); - leDatabaseHost->setEnabled( false ); - lblDatabasePort->setEnabled( false ); - leDatabasePort->clear(); - leDatabasePort->setEnabled( false ); - pbtnOpenFile->setEnabled( true ); - lblDatabaseUsername->setEnabled( false ); - leDatabaseUsername->clear(); - leDatabaseUsername->setEnabled( false ); - lblDatabasePassword->setEnabled( false ); - leDatabasePassword->clear(); - leDatabasePassword->setEnabled( false ); - leDatabaseName->clear(); - } - else - { - lblDatabaseHost->setEnabled( true ); - leDatabaseHost->setEnabled( true ); - lblDatabasePort->setEnabled( false ); - leDatabasePort->clear(); - leDatabasePort->setEnabled( false ); - pbtnOpenFile->setEnabled( false ); - lblDatabaseUsername->setEnabled( true ); - leDatabaseUsername->setEnabled( true ); - lblDatabasePassword->setEnabled( true ); - leDatabasePassword->setEnabled( true ); - leDatabaseName->clear(); - } -} - -/** -* Slot called when pbtnConnect button pressed. This function does some basic error checking before -* requesting a new database connection -*/ -void eVisDatabaseConnectionGui::pbtnConnect_clicked() -{ - teditConsole->append( tr( "New Database connection requested…" ) ); - bool errors = false; - - if ( cboxDatabaseType->currentText() == tr( "Undefined" ) ) - { - teditConsole->append( tr( "Error: You must select a database type" ) ); - errors = true; - } - - if ( !errors && ( cboxDatabaseType->currentText() == QLatin1String( "MYSQL" ) || cboxDatabaseType->currentText() == QLatin1String( "PostGreSQL" ) ) ) - { - if ( leDatabaseHost->text().isEmpty() ) - { - teditConsole->append( tr( "Error: No host name entered" ) ); - errors = true; - } - } - - if ( !errors && leDatabaseName->text().isEmpty() ) - { - teditConsole->append( tr( "Error: No database name entered" ) ); - errors = true; - } - - //If no errors thus far, request a new database connection - if ( !errors ) - { - eVisDatabaseConnection::DatabaseType myDatabaseType; - if ( cboxDatabaseType->currentText() == QLatin1String( "MSAccess" ) ) - { - myDatabaseType = eVisDatabaseConnection::MSAccess; - } - else if ( cboxDatabaseType->currentText() == QLatin1String( "MYSQL" ) ) - { - myDatabaseType = eVisDatabaseConnection::QMySQL; - } - else if ( cboxDatabaseType->currentText() == QLatin1String( "ODBC" ) ) - { - myDatabaseType = eVisDatabaseConnection::QODBC; - } - else if ( cboxDatabaseType->currentText() == QLatin1String( "PostGreSQL" ) ) - { - myDatabaseType = eVisDatabaseConnection::QPSQL; - } - else - { - myDatabaseType = eVisDatabaseConnection::QSqlite; - } - - //If there is already a database connection object, reset with the current parameters - if ( mDatabaseConnection ) - { - mDatabaseConnection->resetConnectionParameters( leDatabaseHost->text(), leDatabasePort->text().toInt(), leDatabaseName->text(), leDatabaseUsername->text(), leDatabasePassword->text(), myDatabaseType ); - } - else //create a new database connection object - { - mDatabaseConnection = new eVisDatabaseConnection( leDatabaseHost->text(), leDatabasePort->text().toInt(), leDatabaseName->text(), leDatabaseUsername->text(), leDatabasePassword->text(), myDatabaseType ); - } - - //Try to connect the database connection object - if ( mDatabaseConnection->connect() ) - { - teditConsole->append( tr( "Connection to [%1.%2] established" ).arg( leDatabaseHost->text(), leDatabaseName->text() ) ); - lblConnectionStatus->setText( tr( "connected" ) ); - - //List the tables in the database - teditConsole->append( tr( "Tables" ) + ':' ); - QStringList myTableList = mDatabaseConnection->tables(); - for ( int myIterator = 0; myIterator < myTableList.size(); myIterator++ ) - { - teditConsole->append( "->" + myTableList[myIterator] ); - } - } - else - { - teditConsole->append( tr( "Connection to [%1.%2] failed: %3" ) - .arg( leDatabaseHost->text(), leDatabaseName->text(), mDatabaseConnection->lastError() ) ); - } - } -} - -/** -* Slot called when pbtnLoadPredefinedQueries button is pressed. The method will open a file dialog and then -* try to parse through an XML file of predefined queries. -*/ -void eVisDatabaseConnectionGui::pbtnLoadPredefinedQueries_clicked() -{ - //There probably needs to be some more error checking, but works for now. - - //Select the XML file to parse - QString myFilename = QFileDialog::getOpenFileName( this, tr( "Open File" ), QDir::homePath(), QStringLiteral( "XML ( *.xml )" ) ); - if ( !myFilename.isEmpty() ) - { - //Display the name of the file being parsed - lblPredefinedQueryFilename->setText( myFilename ); - - //If the file exists load it into a QDomDocument - QFile myInputFile( myFilename ); - if ( myInputFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) - { - QString errorString; - int errorLine; - int errorColumn; - QDomDocument myXmlDoc; - if ( myXmlDoc.setContent( &myInputFile, &errorString, &errorLine, &errorColumn ) ) - { - //clear any existing query descrptions - cboxPredefinedQueryList->clear(); - if ( !mQueryDefinitionMap->empty() ) - { - delete ( mQueryDefinitionMap ); - mQueryDefinitionMap = new QMap; - } - - //Loop through each child looking for a query tag - int myQueryCount = 0; - QDomNode myNode = myXmlDoc.documentElement().firstChild(); - while ( !myNode.isNull() ) - { - if ( myNode.toElement().tagName() == QLatin1String( "query" ) ) - { - bool insert = false; - eVisQueryDefinition myQueryDefinition; - QDomNode myChildNodes = myNode.toElement().firstChild(); - while ( !myChildNodes.isNull() ) - { - QDomNode myDataNode = myChildNodes.toElement().firstChild(); - QString myDataNodeContent; - if ( !myDataNode.isNull() ) - { - myDataNodeContent = myDataNode.toText().data(); - } - - if ( myChildNodes.toElement().tagName() == QLatin1String( "shortdescription" ) ) - { - if ( !myDataNodeContent.isEmpty() ) - { - myQueryDefinition.setShortDescription( myDataNodeContent ); - myQueryCount++; - insert = true; - } - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "description" ) ) - { - myQueryDefinition.setDescription( myDataNodeContent ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "databasetype" ) ) - { - myQueryDefinition.setDatabaseType( myDataNodeContent ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "databasehost" ) ) - { - myQueryDefinition.setDatabaseHost( myDataNodeContent ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "databaseport" ) ) - { - myQueryDefinition.setDatabasePort( myDataNodeContent.toInt() ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "databasename" ) ) - { - myQueryDefinition.setDatabaseName( myDataNodeContent ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "databaseusername" ) ) - { - myQueryDefinition.setDatabaseUsername( myDataNodeContent ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "databasepassword" ) ) - { - myQueryDefinition.setDatabasePassword( myDataNodeContent ); - } - else if ( myChildNodes.toElement().tagName() == QLatin1String( "sqlstatement" ) ) - { - myQueryDefinition.setSqlStatement( myDataNodeContent ); - } - - myChildNodes = myChildNodes.nextSibling(); - } //end while( !myChildNodes.isNull() ) - - if ( insert ) - { - mQueryDefinitionMap->insert( myQueryCount - 1, myQueryDefinition ); - cboxPredefinedQueryList->insertItem( myQueryCount - 1, myQueryDefinition.shortDescription() ); - } - } //end if( myNode.toElement().tagName() == "query" ) - myNode = myNode.nextSibling(); - } // end while( !myNode.isNull() ) - } - else - { - teditConsole->append( tr( "Error: Parse error at line %1, column %2: %3" ).arg( errorLine ).arg( errorColumn ).arg( errorString ) ); - } - } - else - { - teditConsole->append( tr( "Error: Unable to open file [%1]" ).arg( myFilename ) ); - } - } -} - -/** -* Slot called when cboxPredefinedQueryList combo box index changes -* \param index - The current index of the selected item -*/ -void eVisDatabaseConnectionGui::cboxPredefinedQueryList_currentIndexChanged( int index ) -{ - if ( !mQueryDefinitionMap->isEmpty() ) - { - //get the query definition at the current index - //NOTE: not really necessary to check to see if index is out of range from the query definition map because items cannot - //be added to the combo box unless they are added to the query definition map - eVisQueryDefinition myQueryDefinition = mQueryDefinitionMap->value( index ); - - //Populate the GUI components with the values from the query definition - teditQueryDescription->setText( myQueryDefinition.description() ); - cboxDatabaseType->setCurrentIndex( cboxDatabaseType->findText( myQueryDefinition.databaseType() ) ); - leDatabaseHost->setText( myQueryDefinition.databaseHost() ); - leDatabasePort->setText( QStringLiteral( "%1" ).arg( myQueryDefinition.databasePort() ) ); - leDatabaseName->setText( myQueryDefinition.databaseName() ); - leDatabaseUsername->setText( myQueryDefinition.databaseUsername() ); - leDatabasePassword->setText( myQueryDefinition.databasePassword() ); - teditSqlStatement->setText( myQueryDefinition.sqlStatement() ); - } -} - -/** -* Slot called when pbtnOpenFile button is pressed -*/ -void eVisDatabaseConnectionGui::pbtnOpenFile_clicked() -{ - if ( cboxDatabaseType->currentText() == QLatin1String( "MSAccess" ) ) - leDatabaseName->setText( QFileDialog::getOpenFileName( this, tr( "Open File" ), QDir::homePath(), QStringLiteral( "MSAccess ( *.mdb )" ) ) ); - else - leDatabaseName->setText( QFileDialog::getOpenFileName( this, tr( "Open File" ), QDir::homePath(), QStringLiteral( "Sqlite ( *.db )" ) ) ); -} - -/** -* Slot called when the pbtnRunQuery button is pressed -*/ -void eVisDatabaseConnectionGui::pbtnRunQuery_clicked() -{ - //Check to see if we have a query - if ( !teditSqlStatement->toPlainText().isEmpty() ) - { - //Verify that we have an active database connection - if ( mDatabaseConnection ) - { - //Execute query - QSqlQuery *myResults = mDatabaseConnection->query( teditSqlStatement->toPlainText() ); - if ( !myResults ) - { - teditConsole->append( tr( "Error: Query failed: %1" ).arg( mDatabaseConnection->lastError() ) ); - } - else if ( myResults->isSelect() ) - { - //if valid and a select query, save results into temporary file and load as layer - ( void )myResults->next(); - if ( myResults->isValid() ) - { - mTempOutputFileList->append( new QTemporaryFile() ); - if ( mTempOutputFileList->last()->open() ) - { - QTextStream outputStream( mTempOutputFileList->last() ); - QStringList fieldList; - /* - * Output column names - */ - for ( int x = 0; x < myResults->record().count(); x++ ) - { - if ( 0 == x ) - { - outputStream << myResults->record().fieldName( x ); - } - else - { - outputStream << "\t" << myResults->record().fieldName( x ); - } - fieldList << myResults->record().fieldName( x ); - } - outputStream << endl; - /* - * Output Data - */ - while ( myResults->isValid() ) - { - for ( int x = 0; x < myResults->record().count(); x++ ) - { - if ( x == 0 ) - { - outputStream << myResults->value( x ).toString(); - } - else - { - outputStream << "\t" << myResults->value( x ).toString(); - } - } - outputStream << endl; - ( void )myResults->next(); - } - mTempOutputFileList->last()->close(); - mDatabaseLayerFieldSelector->setFieldList( &fieldList ); - mDatabaseLayerFieldSelector->show(); - } - else - { - teditConsole->append( tr( "Error: Could not create temporary file, process halted" ) ); - } - } - } - } - else - { - teditConsole->append( tr( "Error: A database connection is not currently established" ) ); - } - } -} - -void eVisDatabaseConnectionGui::showHelp() -{ - QgsHelp::openHelp( QStringLiteral( "plugins/core_plugins/plugins_evis.html#database-connection" ) ); -} diff --git a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h b/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h deleted file mode 100644 index ff2dcfcf8f50..000000000000 --- a/src/plugins/evis/databaseconnection/evisdatabaseconnectiongui.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -** File: evisdatabaseconnectiongui.h -** 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 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. -** -**/ -#ifndef eVisDatabaseConnectionGUI_H -#define eVisDatabaseConnectionGUI_H - -#include "ui_evisdatabaseconnectionguibase.h" -#include "evisdatabaseconnection.h" -#include "evisdatabaselayerfieldselectiongui.h" -#include "evisquerydefinition.h" -#include "qgshelp.h" - -#include -#include - -/** -* \class eVisDatabaseConnectionGui -* \brief GUI class for database connections -* This class provides the GUI component for setting up a database connection and making a sql query. -* This class effectively provides access to a wide variety of database types. Upon a successful query, -* the results are stored in a tabdelimited file the loaded into qgis using the demlimitedtext data provider -*/ -class eVisDatabaseConnectionGui : public QDialog, private Ui::eVisDatabaseConnectionGuiBase -{ - - Q_OBJECT - - public: - //! \brief Constructor - eVisDatabaseConnectionGui( QList *, QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); - - private: - //! \brief Pointer to a database connection - eVisDatabaseConnection *mDatabaseConnection = nullptr; - - //! \brief Pointer to a temporary file which will hold the results of our query - QList *mTempOutputFileList; - - //! \brief Pointer to another GUI component that will select which fields contain x, y coordinates - eVisDatabaseLayerFieldSelectionGui *mDatabaseLayerFieldSelector = nullptr; - - //! \brief Pointer to a QMap which will hold the definition of preexisting query that can be loaded from an xml file - QMap *mQueryDefinitionMap; - - private slots: - //! \brief Slot called after the user selects the x, y fields in the field selection gui component - void drawNewVectorLayer( const QString &, const QString &, const QString & ); - - void buttonBox_accepted(); - void showHelp(); - - void cboxDatabaseType_currentIndexChanged( int ); - void cboxPredefinedQueryList_currentIndexChanged( int ); - void pbtnConnect_clicked(); - void pbtnLoadPredefinedQueries_clicked(); - void pbtnOpenFile_clicked(); - void pbtnRunQuery_clicked(); - - signals: - //! \brief signal emitted by the drawNewVectorLayer slot - void drawVectorLayer( const QString &, const QString &, const QString & ); -}; - -#endif diff --git a/src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.cpp b/src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.cpp deleted file mode 100644 index 948cf9f3e64b..000000000000 --- a/src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -** File: evisdatabaselayerfieldselectiongui.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 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. -** -**/ -#include "evisdatabaselayerfieldselectiongui.h" - -/** -* Constructor -* \param parent - Pointer the to parent QWidget for modality -* \param fl - Windown flags -*/ -eVisDatabaseLayerFieldSelectionGui::eVisDatabaseLayerFieldSelectionGui( QWidget *parent, Qt::WindowFlags fl ) - : QDialog( parent, fl ) -{ - setupUi( this ); - connect( buttonBox, &QDialogButtonBox::accepted, this, &eVisDatabaseLayerFieldSelectionGui::buttonBox_accepted ); - connect( buttonBox, &QDialogButtonBox::rejected, this, &eVisDatabaseLayerFieldSelectionGui::buttonBox_rejected ); -} - -/** -* Public method that will insert the values in fieldList into the x and y coordinate selection combo boxes. -* \param fileList - QStringList containing the field names to add to the combo boxes -*/ -void eVisDatabaseLayerFieldSelectionGui::setFieldList( QStringList *fieldList ) -{ - - int xCoordinateIndex = -1; - int yCoordinateIndex = -1; - cboxXCoordinate->clear(); - cboxYCoordinate->clear(); - - for ( int x = 0; x < fieldList->size(); x++ ) - { - cboxXCoordinate->addItem( fieldList->at( x ) ); - cboxYCoordinate->addItem( fieldList->at( x ) ); - - //Take a guess in an attempt to auto select the correct field - if ( fieldList->at( x ).contains( QRegExp( "( ^x|^lon|^east )", Qt::CaseInsensitive ) ) ) - { - xCoordinateIndex = x; - } - - if ( fieldList->at( x ).contains( QRegExp( "( ^y|^lat|^north )", Qt::CaseInsensitive ) ) ) - { - yCoordinateIndex = x; - } - - } - - cboxXCoordinate->setCurrentIndex( xCoordinateIndex ); - cboxYCoordinate->setCurrentIndex( yCoordinateIndex ); -} - -/* - * - * Public and Private Slots - * - */ - -/** -* Slot called when the OK/Accept button is pressed -*/ -void eVisDatabaseLayerFieldSelectionGui::buttonBox_accepted() -{ - //emit the signal to draw the layer - emit eVisDatabaseLayerFieldsSelected( leLayerName->text(), cboxXCoordinate->currentText(), cboxYCoordinate->currentText() ); - - //close the gui component - close(); - - //reset the layer name line edit - leLayerName->clear(); -} - -/** -* Slot called then the cancel button is pressed -*/ -void eVisDatabaseLayerFieldSelectionGui::buttonBox_rejected() -{ - close(); - leLayerName->clear(); -} diff --git a/src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.h b/src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.h deleted file mode 100644 index 15ae71e268ad..000000000000 --- a/src/plugins/evis/databaseconnection/evisdatabaselayerfieldselectiongui.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -** File: evisdatabaselayerfieldselectiongui.h -** 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 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. -** -**/ -#ifndef eVisDatabaseLayerFieldSelectionGui_H -#define eVisDatabaseLayerFieldSelectionGui_H - -#include -#include "ui_evisdatabaselayerfieldselectionguibase.h" - -/** -* \class eVisDatabaseLayerFieldSelectionGui -* \brief GUI component that allows user to select field names that hold the x, y coordinates for the feature -* This class provides the GUI component that allows the user to enter a name for a newly created layer and also -* select the field names that hold the x, y coordinates for the features in this layer. -*/ -class eVisDatabaseLayerFieldSelectionGui : public QDialog, private Ui::eVisDatabaseLayerFieldSelectionGuiBase -{ - Q_OBJECT - - public: - //! \brief Constructor - eVisDatabaseLayerFieldSelectionGui( QWidget *parent, Qt::WindowFlags fl ); - - //! \brief Public method that sets the contents of the combo boxes with the available field names - void setFieldList( QStringList * ); - - public slots: - void buttonBox_accepted(); - void buttonBox_rejected(); - - signals: - //! \brief Signal emitted when the user has entered the layername, selected the field names, and pressed the accept button - void eVisDatabaseLayerFieldsSelected( const QString &, const QString &, const QString & ); -}; -#endif diff --git a/src/plugins/evis/databaseconnection/evisquerydefinition.cpp b/src/plugins/evis/databaseconnection/evisquerydefinition.cpp deleted file mode 100644 index 2023773b422a..000000000000 --- a/src/plugins/evis/databaseconnection/evisquerydefinition.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -** File: evisquerydefinition.cpp -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-04-12 -** -** 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 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. -** -**/ -#include "evisquerydefinition.h" - -/** -* Constructor -*/ -eVisQueryDefinition::eVisQueryDefinition() = default; - diff --git a/src/plugins/evis/databaseconnection/evisquerydefinition.h b/src/plugins/evis/databaseconnection/evisquerydefinition.h deleted file mode 100644 index 1ec14080212c..000000000000 --- a/src/plugins/evis/databaseconnection/evisquerydefinition.h +++ /dev/null @@ -1,150 +0,0 @@ -/* -** File: evisquerydefinition.h -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-04-12 -** -** 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 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. -** -**/ -#ifndef EVISQUERYDEFINITION_H -#define EVISQUERYDEFINITION_H - -#include "evisdatabaseconnection.h" - -#include - -/** -* \class eVisQueryDefinition -* \brief Object for holding an parameters to an eVis sql query -* This class is not much more than a structure for holding the parameters for a eVis sql query. THis class -* is used by eVisDatabaseConnectionGui to store not only the sql statement but also all the parameters for -* making a connection to a database or datasource, as loaded from an XML file. -*/ -class eVisQueryDefinition -{ - - public: - //! \brief Constructor - eVisQueryDefinition(); - - //! \brief Accessor for query description - QString description() { return mDescription; } - - //! \brief Accessor for query short description - QString shortDescription() { return mShortDescription; } - - //! \brief Accessor for database type - QString databaseType() { return mDatabaseType; } - - //! \brief Accessor for database host name - QString databaseHost() { return mDatabaseHost; } - - //! \brief Accessor for database port - int databasePort() { return mDatabasePort; } - - //! \brief Accessor for database name - QString databaseName() { return mDatabaseName; } - - //! \brief Accessor for database username - QString databaseUsername() { return mDatabaseUsername; } - - //! \brief Accessor for database password - QString databasePassword() { return mDatabasePassword; } - - //! \brief Accessor for SQL statement - QString sqlStatement() { return mSqlStatement; } - - //! \brief Accessor for auto connection flag - bool autoConnect() { return mAutoConnect; } - - //! \brief Mutator for query description - void setDescription( const QString &description ) { mDescription = description; } - - //! \brief Mutator for query short description - void setShortDescription( const QString &description ) { mShortDescription = description; } - - //! \brief Mutator for database type - void setDatabaseType( const QString &type ) { mDatabaseType = type; } - - //! \brief Mutator for database host name - void setDatabaseHost( const QString &host ) { mDatabaseHost = host; } - - //! \brief Mutator for database port - void setDatabasePort( int port ) { mDatabasePort = port; } - - //! \brief Mutator for database name - void setDatabaseName( const QString &name ) { mDatabaseName = name; } - - //! \brief Mutator for database username - void setDatabaseUsername( const QString &username ) { mDatabaseUsername = username; } - - //! \brief Mutator for database password - void setDatabasePassword( const QString &password ) { mDatabasePassword = password; } - - //! \brief Mutator for SQL statement - void setSqlStatement( const QString &statement ) { mSqlStatement = statement; } - - //! \brief Mutator for auto connection flag - void setAutoConnect( const QString &autoconnect ) - { - if ( autoconnect.startsWith( QLatin1String( "true" ), Qt::CaseInsensitive ) ) - { - mAutoConnect = true; - } - else - { - mAutoConnect = false; - } - } - - - private: - //! \brief Detailed description for the query - QString mDescription; - - //! \brief Short description for the query - QString mShortDescription; - - //! \brief The database type to which a connection should be made - QString mDatabaseType; - - //! \brief The database host to which a connection should be made - QString mDatabaseHost; - - //! \brief The port/socket on the database host to which a connection should be made - int mDatabasePort = -1; - - //! \brief The name, or filename, of the database to which a connection should be made - QString mDatabaseName; - - //! \brief Username for the database, if required - QString mDatabaseUsername; - - //! \brief Password for the username, if require - QString mDatabasePassword; - - //! \brief The SQL statement to execute upon successful connection to a database - QString mSqlStatement; - - //! \brief Boolean to allow for automated connection to the database when query definition is successfully loaded - bool mAutoConnect = false; -}; -#endif diff --git a/src/plugins/evis/eventbrowser/evisconfiguration.cpp b/src/plugins/evis/eventbrowser/evisconfiguration.cpp deleted file mode 100644 index 1377efdc4737..000000000000 --- a/src/plugins/evis/eventbrowser/evisconfiguration.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/* -** File: evisconfiguration.cpp -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-12-11 -** -** 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 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. -** -**/ -#include -#include - -#include "evisconfiguration.h" - -eVisConfiguration::eVisConfiguration() -{ - QSettings myQSettings; - - setApplyPathRulesToDocs( myQSettings.value( QStringLiteral( "eVis/applypathrulestodocs" ), false ).toBool() ); - - setEventImagePathField( myQSettings.value( QStringLiteral( "eVis/eventimagepathfield" ), "" ).toString() ); - setEventImagePathRelative( myQSettings.value( QStringLiteral( "eVis/eventimagepathrelative" ), false ).toBool() ); - - setDisplayCompassBearing( myQSettings.value( QStringLiteral( "eVis/displaycompassbearing" ), false ).toBool() ); - setCompassBearingField( myQSettings.value( QStringLiteral( "eVis/compassbearingfield" ), "" ).toString() ); - - setManualCompassOffset( myQSettings.value( QStringLiteral( "eVis/manualcompassoffset" ), false ).toBool() ); - setCompassOffset( myQSettings.value( QStringLiteral( "eVis/compassoffset" ), "0.0" ).toDouble() ); - setAttributeCompassOffset( myQSettings.value( QStringLiteral( "eVis/attributecompassoffset" ), false ).toBool() ); - setCompassOffsetField( myQSettings.value( QStringLiteral( "eVis/compassoffsetfield" ), "" ).toString() ); - - setBasePath( myQSettings.value( QStringLiteral( "eVis/basepath" ), QDir::homePath() ).toString() ); - mUseOnlyFilename = myQSettings.value( QStringLiteral( "eVis/useonlyfilename" ), false ).toBool(); -} - -QString eVisConfiguration::basePath() -{ - return mBasePath; -} - -QString eVisConfiguration::compassBearingField() -{ - return mCompassBearingField; -} - -double eVisConfiguration::compassOffset() -{ - return mCompassOffset; -} - -QString eVisConfiguration::compassOffsetField() -{ - return mCompassOffsetField; -} - -QString eVisConfiguration::eventImagePathField() -{ - return mEventImagePathField; -} - -bool eVisConfiguration::isApplyPathRulesToDocsSet() -{ - return mApplyPathRulesToDocs; -} - -bool eVisConfiguration::isAttributeCompassOffsetSet() -{ - return mAttributeCompassOffset; -} - -bool eVisConfiguration::isDisplayCompassBearingSet() -{ - return mDisplayCompassBearing; -} - -bool eVisConfiguration::isEventImagePathRelative() -{ - return mEventImagePathRelative; -} - -bool eVisConfiguration::isManualCompassOffsetSet() -{ - return mManualCompassOffset; -} - -bool eVisConfiguration::isUseOnlyFilenameSet() -{ - return mUseOnlyFilename; -} - -void eVisConfiguration::setApplyPathRulesToDocs( bool pathRules ) -{ - mApplyPathRulesToDocs = pathRules; -} - -void eVisConfiguration::setAttributeCompassOffset( bool compassOffset ) -{ - mAttributeCompassOffset = compassOffset; -} - -void eVisConfiguration::setBasePath( const QString &path ) -{ - QSettings myQSettings; - mBasePath = path; - if ( "" != mBasePath ) - { - if ( mBasePath.contains( '/' ) ) - { - if ( mBasePath[mBasePath.length() - 1] != '/' ) - { - mBasePath = mBasePath + '/'; - } - } - else - { - if ( mBasePath[mBasePath.length() - 1] != '\\' ) - { - mBasePath = mBasePath + '\\'; - } - } - } -} - -void eVisConfiguration::setCompassBearingField( const QString &field ) -{ - mCompassBearingField = field; -} - -void eVisConfiguration::setCompassOffset( double offset ) -{ - mCompassOffset = offset; -} - -void eVisConfiguration::setCompassOffsetField( const QString &field ) -{ - mCompassOffsetField = field; -} - -void eVisConfiguration::setDisplayCompassBearing( bool compassBearing ) -{ - mDisplayCompassBearing = compassBearing; -} - -void eVisConfiguration::setEventImagePathField( const QString &field ) -{ - mEventImagePathField = field; -} - -void eVisConfiguration::setEventImagePathRelative( bool pathRelative ) -{ - mEventImagePathRelative = pathRelative; -} - -void eVisConfiguration::setManualCompassOffset( bool manualOffset ) -{ - mManualCompassOffset = manualOffset; -} - -void eVisConfiguration::setUseOnlyFilename( bool useOnlyFileName ) -{ - mUseOnlyFilename = useOnlyFileName; -} diff --git a/src/plugins/evis/eventbrowser/evisconfiguration.h b/src/plugins/evis/eventbrowser/evisconfiguration.h deleted file mode 100644 index 23a604172e90..000000000000 --- a/src/plugins/evis/eventbrowser/evisconfiguration.h +++ /dev/null @@ -1,87 +0,0 @@ -/* -** File: evisconfiguration.h -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-12-11 -** -** 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 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. -** -**/ -#ifndef eVisConfiguration_H -#define eVisConfiguration_H - -#include - -/** -* \class eVisConfiguration -* \brief This class is not much more than a structure for holding parameters -* The eVisConfiguration is simply a class to hold a variety of configuration options -* for the event browser. The event browser is actually responsible for saving -* the options. Give that, the individual function are not commented as they should be obvious -*/ -class eVisConfiguration -{ - - public: - eVisConfiguration(); - - QString basePath(); - QString compassBearingField(); - double compassOffset(); - QString compassOffsetField(); - QString eventImagePathField(); - - bool isApplyPathRulesToDocsSet(); - bool isAttributeCompassOffsetSet(); - bool isDisplayCompassBearingSet(); - bool isEventImagePathRelative(); - bool isManualCompassOffsetSet(); - bool isUseOnlyFilenameSet(); - - void setApplyPathRulesToDocs( bool pathRules ); - void setAttributeCompassOffset( bool compassOffset ); - void setBasePath( const QString & ); - void setCompassBearingField( const QString & ); - void setCompassOffset( double ); - void setCompassOffsetField( const QString & ); - void setDisplayCompassBearing( bool compassBearing ); - void setEventImagePathField( const QString & ); - void setEventImagePathRelative( bool pathRelative ); - void setManualCompassOffset( bool manualOffset ); - void setUseOnlyFilename( bool useOnlyFileName ); - - - private: - bool mApplyPathRulesToDocs; - bool mAttributeCompassOffset; - bool mDisplayCompassBearing; - bool mEventImagePathRelative; - bool mManualCompassOffset; - bool mUseOnlyFilename; - - QString mBasePath; - QString mCompassOffsetField; - QString mCompassBearingField; - QString mEventImagePathField; - - - double mCompassOffset; -}; -#endif diff --git a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp b/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp deleted file mode 100644 index 22cc13fd0dfd..000000000000 --- a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp +++ /dev/null @@ -1,1200 +0,0 @@ -/* -** File: evisgenericeventbrowsergui.cpp -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-08 -** -** 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 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. -** -**/ -#include "evisgenericeventbrowsergui.h" - -#include "qgsapplication.h" -#include "qgsfeatureiterator.h" -#include "qgsmaptopixel.h" -#include "qgsmapcanvas.h" -#include "qgsgeometry.h" -#include "qgslogger.h" -#include "qgspointxy.h" -#include "qgsfields.h" -#include "qgsrectangle.h" -#include "qgsvectorlayer.h" -#include "qgsgui.h" - -#include -#include -#include -#include -#include -#include -#include - -/** -* Constructor called when browser is launched from the application plugin tool bar -* \param parent - Pointer the to parent QWidget for modality -* \param interface - Pointer to the application interface -* \param fl - Window flags -*/ -eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget *parent, QgisInterface *interface, Qt::WindowFlags fl ) - : QDialog( parent, fl ) - , mInterface( interface ) -{ - setupUi( this ); - QgsGui::instance()->enableAutoGeometryRestore( this ); - - connect( buttonboxOptions, &QDialogButtonBox::clicked, this, &eVisGenericEventBrowserGui::buttonboxOptions_clicked ); - connect( chkboxApplyPathRulesToDocs, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged ); - connect( cboxEventImagePathField, static_cast( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged ); - connect( cboxCompassBearingField, static_cast( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged ); - connect( cboxCompassOffsetField, static_cast( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged ); - connect( chkboxDisplayCompassBearing, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged ); - connect( chkboxEventImagePathRelative, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged ); - connect( chkboxUseOnlyFilename, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged ); - connect( displayArea, &QTabWidget::currentChanged, this, &eVisGenericEventBrowserGui::displayArea_currentChanged ); - connect( dsboxCompassOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged ); - connect( leBasePath, &QLineEdit::textChanged, this, &eVisGenericEventBrowserGui::leBasePath_textChanged ); - connect( pbtnAddFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnAddFileType_clicked ); - connect( pbtnDeleteFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked ); - connect( pbtnNext, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnNext_clicked ); - connect( pbtnPrevious, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnPrevious_clicked ); - connect( pbtnResetApplyPathRulesToDocs, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked ); - connect( pbtnResetBasePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked ); - connect( pbtnResetCompassBearingData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked ); - connect( pbtnResetCompassOffsetData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked ); - connect( pbtnResetEventImagePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked ); - connect( pbtnResetUseOnlyFilenameData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked ); - connect( rbtnManualCompassOffset, &QRadioButton::toggled, this, &eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled ); - connect( tableFileTypeAssociations, &QTableWidget::cellDoubleClicked, this, &eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked ); - - if ( initBrowser() ) - { - loadRecord(); - show(); - } - else - { - close(); - } -} - -/** -* Constructor called when browser is launched by the eVisEventIdTool -* \param parent - Pointer to the parent QWidget for modality -* \param canvas - Pointer to the map canvas -* \param fl - Window flags -*/ -eVisGenericEventBrowserGui::eVisGenericEventBrowserGui( QWidget *parent, QgsMapCanvas *canvas, Qt::WindowFlags fl ) - : QDialog( parent, fl ) - , mCanvas( canvas ) -{ - setupUi( this ); - connect( buttonboxOptions, &QDialogButtonBox::clicked, this, &eVisGenericEventBrowserGui::buttonboxOptions_clicked ); - connect( chkboxApplyPathRulesToDocs, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged ); - connect( cboxEventImagePathField, static_cast( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged ); - connect( cboxCompassBearingField, static_cast( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged ); - connect( cboxCompassOffsetField, static_cast( &QComboBox::currentIndexChanged ), this, &eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged ); - connect( chkboxDisplayCompassBearing, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged ); - connect( chkboxEventImagePathRelative, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged ); - connect( chkboxUseOnlyFilename, &QCheckBox::stateChanged, this, &eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged ); - connect( displayArea, &QTabWidget::currentChanged, this, &eVisGenericEventBrowserGui::displayArea_currentChanged ); - connect( dsboxCompassOffset, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, &eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged ); - connect( leBasePath, &QLineEdit::textChanged, this, &eVisGenericEventBrowserGui::leBasePath_textChanged ); - connect( pbtnAddFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnAddFileType_clicked ); - connect( pbtnDeleteFileType, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked ); - connect( pbtnNext, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnNext_clicked ); - connect( pbtnPrevious, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnPrevious_clicked ); - connect( pbtnResetApplyPathRulesToDocs, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked ); - connect( pbtnResetBasePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked ); - connect( pbtnResetCompassBearingData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked ); - connect( pbtnResetCompassOffsetData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked ); - connect( pbtnResetEventImagePathData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked ); - connect( pbtnResetUseOnlyFilenameData, &QPushButton::clicked, this, &eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked ); - connect( rbtnManualCompassOffset, &QRadioButton::toggled, this, &eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled ); - connect( tableFileTypeAssociations, &QTableWidget::cellDoubleClicked, this, &eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked ); - - if ( initBrowser() ) - { - loadRecord(); - show(); - } - else - { - close(); - } -} - - -/** - * Basic destructor - */ -eVisGenericEventBrowserGui::~eVisGenericEventBrowserGui() -{ - //Clean up, disconnect the highlighting routine and refresh the canvas to clear highlighting symbol - if ( mCanvas ) - { - disconnect( mCanvas, &QgsMapCanvas::renderComplete, this, &eVisGenericEventBrowserGui::renderSymbol ); - mCanvas->refresh(); - } - - //On close, clear selected feature - if ( mVectorLayer ) - { - mVectorLayer->removeSelection(); - } -} - -/** - * This method is an extension of the constructor. It was implemented to reduce the amount of code duplicated between the constructors. - */ -bool eVisGenericEventBrowserGui::initBrowser() -{ - - //setup gui - setWindowTitle( tr( "Generic Event Browser" ) ); - - connect( treeEventData, &QTreeWidget::itemDoubleClicked, this, &eVisGenericEventBrowserGui::launchExternalApplication ); - - mHighlightSymbol.load( QStringLiteral( ":/evis/eVisHighlightSymbol.png" ) ); - mPointerSymbol.load( QStringLiteral( ":/evis/eVisPointerSymbol.png" ) ); - mCompassOffset = 0.0; - - //Flag to let us know if the browser fully loaded - mBrowserInitialized = false; - - //Initialize some class variables - mDefaultEventImagePathField = 0; - mDefaultCompassBearingField = 0; - mDefaultCompassOffsetField = 0; - - //initialize Display tab GUI elements - pbtnNext->setEnabled( false ); - pbtnPrevious->setEnabled( false ); - - - //Set up Attribute display - treeEventData->setColumnCount( 2 ); - QStringList treeHeaders; - treeHeaders << tr( "Field" ) << tr( "Value" ); - treeEventData->setHeaderLabels( treeHeaders ); - - //Initialize Options tab GUI elements - cboxEventImagePathField->setEnabled( true ); - chkboxEventImagePathRelative->setChecked( false ); - - chkboxDisplayCompassBearing->setChecked( false ); - cboxCompassBearingField->setEnabled( true ); - - rbtnManualCompassOffset->setChecked( false ); - dsboxCompassOffset->setEnabled( true ); - dsboxCompassOffset->setValue( 0.0 ); - rbtnAttributeCompassOffset->setChecked( false ); - cboxCompassOffsetField->setEnabled( true ); - - - chkboxUseOnlyFilename->setChecked( false ); - - - chkboxSaveEventImagePathData->setChecked( false ); - chkboxSaveCompassBearingData->setChecked( false ); - chkboxSaveCompassOffsetData->setChecked( false ); - chkboxSaveBasePathData->setChecked( false ); - chkboxSaveUseOnlyFilenameData->setChecked( false ); - - - //Check to for interface, not null when launched from plugin toolbar, otherwise expect map canvas - if ( mInterface ) - { - //check for active layer - if ( mInterface->activeLayer() ) - { - //verify that the active layer is a vector layer - if ( QgsMapLayerType::VectorLayer == mInterface->activeLayer()->type() ) - { - mVectorLayer = qobject_cast< QgsVectorLayer * >( mInterface->activeLayer() ); - mCanvas = mInterface->mapCanvas(); - } - else - { - QMessageBox::warning( this, tr( "Generic Event Browser" ), tr( "This tool only supports vector data." ) ); - return false; - } - } - else - { - QMessageBox::warning( this, tr( "Generic Event Browser" ), tr( "No active layers found." ) ); - return false; - } - } - //check for map canvas, if map canvas is null, throw error - else if ( mCanvas ) - { - //check for active layer - if ( mCanvas->currentLayer() ) - { - //verify that the active layer is a vector layer - if ( QgsMapLayerType::VectorLayer == mCanvas->currentLayer()->type() ) - { - mVectorLayer = qobject_cast< QgsVectorLayer * >( mCanvas->currentLayer() ); - } - else - { - QMessageBox::warning( this, tr( "Generic Event Browser" ), tr( "This tool only supports vector data." ) ); - return false; - } - } - else - { - QMessageBox::warning( this, tr( "Generic Event Browser" ), tr( "No active layers found." ) ); - return false; - } - } - else - { - QMessageBox::warning( this, tr( "Generic Event Browser" ), tr( "Unable to connect to either the map canvas or application interface." ) ); - return false; - } - - //Connect rendering routine for highlighting symbols and load symbols - connect( mCanvas, &QgsMapCanvas::renderComplete, this, &eVisGenericEventBrowserGui::renderSymbol ); - - mDataProvider = mVectorLayer->dataProvider(); - - /* - * A list of the selected feature ids is made so that we can move forward and backward through - * the list. The data providers only have the ability to get one feature at a time or - * sequentially move forward through the selected features - */ - if ( 0 == mVectorLayer->selectedFeatureCount() ) //if nothing is selected select everything - { - mVectorLayer->invertSelection(); - mFeatureIds = mVectorLayer->selectedFeatureIds().toList(); - } - else //use selected features - { - mFeatureIds = mVectorLayer->selectedFeatureIds().toList(); - } - - if ( 0 == mFeatureIds.size() ) - return false; - - //get the first feature in the list so we can set the field in the pull-down menus - QgsFeature *myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - if ( !myFeature ) - { - QMessageBox::warning( this, tr( "Generic Event Browser" ), tr( "An invalid feature was received during initialization." ) ); - return false; - } - - QgsFields myFields = mVectorLayer->fields(); - mIgnoreEvent = true; //Ignore indexChanged event when adding items to combo boxes - for ( int x = 0; x < myFields.count(); x++ ) - { - QString name = myFields.at( x ).name(); - cboxEventImagePathField->addItem( name ); - cboxCompassBearingField->addItem( name ); - cboxCompassOffsetField->addItem( name ); - if ( myFeature->attribute( x ).toString().contains( QRegExp( "(jpg|jpeg|tif|tiff|gif)", Qt::CaseInsensitive ) ) ) - { - mDefaultEventImagePathField = x; - } - - if ( name.contains( QRegExp( "(comp|bear)", Qt::CaseInsensitive ) ) ) - { - mDefaultCompassBearingField = x; - } - - if ( name.contains( QRegExp( "(offset|declination)", Qt::CaseInsensitive ) ) ) - { - mDefaultCompassOffsetField = x; - } - } - mIgnoreEvent = false; - - //Set Display tab gui items - if ( mFeatureIds.size() > 1 ) - { - pbtnNext->setEnabled( true ); - } - - setWindowTitle( tr( "Event Browser - Displaying Records 01 of %1" ).arg( mFeatureIds.size(), 2, 10, QChar( '0' ) ) ); - - //Set Options tab gui items - initOptionsTab(); - - //Load file associations into Configure External Applications tab gui items - QSettings myQSettings; - myQSettings.beginWriteArray( QStringLiteral( "/eVis/filetypeassociations" ) ); - int myTotalAssociations = myQSettings.childGroups().count(); - int myIterator = 0; - while ( myIterator < myTotalAssociations ) - { - myQSettings.setArrayIndex( myIterator ); - tableFileTypeAssociations->insertRow( tableFileTypeAssociations->rowCount() ); - tableFileTypeAssociations->setItem( myIterator, 0, new QTableWidgetItem( myQSettings.value( QStringLiteral( "extension" ), "" ).toString() ) ); - tableFileTypeAssociations->setItem( myIterator, 1, new QTableWidgetItem( myQSettings.value( QStringLiteral( "application" ), "" ).toString() ) ); - myIterator++; - } - myQSettings.endArray(); - - mBrowserInitialized = true; - - return true; -} - -/** - * This method is an extension of the constructor. It was implemented so that it could be called by the GUI at anytime. - */ -void eVisGenericEventBrowserGui::initOptionsTab() -{ - //The base path has to be set first. If not if/when cboxEventImagePathRelative state change slot - //will all ways over write the base path with the path to the data source - //TODO: Find some better logic to prevent this from happening. - leBasePath->setText( mConfiguration.basePath() ); - chkboxUseOnlyFilename->setChecked( mConfiguration.isUseOnlyFilenameSet() ); - - //Set Options tab gui items - int myIndex = cboxEventImagePathField->findText( mConfiguration.eventImagePathField(), Qt::MatchExactly ); - if ( -1 != myIndex ) - { - cboxEventImagePathField->setCurrentIndex( myIndex ); - } - else - { - cboxEventImagePathField->setCurrentIndex( mDefaultEventImagePathField ); - } - - chkboxEventImagePathRelative->setChecked( mConfiguration.isEventImagePathRelative() ); - - myIndex = cboxCompassBearingField->findText( mConfiguration.compassBearingField(), Qt::MatchExactly ); - if ( -1 != myIndex ) - { - cboxCompassBearingField->setCurrentIndex( myIndex ); - } - else - { - cboxCompassBearingField->setCurrentIndex( mDefaultCompassBearingField ); - } - - chkboxDisplayCompassBearing->setChecked( mConfiguration.isDisplayCompassBearingSet() ); - - if ( !mConfiguration.isDisplayCompassBearingSet() ) - { - cboxCompassBearingField->setEnabled( false ); - } - - dsboxCompassOffset->setValue( mConfiguration.compassOffset() ); - myIndex = cboxCompassOffsetField->findText( mConfiguration.compassOffsetField(), Qt::MatchExactly ); - if ( -1 != myIndex ) - { - cboxCompassOffsetField->setCurrentIndex( myIndex ); - } - else - { - loadRecord(); - cboxCompassOffsetField->setCurrentIndex( mDefaultCompassOffsetField ); - } - - if ( mConfiguration.isManualCompassOffsetSet() ) - { - rbtnManualCompassOffset->setChecked( true ); - rbtnAttributeCompassOffset->setChecked( false ); - } - else if ( !mConfiguration.compassOffsetField().isEmpty() ) - { - rbtnManualCompassOffset->setChecked( false ); - rbtnAttributeCompassOffset->setChecked( true ); - } - else - { - rbtnManualCompassOffset->setChecked( false ); - rbtnAttributeCompassOffset->setChecked( false ); - dsboxCompassOffset->setEnabled( false ); - cboxCompassOffsetField->setEnabled( false ); - } - - chkboxApplyPathRulesToDocs->setChecked( mConfiguration.isApplyPathRulesToDocsSet() ); - -} - -void eVisGenericEventBrowserGui::closeEvent( QCloseEvent *event ) -{ - if ( mBrowserInitialized ) - { - accept(); - event->accept(); - } -} - -void eVisGenericEventBrowserGui::accept() -{ - QSettings myQSettings; - - if ( chkboxSaveEventImagePathData->isChecked() ) - { - myQSettings.setValue( QStringLiteral( "eVis/eventimagepathfield" ), cboxEventImagePathField->currentText() ); - myQSettings.setValue( QStringLiteral( "eVis/eventimagepathrelative" ), chkboxEventImagePathRelative->isChecked() ); - } - - if ( chkboxSaveCompassBearingData->isChecked() ) - { - myQSettings.setValue( QStringLiteral( "eVis/compassbearingfield" ), cboxCompassBearingField->currentText() ); - myQSettings.setValue( QStringLiteral( "eVis/displaycompassbearing" ), chkboxDisplayCompassBearing->isChecked() ); - } - - if ( chkboxSaveCompassOffsetData->isChecked() ) - { - myQSettings.setValue( QStringLiteral( "eVis/manualcompassoffset" ), rbtnManualCompassOffset->isChecked() ); - myQSettings.setValue( QStringLiteral( "eVis/compassoffset" ), dsboxCompassOffset->value() ); - myQSettings.setValue( QStringLiteral( "eVis/attributecompassoffset" ), rbtnAttributeCompassOffset->isChecked() ); - myQSettings.setValue( QStringLiteral( "eVis/compassoffsetfield" ), cboxCompassOffsetField->currentText() ); - } - - if ( chkboxSaveBasePathData->isChecked() ) - { - myQSettings.setValue( QStringLiteral( "eVis/basepath" ), leBasePath->text() ); - } - - if ( chkboxSaveUseOnlyFilenameData->isChecked() ) - { - myQSettings.setValue( QStringLiteral( "eVis/useonlyfilename" ), chkboxUseOnlyFilename->isChecked() ); - } - - if ( chkboxSaveApplyPathRulesToDocs->isChecked() ) - { - myQSettings.setValue( QStringLiteral( "eVis/applypathrulestodocs" ), chkboxApplyPathRulesToDocs->isChecked() ); - } - - myQSettings.remove( QStringLiteral( "/eVis/filetypeassociations" ) ); - myQSettings.beginWriteArray( QStringLiteral( "/eVis/filetypeassociations" ) ); - int myIterator = 0; - int myIndex = 0; - while ( myIterator < tableFileTypeAssociations->rowCount() ) - { - myQSettings.setArrayIndex( myIndex ); - if ( tableFileTypeAssociations->item( myIterator, 0 ) && tableFileTypeAssociations->item( myIterator, 1 ) ) - { - myQSettings.setValue( QStringLiteral( "extension" ), tableFileTypeAssociations->item( myIterator, 0 )->text() ); - myQSettings.setValue( QStringLiteral( "application" ), tableFileTypeAssociations->item( myIterator, 1 )->text() ); - myIndex++; - } - myIterator++; - } - myQSettings.endArray(); -} - -/** - * Modifies the Event Image Path according to the local and global settings - */ -void eVisGenericEventBrowserGui::buildEventImagePath() -{ - //This if statement is a bit of a hack, have to track down where the 0 is coming from on initialization - if ( "0" != mEventImagePath ) - { - int myImageNameMarker = 0; - - if ( mEventImagePath.contains( '/' ) ) - { - myImageNameMarker = mEventImagePath.lastIndexOf( '/' ); - } - else - { - myImageNameMarker = mEventImagePath.lastIndexOf( '\\' ); - } - - QString myImageName = mEventImagePath; - myImageName.remove( 0, myImageNameMarker + 1 ); - if ( mConfiguration.isUseOnlyFilenameSet() ) - { - mEventImagePath = mConfiguration.basePath() + myImageName; - } - else - { - if ( mConfiguration.isEventImagePathRelative() ) - { - mEventImagePath = mConfiguration.basePath() + mEventImagePath; - } - } - } -} - -/** - * Chooses which image loading method to use and centers the map canvas on the current feature - */ -void eVisGenericEventBrowserGui::displayImage() -{ - //This if statement is a bit of a hack, have to track down where the 0 is coming from on initialization - if ( "0" != mEventImagePath && 0 == displayArea->currentIndex() ) - { - if ( mEventImagePath.startsWith( QLatin1String( "http://" ), Qt::CaseInsensitive ) ) - { - imageDisplayArea->displayUrlImage( mEventImagePath ); - } - else - { - imageDisplayArea->displayImage( mEventImagePath ); - } - - //clear any selection that may be present - mVectorLayer->removeSelection(); - if ( !mFeatureIds.isEmpty() ) - { - //select the current feature in the layer - mVectorLayer->select( mFeatureIds.at( mCurrentFeatureIndex ) ); - //get a copy of the feature - QgsFeature *myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - - if ( !myFeature ) - return; - - QgsPointXY myPoint = myFeature->geometry().asPoint(); - myPoint = mCanvas->mapSettings().layerToMapCoordinates( mVectorLayer, myPoint ); - //keep the extent the same just center the map canvas in the display so our feature is in the middle - QgsRectangle myRect( myPoint.x() - ( mCanvas->extent().width() / 2 ), myPoint.y() - ( mCanvas->extent().height() / 2 ), myPoint.x() + ( mCanvas->extent().width() / 2 ), myPoint.y() + ( mCanvas->extent().height() / 2 ) ); - - // only change the extents if the point is beyond the current extents to minimize repaints - if ( !mCanvas->extent().contains( myPoint ) ) - { - mCanvas->setExtent( myRect, true ); - } - mCanvas->refresh(); - } - } -} - -/** - * Returns a pointer to the requested feature with a given featureid - * \param id - FeatureId of the feature to find/select - */ -QgsFeature *eVisGenericEventBrowserGui::featureAtId( QgsFeatureId id ) -{ - //This method was originally necessary because delimited text data provider did not support featureAtId() - //It has mostly been stripped down now - if ( mVectorLayer && mFeatureIds.size() != 0 ) - { - if ( !mVectorLayer->getFeatures( QgsFeatureRequest().setFilterFid( id ) ).nextFeature( mFeature ) ) - { - return nullptr; - } - } - - return &mFeature; -} - -/** - * Display the attrbiutes for the current feature and load the image - */ -void eVisGenericEventBrowserGui::loadRecord() -{ - treeEventData->clear(); - - //Get a pointer to the current feature - QgsFeature *myFeature = nullptr; - myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - - if ( !myFeature ) - return; - - QString myCompassBearingField = cboxCompassBearingField->currentText(); - QString myCompassOffsetField = cboxCompassOffsetField->currentText(); - QString myEventImagePathField = cboxEventImagePathField->currentText(); - QgsFields myFields = mVectorLayer->fields(); - QgsAttributes myAttrs = myFeature->attributes(); - //loop through the attributes and display their contents - for ( int i = 0; i < myAttrs.count(); ++i ) - { - QStringList myValues; - QString fieldName = myFields.at( i ).name(); - myValues << fieldName << myAttrs.at( i ).toString(); - QTreeWidgetItem *myItem = new QTreeWidgetItem( myValues ); - if ( fieldName == myEventImagePathField ) - { - mEventImagePath = myAttrs.at( i ).toString(); - } - - if ( fieldName == myCompassBearingField ) - { - mCompassBearing = myAttrs.at( i ).toDouble(); - } - - if ( mConfiguration.isAttributeCompassOffsetSet() ) - { - if ( fieldName == myCompassOffsetField ) - { - mCompassOffset = myAttrs.at( i ).toDouble(); - } - } - else - { - mCompassOffset = 0.0; - } - - //Check to see if the attribute is a know file type - int myIterator = 0; - while ( myIterator < tableFileTypeAssociations->rowCount() ) - { - if ( tableFileTypeAssociations->item( myIterator, 0 ) && ( myAttrs.at( i ).toString().startsWith( tableFileTypeAssociations->item( myIterator, 0 )->text() + ':', Qt::CaseInsensitive ) || myAttrs.at( i ).toString().endsWith( tableFileTypeAssociations->item( myIterator, 0 )->text(), Qt::CaseInsensitive ) ) ) - { - myItem->setBackground( 1, QBrush( QColor( 183, 216, 125, 255 ) ) ); - break; - } - else - myIterator++; - } - treeEventData->addTopLevelItem( myItem ); - } - //Modify EventImagePath as needed - buildEventImagePath(); - - //Request the image to be displayed in the browser - displayImage(); -} - -/** - * Restore the default configuration options - */ -void eVisGenericEventBrowserGui::restoreDefaultOptions() -{ - chkboxEventImagePathRelative->setChecked( false ); - cboxEventImagePathField->setCurrentIndex( mDefaultEventImagePathField ); - - cboxCompassBearingField->setEnabled( true ); - cboxCompassBearingField->setCurrentIndex( mDefaultCompassBearingField ); - cboxCompassBearingField->setEnabled( false ); - chkboxDisplayCompassBearing->setChecked( false ); - - cboxCompassOffsetField->setEnabled( true ); - cboxCompassOffsetField->setCurrentIndex( mDefaultCompassOffsetField ); - cboxCompassOffsetField->setEnabled( false ); - rbtnManualCompassOffset->setChecked( true ); - dsboxCompassOffset->setValue( 0.0 ); - - leBasePath->clear(); - chkboxUseOnlyFilename->setChecked( false ); - - chkboxSaveEventImagePathData->setChecked( false ); - chkboxSaveCompassBearingData->setChecked( false ); - chkboxSaveCompassOffsetData->setChecked( false ); - chkboxSaveBasePathData->setChecked( false ); - chkboxSaveUseOnlyFilenameData->setChecked( false ); - chkboxApplyPathRulesToDocs->setChecked( false ); -} - -/** - * Sets the base path to the path of the data source - */ -void eVisGenericEventBrowserGui::setBasePathToDataSource() -{ - int myPathMarker = 0; - - QString mySourceUri = mDataProvider->dataSourceUri(); - //Check to see which way the directory symbol goes, I think this is actually unnecessary in qt - if ( mySourceUri.contains( '/' ) ) - { - myPathMarker = mySourceUri.lastIndexOf( '/' ); - } - else - { - myPathMarker = mySourceUri.lastIndexOf( '\\' ); - } - - //Strip off the actual filename so we just have path - mySourceUri.truncate( myPathMarker + 1 ); - - //check for duplicate directory symbols when concatinating the two strings -#ifdef Q_OS_WIN - mySourceUri.replace( "\\\\", "\\" ); -#else - if ( mySourceUri.startsWith( QLatin1String( "http://" ), Qt::CaseInsensitive ) ) - { - mySourceUri.replace( QLatin1String( "//" ), QLatin1String( "/" ) ); - mySourceUri.replace( QLatin1String( "http:/" ), QLatin1String( "http://" ), Qt::CaseInsensitive ); - } - else - { - mySourceUri.replace( QLatin1String( "//" ), QLatin1String( "/" ) ); - } -#endif - - leBasePath->setText( mySourceUri ); -} - -/* - * - * Public and Private Slots - * - */ - -/** - * Slot called when a column is clicked in the tree displaying the attribute data - * \param item - The tree widget item click - * \param column - The column that was clicked - */ -void eVisGenericEventBrowserGui::launchExternalApplication( QTreeWidgetItem *item, int column ) -{ - // At this point there is only attribute data with no children, ignore clicks on field name - if ( 1 == column ) - { - int myIterator = 0; - bool startsWithExtension = false; - while ( myIterator < tableFileTypeAssociations->rowCount() ) - { - if ( item->text( column ).startsWith( tableFileTypeAssociations->item( myIterator, 0 )->text() + ':', Qt::CaseInsensitive ) ) - { - startsWithExtension = true; - break; - } - else if ( item->text( column ).endsWith( tableFileTypeAssociations->item( myIterator, 0 )->text(), Qt::CaseInsensitive ) ) - { - startsWithExtension = false; - break; - } - else - myIterator++; - } - - if ( myIterator != tableFileTypeAssociations->rowCount() ) - { - QProcess *myProcess = new QProcess(); - QString myApplication = tableFileTypeAssociations->item( myIterator, 1 )->text(); - QString myDocument = item->text( column ); - if ( startsWithExtension ) - { - myDocument = item->text( column ).remove( tableFileTypeAssociations->item( myIterator, 0 )->text() + ':', Qt::CaseInsensitive ); - } - - if ( "" != myApplication ) - { - if ( mConfiguration.isApplyPathRulesToDocsSet() ) - { - int myDocumentNameMarker = 0; - - if ( myDocument.contains( '/' ) ) - { - myDocumentNameMarker = myDocument.lastIndexOf( '/' ); - } - else - { - myDocumentNameMarker = myDocument.lastIndexOf( '\\' ); - } - - QString myDocumentName = myDocument; - myDocumentName.remove( 0, myDocumentNameMarker + 1 ); - if ( mConfiguration.isUseOnlyFilenameSet() ) - { - myDocument = mConfiguration.basePath() + myDocumentName; - } - else - { - if ( mConfiguration.isEventImagePathRelative() ) - { - myDocument = mConfiguration.basePath() + myDocument; - } - } - } - - myProcess->start( myApplication, QStringList() << myDocument ); - } - } - else - { - QMessageBox::information( this, tr( "Attribute Contents" ), item->text( column ) ); - } - } -} - -/** - * Slot called when the restore or save button is click on the options panel - * \param state - The new state of the checkbox - */ -void eVisGenericEventBrowserGui::buttonboxOptions_clicked( QAbstractButton *button ) -{ - if ( QDialogButtonBox::ResetRole == buttonboxOptions->buttonRole( button ) ) - { - restoreDefaultOptions(); - } - else if ( QDialogButtonBox::AcceptRole == buttonboxOptions->buttonRole( button ) ) - { - accept(); - } -} - -/** - * Slot called when the state changes for the chkboxApplyPathRulesToDocs checkbox. - * \param state - The new state of the checkbox - */ -void eVisGenericEventBrowserGui::chkboxApplyPathRulesToDocs_stateChanged( int state ) -{ - Q_UNUSED( state ) - mConfiguration.setApplyPathRulesToDocs( chkboxApplyPathRulesToDocs->isChecked() ); -} - -/** - * Slot called when the index changes for the cboxEventImagePathField combo box. - * \param index - The index of the new selected item - */ -void eVisGenericEventBrowserGui::cboxEventImagePathField_currentIndexChanged( int index ) -{ - Q_UNUSED( index ) - if ( !mIgnoreEvent ) - { - mConfiguration.setEventImagePathField( cboxEventImagePathField->currentText() ); - - QgsFields myFields = mVectorLayer->fields(); - QgsFeature *myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - - if ( !myFeature ) - return; - - QgsAttributes myAttrs = myFeature->attributes(); - for ( int i = 0; i < myAttrs.count(); ++i ) - { - if ( myFields.at( i ).name() == cboxEventImagePathField->currentText() ) - { - mEventImagePath = myAttrs.at( i ).toString(); - } - } - } -} - -/** - * Slot called when the index changes for the cboxCompassBearingField combo box. - * \param index - The index of the new selected item - */ -void eVisGenericEventBrowserGui::cboxCompassBearingField_currentIndexChanged( int index ) -{ - Q_UNUSED( index ) - if ( !mIgnoreEvent ) - { - mConfiguration.setCompassBearingField( cboxCompassBearingField->currentText() ); - - QgsFields myFields = mVectorLayer->fields(); - QgsFeature *myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - - if ( !myFeature ) - return; - - QgsAttributes myAttrs = myFeature->attributes(); - for ( int i = 0; i < myAttrs.count(); ++i ) - { - if ( myFields.at( i ).name() == cboxCompassBearingField->currentText() ) - { - mCompassBearing = myAttrs.at( i ).toDouble(); - } - } - } -} - -/** - * Slot called when the index changes for the cboxCompassBearingField combo box. - * \param index - The index of the new selected item - */ -void eVisGenericEventBrowserGui::cboxCompassOffsetField_currentIndexChanged( int index ) -{ - Q_UNUSED( index ) - if ( !mIgnoreEvent ) - { - mConfiguration.setCompassOffsetField( cboxCompassOffsetField->currentText() ); - - QgsFields myFields = mVectorLayer->fields(); - QgsFeature *myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - - if ( !myFeature ) - return; - - QgsAttributes myAttrs = myFeature->attributes(); - for ( int i = 0; i < myAttrs.count(); ++i ) - { - if ( myFields.at( i ).name() == cboxCompassOffsetField->currentText() ) - { - mCompassOffset = myAttrs.at( i ).toDouble(); - } - } - } -} - -/** - * Slot called when the chkDisplayCompassBearing radio button is toggled - * \param state - The current selection state of the radio button - */ -void eVisGenericEventBrowserGui::chkboxDisplayCompassBearing_stateChanged( int state ) -{ - Q_UNUSED( state ) - mConfiguration.setDisplayCompassBearing( chkboxDisplayCompassBearing->isChecked() ); - cboxCompassBearingField->setEnabled( chkboxDisplayCompassBearing->isChecked() ); -} - -/** - * Slot called when the state changes for the chkboxEventImagePathRelative checkbox. - * \param state - The new state of the checkbox - */ -void eVisGenericEventBrowserGui::chkboxEventImagePathRelative_stateChanged( int state ) -{ - Q_UNUSED( state ) - mConfiguration.setEventImagePathRelative( chkboxEventImagePathRelative->isChecked() ); - - if ( chkboxEventImagePathRelative->isChecked() && "" == leBasePath->text() ) - { - setBasePathToDataSource(); - } - -} - -/** - * Slot called when the state changes for the chkboxUseOnlyFilename checkbox. - * \param state - The new state of the checkbox - */ -void eVisGenericEventBrowserGui::chkboxUseOnlyFilename_stateChanged( int state ) -{ - Q_UNUSED( state ) - mConfiguration.setUseOnlyFilename( chkboxUseOnlyFilename->isChecked() ); -} - -/** - * Slot called when the tabs in the tabWidget are selected - * \param currentTabIndex - The index of the currently selected tab - */ -void eVisGenericEventBrowserGui::displayArea_currentChanged( int currentTabIndex ) -{ - //Force redraw when we switching back to the Display tab - if ( 0 == currentTabIndex ) - { - loadRecord(); - } -} - -/** - * Slot called when a manual compass offset is entered - * \param value - The new compass offset - */ -void eVisGenericEventBrowserGui::dsboxCompassOffset_valueChanged( double value ) -{ - mConfiguration.setCompassOffset( value ); -} - -/** - * Slot called the text in leBasePath is set or changed - * \param text - The new base path - */ -void eVisGenericEventBrowserGui::leBasePath_textChanged( const QString &text ) -{ - mConfiguration.setBasePath( text ); -} - -/** - * Slot called when the pbtnAddFileType button is clicked - adds a new row to the file associations table - */ -void eVisGenericEventBrowserGui::pbtnAddFileType_clicked() -{ - tableFileTypeAssociations->insertRow( tableFileTypeAssociations->rowCount() ); -} - -/** - * Slot called when the pbtnDeleteFileType button is clicked - removes arow from the file associations table - */ -void eVisGenericEventBrowserGui::pbtnDeleteFileType_clicked() -{ - if ( 1 <= tableFileTypeAssociations->rowCount() ) - { - tableFileTypeAssociations->removeRow( tableFileTypeAssociations->currentRow() ); - } - -} - -/** - * Slot called when the pbtnNext button is pressed - */ -void eVisGenericEventBrowserGui::pbtnNext_clicked() -{ - if ( mCurrentFeatureIndex != mFeatureIds.size() - 1 ) - { - pbtnPrevious->setEnabled( true ); - mCurrentFeatureIndex++; - - setWindowTitle( tr( "Event Browser - Displaying Records %1 of %2" ) - .arg( mCurrentFeatureIndex + 1, 2, 10, QChar( '0' ) ).arg( mFeatureIds.size(), 2, 10, QChar( '0' ) ) ); - - loadRecord(); - } - - if ( mCurrentFeatureIndex == mFeatureIds.size() - 1 ) - { - pbtnNext->setEnabled( false ); - } -} - -/** - * Slot called when the pbtnPrevious button is pressed - */ -void eVisGenericEventBrowserGui::pbtnPrevious_clicked() -{ - if ( mCurrentFeatureIndex > 0 ) - { - pbtnNext->setEnabled( true ); - mCurrentFeatureIndex--; - - setWindowTitle( tr( "Event Browser - Displaying Records %1 of %2" ) - .arg( mCurrentFeatureIndex + 1, 2, 10, QChar( '0' ) ).arg( mFeatureIds.size(), 2, 10, QChar( '0' ) ) ); - - loadRecord(); - } - - if ( mCurrentFeatureIndex == 0 ) - { - pbtnPrevious->setEnabled( false ); - } - -} - -void eVisGenericEventBrowserGui::pbtnResetApplyPathRulesToDocs_clicked() -{ - chkboxApplyPathRulesToDocs->setChecked( false ); -} - -void eVisGenericEventBrowserGui::pbtnResetBasePathData_clicked() -{ - leBasePath->clear(); - if ( chkboxEventImagePathRelative->isChecked() ) - { - setBasePathToDataSource(); - } -} - -void eVisGenericEventBrowserGui::pbtnResetCompassBearingData_clicked() -{ - cboxCompassBearingField->setEnabled( true ); - cboxCompassBearingField->setCurrentIndex( mDefaultCompassBearingField ); - cboxCompassBearingField->setEnabled( false ); - chkboxDisplayCompassBearing->setChecked( false ); -} - -void eVisGenericEventBrowserGui::pbtnResetCompassOffsetData_clicked() -{ - cboxCompassOffsetField->setEnabled( true ); - cboxCompassOffsetField->setCurrentIndex( mDefaultCompassOffsetField ); - cboxCompassOffsetField->setEnabled( false ); - rbtnManualCompassOffset->setChecked( true ); - dsboxCompassOffset->setValue( 0.0 ); -} - -void eVisGenericEventBrowserGui::pbtnResetEventImagePathData_clicked() -{ - chkboxEventImagePathRelative->setChecked( false ); - cboxEventImagePathField->setCurrentIndex( mDefaultEventImagePathField ); -} - -void eVisGenericEventBrowserGui::pbtnResetUseOnlyFilenameData_clicked() -{ - chkboxUseOnlyFilename->setChecked( false ); -} - -void eVisGenericEventBrowserGui::rbtnManualCompassOffset_toggled( bool state ) -{ - mConfiguration.setManualCompassOffset( state ); - mConfiguration.setAttributeCompassOffset( !state ); - - dsboxCompassOffset->setEnabled( state ); - cboxCompassOffsetField->setEnabled( !state ); -} - -/** - * Slot called when an entry in the file associations table is clicked - * \param row - the row that was clicked - * \param column - the column that was clicked - */ -void eVisGenericEventBrowserGui::tableFileTypeAssociations_cellDoubleClicked( int row, int column ) -{ - if ( 1 == column ) - { - QString myApplication = QFileDialog::getOpenFileName( this, tr( "Select Application" ), QDir::homePath(), tr( "All ( * )" ) ); - if ( "" != myApplication ) - { - tableFileTypeAssociations->setItem( row, column, new QTableWidgetItem( myApplication ) ); - } - - } -} - -/** - * This slot is coonnected to the map canvas. When the canvas is done drawing the slot is fired to display thee highlighting symbol - * \param painter - Pointer to the QPainter object - */ -void eVisGenericEventBrowserGui::renderSymbol( QPainter *painter ) -{ - - if ( !mFeatureIds.isEmpty() && mVectorLayer ) - { - //Get a pointer to the current feature - QgsFeature *myFeature = featureAtId( mFeatureIds.at( mCurrentFeatureIndex ) ); - - if ( !myFeature ) - return; - - QgsPointXY myPoint = myFeature->geometry().asPoint(); - myPoint = mCanvas->mapSettings().layerToMapCoordinates( mVectorLayer, myPoint ); - - mCanvas->getCoordinateTransform()->transform( &myPoint ); - - if ( mConfiguration.isDisplayCompassBearingSet() ) - { - //Make a copy of the pointersymbol and rotate it based on the values in the attribute field - QPixmap myTempPixmap( mPointerSymbol.height(), mPointerSymbol.height() ); - myTempPixmap.fill( QColor( 255, 255, 255, 0 ) ); - QPainter p( &myTempPixmap ); - QTransform wm; - wm.translate( myTempPixmap.width() / 2, myTempPixmap.height() / 2 ); // really center - - double myBearing = mCompassBearing; - if ( mConfiguration.isManualCompassOffsetSet() ) - { - myBearing = mCompassBearing + mConfiguration.compassOffset(); - } - else - { - myBearing = mCompassBearing + mCompassOffset; - } - - if ( myBearing < 0.0 ) - { - while ( myBearing < 0.0 ) - myBearing = 360.0 + myBearing; - } - else if ( myBearing >= 360.0 ) - { - while ( myBearing >= 360.0 ) - myBearing = myBearing - 360.0; - } - - wm.rotate( myBearing ); - - p.setWorldTransform( wm ); - p.drawPixmap( -mPointerSymbol.width() / 2, -mPointerSymbol.height() / 2, mPointerSymbol ); - - int xShift = static_cast( myPoint.x() ) - ( myTempPixmap.width() / 2 ); - int yShift = static_cast( myPoint.y() ) - ( myTempPixmap.height() / 2 ); - painter->drawPixmap( xShift, yShift, myTempPixmap ); - } - else - { - int xShift = static_cast( myPoint.x() ) - ( mHighlightSymbol.width() / 2 ); - int yShift = static_cast( myPoint.y() ) - ( mHighlightSymbol.height() / 2 ); - painter->drawPixmap( xShift, yShift, mHighlightSymbol ); - } - } -} diff --git a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h b/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h deleted file mode 100644 index ee1c0ab15668..000000000000 --- a/src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h +++ /dev/null @@ -1,181 +0,0 @@ -/* -** File: evisgenericeventbrowsergui.h -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-08 -** -** 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 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. -** -**/ -#ifndef eVisGenericEventBrowserGui_H -#define eVisGenericEventBrowserGui_H - -#include -#include - -#include "qgsmaptool.h" -#include "qgsfeature.h" -#include "qgisinterface.h" -#include "qgsvectordataprovider.h" - -#include "evisconfiguration.h" - -#include "ui_evisgenericeventbrowserguibase.h" - -class QgsMapCanvas; - -/** -* \class eVisGenericEventBrowserGui -* \brief Generic viewer for browsing event -* The eVisGenericEventBrowserGui is simply a window that will display an image referenced/stored -* in an attribute of a feature. Images can either loaded locally from disk or loaded via a URL. -* The eVisGenericEventBrowserGui also interacts with the map canvas to draw a highlighting symbol -* on the canvas. The highlighting symbol can also be a pointer showing the direction in which the -* image was taken by referencing a compass bearing recorded as an attribute of a feature. -*/ -class eVisGenericEventBrowserGui : public QDialog, private Ui::eVisGenericEventBrowserGuiBase -{ - Q_OBJECT - - public: - //! \brief Constructor called when button is pressed in the plugin toolbar - eVisGenericEventBrowserGui( QWidget *parent, QgisInterface *interface, Qt::WindowFlags fl ); - - //! \brief Constructor called when new browser is requested by the eVisEventIdTool - eVisGenericEventBrowserGui( QWidget *parent, QgsMapCanvas *canvas, Qt::WindowFlags fl ); - - ~eVisGenericEventBrowserGui() override; - - protected: - void closeEvent( QCloseEvent *event ) override; - - private: - //Variables - //! \brief A flag to bypass some signal/slots during gui initialization - bool mIgnoreEvent = false; - - //! \brief Pointer to the main configurations object - eVisConfiguration mConfiguration; - - //! \brief Flag indicating if the browser fully initialized - bool mBrowserInitialized = false; - - //! \brief Index of the attribute field name that closest 'matches' configuration of the parameter - int mDefaultCompassBearingField = 0; - - //! \brief Index of the attribute field name that closest 'matches' configuration of the parameter - int mDefaultCompassOffsetField = 0; - - //! \brief Index of the attribute field name that closest 'matches' configuration of the parameter - int mDefaultEventImagePathField = 0; - - //! \brief Pointer to the QgisInferface - QgisInterface *mInterface = nullptr; - - //! \brief Pointer to the map canvas - QgsMapCanvas *mCanvas = nullptr; - - //! \brief Pointer to the vector layer - QgsVectorLayer *mVectorLayer = nullptr; - - //! \brief Pointer to the vector data provider - QgsVectorDataProvider *mDataProvider = nullptr; - - //! \brief QPixmap holding the default highlighting symbol - QPixmap mHighlightSymbol; - - //! \brief QPixmap holding the pointer highlighting symbol - QPixmap mPointerSymbol; - - //! \brief Compass bearing value for the current feature - double mCompassBearing = 0; - - //! \brief Compass bearing offset retrieved from attribute - double mCompassOffset = 0; - - //! \brief QString holding the path to the image for the current feature - QString mEventImagePath; - - //! \brief List of current select featured ids - QList mFeatureIds; - - //! \brief Index of selected feature being viewed, used to access mFeatureIds - int mCurrentFeatureIndex = 0; - - //! \brief Current feature being viewed - QgsFeature mFeature; - - //Methods - //! \brief Applies parameters on the Options tabs and saves the configuration - void accept() override; - - //! \brief Modifies the Event Image Path according to the local and global settings - void buildEventImagePath(); - - //! \brief Method that loads the image in the browser - void displayImage(); - - //! \brief Generic method to get a feature by id. Access mLocalFeatureList when layer is of type delimitedtext otherwise calls existing methods in mDataProvider - QgsFeature *featureAtId( QgsFeatureId ); - - //! \brief Functionality common to both constructors - bool initBrowser(); - - //! Sets all of the gui objects based on the current configuration - void initOptionsTab(); - - //! \brief Method called to load data into the browser - void loadRecord(); - - //! \brief Reset all gui items on the options tab to a 'system default' - void restoreDefaultOptions(); - - //! Sets the base path to the path of the data source - void setBasePathToDataSource(); - - private slots: - void launchExternalApplication( QTreeWidgetItem *, int ); - void buttonboxOptions_clicked( QAbstractButton * ); - void chkboxApplyPathRulesToDocs_stateChanged( int ); - void cboxEventImagePathField_currentIndexChanged( int ); - void cboxCompassBearingField_currentIndexChanged( int ); - void cboxCompassOffsetField_currentIndexChanged( int ); - void chkboxDisplayCompassBearing_stateChanged( int ); - void chkboxEventImagePathRelative_stateChanged( int ); - void chkboxUseOnlyFilename_stateChanged( int ); - void displayArea_currentChanged( int ); - void dsboxCompassOffset_valueChanged( double ); - void leBasePath_textChanged( const QString & ); - void pbtnAddFileType_clicked(); - void pbtnDeleteFileType_clicked(); - void pbtnNext_clicked(); - void pbtnPrevious_clicked(); - void pbtnResetApplyPathRulesToDocs_clicked(); - void pbtnResetBasePathData_clicked(); - void pbtnResetCompassBearingData_clicked(); - void pbtnResetCompassOffsetData_clicked(); - void pbtnResetEventImagePathData_clicked(); - void pbtnResetUseOnlyFilenameData_clicked(); - void rbtnManualCompassOffset_toggled( bool ); - void tableFileTypeAssociations_cellDoubleClicked( int, int ); - //! \brief Slot called when the map canvas is done refreshing. Draws the highlighting symbol over the current selected feature - void renderSymbol( QPainter * ); -}; -#endif diff --git a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp b/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp deleted file mode 100644 index f3b662d3286d..000000000000 --- a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/* -** File: evisimagedisplaywidget.cpp -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-13 -** -** 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 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. -** -**/ -#include "evisimagedisplaywidget.h" - -#include "qgsapplication.h" -#include "qgsscrollarea.h" - -#include -#include -#include -#include - -/** -* Constructor -* \param parent - Pointer the to parent QWidget for modality -* \param fl - Windown flags -*/ -eVisImageDisplayWidget::eVisImageDisplayWidget( QWidget *parent, Qt::WindowFlags fl ) - : QWidget( parent, fl ) -{ - //Setup zoom buttons - pbtnZoomIn = new QPushButton(); - pbtnZoomOut = new QPushButton(); - pbtnZoomFull = new QPushButton(); - pbtnZoomIn->setEnabled( false ); - pbtnZoomOut->setEnabled( false ); - pbtnZoomFull->setEnabled( false ); - QString myThemePath = QgsApplication::defaultThemePath(); - pbtnZoomIn->setToolTip( tr( "Zoom in" ) ); - pbtnZoomIn->setWhatsThis( tr( "Zoom in to see more detail." ) ); - pbtnZoomOut->setToolTip( tr( "Zoom out" ) ); - pbtnZoomOut->setWhatsThis( tr( "Zoom out to see more area." ) ); - pbtnZoomFull->setToolTip( tr( "Zoom to full extent" ) ); - pbtnZoomFull->setWhatsThis( tr( "Zoom to display the entire image." ) ); - pbtnZoomIn->setIcon( QIcon( QPixmap( myThemePath + "/mActionZoomIn.svg" ) ) ); - pbtnZoomOut->setIcon( QIcon( QPixmap( myThemePath + "/mActionZoomOut.svg" ) ) ); - pbtnZoomFull->setIcon( QIcon( QPixmap( myThemePath + "/mActionZoomFullExtent.svg" ) ) ); - connect( pbtnZoomIn, &QAbstractButton::clicked, this, &eVisImageDisplayWidget::pbtnZoomIn_clicked ); - connect( pbtnZoomOut, &QAbstractButton::clicked, this, &eVisImageDisplayWidget::pbtnZoomOut_clicked ); - connect( pbtnZoomFull, &QAbstractButton::clicked, this, &eVisImageDisplayWidget::pbtnZoomFull_clicked ); - - //Setup zoom button layout - QWidget *myButtonBar = new QWidget(); - QHBoxLayout *myButtonBarLayout = new QHBoxLayout(); - myButtonBarLayout->addStretch(); - myButtonBarLayout->addWidget( pbtnZoomIn ); - myButtonBarLayout->addWidget( pbtnZoomOut ); - myButtonBarLayout->addWidget( pbtnZoomFull ); - myButtonBar->setLayout( myButtonBarLayout ); - - //setup display area - mDisplayArea = new QgsScrollArea(); - - QVBoxLayout *myLayout = new QVBoxLayout; - myLayout->addWidget( myButtonBar ); - myLayout->addWidget( mDisplayArea ); - setLayout( myLayout ); - - //setup label to hold image - mImageLabel = new QLabel(); - mImageLabel->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Ignored ); - mImageLabel->setScaledContents( true ); - mDisplayArea->setWidget( mImageLabel ); - - //setup image - mImageLoaded = false; - mImage = new QPixmap( mDisplayArea->size().width(), mDisplayArea->size().height() ); - mImage->fill(); - mImageLabel->setPixmap( *mImage ); - - //setup http connection - mHttpBuffer = new QBuffer(); - mHttpBuffer->open( QBuffer::ReadWrite ); - - //initialize remaining variables - mScaleByHeight = false; - mScaleByWidth = false; - mCurrentZoomStep = 0; - ZOOM_STEPS = 5; -} - -eVisImageDisplayWidget::~eVisImageDisplayWidget() -{ - - delete mImageLabel; - delete mImage; - delete mHttpBuffer; - delete pbtnZoomIn; - delete pbtnZoomOut; - delete pbtnZoomFull; - delete mDisplayArea; -} - -void eVisImageDisplayWidget::resizeEvent( QResizeEvent *event ) -{ - event->accept(); - setScalers(); - displayImage(); -} - -/** -* Public method called to display an image loaded locally from disk -* \param path - The path and filename of the image to load from disk -*/ -void eVisImageDisplayWidget::displayImage( const QString &path ) -{ - mImageLoaded = mImage->load( path, nullptr, Qt::AutoColor ); - setToolTip( path ); - - mCurrentZoomStep = 0; - pbtnZoomOut->setEnabled( false ); - pbtnZoomFull->setEnabled( false ); - if ( mImageLoaded ) - { - pbtnZoomIn->setEnabled( true ); - } - else - { - pbtnZoomIn->setEnabled( false ); - } - - setScalers(); - - displayImage(); -} - -/** -* Private method which scales and actually displays the image in the widget -*/ -void eVisImageDisplayWidget::displayImage() -{ - QSize mySize; - if ( mImageLoaded ) - { - //TODO: See about migrating these nasty scaling routines to use a QMatrix - if ( mScaleByWidth ) - { - mySize.setWidth( static_cast( mImage->width() * ( mScaleToFit + ( mScaleFactor * mCurrentZoomStep ) ) ) ); - mySize.setHeight( static_cast( static_cast( mySize.width() ) * mImageSizeRatio ) ); - } - else - { - mySize.setHeight( static_cast( mImage->height() * ( mScaleToFit + ( mScaleFactor * mCurrentZoomStep ) ) ) ); - mySize.setWidth( static_cast( static_cast( mySize.height() ) * mImageSizeRatio ) ); - } - } - else - { - mySize.setWidth( mDisplayArea->size().width() ); - mySize.setHeight( mDisplayArea->size().height() ); - mImage->fill(); - } - //the minus 4 is there to keep scroll bars from appearing at full extent view - mImageLabel->resize( mySize.width() - 4, mySize.height() - 4 ); - mImageLabel->setPixmap( *mImage ); -} - -/** -* Public method called to display an image loaded from a url -* \param url - The url from which to load an image -*/ -void eVisImageDisplayWidget::displayUrlImage( const QString &url ) -{ - Q_UNUSED( url ) -} - -/** -* Private method to set the scaling and zoom steps for each new image -*/ -void eVisImageDisplayWidget::setScalers() -{ - if ( mImageLoaded ) - { - double xRatio = static_cast( mDisplayArea->size().width() ) / static_cast( mImage->width() ); - double yRatio = static_cast( mDisplayArea->size().height() ) / static_cast( mImage->height() ); - if ( xRatio < yRatio ) - { - mScaleByWidth = true; - mScaleByHeight = false; - mImageSizeRatio = static_cast( mImage->height() ) / static_cast( mImage->width() ); - mScaleToFit = static_cast( mDisplayArea->size().width() ) / static_cast( mImage->width() ); - mScaleFactor = ( 1.0 - mScaleToFit ) / static_cast( ZOOM_STEPS ); - } - else - { - mScaleByWidth = false; - mScaleByHeight = true; - mImageSizeRatio = static_cast( mImage->width() ) / static_cast( mImage->height() ); - mScaleToFit = static_cast( mDisplayArea->size().height() ) / static_cast( mImage->height() ); - mScaleFactor = ( 1.0 - mScaleToFit ) / static_cast( ZOOM_STEPS ); - } - } -} - -/* - * - * Public and Private Slots - * - */ - -/** -* Slot called when a http request is complete -* \param requestId - The id of the http request -* \param error - Boolean denoting success of http request -*/ -void eVisImageDisplayWidget::displayUrlImage( int requestId, bool error ) -{ - //only process if no error and the request id matches the request id stored in displayUrlImage - if ( !error && requestId == mCurrentHttpImageRequestId ) - { - //reset to be beginning of the buffer - mHttpBuffer->seek( 0 ); - //load the image data from the buffer - mImageLoaded = mImage->loadFromData( mHttpBuffer->buffer() ); - - mCurrentZoomStep = 0; - pbtnZoomOut->setEnabled( false ); - pbtnZoomFull->setEnabled( false ); - if ( mImageLoaded ) - { - pbtnZoomIn->setEnabled( true ); - } - else - { - pbtnZoomIn->setEnabled( false ); - } - } - - setScalers(); - - displayImage(); -} - -/** -* Slot called when the pbtnZoomIn button is pressed -*/ -void eVisImageDisplayWidget::pbtnZoomIn_clicked() -{ - if ( mCurrentZoomStep < ZOOM_STEPS ) - { - pbtnZoomOut->setEnabled( true ); - pbtnZoomFull->setEnabled( true ); - mCurrentZoomStep++; - displayImage(); - } - - if ( mCurrentZoomStep == ZOOM_STEPS ) - { - pbtnZoomIn->setEnabled( false ); - } -} - -/** -* Slot called when the pbtnZoomOut button is pressed -*/ -void eVisImageDisplayWidget::pbtnZoomOut_clicked() -{ - if ( mCurrentZoomStep > 0 ) - { - pbtnZoomIn->setEnabled( true ); - mCurrentZoomStep--; - displayImage(); - } - - if ( mCurrentZoomStep == 0 ) - { - pbtnZoomOut->setEnabled( false ); - pbtnZoomFull->setEnabled( false ); - } -} - -/** -* Slot called when the pbtnZoomFull button is pressed -*/ -void eVisImageDisplayWidget::pbtnZoomFull_clicked() -{ - pbtnZoomOut->setEnabled( false ); - pbtnZoomFull->setEnabled( false ); - pbtnZoomIn->setEnabled( true ); - mCurrentZoomStep = 0; - displayImage(); -} diff --git a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h b/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h deleted file mode 100644 index 0628e65b2fd2..000000000000 --- a/src/plugins/evis/eventbrowser/evisimagedisplaywidget.h +++ /dev/null @@ -1,141 +0,0 @@ -/* -** File: evisimagedisplaywidget.h -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-13 -** -** 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 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. -** -**/ -#ifndef EVISIMAGEDISPLAYWIDGET_H -#define EVISIMAGEDISPLAYWIDGET_H - -#include -#include -#include -#include -#include - -class QgsScrollArea; - -/** -* \class eVisGenericEventBrowserGui -* \brief Generic viewer for browsing event -* The eVisImageDisplayWidget is a component of the eVisGenericEventBrowser. This widget provides -* the ability to display an image on the widget and basic zoom capabilities. This class was created -* so the same display features could be easily added to other widgets as needed. -*/ -class eVisImageDisplayWidget : public QWidget -{ - - Q_OBJECT - - public: - //! \brief Constructor - eVisImageDisplayWidget( QWidget *parent = nullptr, Qt::WindowFlags fl = nullptr ); - - ~eVisImageDisplayWidget() override; - - //! \brief Load an image from disk and display - void displayImage( const QString & ); - - //! \brief Load an image from a remote location using http and display - void displayUrlImage( const QString & ); - - /* - * There needs to be more logic around setting the zoom steps as you could change it mid display - * and end up getting not being able to zoom in or out - */ - //! \brief Accessor for ZOOM_STEPS - int getZoomSteps() { return ZOOM_STEPS; } - - //! \brief Mutator for ZOON_STEPS - void setZoomSteps( int steps ) { ZOOM_STEPS = steps; } - - protected: - void resizeEvent( QResizeEvent *event ) override; - - private: - - //! \brief Used to hold the http request to match the correct emits with the correct result - int mCurrentHttpImageRequestId = 0; - - //! \brief CUrrent Zoom level - int mCurrentZoomStep; - - //! \brief widget to display the image in - QgsScrollArea *mDisplayArea = nullptr; - - //! \brief Method that actually display the image in the widget - void displayImage(); - - //! \brief Pointer to the http buffer - QBuffer *mHttpBuffer = nullptr; - - //! \brief This is a point to the actual image being displayed - QPixmap *mImage = nullptr; - - //! \brief Label to hold the image - QLabel *mImageLabel = nullptr; - - //! \brief Flag to indicate the success of the last load request - bool mImageLoaded; - - //! \brief Ratio if height to width or width to height for the original image, which ever is smaller - double mImageSizeRatio = 0.0; - - //! \brief Boolean to indicate which feature the mImageSizeRation corresponds to - bool mScaleByHeight; - - //! \brief Boolean to indicate which feature the mImageSizeRation corresponds to - bool mScaleByWidth; - - //! \brief The increment by which the image is scaled during each scaling event - double mScaleFactor = 1.0; - - //! \brief The single factor by which the original image needs to be scaled to fit into current display area - double mScaleToFit = 0.0; - - //! \brief Zoom in button - QPushButton *pbtnZoomIn = nullptr; - - //! \brief Zoom out button - QPushButton *pbtnZoomOut = nullptr; - - //! \brief Zoom to full extent button - QPushButton *pbtnZoomFull = nullptr; - - //! \brief Method called to compute the various scaling parameters - void setScalers(); - - //! \brief The number of steps between the scale to fit image and full resolution - int ZOOM_STEPS; - - private slots: - void pbtnZoomIn_clicked(); - - void pbtnZoomOut_clicked(); - - void pbtnZoomFull_clicked(); - - //! \brief Slot called when the http request is completed - void displayUrlImage( int, bool ); -}; -#endif diff --git a/src/plugins/evis/evis.cpp b/src/plugins/evis/evis.cpp deleted file mode 100644 index cfb8d208799f..000000000000 --- a/src/plugins/evis/evis.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/* -** File: evis.cpp -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-06 -** -** 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 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. -** -**/ - -//This file was created using the plugin generator distributed with QGIS evis.h -//is based on and a modification of the default plugin.h file which carried the -//following header -/*************************************************************************** - evis.cpp - An event visualization plugin for QGIS - - ------------------- - begin : [PluginDate] - copyright : [( C ) Your Name and Date] - email : [Your Email] - - *************************************************************************** - * * - * 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 "evis.h" - -// -// QGIS Specific includes -// -#include "qgsapplication.h" -#include "qgsrasterlayer.h" -#include "qgisinterface.h" -#include "qgsmaplayer.h" -#include "qgsguiutils.h" - -//the gui subclass -#include "evisdatabaseconnectiongui.h" -#include "evisgenericeventbrowsergui.h" -#include "eviseventidtool.h" - -// -// Qt Related Includes -// -#include -#include -#include -#include -#include -#include -#include -#include - -static const QString sName = QObject::tr( "eVis" ); -static const QString sDescription = QObject::tr( "An event visualization tool - view images associated with vector features" ); -static const QString sCategory = QObject::tr( "Database" ); -static const QString sPluginVersion = QObject::tr( "Version 1.1.0" ); -static const QgisPlugin::PluginType sPluginType = QgisPlugin::UI; -static const QString sIcon = QStringLiteral( ":/evis/eVisEventBrowser.png" ); - - - -eVis::eVis( QgisInterface *qgisInterface ) - : QgisPlugin( sName, sDescription, sCategory, sPluginVersion, sPluginType ) - , mQGisIface( qgisInterface ) -{ - mIdTool = nullptr; -} - -void eVis::initGui() -{ - delete mDatabaseConnectionActionPointer; - delete mEventIdToolActionPointer; - delete mEventBrowserActionPointer; - - // Create the action for tool - mDatabaseConnectionActionPointer = new QAction( QIcon( ":/evis/eVisDatabaseConnection.png" ), tr( "eVis Database Connection" ), this ); - mDatabaseConnectionActionPointer->setObjectName( QStringLiteral( "mDatabaseConnectionActionPointer" ) ); - mEventIdToolActionPointer = new QAction( QIcon( ":/evis/eVisEventIdTool.png" ), tr( "eVis Event Id Tool" ), this ); - mEventIdToolActionPointer->setObjectName( QStringLiteral( "mEventIdToolActionPointer" ) ); - mEventBrowserActionPointer = new QAction( QIcon( ":/evis/eVisEventBrowser.png" ), tr( "eVis Event Browser" ), this ); - mEventBrowserActionPointer->setObjectName( QStringLiteral( "mEventBrowserActionPointer" ) ); - - // Set the what's this text - mDatabaseConnectionActionPointer->setWhatsThis( tr( "Create layer from a database query" ) ); - mEventIdToolActionPointer->setWhatsThis( tr( "Open an Event Browser and display the selected feature" ) ); - mEventBrowserActionPointer->setWhatsThis( tr( "Open an Event Browser to explore the current layer's features" ) ); - - // Connect the action to the runmQGisIface->mapCanvas() - connect( mDatabaseConnectionActionPointer, &QAction::triggered, this, &eVis::launchDatabaseConnection ); - connect( mEventIdToolActionPointer, &QAction::triggered, this, &eVis::launchEventIdTool ); - connect( mEventBrowserActionPointer, &QAction::triggered, this, &eVis::launchEventBrowser ); - - - // Add the icon to the toolbar - mQGisIface->addDatabaseToolBarIcon( mDatabaseConnectionActionPointer ); - mQGisIface->addDatabaseToolBarIcon( mEventIdToolActionPointer ); - mQGisIface->addDatabaseToolBarIcon( mEventBrowserActionPointer ); - - mQGisIface->addPluginToDatabaseMenu( QStringLiteral( "&eVis" ), mDatabaseConnectionActionPointer ); - mQGisIface->addPluginToDatabaseMenu( QStringLiteral( "&eVis" ), mEventIdToolActionPointer ); - mQGisIface->addPluginToDatabaseMenu( QStringLiteral( "&eVis" ), mEventBrowserActionPointer ); - - mEventIdToolActionPointer->setCheckable( true ); -} - -//method defined in interface -void eVis::help() -{ - //implement me! -} - -void eVis::launchDatabaseConnection() -{ - eVisDatabaseConnectionGui *myPluginGui = new eVisDatabaseConnectionGui( &mTemporaryFileList, mQGisIface->mainWindow(), QgsGuiUtils::ModalDialogFlags ); - myPluginGui->setAttribute( Qt::WA_DeleteOnClose ); - - connect( myPluginGui, &eVisDatabaseConnectionGui::drawVectorLayer, this, &eVis::drawVectorLayer ); - myPluginGui->show(); -} - -void eVis::launchEventIdTool() -{ - if ( !mIdTool ) - { - mIdTool = new eVisEventIdTool( mQGisIface->mapCanvas() ); - mIdTool->setAction( mEventIdToolActionPointer ); - } - else - { - mQGisIface->mapCanvas()->setMapTool( mIdTool ); - } -} - -void eVis::launchEventBrowser() -{ - eVisGenericEventBrowserGui *myPluginGui = new eVisGenericEventBrowserGui( mQGisIface->mainWindow(), mQGisIface, QgsGuiUtils::ModalDialogFlags ); - myPluginGui->setAttribute( Qt::WA_DeleteOnClose ); -} - -void eVis::unload() -{ - // remove the GUI - mQGisIface->removePluginDatabaseMenu( QStringLiteral( "&eVis" ), mDatabaseConnectionActionPointer ); - mQGisIface->removeDatabaseToolBarIcon( mDatabaseConnectionActionPointer ); - delete mDatabaseConnectionActionPointer; - - mQGisIface->removePluginDatabaseMenu( QStringLiteral( "&eVis" ), mEventIdToolActionPointer ); - mQGisIface->removeDatabaseToolBarIcon( mEventIdToolActionPointer ); - delete mEventIdToolActionPointer; - - mQGisIface->removePluginDatabaseMenu( QStringLiteral( "&eVis" ), mEventBrowserActionPointer ); - mQGisIface->removeDatabaseToolBarIcon( mEventBrowserActionPointer ); - delete mEventBrowserActionPointer; - - while ( !mTemporaryFileList.isEmpty() ) - { - delete ( mTemporaryFileList.takeLast() ); - } - - delete mIdTool; -} - -void eVis::drawVectorLayer( const QString &pathNameQString, const QString &baseNameQString, const QString &providerQString ) -{ - mQGisIface->addVectorLayer( pathNameQString, baseNameQString, providerQString ); -} - - -////////////////////////////////////////////////////////////////////////// -// -// -// THE FOLLOWING CODE IS AUTOGENERATED BY THE PLUGIN BUILDER SCRIPT -// YOU WOULD NORMALLY NOT NEED TO MODIFY THIS, AND YOUR PLUGIN -// MAY NOT WORK PROPERLY IF YOU MODIFY THIS INCORRECTLY -// -// -////////////////////////////////////////////////////////////////////////// - -/** - * Required extern functions needed for every plugin - * These functions can be called prior to creating an instance - * of the plugin class - */ -// Class factory to return a new instance of the plugin class -QGISEXTERN QgisPlugin *classFactory( QgisInterface *qgisInterfacePointer ) -{ - return new eVis( qgisInterfacePointer ); -} -// Return the name of the plugin - note that we do not user class members as -// the class may not yet be insantiated when this method is called. -QGISEXTERN QString name() -{ - return sName; -} - -// Return the description -QGISEXTERN QString description() -{ - return sDescription; -} - -// Return the category -QGISEXTERN QString category() -{ - return sCategory; -} - -// Return the type ( either UI or MapLayer plugin ) -QGISEXTERN int type() -{ - return sPluginType; -} - -// Return the icon -QGISEXTERN QString icon() -{ - return sIcon; -} - -// Return the version number for the plugin -QGISEXTERN QString version() -{ - return sPluginVersion; -} - -// Delete ourself -QGISEXTERN void unload( QgisPlugin *pluginPointer ) -{ - delete pluginPointer; -} diff --git a/src/plugins/evis/evis.h b/src/plugins/evis/evis.h deleted file mode 100644 index 738a5885ca15..000000000000 --- a/src/plugins/evis/evis.h +++ /dev/null @@ -1,130 +0,0 @@ -/* -** File: evis.h -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-06 -** -** 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 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. -** -**/ - -//This file was created using the plugin generator distributed with QGIS evis.h -//is based on and a modification of the default plugin.h file which carried the -//following header -/*************************************************************************** - plugin.h - Functions: - ------------------- - begin : Jan 21, 2004 - copyright : ( C ) 2004 by Tim Sutton - email : tim at linfiniti.com - ***************************************************************************/ - -/*************************************************************************** - * * - * 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. * - * * - ***************************************************************************/ - -/*************************************************************************** - * QGIS Programming conventions: - * - * mVariableName - a class level member variable - * sVariableName - a static class level member variable - * variableName() - accessor for a class member ( no 'get' in front of name ) - * setVariableName() - mutator for a class member ( prefix with 'set' ) - * - * Additional useful conventions: - * - * variableName - a method parameter ( prefix with 'the' ) - * myVariableName - a locally declared variable within a method ( 'my' prefix ) - * - * DO: Use mixed case variable names - myVariableName - * DON'T: separate variable names using underscores: my_variable_name ( NO! ) - * - * **************************************************************************/ -#ifndef eVis_H -#define eVis_H - -#include - -#include - -#include "qgisplugin.h" -#include "qgisinterface.h" - -//forward declarations -class QAction; -class QToolBar; -class eVisEventIdTool; - -/** -* \class eVis -* \brief eVis plugin for QGIS -* This plugin allows for generic database connectivity and also provides a browser in which -* users can load and view photos referenced as attributes for a feature. The browser also -* has the ability to interact with the map canvas and display an arrow point in the direction -* in which a photograph was taken -*/ -class eVis: public QObject, public QgisPlugin -{ - Q_OBJECT - public: - - //! Constructor - explicit eVis( QgisInterface *interface ); - - public slots: - //! init the gui - void initGui() override; - - //! Main button actions - void launchDatabaseConnection(); - void launchEventIdTool(); - void launchEventBrowser(); - - //! unload the plugin - void unload() override; - - //! show the help document - void help(); - - //! Add a vector layer given vectorLayerPath, baseName, providerKey ( "ogr" or "postgres" ); - void drawVectorLayer( const QString &, const QString &, const QString & ); - - private: - - QgisInterface *mQGisIface = nullptr; - - QAction *mDatabaseConnectionActionPointer = nullptr; - - QAction *mEventIdToolActionPointer = nullptr; - - QAction *mEventBrowserActionPointer = nullptr; - - eVisEventIdTool *mIdTool = nullptr; - - //! List of pointers to temporary files, files are created by database queries */ - QList mTemporaryFileList; -}; -#endif //eVis_H diff --git a/src/plugins/evis/idtool/eviseventidtool.cpp b/src/plugins/evis/idtool/eviseventidtool.cpp deleted file mode 100644 index 05b13dec591d..000000000000 --- a/src/plugins/evis/idtool/eviseventidtool.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * -** File: eviseventidtool.cpp -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-19 -** -** 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. -** -**/ - - -#include -#include - -#include "eviseventidtool.h" - -#include "qgsmaptopixel.h" -#include "qgsmaptool.h" -#include "qgsvectorlayer.h" -#include "qgsvectordataprovider.h" -#include "qgsfeatureiterator.h" -#include "qgsmapmouseevent.h" -#include "qgsapplication.h" - - -/** -* Constructor for the id style tool, this tool inherits the QgsMapTool and requires a pointer to -* to the map canvas. -* \param canvas - Pointer to the QGIS map canvas -*/ -eVisEventIdTool::eVisEventIdTool( QgsMapCanvas *canvas ) - : QgsMapTool( canvas ) -{ - //set cursor - setCursor( QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify ) ); - - //set the current tool to this object - if ( mCanvas ) - { - mCanvas->setMapTool( this ); - } -} - -/** -* Mouse release, i.e., select, event -* \param mouseEvent - Pointer to a QMouseEvent -*/ -void eVisEventIdTool::canvasReleaseEvent( QgsMapMouseEvent *mouseEvent ) -{ - if ( !mCanvas || !mouseEvent ) - return; - -//Check to see if there is a layer selected - if ( mCanvas->currentLayer() ) - { - //Check to see if the current layer is a vector layer - if ( QgsMapLayerType::VectorLayer == mCanvas->currentLayer()->type() ) - { - select( mCanvas->getCoordinateTransform()->toMapCoordinates( mouseEvent->x(), mouseEvent->y() ) ); - } - else - { - QMessageBox::warning( mCanvas, QObject::tr( "eVis Event Id Tool" ), QObject::tr( "This tool only supports vector data." ) ); - } - } - else - { - QMessageBox::warning( mCanvas, QObject::tr( "eVis Event Id Tool" ), QObject::tr( "No active layers found." ) ); - } -} - -/** -* Selection routine called by the mouse release event -* \param point = QgsPointXY representing the x, y coordinates of the mouse release event -*/ -void eVisEventIdTool::select( const QgsPointXY &point ) -{ - - if ( !mCanvas ) - return; - - QgsVectorLayer *myLayer = ( QgsVectorLayer * )mCanvas->currentLayer(); - - // create the search rectangle. this was modeled after the QgsMapIdentifyTool in core QGIS application - double searchWidth = QgsMapTool::searchRadiusMU( mCanvas ); - - QgsRectangle myRectangle; - myRectangle.setXMinimum( point.x() - searchWidth ); - myRectangle.setXMaximum( point.x() + searchWidth ); - myRectangle.setYMinimum( point.y() - searchWidth ); - myRectangle.setYMaximum( point.y() + searchWidth ); - - //Transform rectangle to map coordinates - myRectangle = toLayerCoordinates( myLayer, myRectangle ); - - //select features - QgsFeatureIterator fit = myLayer->getFeatures( QgsFeatureRequest().setFilterRect( myRectangle ).setFlags( QgsFeatureRequest::ExactIntersect ).setNoAttributes() ); - - QgsFeature f; - QgsFeatureIds newSelectedFeatures; - while ( fit.nextFeature( f ) ) - { - newSelectedFeatures.insert( f.id() ); - } - - myLayer->selectByIds( newSelectedFeatures ); - - //Launch a new event browser to view selected features - mBrowser = new eVisGenericEventBrowserGui( mCanvas, mCanvas, nullptr ); - mBrowser->setAttribute( Qt::WA_DeleteOnClose ); -} diff --git a/src/plugins/evis/idtool/eviseventidtool.h b/src/plugins/evis/idtool/eviseventidtool.h deleted file mode 100644 index b530895004ed..000000000000 --- a/src/plugins/evis/idtool/eviseventidtool.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -** File: eviseventidtool.h -** Author: Peter J. Ersts ( ersts at amnh.org ) -** Creation Date: 2007-03-19 -** -** 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 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. -** -**/ -#ifndef EVISEVENTIDTOOL_H -#define EVISEVENTIDTOOL_H - -#include -#include - -#include "qgsmaptool.h" -#include "qgsmapcanvas.h" -#include "qgspointxy.h" - -#include "evisgenericeventbrowsergui.h" - -class QgsMapLayer; - -/** -* \class eVisEventIdTool -* \brief Map tool for launching event browser -* The eVisEventIdTool is an id style map tool that is used to select point and launch the generic event browser -* to view the associated attributes for each selected feature, specifically features with associated photographic data -*/ -class eVisEventIdTool : public QgsMapTool -{ - Q_OBJECT - - public: - //! \brief Constructor - explicit eVisEventIdTool( QgsMapCanvas * ); - - //! \brief Method to handle mouse release, i.e., select, event - void canvasReleaseEvent( QgsMapMouseEvent * ) override; - - private: - - //! \brief Pointer to a generic event browser - eVisGenericEventBrowserGui *mBrowser = nullptr; - - //! \brief Selection routine called by the mouse release event - void select( const QgsPointXY & ); -}; -#endif diff --git a/src/plugins/evis/resources/eVisDatabaseConnection.png b/src/plugins/evis/resources/eVisDatabaseConnection.png deleted file mode 100644 index 6674bfc16974..000000000000 Binary files a/src/plugins/evis/resources/eVisDatabaseConnection.png and /dev/null differ diff --git a/src/plugins/evis/resources/eVisEventBrowser.png b/src/plugins/evis/resources/eVisEventBrowser.png deleted file mode 100644 index 3e2387fc965d..000000000000 Binary files a/src/plugins/evis/resources/eVisEventBrowser.png and /dev/null differ diff --git a/src/plugins/evis/resources/eVisEventIdTool.png b/src/plugins/evis/resources/eVisEventIdTool.png deleted file mode 100644 index 692cdc5ad178..000000000000 Binary files a/src/plugins/evis/resources/eVisEventIdTool.png and /dev/null differ diff --git a/src/plugins/evis/resources/eVisHighlightSymbol.png b/src/plugins/evis/resources/eVisHighlightSymbol.png deleted file mode 100644 index 86d4e993e2a8..000000000000 Binary files a/src/plugins/evis/resources/eVisHighlightSymbol.png and /dev/null differ diff --git a/src/plugins/evis/resources/eVisPointerSymbol.png b/src/plugins/evis/resources/eVisPointerSymbol.png deleted file mode 100644 index 52dca8fddaaf..000000000000 Binary files a/src/plugins/evis/resources/eVisPointerSymbol.png and /dev/null differ diff --git a/src/plugins/evis/resources/evis.qrc b/src/plugins/evis/resources/evis.qrc deleted file mode 100644 index 10edbbeb6a80..000000000000 --- a/src/plugins/evis/resources/evis.qrc +++ /dev/null @@ -1,9 +0,0 @@ - - - eVisDatabaseConnection.png - eVisEventIdTool.png - eVisEventBrowser.png - eVisPointerSymbol.png - eVisHighlightSymbol.png - - diff --git a/src/plugins/evis/ui/evisdatabaseconnectionguibase.ui b/src/plugins/evis/ui/evisdatabaseconnectionguibase.ui deleted file mode 100644 index b4e4c88bc5b1..000000000000 --- a/src/plugins/evis/ui/evisdatabaseconnectionguibase.ui +++ /dev/null @@ -1,512 +0,0 @@ - - eVisDatabaseConnectionGuiBase - - - - 0 - 0 - 478 - 548 - - - - Database Connection - - - - :/evis/eVisDatabaseConnection.png:/evis/eVisDatabaseConnection.png - - - - 9 - - - 6 - - - - - QFrame::Panel - - - QFrame::Sunken - - - 1 - - - - - 0 - 0 - 470 - 237 - - - - Predefined Queries - - - - 9 - - - 6 - - - - - - 0 - 0 - - - - Load predefined queries - - - Loads an XML file with predefined queries. Use the Open File window to locate the XML file that contains one or more predefined queries using the format described in the user guide. - - - - - - - :/images/themes/default/mActionFolder.svg:/images/themes/default/mActionFolder.svg - - - - - - - - 0 - 0 - - - - - - - - - - - - - - The description of the selected query. - - - - - - - - - - Select the predefined query you want to use from the drop-down list containing queries identified from the file loaded using the Open File icon above. To run the query you need to click on the SQL Query tab. The query will be automatically entered in the query window. - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 45 - 0 - - - - - - - - Qt::Horizontal - - - - 401 - 0 - - - - - - - - - - 0 - 0 - 446 - 237 - - - - Database Connection - - - - 9 - - - 6 - - - - - not connected - - - Qt::AutoText - - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">Connection Status: </span></p></body></html> - - - - - - - Database Host - - - - - - - Enter the database host. If the database resides on your desktop you should enter ¨localhost¨. If you selected ¨MSAccess¨ as the database type this option will not be available. - - - - - - - - - - Password to access the database. - - - QLineEdit::Password - - - - - - - Enter the name of the database. - - - - - - - Qt::Vertical - - - - 20 - 51 - - - - - - - - Username - - - - - - - Enter the port through which the database must be accessed if a MYSQL database is used. - - - - - - - - - - Connect to the database using the parameters selected above. If the connection was successful a message will be displayed in the Output Console below saying the connection was established. - - - Connect - - - - - - - - - - User name to access the database. - - - - - - - Select the type of database from the list of supported databases in the drop-down menu. - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Database Name - - - - - - - Password - - - - - - - Database Type - - - - - - - Port - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - :/images/themes/default/mActionFolder.svg:/images/themes/default/mActionFolder.svg - - - - - - - - - 0 - 0 - 470 - 237 - - - - SQL Query - - - - 9 - - - 6 - - - - - Qt::Horizontal - - - - 341 - 20 - - - - - - - - Run the query entered above. The status of the query will be displayed in the Output Console below. - - - Run Query - - - - - - - - - - Enter the query you want to run in this window. - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Help|QDialogButtonBox::Ok - - - - - - - Qt::Vertical - - - - 0 - 53 - - - - - - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - A window for status messages to be displayed. - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 0 - 125 - - - - - - - - Output Console - - - - - - - Qt::Vertical - - - QSizePolicy::Maximum - - - - 0 - 314 - - - - - - - - Qt::Vertical - - - - 0 - 530 - - - - - - - - - teditConsole - cboxDatabaseType - leDatabaseHost - leDatabasePort - leDatabaseName - leDatabaseUsername - leDatabasePassword - pbtnConnect - teditSqlStatement - pbtnRunQuery - buttonBox - - - - - - - diff --git a/src/plugins/evis/ui/evisdatabaselayerfieldselectionguibase.ui b/src/plugins/evis/ui/evisdatabaselayerfieldselectionguibase.ui deleted file mode 100644 index 2179ca13c810..000000000000 --- a/src/plugins/evis/ui/evisdatabaselayerfieldselectionguibase.ui +++ /dev/null @@ -1,147 +0,0 @@ - - - eVisDatabaseLayerFieldSelectionGuiBase - - - Qt::WindowModal - - - - 0 - 0 - 319 - 185 - - - - Database File Selection - - - - :/evis/eVisDatabaseConnection.png:/evis/eVisDatabaseConnection.png - - - - 9 - - - 9 - - - 9 - - - 9 - - - 6 - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - - The name of the field that contains the Y coordinate of the points. - - - - - - - - - - - - - The name of the field that contains the X coordinate of the points. - - - - - - - - - - Enter the name for the new layer that will be created and displayed in QGIS. - - - - - - - Y Coordinate - - - - - - - X Coordinate - - - - - - - Name of New Layer - - - - - - - leLayerName - cboxXCoordinate - cboxYCoordinate - - - - - - - buttonBox - accepted() - eVisDatabaseLayerFieldSelectionGuiBase - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - eVisDatabaseLayerFieldSelectionGuiBase - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/plugins/evis/ui/evisgenericeventbrowserguibase.ui b/src/plugins/evis/ui/evisgenericeventbrowserguibase.ui deleted file mode 100644 index b9f00be85d60..000000000000 --- a/src/plugins/evis/ui/evisgenericeventbrowserguibase.ui +++ /dev/null @@ -1,1037 +0,0 @@ - - - eVisGenericEventBrowserGuiBase - - - - 0 - 0 - 801 - 654 - - - - - - - - :/evis/eVisEventBrowser.png:/evis/eVisEventBrowser.png - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - - - - 0 - - - - Display - - - - - - Qt::Horizontal - - - QDialogButtonBox::Close - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 125 - - - - - 16777215 - 125 - - - - - - - All of the attribute information for the point associated with the photo being viewed is displayed here. If the file type being referenced in the displayed record is not an image but is of a file type defined in the “Configure External Applications” tab then when you double-click on the value of the field containing the path to the file the application to open the file will be launched to view or hear the contents of the file. If the file extension is recognized the attribute data will be displayed in green. - - - - 1 - - - - - - - - - 0 - 0 - - - - - - - Use the Next button to display the next photo when more than one photo is available for display. - - - - - - - :/images/themes/default/mActionArrowRight.svg:/images/themes/default/mActionArrowRight.svg - - - - - - - - - - - - - - - 0 - 0 - - - - - - - Use the Previous button to display the previous photo when more than one photo is available for display. - - - - - - - :/images/themes/default/mActionArrowLeft.svg:/images/themes/default/mActionArrowLeft.svg - - - - - - - - 0 - 0 - - - - Image display area - - - Display area for the image. - - - - - - - - - - Options - - - - - - File path - - - - - - Attribute containing path to file - - - - - - - Qt::Horizontal - - - - 288 - 20 - - - - - - - - - 0 - 0 - - - - Reset to default - - - - - - Resets the values on this line to the default setting. - - - Reset - - - - :/images/themes/default/mActionUndo.svg:/images/themes/default/mActionUndo.svg - - - - 16 - 16 - - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - <html><head/><body><p>Use the drop-down list to select the field containing a directory path to the image. This can be an absolute or relative path.</p></body></html> - - - - - - - - - - <html><head/><body><p>If checked the path to the image will be defined appending the attribute in the field selected from the “Attribute Containing Path to Image” drop-down list to the “Base Path” defined below.</p></body></html> - - - - - - Path is relative - - - - - - - If checked, the relative path values will be saved for the next session. - - - - - - Qt::LeftToRight - - - Remember this - - - - - - - Qt::Horizontal - - - - 251 - 20 - - - - - - - - - - - Compass bearing - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - <html><head/><body><p>Use the drop-down list to select the field containing the compass bearing for the image.</p><p>This bearing usually references the direction the camera was pointing when the image was acquired. </p></body></html> - - - - - - - - - - Qt::Horizontal - - - - 121 - 20 - - - - - - - - - 0 - 0 - - - - Reset to default - - - Resets the values on this line to the default setting. - - - Reset - - - - :/images/themes/default/mActionUndo.svg:/images/themes/default/mActionUndo.svg - - - - 16 - 16 - - - - - - - - Attribute containing compass bearing - - - - - - - <html><head/><body><p>If checked an arrow pointing in the direction defined by the attribute in the field selected from the drop-down list</p><p>to the right will be displayed in the QGIS window on top of the point for this image.</p></body></html> - - - - - - Display compass bearing - - - - - - - If checked, the Display Compass Bearing values will be saved for the next session. - - - - - - Qt::LeftToRight - - - Remember this - - - - - - - Qt::Horizontal - - - - 268 - 24 - - - - - - - - - - - Compass offset - - - - - - If checked, the compass offset values will be saved for the next session. - - - - - - Qt::LeftToRight - - - Remember this - - - - - - - Define the compass offset using a field from the vector layer attribute table. - - - - - - From Attribute - - - - - - - - 0 - 0 - - - - Reset to default - - - Resets the compass offset values to the default settings. - - - Reset - - - - :/images/themes/default/mActionUndo.svg:/images/themes/default/mActionUndo.svg - - - - 16 - 16 - - - - - - - - Qt::Horizontal - - - - 424 - 20 - - - - - - - - Qt::Horizontal - - - - 281 - 20 - - - - - - - - - 0 - 0 - - - - <html><head/><body><p>A value to be added to the compass bearing.</p><p>This allows you to compensate for declination (adjust bearings collected using magnetic bearings to true north bearings). East declinations should be entered using positive values and west declinations should use negative values. </p></body></html> - - - - - - 1 - - - -180.000000000000000 - - - 180.000000000000000 - - - 1.000000000000000 - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - <html><head/><body><p>Use the drop-down list to select the field containing the compass bearing offset.</p><p>This allows you to compensate for declination (adjust bearings collected using magnetic bearings to true north bearings). East declinations should be entered using positive values and west declinations should use negative values. </p></body></html> - - - - - - - - - - Define the compass offset manually. - - - - - - Manual - - - - - - - Qt::Horizontal - - - - 430 - 20 - - - - - - - - - - - Relative paths - - - - - - The base path or url from which images and documents can be “relative” - - - - - - - Qt::Horizontal - - - - 131 - 20 - - - - - - - - Base Path - - - - - - - - 10 - 0 - - - - The Base Path onto which the relative path defined above will be appended. - - - - - - - - - - If checked, the Base Path will be saved for the next session. - - - - - - Qt::LeftToRight - - - Remember this - - - - - - - - 0 - 0 - - - - Reset to default - - - Enters the default “Base Path” which is the path to the directory of the vector layer containing the image information. - - - Reset - - - - :/images/themes/default/mActionUndo.svg:/images/themes/default/mActionUndo.svg - - - - 16 - 16 - - - - - - - - - 0 - 0 - - - - <html><head/><body><p>If checked, the Base Path will append only the file name instead of the entire relative path (defined above) to create the full directory path to the file. </p></body></html> - - - - - - Replace entire path/url stored in image path attribute with user defined -Base Path (i.e. keep only filename from attribute) - - - - - - - If checked, the current checkbox setting will be saved for the next session. - - - - - - Qt::LeftToRight - - - Remember this - - - - - - - - 0 - 0 - - - - Reset to default - - - Clears the checkbox on this line. - - - Reset - - - - :/images/themes/default/mActionUndo.svg:/images/themes/default/mActionUndo.svg - - - - 16 - 16 - - - - - - - - - 0 - 0 - - - - <html><head/><body><p>If checked, the same path rules that are defined for images will be used for non-image documents such as movies, text documents, and sound files.</p><p>If not checked the path rules will only apply to images and other documents will ignore the Base Path parameter.</p></body></html> - - - - - - Apply Path to Image rules when loading docs in external applications - - - - - - - If checked, the current checkbox setting will be saved for the next session. - - - - - - Qt::LeftToRight - - - Remember this - - - - - - - - 0 - 0 - - - - Reset to default - - - Clears the checkbox on this line. - - - Reset - - - - :/images/themes/default/mActionUndo.svg:/images/themes/default/mActionUndo.svg - - - - 16 - 16 - - - - - - - - - - - Qt::Horizontal - - - - - - - <html><head/><body><p>Clicking on Save will save the settings without closing the Options pane.</p><p>Clicking on Restore Defaults will reset all of the fields to their default settings.</p><p>It has the same effect as clicking all of the “Reset to default” buttons. </p></body></html> - - - - - - QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save - - - - - - - - Configure External Applications - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - File extension and external application in which to load a document of that type - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - A table containing file types that can be opened using eVis. Each file type needs a file extension and the path to an application that can open that type of file. This provides the capability of opening a broad range of files such as movies, sound recording, and text documents instead of only images. - - - - Extension - - - - - Application - - - - - - - - - - Add new file type - - - Add a new file type with a unique extension and the path for the application that can open the file. - - - - - - - :/images/themes/default/symbologyAdd.svg:/images/themes/default/symbologyAdd.svg - - - - - - - Delete current row - - - Delete the file type highlighted in the table and defined by a file extension and a path to an associated application. - - - - - - - :/images/themes/default/symbologyRemove.svg:/images/themes/default/symbologyRemove.svg - - - - - - - Qt::Vertical - - - - 20 - 491 - - - - - - - - - - - - - - - eVisImageDisplayWidget - QWidget -
evisimagedisplaywidget.h
-
-
- - cboxEventImagePathField - chkboxEventImagePathRelative - chkboxSaveEventImagePathData - pbtnResetEventImagePathData - cboxCompassBearingField - chkboxDisplayCompassBearing - chkboxSaveCompassBearingData - pbtnResetCompassBearingData - rbtnManualCompassOffset - dsboxCompassOffset - rbtnAttributeCompassOffset - cboxCompassOffsetField - chkboxSaveCompassOffsetData - pbtnResetCompassOffsetData - leBasePath - chkboxSaveBasePathData - pbtnResetBasePathData - chkboxUseOnlyFilename - chkboxSaveUseOnlyFilenameData - pbtnResetUseOnlyFilenameData - chkboxApplyPathRulesToDocs - chkboxSaveApplyPathRulesToDocs - pbtnResetApplyPathRulesToDocs - tableFileTypeAssociations - pbtnAddFileType - pbtnDeleteFileType - displayArea - - - - - - - buttonBox - rejected() - eVisGenericEventBrowserGuiBase - close() - - - 310 - 652 - - - 286 - 274 - - - - - buttonBox - accepted() - eVisGenericEventBrowserGuiBase - close() - - - 525 - 664 - - - 403 - 273 - - - - -