OpendTect-6_4  6.4
uidatapointsetcrossplot.h
Go to the documentation of this file.
1 #ifndef uidatapointsetcrossplot_h
2 #define uidatapointsetcrossplot_h
3 
4 /*+
5 ________________________________________________________________________
6 
7  (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
8  Author: Bert
9  Date: Mar 2008
10  RCS: $Id$
11 ________________________________________________________________________
12 
13 -*/
14 
15 #include "uiiomod.h"
16 #include "uiaxishandler.h"
17 #include "uidatapointset.h"
18 #include "coltabsequence.h"
19 #include "coltabmapper.h"
20 #include "datapointset.h"
21 #include "uirgbarraycanvas.h"
22 #include "uiaxisdata.h"
23 #include "rowcol.h"
24 #include "linear.h"
25 #include "uidpscrossplottools.h"
26 
27 class RowCol;
28 class MouseEvent;
29 class LinStats2D;
30 class Timer;
31 class uiDataPointSet;
32 class uiPolygonItem;
33 class uiLineItem;
34 class uiPolyLineItem;
35 class uiRectItem;
37 class uiGraphicsItem;
38 class uiColTabItem;
39 class uiRect;
40 template <class T> class Array1D;
41 namespace Math { class Expression; }
42 
49 public:
50 
51  struct Setup
52  {
53  Setup();
54 
55  mDefSetupMemb(bool,noedit)
56  mDefSetupMemb(uiBorder,minborder)
57  mDefSetupMemb(MarkerStyle2D,markerstyle) // None => uses drawPoint
61  mDefSetupMemb(bool,showcc) // corr coefficient
62  mDefSetupMemb(bool,showregrline)
63  mDefSetupMemb(bool,showy1userdefpolyline)
64  mDefSetupMemb(bool,showy2userdefpolyline)
65  };
66 
68  const Setup&);
70 
71  const Setup& setup() const { return setup_; }
72  Setup& setup() { return setup_; }
73 
74  void setCols(DataPointSet::ColID x,
77  void setOverlayY1Cols(DataPointSet::ColID y3);
78  void setOverlayY2Cols(DataPointSet::ColID y3);
79 
88  DataPointSet::RowID selRow() const { return selrow_; }
89  bool selRowIsY2() const { return selrowisy2_; }
90 
91  void dataChanged();
92 
94  mExpClass(uiIo) AxisData : public uiAxisData
96  public:
98  uiRect::Side);
99 
100  void stop();
101  void setCol(DataPointSet::ColID);
102 
103  void newColID();
104 
107  };
108 
109 
110 
114  int getRow(const AxisData&,uiPoint) const;
115  void drawData(const AxisData&,bool y2,
116  bool rempts = false);
117  void drawRegrLine(uiAxisHandler&,
118  const Interval<int>&);
119 
120  void prepareItems(bool y2);
121  void addItemIfNew(int itmidx,MarkerStyle2D&,
124  void setItem(uiGraphicsItem*,bool y2,const uiPoint&);
125  void setAnnotEndTxt(uiAxisHandler&);
126  int calcDensity(Array2D<float>*,bool chgdps=false,
127  bool removesel=false,
128  bool isy2=false, int areatyp=0,
129  Interval<int>* cellsz = 0,
130  Array2D<float>* freqdata = 0);
131  int calculateDensity(Array2D<float>*,
132  bool chgdps=false,
133  bool removesel=false);
134  void drawDensityPlot(bool removesel=false);
135  bool drawPoints(uiGraphicsItemGroup*,
136  const AxisData&,bool y2,
137  MarkerStyle2D&,bool rempt = false);
138  void removeSelectionItems();
139 
140  void setSceneSelectable( bool yn )
141  { selectable_ = yn; }
142  bool isSceneSelectable() const
143  { return selectable_; }
144  void setSelectable( bool y1, bool y2 );
145  void removeSelections(bool relfrmselgrp = true);
146  void deleteSelections();
147  float getSelectedness(uiDataPointSet::DRowID,
148  bool fory2);
149  void checkSelection(uiDataPointSet::DRowID,
150  uiGraphicsItem*,bool,const AxisData&,
151  bool rempt = false);
152  bool checkSelArea(const SelectionArea&) const;
154  { return axisData(ax).autoscalepars_; }
156  { return axisData(ax).axis_; }
157  const uiAxisHandler* axisHandler( int ax ) const
158  { return axisData(ax).axis_; }
159  const LinStats2D& linStats( bool y1=true ) const
160  { return y1 ? lsy1_ : lsy2_; }
161 
162  AxisData& axisData( int ax )
163  { return ax ? (ax == 2 ? y2_ : y_) : x_; }
164  const AxisData& axisData( int ax ) const
165  { return ax ? (ax == 2 ? y2_ : y_) : x_; }
166 
168  friend class AxisData;
169 
172 
175 
178 
179  void setMathObj(Math::Expression*);
180  void setMathObjStr( const char* str )
181  { mathobjstr_ = str; }
182  const OD::String& mathObjStr() const { return mathobjstr_; }
183  Math::Expression* mathObj() const { return mathobj_; }
186  { modcolidxs_ = ids; }
187  const TypeSet<int>& modifiedColIds() const { return modcolidxs_; }
188 
189  const DataPointSet& dps() const { return dps_; }
190  DataPointSet& dps() { return dps_; }
191 
192  const uiDataPointSet& uidps() const { return uidps_; }
193  uiDataPointSet& uidps() { return uidps_; }
194 
195  const TypeSet<RowCol>& getSelectedCells() { return selrowcols_; }
196 
197  int nrYSels() const { return selyitems_; }
198  int nrY2Sels() const { return sely2items_; }
199 
200  TypeSet<Color>& y1grpColors() { return y1grpcols_; }
201  TypeSet<Color>& y2grpColors() { return y2grpcols_; }
202 
203  void setColTab( const ColTab::Sequence& ctseq )
204  { ctab_ = ctseq; }
205  void setCTMapper(const ColTab::MapperSetup&);
206  void showY2(bool);
207  void drawContent( bool withaxis = true );
208  void drawColTabItem(bool isy1);
209  bool isY2Shown() const;
210  bool isY1Selectable() const
211  { return isy1selectable_; }
212  bool isY2Selectable() const
213  { return isy2selectable_; }
214  bool showY3() const { return showy3_; }
215  bool showY4() const { return showy4_; }
216  void setShowY3(bool);
217  void setShowY4(bool);
218  bool isADensityPlot() const { return isdensityplot_;}
219  void setDensityPlot(bool yn,bool showy2);
220  bool isRectSelection() const
221  { return rectangleselection_; }
222  void setRectSelection( bool yn )
223  { rectangleselection_ = yn; }
224 
225  SelectionArea& getCurSelArea();
226  void setSelArea(const SelectionArea&,int selgrpidx);
227  bool getSelArea(SelectionArea&,int selareaid);
228  ObjectSet<SelectionGrp>& selectionGrps() { return selgrpset_; }
230  { return selgrpset_; }
231  int selAreaSize() const;
232  int curGroup() const { return curgrp_; }
233  void reDrawSelections();
234  TypeSet<Color> selGrpCols() const;
235  void setCurSelGrp(int grp) { curselgrp_ = grp; }
236  int curSelGrp() const { return curselgrp_; }
237 
238  int getNewSelAreaID() const;
239  bool isSelAreaValid(int id) const;
240  int getSelGrpIdx(int selareaid) const;
241  void setTRMsg( const uiString& msg )
242  { trmsg_ = msg; }
243  int totalNrItems() const;
244  void getRandRowids();
245  void setMultiColMode(bool yn)
246  { multclron_ = yn; }
247  bool isMultiColMode() const { return multclron_; }
248  void setCellSize( int sz ) { cellsize_ = sz; }
249  int cellSize() const { return cellsize_; }
250  bool isSelectionValid(uiDataPointSet::DRowID);
251 
252  void setOverlayY1AttMapr(const ColTab::MapperSetup&);
253  void setOverlayY2AttMapr(const ColTab::MapperSetup&);
254  void setOverlayY1AttSeq(const ColTab::Sequence&);
255  void setOverlayY2AttSeq(const ColTab::Sequence&);
256 
257  void setUserDefDrawType(bool dodrw,bool isy2,
258  bool drwln = false);
259  void setUserDefPolyLine(TypeSet<uiWorldPoint>&,bool);
260  void drawUserDefPolyLine(bool);
261 
262  void updateOverlayMapper(bool isy1);
263  Color getOverlayColor(uiDataPointSet::DRowID,bool);
264 
265  int y3Colid() const { return y3colid_; }
266  int y4Colid() const { return y4colid_; }
267  const ColTab::Mapper& y3Mapper() const { return y3mapper_; }
268  const ColTab::Mapper& y4Mapper() const { return y4mapper_; }
269  const ColTab::Sequence& y3CtSeq() const { return y3ctab_; }
270  const ColTab::Sequence& y4CtSeq() const { return y4ctab_; }
271 
272  float getVal(int colid,int rid) const;
273 
274 protected:
275 
276  int y3colid_;
277  int y4colid_;
278 
285 
297 
307  bool showy3_;
308  bool showy4_;
316  bool drawy2_;
317  float plotperc_;
318  int curgrp_;
337 
343 
344  void initDraw();
345  void setDraw();
346  void calcStats();
347  void setWorldSelArea(int);
348  void reDrawSelArea();
349  bool drawRID(uiDataPointSet::DRowID,
351  const AxisData&,bool y2,
352  MarkerStyle2D&,int idmidx,bool rempt);
353 
354  bool selNearest(const MouseEvent&);
355  void reDrawCB(CallBacker*);
356  void reSizeDrawCB(CallBacker*);
357  void mouseClickedCB(CallBacker*);
358  void mouseMoveCB(CallBacker*);
359  void mouseReleasedCB(CallBacker*);
360 };
361 
362 #endif
Convenient base class to carry axis data: 1) the AxisHandler which handles the behaviour and position...
Definition: uiaxisdata.h:30
Array1D ( Subclass of ArrayND ) is a one dimensional array.
Definition: arraynd.h:101
bool isRectSelection() const
Definition: uidatapointsetcrossplot.h:220
DataPointSet & dps_
Definition: uidatapointsetcrossplot.h:280
#define mExpClass(module)
Definition: commondefs.h:160
TypeSet< Color > & y2grpColors()
Definition: uidatapointsetcrossplot.h:201
const LinStats2D & linStats(bool y1=true) const
Definition: uidatapointsetcrossplot.h:159
void setColTab(const ColTab::Sequence &ctseq)
Definition: uidatapointsetcrossplot.h:203
uiString trmsg_
Definition: uidatapointsetcrossplot.h:284
To be able to send and/or receive CallBacks, inherit from this class.
Definition: callback.h:272
ColTab::Mapper y3mapper_
Definition: uidatapointsetcrossplot.h:302
void setSceneSelectable(bool yn)
Definition: uidatapointsetcrossplot.h:140
Definition: uigeom.h:42
BufferString & y2rmserr_
Definition: uidatapointsetcrossplot.h:177
FixedString Setup()
Definition: keystrs.h:116
BufferString & userdefy1str_
Definition: uidatapointsetcrossplot.h:173
uiColTabItem * y2overlayctitem_
Definition: uidatapointsetcrossplot.h:296
const ColTab::Mapper & y3Mapper() const
Definition: uidatapointsetcrossplot.h:267
bool showY3() const
Definition: uidatapointsetcrossplot.h:214
TypeSet< uiWorldPoint > y2userdefpts_
Definition: uidatapointsetcrossplot.h:331
Set of data points with group selection.
Definition: datapointset.h:48
Timer & timer_
Definition: uidatapointsetcrossplot.h:306
uiPoint startpos_
Definition: uidatapointsetcrossplot.h:336
bool drawy2_
Definition: uidatapointsetcrossplot.h:316
const Setup & setup() const
Definition: uidatapointsetcrossplot.h:71
#define mODTextTranslationClass(clss)
Definition: uistring.h:38
Maps from [0,1] -> Color.
Definition: coltabsequence.h:37
Steepness and intercept.
Definition: linear.h:26
uiRectItem * selectionrectitem_
Definition: uidatapointsetcrossplot.h:287
bool drawy1userdefpolyline_
Definition: uidatapointsetcrossplot.h:314
void setMathObjStr(const char *str)
Definition: uidatapointsetcrossplot.h:180
Definition: uiaxisdata.h:40
uiGraphicsItemGroup * y2ptitems_
Definition: uidatapointsetcrossplot.h:289
TypeSet< uiWorldPoint > y1userdefpts_
Definition: uidatapointsetcrossplot.h:330
Definition: draw.h:60
Definition: draw.h:118
TypeSet< RowCol > selrowcols_
Definition: uidatapointsetcrossplot.h:327
bool selectable_
Definition: uidatapointsetcrossplot.h:309
Definition: uigraphicsitemimpl.h:192
ObjectSet< SelectionArea > selareaset_
Definition: uidatapointsetcrossplot.h:338
int RowID
Definition: datapointset.h:52
void setCellSize(int sz)
Definition: uidatapointsetcrossplot.h:248
LinStats2D & lsy2_
Definition: uidatapointsetcrossplot.h:305
bool selrowisy2_
Definition: uidatapointsetcrossplot.h:335
Handles an axis on a plot.
Definition: uiaxishandler.h:51
uiPolyLineItem * y2userdefpolylineitm_
Definition: uidatapointsetcrossplot.h:294
int ColID
Definition: datapointset.h:53
bool showy4_
Definition: uidatapointsetcrossplot.h:308
AxisData x_
Definition: uidatapointsetcrossplot.h:111
bool mousepressed_
Definition: uidatapointsetcrossplot.h:310
bool showy3_
Definition: uidatapointsetcrossplot.h:307
TypeSet< uiDataPointSet::DColID > modcolidxs_
Definition: uidatapointsetcrossplot.h:334
bool selRowIsY2() const
Definition: uidatapointsetcrossplot.h:89
Math::Expression * mathObj() const
Definition: uidatapointsetcrossplot.h:183
LinePars & userdefy1lp_
Definition: uidatapointsetcrossplot.h:170
uiGraphicsItemGroup * yptitems_
Definition: uidatapointsetcrossplot.h:288
bool drawuserdefline_
Definition: uidatapointsetcrossplot.h:313
Setup & setup()
Definition: uidatapointsetcrossplot.h:72
DataPointSet crossplotter.
Definition: uidatapointsetcrossplot.h:47
Definition: uistring.h:89
Definition: uiparent.h:26
linear stats in 2D.
Definition: linear.h:74
float plotperc_
Definition: uidatapointsetcrossplot.h:317
void setModifiedColIds(const TypeSet< uiDataPointSet::DColID > &ids)
Definition: uidatapointsetcrossplot.h:184
Maps data values to colortable positions: [0,1].
Definition: coltabmapper.h:84
Notifier< uiDataPointSetCrossPlotter > dataChgd
Definition: uidatapointsetcrossplot.h:82
AxisData::AutoScalePars & autoScalePars(int ax)
Definition: uidatapointsetcrossplot.h:153
bool isy1selectable_
Definition: uidatapointsetcrossplot.h:340
int nrYSels() const
Definition: uidatapointsetcrossplot.h:197
DataPointSet & dps()
Definition: uidatapointsetcrossplot.h:190
uiDataPointSetCrossPlotter & cp_
Definition: uidatapointsetcrossplot.h:105
BufferString & y1rmserr_
Definition: uidatapointsetcrossplot.h:176
int cellsize_
Definition: uidatapointsetcrossplot.h:323
Setup setup_
Definition: uidatapointsetcrossplot.h:281
bool isADensityPlot() const
Definition: uidatapointsetcrossplot.h:218
ColTab::Sequence y4ctab_
Definition: uidatapointsetcrossplot.h:301
uiGraphicsItemGroup * selpolyitems_
Definition: uidatapointsetcrossplot.h:291
const ColTab::Sequence & y4CtSeq() const
Definition: uidatapointsetcrossplot.h:270
uiAxisHandler * axisHandler(int ax)
Definition: uidatapointsetcrossplot.h:155
AxisData y2_
Definition: uidatapointsetcrossplot.h:113
bool showY4() const
Definition: uidatapointsetcrossplot.h:215
Definition: uidatapointsetcrossplot.h:94
DataPointSet::ColID colid_
Definition: uidatapointsetcrossplot.h:106
int curselarea_
Definition: uidatapointsetcrossplot.h:321
Definition: uigraphicsitem.h:157
int curgrp_
Definition: uidatapointsetcrossplot.h:318
TypeSet< Color > y2grpcols_
Definition: uidatapointsetcrossplot.h:329
DataPointSet::RowID DRowID
Definition: uidatapointset.h:51
uiLineItem * regrlineitm_
Definition: uidatapointsetcrossplot.h:292
TypeSet< Color > y1grpcols_
Definition: uidatapointsetcrossplot.h:328
encapsulates the read-access-only part of strings in OD.
Definition: odstring.h:31
DataPointSet::RowID selrow_
Definition: uidatapointsetcrossplot.h:325
Definition: uidatapointsetcrossplot.h:51
LinePars & userdefy2lp_
Definition: uidatapointsetcrossplot.h:171
bool isSceneSelectable() const
Definition: uidatapointsetcrossplot.h:142
LinStats2D & lsy1_
Definition: uidatapointsetcrossplot.h:304
Math::Expression * mathobj_
Definition: uidatapointsetcrossplot.h:282
Data Point Set Cross Plotter Main window.
Definition: uidatapointsetcrossplotwin.h:28
Definition: uigraphicsitemimpl.h:255
void setRectSelection(bool yn)
Definition: uidatapointsetcrossplot.h:222
int curGroup() const
Definition: uidatapointsetcrossplot.h:232
AxisData & axisData(int ax)
Definition: uidatapointsetcrossplot.h:162
TypeSet< Color > & y1grpColors()
Definition: uidatapointsetcrossplot.h:200
#define mDefSetupMemb(typ, memb)
Definition: commondefs.h:137
bool rectangleselection_
Definition: uidatapointsetcrossplot.h:311
const uiDataPointSet & uidps() const
Definition: uidatapointsetcrossplot.h:192
Setup class for colortable Mapper.
Definition: coltabmapper.h:35
bool multclron_
Definition: uidatapointsetcrossplot.h:342
const DataPointSet::ColID mincolid_
Definition: uidatapointsetcrossplot.h:324
bool isY1Selectable() const
Definition: uidatapointsetcrossplot.h:210
void setCurSelGrp(int grp)
Definition: uidatapointsetcrossplot.h:235
Definition: uigraphicscoltab.h:26
const TypeSet< int > & modifiedColIds() const
Definition: uidatapointsetcrossplot.h:187
Notifier< uiDataPointSetCrossPlotter > selectionChanged
Definition: uidatapointsetcrossplot.h:85
Definition: uigeom.h:78
IdxPair used for its row() and col().
Definition: rowcol.h:25
Notifier< uiDataPointSetCrossPlotter > removeRequest
Definition: uidatapointsetcrossplot.h:84
Parsed Math expression.
Definition: mathexpression.h:32
Definition: uigraphicsitemimpl.h:214
Provides a canvas where a uiRGBArray is pre-drawn.
Definition: uirgbarraycanvas.h:36
bool isY2Selectable() const
Definition: uidatapointsetcrossplot.h:212
const ObjectSet< SelectionGrp > & selectionGrps() const
Definition: uidatapointsetcrossplot.h:229
uiColTabItem * y1overlayctitem_
Definition: uidatapointsetcrossplot.h:295
const ColTab::Mapper & y4Mapper() const
Definition: uidatapointsetcrossplot.h:268
OD::String with its own variable length buffer. The buffer has a guaranteed minimum size...
Definition: bufstring.h:40
Array1D< char > * y2rowidxs_
Definition: uidatapointsetcrossplot.h:333
Array1D< char > * yrowidxs_
Definition: uidatapointsetcrossplot.h:332
int y4Colid() const
Definition: uidatapointsetcrossplot.h:266
int curselgrp_
Definition: uidatapointsetcrossplot.h:322
Edit DataPointSet.
Definition: uidatapointset.h:44
void setMultiColMode(bool yn)
Definition: uidatapointsetcrossplot.h:245
uiGraphicsItemGroup * selrectitems_
Definition: uidatapointsetcrossplot.h:290
ColTab::Mapper y4mapper_
Definition: uidatapointsetcrossplot.h:303
int nrY2Sels() const
Definition: uidatapointsetcrossplot.h:198
Notifier< uiDataPointSetCrossPlotter > mouseReleased
Definition: uidatapointsetcrossplot.h:81
Notifier< uiDataPointSetCrossPlotter > pointsSelected
Definition: uidatapointsetcrossplot.h:83
int selyitems_
Definition: uidatapointsetcrossplot.h:319
uiPolyLineItem * y1userdefpolylineitm_
Definition: uidatapointsetcrossplot.h:293
bool drawy2userdefpolyline_
Definition: uidatapointsetcrossplot.h:315
Notifier< uiDataPointSetCrossPlotter > lineDrawn
Definition: uidatapointsetcrossplot.h:80
Definition: math2.h:29
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 curSelGrp() const
Definition: uidatapointsetcrossplot.h:236
CNotifier< uiDataPointSetCrossPlotter, Interval< float > > coltabRgChanged
Definition: uidatapointsetcrossplot.h:87
const TypeSet< RowCol > & getSelectedCells()
Definition: uidatapointsetcrossplot.h:195
bool isdensityplot_
Definition: uidatapointsetcrossplot.h:312
ObjectSet< SelectionGrp > & selectionGrps()
Definition: uidatapointsetcrossplot.h:228
uiDataPointSet & uidps_
Definition: uidatapointsetcrossplot.h:279
DataPointSet::RowID selRow() const
Definition: uidatapointsetcrossplot.h:88
ColTab::Sequence ctab_
Definition: uidatapointsetcrossplot.h:298
int y3Colid() const
Definition: uidatapointsetcrossplot.h:265
ColTab::Mapper ctmapper_
Definition: uidatapointsetcrossplot.h:299
const DataPointSet & dps() const
Definition: uidatapointsetcrossplot.h:189
int sely2items_
Definition: uidatapointsetcrossplot.h:320
Timer class.
Definition: timer.h:25
const AxisData & axisData(int ax) const
Definition: uidatapointsetcrossplot.h:164
Interval< int > usedxpixrg_
Definition: uidatapointsetcrossplot.h:326
const OD::String & mathObjStr() const
Definition: uidatapointsetcrossplot.h:182
BufferString mathobjstr_
Definition: uidatapointsetcrossplot.h:283
AxisData y_
Definition: uidatapointsetcrossplot.h:112
int y3colid_
Definition: uidatapointsetcrossplot.h:276
BufferString & userdefy2str_
Definition: uidatapointsetcrossplot.h:174
Definition: mouseevent.h:73
ObjectSet< SelectionGrp > selgrpset_
Definition: uidatapointsetcrossplot.h:339
bool isMultiColMode() const
Definition: uidatapointsetcrossplot.h:247
Side
Definition: uigeom.h:46
int y4colid_
Definition: uidatapointsetcrossplot.h:277
const uiAxisHandler * axisHandler(int ax) const
Definition: uidatapointsetcrossplot.h:157
Definition: uigraphicsitemimpl.h:110
CNotifier< uiDataPointSetCrossPlotter, bool > drawTypeChanged
Definition: uidatapointsetcrossplot.h:86
uiDataPointSet & uidps()
Definition: uidatapointsetcrossplot.h:193
bool isy2selectable_
Definition: uidatapointsetcrossplot.h:341
ColTab::Sequence y3ctab_
Definition: uidatapointsetcrossplot.h:300
uiPolygonItem * selectionpolygonitem_
Definition: uidatapointsetcrossplot.h:286
int cellSize() const
Definition: uidatapointsetcrossplot.h:249
void setTRMsg(const uiString &msg)
Definition: uidatapointsetcrossplot.h:241
const ColTab::Sequence & y3CtSeq() const
Definition: uidatapointsetcrossplot.h:269

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