OpendTect  6.6
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  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "factory.h"
15 #include "coord.h"
16 #include "refcount.h"
17 #include "threadlock.h"
18 #include "trckey.h"
19 #include "trckeyzsampling.h"
20 
21 class TaskRunner;
22 class IOObj;
23 
24 namespace Survey
25 {
26 class Geometry2D;
27 class Geometry3D;
28 
40 { mRefCountImpl(Geometry)
41 public:
42 
43  typedef Pos::GeomID ID;
44  enum RelationType { UnRelated=0, Related, SubSet, SuperSet, Identical };
48  virtual bool is2D() const = 0;
50  static const Geometry& default3D();
51 
52  ID getID() const { return id_; }
53  void setID( ID id ) { id_ = id; }
54  virtual const char* getName() const = 0;
55 
56  virtual Coord toCoord(Pos::LineID,Pos::TraceID) const = 0;
57  inline Coord toCoord( const BinID& b ) const
58  { return toCoord( b.lineNr(), b.trcNr() ); }
59 
60  virtual bool includes(Pos::LineID,Pos::TraceID) const = 0;
61  bool includes(const TrcKey&) const;
62  inline bool includes( const BinID& b ) const
63  { return includes( b.lineNr(), b.trcNr() ); }
64 
65  static bool exists(const TrcKey&);
66  static Coord toCoord(const TrcKey&);
67 
68  virtual TrcKey getTrace(const Coord&,float maxdist) const;
69  virtual TrcKey nearestTrace(const Coord&,
70  float* distance=nullptr) 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 nullptr; }
80  const Geometry2D* as2D() const;
81 
82  virtual Geometry3D* as3D() { return nullptr; }
83  const Geometry3D* as3D() const;
84 
85 protected:
86 
88 
90 private:
91 
93 
94 };
95 
96 
101 public:
102 
105 
107  const Geometry* getGeometry(const char*) const;
108  const Geometry* getGeometry(const MultiID&) const;
109 
111 
112  const Geometry2D& get2D(Pos::GeomID) const;
113 
114  int nrGeometries() const;
115  bool isUsable(Pos::GeomID) const;
116 
117  Pos::GeomID getGeomID(const char* linenm) const;
118  const char* getName(Pos::GeomID) const;
120 
121  Coord toCoord(const TrcKey&) const;
122 
124  Pos::TraceID) const;
128  TrcKey nearestTrace(const Coord&,bool is2d,
129  float* dist=nullptr) const;
130 
134  bool is2d) const;
137  bool usezrg) const;
139 
140  static TrcKey::SurvID get2DSurvID() { return surv2did_; }
141  static TrcKey::SurvID get3DSurvID() { return surv3did_; }
142  static Pos::GeomID cUndefGeomID() { return mUdf(Pos::GeomID); }
143 
144  mDeprecated("Use get3DSurvID()")
145  TrcKey::SurvID default3DSurvID() const;
146 
147 protected:
148 
149  void ensureSIPresent() const;
150  void addGeometry(Geometry&);
151 
152  int indexOf(Pos::GeomID) const;
153  bool hasDuplicateLineNames();
154 
155  Threads::Lock lock_;
156  ObjectSet<Geometry> geometries_;
157  static const TrcKey::SurvID surv2did_;
158  static const TrcKey::SurvID surv3did_;
159 
160  bool hasduplnms_;
161 
162 public:
163 
167  Geometry* getGeometry(Pos::GeomID);
169  bool write(Geometry&,uiString&);
170  Pos::GeomID addNewEntry(Geometry*,uiString&);
172  bool removeGeometry(Pos::GeomID);
173 
174  Pos::GeomID getGeomID(const char* lsm,
175  const char* linenm) const;
178  bool fetchFrom2DGeom(uiString& errmsg);
179  //converts od4 geometries to od5 geometries.
180  bool updateGeometries(TaskRunner*);
181 };
182 
183 
184 mGlobal(Basic) const GeometryManager& GM();
186 { return const_cast<GeometryManager&>( Survey::GM() ); }
187 
193 
194 
196 {
197 public:
198 
199  virtual ~GeometryReader() {}
201 
202  virtual bool read(ObjectSet<Geometry>&,TaskRunner*) const
203  { return true; }
205  { return true; }
206 };
207 
208 
209 
211 {
212 public:
213 
214  virtual ~GeometryWriter() {}
216 
217  virtual bool write(Geometry&,uiString&,
218  const char* crfromstr=0) const { return true; }
219  virtual IOObj* createEntry(const char*) const { return 0; }
220  virtual Pos::GeomID createNewGeomID(const char*) const { return 0; }
221  virtual bool removeEntry(const char*) const { return 0; }
222 
223 };
224 
225 } //namespace Survey
226 
227 
228 #define mUdfGeomID Survey::GeometryManager::cUndefGeomID()
229 #define mIsUdfGeomID(geomid) (geomid == mUdfGeomID)
230 //To cut the long story short.
231 
Survey::GeometryManager::GeometryManager
GeometryManager()
Survey::GeometryReader
Definition: survgeom.h:196
Survey::GMAdmin
GeometryManager & GMAdmin()
Definition: survgeom.h:185
Survey::Geometry::getTrace
virtual TrcKey getTrace(const Coord &, float maxdist) const
Survey::GeometryManager::get2D
const Geometry2D & get2D(Pos::GeomID) const
Survey::GeometryWriter
Definition: survgeom.h:211
Survey::GeometryManager::get3DSurvID
static TrcKey::SurvID get3DSurvID()
Definition: survgeom.h:141
Survey::Geometry::Geometry
Geometry()
Survey::Geometry::toCoord
virtual Coord toCoord(Pos::LineID, Pos::TraceID) const =0
factory.h
Survey::Geometry::as3D
virtual Geometry3D * as3D()
Definition: survgeom.h:82
Survey::is2DGeom
bool is2DGeom(Pos::GeomID)
Pos
Position.
Definition: commontypes.h:78
Survey::Geometry::getName
virtual const char * getName() const =0
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
Survey::Geometry::exists
static bool exists(const TrcKey &)
ObjectSet
Set of pointers to objects.
Definition: commontypes.h:31
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
Survey::GeometryManager::getGeometry
const Geometry * getGeometry(const char *) const
Survey::Geometry::getSurvID
Pos::SurvID getSurvID() const
Geometry
Definition: arraytesselator.h:21
Survey::Geometry::RelationType
RelationType
Definition: survgeom.h:44
Survey::GeometryManager
Makes geometries accessible from a geometry ID, or a MultiID.
Definition: survgeom.h:100
trckey.h
Survey::Geometry::as2D
const Geometry2D * as2D() const
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
Survey::GeometryManager::getName
const char * getName(Pos::GeomID) const
Survey::GeometryManager::toCoord
Coord toCoord(const TrcKey &) const
Pos::SurvID
Index_Type SurvID
Definition: commontypes.h:84
Survey::Geometry::as3D
const Geometry3D * as3D() const
Survey::Geometry3D
Scaled down survey geometry for an inl/crl geometry.
Definition: survgeom3d.h:28
Survey::default3DGeomID
Pos::GeomID default3DGeomID()
Pos::IdxPair::trcNr
IdxType & trcNr()
Definition: posidxpair.h:48
Survey::Geometry::toCoord
Coord toCoord(const BinID &b) const
Definition: survgeom.h:57
Survey::GeometryManager::fillGeometries
bool fillGeometries(TaskRunner *)
mODTextTranslationClass
#define mODTextTranslationClass(clss)
Definition: uistring.h:40
Survey::GeometryManager::nearestTrace
TrcKey nearestTrace(const Coord &, bool is2d, float *dist=nullptr) const
TrcKeyZSampling
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
Pos::LineID
Index_Type LineID
Definition: commontypes.h:85
Survey::is3DGeom
bool is3DGeom(Pos::GeomID)
Survey::GeometryReader::~GeometryReader
virtual ~GeometryReader()
Definition: survgeom.h:199
Survey::GM
const GeometryManager & GM()
BinID
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:31
StepInterval< float >
Coord
A cartesian coordinate in 2D space.
Definition: coord.h:25
Pos::IdxPair::lineNr
IdxType & lineNr()
Definition: posidxpair.h:43
Survey::Geometry::includes
virtual bool includes(Pos::LineID, Pos::TraceID) const =0
Survey::GeometryWriter::createNewGeomID
virtual Pos::GeomID createNewGeomID(const char *) const
Definition: survgeom.h:220
Survey::Geometry::nearestTrace
virtual TrcKey nearestTrace(const Coord &, float *distance=nullptr) const =0
Pos::TraceID
Index_Type TraceID
Definition: commontypes.h:86
indexOf
BufferStringSet::idx_type indexOf(const BufferStringSet &, const char *)
trckeyzsampling.h
Survey::GeometryManager::getGeometry
const Geometry * getGeometry(const MultiID &) const
mDeprecated
#define mDeprecated(msg)
Definition: plfdefs.h:215
mDefineFactoryInClass
#define mDefineFactoryInClass(T, funcname)
Definition: factory.h:425
TaskRunner
Class that can execute a task.
Definition: task.h:170
Survey
Definition: surveydisklocation.h:18
Survey::GeometryManager::zRange
StepInterval< float > zRange(Pos::GeomID) const
IOObj
Definition: ioobj.h:58
Survey::GeometryManager::~GeometryManager
~GeometryManager()
Survey::Geometry::default3D
static const Geometry & default3D()
Survey::GeometryWriter::createEntry
virtual IOObj * createEntry(const char *) const
Definition: survgeom.h:219
Survey::GeometryManager::traceKey
TrcKey traceKey(Pos::GeomID, Pos::TraceID) const
For 2D.
Survey::GeometryManager::getGeomID
Pos::GeomID getGeomID(const char *linenm) const
Survey::isValidGeomID
bool isValidGeomID(Pos::GeomID)
Survey::Geometry::is2D
virtual bool is2D() const =0
MultiID
Compound key consisting of ints.
Definition: multiid.h:24
TrcKey
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:28
Survey::GeometryWriter::~GeometryWriter
virtual ~GeometryWriter()
Definition: survgeom.h:214
Survey::GeometryManager::getGeometry
const Geometry * getGeometry(Pos::GeomID) const
Survey::Geometry::includes
bool includes(const BinID &b) const
Definition: survgeom.h:62
Survey::GeometryReader::updateGeometries
virtual bool updateGeometries(ObjectSet< Geometry > &, TaskRunner *) const
Definition: survgeom.h:204
Survey::GeometryWriter::removeEntry
virtual bool removeEntry(const char *) const
Definition: survgeom.h:221
uiString
String that is able to hold international (UTF-8) strings for the user interface.
Definition: uistring.h:121
TrcKey::SurvID
Pos::SurvID SurvID
Definition: trckey.h:31
Survey::GeometryManager::get2DSurvID
static TrcKey::SurvID get2DSurvID()
Definition: survgeom.h:140
Survey::GeometryManager::cUndefGeomID
static Pos::GeomID cUndefGeomID()
Definition: survgeom.h:142
Survey::isSynthetic
bool isSynthetic(Pos::GeomID)
threadlock.h
Survey::Geometry::toCoord
static Coord toCoord(const TrcKey &)
Survey::GeometryManager::nrGeometries
int nrGeometries() const
mUdf
#define mUdf(type)
Use this macro to get the undefined for simple types.
Definition: undefval.h:274
refcount.h
Survey::Geometry2D
Geometry of a 2D Line.
Definition: survgeom2d.h:27
Survey::Geometry::compare
virtual RelationType compare(const Geometry &, bool usezrg) const
Definition: survgeom.h:75
Batch::ID
int ID
Definition: batchjobdispatch.h:24
Survey::GeometryManager::getList
bool getList(BufferStringSet &names, TypeSet< Pos::GeomID > &ids, bool is2d) const
Survey::GeometryManager::isUsable
bool isUsable(Pos::GeomID) const
Survey::Geometry::sampling
const TrcKeyZSampling & sampling() const
Definition: survgeom.h:72
Survey::Geometry::setID
void setID(ID id)
Definition: survgeom.h:53
Survey::Geometry::averageTrcDist
virtual float averageTrcDist() const =0
Survey::Geometry::id_
ID id_
Definition: survgeom.h:92
Survey::Geometry::as2D
virtual Geometry2D * as2D()
Definition: survgeom.h:79
Threads
interface to threads that should be portable.
Definition: atomic.h:23
Survey::GeometryManager::findRelated
Pos::GeomID findRelated(const Geometry &, Geometry::RelationType &, bool usezrg) const
Returns cUndefGeomID() if none found.
Survey::Geometry::sampling_
TrcKeyZSampling sampling_
Definition: survgeom.h:89
Survey::Geometry::getID
ID getID() const
Definition: survgeom.h:52
Pos::GeomID
Index_Type GeomID
Definition: commontypes.h:87
Survey::Geometry::includes
bool includes(const TrcKey &) const
TypeSet< Pos::GeomID >
Survey::GeometryManager::traceKey
TrcKey traceKey(Pos::GeomID, Pos::LineID, Pos::TraceID) const
For 3D.
Survey::GeometryManager::getGeometry3D
const Geometry3D * getGeometry3D(Pos::SurvID) const
coord.h

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