109 lines
3.2 KiB
OCaml
109 lines
3.2 KiB
OCaml
(* BSD-2-Clause License *)
|
|
|
|
type _ t =
|
|
| Basic : Jv.t -> [> `Basic ] t
|
|
| Geojson : Jv.t -> [> `Geojson ] t
|
|
| Marker : Jv.t -> [> `Marker ] t
|
|
| Tile : Jv.t -> [> `Tile ] t
|
|
| Vector : Jv.t -> [> `Vector ] t
|
|
|
|
type _ sub =
|
|
| Basic : [> `Basic ] sub
|
|
| Geojson : [> `Geojson ] sub
|
|
| Marker : [> `Marker ] sub
|
|
| Tile : [> `Tile ] sub
|
|
| Vector : [> `Vector ] sub
|
|
|
|
(** Basic layers *)
|
|
|
|
(** [add_to map layer] adds [layer] to [map] *)
|
|
val add_to : Map.t -> _ t -> unit
|
|
|
|
(** [remove layer] removes [layer] from the map it is currently active on *)
|
|
val remove : _ t -> unit
|
|
|
|
(** [remove_from map layer] removes [layer] from [map] *)
|
|
val remove_from : Map.t -> _ t -> unit
|
|
|
|
(** [bind_popup popup layer] binds [popup] to [layer] *)
|
|
val bind_popup : Popup.t -> _ t -> unit
|
|
|
|
(** [unbind_popup layer] unbinds the popup bound to [layer] *)
|
|
val unbind_popup : _ t -> unit
|
|
|
|
(** [open_popup layer] opens the popup bound to [layer] *)
|
|
val open_popup : _ t -> unit
|
|
|
|
(** [close_popup layer] closes the popup bound to [layer] *)
|
|
val close_popup : _ t -> unit
|
|
|
|
(** [get_popup layer] is the popup bound to [layer] *)
|
|
val get_popup : _ t -> Popup.t
|
|
|
|
(** [to_jv o] is [o] as a {!Jv.t} *)
|
|
val to_jv : _ t -> Jv.t
|
|
|
|
(** [of_jv tag o] is [o] as a [tag t] *)
|
|
val of_jv : 'a sub -> Jv.t -> 'a t
|
|
|
|
(** [on event handler layer] add an event listener on [layer] for event [event]
|
|
with handler [handler] *)
|
|
val on : 'a Event.sub -> ('a Event.t -> 'b) -> 'c t -> unit
|
|
|
|
(** Geojson layers *)
|
|
|
|
(** type for geojson option, used to create geojson *)
|
|
type geojson_opt =
|
|
| Point_to_layer of (Jv.t -> Latlng.t -> [ `Marker ] t)
|
|
| Style of (Jv.t -> unit)
|
|
| On_each_feature of (Jv.t -> [ `Geojson ] t -> unit)
|
|
| Filter of (Jv.t -> bool)
|
|
| Coords_to_latlng of (Jv.t -> Latlng.t)
|
|
| Markers_inherit_options of bool
|
|
|
|
(** [create_geojson geojson] is a new geojson layer *)
|
|
val create_geojson : Brr.Json.t -> geojson_opt array -> [ `Geojson ] t
|
|
|
|
(** Tile layers *)
|
|
|
|
type tile_layer_opt =
|
|
| Min_zoom of int
|
|
| Max_zoom of int
|
|
| Subdomains of string array
|
|
| Error_tile_url of string
|
|
| Zoom_offset of int
|
|
| Tms of bool
|
|
| Zoom_reverse of bool
|
|
| Detect_retina of bool
|
|
| Cross_origin of bool
|
|
| Referrer_policy of bool
|
|
| Tile_size of Point.t
|
|
| Opacity of float
|
|
| Update_when_idle of bool
|
|
| Update_when_zooming of bool
|
|
| Update_interval of int
|
|
| Z_index of int
|
|
| Bounds of (* LatLngBounds *) Latlng.t * Latlng.t
|
|
| Max_native_zoom of int
|
|
| Min_native_zoom of int
|
|
| No_wrap of bool
|
|
| Pane of string
|
|
| Class_name of string
|
|
| Keep_buffer of int
|
|
|
|
(** [create_tile url attribution opts] create a new tile layer *)
|
|
val create_tile :
|
|
string -> attribution:string -> tile_layer_opt array -> [ `Tile ] t
|
|
|
|
(** [create_tile_osm opts] create a new tile layer with tile server and
|
|
attribution set to [openstreetmap.org]. See
|
|
{:https://wiki.openstreetmap.org/wiki/Tile_servers} *)
|
|
val create_tile_osm : tile_layer_opt array -> [ `Tile ] t
|
|
|
|
(** [create_polyline l] create a polyline layer from [l] *)
|
|
val create_polyline : Latlng.t array -> [ `Vector ] t
|
|
|
|
(** [create_circle_marker c r] create a cirecle marker layer with center [c] and
|
|
radius [r] *)
|
|
val create_circle_marker : Latlng.t -> float -> [ `Vector ] t
|