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

GraphicsObjectsList.h

Go to the documentation of this file.
00001 #ifndef GraphicsObjectsListH
00002 #define GraphicsObjectsListH
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:                GraphicsObjectsList
00026 ** FUNCTION:            list of all graphics objects
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 "XMLFile.h"
00043 #include "Transformation.h"
00044 #include "GraphicsObject.h"
00045 
00046 /* HEADER FILES END ***********************************************************/
00047 
00048 class CAdvancedProject;
00049 class CGraphicsObjectsList;
00050 class CGraphicsProfile;
00051 class CXMLElement;
00052 class TOpenGLWin;
00053 class CManipulator;
00054 class CGraphicsProfileData;
00055 
00056 //---------------------------------------------------------------------------
00057 
00059 
00062 class NEMESIS_CORE_PACKAGE CGraphicsObjectData : public CComObject{
00063     public:
00064  // konstruktor ----------------------------------------------------------------
00065         __fastcall CGraphicsObjectData(CComObject* owner,CPluginObjectInfo* objectinfo);
00066 
00067  // inicializační a rekonstrukční operace --------------------------------------
00068     void             __fastcall GetFromGraphicsObject(CGraphicsObject* object);
00069     CGraphicsObject* __fastcall MakeGraphicsObject(CGraphicsObjectsList* p_gl,CElementsRecord* history=NULL);
00070     inline int       __fastcall GetGraphicsObjectIndex(void);
00071 
00072  // extraktor a inserter pro proudové operace ----------------------------------
00073     friend inline ostream& __fastcall operator << (ostream& str,const CGraphicsObjectData& sg);
00074     friend inline istream& __fastcall operator >> (istream& str,CGraphicsObjectData& sg);
00075 
00076  // sekce soukromých dat -------------------------------------------------------
00077     public:
00078     CUUID                           UUID;                               // uuid objektu
00079     int                                 GraphicsObjectIndex;    // index objektu
00080     CSmallString                Name;                   // jméno objektu
00081     CSmallString                Description;            // popis objektu
00082     CExtObject::CStatus Status;                 // status objektu
00083     CXMLFile            File;
00084     };
00085 
00086 //------------------------------------------------------------------------------
00087 
00089 
00092 class NEMESIS_CORE_PACKAGE CGraphicsObjectsList : public CExtObject, public CTemplList<CGraphicsObject> {
00093     public:
00094         __fastcall CGraphicsObjectsList(CAdvancedProject* owner);
00095         __fastcall ~CGraphicsObjectsList(void);
00096 
00097  // metody - vytvoření objektů - záznam do history listu -----------------------
00098     CGraphicsObject* __fastcall CreateGraphicsObject(const CUUID& objectuuid,
00099                                         const CSmallString& name,
00100                                         const CSmallString& descr,
00101                                         CGraphicsProfile* profile=NULL);
00102 
00103  // metody - operace se seznamem -----------------------------------------------
00104     CGraphicsObject* __fastcall SearchByName(const CSmallString& name);
00105     CGraphicsObject* __fastcall SearchByDescription(const CSmallString& descrip);
00106 
00107  // metody - výkonové operace --------------------------------------------------
00108     CGraphicsObject* __fastcall AddGraphicsObject(const CUUID& objectuuid,const CSmallString& name,CElementsRecord* history=NULL);
00109     CGraphicsObject* __fastcall AddGraphicsObject(CGraphicsObjectData* p_data,CElementsRecord* history=NULL);
00110 
00111  // metody - práce s profily ---------------------------------------------------
00112  // se zaznamem do history listu
00113     CGraphicsProfile* __fastcall MakeNewProfile(const CSmallString& name, const CSmallString& descr);
00114     bool __fastcall ActivateProfile(CGraphicsProfile* profile);
00115 
00116  // bez zaznamu do history listu
00117     CGraphicsProfile* __fastcall AddProfile(const CGraphicsProfileData& data,CElementsRecord* history=NULL);
00118     void              __fastcall SetActiveProfile(CGraphicsProfile* profile,CElementsRecord* history=NULL);
00119     inline CTemplList<CGraphicsProfile>& __fastcall GetProfilesList(void);
00120     inline CGraphicsProfile* __fastcall GetActiveProfile(void);
00121     CGraphicsProfile* __fastcall FindProfile(int index);
00122 
00123  // zjišťovací operace ---------------------------------------------------------
00124     __property CAdvancedProject* Project = {read = GetAdvancedProject};
00125     CExtObject* __fastcall FindObject(int index);
00126 
00127  // nastavovací operace --------------------------------------------------------
00128     void __fastcall SetOpenGLWin(TOpenGLWin* openglwin);
00129     void __fastcall SetCentrum(const CPoint& centrum);
00130     inline TOpenGLWin* __fastcall GetOpenGLWin(void);
00131 
00132  // výkonné funkce -------------------------------------------------------------
00133     void        __fastcall Repaint(void);  // překreslí scénu
00134 
00135     CExtObject* __fastcall RepaintSelect(int mousex,int mousey);
00136     void __fastcall RepaintRectSelect(int x,int y,int w,int h);
00137     CExtObject* __fastcall GetFirstRectSelectObject(void);
00138     CExtObject* __fastcall GetNextRectSelectObject(void);
00139 
00140  // manipulator setup ----------------------------------------------------------
00141     void __fastcall FitScene(void);
00142     void __fastcall SetUniformManipMode(bool set);
00143     bool __fastcall IsInUniformManipMode(void);
00144     CManipulator* __fastcall GetCurrentManipulator(void);
00145 
00146  // uložení a načtení dat ------------------------------------------------------
00147     bool __fastcall Load(CXMLElement* p_el);
00148     bool __fastcall Save(CXMLElement* p_el);
00149 
00150     void __fastcall RevertToGlobalSystem(void);
00151     void __fastcall RevertToLocalSystem(void);
00152 
00153  // sekce soukromých dat -------------------------------------------------------
00154     private:
00155     CTemplList<CGraphicsProfile>       Profiles;        // grafické profily
00156     TOpenGLWin*                        FOpenGLWin;      // grafický výstup
00157     CGraphicsProfile*                  FActiveProfile;  // aktivní grafický profil
00158     inline CAdvancedProject* __fastcall GetAdvancedProject(void);
00159     CPoint                              Centrum;    // falesné centrum
00160     bool                                FUniformManipMode;
00161     CPoint                              UniformPos;
00162     CTransformation                     UniformTrans;
00163     bool                                RevertedCoords;
00164     GLdouble                            LocalModelMatrix[16];
00165     };
00166 
00167 //------------------------------------------------------------------------------
00168 
00169 inline TOpenGLWin* __fastcall CGraphicsObjectsList::GetOpenGLWin(void)
00170 {
00171  return(FOpenGLWin);
00172 }
00173 
00174 //------------------------------------------------------------------------------
00175 
00176 DECLARE_EVENT(GraphicsObjectsList_AddObject);
00177 DECLARE_EVENT(GraphicsObjectsList_RemoveObject);
00178 DECLARE_EVENT(GraphicsObjectsList_AddProfile);
00179 DECLARE_EVENT(GraphicsObjectsList_RemoveProfile);
00180 DECLARE_EVENT(GraphicsObjectsList_ActivateProfile);
00181 
00182 //------------------------------------------------------------------------------
00183 //##############################################################################
00184 //------------------------------------------------------------------------------
00185 
00186 
00187 class CGraphicsObjectHistory: public CElementData{
00188     public:
00189     __fastcall CGraphicsObjectHistory(CGraphicsObject* p_go,bool create);
00190     __fastcall ~CGraphicsObjectHistory(void);
00191 
00192     private:
00193     CGraphicsObjectsList*      GraphicsObjectsList;
00194     CGraphicsObjectData*       Data;
00195 
00196     virtual void __fastcall Forward(void);
00197     virtual void __fastcall Backward(void);
00198     };
00199 
00200 //------------------------------------------------------------------------------
00201 
00202 class CGraphicsObjectsListCreateObjectHistory:public CCoreElementsRecord{
00203     public:
00204         __fastcall CGraphicsObjectsListCreateObjectHistory(CGraphicsObjectData* p_data);
00205         private:
00206     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00207     CSmallString    ObjectName;
00208     CSmallString    ObjectType;
00209     };
00210 
00211 //------------------------------------------------------------------------------
00212 
00213 class CProfileCreateHistory:public CCoreElementsRecord{
00214     public:
00215         __fastcall CProfileCreateHistory(const CSmallString& name,const CSmallString& descr);
00216 
00217         private:
00218     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00219     CSmallString    ProfileName;
00220     CSmallString    ProfileDescr;
00221     };
00222 
00223 //------------------------------------------------------------------------------
00224 
00225 class CActivateProfileHistory:public CCoreElementsRecord{
00226     public:
00227         __fastcall CActivateProfileHistory(const CSmallString& name,const CSmallString& descr);
00228 
00229         private:
00230     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00231     CSmallString    ProfileName;
00232     CSmallString    ProfileDescr;
00233     };
00234 
00235 //------------------------------------------------------------------------------
00236 
00237 class CSetActiveProfileHistory: public CElementData{
00238     public:
00239     __fastcall CSetActiveProfileHistory(CGraphicsObjectsList* p_list,CGraphicsProfile* p_prof,bool activate);
00240 
00241     private:
00242     CGraphicsObjectsList*      GraphicsObjectsList;
00243     int                        ProfileIndex;
00244     int                        PrevProfileIndex;
00245 
00246     virtual void __fastcall Forward(void);
00247     virtual void __fastcall Backward(void);
00248     };
00249 
00250 //------------------------------------------------------------------------------
00251 //##############################################################################
00252 //------------------------------------------------------------------------------
00253 
00254 
00255 inline int __fastcall CGraphicsObjectData::GetGraphicsObjectIndex(void)
00256 {
00257  return(GraphicsObjectIndex);
00258 }
00259 
00260 //------------------------------------------------------------------------------
00261 
00262 inline CTemplList<CGraphicsProfile>& __fastcall CGraphicsObjectsList::GetProfilesList(void)
00263 {
00264  return(Profiles);
00265 }
00266 
00267 //------------------------------------------------------------------------------
00268 
00269 inline CGraphicsProfile* __fastcall CGraphicsObjectsList::GetActiveProfile(void)
00270 {
00271  return(FActiveProfile);
00272 }
00273 
00274 //------------------------------------------------------------------------------
00275 
00276 inline CAdvancedProject* __fastcall CGraphicsObjectsList::GetAdvancedProject(void)
00277 {
00278  return((CAdvancedProject*)GetProject());
00279 }
00280 
00281 //------------------------------------------------------------------------------
00282 
00283 #endif

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