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

« back to all changes in this revision

Viewing changes to src/app/qgsidentifyresults.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
                      qgsidentifyresults.h  -  description
 
3
                               ------------------
 
4
        begin                : Fri Oct 25 2002
 
5
        copyright            : (C) 2002 by Gary E.Sherman
 
6
        email                : sherman at mrcc dot com
 
7
        Romans 3:23=>Romans 6:23=>Romans 5:8=>Romans 10:9,10=>Romans 12
 
8
 ***************************************************************************/
 
9
 
 
10
/***************************************************************************
 
11
 *                                                                         *
 
12
 *   This program is free software; you can redistribute it and/or modify  *
 
13
 *   it under the terms of the GNU General Public License as published by  *
 
14
 *   the Free Software Foundation; either version 2 of the License, or     *
 
15
 *   (at your option) any later version.                                   *
 
16
 *                                                                         *
 
17
 ***************************************************************************/
 
18
/* $Id$ */
 
19
#ifndef QGSIDENTIFYRESULTS_H
 
20
#define QGSIDENTIFYRESULTS_H
 
21
 
 
22
#include "ui_qgsidentifyresultsbase.h"
 
23
#include "qgsattributeaction.h"
 
24
#include "qgscontexthelp.h"
 
25
 
 
26
#include <QWidget>
 
27
#include <QList>
 
28
 
 
29
class QCloseEvent;
 
30
class QTreeWidgetItem;
 
31
class QAction;
 
32
class QMenu;
 
33
 
 
34
class QgsMapLayer;
 
35
class QgsVectorLayer;
 
36
class QgsRubberBand;
 
37
class QgsMapCanvas;
 
38
class QDockWidget;
 
39
 
 
40
/**
 
41
 *@author Gary E.Sherman
 
42
 */
 
43
 
 
44
class QgsIdentifyResults: public QDialog, private Ui::QgsIdentifyResultsBase
 
45
{
 
46
    Q_OBJECT
 
47
 
 
48
  public:
 
49
 
 
50
    //! Constructor - takes it own copy of the QgsAttributeAction so
 
51
    // that it is independent of whoever created it.
 
52
    QgsIdentifyResults( QgsMapCanvas *canvas, QWidget *parent = 0, Qt::WFlags f = 0 );
 
53
 
 
54
    ~QgsIdentifyResults();
 
55
 
 
56
    /** Add add feature */
 
57
    void addFeature( QgsMapLayer *layer, int fid,
 
58
                     QString displayField, QString displayValue,
 
59
                     const QMap< QString, QString > &attributes,
 
60
                     const QMap< QString, QString > &derivedAttributes );
 
61
 
 
62
    /** map tool was deactivated */
 
63
    void deactivate();
 
64
 
 
65
    /** map tool was activated */
 
66
    void activate();
 
67
 
 
68
    void closeEvent( QCloseEvent *e );
 
69
 
 
70
  signals:
 
71
    void selectedFeatureChanged( QgsVectorLayer *, int featureId );
 
72
 
 
73
  public slots:
 
74
    /** Remove results */
 
75
    void clear();
 
76
 
 
77
    void show();
 
78
 
 
79
    void close();
 
80
    void contextMenuEvent( QContextMenuEvent* );
 
81
 
 
82
    void layerDestroyed();
 
83
    void editingToggled();
 
84
    void featureDeleted( int fid );
 
85
 
 
86
    void featureForm();
 
87
    void zoomToFeature();
 
88
    void copyAttributeValue();
 
89
    void copyFeatureAttributes();
 
90
    void highlightAll();
 
91
    void highlightLayer();
 
92
    void clearRubberbands();
 
93
    void expandAll();
 
94
    void collapseAll();
 
95
 
 
96
    /* Called when an item is expanded so that we can ensure that the
 
97
       column width if expanded to show it */
 
98
    void itemExpanded( QTreeWidgetItem * );
 
99
 
 
100
    //! sends signal if current feature id has changed
 
101
    void handleCurrentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous );
 
102
 
 
103
    /* Item in tree was clicked */
 
104
    void itemClicked( QTreeWidgetItem *lvi, int column );
 
105
 
 
106
    QTreeWidgetItem *retrieveAttributes( QTreeWidgetItem *item, QList< QPair<QString, QString> > &attributes, int &currentIdx );
 
107
 
 
108
    void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
 
109
 
 
110
  private:
 
111
    QMenu *mActionPopup;
 
112
    QMap<QTreeWidgetItem *, QgsRubberBand * > mRubberBands;
 
113
    QgsMapCanvas *mCanvas;
 
114
 
 
115
    QgsVectorLayer *vectorLayer( QTreeWidgetItem *item );
 
116
    QTreeWidgetItem *featureItem( QTreeWidgetItem *item );
 
117
    QTreeWidgetItem *layerItem( QTreeWidgetItem *item );
 
118
    QTreeWidgetItem *layerItem( QObject *layer );
 
119
 
 
120
    void highlightLayer( QTreeWidgetItem *object );
 
121
    void disconnectLayer( QObject *object );
 
122
 
 
123
    void setColumnText( int column, const QString & label );
 
124
    void expandColumnsToFit();
 
125
    void saveWindowLocation();
 
126
    void restorePosition();
 
127
 
 
128
    void highlightFeature( QTreeWidgetItem *item );
 
129
 
 
130
    void doAction( QTreeWidgetItem *item, int action );
 
131
 
 
132
    QDockWidget *mDock;
 
133
};
 
134
 
 
135
class QgsFeatureAction : public QAction
 
136
{
 
137
    Q_OBJECT
 
138
 
 
139
  public:
 
140
    QgsFeatureAction( const QString &name, QgsIdentifyResults *results, QgsVectorLayer *vl, int action, QTreeWidgetItem *featItem ) :
 
141
        QAction( name, results ), mResults( results ), mLayer( vl ), mAction( action ), mFeatItem( featItem )
 
142
    {}
 
143
 
 
144
  public slots:
 
145
    void execute();
 
146
 
 
147
  private:
 
148
    QgsIdentifyResults *mResults;
 
149
    QgsVectorLayer *mLayer;
 
150
    int mAction;
 
151
    QTreeWidgetItem *mFeatItem;
 
152
};
 
153
 
 
154
#endif