OpendTect  6.6
welldahobj.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: May 2004
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 
13 -*/
14 
15 #include "wellmod.h"
16 #include "sets.h"
17 #include "namedobj.h"
18 #include "ranges.h"
19 
20 namespace Well
21 {
22 
27 mExpClass(Well) DahObj : public ::NamedCallBacker
28 {
29 public:
30 
31  DahObj( const char* nm=0 );
32  DahObj( const DahObj& d );
34 
35  inline int size() const { return dah_.size(); }
36  inline float dah(int idx) const { return dah_[idx]; }
37  virtual float value(int idx) const = 0;
38  virtual bool insertAtDah(float dah, float val) = 0;
39  int indexOf(float dah) const;
40  virtual void remove( int idx )
41  { dah_.removeSingle(idx); removeAux(idx); }
42  virtual void setEmpty()
43  { dah_.erase(); eraseAux(); }
44  inline bool isEmpty() const { return size() == 0; }
49 
50  float dahStep(bool min_else_average) const;
51 
52  void addToDahFrom(int fromidx,float extradah);
53  void removeFromDahFrom(int fromidx,float extradah);
54 
55  void deInterpolate();
57  float* dahArr() { return dah_.arr(); }
58  const float* dahArr() const { return dah_.arr(); }
59 
61 
62 protected:
63 
64  DahObj& operator =(const DahObj&);
65 
68 
69  virtual void removeAux(int) = 0;
70  virtual void eraseAux() = 0;
71 };
72 
73 
74 #define mWellDahObjInsertAtDah(dh,v,vals,ascvalonly)\
75 {\
76  if ( mIsUdf(v) ) return false;\
77  const bool ascendingvalonly = (ascvalonly); \
78  if ( dah_.isEmpty() || dh >= dah_[dah_.size()-1] )\
79  {\
80  if ( !dah_.isEmpty() && ascendingvalonly && v <= vals[dah_.size()-1] )\
81  return false;\
82  dah_ += dh; vals += val;\
83  return true;\
84  }\
85  if ( dh < dah_[0] )\
86  {\
87  if ( ascendingvalonly && v >= vals[0] )\
88  return false;\
89  dah_.insert( 0, dh ); vals.insert( 0, v );\
90  return true; \
91  }\
92  const int insertidx = indexOf( dh );\
93  if ( insertidx<0 ) return false;\
94  if ( ascendingvalonly && (v <= vals[insertidx] || v >= vals[insertidx+1]) )\
95  return false;\
96  dah_.insert( insertidx+1, dh ); vals.insert( insertidx+1, v );\
97 }
98 
99 
100 
101 }; // namespace Well
102 
Well::DahObj::dahArr
const float * dahArr() const
Definition: welldahobj.h:58
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
Well::DahObj::indexOf
int indexOf(float dah) const
namedobj.h
Well::DahObj::dahRange
Interval< float > dahRange() const
returns Udf for empty dah_
Well::DahObj::dah
float dah(int idx) const
Definition: welldahobj.h:36
Well::DahObj::~DahObj
~DahObj()
Well
Definition: directionalsurvey.h:20
Well::DahObj::DahObj
DahObj(const DahObj &d)
Well::DahObj::dahrange_
Interval< float > dahrange_
Definition: welldahobj.h:67
Well::DahObj::dahArr
float * dahArr()
Definition: welldahobj.h:57
Notifier
Class to help setup a callback handling.
Definition: notify.h:126
Well::DahObj::DahObj
DahObj(const char *nm=0)
Well::DahObj::setEmpty
virtual void setEmpty()
Definition: welldahobj.h:42
Well::DahObj::updateDahRange
void updateDahRange()
Well::DahObj::dah_
TypeSet< float > dah_
Definition: welldahobj.h:66
Well::DahObj::isEmpty
bool isEmpty() const
Definition: welldahobj.h:44
Well::DahObj::removeFromDahFrom
void removeFromDahFrom(int fromidx, float extradah)
Well::DahObj::eraseAux
virtual void eraseAux()=0
Well::DahObj::value
virtual float value(int idx) const =0
Well::DahObj::removeAux
virtual void removeAux(int)=0
Well::DahObj::size
int size() const
Definition: welldahobj.h:35
ranges.h
sets.h
Interval< float >
Well::DahObj::dahRange
Interval< float > & dahRange()
Well::DahObj::addToDahFrom
void addToDahFrom(int fromidx, float extradah)
Well::DahObj::insertAtDah
virtual bool insertAtDah(float dah, float val)=0
Well::DahObj::instanceCreated
static Notifier< DahObj > & instanceCreated()
Well::DahObj::remove
virtual void remove(int idx)
Definition: welldahobj.h:40
Well::DahObj::dahStep
float dahStep(bool min_else_average) const
Well::DahObj::deInterpolate
void deInterpolate()
Remove unnecessary points.
TypeSet< float >
Well::DahObj
Depth/Distance along hole object.
Definition: welldahobj.h:28

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