class MapWidget extends FrameLayoutWidget implements View.OnTouchListener, View.OnClickListener |
Package: | dji.ux.widget |
Inherits From: | FrameLayoutWidget implements View.OnTouchListener, View.OnClickListener |
Widget that displays the aircraft's state and information on the map this includes aircraft location, home location, aircraft trail path, aircraft heading, and No Fly Zones.
Preferred Aspect Ratio: 1:1
float getFlightPathWidth() |
Package: | dji.ux.widget |
Gets the line width, in pixels, of the flight path. Valid range is 0-100.
float | The width in pixels of the flight path. |
void initHereMap(final OnMapReadyListener listener) |
Package: | dji.ux.widget |
Initializes the MapWidget with Here Maps.
Note: Here Maps currently only works on arm v7 devices, and you must sign up for their premium package.
final OnMapReadyListener listener | The OnMapReadyListener which will invoke the onMapReady method when the map has finished initializing. |
void initGoogleMap(final OnMapReadyListener listener) |
Package: | dji.ux.widget |
Initializes the MapWidget with Google Maps.
Note: Google Maps only works on devices with Google Play Services (not Crystal Sky).
Important: The following lifecycle methods in your activity must call the corresponding methods in MapWidget in order for the map to render correctly: {@link #onCreate(Bundle)}, {@link #onResume()}, {@link #onPause()}, {@link #onDestroy()}, {@link #onSaveInstanceState(Bundle)}, and {@link #onLowMemory()}.
final OnMapReadyListener listener | The OnMapReadyListener which will invoke the onMapReady method when the map has finished initializing. |
void initAMap(final OnMapReadyListener listener) |
Package: | dji.ux.widget |
Initializes the MapWidget with AMaps.
final OnMapReadyListener listener | The OnMapReadyListener which will invoke the onMapReady method when the map has finished initializing. |
void initMapboxMap(final OnMapReadyListener listener, String mapboxAccessToken) |
Package: | dji.ux.widget |
Initializes the MapWidget with Mapbox.
Important: The following lifecycle methods in your activity must call the corresponding methods in MapWidget in order for the map to render correctly: {@link #onCreate(Bundle)}, {@link #onResume()}, {@link #onPause()}, {@link #onDestroy()}, {@link #onSaveInstanceState(Bundle)}, and {@link #onLowMemory()}.
final OnMapReadyListener listener | The OnMapReadyListener which will invoke the onMapReady method when the map has finished initializing. |
String mapboxAccessToken | The API access token from Mapbox. |
DJIMap getMap() |
Package: | dji.ux.widget |
Get the DJIMap object.
DJIMap | A DJIMap object. |
void hideAllFlyZones() |
Package: | dji.ux.widget |
Hides all fly zones.
void clearFlightPath() |
Package: | dji.ux.widget |
Clears the flight path up to the current location. The flight path is removed even if it is hidden.
void setFlightPathColor(@ColorInt int color) |
Package: | dji.ux.widget |
Sets the color of the flight path.
@ColorInt int color | The color of the flight path. |
void setMapCenterLock(MapCenterLock mapCenterLock) |
Package: | dji.ux.widget |
Sets the lock on the aircraft or the home location to be in center.
MapCenterLock mapCenterLock | Parameter to select the mode of centering. |
void setOnMarkerClickListener(DJIMap.OnMarkerClickListener onMarkerClickListener) |
Package: | dji.ux.widget |
Sets the OnMarkerClickListener for this widget.
DJIMap.OnMarkerClickListener onMarkerClickListener | The listener that is added to this widget. |
void setAutoFrameMap(boolean isEnabled) |
Package: | dji.ux.widget |
Keeps the home location and the aircraft location visible and adjust the map bounds when set true
.
boolean isEnabled | Parameter to enable or disable the map bounds lock. |
void setHomeBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the home marker.
Bitmap bitmap | The image to be set to. |
void setHomeBitmap(Bitmap bitmap, float x, float y) |
Package: | dji.ux.widget |
Changes the icon of the home marker.
Bitmap bitmap | The image to be set to. |
float x | Specifies the x axis value of anchor to be at a particular point in the marker image. |
float y | Specifies the y axis value of anchor to be at a particular point in the marker image. |
Bitmap getHomeBitmap() |
Package: | dji.ux.widget |
Gets the icon of the home marker.
Bitmap | The icon of the home marker. |
void setFlyZoneColor(FlyZoneCategory category, @ColorInt int color) |
Package: | dji.ux.widget |
Sets the color of the given fly zone category.
FlyZoneCategory category | The fly zone category. |
@ColorInt int color | The new border color. |
|
Package: | dji.ux.widget |
Get the color of the given fly zone category.
FlyZoneCategory category | The fly zone category. |
int | A color int. |
void setFlyZoneAlpha(FlyZoneCategory category, int alpha) |
Package: | dji.ux.widget |
Set the alpha of the given fly zone category.
FlyZoneCategory category | The fly zone category. |
int alpha | An alpha value from 0-255. |
int getFlyZoneAlpha(FlyZoneCategory category) |
Package: | dji.ux.widget |
Get the alpha of the given fly zone category.
FlyZoneCategory category | The fly zone category. |
int | An alpha value from 0-255. |
void setFlyZoneBorderWidth(float width) |
Package: | dji.ux.widget |
Set the border width of all fly zones.
float width | The width in pixels of the fly zone borders. |
float getFlyZoneBorderWidth() |
Package: | dji.ux.widget |
Get the border width of all fly zones.
float | The width in pixels of the fly zone borders. |
|
Package: | dji.ux.widget |
Get the color of the self-unlock fly zones.
int | A color int. |
void setSelfUnlockColor(@ColorInt int selfUnlockColor) |
Package: | dji.ux.widget |
Set the color of the self-unlock fly zones.
@ColorInt int selfUnlockColor | The new color. |
int getSelfUnlockAlpha() |
Package: | dji.ux.widget |
Get the alpha of the self-unlock fly zones.
int | The alpha of the self-unlock fly zones. |
void setSelfUnlockAlpha(int selfUnlockAlpha) |
Package: | dji.ux.widget |
Set the alpha of the self unlock fly zones.
int selfUnlockAlpha | The new alpha. |
void setCustomUnlockFlyZoneOverlayColor(@ColorInt int customUnlockColor) |
Package: | dji.ux.widget |
Set the color of the custom unlock fly zones.
@ColorInt int customUnlockColor | The new color. |
void setCustomUnlockFlyZoneSentToAircraftOverlayColor(@ColorInt int customUnlockSentToAircraftColor) |
Package: | dji.ux.widget |
Set the color of the custom unlock fly zones that have been sent to the aircraft.
@ColorInt int customUnlockSentToAircraftColor | The new color. |
void setCustomUnlockFlyZoneEnabledOverlayColor(@ColorInt int customUnlockEnabledColor) |
Package: | dji.ux.widget |
Set the color of the currently enabled custom unlock fly zones.
@ColorInt int customUnlockEnabledColor | The new color. |
|
Package: | dji.ux.widget |
Get the color of the custom unlock zone.
int | A color int. |
|
Package: | dji.ux.widget |
Get the color of the custom unlock zones sent to the aircraft.
int | A color int. |
|
Package: | dji.ux.widget |
Get the color of the currently enabled custom unlock fly zone.
int | A color int. |
void setCustomUnlockFlyZoneOverlayAlpha(int customUnlockColorAlpha) |
Package: | dji.ux.widget |
Set the alpha of the custom unlock fly zones.
int customUnlockColorAlpha | The new alpha. |
void setCustomUnlockFlyZoneSentToAircraftOverlayAlpha(int customUnlockSentToAircraftColorAlpha) |
Package: | dji.ux.widget |
Set the alpha of the custom unlock fly zones sent to the aircraft.
int customUnlockSentToAircraftColorAlpha | The new alpha. |
void setCustomUnlockFlyZoneEnabledOverlayAlpha(int customUnlockEnabledColorAlpha) |
Package: | dji.ux.widget |
Set the alpha of the currently enabled custom unlock fly zones.
int customUnlockEnabledColorAlpha | The new alpha. |
int getCustomUnlockFlyZoneOverlayAlpha() |
Package: | dji.ux.widget |
Get the alpha of the custom unlock fly zones.
int | The alpha. |
int getCustomUnlockFlyZoneSentToAircraftOverlayAlpha() |
Package: | dji.ux.widget |
Get the alpha of the custom unlock fly zones sent to the aircraft.
int | The alpha. |
int getCustomUnlockFlyZoneEnabledOverlayAlpha() |
Package: | dji.ux.widget |
Get the alpha of the currently enabled custom unlock fly zone.
int | The alpha. |
|
Package: | dji.ux.widget |
Get the color of the maximum height fly zones.
int | The color of the maximum height fly zones. |
void setMaximumHeightColor(@ColorInt int limitedHeightColor) |
Package: | dji.ux.widget |
Set the color of the maximum height fly zones.
@ColorInt int limitedHeightColor | The new color. |
int getMaximumHeightAlpha() |
Package: | dji.ux.widget |
Get the alpha of the maximum height fly zones.
int | The alpha. |
void setMaximumHeightAlpha(int maximumHeightAlpha) |
Package: | dji.ux.widget |
Set the alpha of the maximum height fly zones.
int maximumHeightAlpha | The new alpha. |
void setFlyZoneVisible(FlyZoneCategory flyZoneCategory, boolean isVisible) |
Package: | dji.ux.widget |
Set selected fly zone visibility on the map.
FlyZoneCategory flyZoneCategory | Represents the category of fly zone to show/hide. |
boolean isVisible | true to show fly zones. |
boolean isFlyZoneVisible(FlyZoneCategory flyZoneCategory) |
Package: | dji.ux.widget |
Get selected fly zone visibility on the map.
FlyZoneCategory flyZoneCategory | The category of the fly zone. |
boolean | Whether the given fly zone category is visible on the map. |
void setTapToUnlockEnabled(boolean isFlyZonesUnlockingEnabled) |
Package: | dji.ux.widget |
This will enable the unlocking of fly zones by clicking on them.
boolean isFlyZonesUnlockingEnabled | A boolean value that determines whether to enable Fly Zones Unlocking. |
boolean isTapToUnlockEnabled() |
Package: | dji.ux.widget |
Gets whether tap to unlock is enabled.
boolean | true if tapping to unlock select fly zones is enabled. |
void setSelfUnlockedBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the unlocked self-unlock zones.
Bitmap bitmap | The image to be set. |
void setSelfUnlockedBitmap(Bitmap bitmap, float x, float y) |
Package: | dji.ux.widget |
Changes the icon of the unlocked self-unlock zones.
Bitmap bitmap | The image to be set. |
float x | Specifies the x axis value of anchor to be at a particular point in the marker image. |
float y | Specifies the y axis value of anchor to be at a particular point in the marker image. |
void setSelfLockedBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the locked self-unlock zones
Bitmap bitmap | The image to be set. |
void setSelfLockedBitmap(Bitmap bitmap, float x, float y) |
Package: | dji.ux.widget |
Changes the icon of the locked self-unlock zones
Bitmap bitmap | The image to be set. |
float x | Specifies the x axis value of anchor to be at a particular point in the marker image. |
float y | Specifies the y axis value of anchor to be at a particular point in the marker image. |
void setCustomUnlockEnabledBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the custom unlock zone which is enabled.
Bitmap bitmap | The image to be set. |
void setCustomUnlockEnabledBitmap(Bitmap bitmap, float x, float y) |
Package: | dji.ux.widget |
Changes the icon of the custom unlock zone which is enabled.
Bitmap bitmap | The image to be set. |
float x | Specifies the x axis value of anchor to be at a particular point in the marker image. |
float y | Specifies the y axis value of anchor to be at a particular point in the marker image. |
void setCustomUnlockSentToAircraftBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the custom unlock zone which is on aircraft but not enabled.
Bitmap bitmap | The image to be set. |
void setCustomUnlockSentToAircraftBitmap(Bitmap bitmap, float x, float y) |
Package: | dji.ux.widget |
Changes the icon of the custom unlock zone which is on aircraft but not enabled.
Bitmap bitmap | The image to be set. |
float x | Specifies the x axis value of anchor to be at a particular point in the marker image. |
float y | Specifies the y axis value of anchor to be at a particular point in the marker image. |
void setDirectionToHomeVisible(boolean isVisible) |
Package: | dji.ux.widget |
Sets the visibility of the path from aircraft to home point.
boolean isVisible | A boolean value that determines whether to show the path from aircraft to home point. |
boolean isDirectionToHomeVisible() |
Package: | dji.ux.widget |
Defaults to false
. A Boolean value indicating whether the map displays a line showing
the direction to home.
boolean | true if direction to home is visible. |
void setDirectionToHomeColor(@ColorInt int color) |
Package: | dji.ux.widget |
Sets the color of the path from aircraft to home point.
@ColorInt int color | The new color of the path. |
|
Package: | dji.ux.widget |
Gets the color of the path from aircraft to home point.
int | The color of the path. |
void setDirectionToHomeWidth(float width) |
Package: | dji.ux.widget |
Sets the width of the path from aircraft to home point.
float width | The width of the path. |
float getDirectionToHomeWidth() |
Package: | dji.ux.widget |
Gets the width of the path from aircraft to home point.
float | The width of the path. |
void setFlightPathVisible(boolean isVisible) |
Package: | dji.ux.widget |
Sets the flight path visibility.
boolean isVisible | A boolean value that determines whether to show the flight path. |
boolean isFlightPathVisible() |
Package: | dji.ux.widget |
true
if the flight path is visible. The default value is false
boolean | A boolean value indicating if the flight path is visible. |
|
Package: | dji.ux.widget |
Gets the color of the flight path.
int | The color of the flight path. |
void setFlightPathWidth(float width) |
Package: | dji.ux.widget |
Sets a line width, in pixels, for the flight path. Valid range is 0-100.
float width | The width in pixels of the flight path. |
void setGimbalAttitudeVisible(boolean isVisible) |
Package: | dji.ux.widget |
Sets the visibility of the gimbal attitude marker.
boolean isVisible | A boolean value that determines whether to show the gimbal attitude marker. |
boolean isGimbalAttitudeVisible() |
Package: | dji.ux.widget |
Gets the visibility of the gimbal attitude marker.
boolean | true if the gimbal attitude marker is visible. |
void setAircraftBitmap(Bitmap bitmap, float x, float y) |
Package: | dji.ux.widget |
Set the icon of the aircraft marker.
Bitmap bitmap | The image to be set. |
float x | Specifies the x axis value of anchor to be at a particular point in the marker image. |
float y | Specifies the y axis value of anchor to be at a particular point in the marker image. |
void setAircraftBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the aircraft marker.
Bitmap bitmap | The image to be set to. |
Bitmap getAircraftBitmap() |
Package: | dji.ux.widget |
Gets the icon of the aircraft marker.
Bitmap | The icon of the aircraft marker. |
void setGimbalAttitudeBitmap(Bitmap bitmap) |
Package: | dji.ux.widget |
Changes the icon of the gimbal attitude marker.
Bitmap bitmap | The image to be set to. |
Bitmap getGimbalAttitudeBitmap() |
Package: | dji.ux.widget |
Gets the icon of the gimbal attitude marker.
Bitmap | The icon of the gimbal attitude marker. |
void setHomeVisible(boolean isVisible) |
Package: | dji.ux.widget |
Sets the visibility of the home marker if present on the map.
boolean isVisible | A boolean value to determine if the home marker is visible. |
boolean isHomeVisible() |
Package: | dji.ux.widget |
true
if the map displays the home point of the aircraft. The default value of this property is true
.
boolean | The icon of the home point marker. |
void setDialogTheme(@StyleRes int dialogTheme) |
Package: | dji.ux.widget |
Sets the theme of all dialogs launched by this widget, such as self-unlock and custom unlock prompts. The theme must be an AppCompat theme since the AlertDialog is from the support library.
@StyleRes int dialogTheme | The theme set for all dialogs launched by this widget. |
enum MapCenterLock |
Package: | dji.ux.widget |
Map Centering Options.
void showAllFlyZones() |
Package: | dji.ux.widget |
Make all Fly zones visible on the map.
void showFlyZoneLegend(boolean showFlyZoneLegend) |
Package: | dji.ux.widget |
Shows the fly zone legend. The fly zone legend indicates the color for all zone categories and self-unlock zones.
boolean showFlyZoneLegend | true to show the legend, false to hide. |
void showDJIAccountLoginIndicator(boolean isLoginIndicatorVisible) |
Package: | dji.ux.widget |
Defaults to false
. Show a small indicator displaying the latest DJI account login state. Useful if using FlySafe features.
boolean isLoginIndicatorVisible | true if visible, false if hidden. |
boolean isDJIAccountLoginIndicatorVisible() |
Package: | dji.ux.widget |
Get current visibility of DJI Account Login Indicator.
boolean | true if visible, false if hidden. |
void showCustomUnlockZones(boolean isVisible) |
Package: | dji.ux.widget |
Defaults to false
. Shows custom unlock zones if any are available for the currently connected aircraft.
boolean isVisible | true to show fly zones. |
boolean isCustomUnlockZonesVisible() |
Package: | dji.ux.widget |
Returns flag for the current visibility of Custom Unlock FlyZones
boolean | true if custom unlock fly zones are visible. |
void syncCustomUnlockZones() |
Package: | dji.ux.widget |
Call this to sync currently shown custom unlock zones to aircraft. They will still need to be manually enabled.