OpendTect-6_4  6.4
uiaxishandler.h
Go to the documentation of this file.
1 #ifndef uiaxishandler_h
2 #define uiaxishandler_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Mar 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uitoolsmod.h"
16 #include "draw.h"
17 #include "bufstringset.h"
18 #include "namedobj.h"
19 #include "uigeom.h"
20 #include "uistring.h"
21 #include "fontdata.h"
22 
23 class uiGraphicsScene;
24 class uiLineItem;
25 class uiTextItem;
26 class uiAHPlotAnnotSet;
27 template <class T> class LineParameters;
28 
52 {
53 public:
54 
55  struct Setup
56  {
57  Setup( uiRect::Side s, int w=0, int h=0 )
58  : side_(s)
59  , noaxisline_(false)
60  , noaxisannot_(false)
61  , nogridline_(false)
62  , showauxannot_(false)
63  , auxlinestyle_(OD::LineStyle(OD::LineStyle::Dot))
64  , annotinside_(false)
65  , annotinint_(false)
66  , fixedborder_(false)
67  , ticsz_(2)
68  , width_(w)
69  , height_(h)
70  , maxnrchars_(0)
71  , specialvalue_(0.0f)
72  , islog_(false)
73  , zval_(4)
74  , nmcolor_(Color::NoColor())
75  , fontdata_(FontData(10))
76  {}
77 
79  mDefSetupMemb(int,width)
80  mDefSetupMemb(int,height)
81  mDefSetupMemb(bool,islog)
82  mDefSetupMemb(bool,noaxisline)
83  mDefSetupMemb(bool,noaxisannot)
84  mDefSetupMemb(bool,nogridline)
85  mDefSetupMemb(bool,annotinside)
86  mDefSetupMemb(bool,annotinint)
87  mDefSetupMemb(bool,fixedborder)
88  mDefSetupMemb(bool,showauxannot)
89  mDefSetupMemb(int,ticsz)
91  mDefSetupMemb(OD::LineStyle,style)
92  mDefSetupMemb(OD::LineStyle,gridlinestyle)
93  mDefSetupMemb(OD::LineStyle,auxlinestyle)
94  mDefSetupMemb(OD::LineStyle,auxhllinestyle)
95  mDefSetupMemb(uiString,caption)
96  mDefSetupMemb(int,maxnrchars)
97  mDefSetupMemb(float,specialvalue)
98  mDefSetupMemb(int,zval)
99  mDefSetupMemb(Color,nmcolor)
100  mDefSetupMemb(FontData,fontdata)
101 
102  Setup& noannot( bool yn )
103  { noaxisline_ = noaxisannot_ = nogridline_ = yn;
104  return *this; }
105 
106  void setShowSpecialValue( bool yn, float newval=0.0f )
107  { specialvalue_ = yn ? newval : mUdf(float); }
108  bool showSpecialValue() const
109  { return !mIsUdf(specialvalue_); }
110  };
111 
113  ~uiAxisHandler();
114 
115  void setCaption(const uiString&);
116  uiString getCaption() const { return setup_.caption_; }
117  void setBorder(const uiBorder&);
118  void setIsLog(bool yn);
119  void setBegin( const uiAxisHandler* ah )
120  { beghndlr_ = ah; newDevSize();}
121  void setEnd( const uiAxisHandler* ah )
122  { endhndlr_ = ah; newDevSize();}
123 
124  void setRange(const StepInterval<float>&,float* axstart=0);
125  void setBounds(Interval<float>);
126 
127  float getVal(int pix) const;
128  float getRelPos(float absval) const;
129  int getPix(float absval) const;
130  int getPix(double abvsval) const;
131  int getPix(int) const;
132  int getRelPosPix(float relpos) const;
134  { auxannots_ = pos; }
135 
136  const Setup& setup() const { return setup_; }
137  Setup& setup() { return setup_; }
138  StepInterval<float> range() const { return datarg_; }
139  float annotStart() const { return annotstart_; }
140  bool isHor() const { return uiRect::isHor(setup_.side_); }
141  int pixToEdge(bool withborder=true) const;
142  int pixBefore() const;
143  int pixAfter() const;
144  Interval<int> pixRange() const;
145 
147  void newDevSize();
148  void updateDevSize();
149  void setNewDevSize(int,int);
150  void updateScene();
151 
152  uiLineItem* getTickLine(int pix);
153  uiLineItem* getGridLine(int pix);
154  int getNrAnnotCharsForDisp() const;
155  void setVisible(bool);
156  void annotAtEnd(const uiString&);
157 
158 protected:
159 
164 
166  bool islog_;
168  float annotstart_;
170  int ticsz_;
171  int height_;
172  int width_;
176 
178  uiAHPlotAnnotSet& annots_;
180  float endpos_;
181  int devsz_;
182  int axsz_;
183  bool rgisrev_;
185  float rgwidth_;
186  float epsilon_;
188  int nrsteps_;
189 
190  int ticSz() const
191  { return setup_.noaxisannot_ ? 0 : ticsz_; }
192  int tickEndPix(bool farend) const;
193  void updateAxisLine();
194  bool reCalcAnnotation();
195  void updateName();
196 
197  friend class uiAHPlotAnnotSet;
198 
199 };
200 
202 mGlobal(uiTools) void setLine(uiLineItem&,const LineParameters<float>&,
203  const uiAxisHandler& xah,const uiAxisHandler& yah,
204  const Interval<float>* xvalrg = 0);
205 
206 
207 #endif
#define mExpClass(module)
Definition: commondefs.h:160
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
int ticsz_
Definition: uiaxishandler.h:170
float annotstart_
Definition: uiaxishandler.h:168
StepInterval< float > datarg_
Definition: uiaxishandler.h:167
Steepness and intercept.
Definition: linear.h:26
const uiAxisHandler * beghndlr_
Definition: uiaxishandler.h:174
#define mGlobal(module)
Definition: commondefs.h:163
int ticSz() const
Definition: uiaxishandler.h:190
StepInterval< float > range() const
Definition: uiaxishandler.h:138
uiTextItem * nameitm_
Definition: uiaxishandler.h:161
Handles an axis on a plot.
Definition: uiaxishandler.h:51
int axsz_
Definition: uiaxishandler.h:182
bool showSpecialValue() const
Definition: uiaxishandler.h:108
Definition: uistring.h:89
Data needed to make an actual font.
Definition: fontdata.h:20
void setAuxAnnot(const TypeSet< PlotAnnotation > &pos)
Definition: uiaxishandler.h:133
float rgwidth_
Definition: uiaxishandler.h:185
FixedString LineStyle()
Definition: keystrs.h:80
void setLine(uiLineItem &, const LineParameters< float > &, const uiAxisHandler &xah, const uiAxisHandler &yah, const Interval< float > *xvalrg=0)
draws line not outside box defined by X and Y value ranges
void setEnd(const uiAxisHandler *ah)
Definition: uiaxishandler.h:121
float epsilon_
Definition: uiaxishandler.h:186
TypeSet< PlotAnnotation > auxannots_
Definition: uiaxishandler.h:179
Setup & setup()
Definition: uiaxishandler.h:137
Setup setup_
Definition: uiaxishandler.h:165
bool isHor() const
Definition: uiaxishandler.h:140
int reqnrchars_
Definition: uiaxishandler.h:173
int height_
Definition: uiaxishandler.h:171
uiString getCaption() const
Definition: uiaxishandler.h:116
StepInterval< float > annotrg_
Definition: uiaxishandler.h:187
Setup(uiRect::Side s, int w=0, int h=0)
Definition: uiaxishandler.h:57
int nrsteps_
Definition: uiaxishandler.h:188
uiAHPlotAnnotSet & annots_
Definition: uiaxishandler.h:178
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
float endpos_
Definition: uiaxishandler.h:180
void setBegin(const uiAxisHandler *ah)
Definition: uiaxishandler.h:119
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
int pxsizeinotherdir_
Definition: uiaxishandler.h:177
uiLineItem * axislineitm_
Definition: uiaxishandler.h:163
const uiAxisHandler * endhndlr_
Definition: uiaxishandler.h:175
Definition: uigeom.h:78
int devsz_
Definition: uiaxishandler.h:181
const Setup & setup() const
Definition: uiaxishandler.h:136
int width_
Definition: uiaxishandler.h:172
uiTextItem * endannotitm_
Definition: uiaxishandler.h:162
uiGraphicsScene * scene_
Definition: uiaxishandler.h:160
float annotStart() const
Definition: uiaxishandler.h:139
OpendTect.
Definition: commontypes.h:29
uiBorder border_
Definition: uiaxishandler.h:169
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
Definition: uigraphicsitemimpl.h:273
bool islog_
Definition: uiaxishandler.h:166
Definition: uiaxishandler.h:55
bool ynmtxtvertical_
Definition: uiaxishandler.h:184
void setShowSpecialValue(bool yn, float newval=0.0f)
Definition: uiaxishandler.h:106
Side
Definition: uigeom.h:46
Definition: uigraphicsitemimpl.h:110
bool rgisrev_
Definition: uiaxishandler.h:183
Definition: uigraphicsscene.h:39

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