OpendTect-6_4  6.4
dpsdispmgr.h
Go to the documentation of this file.
1 #ifndef dpsdispmgr_h
2 #define dpsdispmgr_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Satyaki Maitra
9  Date: Nov 2009
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "generalmod.h"
16 #include "generalmod.h"
17 #include "callback.h"
18 #include "bufstringset.h"
19 #include "color.h"
20 #include "coltabsequence.h"
21 #include "coltabmapper.h"
22 
23 class DataPointSet;
24 
38 {
39 public:
41  const ColTab::Sequence& cs,
42  const ColTab::MapperSetup& cm,int id)
43  : coltab_(cs), coltabmappersu_(cm)
44  , showsel_(false), dpscolid_(id) {}
45 
47  const BufferStringSet& nms,
48  const TypeSet<Color>& cols)
49  : selgrpnms_(nms), selgrpcols_(cols)
50  , showsel_(true), dpscolid_(-1) {}
52 
53  virtual DataPointSetDisplayProp* clone() const
54  {
55  if ( showsel_ )
56  return new DataPointSetDisplayProp( selgrpnms_, selgrpcols_ );
57  else
58  return new DataPointSetDisplayProp(coltab_,coltabmappersu_,
59  dpscolid_);
60  }
61 
62  int dpsColID() const { return dpscolid_; }
63  bool showSelected() const { return showsel_; }
64  const BufferStringSet& selGrpNames() const { return selgrpnms_; }
65  const TypeSet<Color>& selGrpColors() const { return selgrpcols_; }
66  const ColTab::Sequence& colSequence() const { return coltab_; }
68  { return coltabmappersu_; }
69 
70 virtual Color getColor( float val ) const
71 {
72  if ( showsel_ )
73  {
74  return selgrpcols_.validIdx(mNINT32(val)) ? selgrpcols_[mNINT32(val)]
75  : Color::NoColor();
76  }
77 
78  if ( mIsUdf(val) )
79  return coltab_.undefColor();
80 
81  ColTab::Mapper mapper;
82  mapper.setup_ = coltabmappersu_;
83  const float pos = mapper.position( val );
84  Color col = coltab_.color( pos );
85  col.setTransparency( (unsigned char) mNINT32(coltab_.transparencyAt(pos)) );
86  return col;
87 }
88 
89 protected:
90 
95  int dpscolid_;
96  bool showsel_;
97 };
98 
99 
105 {
106 public:
107 
108  typedef int DispID;
110  virtual void lock() = 0;
111  virtual void unLock() = 0;
112 
113  virtual bool hasDisplays() const = 0;
114  virtual DispID getDisplayID(const DataPointSet&) const = 0;
115  virtual int getNrViewers() const = 0;
116  virtual const char* getViewerName(int) const = 0;
117 
118  virtual DispID addDisplay(const TypeSet<int>& parents,
119  const DataPointSet&) = 0;
120  virtual void updateDisplay(DispID id,
121  const TypeSet<int>& parents,
122  const DataPointSet&) = 0;
123  virtual void updateDisplay(DispID id,const DataPointSet&) =0;
124  virtual void removeDisplay(DispID) = 0;
126  { return availableviewers_; }
127 
128  virtual void getIconInfo(BufferString& fnm,
129  BufferString& tootltip) const = 0;
130 
132  { return dispprop_; }
134  { delete dispprop_; dispprop_ = prop; }
135 
137  { delete dispprop_; dispprop_ = 0; }
138 
139 protected:
140 
142  : dispprop_( 0 ) {}
145 };
146 
147 
148 #endif
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
virtual ~DataPointSetDisplayProp()
Definition: dpsdispmgr.h:51
Set of data points with group selection.
Definition: datapointset.h:48
Maps from [0,1] -> Color.
Definition: coltabsequence.h:37
void setTransparency(unsigned char t_)
ColTab::MapperSetup coltabmappersu_
Definition: dpsdispmgr.h:94
DataPointSetDisplayMgr()
Definition: dpsdispmgr.h:141
DataPointSetDisplayProp(const ColTab::Sequence &cs, const ColTab::MapperSetup &cm, int id)
Definition: dpsdispmgr.h:40
Set of BufferString objects.
Definition: bufstringset.h:28
Maps data values to colortable positions: [0,1].
Definition: coltabmapper.h:84
DataPointSet display manager.
Definition: dpsdispmgr.h:104
const TypeSet< Color > & selGrpColors() const
Definition: dpsdispmgr.h:65
virtual Color getColor(float val) const
Definition: dpsdispmgr.h:70
#define mNINT32(x)
Definition: commondefs.h:45
BufferStringSet selgrpnms_
Definition: dpsdispmgr.h:91
TypeSet< int > availableviewers_
Definition: dpsdispmgr.h:143
virtual ~DataPointSetDisplayMgr()
Definition: dpsdispmgr.h:109
void setDispProp(DataPointSetDisplayProp *prop)
Definition: dpsdispmgr.h:133
const BufferStringSet & selGrpNames() const
Definition: dpsdispmgr.h:64
Interface for DataPointSet Displays.
Definition: dpsdispmgr.h:37
DataPointSetDisplayProp * dispprop_
Definition: dpsdispmgr.h:144
const DataPointSetDisplayProp * dispProp() const
Definition: dpsdispmgr.h:131
Setup class for colortable Mapper.
Definition: coltabmapper.h:35
void clearDispProp()
Definition: dpsdispmgr.h:136
const ColTab::Sequence & colSequence() const
Definition: dpsdispmgr.h:66
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
int dpscolid_
Definition: dpsdispmgr.h:95
Pos pos(RowID) const
MapperSetup setup_
Definition: coltabmapper.h:109
DataPointSetDisplayProp(const BufferStringSet &nms, const TypeSet< Color > &cols)
Definition: dpsdispmgr.h:46
TypeSet< Color > selgrpcols_
Definition: dpsdispmgr.h:92
bool showSelected() const
Definition: dpsdispmgr.h:63
int dpsColID() const
Definition: dpsdispmgr.h:62
Color is an RGB color object, with a transparancy. The storage is in a 4-byte integer, similar to Qt.
Definition: color.h:26
int DispID
Definition: dpsdispmgr.h:108
#define mClass(module)
Definition: commondefs.h:164
bool showsel_
Definition: dpsdispmgr.h:96
virtual DataPointSetDisplayProp * clone() const
Definition: dpsdispmgr.h:53
const ColTab::MapperSetup & colMapperSetUp() const
Definition: dpsdispmgr.h:67
static Color NoColor()
Definition: color.h:75
const TypeSet< int > & availableViewers() const
Definition: dpsdispmgr.h:125
ColTab::Sequence coltab_
Definition: dpsdispmgr.h:93
float position(float val) const
returns position in ColorTable

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