~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
** File: evisgenericeventbrowsergui.h
 
3
** Author: Peter J. Ersts ( ersts at amnh.org )
 
4
** Creation Date: 2007-03-08
 
5
**
 
6
** Copyright ( c ) 2007, American Museum of Natural History. All rights reserved.
 
7
**
 
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.
 
12
**
 
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.
 
17
**
 
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.
 
25
**
 
26
**/
 
27
/*  $Id: $ */
 
28
#ifndef eVisGenericEventBrowserGui_H
 
29
#define eVisGenericEventBrowserGui_H
 
30
 
 
31
#include <QDialog>
 
32
#include <QGraphicsPixmapItem>
 
33
 
 
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"
 
41
 
 
42
#include "evisconfiguration.h"
 
43
 
 
44
#include "ui_evisgenericeventbrowserguibase.h"
 
45
 
 
46
/**
 
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.
 
54
*/
 
55
class eVisGenericEventBrowserGui : public QDialog, private Ui::eVisGenericEventBrowserGuiBase
 
56
{
 
57
    Q_OBJECT
 
58
 
 
59
  public:
 
60
    /** \brief Constructor called when button is pressed in the plugin toolbar */
 
61
    eVisGenericEventBrowserGui( QWidget* parent, QgisInterface* interface, Qt::WFlags fl );
 
62
 
 
63
    /** \brief Constructor called when new browser is requested by the eVisEventIdTool */
 
64
    eVisGenericEventBrowserGui( QWidget* parent, QgsMapCanvas* canvas, Qt::WFlags fl );
 
65
 
 
66
    /** \Brief Destructor */
 
67
    ~eVisGenericEventBrowserGui( );
 
68
 
 
69
  protected:
 
70
    void closeEvent( QCloseEvent *event );
 
71
 
 
72
  private:
 
73
    //Variables
 
74
    /** \brief A flag to bypass some signal/slots during gui initialization */
 
75
    bool mIgnoreEvent;
 
76
 
 
77
    /** \brief Pointer to the main configurations object */
 
78
    eVisConfiguration mConfiguration;
 
79
 
 
80
    /** \brief Flag indicating if the browser fully initialized */
 
81
    bool mBrowserInitialized;
 
82
 
 
83
    /** \brief Index of the attribute field name that closest 'matches' configuration of the parameter */
 
84
    int mDefaultCompassBearingField;
 
85
 
 
86
    /** \brief Index of the attribute field name that closest 'matches' configuration of the parameter */
 
87
    int mDefaultCompassOffsetField;
 
88
 
 
89
    /** \brief Index of the attribute field name that closest 'matches' configuration of the parameter */
 
90
    int mDefaultEventImagePathField;
 
91
 
 
92
    /** \brief Pointer to the QgisInferface */
 
93
    QgisInterface* mInterface;
 
94
 
 
95
    /** \brief Pointer to the map canvas */
 
96
    QgsMapCanvas* mCanvas;
 
97
 
 
98
    /** \brief Pointer to the vector layer */
 
99
    QgsVectorLayer* mVectorLayer;
 
100
 
 
101
    /** \brief Pointer to the vector data provider */
 
102
    QgsVectorDataProvider* mDataProvider;
 
103
 
 
104
    /** \brief QPixmap holding the default highlighting symbol */
 
105
    QPixmap mHighlightSymbol;
 
106
 
 
107
    /** \brief QPixmap holding the pointer highlighting symbol */
 
108
    QPixmap mPointerSymbol;
 
109
 
 
110
    /** \brief Compass bearing value for the current feature */
 
111
    double mCompassBearing;
 
112
 
 
113
    /** \brief Compass bearing offset retrieved from attribute */
 
114
    double mCompassOffset;
 
115
 
 
116
    /** \brief QString holding the path to the image for the current feature */
 
117
    QString mEventImagePath;
 
118
 
 
119
    /** \brief List of current select featured ids*/
 
120
    QList<int> mFeatureIds;
 
121
 
 
122
    /** \brief Index of selected feature being viewed, used to access mFeatureIds */
 
123
    int mCurrentFeatureIndex;
 
124
 
 
125
    /** \brief Current feature being viewed */
 
126
    QgsFeature mFeature;
 
127
 
 
128
    //Methods
 
129
    /** \brief Applies parameters on the Options tabs and saves the configuration */
 
130
    void accept( );
 
131
 
 
132
    /** \brief Modifies the Event Image Path according to the local and global settings */
 
133
    void buildEventImagePath( );
 
134
 
 
135
    /** \brief Method that loads the image in the browser */
 
136
    void displayImage( );
 
137
 
 
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 );
 
140
 
 
141
    /** \brief Functionality common to both constructors */
 
142
    bool initBrowser( );
 
143
 
 
144
    /** \brief Set all of the gui objects based on the current configuration*/
 
145
    void initOptionsTab( );
 
146
 
 
147
    /** \brief Method called to load data into the browser */
 
148
    void loadRecord( );
 
149
 
 
150
    /** \brief Reset all gui items on the options tab to a 'system default' */
 
151
    void restoreDefaultOptions( );
 
152
 
 
153
    /** \brief Sets the base path to the path of the data source */
 
154
    void setBasePathToDataSource( );
 
155
 
 
156
  private slots:
 
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* );
 
183
};
 
184
#endif