aride_project.h

00001 /* -- 2007-05-07 -- 
00002  *  ardev - an augmented reality library for robot developers
00003  *  Copyright 2005-2007 - Toby Collett (ardev _at_ plan9.net.nz)
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Lesser General Public
00007  *  License as published by the Free Software Foundation; either
00008  *  version 2.1 of the License, or (at your option) any later version.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00013  *  Lesser General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Lesser General Public
00016  *  License along with this library; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00018  *
00019  */
00020  
00021 #ifndef ARIDE_PROJECT_H
00022 #define ARIDE_PROJECT_H
00023 
00024 #define CONFIG_FILE_VERSION "0.2"
00025 
00026 #include <ardev/ardev.h>
00027 
00028 #include <QDomNode>
00029 #include <QDomElement>
00030 #include <QDomDocument>
00031 
00032 #include <stdlib.h>
00033 #include <list>
00034 #include <vector>
00035 using namespace std;
00036 
00037 class QWidget;
00038 class ObjectHandler;
00039 class EnvironmentObjectHandler;
00040 
00041 typedef enum ArideSection {ARIDE_UNKNOWN,ARIDE_CAMERA,ARIDE_CAPTURE,ARIDE_OUTPUT,ARIDE_SECONDARYOUTPUT,ARIDE_PREPROCESS,ARIDE_POSITION,ARIDE_RENDER,ARIDE_MISC,ARIDE_RENDERPAIR,ARIDE_ENVIRONMENTS,ARIDE_END} ArideSection;
00042 const char * GetArideSectionTypeName(ArideSection Section);
00043 
00044 class aride_object
00045 {
00046         public:
00047                 aride_object(const QDomElement & _Element, ObjectHandler * Handler=NULL);
00048                 virtual ~aride_object();
00049         
00050                 //QString Name;
00051                 QString Parent;
00052                 ArideSection Section;   // ie camera, capture etc
00053                 QString Type;           // ie CameraPlayer
00054         
00055                 QDomElement Element;
00056         
00057                 static int GetSection(const QString & TagName);
00058                 
00059                 void ChangeType(const QString & NewType);
00060                 
00061                 QString GetName() const;
00062                 void SetName(const QString & Name);
00063                 virtual void ExternalNameChange(const QString & OldName, const QString & NewName);      
00064                 
00065                 ObjectHandler * Handler;
00066 };
00067 
00068 
00069 class aride_environment : public aride_object
00070 {
00071         public:
00072                 aride_environment(const QDomElement & _Element);
00073                 virtual ~aride_environment();
00074         
00075                 //list<aride_object *> RenderObjects;
00076         
00077                 EnvironmentObjectHandler * EnvHandler;
00078                 
00079                 QString Out;
00080                 QString Cam;
00081                 QString Cap;
00082                 list<QString> PreProcessObjects;
00083                 list<QString> SecondaryObjects;
00084                 list<QString> MiscObjects;
00085 
00086                 virtual void ExternalNameChange(const QString & OldName, const QString & NewName);      
00087                 
00088                 
00089                 void Start();
00090                 void Pause();
00091                 void Stop();
00092                 bool Paused;
00093         
00094 };
00095 
00096 
00097 class aride_displaylist_node
00098 {
00099         public:
00100                 aride_displaylist_node(const QDomElement & _Element, aride_displaylist_node * _Parent, aride_object * _Object);
00101                 ~aride_displaylist_node();
00102                 
00103                 //vector<aride_displaylist_node *> Children;
00104                 aride_displaylist_node * Parent;
00105                 
00106                 QDomElement Element;
00107                 aride_object * object;
00108                 QString Name;
00109                 
00110                 QString GetName() {return Name;};
00111                 void SetName(const QString & _Name) {Name = _Name;};
00112                 void ExternalNameChange(const QString & OldName, const QString & NewName);
00113 };
00114 
00115 
00116 class aride_project
00117 {
00118         public:
00119                 aride_project();
00120                 ~aride_project();
00121 
00122 
00123                 int LoadFromFile(const char * Filename);
00124                 int SaveToFile(const char * Filename=NULL);
00125                 int New();
00126         
00127                 QString CreateObjectNode(ArideSection Section, const QString & Type, aride_object * parent=NULL);
00128                 int CreateEnvironmentNode();
00129                 QString CreateDisplayList(QDomNode &n);
00130                 QString CreateDisplayList();
00131                 QString CreateDisplayListNode(aride_displaylist_node * parent, QDomNode &n);
00132                 QString CreateDisplayListNode(const ArideSection Section, const QString & Type,const QString & Parent);
00133                 void RemoveDisplayListNode(QString Name);
00134                 void RemoveDisplayListNode(aride_displaylist_node * node);
00135                 int RemoveObject(aride_object * obj);
00136                 int RemoveEnvironment(aride_environment * env);
00137 
00138 
00139                 RenderPair * CreateRenderPair(aride_displaylist_node * node);
00140 
00141                 void UpdateParents(const QString & OldName, const QString & NewName);
00142                 void ExternalNameChange(const QString & OldName, const QString & NewName);
00143         
00144                 void Run();
00145                 void Pause();
00146                 void Stop(); 
00147 
00148                 QDomDocument doc;
00149 
00150                 list<aride_object *> Objects;
00151                 list<aride_environment *> Environments;
00152                 list<aride_displaylist_node *> DisplayNodes;
00153                 list<RenderPair *> RenderPairs;
00154         
00155                 bool Open;
00156         protected:
00157                 char * StoredFilename;
00158                 bool Changed;
00159 
00160 };
00161 
00162 
00163 #endif

SourceForge.net Logo Generated on Sat May 12 15:25:43 2007 for ardev by doxygen 1.5.1