float3d.h
1 /***************************************************************************
2  float3d.h - description
3  -------------------
4  begin : Thu Nov 10 2005
5  copyright : (C) 2000-2015 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 
47  public slots:
48  void refresh(const float* data, float lowbound, float uppbound);
49  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);}
50 
51  private slots:
52  void emitClicked(int xposition, int yposition) {emit clicked(xposition,yposition,get_current_z());}
53  void emitNewProfile(const float *data, int npts, bool horizontal, int position) {emit newProfile(data, npts, horizontal, position);}
54  void emitNewMask(const float *data) {emit newMask(data,get_current_z());}
55 
56  protected slots:
57  void changez(int iz);
58 
59 
60  signals:
61  void clicked(int x, int y, int z);
62  void newProfile(const float *data, int npts, bool horizontal, int position);
63  void newMask(const float* data, int slice);
64 
65  protected:
66 
67  floatLabel2D* label; // GeoEditLabel needs access to it
68 
69  int get_current_z() const;
70 
71  private:
72 
73  virtual void repaint() {} // overload this function to draw additional stuff after changez
74 
75  void repaint_slice(int iz) const;
76 
77  GuiSlider* zslider;
78  QLabel* zval;
79 
80  GuiGridLayout *grid;
81 
82  QLabel* maplegend;
83 
84  const float* data_cache;
85  unsigned int oneimagesize;
86  unsigned int nz_cache;
87  float lowbound_cache;
88  float uppbound_cache;
89 
90  const float* map_cache;
91  float lowbound_map_cache;
92  float uppbound_map_cache;
93  float rectsize_map_cache;
94 
95  unsigned int onemapsize;
96 
97  float* mask3d;
98 };
99 
100 #endif