OpendTect-6_4  6.4
stratlith.h
Go to the documentation of this file.
1 #ifndef stratlith_h
2 #define stratlith_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert Bril
9  Date: Dec 2003
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "stratmod.h"
17 #include "namedobj.h"
18 #include "manobjectset.h"
19 #include "color.h"
20 class BufferStringSet;
21 
22 
23 namespace Strat
24 {
25 
38 {
39 public:
40 
41  typedef int ID;
42 
43  Lithology(ID id,const char* nm,bool por=false);
44  Lithology( const Lithology& l )
45  : id_(l.id_) { *this = l; }
46  Lithology& operator =(const Lithology&);
47  bool operator ==( const Lithology& l ) const
48  { return l.id_ == id_; }
49 
50  bool isUdf() const { return this == &undef(); }
51  static bool isUdf( ID id ) { return id == undef().id_; }
52 
53  ID id() const { return id_; }
54  bool& porous() { return porous_; }
55  bool porous() const { return porous_; }
56  Color& color() { return color_; }
57  const Color& color() const { return color_; }
58 
59  static const Lithology& undef();
60 
61 protected:
62 
63  const ID id_;
64  bool porous_;
66 
67  friend class LithologySet;
68 
69 public:
70 
71  Lithology(const char*); // from string in file
72  void fill(BufferString&) const;
73 
74 };
75 
76 
78 {
79 public:
81  : anyChange(this) {}
82 
83  int size() const { return lths_.size(); }
84  bool isEmpty() const { return lths_.isEmpty(); }
85  Lithology& getLith( int i ) { return *lths_[i]; }
86  const Lithology& getLith( int i ) const { return *lths_[i]; }
87 
88  int indexOf( const char* nm ) const { return idxOf(nm,-2);}
89  bool isPresent(const char* nm) const { return gtLith(nm,-2);}
90  int indexOf( Lithology::ID id ) const { return idxOf(0,id);}
91  bool isPresent( Lithology::ID id ) const { return gtLith(0,id);}
92 
93  Lithology* get( const char* nm ) { return gtLith(nm,-2);}
94  const Lithology* get( const char* nm ) const { return gtLith(nm,-2);}
95  Lithology* get( Lithology::ID id ) { return gtLith(0,id); }
96  const Lithology* get( Lithology::ID id ) const { return gtLith(0,id); }
97 
98  enum PorSel { OnlyPorous, NotPorous, AllPor };
99  void getNames(BufferStringSet&,PorSel ps=AllPor) const;
100 
101  Lithology::ID getFreeID() const;
102 
103  void reportAnyChange() { anyChange.trigger(); }
105 
106 protected:
107 
109 
110  int idxOf(const char*,Lithology::ID) const;
111  Lithology* gtLith( const char* nm, Lithology::ID id ) const
112  { const int idx = idxOf(nm,id); return idx < 0 ? 0
113  : const_cast<Lithology*>(lths_[idx]); }
114 
115 public:
116 
117  void setEmpty() { lths_.erase(); }
118  const char* add(Lithology*);
120 
121  const ObjectSet<Lithology>& lithologies() const { return lths_; }
122  ObjectSet<Lithology>& lithologies() { return lths_; }
123 
124 };
125 
126 
127 }; // namespace Strat
128 
129 #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 operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Definition: stratlith.h:77
Notifier< LithologySet > anyChange
Definition: stratlith.h:104
virtual void erase()
Definition: manobjectset.h:37
bool & porous()
Definition: stratlith.h:54
Color color_
Definition: stratlith.h:65
PorSel
Definition: stratlith.h:98
void setEmpty()
Definition: stratlith.h:117
int indexOf(const char *nm) const
Definition: stratlith.h:88
Set of BufferString objects.
Definition: bufstringset.h:28
bool isUdf() const
Definition: stratlith.h:50
ID id() const
Definition: stratlith.h:53
Definition: callback.h:254
Set of pointers to objects.
Definition: commontypes.h:32
Lithology & getLith(int i)
Definition: stratlith.h:85
int indexOf(Lithology::ID id) const
Definition: stratlith.h:90
static bool isUdf(ID id)
Definition: stratlith.h:51
a name and an ID.
Definition: stratlith.h:37
int ID
Definition: stratlith.h:41
int size() const
Definition: stratlith.h:83
ManagedObjectSet< Lithology > lths_
Definition: stratlith.h:108
Lithology * gtLith(const char *nm, Lithology::ID id) const
Definition: stratlith.h:111
bool porous_
Definition: stratlith.h:64
const ObjectSet< Lithology > & lithologies() const
Definition: stratlith.h:121
Stratigraphy.
Definition: stratlevel.h:26
const Lithology & getLith(int i) const
Definition: stratlith.h:86
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
LithologySet()
Definition: stratlith.h:80
const Color & color() const
Definition: stratlith.h:57
Object with a name.
Definition: namedobj.h:35
Lithology(const Lithology &l)
Definition: stratlith.h:44
Color & color()
Definition: stratlith.h:56
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 isPresent(Lithology::ID id) const
Definition: stratlith.h:91
const ID id_
Definition: stratlith.h:63
ObjectSet where the objects contained are owned by this set.
Definition: manobjectset.h:23
ObjectSet< Lithology > & lithologies()
Definition: stratlith.h:122
bool isPresent(const char *nm) const
Definition: stratlith.h:89
bool isEmpty() const
Definition: stratlith.h:84
bool porous() const
Definition: stratlith.h:55
void reportAnyChange()
Definition: stratlith.h:103

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