Developer Documentation
FileBundle.hh
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43 * *
44 * $Revision$ *
45 * $LastChangedBy$ *
46 * $Date$ *
47 * *
48 \*===========================================================================*/
49 
50 
51 //================================================================
52 //
53 // CLASS FileBundlePlugin
54 //
55 // This class is the base class for loading and saving
56 // (reading/writing) SplatCloud objects from/to bundler files
57 // on disc.
58 //
59 //================================================================
60 
61 
62 #ifndef FILEBUNDLEPLUGIN_HH
63 #define FILEBUNDLEPLUGIN_HH
64 
65 
66 //== INCLUDES ====================================================
67 
68 
69 #include <QObject>
70 
76 
78 
80 
81 //== CLASS DEFINITION ============================================
82 
83 
85 {
86  Q_OBJECT
87  Q_INTERFACES( FileInterface )
88  Q_INTERFACES( LoadSaveInterface )
89  Q_INTERFACES( LoggingInterface )
90  Q_INTERFACES( BaseInterface )
91  Q_INTERFACES( ScriptInterface )
92 #if QT_VERSION >= 0x050000
93  Q_PLUGIN_METADATA(IID "org.OpenFlipper.Plugins.Plugin-FileBundle")
94 #endif
95 signals:
96 
97  // -- File Interface --
98  void openedFile( int _objectId );
99 
100  // -- LoadSave Interface --
101  void addEmptyObject( DataType _type, int &_objectId );
102  void deleteObject ( int _objectId );
103  void updatedObject( int _objectId, const UpdateType &_type );
104 
105  //-- Logging Interface --
106  void log( QString _message );
107  void log( Logtype _type, QString _message );
108 
109 public slots:
110 
111  // -- Base Interface --
112  QString version() { return QString( "1.0" ); }
113 
114  // -- File Interface --
115  int loadObject( QString _filename );
116  bool saveObject( int _objectId, QString _filename );
117 
118 private slots:
119 
120  // -- Base Interface --
121  void noguiSupported() { }
122 
123 public:
124 
125  //-- Base Interface --
126  QString name() { return QString( "FileBundle" ); }
127  QString description( ) { return QString( tr( "Load/Save SplatCloud Bundler format files" ) ); }
128 
129  // -- File Interface --
131 
132  // -- File Interface --
133  QString getSaveFilters() { return QString( tr( "Bundler SplatCloud files ( *.out )" ) ); }
134  QString getLoadFilters() { return QString( tr( "Bundler SplatCloud files ( *.out )" ) ); }
135  QWidget *saveOptionsWidget( QString /*_currentFilter*/ );
136  QWidget *loadOptionsWidget( QString /*_currentFilter*/ );
137 
138 private:
139 
140  // add/remove multiple objects
141  bool addEmptyObjects( unsigned int _num, const DataType &_dataType, std::vector<int> &_objectIDs );
142  void deleteObjects( std::vector<int> &_objectIDs );
143 
144  // read image list file from disc
145  bool readImagelistFile( const char *_filename, std::vector<std::string> &_imagePaths ) /*const*/;
146 
147  // read bundle file from disc to scenegraph node
148  void readCameras( FILE *_file, const std::vector<int> &_cameraObjectIDs, SplatCloud_Cameras &_cameras ) /*const*/;
149  void readPoints ( FILE *_file, const std::vector<int> &_cameraObjectIDs, SplatCloud &_splatCloud ) /*const*/;
150  bool readBundleFile( const char *_filename, SplatCloud &_splatCloud ) /*const*/;
151 
152  // write bundle file from scenegraph node to disc
153  bool writeBundleFile( const char *_filename, const SplatCloud &_splatCloud ) /*const*/;
154 };
155 
156 
157 //================================================================
158 
159 
160 #endif // FILEBUNDLEPLUGIN_HH
QString name()
Return a name for the plugin.
Definition: FileBundle.hh:126
Predefined datatypes.
Definition: DataTypes.hh:96
QWidget * saveOptionsWidget(QString)
Definition: FileBundle.cc:532
Logtype
Log types for Message Window.
DataType supportedType()
Return your supported object type( e.g. DATA_TRIANGLE_MESH )
Definition: FileBundle.hh:130
#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.
QString getSaveFilters()
Definition: FileBundle.hh:133
QString description()
Return a description of what the plugin is doing.
Definition: FileBundle.hh:127
Interface class for file handling.
Interface for all plugins which want to Load or Save files and create Objects.
QWidget * loadOptionsWidget(QString)
Definition: FileBundle.cc:541
QString getLoadFilters()
Definition: FileBundle.hh:134