Conditions
Indoorgraphs offers robust condition functionality, allowing you to specify which paths and nodes to exclude when calculating a route.
Example data
To get started, consider the following simple graph consisting of two nodes that are linked to each other:
const data = {
"nodes": {
"UG_t1": {
"coordinates": [
6.967842553558049,
50.946860664839846
],
"attributes": {
"wellLit": true,
"doorWidth": "200"
},
"id": "UG_t1",
"level": "UG",
"adjacentNodes": [
"UG_t2"
]
},
"UG_t2": {
"coordinates": [
6.968503094697883,
50.94665193377298
],
"attributes": {
"wellLit": true,
"doorWidth": "200"
},
"id": "UG_t2",
"level": "UG",
"adjacentNodes": [
"UG_t1",
]
}
},
"pathAttributes": {
"UG_t2-UG_t1": {
"pathWidth": "20"
}
}
}
Simple conditions
The following query removes nodes with a doorWidth of 200:
graph.removeNodes([["doorWidth === 200"]]);
Query operators
<
less than<=
less than or equal to===
equal too>
greater than>=
greater than or equal to!==
not equal to
Compound AND conditions
graph.removeNodes([["doorWidth === 200", "&&", "wellLit" === false]]);
OR conditions
graph.removeNodes([["doorWidth === 200", "||", "wellLit" === false]]);
Chain conditions
WIP
Last updated