DISPLACE  1.0
A spatial model of fisheries to help sustainable fishing and maritime spatial planning
nodeentity.h
Go to the documentation of this file.
1 /* --------------------------------------------------------------------------
2  * DISPLACE: DYNAMIC INDIVIDUAL VESSEL-BASED SPATIAL PLANNING
3  * AND EFFORT DISPLACEMENT
4  * Copyright (c) 2012, 2013, 2014 Francois Bastardie <fba@aqua.dtu.dk>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  * --------------------------------------------------------------------------
20  */
21 #ifndef NODEENTITY_H
22 #define NODEENTITY_H
23 
25 
26 namespace objecttree {
27 
28 class NodeEntity : public QObject, public ObjectTreeEntity
29 {
30  Q_OBJECT
31 
32  int mNodeId;
33 
34 public:
35  NodeEntity(ObjectTreeModel *_model, int id = -1);
36 
37  virtual ObjectTreeModel::Category getCategory() const override {
39  }
40 
41  virtual QModelIndex parent (const QModelIndex &parent) const override;
42  virtual QModelIndex index (int row, int column, const QModelIndex &parent) const override;
43  virtual int rowCount() const override;
44  virtual int columnCount() const override;
45  virtual QVariant data(const QModelIndex &index, int role) const override;
46  virtual Qt::ItemFlags flags(Qt::ItemFlags defflags, const QModelIndex &index) const override;
47  virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override;
48 
49  int getNodeId() const { return mNodeId; }
50 
51  virtual QMenu *contextMenu() const override ;
52 
53 public slots:
54  void onActionSearchById();
55 
56 private:
57  QMenu *mContextMenu;
58  QList<NodeEntity *> mEntities; // for lazy initialization
59 
60  void init() ;
61  void initMenu();
62 };
63 
64 }
65 
66 #endif // NODEENTITY_H
virtual QVariant data(const QModelIndex &index, int role) const override
Definition: nodeentity.cpp:74
Definition: benthosentity.cpp:27
Definition: objecttreemodel.h:50
virtual int columnCount() const override
Definition: nodeentity.cpp:69
NodeEntity(ObjectTreeModel *_model, int id=-1)
Definition: nodeentity.cpp:32
void onActionSearchById()
Definition: nodeentity.cpp:110
Definition: objecttreeentity.h:32
Definition: nodeentity.h:28
virtual ObjectTreeModel::Category getCategory() const override
Definition: nodeentity.h:37
virtual QModelIndex parent(const QModelIndex &parent) const override
Definition: nodeentity.cpp:39
Definition: objecttreemodel.h:39
int getNodeId() const
Definition: nodeentity.h:49
std::pair< box, unsigned > value
Definition: diffusion.cpp:30
virtual int rowCount() const override
Definition: nodeentity.cpp:61
Category
Definition: objecttreemodel.h:44
virtual bool setData(const QModelIndex &index, const QVariant &value, int role) override
Definition: nodeentity.cpp:92
virtual QMenu * contextMenu() const override
Definition: nodeentity.cpp:101
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const override
Definition: nodeentity.cpp:45
virtual Qt::ItemFlags flags(Qt::ItemFlags defflags, const QModelIndex &index) const override
Definition: nodeentity.cpp:85