OpendTect  6.3
attribdescset.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: Kristofer Tingdahl
8  Date: 07-10-1999
9 ________________________________________________________________________
10 
11 -*/
12 
13 #include "attributeenginemod.h"
14 
15 #include "attribdescid.h"
16 #include "notify.h"
17 #include "dbkey.h"
18 #include "uistring.h"
19 
20 class BufferStringSet;
21 class DataPointSet;
22 
23 namespace Attrib
24 {
25 class Desc; class DescSetup; class SelSpec;
26 
29 mExpClass(AttributeEngine) DescSet : public CallBacker
31 public:
32  DescSet(bool is2d);
33  DescSet(const DescSet&);
34  ~DescSet() { removeAll( false ); }
35 
36  DescSet& operator =(const DescSet&);
37  bool isEmpty() const { return descs_.isEmpty(); }
38  inline int size() const { return nrDescs(true,true); }
39  int indexOf(const char* nm, bool usrref=true) const;
40  inline bool isPresent( const char* nm, bool usr=true ) const
41  { return indexOf(nm,usr) >= 0; }
42 
43  DescSet* optimizeClone(const DescID& targetid) const;
44  DescSet* optimizeClone(const TypeSet<DescID>&) const;
45  DescSet* optimizeClone(const BufferStringSet&) const;
48  void updateInputs();
52  DescID addDesc(Desc*,DescID newid=DescID());
55  DescID insertDesc(Desc*,int,DescID newid=DescID());
58  void createAndAddMultOutDescs(const DescID&,
59  const TypeSet<int>&,
60  const BufferStringSet&,
66  Desc& operator[]( int idx ) { return *desc(idx); }
67  const Desc& operator[]( int idx ) const { return *desc(idx); }
68  int nrDescs(bool inclstored,bool inclhidden) const;
70  Desc* desc( int idx ) { return descs_[idx]; }
71  const Desc* desc( int idx ) const { return descs_[idx]; }
72 
73  Desc* getDesc( const DescID& id )
74  { return gtDesc(id); }
75  const Desc* getDesc( const DescID& id ) const
76  { return gtDesc(id); }
77  DescID getID(const Desc&) const;
78  DescID getID(int) const;
79  DescID getID(const char* ref,bool isusrref,
80  bool mustbestored=false,
81  bool usestorinfo=false) const;
82  void getIds(TypeSet<DescID>&) const;
83  void getStoredIds(TypeSet<DescID>&) const;
84  DescID getStoredID(const DBKey&,int selout=-1,
85  bool create=true,bool blindcomp=false,
86  const char* blindcompnm=0);
87  Desc* getFirstStored(bool usesteering=true) const;
88  DBKey getStoredKey(const DescID&) const;
89  void getStoredNames(BufferStringSet&) const;
90  void getAttribNames(BufferStringSet&,bool inclhidden) const;
91 
92  void removeDesc(const DescID&);
93  void moveDescUpDown(const DescID&,bool);
94  void sortDescSet();
95  void removeAll(bool kpdefault);
96  int removeUnused(bool removestored=false,
97  bool kpdefault=true);
101  bool isAttribUsed(const DescID&,BufferString&) const;
102  bool isAttribUsed(const DescID&) const;
103  void cleanUpDescsMissingInputs();
104 
105  bool createSteeringDesc(const IOPar&,BufferString,
106  ObjectSet<Desc>&, int& id,
107  uiStringSet* errmsgs=0);
108  static Desc* createDesc(const BufferString&, const IOPar&,
109  const BufferString&,uiStringSet*);
110  Desc* createDesc(const BufferString&, const IOPar&,
111  const BufferString& );
112  DescID createStoredDesc(const DBKey&,int selout,
113  const BufferString& compnm);
114  bool setAllInputDescs(int, const IOPar&,uiStringSet*);
115  void handleStorageOldFormat(IOPar&);
116  void handleOldAttributes(BufferString&,IOPar&,BufferString&,
117  int) const;
118  void handleOldMathExpression(IOPar&,BufferString&,int) const;
119  void handleReferenceInput(Desc*);
120 
123  void fillInAttribColRefs(BufferStringSet&) const;
124 
127  void fillInUIInputList(BufferStringSet&) const;
130  Desc* getDescFromUIListEntry(const StringPair&);
131 
133  DataPointSet* createDataPointSet(Attrib::DescSetup,
134  bool withstored=true) const;
135  void fillInSelSpecs(Attrib::DescSetup,
136  TypeSet<Attrib::SelSpec>&) const;
137 
138  void setContainStoredDescOnly(bool yn);
139  inline bool containsStoredDescOnly() const
140  { return storedattronly_; }
142  { couldbeanydim_ = yn; }
143  inline bool couldBeUsedInAnyDimension() const
144  { return couldbeanydim_; }
145  bool hasStoredInMem() const;
146 
147  bool exportToDot(const char* nm,const char* fnm) const;
148 
149  inline bool is2D() const { return is2d_; }
150  uiString errMsg() const;
151  static const char* highestIDStr() { return "MaxNrKeys"; }
152  static const char* definitionStr() { return "Definition"; }
153  static const char* userRefStr() { return "UserRef"; }
154  static const char* inputPrefixStr() { return "Input"; }
155  static const char* hiddenStr() { return "Hidden"; }
156  static const char* indexStr() { return "Index"; }
158  { return "Parameter 'id' is not correct"; }
159 
161 
162  void fillPar(IOPar&) const;
163  bool usePar(const IOPar&,uiStringSet* errmsgs=0);
164  bool useOldSteeringPar(IOPar&,ObjectSet<Desc>&,
165  uiStringSet*);
166 protected:
167 
168  DescID getFreeID() const;
169 
172  bool is2d_;
178 
179 private:
180 
181  Desc* gtDesc(const DescID&) const;
182 
183 public:
184 
185  DescID ensureDefStoredPresent() const;
186  static uiString sFactoryEntryNotFound(const char* attrnm);
187 
188 };
189 
190 } // namespace Attrib
const Desc * getDesc(const DescID &id) const
Definition: attribdescset.h:75
#define mExpClass(module)
Definition: commondefs.h:157
TypeSet< DescID > ids_
Definition: attribdescset.h:171
void setCouldBeUsedInAnyDimension(bool yn)
Definition: attribdescset.h:141
const Desc * desc(int idx) const
Definition: attribdescset.h:71
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
Desc * getDesc(const DescID &id)
Definition: attribdescset.h:73
~DescSet()
Definition: attribdescset.h:34
const Desc & operator[](int idx) const
Definition: attribdescset.h:67
Desc & operator[](int idx)
Definition: attribdescset.h:66
Set of data points with group selection.
Definition: datapointset.h:47
#define mODTextTranslationClass(clss)
Definition: uistring.h:37
bool isEmpty() const
Definition: attribdescset.h:37
bool is2D() const
Definition: attribdescset.h:149
void usePar(const IOPar &iop, ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:200
static BufferString storedIDErrStr()
Definition: attribdescset.h:157
Set of attribute descriptions.
Definition: attribdescset.h:29
bool couldBeUsedInAnyDimension() const
Definition: attribdescset.h:143
AttribDesc ID: each Desc has a unique ID in a set; the boolean isstored allows us to know whether thi...
Definition: attribdescid.h:25
Definition: uistring.h:88
Set of BufferString objects.
Definition: bufstringset.h:25
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:173
BufferString defidstr_
Definition: attribdescset.h:176
static const char * indexStr()
Definition: attribdescset.h:156
bool isPresent(const char *nm, bool usr=true) const
Definition: attribdescset.h:40
Set of pointers to objects.
Definition: commontypes.h:28
FixedString Desc()
Definition: keystrs.h:60
void removeAll()
Set of (small) copyable elements.
Definition: commontypes.h:26
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:53
uiString errmsg_
Definition: attribdescset.h:175
CNotifier< DescSet, DescID > descToBeRemoved
Definition: attribdescset.h:160
Description of an attribute in an Attrib::DescSet. Each attribute has a name (e.g. "Similarity"), a user reference (e.g. "My similarity"), and at least one output. In addition, it may have parameters and inputs. If it has multiple outputs, only one of the outputs are selected.
Definition: attribdesc.h:87
Setup class for Attrib::Desc.
Definition: attribdesc.h:37
A StringPair has two strings, first() and second(). The getCompString() function concatanates the two...
Definition: bufstring.h:250
static const char * userRefStr()
Definition: attribdescset.h:153
void fillPar(IOPar &iop, const ODPolygon< T > &poly, const char *inpkey)
Definition: polygon.h:187
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:38
static uiHor3DInterpol * create(uiParent *)
static const char * hiddenStr()
Definition: attribdescset.h:155
bool containsStoredDescOnly() const
Definition: attribdescset.h:139
static const char * highestIDStr()
Definition: attribdescset.h:151
bool is2d_
Definition: attribdescset.h:172
Notifier with automatic capsule creation.
Definition: notify.h:166
Definition: uistring.h:235
Full key to any object in the OpendTect data store.
Definition: dbkey.h:36
static const char * definitionStr()
Definition: attribdescset.h:152
Desc * desc(int idx)
Definition: attribdescset.h:70
const char * errMsg() const
Definition: horizontracker.h:59
bool couldbeanydim_
Definition: attribdescset.h:174
int size() const
Definition: attribdescset.h:38
ObjectSet< Desc > descs_
Definition: attribdescset.h:170
DescID defattribid_
Definition: attribdescset.h:177
bool storedattronly_
Definition: attribdescset.h:173
Semblance Attribute.
Definition: attribdataholder.h:21
static const char * inputPrefixStr()
Definition: attribdescset.h:154

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