mvdDatasetModel.h 6.31 KB
Newer Older
1
2
3
4
5
6
7
/*=========================================================================

  Program:   Monteverdi2
  Language:  C++


  Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
8
  See Copyright.txt for details.
9

10
11
12
  Monteverdi2 is distributed under the CeCILL licence version 2. See
  Licence_CeCILL_V2-en.txt or
  http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt for more details.
13

14
15
16
  This software is distributed WITHOUT ANY WARRANTY; without even
  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  PURPOSE.  See the above copyright notices for more information.
17
18
19
20
21
22
23

=========================================================================*/

#ifndef __mvdDatasetModel_h
#define __mvdDatasetModel_h

//
24
25
26
// Configuration include.
//// Included at first position before any other ones.
#include "ConfigureMonteverdi2.h"
27

28
29
30
31

/*****************************************************************************/
/* INCLUDE SECTION                                                           */

32
33
//
// Qt includes (sorted by alphabetic order)
34
35
36
37
//// Must be included before system/custom includes.

//
// System includes (sorted by alphabetic order)
38
39
40
41
42
43
44
45
46
47

//
// ITK includes (sorted by alphabetic order)

//
// OTB includes (sorted by alphabetic order)

//
// Monteverdi includes (sorted by alphabetic order)
#include "mvdAbstractModel.h"
48
#include "mvdTypes.h"
49

50
51
52
53

/*****************************************************************************/
/* PRE-DECLARATION SECTION                                                   */

54
55
56
57
58
59
60
61
62
63
//
// External classes pre-declaration.
namespace
{
}

namespace mvd
{
//
// Internal classes pre-declaration.
64
class AbstractImageModel;
65
class DatasetDescriptor;
66
67
68

/*****************************************************************************/
/* CLASS DEFINITION SECTION                                                  */
69
70
71
72
73
74
75

/** \class DatasetModel
 *
 */
class Monteverdi2_EXPORT DatasetModel :
    public AbstractModel
{
76
77
78

  /*-[ QOBJECT SECTION ]-----------------------------------------------------*/

79
80
  Q_OBJECT;

81
82
  /*-[ PUBLIC SECTION ]------------------------------------------------------*/

83
84
85
//
// Public types.
public:
86
87
88
89
90
  /**
   */
  typedef QList< const AbstractImageModel* > ConstAbstractImageModelList;
  typedef QList< AbstractImageModel* > AbstractImageModelList;

91
92
93
94
95
96
97
98
99
  /**
   * \class BuildContext
   * \brief WIP.
   */
  class BuildContext
  {
    //
    // Public methods.
  public:
Mickael Savinaud's avatar
Mickael Savinaud committed
100
    BuildContext( const QString& path, const QString& name, int width, int height ) :
101
      m_Path( path ),
Mickael Savinaud's avatar
Mickael Savinaud committed
102
103
104
      m_Name( name ),
      m_Width(width),
      m_Height(height)
105
106
107
108
109
110
111
112
    {
    }

    //
    // Public attributes
  public:
    QString m_Path;
    QString m_Name;
Mickael Savinaud's avatar
Mickael Savinaud committed
113
114
    int m_Width;
    int m_Height;
115
116
  };

117
118
119
120
//
// Public methods.
public:

121
  /** \brief Constructor. */
122
123
  DatasetModel( QObject* parent =NULL );

124
  /** \brief Destructor. */
125
126
  virtual ~DatasetModel();

127
128
129
  /**
   */
  inline const QDir& GetDirectory() const;
130

131
132
133
134
135
136
137
138
  /**
   */
  inline const QString& GetName() const;

  /**
   */
  inline const QString& GetPath() const;

139
  /** */
140
  void ImportImage( const QString& filename, int w, int h );
141
142
143
144
145
146
147
148
149
150

  /** */
  inline bool HasSelectedImageModel() const;

  /** */
  inline const AbstractImageModel* GetSelectedImageModel() const;

  /** */
  inline AbstractImageModel* GetSelectedImageModel();

151
152
  /**
   */
153
  inline ConstAbstractImageModelList GetImageModels() const;
154

155
156
157
158
  /**
   */
  void Save() const;

159
160
161
162
163
  //
  // AbstractModel overrides.

  virtual bool IsModified() const;

164
165
  /*-[ SIGNALS SECTION ]-----------------------------------------------------*/

166
//
167
// Signals.
168
169
signals:

170
171
  /*-[ PROTECTED SECTION ]---------------------------------------------------*/

172
173
174
175
//
// Protected methods.
protected:

176
177
178
179
  //
  // AbstractModel overrides.

  /** */
180
  virtual void virtual_BuildModel( void* context =NULL );
181

182
183
184
185
//
// Protected attributes.
protected:

186
187
  /*-[ PRIVATE SECTION ]-----------------------------------------------------*/

188
189
190
191
192
193
194
//
// Private attributes.
private:
  /**
   */
  static const char* DESCRIPTOR_FILENAME;

195
196
197
198
//
// Private methods.
private:

199
200
201
202
  /**
   */
  inline AbstractImageModelList GetImageModels();

203
  /** */
204
205
206
  void LoadImage( const QString& filename, bool foo, int width, int height );

  /** */
Mickael Savinaud's avatar
Mickael Savinaud committed
207
  void ParseDescriptor(BuildContext* bContext );
208

209
210
211
  /** */
  void WriteDescriptor() const;

212
213
214
//
// Private attributes.
private:
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
  /**
   */
  DatasetDescriptor* m_Descriptor;

  /**
   */
  QString m_Path;

  /**
   */
  QString m_Name;

  /**
   */
  QDir m_Directory;
230

231
232
  /*-[ PRIVATE SLOTS SECTION ]-----------------------------------------------*/

233
//
234
// Slots.
235
236
237
238
239
private slots:
};

} // end namespace 'mvd'

240
241
242
243
244
245
246
247
248
249
/*****************************************************************************/
/* INLINE SECTION                                                            */

//
// Monteverdi deferred includes (sorted by alphabetic order)
#include "mvdAbstractImageModel.h"

namespace mvd
{

250
251
252
253
254
255
256
257
258
/*****************************************************************************/
inline
const QDir&
DatasetModel
::GetDirectory() const
{
  return m_Directory;
}

259
/*****************************************************************************/
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
inline
const QString&
DatasetModel
::GetPath() const
{
  return m_Path;
}

/*****************************************************************************/
inline
const QString&
DatasetModel
::GetName() const
{
  return m_Name;
}

/*****************************************************************************/
278
279
280
281
282
inline
bool
DatasetModel
::HasSelectedImageModel() const
{
283
  return !GetImageModels().empty();
284
285
286
287
288
289
290
291
}

/*****************************************************************************/
inline
const AbstractImageModel*
DatasetModel
::GetSelectedImageModel() const
{
292
  return GetImageModels().first();
293
294
295
296
297
298
299
300
}

/*****************************************************************************/
inline
AbstractImageModel*
DatasetModel
::GetSelectedImageModel()
{
301
  return GetImageModels().first();
302
303
304
}

/*****************************************************************************/
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
inline
DatasetModel::ConstAbstractImageModelList
DatasetModel
::GetImageModels() const
{
  return findChildren< const AbstractImageModel* >();
}

/*****************************************************************************/
inline
DatasetModel::AbstractImageModelList
DatasetModel
::GetImageModels()
{
  return findChildren< AbstractImageModel* >();
}
321
322
323

} // end namespace 'mvd'

324
#endif // __mvdDatasetModel_h