Class: IWOlr

IWOlr

A class for interacting with the OLR Server

new IWOlr()

Methods


addSegment(segment, fileId, preMatched, sessionId, payload)

Adds a segment to a file Segment object example:
Parameters:
Name Type Description
segment Object The segment you want to save to the file
fileId Number The ID of the file you want to save the segment in
preMatched Boolean If you've already matched this segment and you have an OLR code
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void
Example
var segment = {
      "olr": "CwTUqSQnMjvlAgBhADw7NBY=",
      "type": "closure",
      "attributes": {
        "created": "Sun Jul 07 2019 16:03:17 GMT+0200 (Mitteleuropäische Sommerzeit)",
        "description": "Test",
        "direction": "3",
        "modified": "Sun Jul 07 2019 16:03:17 GMT+0200 (Mitteleuropäische Sommerzeit)",
        "speed": "0",
        "start": "2019-07-15T22:00:00.000Z",
        "end": "2019-07-15T24:00:00.000Z"
      },
      "coordinates": [
        new IWCoordinate(6.793168, 50.840316, IWCoordinate.WGS84),
        new IWCoordinate(6.793312, 50.840384, IWCoordinate.WGS84),
        new IWCoordinate(6.794012, 50.840832, IWCoordinate.WGS84)
      ]
    };

changeSegment(segment, fileId, sessionId, payload)

Edits a segment from a file
Parameters:
Name Type Description
segment Object The segment you want to save to the file
fileId Number The ID of the file that contains the segment
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

createFile(fileName, sessionId, payload)

Creates a file on the server
Parameters:
Name Type Description
fileName String The desired name for the file (Must match a-zA-Z0-9_äöüßÄÖÜ)
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

deleteFile(fileId, sessionId, payload)

Deletes a file from the server. This action is not reversible
Parameters:
Name Type Description
fileId Number The ID of the file you want to delete
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

deleteSegment(segmentId, fileId, sessionId, payload)

Permanently deletes a segment from a file
Parameters:
Name Type Description
segmentId Number The ID of the segment you want to delete
fileId Number The ID of the file containing the segment you want to delete
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

drawFileOnMap(fileId, sessionId, payload)

Draws the segments from a file on the map. Calls the `getFileContents` method to read the file before drawing it.
Parameters:
Name Type Description
fileId Number The ID of the file you want to draw on the map
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

getFile(fileId, sessionId, payload)

Gets the contents of a file and returns a list of segments
Parameters:
Name Type Description
fileId Number The ID of the file you want to retrieve the contents for
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

getFileList(sessionId, payload)

Gets a list of all files belonging to the current user, based on the session ID
Parameters:
Name Type Description
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

login(company, username, password, payload)

Issues a login command to the server and triggers an User Event if it succeeds
Parameters:
Name Type Description
company String Part of your login information received from infoware
username String Part of your login information received from infoware
password String Part of your login information received from infoware
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

matchSegment(coordinates, sessionId, payload)

Matches a set of coordinates belonging to a segment and obtains an OLR code for it. Segments cannot be saved without an OLR code
Parameters:
Name Type Description
coordinates Array.<IWCoordinate> The geographical coordinates of the segment you want to match
sessionId String The session ID received after a successful login
payload Any Information you'd like to receive back with the triggered event
Fires:
Returns:
Type
void

Events


fileContents

Creates a new IWOlr file contents event with the contents of a file

fileCreate

Creates a new IWOlr event to confirm the creation of a file on the server

fileDelete

Creates a new IWOlr event to confirm the deletion of a file from the server

fileDrawn

Creates a new IWOlr event triggered after the segments were drawn on the map

fileList

Creates a new IWOlr files event containing the list of files for the current user

login

Creates a new IWOlr login event containing the session id and user information

match

Creates a new IWOlr match event containing the OLR code

segmentAdd

Creates a new IWOlr event to confirm the addition of a segment to a file

segmentChange

Creates a new IWOlr event to confirm the update of a segment in a file

segmentDelete

Creates a new IWOlr event to confirm the deletion of a segment from a file