system.h

Go to the documentation of this file.
00001 /**
00002  * \file system.h <gre/system.h>
00003  * \brief GRE::SYSTEM class definition
00004  *
00005  * \if NODOC
00006  * $Id: system.h_v 1.3 2003/09/15 13:48:59 fileserver!dwilliss Exp $
00007  *
00008  * $Log: system.h_v $
00009  * Revision 1.3  2003/09/15 13:48:59  fileserver!dwilliss
00010  * Doxygen
00011  *
00012  * Revision 1.2  2003/07/30 15:35:04  mju
00013  * Ignore private sections.
00014  *
00015  * Revision 1.1  2003/06/16 19:40:12  mju
00016  * Initial revision
00017  *
00018  * \endif
00019 **/
00020 
00021 #ifndef  INC_GRE_SYSTEM_H
00022 #define  INC_GRE_SYSTEM_H
00023 
00024 #ifndef  INC_GRE_OBJECTBASE_H
00025    #include <gre/objectbase.h>
00026 #endif
00027 
00028 #if !defined(INC_MI32_NAMEDRGN_H) && defined(WIN32_NATIVE)
00029    #include <mi32/namedrgn.h>
00030 #endif
00031 
00032 
00033 //===================================================================================================================
00034 
00035 //! GRE "system" container object.
00036 //!
00037 //! A single instance of this object is automatically created by the GRE system.  This
00038 //! object is used as an implied container for all other top-level GRE (usually GRE_VIEWABLE)
00039 //! objects.  This provides a convenient place to attach callbacks where notification is desired
00040 //! for all layouts and top-level groups.
00041 class GRE_SYSTEM : public GRE_OBJECT {
00042    public:
00043 
00044       //! Get reference to the single GRE_SYSTEM instance.
00045       static GRE_SYSTEM& GetRef (
00046          );
00047 
00048       //! Determine whether to return or continue on serial read error.
00049       static bool GetReturnSerialReadErr (
00050          ) { return (GetRef().m_ReturnSerialReadErr); }
00051 
00052    #ifdef WIN32_NATIVE
00053       //! Get shared region list.
00054       //! @return Reference to shared region list.
00055       //! This method is only available when compiling for WIN32_NATIVE.
00056       static NAMEDREGION_LIST& GetRegionList (
00057          ) { return (GetRef().m_RegionList); }
00058    #endif
00059 
00060    #ifdef X_NATIVE
00061       //! Get "handle" for shared "region manager".
00062       //! This method is only available when compiling for X.
00063       static void* GetRgnMgrHandle (
00064          ) { return (GetRef().PrivGetRgnMgrHandle()); }
00065    #endif
00066 
00067       //! Check if have displayed warning about mixing georef/ungeoref layers.
00068       static bool HasDoneWarningGeoMixed (
00069          ) { return (GetRef().m_DoneWarningGeoMixed); }
00070 
00071       //! Initialize GRE system for non-interactive use.
00072       //! This will automatically register the standard geospatial layer types.
00073       //! At program exit, GRE_SYSTEM::Stop() should be called for proper cleanup.
00074       static void Init (
00075          );
00076 
00077    #ifdef WIN32_MFC
00078       //! Initialize GRE system for interactive use in Microsoft Windows with MFC.
00079       //! This will automatically register the standard geospatial layer types.
00080       //! At program exit, GRE_SYSTEM::StopMFC() should be called for proper cleanup.
00081       //! This is only available when compiling for WIN32_NATIVE and WIN32_MFC.
00082       static void InitMFC (
00083          );
00084    #endif
00085 
00086    #ifdef X_NATIVE
00087       //! Initialize GRE system for interactive use in X Windows.
00088       //! This will automatically register the standard geospatial layer types.
00089       //! At program exit, GRE_SYSTEM::StopX() should be called for proper cleanup.
00090       //! This method is only available when compiling for X.
00091       static void InitX (
00092          int numworkpixels = 0
00093          );
00094    #endif
00095 
00096       //! Register layout-specific layer types (text, scalebar, legend).
00097       //! By default only the standard geospatial layer are registered.
00098       static void RegisterLayoutLayerTypes (
00099          );
00100 
00101       //! Set whether have displayed warning about mixing georef/ungeoref layers.
00102       //!
00103       //! Normally a warning dialog is displayed the first time a user attempts to place
00104       //! both georeferenced and non-georeferenced spatial objects in the same GRE_GROUP.
00105       //! In some processes, such as georeference editing, this is necessary, so this
00106       //! method is provided to avoid the unwanted warning dialog.
00107       static void SetDoneWarningGeoMixed (
00108          bool set = true
00109          ) { GetRef().m_DoneWarningGeoMixed = set; }
00110 
00111       //! Set whether to return serial read error or continue.
00112       static void SetReturnSerialReadErr (
00113          bool set = true
00114          ) { GetRef().m_ReturnSerialReadErr = set; };
00115 
00116       //! Terminate GRE system at program exit.
00117       //! This method should only be called if GRE_SYSTEM::Init() was used.
00118       static void Stop (
00119          );
00120 
00121    #ifdef WIN32_MFC
00122       //! Terminate GRE system at program exit.
00123       //! This method should only be called if GRE_SYSTEM::InitMFC() was used.
00124       static void StopMFC (
00125          );
00126    #endif
00127 
00128    #ifdef X_NATIVE
00129       //! Terminate GRE system at program exit.
00130       //! This method should only be called if GRE_SYSTEM::InitX() was used.
00131       static void StopX (
00132          );
00133    #endif
00134 
00135       //! Destructor.
00136       ~GRE_SYSTEM ();
00137 
00138    private:
00139       #ifndef GENERATING_DOXYGEN_OUTPUT
00140 
00141       static bool s_InitDone;
00142 
00143    #ifdef WIN32_NATIVE
00144       NAMEDREGION_LIST m_RegionList;            //!< Shared region list
00145    #else
00146       void *m_RgnMgrHandle;                     //!< Region manager handle
00147    #endif
00148       bool m_DoneWarningGeoMixed;
00149       bool m_ReturnSerialReadErr;               //!< Return error when loading group/layout instead of continuing
00150 
00151       GRE_SYSTEM ();
00152    #ifdef X_NATIVE
00153       void* PrivGetRgnMgrHandle ();
00154    #endif
00155 
00156       //! GRE_OBJECT overrides.
00157       virtual bool v_Destroy (bool NotifyParent);
00158       virtual MICON v_GetIcon () const;
00159       virtual const char* v_GetTypeName () const;
00160 
00161       GRE_SYSTEM (const GRE_SYSTEM&);
00162       GRE_SYSTEM& operator= (const GRE_SYSTEM&);
00163 
00164       #endif //!< GENERATING_DOXYGEN_OUTPUT
00165    };
00166 
00167 //===================================================================================================================
00168 
00169 
00170 #endif   //!< INC_GRE_SYSTEM_H

Generated on Tue Dec 14 13:18:14 2004 for TNTsdk by  doxygen 1.3.8-20040913