OpendTect-6_4  6.4
uigraphicsscene.h
Go to the documentation of this file.
1 #ifndef uigraphicsscene_h
2 #define uigraphicsscene_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Nanne Hemstra
9  Date: January 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uibasemod.h"
16 #include "uigraphicsitem.h"
17 #include "task.h"
18 #include "bufstringset.h"
19 #include "color.h"
20 #include "keyboardevent.h"
21 #include "mouseevent.h"
22 #include "namedobj.h"
23 
24 
25 mFDQtclass(QGraphicsScene)
26 mFDQtclass(QGraphicsLinearLayout)
27 mFDQtclass(QGraphicsWidget)
28 mFDQtclass(ODGraphicsScene)
29 
30 class ArrowStyle;
31 class Alignment;
32 class MarkerStyle2D;
33 
34 class uiPolygonItem;
35 class uiPolyLineItem;
36 class uiRectItem;
37 class uiObjectItem;
38 
40 {
41 public:
42  uiGraphicsScene(const char*);
43  ~uiGraphicsScene();
44 
45  void removeAllItems();
46  uiGraphicsItem* removeItem(uiGraphicsItem*);
48  uiGraphicsItemSet* removeItems(uiGraphicsItemSet*);
51  template <class T> T* addItem(T*);
55  int nrItems() const;
56  uiGraphicsItem* getItem(int id);
57  const uiGraphicsItem* getItem(int id) const;
58  uiGraphicsItem* itemAt(const Geom::Point2D<float>&);
59  const uiGraphicsItem* itemAt(const Geom::Point2D<float>&) const;
60 
61  uiRectItem* addRect(float x,float y,float w,float h);
62 
63  uiPolygonItem* addPolygon(const TypeSet<uiPoint>&,bool fill);
64  uiPolyLineItem* addPolyLine(const TypeSet<uiPoint>&);
65 
66  void useBackgroundPattern(bool);
67  void setBackGroundColor(const Color&);
68  const Color backGroundColor() const;
69 
70  int getSelItemSize() const;
71  uiRect getSelectedArea() const;
72  void setSelectionArea(const uiRect&);
73 
75  { return mousehandler_; }
76 
79  double width() const;
80  double height() const;
81 
82  void saveAsImage(const char*,int,int,int);
83  void saveAsPDF(const char*,int w,int h,int r);
84  void saveAsPS(const char*,int w,int h,int r);
85  void saveAsPDF_PS(const char*,bool pdf_or_ps,int w,
86  int h,int r);
87  void setSceneRect(float x,float y,float w,float h);
88  uiRect sceneRect();
89 
90  bool isMouseEventActive() const
91  { return ismouseeventactive_; }
92  void setMouseEventActive( bool yn )
93  { ismouseeventactive_ = yn; }
94  mQtclass(QGraphicsScene*) qGraphicsScene()
95  {return (mQtclass(QGraphicsScene*))odgraphicsscene_;}
96  void copyToClipBoard();
97 
98 
99  void addUpdateToQueue(Task*);
100  bool executePendingUpdates();
101 
102  void setPixelDensity(float);
103  float getPixelDensity() const {return pixeldensity_;}
104  static float getDefaultPixelDensity();
105 
107 
108  void translateText();
109 protected:
110 
112  ODGraphicsScene* odgraphicsscene_;
113 
114  void CtrlCPressedCB(CallBacker*);
117  friend class uiGraphicsItem;
118  uiGraphicsItem* doAddItem(uiGraphicsItem*);
119  int indexOf(int id) const;
120 
121  int queueid_;
123 };
124 
125 
126 template <class T>
127 inline T* uiGraphicsScene::addItem( T* itm )
128 {
129  return (T*) doAddItem( itm );
130 }
131 
132 
134 {
135 public:
136  uiGraphicsObjectScene(const char*);
137 
138  void addObjectItem(uiObjectItem*);
139  void insertObjectItem(int,uiObjectItem*);
140  void removeObjectItem(uiObjectItem*);
141  void setItemStretch(uiObjectItem*,int stretch);
142  int stretchFactor(uiObjectItem*) const;
143 
144  void setLayoutPos(const uiPoint&);
145  const uiPoint layoutPos() const;
146  const uiSize layoutSize() const;
147 
148 protected:
149 
150  void resizeLayoutToContent();
151 
152  mQtclass(QGraphicsLinearLayout*) layout_;
153  mQtclass(QGraphicsWidget*) layoutitem_;
154 };
155 
156 
158 {
159 public:
162 
163  bool execute();
164 
165 protected:
169  bool remove_;
170 };
171 
172 
173 #endif
#define mExpClass(module)
Definition: commondefs.h:160
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
bool remove_
Definition: uigraphicsscene.h:169
Definition: uigeom.h:42
#define mQtclass(cls)
Definition: commondefs.h:229
Definition: draw.h:21
mQtclass(QGraphicsScene *) qGraphicsScene()
Definition: uigraphicsscene.h:94
int queueid_
Definition: uigraphicsscene.h:121
Definition: uigraphicsscene.h:133
ObjectSet< uiGraphicsItem > items_
Definition: uigraphicsscene.h:111
Definition: draw.h:60
Definition: uigraphicsitemimpl.h:192
Notifier< uiGraphicsScene > ctrlPPressed
Definition: uigraphicsscene.h:77
ODGraphicsScene * odgraphicsscene_
Definition: uigraphicsscene.h:112
Definition: uigraphicsscene.h:157
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
Definition: uigeom.h:25
uiGraphicsItemGroup * group_
Definition: uigraphicsscene.h:167
MouseEventHandler mousehandler_
Definition: uigraphicsscene.h:115
Definition: uigraphicsitemimpl.h:52
Set of (small) copyable elements.
Definition: commontypes.h:30
T * addItem(T *)
Item becomes mine.
Definition: uigraphicsscene.h:127
Definition: uigraphicsitem.h:157
bool ismouseeventactive_
Definition: uigraphicsscene.h:116
Definition: uigraphicsitemimpl.h:255
Definition: mouseevent.h:162
MouseEventHandler & getMouseEventHandler()
Definition: uigraphicsscene.h:74
Definition: uigraphicsitemimpl.h:214
Object with a name.
Definition: namedobj.h:35
bool isMouseEventActive() const
Definition: uigraphicsscene.h:90
float getPixelDensity() const
Definition: uigraphicsscene.h:103
Definition: uigraphicsitem.h:142
Definition: draw.h:184
mFDQtclass(QGraphicsScene) mFDQtclass(QGraphicsLinearLayout) mFDQtclass(QGraphicsWidget) mFDQtclass(ODGraphicsScene) class ArrowStyle
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
uiGraphicsItem & itm_
Definition: uigraphicsscene.h:168
#define mClass(module)
Definition: commondefs.h:164
uiGraphicsItem * doAddItem(uiGraphicsItem *)
float pixeldensity_
Definition: uigraphicsscene.h:122
Notifier< uiGraphicsScene > ctrlCPressed
Definition: uigraphicsscene.h:78
Generalization of something (e.g. a computation) that needs to be done in multiple steps...
Definition: task.h:28
Notifier< uiGraphicsScene > pixelDensityChange
Definition: uigraphicsscene.h:106
friend class uiGraphicsItem
Definition: uigraphicsscene.h:117
uiGraphicsScene * scene_
Definition: uigraphicsscene.h:166
void setMouseEventActive(bool yn)
Definition: uigraphicsscene.h:92
Definition: uigraphicsscene.h:39

Generated at for the OpendTect seismic interpretation project. Copyright (C): dGB Beheer B. V. 2019