OpendTect  6.3
survgeom.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: A.H.Bril
8  Date: 9-4-1996
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "factory.h"
14 #include "coord.h"
15 #include "refcount.h"
16 #include "threadlock.h"
17 #include "trckey.h"
18 #include "trckeyzsampling.h"
19 
20 class TaskRunner;
21 class IOObj;
22 
23 // Need some shortcuts because GeomID is not a real object:
24 #define mUdfGeomID Survey::GeometryManager::cUndefGeomID()
25 #define mIsUdfGeomID(geomid) (geomid == mUdfGeomID)
26 
27 
28 namespace Survey
29 {
30 class Geometry2D;
31 class Geometry3D;
32 
43 mExpClass(Basic) Geometry : public RefCount::Referenced
44 {
45 public:
46 
47  typedef Pos::GeomID ID;
48  typedef unsigned short CoordSysID;
49 
50  enum RelationType { UnRelated=0, Related, SubSet, SuperSet, Identical };
54  virtual bool is2D() const = 0;
55  Pos::SurvID getSurvID() const;
56  static const Geometry& default3D();
57 
58  ID getID() const { return id_; }
59  void setID( ID id ) { id_ = id; }
60  CoordSysID coordSysID() const { return coordsysid_; }
61  void setCoordSysID( CoordSysID id ) { coordsysid_ = id; }
62  virtual const char* getName() const = 0;
63 
64  virtual Coord toCoord(Pos::LineID,Pos::TraceID) const = 0;
65  inline Coord toCoord( const BinID& b ) const
66  { return toCoord( b.lineNr(), b.trcNr() ); }
67 
68  virtual bool includes(Pos::LineID,Pos::TraceID) const = 0;
69  bool includes(const TrcKey&) const;
70  inline bool includes( const BinID& b ) const
71  { return includes( b.lineNr(), b.trcNr() ); }
72 
73  static bool exists(const TrcKey&);
74  static Coord toCoord(const TrcKey&);
75 
76  virtual TrcKey getTrace(const Coord&,float maxdist) const;
77  virtual TrcKey nearestTrace(const Coord&,float* distance=0) const = 0;
78 
79  const TrcKeyZSampling& sampling() const { return sampling_; }
80 
81  virtual float averageTrcDist() const = 0;
82  virtual RelationType compare(const Geometry&,bool usezrg) const
83  { return UnRelated; }
84 
85  //Convenience functions for the most commone geometries
86  virtual Geometry2D* as2D() { return 0; }
87  const Geometry2D* as2D() const;
88 
89  virtual Geometry3D* as3D() { return 0; }
90  const Geometry3D* as3D() const;
91 
92 protected:
93  ~Geometry();
94  Geometry();
95 
97  CoordSysID coordsysid_;
98 
99 private:
100 
101  ID id_;
102 
103 };
104 
105 
109 { mODTextTranslationClass(GeometryManager)
110 public:
111 
112  GeometryManager();
113  ~GeometryManager();
114 
115  const Geometry* getGeometry(Geometry::ID) const;
116  const Geometry* getGeometry(const char*) const;
117  const Geometry* getGeometry(const DBKey&) const;
118 
119  const Geometry3D* getGeometry3D(Pos::SurvID) const;
120 
121  int nrGeometries() const;
122 
123  Geometry::ID getGeomID(const char* linenm) const;
124  const char* getName(Geometry::ID) const;
125 
126  Coord toCoord(const TrcKey&) const;
127 
129  Pos::TraceID) const;
131  TrcKey traceKey(Geometry::ID,Pos::TraceID) const;
133 
134  bool fillGeometries(TaskRunner*);
135  bool getList(BufferStringSet& names,
137  bool is2d) const;
138  Geometry::ID findRelated(const Geometry&,
140  bool usezrg) const;
142 
143  static TrcKey::SurvID get2DSurvID() { return surv2did_; }
144  TrcKey::SurvID default3DSurvID() const;
145  TrcKey::SurvID synthSurvID() const;
147 
148 protected:
149 
150  void ensureSIPresent() const;
151  void addGeometry(Geometry&);
152 
153  int indexOf(Geometry::ID) const;
154  bool hasDuplicateLineNames();
155 
158  static const TrcKey::SurvID surv2did_;
159 
161 
162 public:
163 
167  Geometry* getGeometry(Geometry::ID);
168  bool write(Geometry&,uiString&);
169  Geometry::ID addNewEntry(Geometry*,uiString&);
171  bool removeGeometry(Geometry::ID);
172 
173  Geometry::ID getGeomID(const char* lsm,
174  const char* linenm) const;
177  bool fetchFrom2DGeom(uiString& errmsg);
178  //converts od4 geometries to od5 geometries.
179  bool updateGeometries(TaskRunner*);
180 };
181 
182 
183 mGlobal(Basic) const GeometryManager& GM();
185 { return const_cast<GeometryManager&>( Survey::GM() ); }
186 
187 
188 
190 {
191 public:
192 
193  virtual ~GeometryReader() {}
194  mDefineFactoryInClass(GeometryReader,factory)
195 
196  virtual bool read(ObjectSet<Geometry>&,TaskRunner*) const
197  { return true; }
199  { return true; }
200 };
201 
202 
203 
205 {
206 public:
207 
208  virtual ~GeometryWriter() {}
209  mDefineFactoryInClass(GeometryWriter,factory)
210 
211  virtual bool write(Geometry&,uiString&,
212  const char* crfromstr=0) const { return true; }
213  virtual IOObj* createEntry(const char*) const { return 0; }
214  virtual Geometry::ID createNewGeomID(const char*) const { return 0; }
215  virtual bool removeEntry(const char*) const { return 0; }
216 
217 };
218 
219 } //namespace Survey
GeometryManager & GMAdmin()
Definition: survgeom.h:184
virtual Geometry3D * as3D()
Definition: survgeom.h:89
#define mExpClass(module)
Definition: commondefs.h:157
Coord toCoord(const BinID &b) const
Definition: survgeom.h:65
const GeometryManager & GM()
Index_Type LineID
Definition: commontypes.h:46
virtual ~GeometryWriter()
Definition: survgeom.h:208
Definition: ioobj.h:57
virtual Geometry2D * as2D()
Definition: survgeom.h:86
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:51
static Geometry::ID cUndefGeomID()
Definition: survgeom.h:146
const TrcKeyZSampling & sampling() const
Definition: survgeom.h:79
ID id_
Definition: survgeom.h:101
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
Index_Type TraceID
Definition: commontypes.h:47
#define mGlobal(module)
Definition: commondefs.h:160
static const TrcKey::SurvID surv2did_
Definition: survgeom.h:158
bool is2D(GeomType gt)
Definition: seistype.h:32
Geometry of a 2D Line.
Definition: survgeom2d.h:26
bool includes(const BinID &b) const
Definition: survgeom.h:70
Pos::SurvID SurvID
Definition: trckey.h:30
Definition: uistring.h:88
virtual Geometry::ID createNewGeomID(const char *) const
Definition: survgeom.h:214
Set of BufferString objects.
Definition: bufstringset.h:25
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
IdxType & trcNr()
Definition: posidxpair.h:47
unsigned short CoordSysID
Definition: survgeom.h:48
virtual bool updateGeometries(ObjectSet< Geometry > &, TaskRunner *) const
Definition: survgeom.h:198
Set of pointers to objects.
Definition: commontypes.h:28
Threads::Lock lock_
Definition: survgeom.h:156
RelationType
Definition: survgeom.h:50
Set of (small) copyable elements.
Definition: commontypes.h:26
Index_Type SurvID
Definition: commontypes.h:45
Class that can execute a task.
Definition: task.h:193
void setCoordSysID(CoordSysID id)
Definition: survgeom.h:61
CoordSysID coordsysid_
Definition: survgeom.h:97
Definition: survgeom.h:204
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:270
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:32
bool hasduplnms_
Definition: survgeom.h:160
virtual bool removeEntry(const char *) const
Definition: survgeom.h:215
#define mDefineFactoryInClass(T, funcname)
Definition: factory.h:424
ObjectSet< Geometry > geometries_
Definition: survgeom.h:157
Index_Type GeomID
Definition: commontypes.h:48
virtual IOObj * createEntry(const char *) const
Definition: survgeom.h:213
virtual RelationType compare(const Geometry &, bool usezrg) const
Definition: survgeom.h:82
void setID(ID id)
Definition: survgeom.h:59
IdxType & lineNr()
Definition: posidxpair.h:42
Scaled down survey geometry for an inl/crl geometry.
Definition: survgeom3d.h:26
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:28
ID getID() const
Definition: survgeom.h:58
Pos::GeomID ID
Definition: survgeom.h:47
virtual ~GeometryReader()
Definition: survgeom.h:193
Makes geometries accessible from a geometry ID, or a DBKey.
Definition: survgeom.h:108
static TrcKey::SurvID get2DSurvID()
Definition: survgeom.h:143
Definition: survgeom.h:28
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
Definition: survgeom.h:189
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:26
2D point or vector class.
Definition: commontypes.h:58
TrcKeyZSampling sampling_
Definition: survgeom.h:96
bool exists(const char *)
Definition: arraytesselator.h:19
const SeisTrc * getTrace(EM::SubID) const
CoordSysID coordSysID() const
Definition: survgeom.h:60
FixedString Geometry()
Definition: keystrs.h:68

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