Developer Documentation
FilePTS.hh
1 //================================================================
2 //
3 /*===========================================================================*\
4 * *
5 * OpenFlipper *
6  * Copyright (c) 2001-2015, RWTH-Aachen University *
7  * Department of Computer Graphics and Multimedia *
8  * All rights reserved. *
9  * www.openflipper.org *
10  * *
11  *---------------------------------------------------------------------------*
12  * This file is part of OpenFlipper. *
13  *---------------------------------------------------------------------------*
14  * *
15  * Redistribution and use in source and binary forms, with or without *
16  * modification, are permitted provided that the following conditions *
17  * are met: *
18  * *
19  * 1. Redistributions of source code must retain the above copyright notice, *
20  * this list of conditions and the following disclaimer. *
21  * *
22  * 2. Redistributions in binary form must reproduce the above copyright *
23  * notice, this list of conditions and the following disclaimer in the *
24  * documentation and/or other materials provided with the distribution. *
25  * *
26  * 3. Neither the name of the copyright holder nor the names of its *
27  * contributors may be used to endorse or promote products derived from *
28  * this software without specific prior written permission. *
29  * *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
32  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
33  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
34  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
35  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
36  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
37  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
38  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
39  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
40  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
41 * *
42 \*===========================================================================*/
43 
44 /*===========================================================================*\
45 * *
46 * $Revision$ *
47 * $LastChangedBy$ *
48 * $Date$ *
49 * *
50 \*===========================================================================*/
51 
52 
53 //================================================================
54 //
55 // CLASS FilePTSPlugin
56 //
57 // This class is the base class for loading and saving (reading/writing) SplatCloud objects from/to disc.
58 //
59 //================================================================
60 
61 
62 #ifndef FILEPTSPLUGIN_HH
63 #define FILEPTSPLUGIN_HH
64 
65 
66 //== INCLUDES ====================================================
67 
68 
69 #include <QObject>
70 class QCheckBox;
71 class QComboBox;
72 class QPushButton;
73 
80 
82 
84 
85 
86 //== CLASS DEFINITION ============================================
87 
88 
90 {
91  Q_OBJECT
92  Q_INTERFACES( FileInterface )
93  Q_INTERFACES( LoadSaveInterface )
94  Q_INTERFACES( LoggingInterface )
95  Q_INTERFACES( BaseInterface )
96  Q_INTERFACES( ScriptInterface )
97  Q_INTERFACES( RPCInterface )
98 #if QT_VERSION >= 0x050000
99  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-FilePTS")
100 #endif
101 signals:
102 
103  // -- File Interface --
104  void openedFile( int _objectId );
105 
106  // -- LoadSave Interface --
107  void addEmptyObject( DataType _type, int &_objectId );
108  void deleteObject ( int _objectId );
109  void updatedObject( int _objectId, const UpdateType &_type );
110 
111  //-- Logging Interface --
112  void log( QString _message );
113  void log( Logtype _type, QString _message );
114 
115 private slots:
116 
117  // -- Base Interface --
118  void noguiSupported() { }
119 
120 public:
121 
122  // standard constructor/destructor
123  FilePTSPlugin();
124  ~FilePTSPlugin() { }
125 
126  //-- Base Interface --
127  QString name() { return QString( "FilePTS" ); }
128  QString description( ) { return QString( tr("Load/Save SplatCloud format files") ); }
129 
130  // -- File Interface --
132 
133  // -- File Interface --
134  QString getSaveFilters() { return QString( tr("SplatCloud format files ( *.pts *.bin )") ); }
135  QString getLoadFilters() { return QString( tr("SplatCloud format files ( *.pts *.bin )") ); }
136  QWidget *saveOptionsWidget( QString /*_currentFilter*/ );
137  QWidget *loadOptionsWidget( QString /*_currentFilter*/ );
138 
139 public slots:
140 
141  // -- Base Interface --
142  QString version() { return QString( "1.0" ); }
143 
144  // -- File Interface --
145  int loadObject( QString _filename );
146  bool saveObject( int _objectId, QString _filename );
147 
148 private:
149 
150  // read binary/text file from disc to scenegraph node
151  bool readBinaryFile( const char *_filename, SplatCloud &_splatCloud ) /*const*/;
152  bool readTextFile ( const char *_filename, SplatCloud &_splatCloud ) /*const*/;
153 
154  // write binary/text file from scenegraph node to disc
155  bool writeBinaryFile( const char *_filename, const SplatCloudNode *_splatCloudNode ) /*const*/;
156  bool writeTextFile ( const char *_filename, const SplatCloudNode *_splatCloudNode ) /*const*/;
157 
158  // widgets
159  QWidget *loadOptions_;
160  QWidget *saveOptions_;
161 
162  // options in the loading menu
163  QCheckBox *loadBinaryFile_;
164  QCheckBox *loadNormals_;
165  QCheckBox *loadPointsizes_;
166  QCheckBox *loadColors_;
167  QComboBox *loadColorRange_;
168  QCheckBox *loadIndices_;
169 
170  // options in the saving menu
171  QCheckBox *saveBinaryFile_;
172  QCheckBox *saveNormals_;
173  QCheckBox *savePointsizes_;
174  QCheckBox *saveColors_;
175  QComboBox *saveColorRange_;
176  QCheckBox *saveIndices_;
177 
178  // buttons
179  QPushButton *loadMakeDefaultButton_;
180  QPushButton *saveMakeDefaultButton_;
181 
182 private slots:
183 
184  // slots called when the Load/Save colors checkbox or binaryfile checkbox was clicked
185  void slotUpdateLoadColorRange();
186  void slotUpdateSaveColorRange();
187 
188  // slots called when user wants to save the given Load/Save Options as default
189  void slotLoadMakeDefaultButtonClicked();
190  void slotSaveMakeDefaultButtonClicked();
191 };
192 
193 
194 //================================================================
195 
196 
197 #endif // FILEPTSPLUGIN_HH
QString getLoadFilters()
Definition: FilePTS.hh:135
Predefined datatypes.
Definition: DataTypes.hh:96
Logtype
Log types for Message Window.
QWidget * loadOptionsWidget(QString)
Definition: FilePTS.cc:861
#define DATA_SPLATCLOUD
Definition: SplatCloud.hh:65
Interface for all Plugins which provide scriptable Functions.
Interface class from which all plugins have to be created.
Update type class.
Definition: UpdateType.hh:70
Interface for all Plugins which do logging to the logging window of the framework.
Interface class for file handling.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: FilePTS.hh:131
QWidget * saveOptionsWidget(QString)
Definition: FilePTS.cc:928
QString getSaveFilters()
Definition: FilePTS.hh:134
QString name()
Return a name for the plugin.
Definition: FilePTS.hh:127
Interface for all plugins which want to Load or Save files and create Objects.
Interface to call functions across plugins.
Definition: RPCInterface.hh:71
QString description()
Return a description of what the plugin is doing.
Definition: FilePTS.hh:128