OpendTect-6_4  6.4
posinfo.h
Go to the documentation of this file.
1 #ifndef posinfo_h
2 #define posinfo_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: 2005 / Mar 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "manobjectset.h"
17 #include "typeset.h"
18 #include "trckeyzsampling.h"
19 #include "indexinfo.h"
20 #include "binid.h"
21 #include "od_iosfwd.h"
22 
23 
40 namespace PosInfo
41 {
42 
49 {
50 public:
52 
53  LineData( int i ) : linenr_(i) {}
54 
55  const int linenr_;
57 
58  int size() const;
59  int segmentOf(int) const;
60  Interval<int> range() const;
61  void merge(const LineData&,bool incl);
63 
64  int nearestSegment(double) const;
65 
66 };
67 
68 
74 {
75 public:
76  CubeDataPos( int iln=0, int isn=0, int sidx=-1 )
77  : lidx_(iln), segnr_(isn), sidx_(sidx) {}
78 
79  int lidx_;
80  int segnr_;
81  int sidx_;
82 
83  void toPreStart() { lidx_ = segnr_ = 0; sidx_ = -1; }
84  void toStart() { lidx_ = segnr_ = sidx_ = 0; }
85  bool isValid() const { return lidx_>=0 && segnr_>=0 && sidx_>=0; }
86 
87 };
88 
89 
96 {
97 public:
98 
99  CubeData() {}
100  CubeData( BinID start, BinID stop, BinID step )
101  { generate(start,stop,step); }
102  CubeData( const CubeData& cd )
103  : ManagedObjectSet<LineData>()
104  { *this = cd; }
105  CubeData& operator =( const CubeData& cd )
106  { copyContents(cd); return *this; }
107 
108  int totalSize() const;
109  int totalSizeInside(const TrcKeySampling& hrg) const;
112  virtual int indexOf(int inl,int* newidx=0) const;
114  bool includes(const BinID&) const;
115  bool includes(int inl,int crl) const;
116  void getRanges(Interval<int>& inl,Interval<int>& crl) const;
117  bool getInlRange(StepInterval<int>&,bool sorted=true) const;
119  bool getCrlRange(StepInterval<int>&,bool sorted=true) const;
121 
122  bool isValid(const CubeDataPos&) const;
123  bool isValid(const BinID&) const;
124  bool isValid(od_int64 globalidx,const TrcKeySampling&) const;
125 
126  bool toNext(CubeDataPos&) const;
127  BinID binID(const CubeDataPos&) const;
128  CubeDataPos cubeDataPos(const BinID&) const;
129 
130  bool haveInlStepInfo() const { return size() > 1; }
131  bool haveCrlStepInfo() const;
132  bool isFullyRectAndReg() const;
133  bool isCrlReversed() const;
134 
135  void limitTo(const TrcKeySampling&);
136  void merge(const CubeData&,bool incl);
138  void generate(BinID start,BinID stop,BinID step,
139  bool allowreversed=false);
140 
141  bool read(od_istream&,bool asc);
142  bool write(od_ostream&,bool asc) const;
143 
144  virtual int indexOf( const LineData* l ) const
145  { return ObjectSet<LineData>::indexOf( l ); }
146 
147 protected:
148 
149  void copyContents(const CubeData&);
150 
151 };
152 
153 
160 {
161 public:
163  SortedCubeData( const BinID& start, const BinID& stop,
164  const BinID& step )
165  : CubeData(start,stop,step) {}
167  : CubeData( cd )
168  { *this = cd; }
169  SortedCubeData( const CubeData& cd ) { *this = cd; }
170  SortedCubeData& operator =( const SortedCubeData& scd )
171  { copyContents(scd); return *this; }
172  SortedCubeData& operator =( const CubeData& cd )
173  { copyContents(cd); return *this; }
174 
175  virtual int indexOf(int inl,int* newidx=0) const;
177 
178  SortedCubeData& add(LineData*);
179 
180  virtual int indexOf( const LineData* l ) const
181  { return CubeData::indexOf( l ); }
182 
183 protected:
184 
185  virtual CubeData& doAdd(LineData*);
186 
187 };
188 
189 
195 {
196 public:
197  CubeDataFiller(CubeData&);
198  ~CubeDataFiller();
199 
200  void add(const BinID&);
201  void finish(); // automatically called on delete
202 
203 protected:
204 
208  int prevcrl;
209 
210  void initLine();
211  void finishLine();
212  LineData* findLine(int);
213 
214 };
215 
216 
222 {
223 public:
224 
226  : cd_(cd) {}
227 
228  inline bool next( BinID& bid )
229  {
230  const bool rv = cd_.toNext( cdp_ );
231  bid = binID(); return rv;
232  }
233  inline void reset() { cdp_.toPreStart(); }
234  inline BinID binID() const { return cd_.binID( cdp_ ); }
235 
236  const CubeData& cd_;
238 
239 };
240 
241 
242 } // namespace PosInfo
243 
244 #endif
#define mExpClass(module)
Definition: commondefs.h:160
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
int prevcrl
Definition: posinfo.h:208
TypeSet< Segment > segments_
Definition: posinfo.h:56
CubeData()
Definition: posinfo.h:99
const int linenr_
Definition: posinfo.h:55
#define od_int64
Definition: plftypes.h:36
int lidx_
Definition: posinfo.h:79
CubeDataIterator(const CubeData &cd)
Definition: posinfo.h:225
SortedCubeData(const CubeData &cd)
Definition: posinfo.h:169
virtual int indexOf(const LineData *l) const
Definition: posinfo.h:144
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
void toPreStart()
Definition: posinfo.h:83
SortedCubeData(const SortedCubeData &cd)
Definition: posinfo.h:166
bool isValid() const
Definition: posinfo.h:85
OD class for stream read.
Definition: od_istream.h:24
LineData(int i)
Definition: posinfo.h:53
void reset()
Definition: posinfo.h:233
Set of (small) copyable elements.
Definition: commontypes.h:30
Horizontal sampling (inline and crossline range and steps).
Definition: trckeysampling.h:27
virtual int indexOf(const LineData *l) const
Definition: posinfo.h:180
bool haveInlStepInfo() const
Definition: posinfo.h:130
const CubeData & cd_
Definition: posinfo.h:236
CubeData & cd_
Definition: posinfo.h:205
Position in a CubeData.
Definition: posinfo.h:73
Iterates through CubeData.
Definition: posinfo.h:221
Position info for a line - in a 3D cube, that would be an inline. Stored as (crossline-)number segmen...
Definition: posinfo.h:48
Position info, often segmented.
Definition: posinfo.h:40
void toStart()
Definition: posinfo.h:84
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
bool next(BinID &bid)
Definition: posinfo.h:228
int segnr_
Definition: posinfo.h:80
SortedCubeData(const BinID &start, const BinID &stop, const BinID &step)
Definition: posinfo.h:163
LineData::Segment seg_
Definition: posinfo.h:207
CubeData(const CubeData &cd)
Definition: posinfo.h:102
Fills CubeData object. Requires inline- and crossline-sorting.
Definition: posinfo.h:194
ObjectSet where the objects contained are owned by this set.
Definition: manobjectset.h:23
Position info for an entire 3D cube. The LineData&#39;s are not sorted.
Definition: posinfo.h:95
CubeDataPos(int iln=0, int isn=0, int sidx=-1)
Definition: posinfo.h:76
SortedCubeData()
Definition: posinfo.h:162
BinID binID() const
Definition: posinfo.h:234
virtual size_type indexOf(const T *) const
Definition: objectset.h:337
Position info for an entire 3D cube. The LineData&#39;s are sorted.
Definition: posinfo.h:159
CubeData(BinID start, BinID stop, BinID step)
Definition: posinfo.h:100
virtual int indexOf(int inl, int *newidx=0) const
newidx only filled if not null and -1 is returned
LineData * ld_
Definition: posinfo.h:206
CubeDataPos cdp_
Definition: posinfo.h:237
int sidx_
Definition: posinfo.h:81
StepInterval< int > Segment
Definition: posinfo.h:51

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