-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
53-support-basic-current-location-indicator (#69)
* catch exceptions while parsing and fix poliline on mobile * add missing return * initial draft on iOS * add symbol methods to controller * parse symbol * implement useCourseSymbolOnMovement * implement new type of location display data source * finish iOS location indicator impl * implement android * fix bug for manual location source on android * add try catch * update docs --------- Co-authored-by: Julian Bissekkou <[email protected]> Co-authored-by: sbergmair <[email protected]>
- Loading branch information
1 parent
1686dae
commit 6dca8cd
Showing
24 changed files
with
951 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import 'package:arcgis_map_sdk_platform_interface/arcgis_map_sdk_platform_interface.dart'; | ||
|
||
/// The use case for manual location displays is relevant when the application | ||
/// has its own location stream obtained from a different source, such as a geolocator, | ||
/// with specific settings. | ||
/// | ||
/// Instead of relying on ArcGIS to create a location client that fetches the position | ||
/// again, this use case involves processing the locations retrieved by the application | ||
/// and displaying the exact location processed by the application. | ||
/// | ||
/// This approach is beneficial when the application needs to manage its own location data | ||
/// independently, without relying on additional calls to fetch the location. | ||
class ArcgisManualLocationDisplay extends ArcgisLocationDisplay { | ||
@override | ||
String get type => "manual"; | ||
|
||
ArcgisManualLocationDisplay({super.mapId}); | ||
|
||
Future<void> updateLocation(UserPosition position) { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance | ||
.updateLocationDisplaySourcePositionManually( | ||
_mapId!, | ||
position, | ||
); | ||
} | ||
} | ||
|
||
class ArcgisLocationDisplay { | ||
int? _mapId; | ||
final String type = "system"; | ||
|
||
ArcgisLocationDisplay({int? mapId}) : _mapId = mapId; | ||
|
||
void attachToMap(int mapId) => _mapId = mapId; | ||
|
||
void deattachFromMap() => _mapId = null; | ||
|
||
Future<void> startSource() { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance.startLocationDisplayDataSource(_mapId!); | ||
} | ||
|
||
Future<void> stopSource() { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance.stopLocationDisplayDataSource(_mapId!); | ||
} | ||
|
||
Future<void> setDefaultSymbol(Symbol symbol) { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance | ||
.setLocationDisplayDefaultSymbol(_mapId!, symbol); | ||
} | ||
|
||
Future<void> setAccuracySymbol(Symbol symbol) { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance | ||
.setLocationDisplayAccuracySymbol(_mapId!, symbol); | ||
} | ||
|
||
Future<void> setPingAnimationSymbol(Symbol symbol) { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance | ||
.setLocationDisplayPingAnimationSymbol(_mapId!, symbol); | ||
} | ||
|
||
Future<void> setUseCourseSymbolOnMovement(bool useCourseSymbol) { | ||
_assertAttached(); | ||
return ArcgisMapPlatform.instance | ||
.setUseCourseSymbolOnMovement(_mapId!, useCourseSymbol); | ||
} | ||
|
||
void _assertAttached() { | ||
assert( | ||
_mapId != null, | ||
"LocationDisplay has not been attached to any map. Make sure to call ArcgisMapController.setLocationDisplay.", | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.