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

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