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.5 2005/05/13 14:38:05 scowan Exp $
00007  *
00008  * $Log: system.h_v $
00009  * Revision 1.5  2005/05/13 14:38:05  scowan
00010  * Moved global lists to here.
00011  *
00012  * Revision 1.4  2004/12/16 14:58:33  mju
00013  * Add GetAutoOpenList.
00014  *
00015  * Revision 1.3  2003/09/15 13:48:59  fileserver!dwilliss
00016  * Doxygen
00017  *
00018  * Revision 1.2  2003/07/30 15:35:04  mju
00019  * Ignore private sections.
00020  *
00021  * Revision 1.1  2003/06/16 19:40:12  mju
00022  * Initial revision
00023  *
00024  * \endif
00025 **/
00026 
00027 #ifndef  INC_GRE_SYSTEM_H
00028 #define  INC_GRE_SYSTEM_H
00029 
00030 #ifndef  INC_GRE_OBJECTBASE_H
00031    #include <gre/objectbase.h>
00032 #endif
00033 
00034 #ifndef  INC_MI32_CRITSEC_H
00035    #include <mi32/critsec.h>
00036 #endif
00037 
00038 #if !defined(INC_MI32_NAMEDRGN_H) && defined(WIN32_NATIVE)
00039    #include <mi32/namedrgn.h>
00040 #endif
00041 
00042 #ifndef GENERATING_DOXYGEN_OUTPUT
00043 class GRE_GROUP;
00044 class GRE_LAYOUT;
00045 class GRE_VIEW;
00046 #endif
00047 
00048 //===================================================================================================================
00049 
00050 //! GRE "system" container object.
00051 //!
00052 //! A single instance of this object is automatically created by the GRE system.  This
00053 //! object is used as an implied container for all other top-level GRE (usually GRE_VIEWABLE)
00054 //! objects.  This provides a convenient place to attach callbacks where notification is desired
00055 //! for all layouts and top-level groups.
00056 class GRE_SYSTEM : public GRE_OBJECT {
00057    public:
00058 
00059       enum AUTOOPEN {
00060          AUTOOPEN_None,
00061          AUTOOPEN_Layout,
00062          AUTOOPEN_Group,
00063          AUTOOPEN_Layer
00064          };
00065 
00066       //! Get list of objects to auto-open via command line.
00067       //! @return Type of auto-open to be performed.
00068       static AUTOOPEN GetAutoOpenList (
00069          MDLGPARENT dlgparent,                        //!< Parent for dialog if need to prompt user for anything
00070          const SIMPLE_ARRAY<const char*>& cmdparms,   //!< Command-line parameters
00071          RVC::OBJITEMLIST& ObjItemList                //!< Object item list returned
00072          );
00073          
00074       //! Get reference to the first 'standalone' group
00075       //! To access this data you should get a lock on the group critical section
00076       static GRE_GROUP* GetFirstGroup (
00077          ) { return (GetRef().m_FirstGroup); }
00078 
00079       //! Get first layout in GRE system.
00080       //! To access this data you should get a lock on the layout critical section
00081       static GRE_LAYOUT* GetFirstLayout (
00082          ) { return (GetRef().m_FirstLayout); }
00083 
00084       //! Get first view in GRE system.
00085       //! To access this data you should get a lock on the layout critical section
00086       static GRE_VIEW* GetFirstView (
00087          ) { return (GetRef().m_FirstView); }
00088 
00089       //! Get reference to the last 'standalone' group
00090       //! To access this data you should get a lock on the group critical section
00091       static GRE_GROUP* GetLastGroup (
00092          ) { return (GetRef().m_LastGroup); }
00093 
00094       //! Get last layout in GRE system.
00095       //! To access this data you should get a lock on the layout critical section
00096       static GRE_LAYOUT* GetLastLayout (
00097          ) { return (GetRef().m_LastLayout); }
00098 
00099       //! Get reference to the 'standalone' group list critical section
00100       static CRITICALSECTION& GetGroupCriticalSection (
00101          ) { return (GetRef().m_GroupListSec); }
00102 
00103       //! Get reference to the layout list critical section
00104       static CRITICALSECTION& GetLayoutCriticalSection (
00105          ) { return (GetRef().m_LayoutListSec); }
00106 
00107       //! Get reference to the view list critical section
00108       static CRITICALSECTION& GetViewCriticalSection (
00109          ) { return (GetRef().m_ViewListSec); }
00110 
00111       //! Get reference to the single GRE_SYSTEM instance.
00112       static GRE_SYSTEM& GetRef (
00113          );
00114 
00115       //! Determine whether to return or continue on serial read error.
00116       static bool GetReturnSerialReadErr (
00117          ) { return (GetRef().m_ReturnSerialReadErr); }
00118 
00119    #ifdef WIN32_NATIVE
00120       //! Get shared region list.
00121       //! @return Reference to shared region list.
00122       //! This method is only available when compiling for WIN32_NATIVE.
00123       static NAMEDREGION_LIST& GetRegionList (
00124          ) { return (GetRef().m_RegionList); }
00125    #endif
00126 
00127    #ifdef X_NATIVE
00128       //! Get "handle" for shared "region manager".
00129       //! This method is only available when compiling for X.
00130       static void* GetRgnMgrHandle (
00131          ) { return (GetRef().PrivGetRgnMgrHandle()); }
00132    #endif
00133 
00134       //! Check if have displayed warning about mixing georef/ungeoref layers.
00135       static bool HasDoneWarningGeoMixed (
00136          ) { return (GetRef().m_DoneWarningGeoMixed); }
00137 
00138       //! Initialize GRE system for non-interactive use.
00139       //! This will automatically register the standard geospatial layer types.
00140       //! At program exit, GRE_SYSTEM::Stop() should be called for proper cleanup.
00141       static void Init (
00142          );
00143 
00144    #ifdef WIN32_MFC
00145       //! Initialize GRE system for interactive use in Microsoft Windows with MFC.
00146       //! This will automatically register the standard geospatial layer types.
00147       //! At program exit, GRE_SYSTEM::StopMFC() should be called for proper cleanup.
00148       //! This is only available when compiling for WIN32_NATIVE and WIN32_MFC.
00149       static void InitMFC (
00150          );
00151    #endif
00152 
00153    #ifdef X_NATIVE
00154       //! Initialize GRE system for interactive use in X Windows.
00155       //! This will automatically register the standard geospatial layer types.
00156       //! At program exit, GRE_SYSTEM::StopX() should be called for proper cleanup.
00157       //! This method is only available when compiling for X.
00158       static void InitX (
00159          int numworkpixels = 0
00160          );
00161    #endif
00162 
00163       //! Register layout-specific layer types (text, scalebar, legend).
00164       //! By default only the standard geospatial layer are registered.
00165       static void RegisterLayoutLayerTypes (
00166          );
00167 
00168       //! Set whether have displayed warning about mixing georef/ungeoref layers.
00169       //!
00170       //! Normally a warning dialog is displayed the first time a user attempts to place
00171       //! both georeferenced and non-georeferenced spatial objects in the same GRE_GROUP.
00172       //! In some processes, such as georeference editing, this is necessary, so this
00173       //! method is provided to avoid the unwanted warning dialog.
00174       static void SetDoneWarningGeoMixed (
00175          bool set = true
00176          ) { GetRef().m_DoneWarningGeoMixed = set; }
00177 
00178       //! Set reference to the first 'standalone' group
00179       //! To access this data you should get a lock on the group critical section
00180       static void SetFirstGroup (
00181          GRE_GROUP* group
00182          ) { GetRef().m_FirstGroup = group; }
00183 
00184       //! Set reference to the first layout
00185       //! To access this data you should get a lock on the layout critical section
00186       static void SetFirstLayout (
00187          GRE_LAYOUT* layout
00188          ) { GetRef().m_FirstLayout = layout; }
00189 
00190       //! Set first view in GRE system.
00191       //! To access this data you should get a lock on the layout critical section
00192       static void SetFirstView (
00193          GRE_VIEW* view
00194          ) { GetRef().m_FirstView = view; }
00195 
00196       //! Set reference to the last 'standalone' group
00197       //! To access this data you should get a lock on the group critical section
00198       static void SetLastGroup (
00199          GRE_GROUP* group
00200          ) { GetRef().m_LastGroup = group; }
00201 
00202       //! Set reference to the last layout
00203       //! To access this data you should get a lock on the layout critical section
00204       static void SetLastLayout (
00205          GRE_LAYOUT* layout
00206          ) { GetRef().m_LastLayout = layout; }
00207 
00208       //! Set whether to return serial read error or continue.
00209       static void SetReturnSerialReadErr (
00210          bool set = true
00211          ) { GetRef().m_ReturnSerialReadErr = set; };
00212 
00213       //! Terminate GRE system at program exit.
00214       //! This method should only be called if GRE_SYSTEM::Init() was used.
00215       static void Stop (
00216          );
00217 
00218    #ifdef WIN32_MFC
00219       //! Terminate GRE system at program exit.
00220       //! This method should only be called if GRE_SYSTEM::InitMFC() was used.
00221       static void StopMFC (
00222          );
00223    #endif
00224 
00225    #ifdef X_NATIVE
00226       //! Terminate GRE system at program exit.
00227       //! This method should only be called if GRE_SYSTEM::InitX() was used.
00228       static void StopX (
00229          );
00230    #endif
00231 
00232       #ifndef GENERATING_DOXYGEN_OUTPUT
00233       ~GRE_SYSTEM ();
00234       #endif
00235 
00236    private:
00237       #ifndef GENERATING_DOXYGEN_OUTPUT
00238 
00239       static bool s_InitDone;
00240 
00241    #ifdef WIN32_NATIVE
00242       NAMEDREGION_LIST m_RegionList;            //!< Shared region list
00243    #else
00244       void *m_RgnMgrHandle;                     //!< Region manager handle
00245    #endif
00246       bool m_DoneWarningGeoMixed;
00247       bool m_ReturnSerialReadErr;               //!< Return error when loading group/layout instead of continuing
00248       CRITICALSECTION m_GroupListSec;
00249       CRITICALSECTION m_LayoutListSec;
00250       CRITICALSECTION m_ViewListSec;
00251       GRE_GROUP* m_FirstGroup;
00252       GRE_GROUP* m_LastGroup;
00253       GRE_LAYOUT* m_FirstLayout;
00254       GRE_LAYOUT* m_LastLayout;
00255       GRE_VIEW* m_FirstView;
00256 
00257       GRE_SYSTEM ();
00258    #ifdef X_NATIVE
00259       void* PrivGetRgnMgrHandle ();
00260    #endif
00261 
00262       //! GRE_OBJECT overrides.
00263       virtual bool v_Destroy (bool NotifyParent);
00264       virtual MICON v_GetIcon () const;
00265       virtual const char* v_GetTypeName () const;
00266 
00267       GRE_SYSTEM (const GRE_SYSTEM&);
00268       GRE_SYSTEM& operator= (const GRE_SYSTEM&);
00269 
00270       #endif //!< GENERATING_DOXYGEN_OUTPUT
00271    };
00272 
00273 //===================================================================================================================
00274 
00275 
00276 #endif   //!< INC_GRE_SYSTEM_H

Generated on Wed May 31 15:26:42 2006 for TNTsdk by  doxygen 1.3.8-20040913