Skip to content

Latest commit

 

History

History
91 lines (83 loc) · 9.01 KB

Functions.md

File metadata and controls

91 lines (83 loc) · 9.01 KB

Functions within SUE - WebInterface

Chatbot

Method Returns Description
sendUpdateToChat (
<String> type,
<Number> id,
<String> name
)
- Sends messages directly to the chat, without going through the Rasa AI.
Currently used for displaying "Discovered New Event" messages.

Complex

Method Returns Description
processComplexEvent (
<Object> json
)
- Processes a list of complex events, only updating markers on the map if the list has changed from what is currently stored.
addComplexMarker (
<Object> complex
)
- Adds a new marker to the map for the complex event described in the passed object.
refineList (
<Array> list
)
Array Removes duplicates from the list of complex events, keeping the one with the most linked events within it.

Details

Method Returns Description
toggleDetailsFromMap (
<Object> e
)
- Toggles marker page with information from selected map marker.Only works with map markers passed directly from the map.
toggleDetailsFromLayer (
<Object> layer
)
- Toggles marker page with information from selected map marker.Works with map markers send from a function.
showDetails (
<Object> json,
<String> coordinates
)
- Fills marker page with information from selected map marker.
clearDetailsMedia ( ) - Clears all media sources to prevent information clashes when more information is added.
addDetailsMedia (
<Object> json,
<String> coordinates,
<String> type,
<Object> chartData,
<String> analysisImgFile,
<String> objDetFile,
<String> slctRevFile,
<String> analysisAudioFile,
<String> sensorVideoFile,
<String> sensorAudioFile,
<Array> timelineInfo
)
- Fills in all media sources with the passed information.
hideElement (
<Object> element
)
- Adds hidden class to element.
removeActive (
<Object> element
)
- Removes active class form element.
setCarouselItem (
<Object> element
)
- Adds element to the media carousel.
removeCarouselItem (
<Object> element
)
- Removes element from the media carousel.
openEventDetails (
<Number> id
)
- Shows the details of an event map marker with passed id.
openComplexEventDetails (
<Number> id
)
- Shows the details of a complex event map marker with passed id.

Graph

Method Returns Description
plotChartPoints ( ) - While the correct chart is visible, and has not been filled, update its values in time with the video/audio track from the sensor.
refreshChart ( ) - Finds the next points on the line chart to be added and pushes them to the canvas.
clearChart ( ) - Removes all data from the chart.
createChart (
<Object> chartData
)
- Builds the analysis chart, resetting canvas and rebuilding with passed data.
buildPriorityChart ( ) - Builds the priority chart on the analysis panel, resetting canvas, defining colours and filling with information gathered from map layers.
buildTimeChart ( ) - Builds the time chart on the analysis panel, resetting canvas and filling with information gathered from map layers.
initiateTimeRefresh ( ) - Refreshes time chart every 30 seconds.
buffEventTimes ( ) Array Fills out dictionary with timepoints for the last 5 minutes, with 30 second intervals.
addTimeToDict (
<Object> dict,
<Array> layerGroup
)
Object Increments value in dictionary, to indicate detection time of each layer in the passed layer group.
buildISOString (
<Date> date,
<Number> seconds
)
String Creates a string in ISO form for the passed date, with optional specified seconds.
resetCanvas (
<String> canvasName
)
- Resets passed HTML canvas by removing and re-adding it to the page.
handleBarClick (
<Object> e
)
- Processes click on the priority bar chart, changes map view and bar colours as needed.
getBarBackgroundColours ( ) Array Returns bar chart background colours based on accessibility mode being active or not, and whether any bars are selected.
getBarBorderColours ( ) Array Returns bar chart border colours based on accessibility mode being active or not.
getHoverBackgroundColours ( ) Array Returns bar chart hover background colours based on accessibility mode being active or not.
handleTimeClick (
<Object> e
)
- Processes click on the time line chart, changes markers on map and point size/ colour as needed.
getTimeLineRadi (
<Array> labels
)
Array Returns the radius of the points on the graph, based on whether they are selected or not.
getTimeLineColour (
<Array> labels
)
Array Returns the colours of the points on the graph, based on whether they are selected or not.

Layer-Markers

Method Returns Description
updateMapMarkers (
<Object> request
)
- For each object in a request, attempts to find and update it on the appropriate map layer.If the object is not found, a new map marker is added to that layer.
deleteMapMarkers (
<Object> request
)
- For each object in a request, attempts to find and delete it from the appropriate map layer.
updateByLayer (
<Object> request,
<String> layerGroup,
<Boolean> ownerSensor,
<Boolean> isRange
)
- Finds the relevant layer and updates its properties, and features of the map marker.
deleteByLayer (
<Object> request,
<String> layerGroup,
<Array> idsList
)
- Attempts to find a map layer with a matching id to one specified in the passed list, deleting it from the layer group it's stored in, when found.
showTimePoint ( ) - Refreshes markers on map to reflect their appearance at a certain time point.
findSensor (
<Number> id
)
- Finds information about sensor with passed id.Used for event details.
findEvents (
<Array> list
)
- Finds information about events with passed ids.Used for complex event details and chatbot view details functionality.
findComplex (
<Number> id
)
- Finds information about complex event with passed id.Used for chatbot view details functionality.
showHoveredEvent (
<Number> id
)
- Opens the Popup of a selected event with passed id.

Layers

Method Returns Description
initializeLayers ( ) - Removes all layer groups from the map and adds the original set back.
alterLayers (
<Object> dict
)
- Removes all layer groups and adds back the ones specified in the passed dictionary.
removeAllLayers ( ) - Attempts to remove all layer groups from the map.
toggleLayer (
<Object> layerGroup
)
- If a layer group is currently on the map, this removes it and adds it back.Used to refresh layer group on data change.
clearMap ( ) - Removes all layers from each layer group and clears the marker sidebar.
showOnlyEvents (
<Boolean> lowPri,
<Boolean> medPri,
<Boolean> highPri,
<Boolean> critPri
)
- Removes all layer groups from the map and adds back those related to the event priority selected.
refreshComplex ( ) - Clears just the complex event layer.

Markers

Method Returns Description
addMarker (
<Object> json,
<Boolean> sensor,
<String> layerGroup
)
- Creates a new map marker with information from the json, then adds it to a layer group on the map.
addMarkerToLayer (
<Object> marker,
<Array> ranges,
<Object> layerGroup,
<Object> rangeLayerGroup
)
- Adds a newly created Marker object and its ranges to the specified map layer groups.
getProperties (
<Object> layer,
<Boolean> graph
)
Object Creates a list of all the properties of the map marker stored by time, returning a compiled list of those properties.
compileProperties (
<Object> properties,
<Array> keys
)
Object Compiles the properties list, containing all properties at various time points, to a list of properties at a certain time point.
showPopup (
<Object> layer
)
- If passed item is not null, opens the popup for that map marker, else opens the popup for the previously selected marker.
getIcon (
<Object> properties,
<Boolean> ownerSensor
)
Object Returns the correct icon to use for the map marker based on the sensor type or owner, the event priority, or the item being a complex event.

Settings

Method Returns Description
toggleAccessibility (
<Boolean> on
)
- Toggles map marker colour scheme between normal view and colour-blindness support.
togglePage (
<Object> e
)
- Toggles sidebar panel on button click.
showPanel (
<String> selectedPanel
)
- Opens sidebar panel specified in selectedPanel, hiding all others.