OpendTect-6_4  6.4
survinfo.h
Go to the documentation of this file.
1 #ifndef survinfo_h
2 #define survinfo_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H.Bril
9  Date: 9-4-1996
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "basicmod.h"
16 #include "namedobj.h"
17 #include "ranges.h"
18 #include "enums.h"
19 #include "zdomain.h"
20 #include "atomic.h"
21 #include "survgeom3d.h"
22 
23 class ascostream;
24 class LatLong2Coord;
25 namespace Coords { class CoordSystem; }
26 
27 
28 
46 {
47 
48  mGlobal(Basic) friend const SurveyInfo& SI();
49 
50 
51 public:
52  ~SurveyInfo();
53  bool has2D() const;
54  bool has3D() const;
55 
56  StepInterval<int> inlRange(bool work) const;
57  StepInterval<int> crlRange(bool work) const;
58  const StepInterval<float>& zRange( bool work ) const;
59  int inlStep() const;
60  int crlStep() const;
61  float zStep() const;
62  float inlDistance() const;
63  float crlDistance() const;
64  float getArea(const Interval<int>& inl,
65  const Interval<int>& crl) const;
66  float getArea(bool work) const ;
67 
68  Coord3 oneStepTranslation(const Coord3& planenormal) const;
69 
70  const TrcKeyZSampling& sampling( bool work ) const
71  { return work ? wcs_ : tkzs_; }
72 
73  Coord transform( const BinID& b ) const;
74  BinID transform(const Coord&) const;
77  bool xyInFeet() const;
78  const char* getXYUnitString(bool withparens=true) const;
79  uiString getUiXYUnitString(bool abbrviated=true,
80  bool withparens=true) const;
81  const ZDomain::Def& zDomain() const;
82  bool depthsInFeet() const { return depthsinfeet_; }
83  inline float showZ2UserFactor() const
84  { return (float)zDomain().userFactor(); }
85 
86  bool zIsTime() const;
88  inline bool zInMeter() const
89  { return zDomain().isDepth() && !depthsinfeet_;}
91  inline bool zInFeet() const
92  { return zDomain().isDepth() && depthsinfeet_;}
93  //<Legacy, don't use
94  const char* getZUnitString(bool withparens=true) const
96  { return zDomain().unitStr( withparens ); }
97  const uiString getUiZUnitString(bool withparens=true) const
98  { return zDomain().uiUnitStr( withparens ); }
99  enum Unit { Second, Meter, Feet };
100  Unit xyUnit() const;
102  Unit zUnit() const;
104 
105  Coord minCoord(bool work) const;
106  Coord maxCoord(bool work) const;
107  bool isInside(const BinID&,bool work) const;
108  bool isReasonable(const BinID&) const;
110  bool isReasonable(const Coord&) const;
112  Interval<int> reasonableRange(bool inl) const;
113  int maxNrTraces(bool work) const;
114 
115  void checkInlRange(Interval<int>&,bool work) const;
117  void checkCrlRange(Interval<int>&,bool work) const;
119  void checkZRange(Interval<float>&,bool work) const;
121  bool includes(const BinID&,const float,bool work) const;
123 
124  void snap(BinID&,const BinID& dir=BinID(0,0)) const;
126  void snapStep(BinID&,const BinID& dir=BinID(0,0))const;
128  void snapZ(float&,int direction=0) const;
130 
131  float seismicReferenceDatum() const {return seisrefdatum_;}
134  void setSeismicReferenceDatum( float d ) { seisrefdatum_=d; }
135 
136  const IOPar& pars() const { return pars_; }
137  void putZDomain(IOPar&) const;
138 
139  RefMan<Survey::Geometry3D> get3DGeometry(bool work) const;
140  RefMan<Coords::CoordSystem> getCoordSystem();
141  ConstRefMan<Coords::CoordSystem> getCoordSystem() const;
142 
143  enum Pol2D { No2D=0, Both2DAnd3D=1, Only2D=2 };
144 
145  // Some public fns moved to bottom because they are rarely used; some fns
146  // that have 'no user servicable parts inside' are at the very bottom
147 
148 protected:
149 
150  SurveyInfo();
151 
154 
156  bool xyinfeet_;
163 
166 
169  BinID set3binids_[3];
170  Coord set3coords_[3];
171 
174 
177 
178  void handleLineRead(const BufferString&,const char*);
179  bool wrapUpRead();
180  void writeSpecLines(ascostream&) const;
181 
182  void setTr(Pos::IdxPair2Coord::DirTransform&,const char*);
183  void putTr(const Pos::IdxPair2Coord::DirTransform&,
184  ascostream&,const char*) const;
185 
186 private:
187 
188  // ugly, but hard to avoid:
189  friend class IOMan;
190  friend class uiSurvey;
191  friend class uiSurveyMap;
192  friend class uiSurveyInfoEditor;
193 
196 
197  // For IOMan only
198  static void setSurveyName(const char*);
199  // friends only
200  static const char* surveyFileName();
201 
202 public:
203 
204  // These fns are rarely used by non-specialist classes.
205 
206  void setWorkRange(const TrcKeyZSampling&);
208 
209  const Pos::IdxPair2Coord& binID2Coord() const { return b2c_; }
210  void get3Pts(Coord c[3],BinID b[2],int& xline) const;
211  const LatLong2Coord& latlong2Coord() const { return ll2c_; }
212  bool isClockWise() const { return isRightHandSystem(); }
214  bool isRightHandSystem() const;
217  float angleXInl() const;
220  float angleXCrl() const;
223  void setXYInFeet( bool yn=true ) { xyinfeet_ = yn; }
224  void setDepthInFeet( bool yn=true ) { depthsinfeet_ = yn; }
225  void setZUnit(bool istime,bool infeet=false);
226  static float defaultXYtoZScale(Unit,Unit);
229  float zScale() const;
233  static const char* sKeyInlRange();
234  static const char* sKeyCrlRange();
235  static const char* sKeyXRange();
236  static const char* sKeyYRange();
237  static const char* sKeyZRange();
238  static const char* sKeyXYInFt();
239  static const char* sKeyDpthInFt();
240  static const char* sKeySurvDataType();
241  static const char* sKeySeismicRefDatum();
242  static const char* sKeySetupFileName() { return ".survey"; }
243  static const char* sKeyBasicSurveyName() { return "BasicSurvey";}
244 
245  BufferString getDirName() const { return dirname_; }
246  BufferString getDataDirName() const { return datadir_; }
247  void updateDirName();
248 
250  Pol2D survDataType() const { return survdatatype_; }
251  void setSurvDataType( Pol2D typ )
252  { survdatatype_ = typ; survdatatypeknown_ = true; }
253 
254  // Auxiliary info
255  const char* comment() const { return comment_.buf(); }
256  BufferString sipName() const { return sipnm_; }
257  void setSipName( BufferString sipnm ) { sipnm_ = sipnm; }
258  void setComment( const char* s ) { comment_ = s; }
259 
260  // Following fns are used by specialist classes. Don't use casually.
261 
262  SurveyInfo(const SurveyInfo&);
263  SurveyInfo& operator =(const SurveyInfo&);
264 
266  { return const_cast<SurveyInfo*>(this)->b2c_; }
268  { return const_cast<SurveyInfo*>(this)->ll2c_; }
269  IOPar& getPars() const
270  { return const_cast<SurveyInfo*>(this)->pars_; }
271 
272  bool write(const char* basedir=0) const;
274  void savePars(const char* basedir=0) const;
276  static SurveyInfo* read(const char* survdir);
277  static SurveyInfo* read(const char* path,bool pathisfile);
278  void setRange(const TrcKeyZSampling&,bool);
279  const char* set3Pts(const Coord c[3],const BinID b[2],int xline);
280  void gen3Pts();
281  bool setCoordSystem(Coords::CoordSystem*);
282  void readSavedCoordSystem() const;
284 
285  void update3DGeometry();
286 
287  static const char* curSurveyName();
288 
289  // No, you really don't need these!
290  static void pushSI(SurveyInfo*);
291  static SurveyInfo* popSI();
292  static void deleteInstance() { delete popSI(); }
293 
294 };
295 
296 
297 mGlobal(Basic) const SurveyInfo& SI();
298 mGlobal(Basic) inline SurveyInfo& eSI()
299  { return const_cast<SurveyInfo&>(SI()); }
300 
301 mExternC( Basic ) const char* GetSurveyName(void);
302 
303 
304 
305 #endif
#define mExpClass(module)
Definition: commondefs.h:160
bool zInFeet() const
Definition: survinfo.h:91
Threads::AtomicPointer< Survey::Geometry3D > s3dgeom_
Definition: survinfo.h:164
BufferString dirname_
Definition: survinfo.h:153
const Pos::IdxPair2Coord & binID2Coord() const
Definition: survinfo.h:209
LatLong2Coord & getLatlong2Coord() const
Definition: survinfo.h:267
The main survey selection dialog.
Definition: uisurvey.h:32
Pos::IdxPair2Coord b2c_
Definition: survinfo.h:167
#define mGlobal(module)
Definition: commondefs.h:163
const LatLong2Coord & latlong2Coord() const
Definition: survinfo.h:211
TrcKeyZSampling & wcs_
Definition: survinfo.h:159
Pol2D survDataType() const
Definition: survinfo.h:250
BufferString getDataDirName() const
Definition: survinfo.h:246
Unit
Definition: survinfo.h:99
Pos::IdxPair2Coord::DirTransform rdxtr_
Definition: survinfo.h:194
bool depthsInFeet() const
Definition: survinfo.h:82
Definition: posidxpair2coord.h:61
LatLong2Coord & ll2c_
Definition: survinfo.h:168
OpendTect standard ascii format file writing.
Definition: ascstream.h:32
manages the &#39;Meta-&#39;data store for the IOObj&#39;s. This info is read from the .omf files.
Definition: ioman.h:36
BufferString getDirName() const
Definition: survinfo.h:245
Notifier< SurveyInfo > workRangeChg
Definition: survinfo.h:207
const char * getZUnitString(bool withparens=true) const
<Legacy, don&#39;t use
Definition: survinfo.h:94
Definition: uistring.h:89
Holds survey general information.
Definition: survinfo.h:45
A cartesian coordinate in 2D space.
Definition: coord.h:25
bool survdatatypeknown_
Definition: survinfo.h:173
Definition: coordsystem.h:31
bool depthsinfeet_
Definition: survinfo.h:157
bool zInMeter() const
Legacy, don&#39;t use.
Definition: survinfo.h:88
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:258
Pos::IdxPair2Coord & getBinID2Coord() const
Definition: survinfo.h:265
BufferString datadir_
Definition: survinfo.h:152
Pol2D
Definition: survinfo.h:143
Definition: commontypes.h:39
void setSurvDataType(Pol2D typ)
Definition: survinfo.h:251
IOPar & pars_
Definition: survinfo.h:161
void setXYInFeet(bool yn=true)
Definition: survinfo.h:223
TrcKeyZSampling & tkzs_
Definition: survinfo.h:158
const uiString getUiZUnitString(bool withparens=true) const
Definition: survinfo.h:97
uiString uiUnitStr(bool withparens=false) const
Definition: coordsystem.h:22
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Pol2D survdatatype_
Definition: survinfo.h:172
static const char * sKeySetupFileName()
Definition: survinfo.h:242
SurveyInfo & eSI()
Definition: survinfo.h:298
The survey info editor.
Definition: uisurvinfoed.h:35
Definition: uisurvmap.h:82
const TrcKeyZSampling & sampling(bool work) const
Definition: survinfo.h:70
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
Threads::AtomicPointer< Survey::Geometry3D > work_s3dgeom_
Definition: survinfo.h:165
bool isDepth() const
RefMan< Coords::CoordSystem > coordsystem_
Definition: survinfo.h:162
float seisrefdatum_
Definition: survinfo.h:160
bool xyinfeet_
Definition: survinfo.h:156
#define mExternC(module)
Definition: commondefs.h:167
void setSipName(BufferString sipnm)
Definition: survinfo.h:257
static void deleteInstance()
Definition: survinfo.h:292
A cartesian coordinate in 3D space.
Definition: coord.h:72
const char * buf() const
Definition: odstring.h:47
const SurveyInfo & SI()
BufferString sipName() const
Definition: survinfo.h:256
void setSeismicReferenceDatum(float d)
Definition: survinfo.h:134
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
BufferString sipnm_
Definition: survinfo.h:176
Object with a name.
Definition: namedobj.h:35
Export_Basic const char * GetSurveyName(void)
Definition: commontypes.h:39
const IOPar & pars() const
Definition: survinfo.h:136
BufferString comment_
Definition: survinfo.h:175
int userFactor() const
Definition: zdomain.h:51
TrcKeyZSampling::Dir direction(TrcKeyZSampling::Dir slctype, int dimnr)
Definition: trckeyzsampling.h:139
ZDomain::Def & zdef_
Definition: survinfo.h:155
const char * unitStr(bool withparens=false) const
IOPar & getPars() const
Definition: survinfo.h:269
void setDepthInFeet(bool yn=true)
Definition: survinfo.h:224
bool isClockWise() const
Don&#39;t use. Will be removed.
Definition: survinfo.h:212
Definition of z-domain.
Definition: zdomain.h:41
const char * comment() const
Definition: survinfo.h:255
Encapsulates linear transform from (i,j) index to (x,y) coordinates.
Definition: posidxpair2coord.h:26
static const char * sKeyBasicSurveyName()
Definition: survinfo.h:243
Estimates to/from LatLong coordinates.
Definition: latlong.h:68
void setComment(const char *s)
Definition: survinfo.h:258
Definition: ptrman.h:168
Pos::IdxPair2Coord::DirTransform rdytr_
Definition: survinfo.h:195
float seismicReferenceDatum() const
Definition: survinfo.h:131
float showZ2UserFactor() const
Definition: survinfo.h:83

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