OpendTect  6.6
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  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 #include "geometrymod.h"
15 #include "binid.h"
16 #include "multiid.h"
17 #include "namedobj.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 
31 { mRefCountImpl(RandomLine)
32 public:
33  RandomLine(const char* nm=0);
34 
35  int ID() const { return id_; }
36 
37  int addNode(const BinID&);
38  void insertNode(int,const BinID&);
39  void setName(const char*);
40  void setNodePosition(int idx,const BinID&,bool moving=false);
42  void removeNode(int);
43  void removeNode(const BinID&);
44  bool isEmpty() const { return nodes_.isEmpty(); }
45  void limitTo(const TrcKeyZSampling&); // nrNodes should be 2
46 
47  int nodeIndex(const BinID&) const;
48  int nrNodes() const;
49  const BinID& nodePosition(int) const;
51  static void getPathBids(const TypeSet<BinID>& knots,
53  TypeSet<BinID>& path,
54  bool allowduplicate=false,
55  TypeSet<int>* segments=0);
57  static void getPathBids(const TypeSet<BinID>& knots,
58  TypeSet<BinID>& path,
59  bool allowduplicate=false,
60  TypeSet<int>* segments=0);
62 
63  void setZRange( const Interval<float>& rg )
64  { zrange_ = rg; zrangeChanged.trigger(); }
65  Interval<float> zRange() const { return zrange_; }
66 
67  void setMultiID(const MultiID&);
68  MultiID getMultiID() const { return mid_; }
69 
70  void setLocked( bool yn ) { locked_ = yn; }
71  bool isLocked() const { return locked_; }
72 
73  struct ChangeData : public CallBacker
74  {
75  enum Event { Undef, Added, Inserted, Moving, Moved, Removed };
76 
77  ChangeData( Event ev=Undef, int nodeidx=-1 )
78  : ev_(ev)
79  , nodeidx_(nodeidx)
80  {}
81 
83  int nodeidx_;
84  };
85 
89 
90  RandomLineSet* lineSet() { return lset_; }
91  const RandomLineSet* lineSet() const { return lset_; }
92 
93 protected:
94 
99  bool locked_;
100 
101  friend class RandomLineSet;
102 
103 private:
104  int id_;
105 
106 public:
108  static Coord getNormal(const TrcKeyPath& knots,const TrcKey& pos);
109  static int getNearestPathPosIdx(const TrcKeyPath&,
110  const TrcKeyPath&,const TrcKey&);
111 
112  enum DuplicateMode { NoDups=0, NoConsecutiveDups, AllDups };
113  static void getPathBids(const TypeSet<BinID>& knots,
114  Pos::SurvID,
115  TypeSet<BinID>& path,
116  DuplicateMode dupmode=NoConsecutiveDups,
117  TypeSet<int>* segments=0);
118 };
119 
120 
122 {
123 public:
124 
126  RandomLineSet(const RandomLine&,double dist,
127  bool parallel);
129 
130  virtual ~RandomLineSet();
131  bool isEmpty() const { return lines_.isEmpty(); }
132  void setEmpty();
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);
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,double dist);
152 
153 public:
154  static void getGeometry(const MultiID&,TypeSet<BinID>& knots,
155  StepInterval<float>* zrg=0);
156 };
157 
158 
160 {
161 public:
163 
165  RandomLine* get(int id);
166  const RandomLine* get(int id) const;
167  bool isLoaded(const MultiID&) const;
168  bool isLoaded(int id) const;
169 
172 
175 
176 
177 protected:
180 
181  int indexOf(const MultiID&) const;
182 
184 };
185 
187 
188 
189 } // namespace Geometry
190 
Geometry::RandomLineManager::add
int add(RandomLine *)
Geometry::RandomLine::lset_
RandomLineSet * lset_
Definition: randomlinegeom.h:98
Geometry::RandomLine::nodePosition
const BinID & nodePosition(int) const
Geometry::RandomLineManager::indexOf
int indexOf(const MultiID &) const
Geometry::RandomLine::removeNode
void removeNode(int)
NamedCallBacker
CallBacker object with a name. Use if you want your object to be able to send and receive CallBack's,...
Definition: namedobj.h:72
Geometry::RandomLineManager::added
CNotifier< RandomLineManager, int > added
Definition: randomlinegeom.h:173
Geometry::RandomLineSet::pars
const IOPar & pars() const
Definition: randomlinegeom.h:143
Geometry::RandomLineSet
Definition: randomlinegeom.h:122
Geometry::RandomLineSet::insertLine
void insertLine(RandomLine &, int idx)
Geometry::RandomLine::setName
void setName(const char *)
sKey::RandomLine
FixedString RandomLine()
Definition: keystrs.h:127
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
ObjectSet
Set of pointers to objects.
Definition: commontypes.h:31
Geometry::RandomLineSet::RandomLineSet
RandomLineSet()
Geometry::RandomLine::id_
int id_
Definition: randomlinegeom.h:104
Geometry
Definition: arraytesselator.h:21
Geometry::RandomLine::getPathBids
static void getPathBids(const TypeSet< BinID > &knots, TypeSet< BinID > &path, bool allowduplicate=false, TypeSet< int > *segments=0)
Deprecated in coming versions of OD.
Geometry::RandomLine::allNodePositions
void allNodePositions(TrcKeyPath &) const
Geometry::RandomLine::ID
mRefCountImpl(RandomLine) public int ID() const
Definition: randomlinegeom.h:35
Geometry::RandomLine::removeNode
void removeNode(const BinID &)
Geometry::RandomLine::getPathBids
static void getPathBids(const TypeSet< BinID > &knots, Pos::SurvID, TypeSet< BinID > &path, DuplicateMode dupmode=NoConsecutiveDups, TypeSet< int > *segments=0)
Geometry::RandomLineSet::RandomLineSet
RandomLineSet(const RandomLine &, double dist, bool parallel)
dist in XY units
Geometry::RandomLine::ChangeData::ev_
Event ev_
Definition: randomlinegeom.h:82
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
namedobj.h
Pos::SurvID
Index_Type SurvID
Definition: commontypes.h:84
Geometry::RandomLine::setLocked
void setLocked(bool yn)
Definition: randomlinegeom.h:70
binid.h
Geometry::RandomLine::setZRange
void setZRange(const Interval< float > &rg)
Definition: randomlinegeom.h:63
Line2
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
Geometry::RandomLine::ChangeData::Undef
@ Undef
Definition: randomlinegeom.h:75
Geometry::RandomLine::allNodePositions
void allNodePositions(TypeSet< BinID > &) const
Geometry::RandomLine::zRange
Interval< float > zRange() const
Definition: randomlinegeom.h:65
Geometry::RandomLine::nodes_
TypeSet< BinID > nodes_
Definition: randomlinegeom.h:95
CallBacker
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
Geometry::RandomLineSet::pars_
IOPar & pars_
Definition: randomlinegeom.h:149
Geometry::RandomLine::getPathBids
static void getPathBids(const TypeSet< BinID > &knots, Pos::SurvID, TypeSet< BinID > &path, bool allowduplicate=false, TypeSet< int > *segments=0)
Deprecated in coming versions of OD.
Geometry::RandomLine::setNodePositions
void setNodePositions(const TypeSet< BinID > &)
Geometry::RandomLine::setNodePosition
void setNodePosition(int idx, const BinID &, bool moving=false)
Geometry::RandomLine::getNearestPathPosIdx
static int getNearestPathPosIdx(const TrcKeyPath &, const TrcKeyPath &, const TrcKey &)
Geometry::RandomLine::ChangeData::Event
Event
Definition: randomlinegeom.h:75
Geometry::RandomLineManager
Definition: randomlinegeom.h:160
Geometry::RandomLine::isLocked
bool isLocked() const
Definition: randomlinegeom.h:71
Geometry::RandomLineManager::RLM
friend RandomLineManager & RLM()
TrcKeyZSampling
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
Geometry::RandomLineManager::get
RandomLine * get(int id)
sKey::Undef
FixedString Undef()
Definition: keystrs.h:176
Geometry::RandomLine::isEmpty
bool isEmpty() const
Definition: randomlinegeom.h:44
Geometry::RandomLine
Definition: randomlinegeom.h:31
Geometry::RandomLineSet::getRandomLine
RandomLine * getRandomLine(int)
multiid.h
BinID
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:31
StepInterval< float >
Coord
A cartesian coordinate in 2D space.
Definition: coord.h:25
Geometry::RandomLine::getMultiID
MultiID getMultiID() const
Definition: randomlinegeom.h:68
Geometry::RandomLine::ChangeData::nodeidx_
int nodeidx_
Definition: randomlinegeom.h:83
Geometry::RandomLineManager::isLoaded
bool isLoaded(const MultiID &) const
Geometry::RandomLine::nodeIndex
int nodeIndex(const BinID &) const
Geometry::RandomLine::nameChanged
Notifier< RandomLine > nameChanged
Definition: randomlinegeom.h:86
Geometry::RandomLineSet::~RandomLineSet
virtual ~RandomLineSet()
Geometry::RandomLine::zrangeChanged
Notifier< RandomLine > zrangeChanged
Definition: randomlinegeom.h:88
Notifier
Class to help setup a callback handling.
Definition: notify.h:126
Geometry::RandomLine::nodeChanged
CNotifier< RandomLine, const ChangeData & > nodeChanged
Definition: randomlinegeom.h:87
Geometry::RandomLineSet::getGeometry
static void getGeometry(const MultiID &, TypeSet< BinID > &knots, StepInterval< float > *zrg=0)
Geometry::RandomLineManager::isLoaded
bool isLoaded(int id) const
Geometry::RandomLine::locked_
bool locked_
Definition: randomlinegeom.h:99
Geometry::RandomLine::insertNode
void insertNode(int, const BinID &)
Geometry::RandomLineManager::removed
CNotifier< RandomLineManager, int > removed
Definition: randomlinegeom.h:174
Geometry::RandomLine::lineSet
const RandomLineSet * lineSet() const
Definition: randomlinegeom.h:91
Geometry::RandomLine::ChangeData::ChangeData
ChangeData(Event ev=Undef, int nodeidx=-1)
Definition: randomlinegeom.h:77
Geometry::RandomLineSet::createParallelLines
void createParallelLines(const Line2 &baseline, double dist)
Geometry::RandomLine::limitTo
void limitTo(const TrcKeyZSampling &)
MultiID
Compound key consisting of ints.
Definition: multiid.h:24
Geometry::RandomLine::lineSet
RandomLineSet * lineSet()
Definition: randomlinegeom.h:90
Geometry::RandomLineSet::setEmpty
void setEmpty()
TrcKey
Represents a unique trace position in one of the surveys that OpendTect is managing.
Definition: trckey.h:28
Geometry::RandomLineManager::get
const RandomLine * get(int id) const
Geometry::RandomLineSet::addLine
void addLine(RandomLine &)
refcount.h
Geometry::RandomLineManager::RandomLineManager
RandomLineManager()
Geometry::RandomLineSet::lines
const ObjectSet< RandomLine > & lines() const
Definition: randomlinegeom.h:137
Geometry::RandomLine::DuplicateMode
DuplicateMode
Definition: randomlinegeom.h:112
Geometry::RandomLine::setMultiID
void setMultiID(const MultiID &)
Geometry::RandomLineSet::lines_
ObjectSet< RandomLine > lines_
Definition: randomlinegeom.h:148
trckeysampling.h
Geometry::RandomLineSet::getRandomLine
const RandomLine * getRandomLine(int) const
Geometry::RandomLineSet::isEmpty
bool isEmpty() const
Definition: randomlinegeom.h:131
Geometry::RandomLineSet::pars
IOPar & pars()
Definition: randomlinegeom.h:144
Geometry::RandomLine::addNode
int addNode(const BinID &)
Geometry::RandomLineManager::~RandomLineManager
~RandomLineManager()
Geometry::RandomLineManager::get
RandomLine * get(const MultiID &)
Geometry::RandomLine::ChangeData
Definition: randomlinegeom.h:74
Geometry::RandomLine::nrNodes
int nrNodes() const
ranges.h
Interval< float >
Geometry::RandomLine::zrange_
Interval< float > zrange_
Definition: randomlinegeom.h:96
Geometry::RandomLineManager::lines_
ObjectSet< RandomLine > lines_
Definition: randomlinegeom.h:183
Geometry::RandomLineSet::removeLine
void removeLine(int idx)
Geometry::RLM
RandomLineManager & RLM()
Geometry::RandomLine::mid_
MultiID mid_
Definition: randomlinegeom.h:97
Geometry::RandomLineSet::size
int size() const
Definition: randomlinegeom.h:136
Geometry::RandomLineSet::limitTo
void limitTo(const TrcKeyZSampling &)
CNotifier
Notifier with automatic capsule creation.
Definition: notify.h:171
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
Geometry::RandomLine::getNormal
static Coord getNormal(const TrcKeyPath &knots, const TrcKey &pos)
TypeSet< BinID >
Geometry::RandomLineManager::remove
void remove(RandomLine *)

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