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

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