BlockMapQueryResult

A BlockMapQueryResult is an object returned by the getLineBlocks and getRectangleBlocks methods of the BlockMap class. It has methods It has methods to retrieve the linedefs, things, sectors, and vertices that are in the queried blocks. The object is also iterable, returning each block, in cases where more fine-grained control is needed.

const blockmap = new UDB.BlockMap();
const result = blockmap.getLineBlocks([ 0, 0 ], [ 512, 256 ]);

// Print all linedefs in the blocks
result.getLinedefs().forEach(ld => UDB.log(ld));

Looping over each block:

const blockmap = new UDB.BlockMap();
const result = blockmap.getLineBlocks([ 0, 0 ], [ 512, 256 ]);

for(const block of result)
{
    UDB.log('--- New block ---');
    block.getLinedefs().forEach(ld => UDB.log(ld));
}

Note

The methods to retrieve map elements from BlockMapQueryResult return arrays that only contain each map element once, since linedefs and sectors can be in multiple blocks, looping over a BlockMapQueryResult using for...of can return the same map elements multiple times.

Methods


Version: 5

getLinedefs()

Gets all Linedefs in the blockmap query result.

Return value

Array of Linedefs


Version: 5

getSectors()

Gets all Sectors in the blockmap query result.

Return value

Array of Sectors


Version: 5

getThings()

Gets all Things in the blockmap query result.

Return value

Array of Things


Version: 5

getVertices()

Gets all Vertex in the blockmap query result.

Return value

Array of Vertex