OpendTect  6.3
dpsdispmgr.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: Satyaki Maitra
8  Date: Nov 2009
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "generalmod.h"
14 #include "generalmod.h"
15 #include "callback.h"
16 #include "bufstringset.h"
17 #include "color.h"
18 #include "coltabseqmgr.h"
19 #include "coltabmapper.h"
20 
21 class DataPointSet;
22 
36 {
37 public:
39  const ColTab::Sequence& cs,
40  const ColTab::MapperSetup& msu, int id)
41  : colseq_(&cs)
42  , ctmapper_(new ColTab::Mapper(msu))
43  , showsel_(false), dpscolid_(id) {}
44 
46  const BufferStringSet& nms,
47  const TypeSet<Color>& cols)
48  : selgrpnms_(nms), selgrpcols_(cols)
49  , showsel_(true), dpscolid_(-1)
50  , colseq_(ColTab::SeqMGR().getDefault())
51  , ctmapper_(new ColTab::Mapper)
52  {}
53 
54  DataPointSetDisplayProp* clone() const
55  {
56  if ( showsel_ )
57  return new DataPointSetDisplayProp( selgrpnms_, selgrpcols_ );
58  else
59  return new DataPointSetDisplayProp( *colseq_,
60  ctmapper_->setup(), dpscolid_ );
61  }
62 
63  int dpsColID() const { return dpscolid_; }
64  bool showSelected() const { return showsel_; }
65  const BufferStringSet& selGrpNames() const { return selgrpnms_; }
66  const TypeSet<Color>& selGrpColors() const { return selgrpcols_; }
67  const ColTab::Sequence& colSequence() const { return *colseq_; }
68  ColTab::Mapper& colTabMapper() { return *ctmapper_; }
69  const ColTab::Mapper& colTabMapper() const { return *ctmapper_; }
70 
71 Color getColor( float val ) const
72 {
73  if ( showsel_ )
74  {
75  return selgrpcols_.validIdx(mNINT32(val)) ? selgrpcols_[mNINT32(val)]
76  : Color::NoColor();
77  }
78 
79  if ( mIsUdf(val) )
80  return colseq_->undefColor();
81 
82  const float pos = ctmapper_->seqPosition( val );
83  return colseq_->color( pos );
84 }
85 
86 protected:
87 
92  int dpscolid_;
93  bool showsel_;
94 
95 };
96 
97 
103 {
104 public:
105 
106  typedef int DispID;
108  virtual void lock() = 0;
109  virtual void unLock() = 0;
110 
111  virtual bool hasDisplays() const = 0;
112  virtual DispID getDisplayID(const DataPointSet&) const = 0;
113  virtual int getNrViewers() const = 0;
114  virtual const char* getViewerName(int) const = 0;
115 
116  virtual DispID addDisplay(const TypeSet<int>& parents,
117  const DataPointSet&) = 0;
118  virtual void updateDisplay(DispID id,
119  const TypeSet<int>& parents,
120  const DataPointSet&) = 0;
121  virtual void updateDisplay(DispID id,const DataPointSet&) =0;
122  virtual void removeDisplay(DispID) = 0;
124  { return availableviewers_; }
125 
126  virtual void getIconInfo(BufferString& fnm,
127  BufferString& tootltip) const = 0;
128  virtual void getIconInfo(BufferString&,
129  uiString& tooltip) const = 0;
130 
132  { return dispprop_; }
134  { return dispprop_; }
136  { delete dispprop_; dispprop_ = prop; }
137 
139  { delete dispprop_; dispprop_ = 0; }
140 
141 protected:
142 
144  : dispprop_( 0 ) {}
145 
148 
149 };
ColTab::Mapper & colTabMapper()
Definition: dpsdispmgr.h:68
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
Set of data points with group selection.
Definition: datapointset.h:47
A series of color control points able to give an (interpolated) color for every position [0...
Definition: coltabsequence.h:37
DataPointSetDisplayMgr()
Definition: dpsdispmgr.h:143
ConstRefMan< ColTab::Sequence > colseq_
Definition: dpsdispmgr.h:90
Definition: uistring.h:88
Set of BufferString objects.
Definition: bufstringset.h:25
Maps data values to color sequence positions: [0,1].
Definition: coltabmapper.h:33
Color getColor(float val) const
Definition: dpsdispmgr.h:71
DataPointSet display manager.
Definition: dpsdispmgr.h:102
DataPointSetDisplayProp * dispProp()
Definition: dpsdispmgr.h:131
const TypeSet< Color > & selGrpColors() const
Definition: dpsdispmgr.h:66
#define mNINT32(x)
Definition: commondefs.h:48
BufferStringSet selgrpnms_
Definition: dpsdispmgr.h:88
TypeSet< int > availableviewers_
Definition: dpsdispmgr.h:146
DataPointSetDisplayProp * clone() const
Definition: dpsdispmgr.h:54
const ColTab::Mapper & colTabMapper() const
Definition: dpsdispmgr.h:69
virtual ~DataPointSetDisplayMgr()
Definition: dpsdispmgr.h:107
void setDispProp(DataPointSetDisplayProp *prop)
Definition: dpsdispmgr.h:135
const BufferStringSet & selGrpNames() const
Definition: dpsdispmgr.h:65
Interface for DataPointSet Displays.
Definition: dpsdispmgr.h:35
DataPointSetDisplayProp * dispprop_
Definition: dpsdispmgr.h:147
const DataPointSetDisplayProp * dispProp() const
Definition: dpsdispmgr.h:133
Parameters for the colortable Mapper.
Definition: coltabmappersetup.h:27
void clearDispProp()
Definition: dpsdispmgr.h:138
const ColTab::Sequence & colSequence() const
Definition: dpsdispmgr.h:67
DataPointSetDisplayProp(const ColTab::Sequence &cs, const ColTab::MapperSetup &msu, int id)
Definition: dpsdispmgr.h:38
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
int dpscolid_
Definition: dpsdispmgr.h:92
Pos pos(RowID) const
DataPointSetDisplayProp(const BufferStringSet &nms, const TypeSet< Color > &cols)
Definition: dpsdispmgr.h:45
RefMan< ColTab::Mapper > ctmapper_
Definition: dpsdispmgr.h:91
TypeSet< Color > selgrpcols_
Definition: dpsdispmgr.h:89
bool showSelected() const
Definition: dpsdispmgr.h:64
int dpsColID() const
Definition: dpsdispmgr.h:63
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
int DispID
Definition: dpsdispmgr.h:106
#define mClass(module)
Definition: commondefs.h:161
bool showsel_
Definition: dpsdispmgr.h:93
static Color NoColor()
Definition: color.h:74
const TypeSet< int > & availableViewers() const
Definition: dpsdispmgr.h:123
const SequenceManager & SeqMGR()

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