Randy Hector
Randy Hector

Reputation: 99

How to fit route bounds using CARTO-Mobile-SDK

i calculate the route betwen two points, and i get the polygon produced by the separation of this two points, i create the polygon in this way

let polygon = NTPolygon(poses: vector, style: NTPolygonStyleBuilder().buildStyle()) 

so, i am creating a functionality for when the route between this 2 points is to large you can press the button and the map will zoom out and show the bounding box of the route, for that i get the bounding box from the polygon polygon.getBounds() and i am trying to use map.move(toFit: NTMapBounds!, screenBounds: NTScreenBounds!, integerZoom: Bool, durationSeconds: Float) but i dont how to get NTScreenBounds

Any help whit this issue, also any other approach than using map.move is welcome.

Thanks in advance

Upvotes: 1

Views: 148

Answers (1)

Nikitah
Nikitah

Reputation: 739

NTScreenBounds, in this context, is the layout of your NTMapView.

Here's an example from Xamarin.iOS, you should get the gist of it:

public ScreenBounds FindScreenBounds()
{
    var min = new ScreenPos(Frame.X, Frame.Y);
    var max = new ScreenPos(Frame.Width, Frame.Height);

    return new ScreenBounds(min, max);
}

Upvotes: 0

Related Questions