![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2010 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtChannelKeywordCompass.h,v $ $Revision: 1.11 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00012 00013 #pragma once 00014 00015 #include <vrvCore/vrvCore.h> 00016 #include <vrvCore/DtChannelKeywordObject.h> 00017 00018 #include <vrvUtil/DtSignalConnectionManager.h> 00019 00020 #include <string> 00021 00022 namespace makVrv 00023 { 00024 class DtDe; 00025 class DtChannelConfiguration; 00026 class DtWindowConfiguration; 00027 class DtChannelCompassAgent; 00028 class DtObserver; 00029 class DtInputDriver; 00030 00033 class DT_DLL_VRVCORE DtChannelKeywordCompass : public DtChannelKeywordObject 00034 { 00035 public: 00036 00038 friend class DtChannelKeywordLargeCompassCreator; 00039 friend class DtChannelKeywordSmallCompassCreator; 00040 00042 virtual ~DtChannelKeywordCompass(); 00043 00047 virtual void channelNameChanged( const std::string& displayName, 00048 const std::string& windowName, const std::string& channelName ); 00049 00052 virtual void channelConfigurationChanged( 00053 const DtChannelConfiguration& config ); 00054 00057 virtual void windowConfigurationChanged( 00058 const DtWindowConfiguration& config ) {} 00059 00061 DtChannelCompassAgent* compassAgent(); 00062 00063 protected: 00064 00065 // Slots for responding to observer-related signals 00066 00067 // Called when an observer is created, so that we can connect to an observer that 00068 // didn't exist when the compass itself was created 00069 virtual void slot_observerCreated( DtInputDriver*, DtObserver* observer ); 00070 00071 // Called when an observer is about to be destroyed, so we can disconnect from the 00072 // observer mode changed signal and set myObserver to Null 00073 virtual void slot_observerToBeDestroyed( DtInputDriver*, DtObserver* observer ); 00074 00075 // Called when an observer's observer mode changes, so we can determine if we need 00076 // to create or destroy a compass 00077 virtual void slot_observerModeChanged( DtObserver* observer, int newMode ); 00078 00079 // Called when an observer mode's setting changes; if its the mode our observer is 00080 // using and the setting is DisplayCompass, we may need to create or destroy 00081 // a compass 00082 virtual void slot_observerModeSettingChanged( int mode, int setting ); 00083 00084 // Helper methods 00085 00086 // Set myObserver to the specified observer and connect to the observerModeChanged 00087 // signal 00088 virtual void connectToObserver( DtObserver* observer ); 00089 00090 // Look up the observer by name, cache the observer name, and call connectToObserver 00091 // with the found observer 00092 virtual void connectToObserver( const std::string& observerName ); 00093 00094 // Disconnect from the current observer's observerModeChanged signal, delete the 00095 // the compass agent if it exists, and set myObserver and myCompassAgent 00096 // to Null 00097 virtual void disconnectFromObserver(); 00098 00099 // This function looks up the display compass observer setting value and creates 00100 // or destroys a compass as needed 00101 virtual void updateCompassState(); 00102 00103 protected: 00104 00106 DtChannelKeywordCompass( DtDe& de, const std::string& keyword, 00107 const std::string& displayName, const std::string& windowName, 00108 const DtChannelConfiguration& channelConfig ); 00109 00110 protected: 00111 00112 DtChannelCompassAgent* myCompassAgent; 00113 std::string myObserverName; 00114 DtObserver* myObserver; 00115 std::string myKeyword; 00116 std::string myDisplayName; 00117 std::string myWindowName; 00118 std::string myChannelName; 00119 DtSignalConnectionManager myConnections; 00120 }; 00121 00124 class DT_DLL_VRVCORE DtChannelKeywordLargeCompassCreator : public DtChannelKeywordObjectCreator 00125 { 00126 public: 00128 DtChannelKeywordLargeCompassCreator(); 00129 00131 virtual ~DtChannelKeywordLargeCompassCreator(); 00132 00134 virtual DtChannelKeywordObject* createChannelKeywordObject(DtDe& de, 00135 const std::string& displayName, const std::string& windowName, 00136 const DtChannelConfiguration& channelConfig ); 00137 00138 public: 00139 static std::string keyword(); 00140 00141 protected: 00142 std::string myKeyword; 00143 }; 00144 00145 00148 class DT_DLL_VRVCORE DtChannelKeywordSmallCompassCreator : public DtChannelKeywordObjectCreator 00149 { 00150 public: 00152 DtChannelKeywordSmallCompassCreator(); 00153 00155 virtual ~DtChannelKeywordSmallCompassCreator(); 00156 00158 virtual DtChannelKeywordObject* createChannelKeywordObject(DtDe& de, 00159 const std::string& displayName, const std::string& windowName, 00160 const DtChannelConfiguration& channelConfig ); 00161 00162 public: 00163 static std::string keyword(); 00164 00165 protected: 00166 std::string myKeyword; 00167 }; 00168 } 00169 00170