Add FloorAltitude & maj API > basefunction except edit are fine, representation take only cylinder and polySurface

This commit is contained in:
Kouril42
2023-02-02 18:14:25 +01:00
parent 250e186017
commit 0cb138d7d6
7 changed files with 222 additions and 177 deletions
+10 -19
View File
@@ -22,29 +22,20 @@ class MapApiController extends AbstractController
}
#[Route('/map/api/get_floor')]
public function get_floor(FloorRepository $rep, int $id): JsonResponse
public function get_floor(FloorRepository $rep, int $id, string $representation): JsonResponse
{
$floor = $rep->findFloorById($id);
$corridors = $floor->getCorridors();
$rooms = array();
foreach ($corridors as $cor){
foreach ($cor->getConnectedPlaces() as $place) {
if (($place instanceof Room) and !($rooms->contains($place))) {
$rooms[] = $place;
}
}
}
$jsonCorridors = array();
$jsonRooms = array();
foreach ($corridors as $cor){
$jsonCorridors[] = $this->json([
'id' => $cor->getId(),
'name' => $cor->getName(),
'type' => $cor->getType()
//'polygon' => $cor->getPolyhedronRepresentation()
$places = $floor->getPlace();
$jsonPlaces = new ArrayCollection();
foreach ($places as $place){
$jsonPlaces[] = $this->json([
'id' => $place->getId(),
'name' => $place->getName(),
'type' => $place->getType(),
'surface' => $place->getTwoDRepresentation($representation, $floor->getAltitude())
]);
}
return array($jsonCorridors, $jsonRooms);
return $jsonPlaces;
}
#[Route('/map/api/find_room_by_name')]