OpendTect-6_4  6.4
coltabsequence.h
Go to the documentation of this file.
1 #ifndef coltabsequence_h
2 #define coltabsequence_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: A.H. Bril
9  Date: 23-3-2000
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 
16 #include "generalmod.h"
17 #include "color.h"
18 #include "enums.h"
19 #include "namedobj.h"
20 #include "geometry.h"
21 
22 class BufferStringSet;
23 
24 
25 namespace ColTab
26 {
27 
37 mExpClass(General) Sequence : public NamedObject
38 {
39 public:
40 
41  Sequence();
42  Sequence(const char*);
43  Sequence(const Sequence&);
44  ~Sequence();
45 
46  enum Type { System, User, Edited };
47 
48  Sequence& operator=(const Sequence&);
49  bool operator==(const Sequence&) const;
50  bool operator!=(const Sequence&) const;
51 
52  bool isSys() const
53  { return type_==System; }
54  Type type() const { return type_; }
55  void setType( Type tp ) { type_ = tp; }
56 
57  Color color(float pos) const;
58 
59  inline bool isEmpty() const { return x_.isEmpty(); }
60  inline int size() const { return x_.size(); }
61  inline float position( int idx ) const { return x_[idx]; }
62  inline unsigned char r( int idx ) const { return r_[idx]; }
63  inline unsigned char g( int idx ) const { return g_[idx]; }
64  inline unsigned char b( int idx ) const { return b_[idx]; }
65 
66  int transparencySize() const { return tr_.size(); }
67  Geom::Point2D<float> transparency( int idx ) const { return tr_[idx]; }
68  float transparencyAt(float) const;
69  void setTransparency(Geom::Point2D<float>);
71  void changeTransparency(int,Geom::Point2D<float>);
72  void removeTransparencies();
73  void removeTransparencyAt(int);
74  bool hasTransparency() const;
75 
76  int nrSegments() const { return nrsegments_; }
77  void setNrSegments(int n) { nrsegments_ = n; }
83  bool isSegmentized() const { return nrsegments_; }
84 
85  void changeColor(int,
86  unsigned char,unsigned char,unsigned char);
87  void changePos(int,float);
88  int setColor(float pos,
89  unsigned char,unsigned char,unsigned char);
90  void removeColor(int);
91  void removeAllColors();
92  void flipColor();
93  void flipTransparency();
94 
95  void fillPar(IOPar&) const;
96  bool usePar(const IOPar&);
97 
101 
102  const Color& undefColor() const
103  { return undefcolor_; }
105  { undefcolor_ = c; triggerAll(); }
106  const Color& markColor() const
107  { return markcolor_; }
108  void setMarkColor( Color c )
109  { markcolor_ = c; triggerAll(); }
110 
111  static const char* sKeyValCol();
112  static const char* sKeyMarkColor();
113  static const char* sKeyUdfColor();
114  static const char* sKeyTransparency();
115  static const char* sKeyCtbl();
116  static const char* sKeyNrSegments();
117  static const char* sKeyRainbow();
118 
119 protected:
120 
126 
131 
132  inline void triggerAll() { colorChanged.trigger();
133  transparencyChanged.trigger(); }
134  float snapToSegmentCenter(float) const;
135 };
136 
137 
144 mExpClass(General) SeqMgr : public CallBacker
145 {
146 public:
147 
148  void refresh();
149 
150  int size() const { return seqs_.size(); }
151  int indexOf(const char*) const;
152  const Sequence* get( int idx ) const { return seqs_[idx]; }
153  bool get(const char*,Sequence&);
154  void getSequenceNames(BufferStringSet&);
155  const Sequence* getAny(const char* key) const;
157 
158  void set(const Sequence&);
159  void remove(int);
160 
161  bool write(bool sys=false,bool applsetup=true);
162 
165 
166  ~SeqMgr() { deepErase(seqs_); }
167 
168 protected:
169 
170  SeqMgr();
171 
172 
174 
175  friend mGlobal(General) SeqMgr& SM();
176 
177  void addFromPar(const IOPar&,bool);
178  void add( Sequence* seq )
179  { seqs_ += seq; seqAdded.trigger(); }
180  void readColTabs();
181 };
182 
183 mGlobal(General) SeqMgr& SM();
184 
185 
186 } // namespace ColTab
187 
188 
189 #endif
#define mExpClass(module)
Definition: commondefs.h:160
const Color & markColor() const
Definition: coltabsequence.h:106
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
Manages Sequences; reads/writes system or user-defined.
Definition: coltabsequence.h:144
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
TypeSet< Geom::Point2D< float > > tr_
Definition: coltabsequence.h:125
Maps from [0,1] -> Color.
Definition: coltabsequence.h:37
#define mGlobal(module)
Definition: commondefs.h:163
TypeSet< unsigned char > r_
Definition: coltabsequence.h:122
bool isSys() const
Definition: coltabsequence.h:52
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:188
unsigned char b(int idx) const
Definition: coltabsequence.h:64
Notifier< Sequence > toBeRemoved
Definition: coltabsequence.h:100
float position(int idx) const
Definition: coltabsequence.h:61
TypeSet< float > x_
Definition: coltabsequence.h:121
int nrsegments_
Definition: coltabsequence.h:130
void triggerAll()
Definition: coltabsequence.h:132
Definition: coltabsequence.h:46
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
Type type_
Definition: coltabsequence.h:129
Notifier< Sequence > transparencyChanged
Definition: coltabsequence.h:99
Notifier< Sequence > colorChanged
Definition: coltabsequence.h:98
Geom::Point2D< float > transparency(int idx) const
Definition: coltabsequence.h:67
Definition: pythonaccess.h:37
int size() const
Definition: coltabsequence.h:60
Notifier< SeqMgr > seqRemoved
Definition: coltabsequence.h:164
Definition: callback.h:254
void setMarkColor(Color c)
Definition: coltabsequence.h:108
Set of pointers to objects.
Definition: commontypes.h:32
TypeSet< unsigned char > b_
Definition: coltabsequence.h:124
int size() const
Definition: coltabsequence.h:150
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
unsigned char r(int idx) const
Definition: coltabsequence.h:62
TypeSet< unsigned char > g_
Definition: coltabsequence.h:123
void setNrSegments(int n)
Definition: coltabsequence.h:77
ObjectSet< Sequence > seqs_
Definition: coltabsequence.h:173
void trigger(T &t)
Definition: callback.h:258
Type type() const
Definition: coltabsequence.h:54
bool operator!=(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:62
SeqMgr & SM()
Notifier< SeqMgr > seqAdded
Definition: coltabsequence.h:163
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:175
unsigned char g(int idx) const
Definition: coltabsequence.h:63
void setUndefColor(Color c)
Definition: coltabsequence.h:104
bool isEmpty() const
Definition: coltabsequence.h:59
Object with a name.
Definition: namedobj.h:35
int transparencySize() const
Definition: coltabsequence.h:66
int nrSegments() const
Definition: coltabsequence.h:76
Type
Definition: coltabsequence.h:46
Color Table
Definition: coltab.h:22
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
bool isSegmentized() const
Definition: coltabsequence.h:83
void setType(Type tp)
Definition: coltabsequence.h:55
Color undefcolor_
Definition: coltabsequence.h:127
const Color & undefColor() const
Definition: coltabsequence.h:102
Color markcolor_
Definition: coltabsequence.h:128
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:118
~SeqMgr()
Definition: coltabsequence.h:166

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