2
** File: evisgenericeventbrowsergui.h
3
** Author: Peter J. Ersts ( ersts at amnh.org )
4
** Creation Date: 2007-03-08
6
** Copyright ( c ) 2007, American Museum of Natural History. All rights reserved.
8
** This library/program is free software; you can redistribute it
9
** and/or modify it under the terms of the GNU Library General Public
10
** License as published by the Free Software Foundation; either
11
** version 2 of the License, or ( at your option ) any later version.
13
** This library/program is distributed in the hope that it will be useful,
14
** but WITHOUT ANY WARRANTY; without even the implied warranty of
15
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
** Library General Public License for more details.
18
** This work was made possible through a grant by the the John D. and
19
** Catherine T. MacArthur Foundation. Additionally, this program was prepared by
20
** the American Museum of Natural History under award No. NA05SEC46391002
21
** from the National Oceanic and Atmospheric Administration, U.S. Department
22
** of Commerce. The statements, findings, conclusions, and recommendations
23
** are those of the author( s ) and do not necessarily reflect the views of the
24
** National Oceanic and Atmospheric Administration or the Department of Commerce.
28
#ifndef eVisGenericEventBrowserGui_H
29
#define eVisGenericEventBrowserGui_H
32
#include <QGraphicsPixmapItem>
34
#include "qgsmaptool.h"
35
#include "qgsfeature.h"
36
#include "qgsmapcanvas.h"
37
#include "qgisinterface.h"
38
#include "qgsmaprenderer.h"
39
#include "qgsvectorlayer.h"
40
#include "qgsvectordataprovider.h"
42
#include "evisconfiguration.h"
44
#include "ui_evisgenericeventbrowserguibase.h"
47
* \class eVisGenericEventBrowserGui
48
* \brief Generic viewer for browsing event
49
* The eVisGenericEventBrowserGui is simply a window that will display an image referenced/stored
50
* in an attribute of a feature. Images can either loaded locally from disk or loaded via a URL.
51
* The eVisGenericEventBrowserGui also interacts with the map canvas to draw a highlighing symbol
52
* on the canvas. The highlighing symbol can also be a pointer showing the direction in which the
53
* image was taken by referencing a compass bearing recorded as an attribute of a feature.
55
class eVisGenericEventBrowserGui : public QDialog, private Ui::eVisGenericEventBrowserGuiBase
60
/** \brief Constructor called when button is pressed in the plugin toolbar */
61
eVisGenericEventBrowserGui( QWidget* parent, QgisInterface* interface, Qt::WFlags fl );
63
/** \brief Constructor called when new browser is requested by the eVisEventIdTool */
64
eVisGenericEventBrowserGui( QWidget* parent, QgsMapCanvas* canvas, Qt::WFlags fl );
66
/** \Brief Destructor */
67
~eVisGenericEventBrowserGui( );
70
void closeEvent( QCloseEvent *event );
74
/** \brief A flag to bypass some signal/slots during gui initialization */
77
/** \brief Pointer to the main configurations object */
78
eVisConfiguration mConfiguration;
80
/** \brief Flag indicating if the browser fully initialized */
81
bool mBrowserInitialized;
83
/** \brief Index of the attribute field name that closest 'matches' configuration of the parameter */
84
int mDefaultCompassBearingField;
86
/** \brief Index of the attribute field name that closest 'matches' configuration of the parameter */
87
int mDefaultCompassOffsetField;
89
/** \brief Index of the attribute field name that closest 'matches' configuration of the parameter */
90
int mDefaultEventImagePathField;
92
/** \brief Pointer to the QgisInferface */
93
QgisInterface* mInterface;
95
/** \brief Pointer to the map canvas */
96
QgsMapCanvas* mCanvas;
98
/** \brief Pointer to the vector layer */
99
QgsVectorLayer* mVectorLayer;
101
/** \brief Pointer to the vector data provider */
102
QgsVectorDataProvider* mDataProvider;
104
/** \brief QPixmap holding the default highlighting symbol */
105
QPixmap mHighlightSymbol;
107
/** \brief QPixmap holding the pointer highlighting symbol */
108
QPixmap mPointerSymbol;
110
/** \brief Compass bearing value for the current feature */
111
double mCompassBearing;
113
/** \brief Compass bearing offset retrieved from attribute */
114
double mCompassOffset;
116
/** \brief QString holding the path to the image for the current feature */
117
QString mEventImagePath;
119
/** \brief List of current select featured ids*/
120
QList<int> mFeatureIds;
122
/** \brief Index of selected feature being viewed, used to access mFeatureIds */
123
int mCurrentFeatureIndex;
125
/** \brief Current feature being viewed */
129
/** \brief Applies parameters on the Options tabs and saves the configuration */
132
/** \brief Modifies the Event Image Path according to the local and global settings */
133
void buildEventImagePath( );
135
/** \brief Method that loads the image in the browser */
136
void displayImage( );
138
/** \brief Generic method to get a feature by id. Access mLocalFeatureList when layer is of type delimitedtext otherwise calls existing methods in mDataProvider */
139
QgsFeature* featureAtId( int );
141
/** \brief Functionality common to both constructors */
144
/** \brief Set all of the gui objects based on the current configuration*/
145
void initOptionsTab( );
147
/** \brief Method called to load data into the browser */
150
/** \brief Reset all gui items on the options tab to a 'system default' */
151
void restoreDefaultOptions( );
153
/** \brief Sets the base path to the path of the data source */
154
void setBasePathToDataSource( );
157
void launchExternalApplication( QTreeWidgetItem *, int );
158
void on_buttonboxOptions_clicked( QAbstractButton* );
159
void on_chkboxApplyPathRulesToDocs_stateChanged( int );
160
void on_cboxEventImagePathField_currentIndexChanged( int );
161
void on_cboxCompassBearingField_currentIndexChanged( int );
162
void on_cboxCompassOffsetField_currentIndexChanged( int );
163
void on_chkboxDisplayCompassBearing_stateChanged( int );
164
void on_chkboxEventImagePathRelative_stateChanged( int );
165
void on_chkboxUseOnlyFilename_stateChanged( int );
166
void on_displayArea_currentChanged( int );
167
void on_dsboxCompassOffset_valueChanged( double );
168
void on_leBasePath_textChanged( QString );
169
void on_pbtnAddFileType_clicked( );
170
void on_pbtnDeleteFileType_clicked( );
171
void on_pbtnNext_clicked( );
172
void on_pbtnPrevious_clicked( );
173
void on_pbtnResetApplyPathRulesToDocs_clicked( );
174
void on_pbtnResetBasePathData_clicked( );
175
void on_pbtnResetCompassBearingData_clicked( );
176
void on_pbtnResetCompassOffsetData_clicked( );
177
void on_pbtnResetEventImagePathData_clicked( );
178
void on_pbtnResetUseOnlyFilenameData_clicked( );
179
void on_rbtnManualCompassOffset_toggled( bool );
180
void on_tableFileTypeAssociations_cellDoubleClicked( int, int );
181
/** \brief Slot called when the map canvas is done refreshing. Draws the highlighting symbol over the current selected feature */
182
void renderSymbol( QPainter* );