OpendTect-6_4  6.4
emsurfaceio.h
Go to the documentation of this file.
1 #ifndef emsurfaceio_h
2 #define emsurfaceio_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Kristofer Tingdahl
9  Date: 4-11-2002
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 
14 -*/
15 
16 #include "earthmodelmod.h"
17 #include "bufstringset.h"
18 #include "emposid.h"
19 #include "executor.h"
20 #include "posinfo2dsurv.h"
21 #include "ranges.h"
22 #include "rowcol.h"
23 #include "od_iosfwd.h"
24 
25 class StreamConn;
26 class IOObj;
27 template <class T> class DataInterpreter;
28 template <class T> class Array3D;
29 template <class T> class Array2D;
30 
31 namespace EM
32 {
33 class Surface;
34 class dgbSurfDataReader;
35 class RowColSurfaceGeometry;
36 
37 
48 public:
49  dgbSurfaceReader(const IOObj& ioobj,
50  const char* filetype);
51  dgbSurfaceReader(const char* fullexp, const char* name,
52  const char* filetype);
54 
55  void setOutput(EM::Surface&);
56  void setOutput(Array3D<float>&);
63  int version() const { return version_; }
64 
65  bool isOK() const;
66  void setGeometry();
67 
68  int nrSections() const;
69  EM::SectionID sectionID(int) const;
70  BufferString sectionName(int) const;
71  void selSections(const TypeSet<EM::SectionID>&);
76  const char* dbInfo() const;
77  int nrAuxVals() const;
78  const char* auxDataName(int) const;
79  float auxDataShift(int) const;
80  void selAuxData(const TypeSet<int>&);
85  const StepInterval<int>& rowInterval() const;
86  const StepInterval<int>& colInterval() const;
87  const Interval<float>& zInterval() const;
88 
89  void setRowInterval(const StepInterval<int>&);
90  void setColInterval(const StepInterval<int>&);
91  void setReadOnlyZ(bool yn=true);
92  void setLineNames(const BufferStringSet&);
93  void setLinesTrcRngs(const TypeSet<StepInterval<int> >&);
94 
95  int nrLines() const;
96  BufferString lineName(int) const;
97  BufferString lineSet(int) const;
98  Pos::GeomID lineGeomID(int) const;
99  StepInterval<int> lineTrcRanges( int idx ) const;
100  int stratLevelID() const;
101  const IOPar* pars() const;
102  int getParsOffset() const;
103 
104  virtual od_int64 nrDone() const;
105  virtual uiString uiNrDoneText() const;
106  virtual od_int64 totalNr() const;
107 
108  virtual int nextStep();
109 
110  virtual uiString uiMessage() const;
111 
112  static const char* sKeyNrSections();
113  static const char* sKeyNrSectionsV1();
114  static BufferString sSectionIDKey(int idx);
115  static BufferString sSectionNameKey(int idx);
116  static BufferString sColStepKey(int rowidx);
117  static const char* sKeyDepthOnly();
118  static const char* sKeyRowRange();
119  static const char* sKeyColRange();
120  static const char* sKeyZRange();
121  static const char* sKeyInt16DataChar();
122  static const char* sKeyInt32DataChar();
123  static const char* sKeyInt64DataChar();
124  static const char* sKeyFloatDataChar();
125  static const char* sKeyDBInfo();
126  static const char* sKeyVersion();
127  static const char* sKeyLineSets();
128  static const char* sKeyLineIDs();
129  static const char* sKeyTraceRange();
130 
131  static const char* sMsgParseError();
132  static uiString sMsgReadError();
133  static const char* sKeyUndefLineSet();
134  static const char* sKeyUndefLine();
135 
136 protected:
137 
138  bool isBinary() const;
139 
140  double readDouble(od_istream&) const;
141  int readInt16(od_istream&) const;
142  int readInt32(od_istream&) const;
143  od_int64 readInt64(od_istream&) const;
144  int int64Size() const;
145  void createAuxDataReader();
146  bool readParData(od_istream&,const IOPar&,const char*);
147  void mergeExternalPar(const char*);
148  int scanFor2DGeom(TypeSet< StepInterval<int> >&);
149  bool readHeaders(const char*);
150  bool readRowOffsets(od_istream&);
151  RowCol getFileStep() const;
152  int prepareNewSection(od_istream&);
153  bool shouldSkipCurrentRow() const;
154  int skipRow(od_istream&);
155  bool prepareRowRead(od_istream&);
156  int currentRow() const;
157  void goToNextRow();
158  void createSection( const SectionID& );
159 
161 
169 
174 
175  const IOPar* par_;
176 
178  bool error_;
179  int nrdone_;
180 
181  bool isinited_;
183 
188  int nrrows_;
190 
196 
197 
201 
204 
207  int version_;
208 
209  bool getIndices(const RowCol&,int&,int&) const;
210  bool readVersion2Row(od_istream&,int,int);
211 
212 //Version 3 stuff
213  bool readVersion3Row(od_istream&,int,int,int,
214  int noofcoltoskip=0);
220 
221 //Version 1 stuff
222  bool readVersion1Row(od_istream&,int,int);
223  RowCol convertRowCol(int,int) const;
224  bool parseVersion1(const IOPar&);
225  static const char* sKeyTransformX();
226  static const char* sKeyTransformY();
227 
228  double conv11, conv12, conv13, conv21, conv22, conv23;
229 
230 // for loading horizon based on Lines trace range
233  static const char* linenamesstr_;
234  void init(const char* fulluserexp,const char* name);
235 };
236 
237 
248 public:
249  dgbSurfaceWriter( const IOObj* ioobj,
250  const char* filetype,
251  const EM::Surface& surface,
252  bool binary );
253  dgbSurfaceWriter( const char* fulluserexpr,
254  const char* filetype,
255  const EM::Surface& surface,
256  bool binary );
266  ~dgbSurfaceWriter();
269  int nrSections() const;
270  EM::SectionID sectionID( int ) const;
271  const char* sectionName( int ) const;
272  void selSections(const TypeSet<EM::SectionID>&,
273  bool add=false);
278  void setShift(float);
280 
281  int nrAuxVals() const;
282  const char* auxDataName(int) const;
283  const char* auxDataInfo(int) const;
284  void selAuxData(const TypeSet<int>&);
290  const StepInterval<int>& rowInterval() const;
291  const StepInterval<int>& colInterval() const;
292  void setRowInterval( const StepInterval<int>& );
293  void setColInterval( const StepInterval<int>& );
294 
295  bool writeOnlyZ() const;
296  void setWriteOnlyZ(bool yn);
297  IOPar* pars();
298 
299  virtual od_int64 nrDone() const;
300  virtual uiString uiNrDoneText() const;
301  virtual od_int64 totalNr() const;
302 
303  virtual int nextStep();
304 
305  virtual uiString uiMessage() const;
306 
307 protected:
308 
309  bool writeNewSection(od_ostream&);
310  bool writeRow(od_ostream&);
311 
312  bool writeDouble(od_ostream&,double,
313  const char*) const;
314  bool writeInt16(od_ostream&,unsigned short,
315  const char*) const;
316  bool writeInt32(od_ostream&,od_int32,
317  const char*) const;
318  bool writeInt64(od_ostream&,od_int64,
319  const char*) const;
320 
321  void finishWriting();
323 
325 
331 
333 
337  int nrdone_;
338 
344  int nrrows_;
346 
349 
353 
359  bool binary_;
360  float shift_;
362 
363  static const char* sTab() { return "\t"; }
364  static const char* sEOL() { return "\n"; }
365  static const char* sEOLTab() { return "\n\t\t"; }
366 
367  void init(const char* fulluserexp);
368 };
369 
370 };
371 
372 #endif
StepInterval< int > * writerowrange_
Definition: emsurfaceio.h:354
static const char * sEOLTab()
Definition: emsurfaceio.h:365
od_int16 SectionID
Definition: emposid.h:25
#define mExpClass(module)
Definition: commondefs.h:160
float shift_
Definition: emsurfaceio.h:360
TypeSet< EM::SectionID > sectionsel_
Definition: emsurfaceio.h:167
OD class for stream write common access to the user log file, or std::cout in batch progs...
Definition: od_ostream.h:26
Definition: ioobj.h:58
bool binary_
Definition: emsurfaceio.h:359
StepInterval< int > rowrange_
Definition: emsurfaceio.h:198
StreamConn * conn_
Definition: emsurfaceio.h:160
TypeSet< float > auxdatashifts_
Definition: emsurfaceio.h:171
uiString msg_
Definition: emsurfaceio.h:334
const IOPar * par_
Definition: emsurfaceio.h:175
Executor consisting of other executors.
Definition: executor.h:77
StreamConn * conn_
Definition: emsurfaceio.h:324
int rowindex_
Definition: emsurfaceio.h:189
MultiID objectmid_
Definition: emsurfaceio.h:336
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Array2D< float > * arr_
Definition: emsurfaceio.h:195
TypeSet< od_int64 > sectionoffsets_
Definition: emsurfaceio.h:218
bool writingfinished_
Definition: emsurfaceio.h:322
#define od_int64
Definition: plftypes.h:36
TypeSet< od_int64 > rowoffsets_
Definition: emsurfaceio.h:217
int firstrow_
Definition: emsurfaceio.h:343
bool init()
int oldsectionindex_
Definition: emsurfaceio.h:186
static const char * linenamesstr_
Definition: emsurfaceio.h:233
StepInterval< int > * readcolrange_
Definition: emsurfaceio.h:203
Interval< float > zrange_
Definition: emsurfaceio.h:200
uiString msg_
Definition: emsurfaceio.h:177
int rowindex_
Definition: emsurfaceio.h:345
bool writeonlyz_
Definition: emsurfaceio.h:358
Definition: uistring.h:89
TypeSet< EM::SectionID > sectionids_
Definition: emsurfaceio.h:166
Set of BufferString objects.
Definition: bufstringset.h:28
BufferString fulluserexpr_
Definition: emsurfaceio.h:335
od_int64 nrsectionsoffsetoffset_
Definition: emsurfaceio.h:328
Surface Writer.
Definition: emsurfaceio.h:246
BufferString filetype_
Definition: emsurfaceio.h:361
OD class for stream read.
Definition: od_istream.h:24
int firstrow_
Definition: emsurfaceio.h:187
DataInterpreter< int > * int16interpreter_
Definition: emsurfaceio.h:215
Byte-level data interpreter.
Definition: cbvswriter.h:22
Set of pointers to objects.
Definition: commontypes.h:32
int version_
Definition: emsurfaceio.h:207
int sectionindex_
Definition: emsurfaceio.h:339
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
BufferString dbinfo_
Definition: emsurfaceio.h:206
BufferStringSet auxdatanames_
Definition: emsurfaceio.h:170
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:131
StepInterval< int > colrange_
Definition: emsurfaceio.h:199
bool isinited_
Definition: emsurfaceio.h:181
int parsoffset_
Definition: emsurfaceio.h:219
const TypeSet< StepInterval< int > > * linestrcrgs_
Definition: emsurfaceio.h:232
int nrrows_
Definition: emsurfaceio.h:344
int oldsectionindex_
Definition: emsurfaceio.h:340
DataInterpreter< double > * floatinterpreter_
Definition: emsurfaceio.h:192
StepInterval< int > rowrange_
Definition: emsurfaceio.h:350
StepInterval< int > * readrowrange_
Definition: emsurfaceio.h:202
static const char * sEOL()
Definition: emsurfaceio.h:364
const BufferStringSet * readlinenames_
Definition: emsurfaceio.h:231
TypeSet< EM::SectionID > sectionsel_
Definition: emsurfaceio.h:326
Index_Type GeomID
Definition: commontypes.h:52
Surface Reader.
Definition: emsurfaceio.h:46
IdxPair used for its row() and col().
Definition: rowcol.h:25
RowCol SurfaceGeometry.
Definition: emsurfacegeometry.h:124
BufferStringSet linesets_
Definition: emsurfaceio.h:164
Array3D< float > * cube_
Definition: emsurfaceio.h:194
#define od_int32
Definition: plftypes.h:31
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
int nrdone_
Definition: emsurfaceio.h:179
FixedString Surface()
Definition: keystrs.h:126
od_int64 rowoffsettableoffset_
Definition: emsurfaceio.h:341
EM::Surface * surface_
Definition: emsurfaceio.h:193
bool setsurfacepar_
Definition: emsurfaceio.h:182
TypeSet< od_int64 > sectionoffsets_
Definition: emsurfaceio.h:327
TypeSet< Pos::GeomID > geomids_
Definition: emsurfaceio.h:165
Base class for surfaces like horizons and faults. A surface is made up of one or more segments or pat...
Definition: emsurface.h:33
BufferStringSet linenames_
Definition: emsurfaceio.h:163
Earth Model objects like horizons, faults, fault-sticks and bodies.
Definition: embody.h:25
int nrdone_
Definition: emsurfaceio.h:337
StepInterval< int > colrange_
Definition: emsurfaceio.h:351
Interval< int > writtenrowrange_
Definition: emsurfaceio.h:356
TypeSet< int > auxdatasel_
Definition: emsurfaceio.h:173
TypeSet< od_int64 > rowoffsettable_
Definition: emsurfaceio.h:342
DataInterpreter< od_int64 > * int64interpreter_
Definition: emsurfaceio.h:216
int sectionsread_
Definition: emsurfaceio.h:184
BufferStringSet sectionnames_
Definition: emsurfaceio.h:162
Connection with an underlying iostream.
Definition: streamconn.h:26
ObjectSet< EM::dgbSurfDataReader > auxdataexecs_
Definition: emsurfaceio.h:172
TypeSet< int > auxdatasel_
Definition: emsurfaceio.h:329
Interval< int > writtencolrange_
Definition: emsurfaceio.h:357
bool error_
Definition: emsurfaceio.h:178
bool fullyread_
Definition: emsurfaceio.h:168
Array3D ( Subclass of ArrayND ) is a three dimensional array.
Definition: arraynd.h:153
const EM::RowColSurfaceGeometry * geometry_
Definition: emsurfaceio.h:348
BufferString dbinfo_
Definition: emsurfaceio.h:330
DataInterpreter< int > * int32interpreter_
Definition: emsurfaceio.h:191
static const char * sTab()
Definition: emsurfaceio.h:363
int nrrows_
Definition: emsurfaceio.h:188
int version() const
Definition: emsurfaceio.h:63
Interval< float > zrange_
Definition: emsurfaceio.h:352
Compound key consisting of ints.
Definition: multiid.h:25
int sectionindex_
Definition: emsurfaceio.h:185
StepInterval< int > * writecolrange_
Definition: emsurfaceio.h:355
bool readonlyz_
Definition: emsurfaceio.h:205
const EM::Surface & surface_
Definition: emsurfaceio.h:347
IOPar * par_
Definition: emsurfaceio.h:332
double conv23
Definition: emsurfaceio.h:228

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