OpenWalnut  1.5.0dev
WGEProjectFileIO.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WGEPROJECTFILEIO_H
26 #define WGEPROJECTFILEIO_H
27 
28 #include <string>
29 #include <map>
30 
31 #include <osg/Matrixd>
32 
33 #include "../common/WProjectFileIO.h"
34 
35 class WProjectFile;
36 
37 /**
38  * IO class for writing the graphics engine state to a project file. Currently it only writes the camera settings for the main view with the
39  * WGEZoomTrackbalManipulator.
40  */
42 {
43 public:
44  /**
45  * Default constructor.
46  */
48 
49  /**
50  * Destructor.
51  */
52  virtual ~WGEProjectFileIO();
53 
54  /**
55  * This method parses the specified line and interprets it. It gets called line by line by WProjectFile.
56  *
57  * \param line the current line as string
58  * \param lineNumber the current line number. Useful for error/warning/debugging output.
59  *
60  * \return true if the line could be parsed.
61  */
62  virtual bool parse( std::string line, unsigned int lineNumber );
63 
64  /**
65  * Called whenever the end of the project file has been reached. This is useful if your specific parser class wants to do some post
66  * processing after parsing line by line.
67  */
68  virtual void done();
69 
70  /**
71  * Saves the state to the specified stream.
72  *
73  * \param output the stream to print the state to.
74  */
75  virtual void save( std::ostream& output ); // NOLINT
76 
77  /**
78  * Create a clone of the IO. This is especially useful for custom parsers registered at \ref WProjectFile::registerParser. Implement this
79  * function.
80  *
81  * \param project the project file using this parser instance.
82  *
83  * \return Cloned instance.
84  */
85  virtual SPtr clone( WProjectFile* project ) const;
86 
87 protected:
88  /**
89  * All Cameras parsed.
90  */
91  typedef std::map< unsigned int, std::string > CameraList;
92 
93  /**
94  * Camera map.
95  */
97 
98  /**
99  * All view's manipulator matrices.
100  */
101  std::map< unsigned int, osg::Matrixd > m_manipulatorMatrices;
102 
103  /**
104  * The home position eye point.
105  */
106  std::map< unsigned int, osg::Vec3d > m_homeEyeVectors;
107 
108  /**
109  * The home position center point.
110  */
111  std::map< unsigned int, osg::Vec3d > m_homeCenterVectors;
112 
113  /**
114  * The home position up vector.
115  */
116  std::map< unsigned int, osg::Vec3d > m_homeUpVectors;
117 
118 private:
119 };
120 
121 #endif // WGEPROJECTFILEIO_H
122 
IO class for writing the graphics engine state to a project file.
std::map< unsigned int, osg::Matrixd > m_manipulatorMatrices
All view's manipulator matrices.
std::map< unsigned int, osg::Vec3d > m_homeCenterVectors
The home position center point.
WGEProjectFileIO()
Default constructor.
virtual ~WGEProjectFileIO()
Destructor.
std::map< unsigned int, std::string > CameraList
All Cameras parsed.
std::map< unsigned int, osg::Vec3d > m_homeEyeVectors
The home position eye point.
virtual void done()
Called whenever the end of the project file has been reached.
virtual SPtr clone(WProjectFile *project) const
Create a clone of the IO.
virtual bool parse(std::string line, unsigned int lineNumber)
This method parses the specified line and interprets it.
std::map< unsigned int, osg::Vec3d > m_homeUpVectors
The home position up vector.
virtual void save(std::ostream &output)
Saves the state to the specified stream.
CameraList m_cameras
Camera map.
A base class for all parts of OpenWalnut which can be serialized to a project file.
std::shared_ptr< WProjectFileIO > SPtr
Abbreviation for a shared pointer.
Class loading project files.
Definition: WProjectFile.h:50