Class FileCompactor

This class compress the travel to reduce the size of the file when saved to a file or decompress the travel when reading from a file. Each route of a compressed file have the ItineraryPoints in only one object and the lat and lng of the ItineraryPoints are encoded with the polyline.encode algorithm

Source : file core/lib/FileCompactor.js at line 37

Constructor

new FileCompactor ( )

The constructor

Source : file core/lib/FileCompactor.js at line 144

Public methods

compress ( travel )

Compress the currently edited travel

Source : file core/lib/FileCompactor.js at line 169

Parameters

Name Type Description
travel Travel

The object to compress

Returns

A copy of the currently edited travel compressed and ready to be written in a file
Type : JsonObject

decompress ( travelJsonObject )

Decompress a travel

Source : file core/lib/FileCompactor.js at line 154

Parameters

Name Type Description
travelJsonObject JsonObject

The compressed travel. travelJsonObject is not a Travel instance! It's an Object created with JSON.parse ( ).

Private methods

#compressRoute ( routeJsonObject )

Compress a route

Source : file core/lib/FileCompactor.js at line 45

Parameters

Name Type Description
routeJsonObject JsonObject

The route to compress. routeJsonObject is not a Route instance! It's an Object created with Route.jsonObject ( ).

#decompressRoute ( routeJsonObject )

Decompress a route

Source : file core/lib/FileCompactor.js at line 78

Parameters

Name Type Description
routeJsonObject JsonObject

The compressed route. routeJsonObject is not a Route instance! It's an Object created with JSON.parse ( ).