ODIN
float3d.h
1 /***************************************************************************
2  float3d.h - description
3  -------------------
4  begin : Thu Nov 10 2005
5  copyright : (C) 2000-2021 by Thies Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef FLOAT3D_H
19 #define FLOAT3D_H
20 
21 #include <qgroupbox.h>
22 
23 #include "float2d.h"
24 
25 
29 class floatBox3D : public QGroupBox {
30  Q_OBJECT
31 
32  public:
33  floatBox3D(const float *data, float lowbound, float uppbound, long int nx, long int ny, long int nz,
34  bool disable_scale, int coarseFactor, QWidget *parent, const char *name,
35  const float *overlay_map=0, float lowbound_map=0.0, float uppbound_map=0.0, unsigned int nx_map=0, unsigned int ny_map=0, unsigned int nz_map=0, bool map_firescale=false, float map_rectsize=0.8,
36  bool colormap=false);
37  ~floatBox3D();
38 
39 
40  void write_pixmap(const char* fname, const char* format, bool dump_all=false) const;
41 
42  QLabel* get_map_legend(QWidget* parent) const {return label->get_map_legend(parent);}
43  void write_legend(const char* fname, const char* format) const {label->write_legend(fname, format);}
44  void write_map_legend(const char* fname, const char* format) const {label->write_map_legend(fname, format);}
45 
46  int get_current_z() const;
47 
48  public slots:
49  void refresh(const float* data, float lowbound, float uppbound);
50  void refreshMap(const float* map, float lowbound_map, float uppbound_map, float rectsize) {map_cache=map; label->refreshMap(map_cache+onemapsize*get_current_z(),lowbound_map,uppbound_map,rectsize);}
51 
52  private slots:
53  void emitClicked(int xposition, int yposition) {emit clicked(xposition,yposition,get_current_z());}
54  void emitNewProfile(const float *data, int npts, bool horizontal, int position) {emit newProfile(data, npts, horizontal, position);}
55  void emitNewMask(const float *data) {emit newMask(data,get_current_z());}
56 
57  protected slots:
58  void changez(int iz);
59 
60 
61  signals:
62  void clicked(int x, int y, int z);
63  void newProfile(const float *data, int npts, bool horizontal, int position);
64  void newMask(const float* data, int slice);
65 
66  protected:
67 
68  floatLabel2D* label; // GeoEditLabel needs access to it
69 
70  private:
71 
72  virtual void repaint() {} // overload this function to draw additional stuff after changez
73 
74  void repaint_slice(int iz) const;
75 
76  GuiSlider* zslider;
77  QLabel* zval;
78 
79  GuiGridLayout *grid;
80 
81  QLabel* maplegend;
82 
83  const float* data_cache;
84  unsigned int oneimagesize;
85  unsigned int nz_cache;
86  float lowbound_cache;
87  float uppbound_cache;
88 
89  const float* map_cache;
90  float lowbound_map_cache;
91  float uppbound_map_cache;
92  float rectsize_map_cache;
93 
94  unsigned int onemapsize;
95 
96  float* mask3d;
97 };
98 
99 #endif