Methods
bruteForceIntersections(rectangles)
Checks for rectangle intersections by simply checking every combination.
Used as benchmark reference
Parameters:
Name | Type | Description |
---|---|---|
rectangles |
Array.<rectangle> |
- Source:
Returns:
(async) closeAll() → {Promise.<void>}
closes all detail pannels
Returns:
- Type
- Promise.<void>
(async) createDetails(rectsToShow)
Clears the shown details, fetches the detail data of the rectangles and
rearranges them to not overlap. Then shows them.
Parameters:
Name | Type | Description |
---|---|---|
rectsToShow |
Array.<Rectangle> |
createIcons()
Creates the leaflet icons for all the defined shapes.
createMap()
Creates the leaflet map and all the controls for it
(async) createMarker(entry)
Creates a marker for the provided entry. Used to initially create the markers
after loading all the coordinates.
Parameters:
Name | Type | Description |
---|---|---|
entry |
* |
Returns:
the created marker.
(async) fetchEntry(id)
Fetches the detail data for a certain entry id.
Parameters:
Name | Type | Description |
---|---|---|
id |
Number | The entries id |
Returns:
the parsed data
getCoords(entry)
Returns the parsed coordinates of the entry.
Parameters:
Name | Type | Description |
---|---|---|
entry |
* |
Returns:
intersectionBenchmark()
Used to benchmark the intersections in comparison to brute forcing them.
lineIntersecions(rectangles)
Finds the intersections of rectangles by checking if their edges intersect.
Parameters:
Name | Type | Description |
---|---|---|
rectangles |
Array.<rectangle> |
- Source:
Returns:
(async) loadData(csvFile)
Loads and parses the given coordinates csv file.
Also creates the corresponding rectangles and markers.
Used in the initial loading step.
Parameters:
Name | Type | Description |
---|---|---|
csvFile |
String |
onmessage()
Worker class to compute the rearrange function without freezing the UI
Parameters:
Name | Type | Description |
---|---|---|
e.data |
triangles for which the rearrange algorithm should be applied |
- Source:
rearrange(rectangles)
Perform Rearrange according to the paper "Minimum-Displacement Overlap Removal for Geo-referenced Data Visualization"
https://onlinelibrary.wiley.com/doi/abs/10.1111/cgf.13199
First finds the orthogonal ranks in both x and y dimension of the rectangles.
As long as there are overlapping rectangles it randomly removes their overlap
and repairs orthogonal order violations.
Parameters:
Name | Type | Description |
---|---|---|
rectangles |
Array.<rectangle> |
- Source:
Returns:
The rearranged rctangels
refreshClusters(layers) → {L.MarkerClusterGroup}
Updates the icon of all clusters which are parents of the given marker(s).
In singleMarkerMode, also updates the given marker(s) icon.
Parameters:
Name | Type | Description |
---|---|---|
layers |
L.MarkerClusterGroup|L.LayerGroup|Array(L.Marker)|Map(L.Marker)| L.MarkerCluster|L.Marker (optional) list of markers (or single marker) whose parent clusters need to be updated. If not provided, retrieves all child markers of this. |
Returns:
- Type
- L.MarkerClusterGroup
refreshIconOptions(options, directlyRefreshClusters) → {L.Marker}
Updates the given options in the marker's icon and refreshes the marker.
Parameters:
Name | Type | Description |
---|---|---|
options |
map object of icon options. | |
directlyRefreshClusters |
boolean (optional) true to trigger MCG.refreshClustersOf() right away with this single marker. |
Returns:
- Type
- L.Marker
removeOverlap(r1, r2, t0)
Removes the overlap of two rectangles preserving their orthogonal order.
Doins so by getting the overlaps in both directions and moving them apart
in the direction of the shortest overlap.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
r1 |
rectangle | the first rectangle | |
r2 |
rectangle | the second rectangle | |
t0 |
Number | 5 | the minimum overlap |
- Source:
Returns:
true if there was some overlap removed, false otherwise
repairOrder(rectangles, d, left, right)
repair order algorithm from the paper which does not achieve correct results
should in theorie repair the order of the rank of the rectangles in dimension d
while beforming merge sort
Parameters:
Name | Type | Description |
---|---|---|
rectangles |
for which the order should be repaired | |
d |
dimension in which the order should be repaired | |
left |
index of left side that should be ordered | |
right |
index of right side that should be ordered |
- Source:
repairOrderOwnX(sorted)
Our own repair order algorithm for the x dimension because the one from the paper does not achieve correct results
The difference to the paper is that if we find two triangles not ordered, we average their x coordinates and also swap their position in the array
instead of averaging every triangle thereafter
Parameters:
Name | Type | Description |
---|---|---|
sorted |
triangles for which the order of their rank should be repaired, ordered ascending by their x coordinates basic merge sort implementation from https://stackoverflow.com/questions/63548204/iterative-approach-of-merge-sort-in-javascript by Michael Laszlo |
- Source:
repairOrderOwnY(sorted)
Same as repairOrderOwnX but for dimension Y
Parameters:
Name | Type | Description |
---|---|---|
sorted |
triangles for which the order of their rank should be repaired, ordered ascending by their y coordinates |
- Source:
resetRectangles(rectsToShow)
resets the rectangles positions according to the current zoom.
Parameters:
Name | Type | Description |
---|---|---|
rectsToShow |
Array.<Rectangle> |
(async) showDetails()
Shows the details of all the data points that are currently visible in the viewport.
Only show the details if there are less than MAX_RECTS in the viewport.
shuffleArray(arr)
Shuffles and array randomly
Parameters:
Name | Type | Description |
---|---|---|
arr |
- Source:
sortedYIndex(array, value)
Parameters:
Name | Type | Description |
---|---|---|
array |
* | |
value |
* | value to find the index for |
- Source:
Returns:
the sorted index of the value into the array