OpendTect-6_4  6.4
survgeom.h
Go to the documentation of this file.
1 #ifndef survgeom_h
2 #define survgeom_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 "factory.h"
16 #include "coord.h"
17 #include "refcount.h"
18 #include "threadlock.h"
19 #include "trckey.h"
20 #include "trckeyzsampling.h"
21 
22 class TaskRunner;
23 class IOObj;
24 
25 namespace Survey
26 {
27 class Geometry2D;
28 class Geometry3D;
29 
41 { mRefCountImpl(Geometry)
42 public:
43 
44  typedef Pos::GeomID ID;
45  enum RelationType { UnRelated=0, Related, SubSet, SuperSet, Identical };
49  virtual bool is2D() const = 0;
50  Pos::SurvID getSurvID() const;
51  static const Geometry& default3D();
52 
53  ID getID() const { return id_; }
54  void setID( ID id ) { id_ = id; }
55  virtual const char* getName() const = 0;
56 
57  virtual Coord toCoord(Pos::LineID,Pos::TraceID) const = 0;
58  inline Coord toCoord( const BinID& b ) const
59  { return toCoord( b.lineNr(), b.trcNr() ); }
60 
61  virtual bool includes(Pos::LineID,Pos::TraceID) const = 0;
62  bool includes(const TrcKey&) const;
63  inline bool includes( const BinID& b ) const
64  { return includes( b.lineNr(), b.trcNr() ); }
65 
66  static bool exists(const TrcKey&);
67  static Coord toCoord(const TrcKey&);
68 
69  virtual TrcKey getTrace(const Coord&,float maxdist) const;
70  virtual TrcKey nearestTrace(const Coord&,float* distance=0) const = 0;
71 
72  const TrcKeyZSampling& sampling() const { return sampling_; }
73 
74  virtual float averageTrcDist() const = 0;
75  virtual RelationType compare(const Geometry&,bool usezrg) const
76  { return UnRelated; }
77 
78  //Convenience functions for the most commone geometries
79  virtual Geometry2D* as2D() { return 0; }
80  const Geometry2D* as2D() const;
81 
82  virtual Geometry3D* as3D() { return 0; }
83  const Geometry3D* as3D() const;
84 
85 protected:
86 
87  Geometry();
88 
90 private:
91 
92  ID id_;
93 
94 };
95 
96 
100 { mODTextTranslationClass(GeometryManager)
101 public:
102 
103  GeometryManager();
104  ~GeometryManager();
105 
106  const Geometry* getGeometry(Geometry::ID) const;
107  const Geometry* getGeometry(const char*) const;
108  const Geometry* getGeometry(const MultiID&) const;
109 
110  const Geometry3D* getGeometry3D(Pos::SurvID) const;
111 
112  int nrGeometries() const;
113 
114  Geometry::ID getGeomID(const char* linenm) const;
115  const char* getName(Geometry::ID) const;
116 
117  Coord toCoord(const TrcKey&) const;
118 
120  Pos::TraceID) const;
122  TrcKey traceKey(Geometry::ID,Pos::TraceID) const;
124 
125  bool fillGeometries(TaskRunner*);
126  bool getList(BufferStringSet& names,
128  bool is2d) const;
129  Geometry::ID findRelated(const Geometry&,
131  bool usezrg) const;
133 
134  static TrcKey::SurvID get2DSurvID() { return surv2did_; }
135  TrcKey::SurvID default3DSurvID() const;
137 
138 protected:
139 
140  void ensureSIPresent() const;
141  void addGeometry(Geometry&);
142 
143  int indexOf(Geometry::ID) const;
144  bool hasDuplicateLineNames();
145 
148  static const TrcKey::SurvID surv2did_;
149 
151 
152 public:
153 
157  Geometry* getGeometry(Geometry::ID);
158  bool write(Geometry&,uiString&);
159  Geometry::ID addNewEntry(Geometry*,uiString&);
161  bool removeGeometry(Geometry::ID);
162 
163  Geometry::ID getGeomID(const char* lsm,
164  const char* linenm) const;
167  bool fetchFrom2DGeom(uiString& errmsg);
168  //converts od4 geometries to od5 geometries.
169  bool updateGeometries(TaskRunner*);
170 };
171 
172 
173 mGlobal(Basic) const GeometryManager& GM();
175 { return const_cast<GeometryManager&>( Survey::GM() ); }
176 
177 
178 
180 {
181 public:
182 
183  virtual ~GeometryReader() {}
184  mDefineFactoryInClass(GeometryReader,factory)
185 
186  virtual bool read(ObjectSet<Geometry>&,TaskRunner*) const
187  { return true; }
189  { return true; }
190 };
191 
192 
193 
195 {
196 public:
197 
198  virtual ~GeometryWriter() {}
199  mDefineFactoryInClass(GeometryWriter,factory)
200 
201  virtual bool write(Geometry&,uiString&,
202  const char* crfromstr=0) const { return true; }
203  virtual IOObj* createEntry(const char*) const { return 0; }
204  virtual Geometry::ID createNewGeomID(const char*) const { return 0; }
205  virtual bool removeEntry(const char*) const { return 0; }
206 
207 };
208 
209 } //namespace Survey
210 
211 #define mUdfGeomID Survey::GeometryManager::cUndefGeomID()
212 #define mIsUdfGeomID(geomid) (geomid == mUdfGeomID)
213 //To cut the long story short.
214 
215 #endif
GeometryManager & GMAdmin()
Definition: survgeom.h:174
virtual Geometry3D * as3D()
Definition: survgeom.h:82
#define mRefCountImpl(ClassName)
Macro to setup a class with destructor for reference counting.
Definition: refcount.h:163
#define mExpClass(module)
Definition: commondefs.h:160
Coord toCoord(const BinID &b) const
Definition: survgeom.h:58
const GeometryManager & GM()
Index_Type LineID
Definition: commontypes.h:50
virtual ~GeometryWriter()
Definition: survgeom.h:198
Definition: ioobj.h:58
virtual Geometry2D * as2D()
Definition: survgeom.h:79
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
static Geometry::ID cUndefGeomID()
Definition: survgeom.h:136
const TrcKeyZSampling & sampling() const
Definition: survgeom.h:72
ID id_
Definition: survgeom.h:92
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Index_Type TraceID
Definition: commontypes.h:51
#define mGlobal(module)
Definition: commondefs.h:163
static const TrcKey::SurvID surv2did_
Definition: survgeom.h:148
Geometry of a 2D Line.
Definition: survgeom2d.h:27
bool includes(const BinID &b) const
Definition: survgeom.h:63
Pos::SurvID SurvID
Definition: trckey.h:32
Definition: uistring.h:89
virtual Geometry::ID createNewGeomID(const char *) const
Definition: survgeom.h:204
A cartesian coordinate in 2D space.
Definition: coord.h:25
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
IdxType & trcNr()
Definition: posidxpair.h:49
virtual bool updateGeometries(ObjectSet< Geometry > &, TaskRunner *) const
Definition: survgeom.h:188
Set of pointers to objects.
Definition: commontypes.h:32
Threads::Lock lock_
Definition: survgeom.h:146
RelationType
Definition: survgeom.h:45
Set of (small) copyable elements.
Definition: commontypes.h:30
Index_Type SurvID
Definition: commontypes.h:49
Class that can execute a task.
Definition: task.h:169
Definition: survgeom.h:194
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:272
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
bool hasduplnms_
Definition: survgeom.h:150
virtual bool removeEntry(const char *) const
Definition: survgeom.h:205
#define mDefineFactoryInClass(T, funcname)
Definition: factory.h:426
ObjectSet< Geometry > geometries_
Definition: survgeom.h:147
Index_Type GeomID
Definition: commontypes.h:52
bool getSurvID(const PicksType &picks)
Definition: pickset.h:148
virtual IOObj * createEntry(const char *) const
Definition: survgeom.h:203
virtual RelationType compare(const Geometry &, bool usezrg) const
Definition: survgeom.h:75
void setID(ID id)
Definition: survgeom.h:54
IdxType & lineNr()
Definition: posidxpair.h:44
Scaled down survey geometry for an inl/crl geometry.
Definition: survgeom3d.h:28
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
ID getID() const
Definition: survgeom.h:53
bool is2D(const PicksType &picks)
Definition: pickset.h:142
Pos::GeomID ID
Definition: survgeom.h:44
virtual ~GeometryReader()
Definition: survgeom.h:183
Makes geometries accessible from a geometry ID, or a MultiID.
Definition: survgeom.h:99
static TrcKey::SurvID get2DSurvID()
Definition: survgeom.h:134
Definition: survgeom.h:25
Definition: survgeom.h:179
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:28
TrcKeyZSampling sampling_
Definition: survgeom.h:89
bool exists(const char *)
Definition: arraytesselator.h:21
const SeisTrc * getTrace(EM::SubID) const
Compound key consisting of ints.
Definition: multiid.h:25
FixedString Geometry()
Definition: keystrs.h:69

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