ImportImageView.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef _IMPORT_IMAGE_VIEW_HH_
19 #define _IMPORT_IMAGE_VIEW_HH_
20 
21 #include <map>
22 #include <string>
23 #include <vector>
24 #include "gazebo/gui/qt.h"
25 #include "gazebo/common/Event.hh"
26 #include "gazebo/util/system.hh"
27 
28 namespace gazebo
29 {
30  namespace gui
31  {
32  class EditorItem;
33  class MeasureItem;
34  class GridLines;
35  class ImportImageDialog;
36 
39 
42  class GAZEBO_VISIBLE ImportImageView : public QGraphicsView
43  {
44  Q_OBJECT
45 
48  public: ImportImageView(ImportImageDialog *_parent = 0);
49 
51  public: ~ImportImageView();
52 
55  public: void SetImage(const std::string &_filename);
56 
59  public: void RefreshDistance(double _distance);
60 
63  public: void EnableDrawDistance(bool _enable);
64 
67  private: void resizeEvent(QResizeEvent *_event);
68 
71  private: void mouseMoveEvent(QMouseEvent *_event);
72 
75  private: void mousePressEvent(QMouseEvent *_event);
76 
79  private: void mouseReleaseEvent(QMouseEvent *_event);
80 
83  private: void keyPressEvent(QKeyEvent *_event);
84 
87  private: void DrawMeasure(const QPoint &_pos);
88 
90  public: int pixmapWidthPx;
91 
93  public: int pixmapHeightPx;
94 
96  public: int imageWidthPx;
97 
99  public: int measureScenePx;
100 
102  private: bool drawInProgress;
103 
105  private: std::vector<event::ConnectionPtr> connections;
106 
109  private: QGraphicsItem *currentMouseItem;
110 
112  private: GridLines *gridLines;
113 
115  private: QGraphicsPixmapItem *imageItem;
116 
118  private: QPixmap *imagePixmap;
119 
121  private: QGraphicsTextItem *noImageText;
122 
124  private: QGraphicsTextItem *invalidImageText;
125 
127  private: MeasureItem *measureItem;
128 
130  private: ImportImageDialog *parent;
131 
133  private: bool drawDistanceEnabled;
134  };
136  }
137 }
138 
139 #endif
Measurement lines and values.
Definition: MeasureItem.hh:36
int pixmapWidthPx
Width of the pixmap in pixels.
Definition: ImportImageView.hh:90
int measureScenePx
Length of the measure on the scene in pixels.
Definition: ImportImageView.hh:99
int imageWidthPx
Width of the image in pixels.
Definition: ImportImageView.hh:96
2D grid lines.
Definition: GridLines.hh:33
int pixmapHeightPx
Height of the pixmap in pixels.
Definition: ImportImageView.hh:93
Control the import image view and manage contents in the scene.
Definition: ImportImageView.hh:42
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
Definition: ImportImageDialog.hh:33