OpendTect-6_4  6.4
posinfo2dsurv.h
Go to the documentation of this file.
1 #ifndef posinfo2dsurv_h
2 #define posinfo2dsurv_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Aug 2010
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 
16 #include "basicmod.h"
17 #include "posinfo2d.h"
18 #include "separstr.h"
19 #include "survgeom.h"
20 #include "threadlock.h"
21 #include "callback.h"
22 #include "idxpair.h"
23 
24 class FilePath;
25 class BufferStringSet;
26 namespace PosInfo { class Survey2D; }
27 
28 
31 mGlobal(Basic) const PosInfo::Survey2D& S2DPOS();
32 
33 
34 namespace PosInfo
35 {
36 
39 inline mGlobal(Basic) Survey2D& POS2DAdmin()
40 {
41  return const_cast<Survey2D&>( S2DPOS() );
42 }
43 
44 
45 
49 mExpClass(Basic) Line2DKey : public IdxPair
50 {
51 public:
52 
53  Line2DKey( int lsid=-1, int lineid=-1 )
54  : IdxPair(lsid,lineid) {}
55 
56  inline bool operator ==( const Line2DKey& oth ) const
57  { return IdxPair::operator==(oth); }
58  inline bool operator !=( const Line2DKey& oth ) const
59  { return !( operator==(oth) ); }
60 
61  inline IdxType& lsID() { return first; }
62  inline IdxType lsID() const { return first; }
63  inline IdxType& lineID() { return second; }
64  inline IdxType lineID() const { return second; }
65 
66  bool isOK() const;
67 
68  const char* toString() const;
69  bool fromString(const char*);
70 
71  bool haveLSID() const;
72  bool haveLineID() const;
73 
74  bool isUdf() const;
75  static const Line2DKey& udf();
76 
77 };
78 
79 typedef Line2DKey GeomID;
80 
81 
82 
85 mExpClass(Basic) Survey2D : public CallBacker
86 {
87 public:
88 
90 
91  static void initClass();
92  bool isEmpty() const { return lsnm_.isEmpty(); }
93 
94  //using names
95  bool hasLineSet(const char*) const;
96  bool hasLine(const char* lnm,const char* lsnm=0) const;
97  void getLineSets( BufferStringSet& nms ) const
98  { getKeys(lsindex_,nms); }
99  void getLines(BufferStringSet&,const char* lsnm=0) const;
100 
101  const char* curLineSet() const { return lsnm_.buf(); }
102  void setCurLineSet(const char*) const;
103 
104  bool getGeometry(Line2DData&) const;
105  bool setGeometry(const Line2DData&);
106 
107  void removeLine(const char*);
108  void removeLineSet(const char*);
109  void renameLineSet(const char*,const char*);
110 
111  // using ids
112  const char* getLineSet(IdxType lsid) const;
113  const char* getLineName(IdxType lineid) const;
114  IdxType getLineSetID(const char*) const;
115  IdxType getLineID(const char*) const;
116  bool hasLineSet(IdxType lsid) const;
117  bool hasLine(IdxType lineid,IdxType lsid=-1) const;
118  void getLineIDs(TypeSet<IdxType>&,IdxType lsid) const;
119  void getLines(BufferStringSet&,IdxType lsid) const;
120 
121  IdxType curLineSetID() const;
122  void setCurLineSet(IdxType lsid) const;
123 
124  bool getGeometry(IdxType lid,Line2DData&) const;
125  bool getGeometry(const Line2DKey&,Line2DData&) const;
127 
128  void renameLine(const char*oldnm,const char*newnm);
129  void removeLine(IdxType lid);
130  void removeLineSet(IdxType lsid);
131 
132  Line2DKey getLine2DKey(const char* lsnm,const char* linenm) const;
133  const char* getLSFileNm(const char* lsnm) const;
134  const char* getLineFileNm(const char* lsnm,const char* lnm) const;
135 
136  bool readDistBetwTrcsStats(const char* linemn,float& max,
137  float& median) const;
138 
139 protected:
140 
141  IdxType getNewID(IOPar&);
142  void updateMaxID(IdxType,IOPar&);
143 
144 private:
145 
153 
154  void readIdxFiles();
155  bool isIdxFileNew(const char* lsnm=0) const;
156  BufferString getIdxTimeStamp(const char* lsnm=0) const;
157  static void readIdxFile(const char*,IOPar&);
158  void writeIdxFile(bool) const;
159  void getKeys(const IOPar&,BufferStringSet&) const;
160  void getIDs(const IOPar&,TypeSet<IdxType>&) const;
161  BufferString getNewStorageName(const char*,const FilePath&,
162  const IOPar&) const;
163  int getLineSetIdx(IdxType lsid) const;
164  int getLineIdx(IdxType lineid) const;
165 
166  mGlobal(Basic) friend const Survey2D& ::S2DPOS();
167 
168  Survey2D();
169 
170 public:
171 
172  ~Survey2D();
173 
174 };
175 
176 
177 } // namespace PosInfo
178 
179 #endif
#define mExpClass(module)
Definition: commondefs.h:160
IdxType & lsID()
Definition: posinfo2dsurv.h:61
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:53
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Threads::Lock lock_
Definition: posinfo2dsurv.h:152
IdxType lsID() const
Definition: posinfo2dsurv.h:62
IOPar & lsindex_
Definition: posinfo2dsurv.h:149
FilePath & lsfp_
Definition: posinfo2dsurv.h:147
#define mGlobal(module)
Definition: commondefs.h:163
bool operator==(const IdxPair &) const
Definition: idxpair.h:60
Survey2D & POS2DAdmin()
Your R/W access to the 2D line geometry database.
Definition: posinfo2dsurv.h:39
Position info for a 2D line.
Definition: posinfo2d.h:65
void getLineSets(BufferStringSet &nms) const
Definition: posinfo2dsurv.h:97
Line2DKey GeomID
Definition: posinfo2dsurv.h:79
Set of BufferString objects.
Definition: bufstringset.h:28
IdxType lineID() const
Definition: posinfo2dsurv.h:64
bool isEmpty() const
Definition: posinfo2dsurv.h:92
IOPar & lineindex_
Definition: posinfo2dsurv.h:150
Repository for 2D line geometries.
Definition: posinfo2dsurv.h:85
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
const PosInfo::Survey2D & S2DPOS()
Your read-access to the 2D line geometry database.
Line2DKey::IdxType IdxType
Definition: posinfo2dsurv.h:89
BufferString curlstimestr_
Definition: posinfo2dsurv.h:151
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
Position info, often segmented.
Definition: posinfo.h:40
File pathname tools.
Definition: filepath.h:34
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Line2DKey(int lsid=-1, int lineid=-1)
Definition: posinfo2dsurv.h:53
Index_Type IdxType
Definition: idxpair.h:34
FilePath & basefp_
Definition: posinfo2dsurv.h:146
Key holding ID for both lineset and line.
Definition: posinfo2dsurv.h:49
const char * curLineSet() const
Definition: posinfo2dsurv.h:101
IdxType & lineID()
Definition: posinfo2dsurv.h:63
bool isUdf(const T &t)
Definition: undefval.h:243
Export_Basic const char * toString(ViewStyle)
A pair of numbers; base class for BinID et al.
Definition: idxpair.h:30
static void initClass()
BufferString lsnm_
Definition: posinfo2dsurv.h:148

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