Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

QGLViewerXML.h

Go to the documentation of this file.
00001 /*
00002  * QGLViewerXML.h
00003  * $Id: QGLViewerXML.h,v 1.7 2001/11/15 16:54:52 guenth Exp $
00004  *
00005  * Copyright (C) 1999, 2000, 2001 Michael Meissner, Alexander Buck
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  * As a special exception to the GPL, the QGLViewer authors (Markus
00022  * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas
00023  * Woerner) give permission to link this program with Qt (non-)commercial
00024  * edition, and distribute the resulting executable, without including
00025  * the source code for the Qt (non-)commercial edition in the source
00026  * distribution.
00027  *
00028  */
00029 
00030 //  Description : Class QGLViewerXML
00031 //  Purpose     : Provides  funcionality
00032 
00033 
00034 #ifndef __QGLVIEWERXML_H
00035 #define __QGLVIEWERXML_H
00036 
00037 
00038 // System
00040 #include <math.h>
00041 #include <iostream.h>
00042 
00043 // Own
00045 #include "CP2D.h"
00046 #include "CV2D.h"
00047 #include "CBoundingBox3D.h"
00048 #include "CCamera.h"
00049 #include "CList.h"
00050 #include "CCameraKeyPathPoint.h"
00051 #include "CCameraKeyPathAttributes.h"
00052 
00053 // Qt
00055 #include <qdom.h>
00056 
00057 
00058 // forward declarations
00060 
00061 
00062 
00068 namespace QGLViewerXML {
00069 
00073    QDomElement addNode(QDomElement& parent,
00074                        const QString& member = QString::null);
00075 
00078    QDomElement queryNode(const QDomElement& parent,
00079                          const QString& member);
00080 
00083   bool readXML(const QDomElement&, CP2D&);
00084 
00087   bool writeXML(QDomElement, const CP2D&);
00088 
00091   bool readXML(const QDomElement&, CP3D&);
00092 
00095   bool writeXML(QDomElement, const CP3D&);
00096 
00099   bool readXML(const QDomElement&, CP4D&);
00100 
00103   bool writeXML(QDomElement, const CP4D&);
00104 
00105 
00108   bool readXML(const QDomElement&, CV2D&);
00109 
00112   bool writeXML(QDomElement, const CV2D&);
00113 
00116   bool readXML(const QDomElement&, CV3D&);
00117 
00120   bool writeXML(QDomElement, const CV3D&);
00121 
00124   bool readXML(const QDomElement&, CV4D&);
00125 
00128   bool writeXML(QDomElement, const CV4D&);
00129 
00130 
00133   bool readXML(const QDomElement&, CQuat&);
00134 
00137   bool writeXML(QDomElement, const CQuat&);
00138 
00139 
00142   bool readXML(const QDomElement&, CBoundingBox3D&);
00143 
00146   bool writeXML(QDomElement, const CBoundingBox3D&);
00147 
00148 
00151   bool readXML(const QDomElement&, CMat4D&);
00152 
00155   bool writeXML(QDomElement, const CMat4D&);
00156 
00157 
00160   bool readXML(const QDomElement&, CCamera&);
00161 
00164   bool writeXML(QDomElement, const CCamera&);
00165 
00167   bool readXML(const QDomElement&, CCameraKeyPathPoint&);
00168     
00172   bool writeXML(QDomElement, const CCameraKeyPathPoint&,bool fParams=true);
00173     
00178   bool readXML(const QDomElement&, CCameraKeyPathAttributes&);
00179     
00183   bool writeXML(QDomElement, const CCameraKeyPathAttributes&);
00184 
00188   template <class T>
00189     bool readXML(const QDomElement& domElem, CList<T>& list, QString tagName="CList") {
00190     if (domElem.nodeName().compare(tagName) != 0)
00191       return false;
00192 
00193     int l=0;
00194     QDomNode node = domElem.firstChild();
00195     while (!node.isNull()) {
00196       if (node.isElement()) {
00197         QDomElement elem = node.toElement();
00198         T cam;
00199 
00200         if (QGLViewerXML::readXML(elem, cam)) {
00201           list.insertAsLast(new T(cam));
00202           l++;
00203         }
00204       }
00205       node = node.nextSibling();
00206     }
00207 
00208     return l>0;
00209   };
00210 
00211 
00212 
00216   template <class T>
00217     bool writeXML(QDomElement domElem, const CList<T>& list, QString tagName="CList") {
00218     domElem.setTagName(tagName);
00219     CListContainer<T> *pContainer;
00220     pContainer = list.getFirst();
00221     while (pContainer) {
00222       if (!writeXML(addNode(domElem), *(pContainer->getObject())))
00223         return false;
00224       pContainer = pContainer->getNext();
00225     }
00226     return true;
00227   };
00228 
00229 }
00230 
00231 
00232 #endif

Generated on Wed Mar 5 18:23:25 2003 for QGLViewer by doxygen1.3-rc3