-
Notifications
You must be signed in to change notification settings - Fork 15
Location Widget
The Location Widget is a TextImageLeft type of Base Telemetry Widget. It shows the current geo location which is constituted of the latitude and longitude as reported by the drone. It updates the coordinates in real time and provides a precision up to 6 decimal places. The states of the widget are the following:
State | Image |
---|---|
Disconnected or Location Unavailable | |
Location Available |
If creating the location widget through code it can be added using the convenience method:
- (void)installInViewController:(nullable UIViewController *)viewController
which adds the widget the method is called on, as a subview of the ViewController, that is passed in as an argument. Following this, add constraints to the widget using its widgetSizeHint
property to determine width, height and aspect ratio constraints.
If creating the widget through storyboard use the object library to drag a container view controller into the desired view controller like so:
Following this make sure to change the class of the child view controller to be DUXBetaLocationWidget
. From here you can create the constraints on the container view using the Telemetry Panel Widget's widgetSizeHint
property.
The UI elements can be customized to match the style of the user's application. The widget supports all the Text Customizations provided in the Base Telemetry Widget.
State | Image |
---|---|
Disconnected or Location Unavailable | |
Location Available |
locationWidget.backgroundColor = UIColor.white
locationWidget.labelTextColor = UIColor.black
locationWidget.valueTextColor = UIColor.blue
locationWidget.unitTextColor = UIColor.blue
locationWidget.image = UIImage(named: "Location")
locationWidget.backgroundColor = [UIColor whiteColor];
locationWidget.labelTextColor = [UIColor blackColor];
locationWidget.valueTextColor = [UIColor blueColor];
locationWidget.unitTextColor = [UIColor blueColor];
locationWidget.image = [UIImage imageNamed: @"Location"];
The widget provides hooks for the users to add functionality based on the state changes in the widget.
The DUXBetaLocationWidget
provides the following hooks:
-
LocationModelState
- Provides hooks in events received by the widget from the widget model.-
public static func productConnected(_ isConnected: Bool) -> LocationModelState
- Event when the product is connected or disconnected. -
public static func locationStateUpdated(_ locationState: LocationState) -> LocationModelState
- Event when the aircraft location is updated.
-
DJI UX SDK Version 5 Beta 4.1