OpendTect  6.6
coltabsequence.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: A.H. Bril
8  Date: 23-3-2000
9  RCS: $Id$
10 ________________________________________________________________________
11 
12 -*/
13 
14 
15 #include "generalmod.h"
16 #include "color.h"
17 #include "enums.h"
18 #include "namedobj.h"
19 #include "geometry.h"
20 
21 class BufferStringSet;
22 
23 
24 namespace ColTab
25 {
26 
37 {
38 public:
39 
41  Sequence(const char*);
42  Sequence(const Sequence&);
44 
45  enum Type { System, User, Edited };
46 
48  bool operator==(const Sequence&) const;
49  bool operator!=(const Sequence&) const;
50 
51  bool isSys() const
52  { return type_==System; }
53  Type type() const { return type_; }
54  void setType( Type tp ) { type_ = tp; }
55 
56  Color color(float pos) const;
57 
58  inline bool isEmpty() const { return x_.isEmpty(); }
59  inline int size() const { return x_.size(); }
60  inline float position( int idx ) const { return x_[idx]; }
61  inline unsigned char r( int idx ) const { return r_[idx]; }
62  inline unsigned char g( int idx ) const { return g_[idx]; }
63  inline unsigned char b( int idx ) const { return b_[idx]; }
64 
65  int transparencySize() const { return tr_.size(); }
66  Geom::Point2D<float> transparency( int idx ) const { return tr_[idx]; }
67  float transparencyAt(float) const;
73  bool hasTransparency() const;
74 
75  int nrSegments() const { return nrsegments_; }
76  void setNrSegments(int n) { nrsegments_ = n; }
82  bool isSegmentized() const { return nrsegments_; }
83 
84  void changeColor(int,
85  unsigned char,unsigned char,unsigned char);
86  void changePos(int,float);
87  int setColor(float pos,
88  unsigned char,unsigned char,unsigned char);
89  void removeColor(int);
91  void flipColor();
93 
94  void fillPar(IOPar&) const;
95  bool usePar(const IOPar&);
96 
100 
101  const Color& undefColor() const
102  { return undefcolor_; }
104  { undefcolor_ = c; triggerAll(); }
105  const Color& markColor() const
106  { return markcolor_; }
107  void setMarkColor( Color c )
108  { markcolor_ = c; triggerAll(); }
109 
110  static const char* sKeyValCol();
111  static const char* sKeyMarkColor();
112  static const char* sKeyUdfColor();
113  static const char* sKeyTransparency();
114  static const char* sKeyCtbl();
115  static const char* sKeyNrSegments();
116  static const char* sKeyRainbow();
117 
118 protected:
119 
125 
130 
131  inline void triggerAll() { colorChanged.trigger();
132  transparencyChanged.trigger(); }
133  float snapToSegmentCenter(float) const;
134 };
135 
136 
143 mExpClass(General) SeqMgr : public CallBacker
144 {
145 public:
146 
147  void refresh();
148 
149  int size() const { return seqs_.size(); }
150  int indexOf(const char*) const;
151  const Sequence* get( int idx ) const { return seqs_[idx]; }
152  bool get(const char*,Sequence&);
154  const Sequence* getAny(const char* key) const;
156 
157  void set(const Sequence&);
158  void remove(int);
159 
160  bool write(bool sys=false,bool applsetup=true);
161 
164 
165  ~SeqMgr() { deepErase(seqs_); }
166 
167 protected:
168 
170 
171 
173 
174  friend mGlobal(General) SeqMgr& SM();
175 
176  void addFromPar(const IOPar&,bool);
177  void add( Sequence* seq )
178  { seqs_ += seq; seqAdded.trigger(); }
179  void readColTabs();
180 };
181 
182 mGlobal(General) SeqMgr& SM();
183 
184 
185 } // namespace ColTab
186 
187 
ColTab::Sequence::sKeyTransparency
static const char * sKeyTransparency()
ColTab::Sequence::operator=
Sequence & operator=(const Sequence &)
ColTab::Sequence::Sequence
Sequence()
ColTab::SeqMgr
Manages Sequences; reads/writes system or user-defined.
Definition: coltabsequence.h:144
ColTab::Sequence::fillPar
void fillPar(IOPar &) const
ColTab::Sequence::operator==
bool operator==(const Sequence &) const
ColTab::Sequence::sKeyUdfColor
static const char * sKeyUdfColor()
ColTab::SeqMgr::SM
friend SeqMgr & SM()
ColTab::Sequence::size
int size() const
Definition: coltabsequence.h:59
Notifier::trigger
void trigger()
Definition: notify.h:132
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
ColTab::Sequence::removeColor
void removeColor(int)
ColTab::SeqMgr::get
bool get(const char *, Sequence &)
ColTab::SeqMgr::get
const Sequence * get(int idx) const
Definition: coltabsequence.h:151
geometry.h
ColTab::Sequence::sKeyCtbl
static const char * sKeyCtbl()
mGlobal
#define mGlobal(module)
Definition: commondefs.h:180
ObjectSet
Set of pointers to objects.
Definition: commontypes.h:31
ColTab
Color Table
Definition: coltab.h:22
BufferStringSet
Set of BufferString objects.
Definition: bufstringset.h:26
ColTab::Sequence::undefcolor_
Color undefcolor_
Definition: coltabsequence.h:126
ColTab::SeqMgr::indexOf
int indexOf(const char *) const
ColTab::Sequence::removeTransparencies
void removeTransparencies()
ColTab::Sequence::changeColor
void changeColor(int, unsigned char, unsigned char, unsigned char)
ColTab::Sequence::toBeRemoved
Notifier< Sequence > toBeRemoved
Definition: coltabsequence.h:99
mExpClass
#define mExpClass(module)
Definition: commondefs.h:177
namedobj.h
ColTab::SeqMgr::set
void set(const Sequence &)
if name not yet present, adds
ColTab::Sequence::isSys
bool isSys() const
Definition: coltabsequence.h:51
ColTab::Sequence::~Sequence
~Sequence()
CallBacker
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:185
ColTab::Sequence::g_
TypeSet< unsigned char > g_
Definition: coltabsequence.h:122
ColTab::SeqMgr::~SeqMgr
~SeqMgr()
Definition: coltabsequence.h:165
ColTab::SeqMgr::remove
void remove(int)
ColTab::SeqMgr::add
void add(Sequence *seq)
Definition: coltabsequence.h:177
ColTab::Sequence::setType
void setType(Type tp)
Definition: coltabsequence.h:54
ColTab::Sequence::hasTransparency
bool hasTransparency() const
ColTab::Sequence::setTransparency
void setTransparency(Geom::Point2D< float >)
ColTab::Sequence::transparency
Geom::Point2D< float > transparency(int idx) const
Definition: coltabsequence.h:66
ColTab::Sequence::nrSegments
int nrSegments() const
Definition: coltabsequence.h:75
ColTab::Sequence::sKeyNrSegments
static const char * sKeyNrSegments()
ColTab::Sequence::markcolor_
Color markcolor_
Definition: coltabsequence.h:127
ColTab::Sequence::tr_
TypeSet< Geom::Point2D< float > > tr_
Definition: coltabsequence.h:124
ColTab::Sequence::r
unsigned char r(int idx) const
Definition: coltabsequence.h:61
ColTab::Sequence::Sequence
Sequence(const Sequence &)
ColTab::Sequence
Maps from [0,1] -> Color.
Definition: coltabsequence.h:37
OD::System
@ System
Definition: pythonaccess.h:35
ColTab::SeqMgr::addFromPar
void addFromPar(const IOPar &, bool)
ColTab::Sequence::color
Color color(float pos) const
0 <= pos <= 1
ColTab::Sequence::nrsegments_
int nrsegments_
Definition: coltabsequence.h:129
ColTab::Sequence::Type
Type
Definition: coltabsequence.h:45
ColTab::SM
SeqMgr & SM()
ColTab::SeqMgr::getAny
const Sequence * getAny(const char *key) const
returns with key, or a nice one anyway
ColTab::SeqMgr::SeqMgr
SeqMgr()
ColTab::Sequence::changeTransparency
void changeTransparency(int, Geom::Point2D< float >)
Notifier
Class to help setup a callback handling.
Definition: notify.h:126
ColTab::Sequence::b_
TypeSet< unsigned char > b_
Definition: coltabsequence.h:123
ColTab::SeqMgr::seqs_
ObjectSet< Sequence > seqs_
Definition: coltabsequence.h:172
ColTab::SeqMgr::seqRemoved
Notifier< SeqMgr > seqRemoved
Definition: coltabsequence.h:163
ColTab::Sequence::usePar
bool usePar(const IOPar &)
ColTab::Sequence::removeTransparencyAt
void removeTransparencyAt(int)
ColTab::SeqMgr::seqAdded
Notifier< SeqMgr > seqAdded
Definition: coltabsequence.h:162
ColTab::Sequence::flipTransparency
void flipTransparency()
ColTab::Sequence::removeAllColors
void removeAllColors()
ColTab::SeqMgr::getSequenceNames
void getSequenceNames(BufferStringSet &)
ColTab::Sequence::undefColor
const Color & undefColor() const
Definition: coltabsequence.h:101
ColTab::Sequence::type
Type type() const
Definition: coltabsequence.h:53
ColTab::Sequence::snapToSegmentCenter
float snapToSegmentCenter(float) const
ColTab::SeqMgr::readColTabs
void readColTabs()
ColTab::SeqMgr::refresh
void refresh()
deepErase
void deepErase(BufferStringSet &)
Geom::Point2D< float >
ColTab::Sequence::r_
TypeSet< unsigned char > r_
Definition: coltabsequence.h:121
ColTab::Sequence::operator!=
bool operator!=(const Sequence &) const
ColTab::Sequence::sKeyRainbow
static const char * sKeyRainbow()
ColTab::Sequence::transparencySize
int transparencySize() const
Definition: coltabsequence.h:65
ColTab::Sequence::Sequence
Sequence(const char *)
Find by name in SeqMgr.
enums.h
ColTab::Sequence::g
unsigned char g(int idx) const
Definition: coltabsequence.h:62
ColTab::Sequence::setMarkColor
void setMarkColor(Color c)
Definition: coltabsequence.h:107
ColTab::Sequence::flipColor
void flipColor()
ColTab::Sequence::User
@ User
Definition: coltabsequence.h:45
ColTab::Sequence::sKeyMarkColor
static const char * sKeyMarkColor()
ColTab::Sequence::isSegmentized
bool isSegmentized() const
Definition: coltabsequence.h:82
ColTab::Sequence::changePos
void changePos(int, float)
color.h
ColTab::Sequence::setColor
int setColor(float pos, unsigned char, unsigned char, unsigned char)
ColTab::Sequence::isEmpty
bool isEmpty() const
Definition: coltabsequence.h:58
ColTab::Sequence::position
float position(int idx) const
Definition: coltabsequence.h:60
ColTab::SeqMgr::size
int size() const
Definition: coltabsequence.h:149
Color
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer,...
Definition: color.h:26
ColTab::Sequence::transparencyAt
float transparencyAt(float) const
ColTab::Sequence::markColor
const Color & markColor() const
Definition: coltabsequence.h:105
ColTab::Sequence::type_
Type type_
Definition: coltabsequence.h:128
ColTab::Sequence::setUndefColor
void setUndefColor(Color c)
Definition: coltabsequence.h:103
ColTab::Sequence::setNrSegments
void setNrSegments(int n)
Definition: coltabsequence.h:76
IOPar
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:55
ColTab::SeqMgr::write
bool write(bool sys=false, bool applsetup=true)
ColTab::Sequence::sKeyValCol
static const char * sKeyValCol()
ColTab::Sequence::triggerAll
void triggerAll()
Definition: coltabsequence.h:131
ColTab::Sequence::transparencyChanged
Notifier< Sequence > transparencyChanged
Definition: coltabsequence.h:98
ColTab::Sequence::colorChanged
Notifier< Sequence > colorChanged
Definition: coltabsequence.h:97
ColTab::Sequence::x_
TypeSet< float > x_
Definition: coltabsequence.h:120
ColTab::Sequence::b
unsigned char b(int idx) const
Definition: coltabsequence.h:63
TypeSet< float >

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