FilePTS.hh 7.05 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//================================================================
//
/*===========================================================================*\
*                                                                            *
*                              OpenFlipper                                   *
*      Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen       *
*                           www.openflipper.org                              *
*                                                                            *
*--------------------------------------------------------------------------- *
*  This file is part of OpenFlipper.                                         *
*                                                                            *
*  OpenFlipper is free software: you can redistribute it and/or modify       *
*  it under the terms of the GNU Lesser General Public License as            *
*  published by the Free Software Foundation, either version 3 of            *
*  the License, or (at your option) any later version with the               *
*  following exceptions:                                                     *
*                                                                            *
*  If other files instantiate templates or use macros                        *
*  or inline functions from this file, or you compile this file and          *
*  link it with other files to produce an executable, this file does         *
*  not by itself cause the resulting executable to be covered by the         *
*  GNU Lesser General Public License. This exception does not however        *
*  invalidate any other reasons why the executable file might be             *
*  covered by the GNU Lesser General Public License.                         *
*                                                                            *
*  OpenFlipper is distributed in the hope that it will be useful,            *
*  but WITHOUT ANY WARRANTY; without even the implied warranty of            *
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             *
*  GNU Lesser General Public License for more details.                       *
*                                                                            *
*  You should have received a copy of the GNU LesserGeneral Public           *
*  License along with OpenFlipper. If not,                                   *
*  see <http://www.gnu.org/licenses/>.                                       *
*                                                                            *
\*===========================================================================*/

/*===========================================================================*\
*                                                                            *
*   $Revision$                                                       *
*   $LastChangedBy$                                                *
*   $Date$                     *
*                                                                            *
\*===========================================================================*/

45
46
47

//================================================================
//
Jan Möbius's avatar
Jan Möbius committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//  CLASS FilePTSPlugin
//
//    This class is the base class for loading and saving (reading/writing) SplatCloud objects from/to disc.
//
//================================================================


#ifndef FILEPTSPLUGIN_HH
#define FILEPTSPLUGIN_HH


//== INCLUDES ====================================================


#include <QObject>

#include <OpenFlipper/BasePlugin/BaseInterface.hh>
#include <OpenFlipper/BasePlugin/FileInterface.hh>
#include <OpenFlipper/BasePlugin/LoadSaveInterface.hh>
#include <OpenFlipper/BasePlugin/LoggingInterface.hh>
#include <OpenFlipper/BasePlugin/ScriptInterface.hh>

#include <OpenFlipper/common/Types.hh>

#include <ObjectTypes/SplatCloud/SplatCloud.hh>


//== CLASS DEFINITION ============================================


Jan Möbius's avatar
Jan Möbius committed
78
class FilePTSPlugin : public QObject, BaseInterface, FileInterface, LoadSaveInterface, LoggingInterface, ScriptInterface
Jan Möbius's avatar
Jan Möbius committed
79
{
80
81
82
83
84
85
  Q_OBJECT
  Q_INTERFACES( FileInterface     )
  Q_INTERFACES( LoadSaveInterface )
  Q_INTERFACES( LoggingInterface  )
  Q_INTERFACES( BaseInterface     )
  Q_INTERFACES( ScriptInterface   )
Jan Möbius's avatar
Jan Möbius committed
86
87
88

signals:

89
  // -- File Interface --
90
  void openedFile( int _objectId );
Jan Möbius's avatar
Jan Möbius committed
91

92
  // -- LoadSave Interface --
93
  void addEmptyObject( DataType _type, int &_objectId );
94
  void deleteObject ( int _objectId );
95
  void updatedObject( int _objectId, const UpdateType &_type );
Jan Möbius's avatar
Jan Möbius committed
96

97
  //-- Logging Interface --
98
  void log(                QString _message );
99
  void log( Logtype _type, QString _message );
Jan Möbius's avatar
Jan Möbius committed
100
101
102

private slots:

103
104
  // -- Base Interface --
  void noguiSupported() { }
Jan Möbius's avatar
Jan Möbius committed
105
106
107

public:

108
109
110
  // standard constructor/destructor
  FilePTSPlugin();
  ~FilePTSPlugin() { }
Jan Möbius's avatar
Jan Möbius committed
111

112
  //-- Base Interface --
113
  QString name()         { return QString(    "FilePTS"                            ); }
114
  QString description( ) { return QString( tr("Load/Save SplatCloud format files") ); }
Jan Möbius's avatar
Jan Möbius committed
115

116
117
  // -- File Interface --
  DataType supportedType() { return DATA_SPLATCLOUD; }
Jan Möbius's avatar
Jan Möbius committed
118

119
120
121
122
123
  // -- File Interface --
  QString getSaveFilters() { return QString( tr("SplatCloud format files ( *.pts *.bin )") ); }
  QString getLoadFilters() { return QString( tr("SplatCloud format files ( *.pts *.bin )") ); }
  QWidget *saveOptionsWidget( QString /*_currentFilter*/ );
  QWidget *loadOptionsWidget( QString /*_currentFilter*/ );
Jan Möbius's avatar
Jan Möbius committed
124
125
126

public slots:

127
128
  // -- Base Interface --
  QString version() { return QString( "1.0" ); }
Jan Möbius's avatar
Jan Möbius committed
129

130
  // -- File Interface --
131
  int  loadObject(                QString _filename );
132
  bool saveObject( int _objectId, QString _filename );
Jan Möbius's avatar
Jan Möbius committed
133
134
135

private:

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  // read binary/text file from disc to scenegraph node
  bool readBinaryFile( const char *_filename, SplatCloud &_splatCloud ) /*const*/;
  bool readTextFile  ( const char *_filename, SplatCloud &_splatCloud ) /*const*/;

  // write binary/text file from scenegraph node to disc
  bool writeBinaryFile( const char *_filename, const SplatCloudNode *_splatCloudNode ) /*const*/;
  bool writeTextFile  ( const char *_filename, const SplatCloudNode *_splatCloudNode ) /*const*/;

  // widgets
  QWidget *loadOptions_;
  QWidget *saveOptions_;

  // options in the loading menu
  QCheckBox *loadBinaryFile_;
  QCheckBox *loadNormals_;
  QCheckBox *loadPointsizes_;
  QCheckBox *loadColors_;
  QComboBox *loadColorRange_;
  QCheckBox *loadIndices_;

  // options in the saving menu
  QCheckBox *saveBinaryFile_;
  QCheckBox *saveNormals_;
  QCheckBox *savePointsizes_;
  QCheckBox *saveColors_;
  QComboBox *saveColorRange_;
  QCheckBox *saveIndices_;

  // buttons
  QPushButton *loadMakeDefaultButton_;
  QPushButton *saveMakeDefaultButton_;
Jan Möbius's avatar
Jan Möbius committed
167
168
169

private slots:

170
171
172
  // slots called when the Load/Save colors checkbox or binaryfile checkbox was clicked
  void slotUpdateLoadColorRange();
  void slotUpdateSaveColorRange();
Jan Möbius's avatar
Jan Möbius committed
173

174
175
176
  // slots called when user wants to save the given Load/Save Options as default
  void slotLoadMakeDefaultButtonClicked();
  void slotSaveMakeDefaultButtonClicked();
Jan Möbius's avatar
Jan Möbius committed
177
178
179
180
181
182
183
};


//================================================================


#endif // FILEPTSPLUGIN_HH