Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Merging getScreenShot and takeSnapshot methods (#178)
Browse files Browse the repository at this point in the history
* snapshot to screenshot

* added screenshot options

* fixed import
  • Loading branch information
ggalambas authored Jul 8, 2024
1 parent 6fb2826 commit 2c7a9ef
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 27 deletions.
5 changes: 5 additions & 0 deletions packages/atlas/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
3 changes: 2 additions & 1 deletion packages/atlas/lib/atlas.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
25 changes: 3 additions & 22 deletions packages/atlas/lib/src/atlas_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,10 @@ abstract class AtlasController {
Future<LatLngBounds> 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<Uint8List> getScreenShot({
int x,
int y,
int width,
int height,
required Viewpoint viewpoint,
required Size size,
ScreenShotOptions? options,
});

/// Updates the map's logo bottom padding
Expand Down Expand Up @@ -68,18 +63,4 @@ abstract class AtlasController {
/// Set the compass bearing of the map
/// [bearing] is the value that the bearing will become
Future<void> setBearing(double bearing);

Future<Uint8List?> takeSnapshot({
required BuildContext context,
required Size size,
required ViewportOptions viewportOptions,
MapType mapType = MapType.normal,
bool showUserLocation = false,
Set<Marker> markers = const {},
Set<Polyline> polylines = const {},
Set<Callout> callouts = const {},
Set<Circle> circles = const {},
Heatmap? heatmap,
bool traffic = false,
});
}
23 changes: 23 additions & 0 deletions packages/atlas/lib/src/screen_shot/screen_shot_options.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:atlas/atlas.dart';

class ScreenShotOptions {
final MapType mapType;
final bool showUserLocation;
final Set<Marker> markers;
final Set<Polyline> polylines;
final Set<Callout> callouts;
final Set<Circle> 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,
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion packages/atlas/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2c7a9ef

Please sign in to comment.