OpendTect  6.3
stratlevel.h
Go to the documentation of this file.
1 #pragma once
2 
3 /*+
4 ________________________________________________________________________
5 
6  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
7  Author: Bert Bril
8  Date: Dec 2003
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "generalmod.h"
14 #include "sharedobject.h"
15 #include "undefval.h"
16 #include "ranges.h"
17 #include "color.h"
18 #include "repos.h"
19 #include "integerid.h"
20 #include "uistring.h"
21 class ascistream;
22 class BufferStringSet;
23 
24 
25 namespace Strat
26 {
27 
28 
35 mExpClass(General) Level : public NamedMonitorable
36 {
37 public:
38 
39  mDefIntegerIDType(int,ID);
40 
41  Level(const char* nm,const Color&,ID =ID::getInvalid());
42 
44  bool isDifferentFrom(const Level&) const;
46 
47  inline mImplSimpleMonitoredGet(id,ID,id_)
48  mImplSimpleMonitoredGetSet(inline,color,setColor,Color,color_,cColChange())
49  mImplSimpleMonitoredGetSet(inline,pars,setPars,IOPar,pars_,cParsChange())
50 
51  static const Level& undef();
52  bool isUndef() const;
54 
55  static ChangeType cColChange() { return 2; }
56  static ChangeType cParsChange() { return 3; }
57 
58 protected:
59 
60  Level(const Level&,ID::IDType);
61  const ID id_;
64 
65  void fillPar(IOPar&) const;
66  void usePar(const IOPar&);
67 
68  friend class LevelSet;
69 
70 public:
71 
72  virtual ~Level();
73 
74 };
75 
76 
86 mExpClass(General) LevelSet : public SharedObject
87 {
88 public:
89  mDefIntegerIDType(int,LVLID);
90 
91  typedef Level::ID ID;
93  typedef size_type IdxType;
94 
95 
96  LevelSet(int idstartidsat=0);
98 
99  bool isEmpty() const { return size() < 1; }
100  size_type size() const;
101  void setEmpty();
102 
103  bool isPresent(ID) const;
104  bool isPresent(const char*) const;
105  ID getIDByName(const char*) const;
106  ID getIDByIdx(IdxType) const;
107  IdxType indexOf(ID) const;
108  IdxType indexOf(const char*) const;
109  void getNames(BufferStringSet&) const;
110  BufferString levelName(ID) const;
111  Color levelColor(ID) const;
112  IOPar levelPars(ID) const;
113 
114  Level get(ID) const;
115  Level getByIdx(int) const;
116  Level getByName(const char*) const;
117  Level first() const;
118 
119  ID add(const char*,const Color&);
120  void remove(ID);
121 
122  ID set(const Level&);
123  ID add( const Level& lvl ) { return set( lvl ); }
124  void add(const BufferStringSet&,const TypeSet<Color>&);
125 
126  static ChangeType cLevelAdded() { return 2; }
127  static ChangeType cLevelToBeRemoved() { return 3; }
128 
129  bool store(Repos::Source) const;
130  bool read(Repos::Source);
131  bool readFrom(const char*);
132  bool writeTo(const char*) const;
133 
134  static void getStdNames(BufferStringSet&);
135  static LevelSet* createStd(const char*);
136 
137 protected:
138 
139  virtual ~LevelSet();
140 
143 
144  int gtIdxOf(const char*,ID) const;
145  Level gtLvl(int) const;
146  void doSetEmpty();
147  ID doSet(const Level&,bool* isnew=0);
148 
149  void getFromStream(ascistream&,bool);
151 
152 public:
153 
154  Repos::Source readOldRepos();
155  friend class LevelSetMgr;
156 
157 };
158 
159 mGlobal(General) const LevelSet& LVLS();
160 inline LevelSet& eLVLS() { return const_cast<LevelSet&>(LVLS()); }
161 
162 // From here: do not use, you will not need it.
163 // Needless to say that if you push, make sure you pop (so afterwards the real
164 // default levels are restored
165 mGlobal(General) void pushLevelSet(LevelSet*);
166 mGlobal(General) void popLevelSet();
167 mGlobal(General) const LevelSet& unpushedLVLS();
168 mGlobal(General) void setLVLS(LevelSet*);
169 mGlobal(General) BufferString getStdFileName(const char* inpnm,
170  const char* basenm);
172 
173 
174 }; //namespace
Threads::Atomic< ID::IDType > curlevelid_
Definition: stratlevel.h:142
#define mExpClass(module)
Definition: commondefs.h:157
Strat::Level::ID lvlid_
Definition: stratlevel.h:150
Set of Stratigraphic levels.
Definition: stratlevel.h:86
void popLevelSet()
int ChangeType
Definition: monitorable.h:80
void setLVLS(LevelSet *)
Monitorable object with a name. All but name() are MT-safe.
Definition: namedmonitorable.h:20
FixedString Level()
Definition: keystrs.h:78
#define mGlobal(module)
Definition: commondefs.h:160
static ChangeType cParsChange()
Definition: stratlevel.h:56
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
Definition: sharedobject.h:18
int size_type
Definition: objectset.h:37
bool isEmpty() const
Definition: stratlevel.h:99
#define mImplSimpleMonitoredGet(fnnm, typ, memb)
Defines simple MT-safe copyable member get.
Definition: monitor.h:21
Set of BufferString objects.
Definition: bufstringset.h:25
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
ObjectSet< Level > lvls_
Definition: stratlevel.h:141
const LevelSet & LVLS()
static ChangeType cLevelAdded()
Definition: stratlevel.h:126
const LevelSet & unpushedLVLS()
#define mDeclMonitorableAssignment(clss)
like mDeclAbstractMonitorableAssignment but for non-abstract subclasses. Implements the clone() metho...
Definition: monitor.h:111
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
Set of pointers to objects.
Definition: commontypes.h:28
Color color_
Definition: stratlevel.h:62
Stratigraphic level.
Definition: stratlevel.h:35
static ChangeType cLevelToBeRemoved()
Definition: stratlevel.h:127
Level::ID ID
Definition: stratlevel.h:91
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
size_type IdxType
Definition: stratlevel.h:93
#define mImplSimpleMonitoredGetSet(pfx, fnnmget, fnnmset, typ, memb, chgtyp)
Defines simple MT-safe copyable member access.
Definition: monitor.h:39
ObjectSet< Level >::size_type size_type
Definition: stratlevel.h:92
ID add(const Level &lvl)
Definition: stratlevel.h:123
Source
Definition: repos.h:23
#define mDefIntegerIDType(IntType, classname)
Definition: integerid.h:83
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
OpendTect standard ascii format file reading.
Definition: ascstream.h:81
IOPar pars_
Definition: stratlevel.h:63
LevelSet & eLVLS()
Definition: stratlevel.h:160
Stratigraphy.
Definition: stratlevel.h:25
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
const ID id_
Definition: stratlevel.h:61
BufferString getStdFileName(const char *inpnm, const char *basenm)
example: getStdFileName("North Sea","Levels")
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:24
FixedString ID()
Definition: keystrs.h:71
void pushLevelSet(LevelSet *)

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