mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-09-12 01:00:47 +02:00
Add FloorAltitude & maj API > basefunction except edit are fine, representation take only cylinder and polySurface
This commit is contained in:
@@ -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')]
|
||||
|
||||
Reference in New Issue
Block a user