OpendTect-6_4  6.4
stratcontent.h
Go to the documentation of this file.
1 #ifndef stratcontent_h
2 #define stratcontent_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Jan 2012
10  RCS: $Id$
11 ________________________________________________________________________
12 
13  Impl is in stratlith.cc.
14 
15 -*/
16 
17 #include "stratmod.h"
18 #include "namedobj.h"
19 #include "objectset.h"
20 #include "draw.h"
21 
24 namespace Strat
25 {
26 
30 {
31 public:
32 
33  Content( const char* nm )
34  : NamedObject(nm) {}
35  Content( const Content& c )
36  : NamedObject(c)
37  , pattern_(c.pattern_)
38  , color_(c.color_) {}
39 
40  Content& operator =( const Content& c )
41  {
42  setName(c.name());
43  pattern_=c.pattern_;
44  color_ = c.color_;
45  return *this;
46  }
47  bool operator ==( const Content& c ) const
48  { return name() == c.name(); }
49 
50  inline bool isUnspecified() const
51  { return this == &unspecified(); }
52 
53  static const Content& unspecified();
54 
57 
58  bool getApearanceFrom(const char*);
59  void putAppearanceTo(BufferString&) const;
60 
61 };
62 
63 
65 mGlobal(Strat) inline bool isUnspecified( const Content* ct )
66 {
67  return !ct || ct->isUnspecified();
68 }
69 
70 
74 {
75 public:
76 
77  ~ContentSet() { deepErase(*this); }
78 
79  int getIndexOf(const char*) const;
80 
81  Content* getByName( const char* s )
82  { const int idx = getIndexOf(s); return idx<0 ? 0 : (*this)[idx]; }
83  const Content* getByName( const char* s ) const
84  { return const_cast<ContentSet*>(this)->getByName(s); }
85 
86  const Content& get( const char* s ) const
87  { const Content* c = getByName(s); return c ? *c : Content::unspecified(); }
88 
89 };
90 
91 
92 } // namespace Strat
93 
94 #endif
Color color_
Definition: stratcontent.h:55
#define mExpClass(module)
Definition: commondefs.h:160
Definition: draw.h:146
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
#define mGlobal(module)
Definition: commondefs.h:163
bool isUnspecified(const Content *ct)
convenience: contents can be null or unspecified, handle in one go
Definition: stratcontent.h:65
Content * getByName(const char *s)
Definition: stratcontent.h:81
bool isUnspecified() const
Definition: stratcontent.h:50
const Content * getByName(const char *s) const
Definition: stratcontent.h:83
Content(const char *nm)
Definition: stratcontent.h:33
Set of pointers to objects.
Definition: commontypes.h:32
static const Content & unspecified()
Content(const Content &c)
Definition: stratcontent.h:35
~ContentSet()
Definition: stratcontent.h:77
set of names for stuff that can be inside porous layers
Definition: stratcontent.h:73
Stratigraphy.
Definition: stratlevel.h:26
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
FillPattern pattern_
Definition: stratcontent.h:56
Object with a name.
Definition: namedobj.h:35
stuff that can be inside porous layers
Definition: stratcontent.h:29
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
virtual const OD::String & name() const
Definition: namedobj.h:47
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:118

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