rasdaman complete source
rviewThumb.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
23 
42 #ifndef _RVIEW_THUMB_H_
43 #define _RVIEW_THUMB_H_
44 
45 
46 
47 
48 #include "rasodmg/ref.hh"
49 #include "rasodmg/marray.hh"
50 #include "rasodmg/gmarray.hh"
51 
52 #include "labelManager.hh"
53 #include "rviewUtils.hh"
54 #include "rviewDisplay.hh"
55 #include "rviewDModes.hh"
56 
57 
58 
59 
60 class wxPixmap;
61 class rviewThumb;
62 
63 
64 // List holding all the pixmap items for one mddObject.
65 // This chain is 1 item long for 2D data, but can be any length
66 // for higher dimensions
67 typedef struct rviewThumbPixList
68 {
69  wxPixmap *pixmap;
70  int dimproj, projval;
71  rviewThumbPixList *next;
72 } rviewThumbPixList;
73 
74 // List holding mdd/pixmap items
75 typedef struct rviewThumbList
76 {
77  r_Ref<r_GMarray> mdd;
78  rviewBaseType baseType;
79  int numPix;
80  rviewThumbPixList *pixmaps;
81  rviewThumbList *next;
82 } rviewThumbList;
83 
84 
85 
86 
87 /*
88  * The canvas displaying the thumbnails
89  */
90 class thumbCanvas: public wxCanvas
91 {
92 public:
93 
94  thumbCanvas(rviewThumb *par, int x, int y, int width, int height);
95  ~thumbCanvas(void);
96 
97  void OnPaint(void);
98  void updateDisplay(void);
99 
100 
101 protected:
102 
103  wxBrush brush;
104  rviewThumb *parent;
105 };
106 
107 
108 
109 /*
110  * A window containing small versions of images
111  */
112 class rviewThumb: public rviewFrame
113 {
114 public:
115 
116  rviewThumb(void);
117  ~rviewThumb(void);
118 
119  int addMDD(r_Ref<r_GMarray> &newMdd);
120  int deleteMDD(r_Ref<r_GMarray> &obsMdd);
121  void setLayout(int width, int npl);
122  void newThumbWidth(int newWidth);
123 
124  void label(void);
125  int process(wxObject &obj, wxEvent &evt);
126  virtual const char *getFrameName(void) const;
127  virtual rviewFrameType getFrameType(void) const;
128 
129  void OnSize(int w, int h);
130  void OnMenuCommand(int id);
131 
132  int userEvent(const user_event &ue);
133 
134  // Used by canvas to get data
135  wxPixmap *getPixmapNumber(int no, char *caption);
136  void getThumbInfo(int &num, int &npl);
137  void getGridInfo(int &gx, int &gy);
138 
139  // constants
140  // Initial dimensions of window
141  static const int thumb_width;
142  static const int thumb_height;
143  // Default width of thumbnail images
144  static const int thumb_imgwidth;
145  // Default number of thumbnails per line
146  static const int thumb_perline;
147  // Space between thumbnails
148  static const int thumb_space;
149  // Borders used in thumbnail window
150  static const int thumb_border;
151  // Scrolling values
152  static const int thumb_scrstep;
153  static const int thumb_pgstep;
154  // Dimensions of checkboxs
155  static const int thumb_chkwidth;
156  static const int thumb_chkheight;
157  // Minimum / maximum width of thumbnails
158  static const int thumb_minwidth;
159  static const int thumb_maxwidth;
160  // Minimum / maximum number of thumbnails per line
161  static const int thumb_mincols;
162  static const int thumb_maxcols;
163  // Height of control panel at the top
164  static const int thumb_cheight;
165  // Height of text items
166  static const int thumb_twidth;
167  static const int thumb_theight;
168  // Width of projDim / step widgets
169  static const int thumb_prjwidth;
170 
171 
172 protected:
173 
174  void deletePixmapChain(rviewThumbList *tlst);
175  int pixmapsFromMDD(rviewThumbList *tlst);
176  wxPixmap *buildThumbnail(r_Ref<r_GMarray> &mddObj, rviewBaseType baseType, int dimproject, int projval);
177  void updateCanvasSize(void);
178  void rebuildThumbnails(bool fromScratch);
179  void initForObject(r_Ref<r_GMarray> &mddObj);
180  int parseProjection(r_Ref<r_GMarray> &mddObj);
181  void configureCspace(bool mode);
182 
183  char projString[STRINGSIZE];
184  r_Point pt1, pt2, mapIndex;
185  int thumbs, thumbsperline, numPixmaps;
186  int maxHeight;
187  int gridX, gridY;
188  int imgWidth;
189  int dimMDD; // should be constant for all objects!
190  int dim1, dim2; // dimensions to iterate over
191  int dimproj; // projection dim for 3+D objects
192  int projstep; // stepping value in dimproj
193  unsigned int freeDims;
194  rviewThumbList *listHead;
195  thumbCanvas *canvas;
196  wxMenuBar *mbar;
197  wxPanel *panel;
198  rviewText *thumbWidth;
199  rviewText *thumbCols;
200  rviewText *project;
201  rviewText *thumbProj, *thumbStep;
202  wxFont *font;
203  colourspaceMapper *csmap;
204  bool doValToCspace;
205  bool doFullRangeCspace;
206  bool canDoCspace;
207 };
208 
209 #endif