OpendTect-6_4  6.4
uifunctiondisplay.h
Go to the documentation of this file.
1 #ifndef uifunctiondisplay_h
2 #define uifunctiondisplay_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Apr 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uitoolsmod.h"
16 #include "uigraphicsview.h"
17 #include "draw.h"
18 
19 class uiAxisHandler;
20 class uiGraphicsItem;
22 class uiGraphicsScene;
23 class uiLineItem;
24 class uiPolygonItem;
25 class uiPolyLineItem;
26 class uiRectItem;
27 class uiTextItem;
28 
40 public:
41 
42  struct Setup
43  {
44  Setup()
45  : xrg_(mUdf(float),mUdf(float))
46  , yrg_(mUdf(float),mUdf(float))
47  , y2rg_(mUdf(float),mUdf(float))
48  , bgcol_(Color::White())
49  , ycol_(200,160,140)
50  , y2col_(140,160,200)
51  , ywidth_(2)
52  , y2width_(2)
53  , canvaswidth_(400)
54  , canvasheight_(250)
55  , border_(20,20,20,10)
56  , annotx_(true)
57  , annoty_(true)
58  , annoty2_(true)
59  , noxaxis_(false)
60  , noyaxis_(false)
61  , noy2axis_(false)
62  , noxgridline_(false)
63  , noygridline_(false)
64  , noy2gridline_(false)
65  , pointsz_(0)
66  , ptsnaptol_(0.01)
67  , editable_(false)
68  , curvzvaly_(1)
69  , curvzvaly2_(0)
70  , fillbelow_(false)
71  , fillbelowy2_(false)
72  , drawscattery1_(false)
73  , drawscattery2_(false)
74  , markerstyley1_(MarkerStyle2D::Square,3,
75  ycol_)
76  , markerstyley2_(MarkerStyle2D::Square,3,
77  y2col_)
78  , markerfilly1_(false)
79  , markerfilly2_(false)
80  , drawborder_(false)
81  , fixdrawrg_(true)
82  , borderstyle_(OD::LineStyle())
83  , closepolygon_(true)
84  , drawliney_(true)
85  , useyscalefory2_(false)
86  , xannotinint_(false)
87  , yannotinint_(false)
88  , drawliney2_(true) {}
89 
93  mDefSetupMemb(Color,bgcol)
94  mDefSetupMemb(Color,ycol)
95  mDefSetupMemb(Color,y2col)
96  mDefSetupMemb(int,ywidth)
97  mDefSetupMemb(int,y2width)
98  mDefSetupMemb(int,canvaswidth)
99  mDefSetupMemb(int,canvasheight)
100  mDefSetupMemb(uiBorder,border)
101  mDefSetupMemb(int,curvzvaly)
102  mDefSetupMemb(int,curvzvaly2)
103  mDefSetupMemb(bool,annotx)
104  mDefSetupMemb(bool,annoty)
105  mDefSetupMemb(bool,annoty2)
106  mDefSetupMemb(bool,noxaxis)
107  mDefSetupMemb(bool,noyaxis)
108  mDefSetupMemb(bool,noy2axis)
109  mDefSetupMemb(bool,noxgridline)
110  mDefSetupMemb(bool,noygridline)
111  mDefSetupMemb(bool,noy2gridline)
112  mDefSetupMemb(int,pointsz)
113  mDefSetupMemb(bool,editable)
114  mDefSetupMemb(bool,fillbelow)
115  mDefSetupMemb(bool,fillbelowy2)
116  mDefSetupMemb(bool,drawliney)
117  mDefSetupMemb(bool,drawliney2)
118  mDefSetupMemb(bool,drawscattery1)
119  mDefSetupMemb(bool,drawscattery2)
120  mDefSetupMemb(MarkerStyle2D,markerstyley1)
121  mDefSetupMemb(MarkerStyle2D,markerstyley2)
122  mDefSetupMemb(bool,markerfilly1)
123  mDefSetupMemb(bool,markerfilly2)
124  mDefSetupMemb(bool,closepolygon)
125  mDefSetupMemb(bool,drawborder)
126  mDefSetupMemb(bool,useyscalefory2)
127  mDefSetupMemb(OD::LineStyle,borderstyle)
128  mDefSetupMemb(float,ptsnaptol)
129  mDefSetupMemb(bool,fixdrawrg)
130  mDefSetupMemb(bool,xannotinint)
131  mDefSetupMemb(bool,yannotinint)
132 
133  Setup& drawline( bool yn )
134  { drawliney_ = drawliney2_ = yn; return *this; }
135  Setup& drawgridlines( bool yn )
136  { noxgridline_ = noygridline_ = noy2gridline_ = !yn;
137  return *this; }
138  Setup& drawscatter( bool yn )
139  { drawscattery1_ = drawscattery2_ = yn; return *this; }
140  Setup& annot( bool yn )
141  { annotx_ = annoty_ = annoty2_ = yn; return *this; }
142  Setup& axes( bool yn )
143  { noxaxis_ = noyaxis_ = noy2axis_ = !yn; return *this; }
144 
145  };
146 
149 
150  void setTitle(const uiString&);
151  void setVals(const float* xvals,
152  const float* yvals,int sz);
153  void setVals(const Interval<float>&,
154  const float* yvals,int sz);
156  void setY2Vals(const float* xvals,
157  const float* yvals,int sz);
158  void setY2Vals(const Interval<float>&,
159  const float* yvals,int sz);
161  void setMarkValue(float,bool is_x);
162  void setMark2Value(float,bool is_x);
163  void setEmpty();
164 
165  const TypeSet<float>& xVals() const { return xvals_; }
166  const TypeSet<float>& yVals() const { return yvals_; }
167  uiAxisHandler* xAxis() { return xax_; }
168  uiAxisHandler* yAxis( bool y2) { return y2 ? y2ax_ : yax_; }
169  const uiAxisHandler* xAxis() const { return xax_; }
170  const uiAxisHandler* yAxis( bool y2) const
171  { return y2 ? y2ax_ : yax_; }
172  Setup& setup() { return setup_; }
173 
174  Geom::Point2D<float> getFuncXY(int xpix,bool y2) const;
175  Geom::Point2D<float> getXYFromPix(const Geom::Point2D<int>& pix,
176  bool y2) const;
177 
178  int size() const { return xvals_.size(); }
179 
182  int selPt() const { return selpt_; }
183 
184  void gatherInfo(bool y2=false);
185  void draw();
186 
187  void dump(od_ostream&,bool y2) const;
188 
189 protected:
190 
195  uiGraphicsItem* ypolyitem_;
196  uiGraphicsItem* y2polyitem_;
209 
218  int selpt_;
220 
221  void mousePress(CallBacker*);
222  void mouseRelease(CallBacker*);
223  void mouseMove(CallBacker*);
224  void mouseDClick(CallBacker*);
225  void addPoint(const uiPoint&);
226 
227  void cleanUp();
228  void setUpAxis(bool y2);
229  void getPointSet(TypeSet<uiPoint>&,bool y2);
230  void drawYCurve(const TypeSet<uiPoint>&);
231  void drawY2Curve(const TypeSet<uiPoint>&,bool havy2);
232  void drawMarker(const TypeSet<uiPoint>&,
233  bool y2=false);
234  void drawMarkLine(uiAxisHandler*,float,Color,
235  uiLineItem*&);
236  void drawBorder();
237  void drawMarkLines();
238  bool setSelPt();
239  void reSized( CallBacker* );
240  void saveImageAs( CallBacker* );
241  void getAxisRanges(const TypeSet<float>& vals,
242  const Interval<float>& setuprg,
243  Interval<float>&) const;
244 
245  virtual void drawData();
246 };
247 
248 
249 #endif
const uiAxisHandler * xAxis() const
Definition: uifunctiondisplay.h:169
uiLineItem * ymarkline2item_
Definition: uifunctiondisplay.h:207
#define mExpClass(module)
Definition: commondefs.h:160
uiPolyLineItem * ypolylineitem_
Definition: uifunctiondisplay.h:199
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
float ymarkline2val_
Definition: uifunctiondisplay.h:217
int selPt() const
Definition: uifunctiondisplay.h:182
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
FixedString Setup()
Definition: keystrs.h:116
Setup & setup()
Definition: uifunctiondisplay.h:172
const uiAxisHandler * yAxis(bool y2) const
Definition: uifunctiondisplay.h:170
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Definition: draw.h:64
Definition: draw.h:60
Definition: draw.h:118
uiPolygonItem * y2polygonitem_
Definition: uifunctiondisplay.h:198
Definition: uigraphicsitemimpl.h:192
const TypeSet< float > & yVals() const
Definition: uifunctiondisplay.h:166
TypeSet< float > xvals_
Definition: uifunctiondisplay.h:210
float xmarklineval_
Definition: uifunctiondisplay.h:214
int selpt_
Definition: uifunctiondisplay.h:218
Handles an axis on a plot.
Definition: uiaxishandler.h:51
uiGraphicsItemGroup * ymarkeritems_
Definition: uifunctiondisplay.h:202
Setup setup_
Definition: uifunctiondisplay.h:191
uiAxisHandler * y2ax_
Definition: uifunctiondisplay.h:194
Definition: uistring.h:89
Definition: uiparent.h:26
uiAxisHandler * xAxis()
Definition: uifunctiondisplay.h:167
uiGraphicsItem * y2polyitem_
Definition: uifunctiondisplay.h:196
TypeSet< float > y2yvals_
Definition: uifunctiondisplay.h:213
uiAxisHandler * xax_
Definition: uifunctiondisplay.h:192
int size() const
Definition: uifunctiondisplay.h:178
uiGraphicsItem * ypolyitem_
Definition: uifunctiondisplay.h:195
uiLineItem * ymarklineitem_
Definition: uifunctiondisplay.h:205
Definition: uigraphicsitem.h:157
uiRectItem * borderrectitem_
Definition: uifunctiondisplay.h:201
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
uiTextItem * titleitem_
Definition: uifunctiondisplay.h:208
displays a function of (X,Y) pairs on a canvas - optionally a Y2.
Definition: uifunctiondisplay.h:38
Definition: uigraphicsitemimpl.h:255
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
uiLineItem * xmarklineitem_
Definition: uifunctiondisplay.h:204
bool mousedown_
Definition: uifunctiondisplay.h:219
uiAxisHandler * yax_
Definition: uifunctiondisplay.h:193
Definition: uigeom.h:78
Definition: uigraphicsitemimpl.h:214
TypeSet< float > y2xvals_
Definition: uifunctiondisplay.h:212
static Color White()
Definition: color.h:85
uiPolygonItem * ypolygonitem_
Definition: uifunctiondisplay.h:197
Definition: uigraphicsview.h:51
uiGraphicsItemGroup * y2markeritems_
Definition: uifunctiondisplay.h:203
Notifier< uiFunctionDisplay > pointChanged
Definition: uifunctiondisplay.h:181
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
uiPolyLineItem * y2polylineitem_
Definition: uifunctiondisplay.h:200
Definition: uigraphicsitemimpl.h:273
uiAxisHandler * yAxis(bool y2)
Definition: uifunctiondisplay.h:168
const TypeSet< float > & xVals() const
Definition: uifunctiondisplay.h:165
Notifier< uiFunctionDisplay > pointSelected
Definition: uifunctiondisplay.h:180
uiLineItem * xmarkline2item_
Definition: uifunctiondisplay.h:206
TypeSet< float > yvals_
Definition: uifunctiondisplay.h:211
float ymarklineval_
Definition: uifunctiondisplay.h:215
Definition: uigraphicsitemimpl.h:110
float xmarkline2val_
Definition: uifunctiondisplay.h:216
Definition: uigraphicsscene.h:39

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