VR-Forces 4.0.4 Class Documentation
include/vrvCore/DtEnvironment.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2011 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtEnvironment.h,v $ $Revision: 1.16 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #ifndef DtEnvironment_H_
00014 #define DtEnvironment_H_
00015 
00016 #include <vrvCore/vrvCore.h>
00017 #include <vrvCore/DtRecordSettingsBackup.h>
00018 
00019 #include <vrvUtil/DtSignalConnectionManager.h>
00020 #include <vrvUtil/DtVirtualBaseClass.h>
00021 #include <vrvUtil/event_signal.h>
00022 
00023 #include <boost/signal.hpp>
00024 #include <string>
00025 
00026 namespace makArchives
00027 {
00028    class DtCloudLayerRecord;
00029    class DtEnvironmentRecord;
00030 }
00031 
00032 namespace makVrv
00033 {
00034    class DtDe;
00035    class DtAgentManagerInterface;
00036    class DtSkyObjectAgent;
00037    class DtEventQueueInterface;
00038    class DtSharedSettingsManager;
00039 
00043    class DT_DLL_VRVCORE DtEnvironment
00044    {
00045    public:
00046 
00047       enum PrecipitationType
00048       {
00049          Rain = 0,
00050          Snow = 1
00051       };
00052 
00054       DtEnvironment(DtDe& de, DtAgentManagerInterface& sceneInterface);
00055 
00057       ~DtEnvironment();
00058 
00060       void clear();
00061 
00063       void getRecord(makArchives::DtEnvironmentRecord& record);
00064 
00066       void setFromRecord(const makArchives::DtEnvironmentRecord& record);
00067 
00069       void addCloudLayer(const makArchives::DtCloudLayerRecord& record);
00070 
00072       void setCloudLayerEnabled(unsigned int index, bool enabled);
00073 
00075       void setCloudLayerPosition(unsigned int index, double xCoord, double yCoord);
00076       
00078       void removeCloudLayer(unsigned int index);
00079 
00081       void setAirTurbidity(float turbidity);
00082 
00084       void setVisibleDistance(float distance);
00085 
00087       void setPrecipitationEnabled(bool enabled);
00088 
00090       void setPrecipitationType(PrecipitationType type);
00091 
00093       void setPrecipitationIntensity(float intensity);
00094 
00095 
00097       const makArchives::DtEnvironmentRecord& settings() const;   
00098 
00099       //Helper Function
00100       static int translateCloudTypeStringToEnum(const std::string& str);
00101 
00102       //Helper Function
00103       static  std::string translateCloudTypeEnumToString(int id);
00104 
00105       //Called from CTOR to load the default settings.
00106       void loadDefaults(bool loadOnlyFactorySettings = false);
00107 
00108       // Restores to backup up environment from startup default
00109       void restore();
00110 
00111       //Called to save the current settings as the default settings.
00112       void saveAsDefaults();
00113 
00114       void exportSettings(const std::string& fileName);
00115       void importSettings(const std::string& fileName);
00116 
00117       const DtSettingsBackup* settingsBackup() const
00118       {
00119          return mySettingsBackup;
00120       }
00121 
00122       DtSettingsBackup* settingsBackup()
00123       {
00124          return mySettingsBackup;
00125       }
00126    protected:
00127 
00129       virtual void slot_coordinateSystemChanged( const std::string&, const std::string& );
00130 
00131    protected:
00132 
00133       DtDe& myDe;
00134       DtAgentManagerInterface& mySceneInterface;
00135 
00136       makArchives::DtEnvironmentRecord* mySettings;
00137 
00138       DtSkyObjectAgent* mySkyObject;
00139       DtRecordSettingsBackupInterface*  mySettingsBackup;
00140       DtSignalConnectionManager myConnections;
00141 
00142    };
00143 
00146    class DT_DLL_VRVCORE DtEnvironmentSignaler : public DtVirtualBaseClass
00147    {
00148    public:
00149 
00151       static DtEnvironmentSignaler& instance(DtDe& de);
00152 
00154       virtual ~DtEnvironmentSignaler();
00155 
00156       //Signaled when any of the atmospheric parameters change.
00157       boost::signal<void ()> signal_atmosphericParametersChanged;
00158       
00159       //Signaled when any of the precipitation parameters change.
00160       boost::signal<void ()> signal_precipitationSettingsChanged;
00161 
00162       boost::signal<void (int index)> signal_cloudLayerAdded;
00163       boost::signal<void (int index)> signal_cloudLayerToBeDestroyed;
00164       boost::signal<void (int index, bool enabled)> signal_cloudLayerEnabledChanged;
00165 
00166    protected:
00167       DtEnvironmentSignaler();
00168 
00169    };
00170 
00174    class DT_DLL_VRVCORE DtWeatherProcessorSignaler : public DtVirtualBaseClass
00175    {
00176    public:
00179       static DtWeatherProcessorSignaler& instance(const DtSharedSettingsManager& ssm);
00180 
00183       static DtWeatherProcessorSignaler& instance(DtEventQueueInterface& eqi);
00184 
00188       static DtWeatherProcessorSignaler* findInstance(DtEventQueueInterface* eqi);
00189 
00191       virtual ~DtWeatherProcessorSignaler();
00192 
00193       event_signal< void()  > signal_refreshRemoteWeather;
00194 
00195    protected:
00196       DtWeatherProcessorSignaler(DtEventQueueInterface& eqi);
00197 
00198    private:
00199       DtWeatherProcessorSignaler(const DtWeatherProcessorSignaler&);
00200       DtWeatherProcessorSignaler& operator=(const DtWeatherProcessorSignaler&);
00201    };
00202 
00203    typedef DtRecordSettingsBackup<DtEnvironment, makArchives::DtEnvironmentRecord> DtEnvironmentSettingsBackup;
00204 }
00205 
00206 #endif
00207 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)