getBuilding

Returns a building where the given point is inside. If no such building exists it will return null instead.

The bounding box is only a first pass. Until 4.24.2 it was the whole test, so this returned the first building whose box covered the point even when the point was well outside the building itself — a box is axis-aligned and a footprint is not, and the boxes of neighbouring buildings overlap. Buildings that share a box could not be told apart at all. The point is now tested against the building outline as well, so this returns what it has always said it does.

Use getBuilding with a floor index where the answer has to be right between buildings that meet: building outlines overlap where their floor plates do not.

Return

found MPBuilding or null

Parameters

point

point for search


fun getBuilding(point: MPPoint, floorIndex: Int): MPBuilding?

Returns the building that point is inside, judged on the floor the point is on.

The floor outline for floorIndex is tried first and the building outline only after it, because neighbouring building outlines overlap where their floor plates do not: an outline is drawn around a whole structure, so two buildings that meet can both contain a point that only one of them has a room on. Matching the floor first is what makes the answer unambiguous there.

Pass MPFloor.NO_FLOOR_INDEX when the floor is unknown, to match on building outlines alone.

Return

the MPBuilding containing point, or null if no building does

Since

4.24.2

Parameters

point

the point to look up

floorIndex

the floor point is on