OpendTect-6_4  6.4
uistratdispdata.h
Go to the documentation of this file.
1 #ifndef uistratdispdata_h
2 #define uistratdispdata_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bruno
9  Date: Mar 2010
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uistratmod.h"
16 #include "uistratmod.h"
17 #include "callback.h"
18 #include "color.h"
19 #include "ranges.h"
20 #include "bufstring.h"
21 #include "bufstringset.h"
22 
23 
24 namespace Strat
25 {
26  class UnitRef;
27  class LeavedUnitRef;
28  class NodeOnlyUnitRef;
29  class NodeUnitRef;
30  class RefTree;
31 }
32 
33 class uiStratRefTree;
34 class uiTreeViewItem;
35 
37 {
38 public:
40  ~StratDispData() { eraseData(); }
41 
42  mStruct(uiStrat) Unit
43  {
44  Unit(const char* nm, const char* fullcode=0,
45  const Color& col = Color::White() )
46  : name_( nm )
47  , fullcode_(fullcode)
48  , color_(col)
49  , isdisplayed_(true)
50  {}
51 
52  const char* name() const { return name_.buf(); }
53  const char* fullCode() const { return fullcode_.buf(); }
54 
55  Color color_;
56  Interval<float> zrg_;
57  bool isdisplayed_;
58 
59  int colidx_; //tree depth
60 
61  protected :
62 
63  BufferString name_;
64  BufferString fullcode_;
65  };
66 
67 
68  mStruct(uiStrat) Level
69  {
70  Level(const char* nm,const char* unitcode)
71  : unitcode_(unitcode)
72  , name_( nm )
73  {}
74 
75  const BufferString name_;
76  const BufferString unitcode_;
77  Color color_;
78  float zpos_;
79  };
80 
81 
82  mStruct(uiStrat) Column
83  {
84  Column( const char* nm )
85  : name_(nm)
86  , isdisplayed_(true)
87  {}
88 
89  const BufferString name_;
90  bool isdisplayed_;
91 
92  ObjectSet<Unit> units_;
93  ObjectSet<Level> levels_;
94  };
95 
96 
97 
98  void eraseData()
99  {
100  for ( int idx=0; idx<cols_.size(); idx++ )
101  {
102  cols_[idx]->units_.erase();
103  cols_[idx]->levels_.erase();
104  }
105  cols_.erase();
106  }
107 
108  void addCol( Column* col )
109  { cols_ += col; }
110 
111  int nrCols() const
112  { return cols_.size(); }
113  int nrUnits( int colidx ) const
114  { return cols_[colidx]->units_.size(); }
115  void addUnit( int colidx, Unit* un )
116  { cols_[colidx]->units_ += un; un->colidx_=colidx; }
117 
118  const Column* getCol( int idx ) const
119  { return cols_[idx]; }
120  Column* getCol( int idx )
121  { return cols_[idx]; }
122  Unit* getUnit( int colidx, int uidx )
123  { return gtUnit( colidx, uidx ); }
124  const Unit* getUnit( int colidx, int uidx ) const
125  { return gtUnit( colidx, uidx ); }
126 
127  int nrLevels( int colidx ) const
128  { return cols_[colidx]->levels_.size(); }
129  const Level* getLevel( int colidx, int lidx ) const
130  { return cols_[colidx]->levels_[lidx]; }
131 
132  int nrDisplayedCols() const
133  {
134  int nr = 0;
135  for ( int idx=0; idx<cols_.size(); idx++)
136  { if ( cols_[idx]->isdisplayed_ ) nr++; }
137  return nr;
138  }
139 
140 protected :
141 
142  Unit* gtUnit( int colidx, int uidx ) const
143  { return const_cast<Unit*>(
144  cols_[colidx]->units_[uidx] ); }
145 
147 };
148 
149 
150 
154 {
155 public:
157  bool withaux=true,
158  bool withlvls=true);
160 
161  void setTree();
163 
164  int levelColIdx() const { return levelcolidx_; }
165 
166 protected:
167 
170 
171  bool withauxs_; //lithologies & descriptions
176 
177  void readUnits();
178  void addUnit(const Strat::NodeUnitRef&);
179  void addDescs(const Strat::LeavedUnitRef&);
180  void addLithologies(const Strat::LeavedUnitRef&);
181  void addLevel(const Strat::LeavedUnitRef&);
182  void addAnnot(const char*,Interval<float>& posrg,bool);
183  void readFromTree();
184 
185  void triggerDataChange(CallBacker*);
186  void treeDel(CallBacker*);
187 };
188 
189 
194 {
195 public:
198 
199  uiTreeViewItem* getItemFromTree(const char*);
200 
201  void handleUnitMenu(const char*);
202  void handleUnitProperties(const char*);
203  void setUnitLvl(const char*);
204  void addUnit(const char*);
205 
206 protected:
207 
209 
210 public:
211  uiTreeViewItem* setCurrentTreeItem(const char*);
212 };
213 
214 #endif
#define mExpClass(module)
Definition: commondefs.h:160
void addUnit(int colidx, Unit *un)
Definition: uistratdispdata.h:115
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
ObjectSet< Column > cols_
Definition: uistratdispdata.h:146
UnitRef for units containing Leaf units only.
Definition: stratunitref.h:199
int nrCols() const
Definition: uistratdispdata.h:111
FixedString Level()
Definition: keystrs.h:78
const Unit * getUnit(int colidx, int uidx) const
Definition: uistratdispdata.h:124
#define mStruct(module)
Definition: commondefs.h:165
Column * getCol(int idx)
Definition: uistratdispdata.h:120
bool withauxs_
Definition: uistratdispdata.h:171
int nrDisplayedCols() const
Definition: uistratdispdata.h:132
StratDispData()
Definition: uistratdispdata.h:39
void addCol(Column *col)
Definition: uistratdispdata.h:108
const Level * getLevel(int colidx, int lidx) const
Definition: uistratdispdata.h:129
used to gather all units and tied levels from a tree for display
Definition: uistratdispdata.h:153
int levelcolidx_
Definition: uistratdispdata.h:175
int lithocolidx_
Definition: uistratdispdata.h:173
~StratDispData()
Definition: uistratdispdata.h:40
uiStratRefTree & uitree_
Definition: uistratdispdata.h:208
Strat::RefTree * tree_
Definition: uistratdispdata.h:169
Set of pointers to objects.
Definition: commontypes.h:32
Unit * gtUnit(int colidx, int uidx) const
Definition: uistratdispdata.h:142
Unit * getUnit(int colidx, int uidx)
Definition: uistratdispdata.h:122
FixedString Unit()
Definition: keystrs.h:143
Definition: uitreeview.h:201
StratDispData & data_
Definition: uistratdispdata.h:168
UnitRef for units containing other units only.
Definition: stratunitref.h:118
void eraseData()
Definition: uistratdispdata.h:98
const Column * getCol(int idx) const
Definition: uistratdispdata.h:118
int nrUnits(int colidx) const
Definition: uistratdispdata.h:113
Stratigraphy.
Definition: stratlevel.h:26
static Color White()
Definition: color.h:85
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Definition: uistratdispdata.h:36
Tree of UnitRef&#39;s.
Definition: stratreftree.h:29
Definition: uistratdispdata.h:193
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
bool withlevels_
Definition: uistratdispdata.h:172
int nrLevels(int colidx) const
Definition: uistratdispdata.h:127
int levelColIdx() const
Definition: uistratdispdata.h:164
Notifier< uiStratTreeToDisp > newtreeRead
Definition: uistratdispdata.h:162
int desccolidx_
Definition: uistratdispdata.h:174
Displays a Strat::RefTree.
Definition: uistratreftree.h:33

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