at main 2.6 kB view raw
1(** Route types and operations *) 2 3(** Route point is an alias for waypoint *) 4type point = Waypoint.t 5 6(** Main route type *) 7type t = { 8 name : string option; 9 cmt : string option; 10 desc : string option; 11 src : string option; 12 links : Link.t list; 13 number : int option; 14 type_ : string option; 15 extensions : Extension.t list; 16 rtepts : point list; 17} 18 19(** {2 Route Constructors} *) 20 21(** Create empty route *) 22val empty : t 23 24(** Create route with name *) 25val make : name:string -> t 26 27(** Create route from coordinate list. 28 @param name Route name 29 @param coords List of (latitude, longitude) pairs 30 @raises Invalid_argument on invalid coordinates *) 31val make_from_coords : name:string -> (float * float) list -> t 32 33(** {2 Route Properties} *) 34 35(** Get route name *) 36val name : t -> string option 37 38(** Get route description *) 39val description : t -> string option 40 41(** Get route number *) 42val number : t -> int option 43 44(** Get route comment *) 45val comment : t -> string option 46 47(** Get route source *) 48val source : t -> string option 49 50(** Get route links *) 51val links : t -> Link.t list 52 53(** Get route type *) 54val type_ : t -> string option 55 56(** Get route extensions *) 57val extensions : t -> Extension.t list 58 59(** Get route points *) 60val points : t -> point list 61 62(** Get route point count *) 63val point_count : t -> int 64 65(** Check if route is empty *) 66val is_empty : t -> bool 67 68(** {2 Route Modification} *) 69 70(** Clear all points *) 71val clear_points : t -> t 72 73(** {2 Route Analysis} *) 74 75(** Extract coordinates from route *) 76val to_coords : t -> (float * float) list 77 78(** Calculate total distance between consecutive points in meters *) 79val total_distance : t -> float 80 81(** Get first point *) 82val first_point : t -> point option 83 84(** Get last point *) 85val last_point : t -> point option 86 87(** {2 Functional Operations} *) 88 89(** Update name *) 90val with_name : t -> string -> t 91 92(** Update comment *) 93val with_comment : t -> string -> t 94 95(** Update description *) 96val with_description : t -> string -> t 97 98(** Update source *) 99val with_source : t -> string -> t 100 101(** Update number *) 102val with_number : t -> int -> t 103 104(** Update type *) 105val with_type : t -> string -> t 106 107(** Add point *) 108val add_point : t -> point -> t 109 110(** Add link *) 111val add_link : t -> Link.t -> t 112 113(** Add extensions *) 114val add_extensions : t -> Extension.t list -> t 115 116(** {2 Comparison and Utilities} *) 117 118(** Compare routes *) 119val compare : t -> t -> int 120 121(** Test route equality *) 122val equal : t -> t -> bool 123 124(** Pretty print route *) 125val pp : Format.formatter -> t -> unit