Ground-Truthing GUI  1.0
imagegraphicsview.h
1 
22 #ifndef DISPLAYIMAGE
23 #define DISPLAYIMAGE
24 
25 #include <QMainWindow>
26 #include <QString>
27 #include <QGraphicsScene>
28 #include <QGraphicsView>
29 
30 #include "filereader.h"
31 #include "image.h"
32 #include "createfileabstraction.h"
33 #include "imagegraphicsscene.h"
34 #include "rectangledraw.h"
35 #include "fileexistswindow.h"
36 
37 class ImageGraphicsView:public QGraphicsView
38 {
39  Q_OBJECT
40 
41 private:
42 
43  // The application Main Window
44  QMainWindow *mainWindow;
45 
46  // The image the user wants to work with
47  Image *image;
48 
49  // The file associated to the image
51 
52  // The application scene
53  ImageGraphicsScene *rectangle;
54 
55  // The name of the file containing the image
56  QString *fileName;
57 
58  // The object which is going to read all the rectangles information
59  FileReader *fileReader;
60 
61  // Object which is going to add to the selected rectangle
62  // the litte icon indicating that th rectangle has already been annotated
63  AddIconPicture *addIconPicture;
64 
65  // Window warning the user that the image is already linked to a text file
66  FileExistsWindow *existsWindow;
67 
68  // Checks if the application is in "Draw" mode
69  bool drawStarted;
70 
71  // Checks if the application is in "Drag" mode
72  bool dragButton;
73 
74  // Checks if the user has opened the image directly from its source file
75  // or using the text file
76  bool readFile;
77 
78  int selectedTool;
79 
80  QRect y;
81 
82 public:
83 
87  ImageGraphicsView(QMainWindow *mainWindow_1):QGraphicsView(),mainWindow(mainWindow_1),image(NULL),
88  fileName(NULL),dragButton(false),rectangle(NULL),file(NULL),fileReader(NULL),readFile(false),
89  addIconPicture(NULL),existsWindow(NULL)
90  {
91  // Set the mouse tracking to true
92  this->setMouseTracking(true);
93  }
94 
99  virtual bool display(QString &fileName);
100 
103  virtual void setName(QString *filename);
104 
108  virtual ImageGraphicsScene* getScene();
109 
113  virtual void setDragButton(bool value);
114 
118  virtual void dragEnable();
119 
123  virtual void dragDisable();
124 
128  virtual void cursorActivate();
129 
133  virtual void cursorDesactivate();
134 
135 
136 
137 protected:
138 
142  void drawBackground();
143 
147  void wheelEvent(QWheelEvent *event);
148 };
149 
150 #endif // DISPLAYIMAGE
151 
ImageGraphicsView(QMainWindow *mainWindow_1)
The constructor of the ImageGraphicsView class.
Definition: imagegraphicsview.h:87
virtual void setName(QString *filename)
Deprecated method. Will be removed in a future release.
Definition: imagegraphicsview.cpp:103
virtual void setDragButton(bool value)
Sets the state of the variable representing the state of the Drag icon.
Definition: imagegraphicsview.cpp:111
void drawBackground()
2° for drawing the image
Definition: imagegraphicsview.cpp:35
Creates a text file related to an image.
Definition: createfileabstraction.h:34
virtual ImageGraphicsScene * getScene()
Returns the application scene.
Definition: imagegraphicsview.cpp:107
Adds an icon at the top-left corner of a rectangle.
Definition: addiconpicture.h:34
Inherits the QPixmap class.
Definition: image.h:32
Displays the image.
Definition: imagegraphicsview.h:37
virtual bool display(QString &fileName)
1° step for displaying the image
Definition: imagegraphicsview.cpp:3
virtual void cursorActivate()
Sets the cursor to be a cross when the user presses the draw icon.
Definition: imagegraphicsview.cpp:143
virtual void dragDisable()
Disables the drag mode.
Definition: imagegraphicsview.cpp:125
Warning window.
Definition: fileexistswindow.h:32
void wheelEvent(QWheelEvent *event)
Zoom In and Zoom Out events.
Definition: imagegraphicsview.cpp:129
virtual void dragEnable()
Enables the drag mode.
Definition: imagegraphicsview.cpp:121
Displays the rectangles and work on the image.
Definition: imagegraphicsscene.h:47
virtual void cursorDesactivate()
Sets the cursor to be an arrow when the user stops drawing.
Definition: imagegraphicsview.cpp:147
Reads the text file content.
Definition: filereader.h:35