OpendTect  6.3
odpresentationmgr.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: August 2016
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "bufstringset.h"
14 #include "generalmod.h"
15 #include "idxpair.h"
16 #include "commondefs.h"
17 #include "callback.h"
18 #include "notify.h"
19 #include "typeset.h"
20 #include "objectset.h"
21 #include "dbkey.h"
22 #include "groupedid.h"
23 #include "zdomain.h"
24 #include "zaxistransform.h"
25 
26 namespace OD
27 {
28 
31 
33 
34  mGlobal(General) const char* sKeyPresentationObj();
35 
36 mExpClass(General) ViewerID : public GroupedID
37 {
38 public:
40  : GroupedID(GroupedID::getInvalid())
41  {}
42 
43  ViewerID( ViewerTypeID vwrtypeid,
44  ViewerObjID vwrobjid )
45  : GroupedID(GroupedID::getInvalid())
46  {
47  setGroupID( vwrtypeid );
48  setObjID( vwrobjid );
49  }
50  ViewerID(GroupNrType vwrtypeid, ObjNrType vwrid)
51  : GroupedID(GroupedID::get(vwrtypeid,vwrid))
52  {}
53 
54  ViewerTypeID viewerTypeID() { return groupID(); }
55  ViewerObjID viewerObjID() { return objID(); }
56 
57 };
58 
59 
61 {
62 public:
63 
66  : storedid_(dbk) {}
67  virtual ~ObjPresentationInfo() {}
68  virtual uiString getName() const;
69  ObjPresentationInfo* clone() const;
70  virtual bool isSaveable() const
71  { return !storedid_.isInvalid();}
72  virtual void fillPar(IOPar&) const;
73  virtual bool usePar(const IOPar&);
74  void setStoredID(const DBKey& id)
75  { storedid_ = id; }
76  const DBKey& storedID() const
77  { return storedid_; }
78  const char* objTypeKey() const
79  { return objtypekey_; }
80  virtual bool isSameObj(
81  const ObjPresentationInfo&) const;
82 protected:
85 };
86 
87 
88 
90 {
91 public:
93  { deepErase( prinfoset_ ); }
94  bool isPresent(
95  const ObjPresentationInfo&) const;
96  int size() const
97  { return prinfoset_.size(); }
98  ObjPresentationInfo* remove(int idx);
99  ObjPresentationInfo* get(int idx);
100  const ObjPresentationInfo* get(int idx) const;
101  bool add(ObjPresentationInfo*);
102 protected:
104 };
105 
106 
108 {
109 public:
110  typedef ObjPresentationInfo* (*CreateFunc)( const IOPar& );
111 
112  void addCreateFunc(CreateFunc, const char* key);
114 protected:
117 };
118 
119 
121 
122 
124 {
125 public:
127  virtual ~PresentationManagedViewer();
129  { return OD::ViewerID(viewerTypeID(),
130  viewerObjID()); }
131  virtual ViewerTypeID viewerTypeID() const =0;
132  ViewerObjID viewerObjID() const { return viewerobjid_; }
133  void setViewerObjID(ViewerObjID id)
134  { viewerobjid_ = id; }
136  { return datatransform_.ptr(); }
137  void setZAxisTransform(ZAxisTransform*);
138  bool hasZAxisTransform() const
139  { return datatransform_; }
140  const ZDomain::Info& zDomain() const {return *zdomaininfo_; }
141 
148 
149 protected:
150  ViewerObjID viewerobjid_;
153 };
154 
155 
156 
158 {
159 public:
160  virtual ViewerTypeID viewerTypeID() const =0;
161  virtual void request(ViewerID originivwrid,
163  const IOPar&);
165  { viewers_ += vwr; }
167  const PresentationManagedViewer* getViewer(OD::ViewerObjID) const;
168 protected:
170 };
171 
173 {
174 public:
175 
176  struct SyncInfo
177  {
178  SyncInfo( ViewerTypeID vwrtypeid,
179  bool sync )
180  : vwrtypeid_(vwrtypeid)
181  , issynced_(sync) {}
182  ViewerTypeID vwrtypeid_;
183  bool issynced_;
184  bool operator==( const SyncInfo& rhs ) const
185  {
186  return vwrtypeid_==rhs.vwrtypeid_ && issynced_==rhs.issynced_;
187  }
188  };
189 
190  PresentationManager();
191 
192  VwrTypePresentationMgr* getViewerTypeMgr(ViewerTypeID vwrtypeid);
194  getViewerTypeMgr(ViewerTypeID vwrtypeid) const;
195  PresentationManagedViewer* getViewer(OD::ViewerID vwrid);
197  getViewer(OD::ViewerID vwrid) const;
198  void request(ViewerID id,
200  const IOPar&);
201  void syncAllViewerTypes();
202  void addViewerTypeManager(VwrTypePresentationMgr*);
203  bool canViewerBeSynced(ViewerID,
204  ViewerID) const;
205  bool areViewerTypesSynced(ViewerTypeID,
206  ViewerTypeID) const;
207 protected:
210 
211  int syncInfoIdx(ViewerTypeID) const;
212 };
213 
214 mGlobal(General) PresentationManager& PrMan();
215 
216 }
217 //namedpace OD
Definition: odpresentationmgr.h:157
#define mExpClass(module)
Definition: commondefs.h:157
GroupedID::GroupID ViewerTypeID
Definition: odpresentationmgr.h:29
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
~ObjPresentationInfoSet()
Definition: odpresentationmgr.h:92
ObjectSet< ObjPresentationInfo > prinfoset_
Definition: odpresentationmgr.h:103
Definition: odpresentationmgr.h:123
#define mGlobal(module)
Definition: commondefs.h:160
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
CNotifier< PresentationManagedViewer, IOPar > ObjAdded
Definition: odpresentationmgr.h:142
bool operator==(const SyncInfo &rhs) const
Definition: odpresentationmgr.h:184
DBKey storedid_
Definition: odpresentationmgr.h:84
const char * objTypeKey() const
Definition: odpresentationmgr.h:78
Definition: odpresentationmgr.h:36
ZDomain::Info * zdomaininfo_
Definition: odpresentationmgr.h:152
const ZDomain::Info & zDomain() const
Definition: odpresentationmgr.h:140
const char * sKeyPresentationObj()
CNotifier< PresentationManagedViewer, IOPar > VanishRequested
Definition: odpresentationmgr.h:147
OD::ViewerID viewerID()
Definition: odpresentationmgr.h:128
Definition: uistring.h:88
ViewerID(ViewerTypeID vwrtypeid, ViewerObjID vwrobjid)
Definition: odpresentationmgr.h:43
Definition: odpresentationmgr.h:32
ViewerTypeID viewerTypeID()
Definition: odpresentationmgr.h:54
Set of BufferString objects.
Definition: bufstringset.h:25
ObjNrT ObjNrType
Definition: groupedid.h:39
CNotifier< PresentationManagedViewer, IOPar > UnsavedObjLastCall
Definition: odpresentationmgr.h:144
BufferStringSet keys_
Definition: odpresentationmgr.h:116
ViewerObjID viewerObjID()
Definition: odpresentationmgr.h:55
Set of pointers to objects.
Definition: commontypes.h:28
Definition: groupedid.h:40
ViewerTypeID vwrtypeid_
Definition: odpresentationmgr.h:182
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
CNotifier< PresentationManagedViewer, IOPar > ShowRequested
Definition: odpresentationmgr.h:145
GroupedID::ObjID ViewerObjID
Definition: odpresentationmgr.h:30
ViewerID()
Definition: odpresentationmgr.h:39
ObjectSet< PresentationManagedViewer > viewers_
Definition: odpresentationmgr.h:169
void addViewer(PresentationManagedViewer *vwr)
Definition: odpresentationmgr.h:164
SyncInfo(ViewerTypeID vwrtypeid, bool sync)
Definition: odpresentationmgr.h:178
void setStoredID(const DBKey &id)
Definition: odpresentationmgr.h:74
RefMan< ZAxisTransform > datatransform_
Definition: odpresentationmgr.h:151
Definition: odpresentationmgr.h:172
CNotifier< PresentationManagedViewer, IOPar > ObjOrphaned
Definition: odpresentationmgr.h:143
bool issynced_
Definition: odpresentationmgr.h:183
ObjPresentationInfo()
Definition: odpresentationmgr.h:64
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
ViewerObjID viewerObjID() const
Definition: odpresentationmgr.h:132
const ZAxisTransform * getZAxisTransform() const
Definition: odpresentationmgr.h:135
Definition: odpresentationmgr.h:32
ViewerObjID viewerobjid_
Definition: odpresentationmgr.h:150
Definition: odpresentationmgr.h:32
Definition: odpresentationmgr.h:107
GroupNrT GroupNrType
Definition: groupedid.h:38
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
ViewerID(GroupNrType vwrtypeid, ObjNrType vwrid)
Definition: odpresentationmgr.h:50
static uiHor3DInterpol * create(uiParent *)
Definition: odpresentationmgr.h:32
const DBKey & storedID() const
Definition: odpresentationmgr.h:76
CNotifier< PresentationManagedViewer, IOPar > HideRequested
Definition: odpresentationmgr.h:146
PresentationRequestType
Definition: odpresentationmgr.h:32
Definition: odpresentationmgr.h:89
virtual bool isSaveable() const
Definition: odpresentationmgr.h:70
OpendTect.
Definition: commontypes.h:25
TypeSet< CreateFunc > createfuncs_
Definition: odpresentationmgr.h:115
Notifier with automatic capsule creation.
Definition: notify.h:166
int size() const
Definition: odpresentationmgr.h:96
void setViewerObjID(ViewerObjID id)
Definition: odpresentationmgr.h:133
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
Definition: groupedid.h:41
PresentationManager & PrMan()
BufferString objtypekey_
Definition: odpresentationmgr.h:83
bool hasZAxisTransform() const
Definition: odpresentationmgr.h:138
Base class for z-axis transforms.
Definition: zaxistransform.h:35
ObjPresentationInfoFactory & PRIFac()
A unique identifier for an object consisting of a group and an ID within the group.
Definition: groupedid.h:34
ObjPresentationInfo(const DBKey &dbk)
Definition: odpresentationmgr.h:65
Definition: odpresentationmgr.h:60
virtual ~ObjPresentationInfo()
Definition: odpresentationmgr.h:67
Information of z-domain.
Definition: zdomain.h:96
Definition: odpresentationmgr.h:176
ObjectSet< VwrTypePresentationMgr > vwrtypemanagers_
Definition: odpresentationmgr.h:208
TypeSet< SyncInfo > vwrtypesyncinfos_
Definition: odpresentationmgr.h:209
void deepErase(ObjectSet< T > &os)
empty the ObjectSet deleting all objects pointed to.
Definition: objectset.h:122

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