OpendTect-6_4  6.4
randomlinegeom.h
Go to the documentation of this file.
1 #ifndef randomlinegeom_h
2 #define randomlinegeom_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Nanne Hemstra
9  Date: December 2006
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "geometrymod.h"
16 #include "binid.h"
17 #include "multiid.h"
18 #include "namedobj.h"
19 #include "ranges.h"
20 #include "refcount.h"
21 #include "trckeysampling.h"
22 
23 class TrcKeyZSampling;
24 class Line2;
25 
26 namespace Geometry
27 {
28 
29 class RandomLineSet;
30 
33 public:
34  RandomLine(const char* nm=0);
35 
36  int ID() const { return id_; }
37 
38  int addNode(const BinID&);
39  void insertNode(int,const BinID&);
40  void setName(const char*);
41  void setNodePosition(int idx,const BinID&,bool moving=false);
42  void setNodePositions(const TypeSet<BinID>&);
43  void removeNode(int);
44  void removeNode(const BinID&);
45  bool isEmpty() const { return nodes_.isEmpty(); }
46  void limitTo(const TrcKeyZSampling&); // nrNodes should be 2
47 
48  int nodeIndex(const BinID&) const;
49  int nrNodes() const;
50  const BinID& nodePosition(int) const;
51  void allNodePositions(TypeSet<BinID>&) const;
52  static void getPathBids(const TypeSet<BinID>& knots,
54  TypeSet<BinID>& path,
55  bool allowduplicate=false,
56  TypeSet<int>* segments=0);
58  static void getPathBids(const TypeSet<BinID>& knots,
59  TypeSet<BinID>& path,
60  bool allowduplicate=false,
61  TypeSet<int>* segments=0);
63 
64  void setZRange( const Interval<float>& rg )
65  { zrange_ = rg; zrangeChanged.trigger(); }
66  Interval<float> zRange() const { return zrange_; }
67 
68  void setMultiID(const MultiID&);
69  MultiID getMultiID() const { return mid_; }
70 
71  void setLocked( bool yn ) { locked_ = yn; }
72  bool isLocked() const { return locked_; }
73 
74  struct ChangeData : public CallBacker
75  {
76  enum Event { Undef, Added, Inserted, Moving, Moved, Removed };
77 
78  ChangeData( Event ev=Undef, int nodeidx=-1 )
79  : ev_(ev)
80  , nodeidx_(nodeidx)
81  {}
82 
84  int nodeidx_;
85  };
86 
90 
91  RandomLineSet* lineSet() { return lset_; }
92  const RandomLineSet* lineSet() const { return lset_; }
93 
94 protected:
95 
100  bool locked_;
101 
102  friend class RandomLineSet;
103 
104 private:
105  int id_;
106 
107 public:
108  void allNodePositions(TrcKeyPath&) const;
109  static Coord getNormal(const TrcKeyPath& knots,const TrcKey& pos);
110  static int getNearestPathPosIdx(const TrcKeyPath&,
111  const TrcKeyPath&,const TrcKey&);
112 
113  enum DuplicateMode { NoDups=0, NoConsecutiveDups, AllDups };
114  static void getPathBids(const TypeSet<BinID>& knots,
115  Pos::SurvID,
116  TypeSet<BinID>& path,
117  DuplicateMode dupmode=NoConsecutiveDups,
118  TypeSet<int>* segments=0);
119 };
120 
121 
123 {
124 public:
125 
126  RandomLineSet();
127  RandomLineSet(const RandomLine&,double dist,
128  bool parallel);
130 
131  virtual ~RandomLineSet();
132  bool isEmpty() const { return lines_.isEmpty(); }
133  void setEmpty();
134  RandomLine* getRandomLine(int);
135  const RandomLine* getRandomLine(int) const;
136 
137  int size() const { return lines_.size(); }
138  const ObjectSet<RandomLine>& lines() const { return lines_; }
139  void removeLine(int idx);
140  void addLine(RandomLine&);
141  void insertLine(RandomLine&,int idx);
142  void limitTo(const TrcKeyZSampling&);
143 
144  const IOPar& pars() const { return pars_; }
145  IOPar& pars() { return pars_; }
146 
147 protected:
148 
151 
152  void createParallelLines(const Line2& baseline,double dist);
153 
154 public:
155  static void getGeometry(const MultiID&,TypeSet<BinID>& knots,
156  StepInterval<float>* zrg=0);
157 };
158 
159 
161 {
162 public:
164 
165  RandomLine* get(const MultiID&);
166  RandomLine* get(int id);
167  const RandomLine* get(int id) const;
168  bool isLoaded(const MultiID&) const;
169  bool isLoaded(int id) const;
170 
171  int add(RandomLine*);
172  void remove(RandomLine*);
173 
176 
177 
178 protected:
181 
182  int indexOf(const MultiID&) const;
183 
185 };
186 
188 
189 
190 } // namespace Geometry
191 
192 #endif
#define mRefCountImpl(ClassName)
Macro to setup a class with destructor for reference counting.
Definition: refcount.h:163
#define mExpClass(module)
Definition: commondefs.h:160
int nodeidx_
Definition: randomlinegeom.h:84
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
DuplicateMode
Definition: randomlinegeom.h:113
FixedString Undef()
Definition: keystrs.h:142
bool locked_
Definition: randomlinegeom.h:100
#define mGlobal(module)
Definition: commondefs.h:163
Event ev_
Definition: randomlinegeom.h:83
Interval< float > zrange_
Definition: randomlinegeom.h:97
MultiID mid_
Definition: randomlinegeom.h:98
Definition: randomlinegeom.h:31
const IOPar & pars() const
Definition: randomlinegeom.h:144
bool isLocked() const
Definition: randomlinegeom.h:72
Definition: randomlinegeom.h:76
Notifier< RandomLine > zrangeChanged
Definition: randomlinegeom.h:89
A cartesian coordinate in 2D space.
Definition: coord.h:25
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
MultiID getMultiID() const
Definition: randomlinegeom.h:69
IOPar & pars()
Definition: randomlinegeom.h:145
Definition: callback.h:254
Set of pointers to objects.
Definition: commontypes.h:32
CNotifier< RandomLine, const ChangeData & > nodeChanged
Definition: randomlinegeom.h:88
Interval< float > zRange() const
Definition: randomlinegeom.h:66
IOPar & pars_
Definition: randomlinegeom.h:150
Definition: randomlinegeom.h:160
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
Index_Type SurvID
Definition: commontypes.h:49
ChangeData(Event ev=Undef, int nodeidx=-1)
Definition: randomlinegeom.h:78
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
ObjectSet< RandomLine > lines_
Definition: randomlinegeom.h:149
bool isEmpty() const
Definition: randomlinegeom.h:132
RandomLineSet * lset_
Definition: randomlinegeom.h:99
Definition: randomlinegeom.h:74
TypeSet< BinID > nodes_
Definition: randomlinegeom.h:96
RandomLineManager & RLM()
CNotifier< RandomLineManager, int > removed
Definition: randomlinegeom.h:175
int id_
Definition: randomlinegeom.h:105
void setZRange(const Interval< float > &rg)
Definition: randomlinegeom.h:64
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Object with a name.
Definition: namedobj.h:35
Definition: randomlinegeom.h:122
void setLocked(bool yn)
Definition: randomlinegeom.h:71
Notifier with automatic capsule creation.
Definition: callback.h:395
const ObjectSet< RandomLine > & lines() const
Definition: randomlinegeom.h:138
mRefCountImpl(RandomLine) public int ID() const
Definition: randomlinegeom.h:36
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:28
bool isEmpty() const
Definition: randomlinegeom.h:45
const RandomLineSet * lineSet() const
Definition: randomlinegeom.h:92
int size() const
Definition: randomlinegeom.h:137
Definition: arraytesselator.h:21
RandomLineSet * lineSet()
Definition: randomlinegeom.h:91
CNotifier< RandomLineManager, int > added
Definition: randomlinegeom.h:174
Notifier< RandomLine > nameChanged
Definition: randomlinegeom.h:87
A Line2 is a line on XY-plane, and it is defined in slope-intercept form y = slope*x + y-intercept; f...
Definition: trigonometry.h:397
Compound key consisting of ints.
Definition: multiid.h:25
Event
Definition: randomlinegeom.h:76

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