OpendTect-6_4  6.4
datapointset.h
Go to the documentation of this file.
1 #ifndef datapointset_h
2 #define datapointset_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Jan 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "generalmod.h"
16 #include "binidvalset.h"
17 #include "color.h"
18 #include "datapackbase.h"
19 class DataColDef;
20 class BinIDValueSet;
21 class PosVecDataSet;
22 class UnitOfMeasure;
23 class BufferStringSet;
24 class TaskRunner;
25 class TrcKeyZSampling;
26 
27 namespace Pos { class Filter; class Provider; }
28 
29 
49 {
50 public:
51 
52  typedef int RowID;
53  typedef int ColID;
54  class DataRow;
55 
58  mExpClass(General) Pos
59  {
60  public:
61  Pos() : offsx_(0), offsy_(0), z_(0), nr_(0) {}
62  Pos( const BinID& bid, float _z )
63  : binid_(bid), nr_(0), z_(_z)
64  , offsx_(0), offsy_(0) {}
65  Pos(const Coord&,float z);
66  Pos(const Coord3&);
67 
68  bool operator ==(const Pos& pos) const
69  { return binid_==pos.binid_ && offsx_ ==pos.offsx_
70  && offsy_==pos.offsy_ && z_==pos.z_; }
71  const BinID& binID() const { return binid_; }
72  Coord coord() const;
73  float z() const { return z_; }
74 
75  void set( const BinID& bid )
76  { binid_ = bid; offsx_ = offsy_ = 0; }
77  void set(const Coord&);
78  void set(const Coord3&);
79 
81  float z_;
82  int nr_;
83 
84  float binIDOffSet( bool inx ) const
85  { return inx ? offsx_ : offsy_; }
86  void setBinIDOffset( bool inx, float o )
87  { (inx ? offsx_ : offsy_) = o; }
88  void setBinIDOffsets( float ox, float oy )
89  { offsx_ = ox; offsy_ = oy; }
90 
91  protected:
92 
93  float offsx_, offsy_;
94  void setOffs(const Coord&);
95  friend class DataRow;
96 
97  };
98 
103  {
104  public:
106  : grp_(1) { setSel(false); }
107  DataRow( const Pos& p, unsigned short grp=1,
108  bool issel=false )
109  : pos_(p), grp_((short)grp)
110  { setSel( issel ); }
111 
112  bool operator ==(const DataRow& dr) const
113  { return pos_==dr.pos_ && grp_==dr.grp_
114  && data_==dr.data_; }
115  const BinID& binID() const { return pos_.binID(); }
116  Coord coord() const { return pos_.coord(); }
117  const TypeSet<float>& data() const { return data_; }
118  unsigned short group() const;
119  bool isSel() const { return grp_ > 0; }
120  bool isInactive() const { return grp_ == 0; }
121  void setSel( bool yn )
122  { if ( (grp_ >= 0) != yn ) grp_ = -grp_; }
123  void setGroup(unsigned short grp);
124  void getBVSValues(TypeSet<float>&,bool is2d,
125  bool ismini) const;
126 
129  short grp_;
130  };
131 
133  const ObjectSet<DataColDef>&,
134  bool is2d,bool minimal=false);
136  const BufferStringSet& valnms,
137  bool is2d,bool minimal=false);
138  DataPointSet(const PosVecDataSet&,bool is2d,
139  bool minimal=false);
141  DataPointSet(const DataPointSet&);
142  virtual ~DataPointSet();
143  DataPointSet& operator =(const DataPointSet&);
144  bool is2D() const { return is2d_; }
145  bool isMinimal() const { return minimal_; }
146  bool isEmpty() const { return bvsidxs_.isEmpty(); }
147  void setEmpty();
148  void clearData();
149 
150  int nrCols() const;
151  int nrFixedCols() const { return nrfixedcols_; }
152  const char* colName(ColID) const;
153  const UnitOfMeasure* unit(ColID) const;
154  const DataColDef& colDef( ColID i ) const { return gtColDef(i); }
155  ColID indexOf(const char*) const;
156  bool validColID(ColID) const;
157 
158  // size, binID, coord, z and trcNr impl PointDataPack
159  int size() const { return bvsidxs_.size(); }
160  BinID binID(RowID) const;
161  Coord coord(RowID) const;
162  float z(RowID) const;
163  int trcNr(RowID) const;
164 
165  Pos pos(RowID) const;
166  DataRow dataRow(RowID) const;
167  float value(ColID,RowID) const;
168  bool setValue(ColID,RowID,float);
169  float* getValues(RowID);
170  const float* getValues(RowID) const;
171  unsigned short group(RowID) const;
172  bool isSelected(RowID) const;
173  int selGroup(RowID) const;
174  bool isInactive( RowID rid ) const { return group(rid) == 0;}
175 
176  void setGroup(RowID,unsigned short);
177  void setSelected(RowID,int selgrp);
178  void setInactive(RowID,bool);
179 
180  int nrActive() const;
181  void purgeInactive();
182  void purgeSelected(bool selected_rows=true);
183 
184  RowID find(const Pos&) const;
185  RowID find(const Pos&,float horradius,float deltaz) const;
186  RowID findFirst(const Coord&) const;
187  RowID findFirst(const BinID&) const;
188 
189  const PosVecDataSet& dataSet() const { return data_; }
190  const BinIDValueSet& bivSet() const { return const_cast<DataPointSet*>
191  (this)->bivSet(); }
192  BinIDValueSet& bivSet();
196  PosVecDataSet& dataSet() { return data_; }
199 
200  DataPointSet* getSubselected(int maxsz,
201  const TypeSet<int>* selected_cols=0,
202  bool allow_udf_values=true,
203  const ObjectSet<Interval<float> >* value_ranges=0)
204  const;
205  void randomSubselect(int maxsz);
206 
207  int bivSetIdx( ColID idx ) const
208  { return idx+nrfixedcols_; }
209  bool getRange(TrcKeyZSampling&) const;
210 
211  void dataChanged() { calcIdxs(); }
215  void addRow(const DataRow&);
217  bool setRow(const DataRow&);
220  RowID getRowID(BinIDValueSet::SPos) const;
221  DataColDef& colDef( ColID i ) { return gtColDef(i); }
222  BinIDValueSet::SPos bvsPos( RowID rid ) const { return bvsidxs_[rid];}
223 
224  // Building from scratch
225  DataPointSet(bool is2d,bool minimal=false);
226  bool extractPositions(::Pos::Provider&,
227  const ObjectSet<DataColDef>&,
228  const ::Pos::Filter* f=0,
229  TaskRunner* tr=0);
230  void addCol(const char* nm,const char* ref=0,
231  const UnitOfMeasure* un=0);
233 
234  // DataPack interface impl
235  bool simpleCoords() const { return minimal_; }
236  float nrKBytes() const;
237  void dumpInfo(IOPar&) const;
238 
239 
240 protected:
241 
244  bool is2d_;
245  bool minimal_;
246 
247  void initPVDS();
248  void init(const TypeSet<DataRow>&,
249  const ObjectSet<DataColDef>&);
250  void calcIdxs();
251 
252  static const int groupcol_;
253  const int nrfixedcols_;
254 
255  DataColDef& gtColDef(ColID) const;
256 };
257 
258 
264 public:
265  DPSFromVolumeFiller(DataPointSet&,int firstcol,
266  const SeisDataPack&,
267  int component);
269 
270  virtual uiString uiMessage() const;
271  virtual uiString uiNrDoneText() const;
272 
273  void setSampling(const TrcKeyZSampling*);
274 
275 protected:
276  virtual od_int64 nrIterations() const;
277  virtual bool doWork(od_int64 start,od_int64 stop,int thridx);
278 
283 
287 };
288 
289 #endif
#define mExpClass(module)
Definition: commondefs.h:160
float binIDOffSet(bool inx) const
Definition: datapointset.h:84
DataPointSet & dps_
Definition: datapointset.h:279
const BinID & binID() const
Definition: datapointset.h:115
FixedString Filter()
Definition: keystrs.h:67
Provides a series of positions; can also be used for subselection.
Definition: posprovider.h:33
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:53
Set of data points with group selection.
Definition: datapointset.h:48
void setBinIDOffsets(float ox, float oy)
Definition: datapointset.h:88
bool isMinimal() const
Definition: datapointset.h:145
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
const SeisDataPack & sdp_
Definition: datapointset.h:280
const TrcKeyZSampling * sampling_
Definition: datapointset.h:286
bool isEmpty() const
Definition: datapointset.h:146
float z() const
Definition: datapointset.h:73
DataPack for volume data. Should be renamed to VolumeDataPack later.
Definition: datapackbase.h:200
void setBinIDOffset(bool inx, float o)
Definition: datapointset.h:86
#define od_int64
Definition: plftypes.h:36
bool init()
int RowID
Definition: datapointset.h:52
bool isInactive(RowID rid) const
Definition: datapointset.h:174
int ColID
Definition: datapointset.h:53
const int nrfixedcols_
Definition: datapointset.h:253
Coord coord() const
Definition: datapointset.h:116
Fills DataPointSet with data from a VolumeDataPack.
Definition: datapointset.h:262
Definition: uistring.h:89
A cartesian coordinate in 2D space.
Definition: coord.h:25
Set of BufferString objects.
Definition: bufstringset.h:28
ObjectSet< T >::size_type indexOf(const ObjectSet< T > &os, const S &val)
Locate object in set.
Definition: objectset.h:169
int component_
Definition: datapointset.h:281
position in IdxPairValueSet; an iterator.
Definition: posidxpairvalset.h:96
const BinIDValueSet & bivSet() const
Definition: datapointset.h:190
DataColDef & colDef(ColID i)
Definition: datapointset.h:221
DataPack for point data.
Definition: datapackbase.h:36
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
bool hasstorage_
Definition: datapointset.h:285
PosVecDataSet & data_
Definition: datapointset.h:242
bool minimal_
Definition: datapointset.h:245
float z_
Definition: datapointset.h:81
Generalized set of parameters of the keyword-value type.
Definition: iopar.h:47
int firstcol_
Definition: datapointset.h:282
Class that can execute a task.
Definition: task.h:169
PosVecDataSet & dataSet()
Definition: datapointset.h:196
bool simpleCoords() const
If true, coords are always SI().tranform(b)
Definition: datapointset.h:235
bool hastrcdata_
Definition: datapointset.h:284
int nrFixedCols() const
Definition: datapointset.h:151
Hor+Vert sampling in 3D surveys.
Definition: trckeyzsampling.h:35
static const int groupcol_
Definition: datapointset.h:252
const BinID & binID() const
Definition: datapointset.h:71
TypeSet< BinIDValueSet::SPos > bvsidxs_
Definition: datapointset.h:243
Position.
Definition: commontypes.h:42
const T * find(const ObjectSet< T > &os, const S &val)
Get const object in set.
Definition: objectset.h:183
A cartesian coordinate in 3D space.
Definition: coord.h:72
const DataColDef & colDef(ColID i) const
Definition: datapointset.h:154
void dataChanged()
Definition: datapointset.h:211
short grp_
Definition: datapointset.h:129
Data point with group. Group 0 means &#39;inactive&#39;, it can never be selected.
Definition: datapointset.h:102
Pos()
Definition: datapointset.h:61
int bivSetIdx(ColID idx) const
Definition: datapointset.h:207
DataRow()
Definition: datapointset.h:105
Positioning in a seismic survey: inline/crossline or lineNr/trcNr.
Definition: binid.h:30
Pos pos_
Definition: datapointset.h:127
void setSel(bool yn)
Definition: datapointset.h:121
const TypeSet< float > & data() const
Definition: datapointset.h:117
BinID binid_
Definition: datapointset.h:80
A Pos::IdxPairValueSet with BinIDs.
Definition: binidvalset.h:23
int nr_
unused if not 2D
Definition: datapointset.h:82
bool is2d_
Definition: datapointset.h:244
Column definition in tabular data sets.
Definition: datacoldef.h:29
float offsy_
Definition: datapointset.h:93
bool isInactive() const
Definition: datapointset.h:120
DataRow(const Pos &p, unsigned short grp=1, bool issel=false)
Definition: datapointset.h:107
BinIDValueSet::SPos bvsPos(RowID rid) const
Definition: datapointset.h:222
TypeSet< float > data_
Definition: datapointset.h:128
int size() const
Definition: datapointset.h:159
Data set consisting of data vectors.
Definition: posvecdataset.h:30
Unit of Measure.
Definition: unitofmeasure.h:35
bool is2D() const
Definition: datapointset.h:144
const PosVecDataSet & dataSet() const
Definition: datapointset.h:189
bool isSel() const
Definition: datapointset.h:119
Pos(const BinID &bid, float _z)
Definition: datapointset.h:62

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