diff --git a/packages/atlas/CHANGELOG.md b/packages/atlas/CHANGELOG.md index 9e2f44f..370de02 100644 --- a/packages/atlas/CHANGELOG.md +++ b/packages/atlas/CHANGELOG.md @@ -1,5 +1,10 @@ # atlas +## v3.0.0 (2024-06-01) + +- Merged `getScreenShot` and `takeSnapshot` methods of the `AtlasController` +- Renamed `ViewportOptions` to `Viewpoint` + ## v2.0.0 (2024-06-01) - Added support for `Snapshots` diff --git a/packages/atlas/lib/atlas.dart b/packages/atlas/lib/atlas.dart index c159767..ddca988 100644 --- a/packages/atlas/lib/atlas.dart +++ b/packages/atlas/lib/atlas.dart @@ -31,5 +31,6 @@ export 'src/polyline.dart'; export 'src/provider.dart'; export 'src/rectangle_2d.dart'; export 'src/screen_coordinate.dart'; +export 'src/screen_shot/screen_shot_options.dart'; +export 'src/screen_shot/viewpoint.dart'; export 'src/track_playback.dart'; -export 'src/viewport_options.dart'; diff --git a/packages/atlas/lib/src/atlas_controller.dart b/packages/atlas/lib/src/atlas_controller.dart index a630522..fcbee07 100644 --- a/packages/atlas/lib/src/atlas_controller.dart +++ b/packages/atlas/lib/src/atlas_controller.dart @@ -31,15 +31,10 @@ abstract class AtlasController { Future getVisibleArea(); /// Return a [Uint8List] to the screenshot of the specified range of the current screen - /// - /// [x] and [y] are the starting coordinates relative to the upper left corner [0, 0] - /// [width] is the width to be intercepted - /// [height] is the height to be intercepted Future getScreenShot({ - int x, - int y, - int width, - int height, + required Viewpoint viewpoint, + required Size size, + ScreenShotOptions? options, }); /// Updates the map's logo bottom padding @@ -68,18 +63,4 @@ abstract class AtlasController { /// Set the compass bearing of the map /// [bearing] is the value that the bearing will become Future setBearing(double bearing); - - Future takeSnapshot({ - required BuildContext context, - required Size size, - required ViewportOptions viewportOptions, - MapType mapType = MapType.normal, - bool showUserLocation = false, - Set markers = const {}, - Set polylines = const {}, - Set callouts = const {}, - Set circles = const {}, - Heatmap? heatmap, - bool traffic = false, - }); } diff --git a/packages/atlas/lib/src/screen_shot/screen_shot_options.dart b/packages/atlas/lib/src/screen_shot/screen_shot_options.dart new file mode 100644 index 0000000..84d6643 --- /dev/null +++ b/packages/atlas/lib/src/screen_shot/screen_shot_options.dart @@ -0,0 +1,23 @@ +import 'package:atlas/atlas.dart'; + +class ScreenShotOptions { + final MapType mapType; + final bool showUserLocation; + final Set markers; + final Set polylines; + final Set callouts; + final Set circles; + final Heatmap? heatmap; + final bool traffic; + + ScreenShotOptions({ + this.mapType = MapType.normal, + this.showUserLocation = false, + this.markers = const {}, + this.polylines = const {}, + this.callouts = const {}, + this.circles = const {}, + this.heatmap, + this.traffic = false, + }); +} diff --git a/packages/atlas/lib/src/viewport_options.dart b/packages/atlas/lib/src/screen_shot/viewpoint.dart similarity index 95% rename from packages/atlas/lib/src/viewport_options.dart rename to packages/atlas/lib/src/screen_shot/viewpoint.dart index 22ce1f7..62670f9 100644 --- a/packages/atlas/lib/src/viewport_options.dart +++ b/packages/atlas/lib/src/screen_shot/viewpoint.dart @@ -6,8 +6,8 @@ import 'package:flutter/widgets.dart'; /// /// Anchor and center points are mutually exclusive, with preference for the /// center point when both are set. -class ViewportOptions { - ViewportOptions({ +class Viewpoint { + Viewpoint({ this.center, this.padding, this.anchor, @@ -41,7 +41,7 @@ class ViewportOptions { bool operator ==(Object other) { if (identical(this, other)) return true; if (other.runtimeType != runtimeType) return false; - if (other is ViewportOptions) { + if (other is Viewpoint) { return center == other.center && padding == other.padding && anchor == other.anchor && diff --git a/packages/atlas/pubspec.yaml b/packages/atlas/pubspec.yaml index 53468f6..1036f89 100644 --- a/packages/atlas/pubspec.yaml +++ b/packages/atlas/pubspec.yaml @@ -1,6 +1,6 @@ name: atlas description: An extensible map abstraction for Flutter with support for multiple map providers -version: 2.0.0 +version: 3.0.0 repository: https://github.com/bmw-tech/atlas issue_tracker: https://github.com/bmw-tech/atlas/issues homepage: https://bmw-tech.github.io/atlas