source: imaps-frontend/src/scripts/util/ShapeQuery.js@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 713 bytes
Line 
1import MapNode from "../base/MapNode.js";
2import ShapeRegistry from "./ShapeRegistry.js";
3
4export default class ShapeQuery{
5 static findAllByType(...types) {
6 return ShapeRegistry.getShapes().filter(shape => types.includes(shape.className));
7 }
8
9 static findNodeByName(shapes, name){
10 return shapes.filter(shape => shape instanceof MapNode && shape.info.name === name)[0];
11 }
12 static findAllByTypeAndFloor(floor,...types){
13 return ShapeRegistry.getShapes().filter(shape => types.includes(shape.className) && shape.floorNum === floor);
14 }
15
16 static getAllNodes(floor = null){
17 return ShapeRegistry.getShapes(floor).filter(shape => shape instanceof MapNode);
18 }
19}
Note: See TracBrowser for help on using the repository browser.