OpendTect  6.3
randomlinegeom.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: Nanne Hemstra
8  Date: December 2006
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "geometrymod.h"
14 #include "namedmonitorable.h"
15 #include "binid.h"
16 #include "dbkey.h"
17 #include "notify.h"
18 #include "ranges.h"
19 #include "refcount.h"
20 #include "trckeysampling.h"
21 
22 class TrcKeyZSampling;
23 class Line2;
24 
25 namespace Geometry
26 {
27 
28 class RandomLineSet;
29 
30 mExpClass(Geometry) RandomLine : public RefCount::Referenced
31  , public NamedMonitorable
32 {
33 public:
34 
35  RandomLine(const char* nm=0);
36 
37  void setSurvID(Pos::SurvID s) { survid_ = s; }
38  Pos::SurvID getSurvID() const { return survid_; }
39 
40  int ID() const { return id_; }
41 
42  int addNode(const BinID&);
43  void insertNode(int,const BinID&);
44  void setName(const char*);
45  void setNodePosition(int idx,const BinID&,bool moving=false);
46  void setNodePositions(const TypeSet<BinID>&);
47  void removeNode(int);
48  void removeNode(const BinID&);
49  bool isEmpty() const { return nodes_.isEmpty(); }
50  void limitTo(const TrcKeyZSampling&); // nrNodes should be 2
51 
52  int nodeIndex(const BinID&) const;
53  int nrNodes() const;
54  const BinID& nodePosition(int) const;
55  void allNodePositions(TypeSet<BinID>&) const;
56  void allNodePositions(TrcKeyPath&) const;
57  static Coord getNormal(const TrcKeyPath& knots,const TrcKey& pos);
58  static int getNearestPathPosIdx(const TrcKeyPath&,
59  const TrcKeyPath&,const TrcKey&);
60 
61  enum DuplicateMode { NoDups=0, NoConsecutiveDups, AllDups };
62  static void getPathBids(const TypeSet<BinID>& knots,
64  TypeSet<BinID>& path,
65  DuplicateMode dupmode=NoConsecutiveDups,
66  TypeSet<int>* segments=0);
67 
68  void setZRange( const Interval<float>& rg )
69  { zrange_ = rg; zrangeChanged.trigger(); }
70  Interval<float> zRange() const { return zrange_; }
71 
72  void setDBKey(const DBKey&);
73  DBKey getDBKey() const { return dbky_; }
74 
75  void setLocked( bool yn ) { locked_ = yn; }
76  bool isLocked() const { return locked_; }
77 
78  struct ChangeData : public CallBacker
79  {
80  enum Event { Undef, Added, Inserted, Moving, Moved, Removed };
81 
82  ChangeData( Event ev=Undef, int nodeidx=-1 )
83  : ev_(ev)
84  , nodeidx_(nodeidx)
85  {}
86 
88  int nodeidx_;
89  };
90 
94 
95  RandomLineSet* lineSet() { return lset_; }
96  const RandomLineSet* lineSet() const { return lset_; }
97 
99 
100 protected:
101 
102  ~RandomLine();
103 
105 
110  bool locked_;
111 
112  friend class RandomLineSet;
113 
114 private:
115 
116  int id_;
117 
118 };
119 
120 
122 {
123 public:
124 
125  RandomLineSet();
126  RandomLineSet(const RandomLine&,double dist,
127  bool parallel);
129 
130  virtual ~RandomLineSet();
131  bool isEmpty() const { return lines_.isEmpty(); }
132  void setEmpty();
133  RandomLine* getRandomLine(int);
134  const RandomLine* getRandomLine(int) const;
135 
136  int size() const { return lines_.size(); }
137  const ObjectSet<RandomLine>& lines() const { return lines_; }
138  void removeLine(int idx);
139  void addLine(RandomLine&);
140  void insertLine(RandomLine&,int idx);
141  void limitTo(const TrcKeyZSampling&);
142 
143  const IOPar& pars() const { return pars_; }
144  IOPar& pars() { return pars_; }
145 
146 protected:
147 
150 
151  void createParallelLines(const Line2& baseline,Pos::SurvID,
152  double dist);
153 
154 public:
155  static void getGeometry(const DBKey&,TypeSet<BinID>& knots,
156  StepInterval<float>* zrg=0);
157 };
158 
159 
161 {
162 public:
164 
165  RandomLine* get(const DBKey&);
166  RandomLine* getByName(const char*);
167  RandomLine* get(int id);
168  const RandomLine* get(int id) const;
169  bool isLoaded(const DBKey&) const;
170  bool isLoaded(int id) const;
171 
172  int add(RandomLine*);
173  void remove(RandomLine*);
174 
177 
178 
179 protected:
182 
183  int indexOf(const DBKey&) const;
184 
186 };
187 
189 
190 
191 } // namespace Geometry
#define mExpClass(module)
Definition: commondefs.h:157
int nodeidx_
Definition: randomlinegeom.h:88
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
DuplicateMode
Definition: randomlinegeom.h:61
Monitorable object with a name. All but name() are MT-safe.
Definition: namedmonitorable.h:20
FixedString Undef()
Definition: keystrs.h:139
bool locked_
Definition: randomlinegeom.h:110
#define mGlobal(module)
Definition: commondefs.h:160
Event ev_
Definition: randomlinegeom.h:87
Interval< float > zrange_
Definition: randomlinegeom.h:107
Definition: randomlinegeom.h:30
const IOPar & pars() const
Definition: randomlinegeom.h:143
DBKey dbky_
Definition: randomlinegeom.h:108
bool isLocked() const
Definition: randomlinegeom.h:76
Definition: randomlinegeom.h:80
Notifier< RandomLine > zrangeChanged
Definition: randomlinegeom.h:93
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
DBKey getDBKey() const
Definition: randomlinegeom.h:73
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
IOPar & pars()
Definition: randomlinegeom.h:144
Class to help setup a callback handling.
Definition: notify.h:121
Set of pointers to objects.
Definition: commontypes.h:28
CNotifier< RandomLine, const ChangeData & > nodeChanged
Definition: randomlinegeom.h:92
Interval< float > zRange() const
Definition: randomlinegeom.h:70
IOPar & pars_
Definition: randomlinegeom.h:149
int ID() const
Definition: randomlinegeom.h:40
Definition: randomlinegeom.h:160
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Index_Type SurvID
Definition: commontypes.h:45
ChangeData(Event ev=Undef, int nodeidx=-1)
Definition: randomlinegeom.h:82
void setSurvID(Pos::SurvID s)
Definition: randomlinegeom.h:37
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:32
ObjectSet< RandomLine > lines_
Definition: randomlinegeom.h:148
bool isEmpty() const
Definition: randomlinegeom.h:131
RandomLineSet * lset_
Definition: randomlinegeom.h:109
Pos::SurvID survid_
Definition: randomlinegeom.h:104
Definition: randomlinegeom.h:78
TypeSet< BinID > nodes_
Definition: randomlinegeom.h:106
RandomLineManager & RLM()
CNotifier< RandomLineManager, int > removed
Definition: randomlinegeom.h:176
int id_
Definition: randomlinegeom.h:116
void setZRange(const Interval< float > &rg)
Definition: randomlinegeom.h:68
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:28
Definition: randomlinegeom.h:121
void setLocked(bool yn)
Definition: randomlinegeom.h:75
Notifier with automatic capsule creation.
Definition: notify.h:166
const ObjectSet< RandomLine > & lines() const
Definition: randomlinegeom.h:137
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:26
bool isEmpty() const
Definition: randomlinegeom.h:49
const RandomLineSet * lineSet() const
Definition: randomlinegeom.h:96
2D point or vector class.
Definition: commontypes.h:58
int size() const
Definition: randomlinegeom.h:136
Definition: arraytesselator.h:19
RandomLineSet * lineSet()
Definition: randomlinegeom.h:95
CNotifier< RandomLineManager, int > added
Definition: randomlinegeom.h:175
Notifier< RandomLine > nameChanged
Definition: randomlinegeom.h:91
A Line2 is a line in the plane, with the following equations:
Definition: trigonometry.h:398
Pos::SurvID getSurvID() const
Definition: randomlinegeom.h:38
Event
Definition: randomlinegeom.h:80

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