OpendTect  6.3
coltab.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: Bert
8  Date: Sep 2007
9 ________________________________________________________________________
10 
11 -*/
12 
13 
14 #include "generalmod.h"
15 #include "color.h"
16 #include "typeset.h"
17 #include "samplingdata.h"
18 
19 
20 namespace ColTab
21 {
22 
23 typedef float ValueType;
24 typedef float PosType;
26 typedef std::pair<float,float> ClipRatePair;
28 {
30 };
31 inline PosType getLimitedRelPos( PosType relpos )
32 {
33  return getLimited( relpos, 0.f, 1.f );
34 }
35 
36 mGlobal(General) bool isFlipped(SeqUseMode);
37 mGlobal(General) bool isCyclic(SeqUseMode);
38 mGlobal(General) SeqUseMode getSeqUseMode(bool flipped,bool cyclic);
40 mGlobal(General) void toPar(SeqUseMode,IOPar&);
41 mGlobal(General) bool fromPar(const IOPar&,SeqUseMode&);
42 mGlobal(General) void convToPerc(ClipRatePair&);
43 mGlobal(General) void convFromPerc(ClipRatePair&);
44 mGlobal(General) inline const char* sKeySeqUseMode()
45  { return "Color Table Use Mode"; }
46 
47 mGlobal(General) const char* defSeqName();
48 mGlobal(General) ClipRatePair defClipRate();
49 mGlobal(General) ValueType defSymMidval();
50 mGlobal(General) bool defAutoSymmetry();
51 mGlobal(General) bool defHistEq();
52 mGlobal(General) void setMapperDefaults(ClipRatePair,
53  ValueType simmid,bool autosym,
54  bool histeq);
55 
56 
57 class Mapper;
58 class Sequence;
59 class TableFiller;
60 class IndexTableFiller;
61 
76 mExpClass(General) Table
77 {
78 public:
79 
81 
82  Table(const Sequence&,int sz,SeqUseMode);
83  Table(const Sequence&,int sz,const Mapper&);
84  Table(const SetType&,SamplingType);
85 
86  int size() const { return cols_.size(); }
87  Color color( int idx ) const { return cols_[idx]; }
88  SamplingType sampling() const { return sampling_; }
89 
90  int indexFor(ValueType) const;
91  Color colorAt(ValueType) const;
92 
93  inline Color snappedColorAt( ValueType val ) const
94  { return cols_[ indexFor(val) ]; }
95 
96 protected:
97 
98  SetType cols_;
99  SamplingType sampling_;
100 
101  friend class TableFiller;
102  void setColor(const Sequence&,const Mapper&,int);
103 
104 private:
105 
106  void createTable(const Sequence& seq,const Mapper&,int);
107 
108 };
109 
110 
124 {
125 public:
126 
128 
129  IndexTable(int sz,SeqUseMode);
130  IndexTable(int sz,const Mapper&);
131  IndexTable(const SetType&,SamplingType);
132 
133  int size() const { return idxs_.size(); }
134  int colIndex( int idx ) const { return idxs_[idx]; }
135  SamplingType sampling() const { return sampling_; }
136 
137  int indexFor(ValueType) const;
138 
139 protected:
140 
141  SetType idxs_;
142  SamplingType sampling_;
143 
144  void setIndex(const Mapper&,int);
145  friend class IndexTableFiller;
146 
147 private:
148 
149  void createTable(const Mapper&,int);
150 
151 };
152 
153 
154 } // namespace ColTab
#define mExpClass(module)
Definition: commondefs.h:157
SamplingType sampling() const
Definition: coltab.h:88
bool defAutoSymmetry()
int size() const
Definition: coltab.h:133
bool fromPar(const IOPar &, SeqUseMode &)
Definition: file.h:109
const char * defSeqName()
void toPar(SeqUseMode, IOPar &)
A series of color control points able to give an (interpolated) color for every position [0...
Definition: coltabsequence.h:37
#define mGlobal(module)
Definition: commondefs.h:160
bool isCyclic(SeqUseMode)
Definition: coltab.h:29
void convFromPerc(ClipRatePair &)
ClipRatePair defClipRate()
int colIndex(int idx) const
Definition: coltab.h:134
Maps data values to color sequence positions: [0,1].
Definition: coltabmapper.h:33
SamplingType sampling() const
Definition: coltab.h:135
void convToPerc(ClipRatePair &)
SetType cols_
Definition: coltab.h:98
Definition: coltab.h:29
void setMapperDefaults(ClipRatePair, ValueType simmid, bool autosym, bool histeq)
int size() const
Definition: coltab.h:86
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
Definition: geom2dascio.h:18
PosType getLimitedRelPos(PosType relpos)
Definition: coltab.h:31
Color color(int idx) const
Definition: coltab.h:87
float ValueType
Definition: coltab.h:23
Color snappedColorAt(ValueType val) const
Definition: coltab.h:93
SamplingType sampling_
Definition: coltab.h:99
SamplingType sampling_
Definition: coltab.h:142
SeqUseMode
Definition: coltab.h:27
Definition: coltab.h:29
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
std::pair< float, float > ClipRatePair
Definition: coltab.h:26
T getLimited(T v, T min, T max)
Definition: commondefs.h:43
ValueType defSymMidval()
Table of color indexes at regular value positions. the indexes point direcly into the colors from a C...
Definition: coltab.h:123
BufferString toString(SeqUseMode)
SamplingData< ValueType > SamplingType
Definition: coltab.h:25
bool defHistEq()
Definition: coltab.h:20
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:24
TypeSet< int > SetType
Definition: coltab.h:127
const char * sKeySeqUseMode()
Definition: coltab.h:44
TypeSet< Color > SetType
Definition: coltab.h:80
SeqUseMode getSeqUseMode(bool flipped, bool cyclic)
float PosType
Definition: coltab.h:24
Definition: coltab.h:29
SetType idxs_
Definition: coltab.h:141
bool isFlipped(SeqUseMode)

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