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;
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];
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;
196  wxMenuBar *mbar;
197  wxPanel *panel;
202  wxFont *font;
207 };
208 
209 #endif
static const int thumb_imgwidth
Definition: rviewThumb.hh:144
int gridX
Definition: rviewThumb.hh:187
rviewThumbList * listHead
Definition: rviewThumb.hh:194
char projString[STRINGSIZE]
Definition: rviewThumb.hh:183
int dimproj
Definition: rviewThumb.hh:191
void label(void)
void deletePixmapChain(rviewThumbList *tlst)
thumbCanvas * canvas
Definition: rviewThumb.hh:195
int process(wxObject &obj, wxEvent &evt)
Definition: point.hh:59
static const int thumb_cheight
Definition: rviewThumb.hh:164
rviewText * thumbStep
Definition: rviewThumb.hh:201
colourspaceMapper * csmap
Definition: rviewThumb.hh:203
wxMenuBar * mbar
Definition: rviewThumb.hh:196
int parseProjection(r_Ref< r_GMarray > &mddObj)
void OnPaint(void)
Definition: rviewUtils.hh:482
rviewThumb * parent
Definition: rviewThumb.hh:104
r_Point mapIndex
Definition: rviewThumb.hh:184
void OnSize(int w, int h)
static const int thumb_scrstep
Definition: rviewThumb.hh:152
~thumbCanvas(void)
int gridY
Definition: rviewThumb.hh:187
static const int thumb_chkheight
Definition: rviewThumb.hh:156
virtual rviewFrameType getFrameType(void) const
int dim2
Definition: rviewThumb.hh:190
thumbCanvas(rviewThumb *par, int x, int y, int width, int height)
Definition: rviewUtils.hh:636
void getThumbInfo(int &num, int &npl)
Definition: rviewThumb.hh:90
static const int thumb_twidth
Definition: rviewThumb.hh:166
void newThumbWidth(int newWidth)
wxFont * font
Definition: rviewThumb.hh:202
int dim1
Definition: rviewThumb.hh:190
Definition: rviewColMap.hh:193
bool doValToCspace
Definition: rviewThumb.hh:204
void configureCspace(bool mode)
void updateDisplay(void)
~rviewThumb(void)
int numPixmaps
Definition: rviewThumb.hh:185
int deleteMDD(r_Ref< r_GMarray > &obsMdd)
rviewText * thumbProj
Definition: rviewThumb.hh:201
int dimMDD
Definition: rviewThumb.hh:189
static const int thumb_minwidth
Definition: rviewThumb.hh:158
static const int thumb_width
Definition: rviewThumb.hh:141
unsigned int freeDims
Definition: rviewThumb.hh:193
void initForObject(r_Ref< r_GMarray > &mddObj)
rviewFrameType
Definition: rviewUtils.hh:443
rviewText * project
Definition: rviewThumb.hh:200
int pixmapsFromMDD(rviewThumbList *tlst)
static const int thumb_height
Definition: rviewThumb.hh:142
static const int thumb_perline
Definition: rviewThumb.hh:146
int addMDD(r_Ref< r_GMarray > &newMdd)
void OnMenuCommand(int id)
bool canDoCspace
Definition: rviewThumb.hh:206
Definition: wx_pixmap.h:114
void updateCanvasSize(void)
int imgWidth
Definition: rviewThumb.hh:188
Definition: rviewUtils.hh:317
int userEvent(const user_event &ue)
static const int thumb_prjwidth
Definition: rviewThumb.hh:169
int thumbsperline
Definition: rviewThumb.hh:185
wxPixmap * buildThumbnail(r_Ref< r_GMarray > &mddObj, rviewBaseType baseType, int dimproject, int projval)
rviewBaseType
Definition: rviewUtils.hh:97
r_Point pt1
Definition: rviewThumb.hh:184
int thumbs
Definition: rviewThumb.hh:185
rviewText * thumbWidth
Definition: rviewThumb.hh:198
static const int thumb_maxwidth
Definition: rviewThumb.hh:159
virtual const char * getFrameName(void) const
static const int thumb_border
Definition: rviewThumb.hh:150
static const int thumb_chkwidth
Definition: rviewThumb.hh:155
bool doFullRangeCspace
Definition: rviewThumb.hh:205
static const int thumb_mincols
Definition: rviewThumb.hh:161
rviewThumb(void)
r_Point pt2
Definition: rviewThumb.hh:184
wxPixmap * getPixmapNumber(int no, char *caption)
static const int thumb_pgstep
Definition: rviewThumb.hh:153
rviewText * thumbCols
Definition: rviewThumb.hh:199
wxPanel * panel
Definition: rviewThumb.hh:197
static const int thumb_maxcols
Definition: rviewThumb.hh:162
Definition: rviewThumb.hh:112
int projstep
Definition: rviewThumb.hh:192
void setLayout(int width, int npl)
void rebuildThumbnails(bool fromScratch)
static const int thumb_space
Definition: rviewThumb.hh:148
Definition: rviewThumb.hh:75
int maxHeight
Definition: rviewThumb.hh:186
void getGridInfo(int &gx, int &gy)
wxBrush brush
Definition: rviewThumb.hh:103
static const int thumb_theight
Definition: rviewThumb.hh:167