@@ -12,6 +12,22 @@ namespace Settings
1212 /// </summary>
1313 public class ProbeConnectionSettingsPanel : MonoBehaviour
1414 {
15+ #region Property Getters and Setters
16+
17+ /// <summary>
18+ /// Set probe manager reference attached to this panel.
19+ /// </summary>
20+ /// <param name="probeManager">This panel's probe's corresponding probe manager</param>
21+ public void SetProbeManager ( ProbeManager probeManager )
22+ {
23+ ProbeManager = probeManager ;
24+
25+ probeIdText . text = probeManager . GetID ( ) . ToString ( ) ;
26+ probeIdText . color = probeManager . GetColor ( ) ;
27+ }
28+
29+ #endregion
30+
1531 #region Unity
1632
1733 private void Awake ( )
@@ -24,29 +40,29 @@ private void Awake()
2440 /// </summary>
2541 private void FixedUpdate ( )
2642 {
27- if ( ! _probeManager . IsConnectedToManipulator ( ) ) return ;
43+ if ( ! ProbeManager . IsEphysLinkControlled ) return ;
2844 // Update display for zero coordinate offset
29- if ( _probeManager . GetZeroCoordinateOffset ( ) != _displayedZeroCoordinateOffset )
45+ if ( ProbeManager . ZeroCoordinateOffset != _displayedZeroCoordinateOffset )
3046 {
31- _displayedZeroCoordinateOffset = _probeManager . GetZeroCoordinateOffset ( ) ;
47+ _displayedZeroCoordinateOffset = ProbeManager . ZeroCoordinateOffset ;
3248 xInputField . text = _displayedZeroCoordinateOffset . x . ToString ( CultureInfo . CurrentCulture ) ;
3349 yInputField . text = _displayedZeroCoordinateOffset . y . ToString ( CultureInfo . CurrentCulture ) ;
3450 zInputField . text = _displayedZeroCoordinateOffset . z . ToString ( CultureInfo . CurrentCulture ) ;
3551 dInputField . text = _displayedZeroCoordinateOffset . w . ToString ( CultureInfo . CurrentCulture ) ;
3652 }
3753
3854 // Update brain surface offset drop direction dropdown
39- if ( _probeManager . IsSetToDropToSurfaceWithDepth ( ) != ( brainSurfaceOffsetDirectionDropdown . value == 0 ) )
55+ if ( ProbeManager . IsSetToDropToSurfaceWithDepth != ( brainSurfaceOffsetDirectionDropdown . value == 0 ) )
4056 brainSurfaceOffsetDirectionDropdown . SetValueWithoutNotify (
41- _probeManager . IsSetToDropToSurfaceWithDepth ( ) ? 0 : 1 ) ;
42-
57+ ProbeManager . IsSetToDropToSurfaceWithDepth ? 0 : 1 ) ;
58+
4359 // Enable/disable interactivity of brain surface offset axis
44- if ( _probeManager . CanChangeBrainSurfaceOffsetAxis ( ) != brainSurfaceOffsetDirectionDropdown . interactable )
45- brainSurfaceOffsetDirectionDropdown . interactable = _probeManager . CanChangeBrainSurfaceOffsetAxis ( ) ;
60+ if ( ProbeManager . CanChangeBrainSurfaceOffsetAxis != brainSurfaceOffsetDirectionDropdown . interactable )
61+ brainSurfaceOffsetDirectionDropdown . interactable = ProbeManager . CanChangeBrainSurfaceOffsetAxis ;
4662
4763 // Update display for brain surface offset
48- if ( ! ( Math . Abs ( _probeManager . GetBrainSurfaceOffset ( ) - _displayedBrainSurfaceOffset ) > 0.001f ) ) return ;
49- _displayedBrainSurfaceOffset = _probeManager . GetBrainSurfaceOffset ( ) ;
64+ if ( ! ( Math . Abs ( ProbeManager . BrainSurfaceOffset - _displayedBrainSurfaceOffset ) > 0.001f ) ) return ;
65+ _displayedBrainSurfaceOffset = ProbeManager . BrainSurfaceOffset ;
5066 brainSurfaceOffsetInputField . text =
5167 _displayedBrainSurfaceOffset . ToString ( CultureInfo . CurrentCulture ) ;
5268 }
@@ -70,8 +86,8 @@ private void FixedUpdate()
7086
7187 #endregion
7288
73- private ProbeManager _probeManager ;
74- private EphysLinkSettings _ephysLinkSettings ;
89+ public ProbeManager ProbeManager { get ; private set ; }
90+ public EphysLinkSettings EphysLinkSettings { private get ; set ; }
7591 private TrajectoryPlannerManager _trajectoryPlannerManager ;
7692
7793 #endregion
@@ -85,40 +101,6 @@ private void FixedUpdate()
85101
86102 #endregion
87103
88- #region Property Getters and Setters
89-
90- /// <summary>
91- /// Set probe manager reference attached to this panel.
92- /// </summary>
93- /// <param name="probeManager">This panel's probe's corresponding probe manager</param>
94- public void SetProbeManager ( ProbeManager probeManager )
95- {
96- _probeManager = probeManager ;
97-
98- probeIdText . text = probeManager . GetID ( ) . ToString ( ) ;
99- probeIdText . color = probeManager . GetColor ( ) ;
100- }
101-
102- /// <summary>
103- /// Get the probe manager attached to this panel.
104- /// </summary>
105- /// <returns>This probe's probe manager</returns>
106- public ProbeManager GetProbeManager ( )
107- {
108- return _probeManager ;
109- }
110-
111- /// <summary>
112- /// Set a reference to the Ephys Link settings panel.
113- /// </summary>
114- /// <param name="ephysLinkSettings">Reference to the Ephys Link settings menu.</param>
115- public void SetEphysLinkSettings ( EphysLinkSettings ephysLinkSettings )
116- {
117- _ephysLinkSettings = ephysLinkSettings ;
118- }
119-
120- #endregion
121-
122104 #region Component Methods
123105
124106 /// <summary>
@@ -131,8 +113,8 @@ public void SetManipulatorIdDropdownOptions(List<string> idOptions)
131113 manipulatorIdDropdown . AddOptions ( idOptions ) ;
132114
133115 // Select the option corresponding to the current manipulator id
134- var indexOfId = _probeManager . IsConnectedToManipulator ( )
135- ? Math . Max ( 0 , idOptions . IndexOf ( _probeManager . GetManipulatorId ( ) ) )
116+ var indexOfId = ProbeManager . IsEphysLinkControlled
117+ ? Math . Max ( 0 , idOptions . IndexOf ( ProbeManager . ManipulatorId ) )
136118 : 0 ;
137119 manipulatorIdDropdown . SetValueWithoutNotify ( indexOfId ) ;
138120 }
@@ -143,29 +125,31 @@ public void SetManipulatorIdDropdownOptions(List<string> idOptions)
143125 /// <param name="index">Manipulator option index that was selected (0 = no manipulator)</param>
144126 public void OnManipulatorDropdownValueChanged ( int index )
145127 {
146- if ( _probeManager . IsConnectedToManipulator ( ) )
147- _probeManager . SetEphysLinkMovement ( false , "" , false , ( ) =>
128+ if ( ProbeManager . IsEphysLinkControlled )
129+ ProbeManager . SetIsEphysLinkControlled ( false , "" , false , ( ) =>
148130 {
149131 if ( index != 0 )
132+ {
150133 AttachToManipulatorAndUpdateUI ( ) ;
134+ }
151135 else
152136 {
153- _ephysLinkSettings . UpdateManipulatorPanelAndSelection ( ) ;
154-
137+ EphysLinkSettings . UpdateManipulatorPanelAndSelection ( ) ;
138+
155139 // Cleanup ghost prove stuff if applicable
156- if ( ! _probeManager . HasGhost ( ) ) return ;
157- _trajectoryPlannerManager . DestroyProbe ( _probeManager . GetGhostProbeManager ( ) ) ;
158- _probeManager . SetGhostProbeManager ( null ) ;
140+ if ( ! ProbeManager . HasGhost ) return ;
141+ _trajectoryPlannerManager . DestroyProbe ( ProbeManager . GhostProbeManager ) ;
142+ ProbeManager . GhostProbeManager = null ;
159143 }
160144 } ) ;
161145 else
162146 AttachToManipulatorAndUpdateUI ( ) ;
163147
164148 void AttachToManipulatorAndUpdateUI ( )
165149 {
166- _probeManager . SetEphysLinkMovement ( true ,
150+ ProbeManager . SetIsEphysLinkControlled ( true ,
167151 manipulatorIdDropdown . options [ index ] . text ,
168- onSuccess : ( ) => { _ephysLinkSettings . UpdateManipulatorPanelAndSelection ( ) ; } ) ;
152+ onSuccess : ( ) => { EphysLinkSettings . UpdateManipulatorPanelAndSelection ( ) ; } ) ;
169153 }
170154 }
171155
@@ -175,7 +159,7 @@ void AttachToManipulatorAndUpdateUI()
175159 /// <param name="x">X coordinate</param>
176160 public void OnZeroCoordinateXInputFieldEndEdit ( string x )
177161 {
178- _probeManager . SetZeroCoordinateOffsetX ( float . Parse ( x ) ) ;
162+ ProbeManager . SetZeroCoordinateOffsetX ( float . Parse ( x ) ) ;
179163 }
180164
181165 /// <summary>
@@ -184,7 +168,7 @@ public void OnZeroCoordinateXInputFieldEndEdit(string x)
184168 /// <param name="y">Y coordinate</param>
185169 public void OnZeroCoordinateYInputFieldEndEdit ( string y )
186170 {
187- _probeManager . SetZeroCoordinateOffsetY ( float . Parse ( y ) ) ;
171+ ProbeManager . SetZeroCoordinateOffsetY ( float . Parse ( y ) ) ;
188172 }
189173
190174 /// <summary>
@@ -193,7 +177,7 @@ public void OnZeroCoordinateYInputFieldEndEdit(string y)
193177 /// <param name="z">Z coordinate</param>
194178 public void OnZeroCoordinateZInputFieldEndEdit ( string z )
195179 {
196- _probeManager . SetZeroCoordinateOffsetZ ( float . Parse ( z ) ) ;
180+ ProbeManager . SetZeroCoordinateOffsetZ ( float . Parse ( z ) ) ;
197181 }
198182
199183 /// <summary>
@@ -202,7 +186,7 @@ public void OnZeroCoordinateZInputFieldEndEdit(string z)
202186 /// <param name="d">Depth coordinate</param>
203187 public void OnZeroCoordinateDInputFieldEndEdit ( string d )
204188 {
205- _probeManager . SetZeroCoordinateOffsetDepth ( float . Parse ( d ) ) ;
189+ ProbeManager . SetZeroCoordinateOffsetDepth ( float . Parse ( d ) ) ;
206190 }
207191
208192 /// <summary>
@@ -211,7 +195,7 @@ public void OnZeroCoordinateDInputFieldEndEdit(string d)
211195 /// <param name="value">Selected direction: 0 = depth, 1 = DV</param>
212196 public void OnBrainSurfaceOffsetDirectionDropdownValueChanged ( int value )
213197 {
214- _probeManager . SetDropToSurfaceWithDepth ( value == 0 ) ;
198+ ProbeManager . SetDropToSurfaceWithDepth ( value == 0 ) ;
215199 }
216200
217201 /// <summary>
@@ -220,7 +204,7 @@ public void OnBrainSurfaceOffsetDirectionDropdownValueChanged(int value)
220204 /// <param name="value">Input field value</param>
221205 public void OnBrainSurfaceOffsetValueUpdated ( string value )
222206 {
223- _probeManager . SetBrainSurfaceOffset ( float . Parse ( value ) ) ;
207+ ProbeManager . BrainSurfaceOffset = float . Parse ( value ) ;
224208 }
225209
226210 /// <summary>
@@ -229,7 +213,7 @@ public void OnBrainSurfaceOffsetValueUpdated(string value)
229213 /// <param name="amount">Amount to increment by (negative numbers are valid)</param>
230214 public void IncrementBrainSurfaceOffset ( float amount )
231215 {
232- _probeManager . IncrementBrainSurfaceOffset ( amount ) ;
216+ ProbeManager . IncrementBrainSurfaceOffset ( amount ) ;
233217 }
234218
235219 #endregion
0 commit comments