2022-04-12 13:46:37 +02:00
|
|
|
(* BSD-2-Clause License *)
|
|
|
|
|
|
2022-04-07 14:45:11 +02:00
|
|
|
type t
|
|
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [create container] creates a map on [container]. * To have a functional map
|
|
|
|
|
you will need to add a tile layer to it. *)
|
2022-05-19 16:16:37 +02:00
|
|
|
val create : ?options:Jv.t -> Brr.El.t -> t
|
2022-04-07 14:45:11 +02:00
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [invalidate_size map] checks if the map container size changed and updates
|
|
|
|
|
the map if so *)
|
2022-04-07 14:45:11 +02:00
|
|
|
val invalidate_size : t -> unit
|
|
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [set_view latlng Some(zoom) map] sets the view of the [map] (geographical
|
|
|
|
|
center and zoom) *)
|
2022-04-09 22:21:22 +02:00
|
|
|
val set_view : Latlng.t -> zoom:int option -> t -> unit
|
2022-04-07 14:45:11 +02:00
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [fit_world map] sets a map view that mostly contains the whole world with
|
|
|
|
|
the maximum zoom level possible *)
|
2022-04-07 14:45:11 +02:00
|
|
|
val fit_world : t -> unit
|
|
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [get_container map] is the HTML element that contains [map] *)
|
2022-04-07 14:45:11 +02:00
|
|
|
val get_container : t -> Brr.El.t
|
|
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [on event handler map] add an event listener on [map] for event [event] with
|
|
|
|
|
handler [handler] *)
|
2022-04-08 22:43:31 +02:00
|
|
|
val on : 'a Event.sub -> ('a Event.t -> 'b) -> t -> unit
|
2022-04-07 14:45:11 +02:00
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [get_center map] is the geographical center of the map view *)
|
2022-04-07 14:45:11 +02:00
|
|
|
val get_center : t -> Latlng.t
|
|
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [get_zoom map] is the current zoom level of the map view *)
|
2022-04-07 14:45:11 +02:00
|
|
|
val get_zoom : t -> int
|
|
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [wrap_latlng latlng map] returns a new [Latlng.t] where lat and lng has been
|
|
|
|
|
wrapped according to the map's CRS's wrapLat and wrapLng properties, if they
|
|
|
|
|
are outside the CRS's bounds. By default this means longitude is wrapped
|
|
|
|
|
around the dateline so its value is between -180 and +180 degrees *)
|
|
|
|
|
val wrap_latlng : Latlng.t -> t -> Latlng.t
|
2022-04-07 14:45:11 +02:00
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [of_jv jv] is [jv] as {!t} *)
|
2022-04-09 22:21:22 +02:00
|
|
|
val of_jv : Jv.t -> t
|
2022-04-07 14:45:11 +02:00
|
|
|
|
2022-05-19 22:42:28 +02:00
|
|
|
(** [to_jv o] is [o] as {!Jv.t} *)
|
2022-04-09 22:21:22 +02:00
|
|
|
val to_jv : t -> Jv.t
|