Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

GraphicsProfile.h

Go to the documentation of this file.
00001 #ifndef GraphicsProfileH
00002 #define GraphicsProfileH
00003 
00004 /*******************************************************************************
00005 Copyright 1998,1999,2000,2001,2002 Petr Kulhanek
00006 
00007     This file is part of Core plugin.
00008 
00009     Core plugin is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     Core plugin is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with Core plugin; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 *******************************************************************************/
00023 /*******************************************************************************
00024 ** PROJECT:             Project NEMESIS
00025 ** FILE:                GraphicsProfile
00026 ** FUNCTION:            define graphics profile
00027 ** VERSION:             1.0
00028 ** LANGUAGE:            CBuilder C++
00029 ** TARGET COMPUTER:     IBM PC
00030 ** PROGRAMMER:          Petr Kulhánek
00031 ** HISTORY:
00032 VERSION DATE        NOTE
00033 *******************************************************************************/
00034 
00038 /* HEADER FILES ***************************************************************/
00039 
00040 #include "CoreMainHeader.h"
00041 #include "ExtObject.h"
00042 #include "Manipulator.h"
00043 #include <GL/GL.h>
00044 #include <GL/GLU.h>
00045 
00046 /* HEADER FILES END ***********************************************************/
00047 
00048 class CGraphicsObjectsList;
00049 class CGraphicsObject;
00050 class CXMLElement;
00051 class CGraphicsProfile;
00052 class CAdvancedProject;
00053 
00054 // -----------------------------------------------------------------------------
00055 // #############################################################################
00056 // -----------------------------------------------------------------------------
00057 
00059 
00062 class NEMESIS_CORE_PACKAGE CGraphicsProfileData{
00063         public:
00064  // konstruktor a destruktor ---------------------------------------------------
00065         __fastcall CGraphicsProfileData(void);
00066         __fastcall ~CGraphicsProfileData(void);
00067 
00068  // inicializační a rekonstrukční operace --------------------------------------
00069         void                        __fastcall GetFromProfile(CGraphicsProfile* p_profile);
00070     CGraphicsProfile*       __fastcall MakeProfile(CAdvancedProject* p_project,CElementsRecord* history=NULL) const;
00071     inline int              __fastcall GetProfileIndex(void) const;
00072 
00073  // sekce soukromých dat -------------------------------------------------------
00074     public:
00075     int                                         ProfileIndex;  // index
00076     CSmallString                        Name;           // jméno
00077     CSmallString                        Description;    // popis
00078     CExtObject::CStatus         Status;         // status
00079     int                     NumOfObjects;
00080     int*                                        Objects;
00081     bool                    UseGList;   // indikuje použití GListu
00082     EDrawLevel              Level;      // úroveň vykreslování
00083     GLuint                  GListName;   // index GListu
00084     };
00085 
00086 // -----------------------------------------------------------------------------
00087 
00089 
00092 class NEMESIS_CORE_PACKAGE CGraphicsProfile : public CExtObject, public CManipulator {
00093     public:
00094  // konstruktor profilu --------------------------------------------------------
00095             __fastcall CGraphicsProfile(CGraphicsObjectsList* p_bl);
00096     void        __fastcall RemoveFromBaseList(CElementsRecord* history=NULL);
00097 
00098  // zmeny se zaznamem do history listu -----------------------------------------
00099     bool __fastcall Delete(void);
00100     bool __fastcall MoveUpObject(CGraphicsObject* object);     //move in list of objects up
00101     bool __fastcall MoveDownObject(CGraphicsObject* object);  //move in list of objects down
00102     bool __fastcall AddObjectWithHistory(CGraphicsObject* object);
00103     bool __fastcall RemoveObjectWithHistory(CGraphicsObject* object);
00104 
00105  // vkládání a odstraňovaní objektů --------------------------------------------
00106     bool __fastcall AddObject(CGraphicsObject* object,CElementsRecord* history=NULL);     //vloží objekt do profilu
00107     bool __fastcall RemoveObject(CGraphicsObject* object,CElementsRecord* history=NULL);  //vyjme objekt z profilu
00108     bool __fastcall MoveObject(CGraphicsObject* object,bool moveup);     //move in list of objects up
00109 
00110     inline bool __fastcall IsFirstObject(CGraphicsObject* object);
00111     inline bool __fastcall IsLastObject(CGraphicsObject* object);
00112 
00113  // metody - vykreslení celé scény ---------------------------------------------
00114     void __fastcall InitGL(TObject* sender);
00115     void __fastcall ResizeGL(TObject* sender,int glwidth,int glheight);
00116     void __fastcall SelectResizeGL(TObject* sender,int glwidth,int glheight,int x,int y,int w,int h);
00117     void __fastcall DrawGL(TObject* sender);
00118 
00119  // metody - pro používání grafických listů a aktualizace plochy ---------------
00120     inline void __fastcall SetUseGList(bool set);   // nastaví používání grafického listu
00121     inline bool __fastcall IsInUseGList(void) const;// zjistí zda je používán grafický list
00122                                                     // vykresluje objekty s nižší prioritou než DP_INIT_OBJECT
00123     void        __fastcall UpdateGList(void);       // aktualizuje grafický list
00124 
00125     virtual void __fastcall SetLevel(EDrawLevel level);
00126 
00127  // zjištovací operace ---------------------------------------------------------
00128     inline CGraphicsObjectsList* __fastcall GetGraphicsObjectsList(void);
00129     bool                         __fastcall IsActiveProfile(void);
00130     CGraphicsObject*             __fastcall FindObject(int objectindex);
00131     void                         __fastcall GetSceneMetrics(CPoint& low,CPoint& high);
00132     bool                         __fastcall GLUUnproject(const CPoint& winpos,CPoint& scenepos);
00133 
00134  // uložení a načtení dat ------------------------------------------------------
00135     bool __fastcall Load(CXMLElement* p_el);
00136     bool __fastcall Save(CXMLElement* p_el);
00137 
00138  // sekce soukromých dat -------------------------------------------------------
00139     private:
00140     bool                               FUseGList;   // indikuje použití GListu
00141     EDrawLevel                         FLevel;      // úroveň vykreslování
00142     GLuint                             GListName;   // index GListu
00143     CSimpleList<CGraphicsObject>       Objects;     // objekty profilu
00144     CGraphicsObjectsList*              GraphicsObjectsList;
00145 
00146  // redefinované z CManipulator
00147                                                 // vykresluje objekty s nižší prioritou než DP_INIT_OBJECT
00148     virtual void  __fastcall    _Draw(void);    // vykreslí jednotlivé objekty
00149 
00150  // rediefinované z CExtObject
00151     virtual void __fastcall RemoveFromRegistered(CExtObject* object,CElementsRecord* history=NULL);
00152 
00153     friend class CGraphicsProfileObjectEnumerator;
00154     friend class CGraphicsProfileData;
00155 
00156     public:
00157         __fastcall ~CGraphicsProfile(void);
00158     };
00159 
00160 //------------------------------------------------------------------------------
00161 
00162 DECLARE_EVENT(GraphicsProfile_AddObject);
00163 DECLARE_EVENT(GraphicsProfile_RemoveObject);
00164 DECLARE_EVENT(GraphicsProfile_ObjectsOrderChange);
00165 
00166 extern CPluginObjectInfo GraphicsProfileObjectInfo;
00167 
00168 // -----------------------------------------------------------------------------
00169 // #############################################################################
00170 // -----------------------------------------------------------------------------
00171 
00172 class CProfileDataHistory : public CElementData{
00173     public:
00174                                 __fastcall CProfileDataHistory(CGraphicsProfile* p_pro,bool create);
00175     private:
00176     virtual void        __fastcall Forward(void);
00177     virtual void        __fastcall Backward(void);
00178 
00179     CAdvancedProject*           Project;
00180     CGraphicsProfileData    Data;
00181     };
00182 
00183 // -----------------------------------------------------------------------------
00184 // #############################################################################
00185 // -----------------------------------------------------------------------------
00186 
00187 class CGraphicsObjectUnregHistory: public CElementData{
00188     public:
00189     __fastcall CGraphicsObjectUnregHistory(CGraphicsProfile* p_pr,CGraphicsObject* p_go,bool reg);
00190 
00191     private:
00192     CGraphicsObjectsList*      GraphicsObjectsList;
00193     int ProfileIndex;
00194     int ObjectIndex;
00195     
00196     virtual void __fastcall Forward(void);
00197     virtual void __fastcall Backward(void);
00198     };
00199 
00200 // -----------------------------------------------------------------------------
00201 // #############################################################################
00202 // -----------------------------------------------------------------------------
00203 
00204 class CProfileDeleteHistory:public CCoreElementsRecord{
00205         public:
00206     __fastcall CProfileDeleteHistory(CGraphicsProfile* p_profile);
00207 
00208     private:
00209     CSmallString Name;
00210     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00211     };
00212 
00213 // -----------------------------------------------------------------------------
00214 // #############################################################################
00215 // -----------------------------------------------------------------------------
00216 
00217 class CProfileMoveObjectHistory:public CCoreElementsRecord{
00218         public:
00219     __fastcall CProfileMoveObjectHistory(CGraphicsProfile* p_profile,CGraphicsObject* p_go,bool moveup);
00220 
00221     private:
00222     CAdvancedProject*    Project;
00223     int                  ProfileIndex;
00224     int                  ObjectIndex;
00225     CSmallString         ProfileName;
00226     CSmallString         ObjectName;
00227     CSmallString         ObjectType;
00228 
00229     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00230     virtual void __fastcall Forward(void);
00231     virtual void __fastcall Backward(void);
00232     };
00233 
00234 // -----------------------------------------------------------------------------
00235 
00236 class CProfileInsertObjectHistory:public CCoreElementsRecord{
00237         public:
00238     __fastcall CProfileInsertObjectHistory(CGraphicsProfile* p_profile,CGraphicsObject* p_go,bool reg);
00239 
00240     private:
00241     CSmallString    ProfileName;
00242     CSmallString    ObjectName;
00243     CSmallString    ObjectType;
00244 
00245     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00246     };
00247 
00248 // -----------------------------------------------------------------------------
00249 // #############################################################################
00250 // -----------------------------------------------------------------------------
00251 
00252 inline bool __fastcall CGraphicsProfile::IsInUseGList(void) const
00253 {
00254  return(FUseGList);
00255 }
00256 
00257 //------------------------------------------------------------------------------
00258 
00259 inline CGraphicsObjectsList* __fastcall CGraphicsProfile::GetGraphicsObjectsList(void)
00260 {
00261  return(GraphicsObjectsList);
00262 }
00263 
00264 //------------------------------------------------------------------------------
00265 
00266 inline int      __fastcall CGraphicsProfileData::GetProfileIndex(void) const
00267 {
00268  return(ProfileIndex);
00269 }
00270 
00271 //------------------------------------------------------------------------------
00272 
00273 inline bool __fastcall CGraphicsProfile::IsFirstObject(CGraphicsObject* object)
00274 {
00275  return( object == Objects.GetFirst());
00276 }
00277 
00278 //------------------------------------------------------------------------------
00279 
00280 inline bool __fastcall CGraphicsProfile::IsLastObject(CGraphicsObject* object)
00281 {
00282  return( object == Objects.GetLast());
00283 }
00284 
00285 //------------------------------------------------------------------------------
00286 #endif

Generated on Sun Feb 9 12:53:50 2003 for NemesisCore by doxygen1.3-rc2