OpendTect  6.3
pickset.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: May 2001 / Mar 2016
9  Contents: PickSet base classes
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "picklocation.h"
15 #include "sharedobject.h"
16 #include "monitoriter.h"
17 #include "enums.h"
18 #include "odpresentationmgr.h"
19 #include "trckey.h"
20 #include "sets.h"
21 #include "draw.h"
22 #include "iopar.h"
23 #include "integerid.h"
24 template <class T> class ODPolygon;
25 
26 
27 namespace Pick
28 {
29 
30 
41 mExpClass(General) Set : public SharedObject
42 {
43 public:
44 
46  typedef size_type IdxType;
47  mDefIntegerIDType(IdxType, LocID);
48 
49  Set(const char* nm=0,const char* category=0);
52 
53  bool isPolygon() const;
54  void setIsPolygon(bool yn=true);
55  void setCategory(const char*);
56  BufferString type() const;
57  BufferString category() const;
58 
59  inline bool isEmpty() const { return size()<1; }
60  size_type size() const;
61  bool validLocID(LocID) const;
62  IdxType idxFor(LocID) const;
63  LocID locIDAfter(LocID) const;
64  bool validIdx(IdxType) const;
65  LocID locIDFor(IdxType) const;
66 
67  Location get(LocID) const;
68  Coord getPos(LocID) const;
69  double getZ(LocID) const;
70  Location first() const;
71  Location getByIndex(IdxType) const;
72 
73  Set& setEmpty();
74  Set& append(const Set&);
75  LocID insertBefore(LocID,const Location&);
76  LocID add(const Location&);
77  LocID remove(LocID);
78  Set& set(LocID,const Location&,bool istemp=false);
79  Set& setPos(LocID,const Coord&,bool istemp=false);
80  Set& setZ(LocID,double,bool istemp=false);
81  Set& setByIndex(IdxType,const Location&,bool istemp=false);
82 
83  bool isMultiGeom() const;
84  Pos::GeomID firstGeomID() const;
85  bool has2D() const;
86  bool has3D() const;
87  bool hasOnly2D() const;
88  bool hasOnly3D() const;
89 
90  void getPolygon(ODPolygon<double>&) const; // coords
91  void getPolygon(ODPolygon<float>&) const; // binids
92  void getLocations(TypeSet<Coord>&) const;
93  float getXYArea() const;
95  LocID find(const TrcKey&) const;
96  LocID nearestLocation(const Coord&) const;
97  LocID nearestLocation(const Coord3&,bool ignorez=false) const;
98  bool removeWithPolygon(const ODPolygon<double>&,
99  bool inside=true);
100 
101  mImplSimpleMonitoredGetSet(inline,pars,setPars,IOPar,pars_,cParsChange())
102  void fillPar(IOPar&) const;
103  bool usePar(const IOPar&);
104  void updateInPar(const char* ky,const char* val);
105 
106  mExpClass(General) Disp
107  {
108  public:
109  enum Connection { None, Open, Close };
111  Disp() : connect_(None) {}
112  inline bool operator ==( const Disp& oth ) const
113  { return connect_ == oth.connect_
114  && mkstyle_ == oth.mkstyle_; }
115  inline bool operator !=( const Disp& oth ) const
116  { return !(*this == oth); }
117 
120  };
121  mImplSimpleMonitoredGetSet(inline,getDisp,setDisp,Disp,disp_,cDispChange())
122  mImplSimpleMonitoredGetSet(inline,connection,setConnection,
123  Disp::Connection,disp_.connect_,cDispChange())
124  mImplSimpleMonitoredGetSet(inline,markerStyle,setMarkerStyle,
125  OD::MarkerStyle3D,disp_.mkstyle_,cDispChange())
126  mImplSimpleMonitoredGetSet(inline,dispColor,setDispColor,
127  Color,disp_.mkstyle_.color_,cDispChange())
128  mImplSimpleMonitoredGetSet(inline,dispSize,setDispSize,
129  int,disp_.mkstyle_.size_,cDispChange())
130 
131  static ChangeType cDispChange() { return 2; }
132  static ChangeType cParsChange() { return 3; }
133  static ChangeType cLocationInsert() { return 4; }
134  static ChangeType cLocationRemove() { return 5; }
135  static ChangeType cLocationPreChange() { return 6; }
136  static ChangeType cLocationChange() { return 7; }
137  static ChangeType cLocationChangeTemp() { return 8; }
138  static inline bool isLocationUpdate( ChangeType ct )
139  { return ct > cDispChange(); }
140  static inline bool isLocationChange( ChangeType ct )
141  { return ct > 5; }
142  static inline bool isTempChange( ChangeType ct )
143  { return ct > 7; }
144 
145  static const Set& emptySet() { return emptyset_; }
146  static Set& dummySet() { return dummyset_; }
147 
148  static const char* sKeyMarkerType() { return "Marker Type"; }
149 
150 protected:
151 
152  ~Set();
153 
159  static const Set emptyset_;
160  static Set dummyset_;
161 
162  IdxType gtIdxFor(LocID) const;
163  LocID insNewLocID(IdxType,AccessLocker&);
164  void replaceID(LocID from,LocID to);
165 
166  friend class SetIter;
167  friend class SetIter4Edit;
168  friend class SetChangeRecord;
169 
170 };
171 
172 
175 mExpClass(General) SetIter : public MonitorableIter4Read<Set::IdxType>
176 {
177 public:
178 
179  SetIter(const Set&,bool start_at_end=false);
180  SetIter(const SetIter&);
181  const Set& pickSet() const;
182 
183  Set::LocID ID() const;
184  const Location& get() const;
185  Coord getPos() const;
186  double getZ() const;
187 
189 
190 };
191 
192 
201 mExpClass(General) SetIter4Edit : public MonitorableIter4Write<Set::IdxType>
202 {
203 public:
204 
205  SetIter4Edit(Set&,bool start_at_end=false);
206  SetIter4Edit(const SetIter4Edit&);
207  Set& pickSet();
208  const Set& pickSet() const;
209 
210  Set::LocID ID() const;
211  Location& get() const;
212  void removeCurrent();
213  void insert(const Pick::Location&);
214 
216 
217 };
218 
219 
220 mExpClass(General) SetPresentationInfo : public OD::ObjPresentationInfo
221 {
222 public:
223 
224  SetPresentationInfo(const DBKey&);
226 
227  static OD::ObjPresentationInfo* createFrom( const IOPar&);
228  static void initClass();
229  static const char* sFactoryKey();
230 
231 };
232 
233 
234 } // namespace Pick
Disp()
Definition: pickset.h:111
#define mExpClass(module)
Definition: commondefs.h:157
static ChangeType cLocationRemove()
Definition: pickset.h:134
static Set & dummySet()
Definition: pickset.h:146
static const char * sKeyMarkerType()
Definition: pickset.h:148
int ChangeType
Definition: monitorable.h:80
static ChangeType cLocationInsert()
Definition: pickset.h:133
T to(const F &fr)
Definition: convert.h:31
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
Pick location in space,.
Definition: picklocation.h:44
base class for non-const Monitorable iterator.
Definition: monitoriter.h:111
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
Definition: sharedobject.h:18
IOPar pars_
Definition: pickset.h:157
(Closed) sequence of connected 2-D coordinates.
Definition: polygon.h:25
Connection connect_
connect picks in set order
Definition: pickset.h:118
static ChangeType cParsChange()
Definition: pickset.h:132
TypeSet< Location > locs_
Definition: pickset.h:154
Disp disp_
Definition: pickset.h:156
base class for const Monitorable iterator.
Definition: monitoriter.h:83
static ChangeType cLocationPreChange()
Definition: pickset.h:135
#define mDeclMonitorableAssignment(clss)
like mDeclAbstractMonitorableAssignment but for non-abstract subclasses. Implements the clone() metho...
Definition: monitor.h:111
OD::MarkerStyle3D mkstyle_
Definition: pickset.h:119
#define mDeclareEnumUtils(enm)
Some utilities surrounding the often needed enum <-> string table.
Definition: enums.h:188
FixedString None()
Definition: keystrs.h:90
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
bool append(TypeSetBase< T, I > &to, const TypeSetBase< S, J > &from)
append allowing a different type to be merged into set
Definition: typeset.h:205
Monitorable set of pick locations.
Definition: pickset.h:41
3D point or vector
Definition: commontypes.h:57
int size_type
Definition: typeset.h:29
Set of (small) copyable elements.
Definition: commontypes.h:26
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Threads::Atomic< IdxType > curlocidnr_
Definition: pickset.h:158
#define mImplSimpleMonitoredGetSet(pfx, fnnmget, fnnmset, typ, memb, chgtyp)
Defines simple MT-safe copyable member access.
Definition: monitor.h:39
non-const Set iterator. Does not lock, so use this for non-shared Pick::Set&#39;s only. Really, because it locks totally nothing, many methods bypass the stand-alone Pick::Set&#39;s locking.
Definition: pickset.h:201
const Set iterator.
Definition: pickset.h:175
static Set dummyset_
Definition: pickset.h:160
#define mDefIntegerIDType(IntType, classname)
Definition: integerid.h:83
static bool isTempChange(ChangeType ct)
Definition: pickset.h:142
#define mDefNoAssignmentOper(clss)
Definition: commondefs.h:131
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:60
static const Set emptyset_
Definition: pickset.h:159
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:187
Definition: pickset.h:109
TypeSet< LocID > locids_
Definition: pickset.h:155
TypeSet< Location >::size_type size_type
Definition: pickset.h:45
Index_Type GeomID
Definition: commontypes.h:48
Holds one change in a Pick::Set.
Definition: picksetchangerecorder.h:25
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
size_type IdxType
Definition: pickset.h:46
Definition: picklocation.h:19
Definition: pickset.h:220
OpendTect.
Definition: commontypes.h:25
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:24
Definition: monitorable.h:155
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
Definition: pickset.h:106
Connection
Definition: pickset.h:109
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:26
static ChangeType cLocationChange()
Definition: pickset.h:136
static bool isLocationChange(ChangeType ct)
Definition: pickset.h:140
2D point or vector class.
Definition: commontypes.h:58
FixedString ID()
Definition: keystrs.h:71
bool isEmpty() const
Definition: pickset.h:59
static ChangeType cLocationChangeTemp()
Definition: pickset.h:137
Definition: odpresentationmgr.h:60
Definition: draw.h:91
static bool isLocationUpdate(ChangeType ct)
Definition: pickset.h:138
static const Set & emptySet()
Definition: pickset.h:145
static void initClass()

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