OpendTect  6.3
wellmarker.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: Aug 2003
9 ________________________________________________________________________
10 
11 
12 -*/
13 
14 #include "wellcommon.h"
15 #include "sharedobject.h"
16 #include "color.h"
17 #include "ranges.h"
18 #include "monitoriter.h"
19 #include "stratlevel.h"
20 
21 class TaskRunner;
22 
23 
24 
25 namespace Well
26 {
27 
28 
33 {
34 public:
35 
37  typedef float ZType;
38 
39  Marker(const char*,ZType d=0.f,Color c=Color());
40  Marker(LevelID,ZType);
41  ~Marker();
44 
45  bool operator >(const Marker&) const;
46 
47  virtual const OD::String& name() const;
48  virtual BufferString getName() const;
49 
50  mImplSimpleMonitoredGetSet(inline,dah,setDah,ZType,dah_,cDahChange());
51  mImplSimpleMonitoredGetSet(inline,levelID,setLevelID,LevelID,levelid_,
52  cLevelChange());
53  Color color() const;
54  mImplSimpleMonitoredSet(setColor,Color,color_,cColorChange());
55 
56  Strat::Level getLevel() const;
57  void setNoLevelID();
58 
59  static const char* sKeyDah();
60  static ChangeType cColorChange() { return 2; }
61  static ChangeType cLevelChange() { return 3; }
62  static ChangeType cDahChange() { return 4; } // like DahObj
63 
64  static const Marker& udf();
65  bool isUdf() const { return *this == udf(); }
66  static Marker& dummy();
67 
68 protected:
69 
70  float dah_;
72  LevelID levelid_;
73 
74  // Usable in locked state
75  BufferString gtName() const;
76  Strat::Level gtLevel() const;
77 
78 };
79 
80 
84 {
85 public:
86 
89  typedef size_type IdxType;
90  mDefIntegerIDType(IdxType, MarkerID);
91 
92 
93  MarkerSet();
94  ~MarkerSet();
97 
98  MarkerID add(const Marker&);
99  Marker get(MarkerID) const;
100  MarkerID set(const Marker&);
101  BufferString getNameByID(MarkerID) const;
102  void setNameByID(MarkerID,const char*);
103  Color getColor(MarkerID) const;
104  void setColor(MarkerID,const Color&);
105  float getDah(MarkerID) const;
106  void setDah(MarkerID,float);
107  void removeSingle(MarkerID);
108 
109  Marker getByIdx(IdxType) const;
110  void removeSingleByIdx(IdxType);
111  float getDahByIdx(IdxType) const;
112  void setDahByIdx(IdxType,float);
113 
114  float getDahFromMarkerName(const char*) const;
115  Marker first() const;
116  Marker last() const;
117 
118  IdxType indexOf(const char* nm) const;
119  Marker getByName(const char* nm) const;
120  Marker getByLvlID(LevelID id) const;
121  MarkerID markerIDFor(IdxType) const;
122  MarkerID markerIDFromName(const char*) const;
123  IdxType getIdxFor(MarkerID) const;
124  bool validIdx(IdxType) const;
125 
126  bool isPresent(const char* n) const;
127  bool isEmpty() const;
128  void setEmpty();
129  size_type size() const;
130 
131  void getNames(BufferStringSet&) const;
132  void getColors(TypeSet<Color>&) const;
133 
134  void fillWithAll(TaskRunner* tskr=0);
135  bool insertNew(const Well::Marker&);
136  void addSameWell(const MarkerSet&);
137  void mergeOtherWell(const MarkerSet&);
138  void append(const MarkerSet& ms)
139  { mergeOtherWell(ms); }
140  IdxType getIdxAbove(float z,const Well::Track* trck=0) const;
142 
143  void fillPar(IOPar&) const;
144  void usePar(const IOPar&);
145 
146 
147  static ChangeType cMarkerAdded() { return 2; }
148  static ChangeType cMarkerRemoved() { return 3; }
149  static ChangeType cMarkerChanged() { return 4; }
150 
151 
152 protected:
153 
157 
158  Marker gtByName(const char*) const; //without locks for own use
159  Marker gtByIndex(IdxType) const;
160  Marker gtByLvlID(LevelID) const;
161  IdxType idxOf(const char*) const;
162  IdxType gtIdxFor(MarkerID) const;
163  IdxType gtIdxForDah(float) const;
164  Marker gtByID(MarkerID) const;
165  MarkerID mrkrIDFor(IdxType) const;
166 
167  void addCopy(const MarkerSet&,IdxType,float);
168  void alignOrderingWith(const MarkerSet&);
169  void moveBlock(IdxType,IdxType,const TypeSet<IdxType>&);
170  bool insrtNew(const Well::Marker&);
171  void insrtNewAfter(IdxType,const MarkerSet&);
172  void insrtAt(IdxType,const Marker&);
173  void insrtAfter(IdxType,const Marker&);
174  void rmoveSingle(IdxType);
175  bool isPrsnt(const char* n) const;
176  size_type gtSize() const;
177 
178  friend class MarkerSetIter;
179  friend class MarkerSetIter4Edit;
180 };
181 
182 
190 {
191 public:
192 
193  typedef MarkerSet::MarkerID MarkerID;
194 
195  MarkerSetIter(const MarkerSet&,bool dorev=false);
196  MarkerSetIter(const MarkerSet&,MarkerID,MarkerID);
197  MarkerSetIter(const MarkerSet&,const char*,const char*);
199 
200  const MarkerSet& markerSet() const;
201 
202  MarkerID ID() const;
203 
204  const Marker& get() const;
205  float getDah() const;
206  BufferString markerName() const;
207 
209 
210 };
211 
212 
221 {
222 public:
223 
225  typedef MarkerSet::MarkerID MarkerID;
226 
227  MarkerSetIter4Edit(MarkerSet&,bool dorev=false);
229  MarkerSetIter4Edit(MarkerSet&,const char*,const char*);
231 
232  MarkerSet& markerSet();
233  const MarkerSet& markerSet() const;
234 
235  BufferString markerName() const;
236  MarkerID ID() const;
237  Marker& get() const;
238  float getDah() const;
239  void setDah(float);
240  void setColor(const Color&);
241 
242  void removeCurrent();
243  void insert(const Marker&);
244 
246 
247 };
248 
249 
254 {
255 public:
256 
259  typedef MarkerSet::MarkerID MarkerID;
260 
261  MarkerRange(const MarkerSet&,MarkerID,MarkerID);
262  MarkerRange(const MarkerSet&,const char*,const char*);
263  virtual ~MarkerRange();
264 
265  size_type size() const;
266  bool isValid() const;
267 
268  bool isIncluded(IdxType) const;
269  bool isIncluded(MarkerID) const;
270 
271  bool isIncluded(const char*) const;
272  bool isIncluded(float z) const;
273 
274  void getNames(BufferStringSet&) const;
275  MarkerSet* getResultSet() const;
276 
277  const MarkerSet& markers() const { return markerset_; }
278 
279  void setRangeForIDs(MarkerSet::MarkerID,MarkerSet::MarkerID);
280  float thickness() const;
281 
282 protected:
283 
284  Interval<IdxType> idxRange() const;
286  MarkerSet::MarkerID topid_;
287  MarkerSet::MarkerID botid_;
288 
289 };
290 
291 
295 {
296 public:
297 
299  MarkerID btid )
300  : MarkerRange(ms,tpid,btid) {}
301 
302  MarkerChgRange( MarkerSet& ms, const char* topmrkr,
303  const char* botmrkr )
304  : MarkerRange(ms,topmrkr,botmrkr) {}
305 
306 
307  void setThickness(float);
308  void remove();
309 
311  { return const_cast<MarkerSet&>(markerset_); }
312 
313 };
314 
315 
316 } // namespace Well
#define mExpClass(module)
Definition: commondefs.h:157
Set of Markers.
Definition: wellmarker.h:83
bool operator>(const NamedObject &obj1, const NamedObject &obj2)
Definition: namedobj.h:75
Range of markers (typically describing zone of interest). As with iterators, pass null or invalid for...
Definition: wellmarker.h:253
const MarkerSet iterator.
Definition: wellmarker.h:189
static ChangeType cMarkerRemoved()
Definition: wellmarker.h:148
int ChangeType
Definition: monitorable.h:80
MarkerSet::MarkerID botid_
Definition: wellmarker.h:287
Monitorable object with a name. All but name() are MT-safe.
Definition: namedmonitorable.h:20
short IdxType
Definition: seisblocksdata.h:39
MarkerRange that can change its MarkerSet.
Definition: wellmarker.h:294
base class for non-const Monitorable iterator.
Definition: monitoriter.h:111
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
Definition: sharedobject.h:18
TypeSet< Marker >::size_type size_type
Definition: wellmarker.h:88
static ChangeType cMarkerAdded()
Definition: wellmarker.h:147
const MarkerSet & markers() const
Definition: wellmarker.h:277
MarkerSet::IdxType IdxType
Definition: wellmarker.h:224
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
base class for const Monitorable iterator.
Definition: monitoriter.h:83
static ChangeType cMarkerChanged()
Definition: wellmarker.h:149
static ChangeType cDahChange()
Definition: wellmarker.h:62
#define mDeclMonitorableAssignment(clss)
like mDeclAbstractMonitorableAssignment but for non-abstract subclasses. Implements the clone() metho...
Definition: monitor.h:111
Strat::Level::ID LevelID
Definition: wellmarker.h:36
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
TypeSet< Marker > markers_
Definition: wellmarker.h:154
#define mImplSimpleMonitoredSet(fnnm, typ, memb, chgtyp)
Defines simple MT-safe copyable member change.
Definition: monitor.h:26
Stratigraphic level.
Definition: stratlevel.h:35
int size_type
Definition: typeset.h:29
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Class that can execute a task.
Definition: task.h:193
Marker::LevelID LevelID
Definition: wellmarker.h:87
#define mImplSimpleMonitoredGetSet(pfx, fnnmget, fnnmset, typ, memb, chgtyp)
Defines simple MT-safe copyable member access.
Definition: monitor.h:39
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:29
FixedString Color()
Definition: keystrs.h:44
Definition: wellcommon.h:16
Color color_
Definition: wellmarker.h:71
Well track.
Definition: welltrack.h:22
#define mDefIntegerIDType(IntType, classname)
Definition: integerid.h:83
MarkerSet::MarkerID topid_
Definition: wellmarker.h:286
#define mDefNoAssignmentOper(clss)
Definition: commondefs.h:131
static ChangeType cColorChange()
Definition: wellmarker.h:60
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
void append(const MarkerSet &ms)
Definition: wellmarker.h:138
MarkerSet::MarkerID MarkerID
Definition: wellmarker.h:259
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
bool isEmpty(const char *)
float dah_
Definition: wellmarker.h:70
MarkerSet & getMarkers()
Definition: wellmarker.h:310
bool isUdf() const
Definition: wellmarker.h:65
Marker, can be attached to Strat level. When not attached, uses the object&#39;s own (fallback) name and ...
Definition: wellmarker.h:32
LevelID levelid_
Definition: wellmarker.h:72
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:24
float ZType
Definition: wellmarker.h:37
Threads::Atomic< IdxType > curmrkridnr_
Definition: wellmarker.h:156
MarkerSet::MarkerID MarkerID
Definition: wellmarker.h:193
MarkerChgRange(MarkerSet &ms, MarkerID tpid, MarkerID btid)
Definition: wellmarker.h:298
FixedString ID()
Definition: keystrs.h:71
edit-while-iterate for MarkerSet. Work on a local copy!
Definition: wellmarker.h:219
size_type IdxType
Definition: wellmarker.h:89
MarkerChgRange(MarkerSet &ms, const char *topmrkr, const char *botmrkr)
Definition: wellmarker.h:302
TypeSet< MarkerID > markerids_
Definition: wellmarker.h:155
MarkerSet::IdxType IdxType
Definition: wellmarker.h:258
static ChangeType cLevelChange()
Definition: wellmarker.h:61
MarkerSet::size_type size_type
Definition: wellmarker.h:257
const MarkerSet & markerset_
Definition: wellmarker.h:285
MarkerSet::MarkerID MarkerID
Definition: wellmarker.h:225

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