mirror of
https://gitlab.aliens-lyon.fr/encartes/backend.git
synced 2026-09-11 16:50:46 +02:00
Add FloorAltitude & maj API > basefunction except edit are fine, representation take only cylinder and polySurface
This commit is contained in:
+171
-2
@@ -26,7 +26,6 @@ class Place
|
||||
|
||||
#[ORM\OneToMany(targetEntity: PlaceName::class, mappedBy: "place")]
|
||||
private $names;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: RoomUserName::class, mappedBy: "place")]
|
||||
private $users;
|
||||
|
||||
@@ -35,10 +34,19 @@ class Place
|
||||
|
||||
#[ORM\ManyToMany(targetEntity: Place::class, inversedBy: "connectedPlaces")]
|
||||
private $connection;
|
||||
|
||||
#[ORM\ManyToMany(targetEntity: Place::class, mappedBy: "connection")]
|
||||
private $connectedPlaces;
|
||||
|
||||
#[ORM\OneToMany(targetEntity: ThreeDObjectFile::class, mappedBy: "place")]
|
||||
private $ComplexRepresentation;
|
||||
#[ORM\OneToMany(targetEntity: Polyhedron::class, mappedBy: "place")]
|
||||
private $PolyhedronRepresentation;
|
||||
#[ORM\OneToMany(targetEntity: Cylinder::class, mappedBy: "place")]
|
||||
private $CylinderRepresentation;
|
||||
#[ORM\OneToMany(targetEntity: PolySurface::class, mappedBy: "place")]
|
||||
private $PolySurfaceRepresentation;
|
||||
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->connection = new ArrayCollection();
|
||||
@@ -46,6 +54,9 @@ class Place
|
||||
$this->names = new ArrayCollection();
|
||||
$this->users = new ArrayCollection();
|
||||
$this->floors = new ArrayCollection();
|
||||
$this->ComplexRepresentation = new ArrayCollection();
|
||||
$this->PolyhedronRepresentation = new ArrayCollection();
|
||||
$this->CylinderRepresentation = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getId(): ?int
|
||||
@@ -178,4 +189,162 @@ class Place
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, ThreeDObjectFile>
|
||||
*/
|
||||
public function getComplexRepresentation(): Collection
|
||||
{
|
||||
return $this->ComplexRepresentation;
|
||||
}
|
||||
|
||||
public function addComplexRepresentation(ThreeDObjectFile $complexRepresentation): self
|
||||
{
|
||||
if (!$this->ComplexRepresentation->contains($complexRepresentation)) {
|
||||
$this->ComplexRepresentation[] = $complexRepresentation;
|
||||
$complexRepresentation->setRoom($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeComplexRepresentation(ThreeDObjectFile $complexRepresentation): self
|
||||
{
|
||||
if ($this->ComplexRepresentation->removeElement($complexRepresentation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($complexRepresentation->getRoom() === $this) {
|
||||
$complexRepresentation->setRoom(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Polyhedron>
|
||||
*/
|
||||
public function getPolyhedronRepresentation(): Collection
|
||||
{
|
||||
return $this->PolyhedronRepresentation;
|
||||
}
|
||||
|
||||
public function addPolyhedronRepresentation(Polyhedron $polyhedronRepresentation): self
|
||||
{
|
||||
if (!$this->PolyhedronRepresentation->contains($polyhedronRepresentation)) {
|
||||
$this->PolyhedronRepresentation[] = $polyhedronRepresentation;
|
||||
$polyhedronRepresentation->setRoom($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePolyhedronRepresentation(Polyhedron $polyhedronRepresentation): self
|
||||
{
|
||||
if ($this->PolyhedronRepresentation->removeElement($polyhedronRepresentation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($polyhedronRepresentation->getRoom() === $this) {
|
||||
$polyhedronRepresentation->setRoom(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Cylinder>
|
||||
*/
|
||||
public function getCylinderRepresentation(): Collection
|
||||
{
|
||||
return $this->CylinderRepresentation;
|
||||
}
|
||||
|
||||
public function addCylinderRepresentation(Cylinder $cylinderRepresentation): self
|
||||
{
|
||||
if (!$this->CylinderRepresentation->contains($cylinderRepresentation)) {
|
||||
$this->CylinderRepresentation[] = $cylinderRepresentation;
|
||||
$cylinderRepresentation->setRoom($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeCylinderRepresentation(Cylinder $cylinderRepresentation): self
|
||||
{
|
||||
if ($this->CylinderRepresentation->removeElement($cylinderRepresentation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($cylinderRepresentation->getRoom() === $this) {
|
||||
$cylinderRepresentation->setRoom(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return Collection<int, PolySurface>
|
||||
*/
|
||||
public function getPolySurfaceRepresentation(): Collection
|
||||
{
|
||||
return $this->PolySurfaceRepresentation;
|
||||
}
|
||||
|
||||
public function addPolySurfaceRepresentation(PolySurface $polySurfaceRepresentation): self
|
||||
{
|
||||
if (!$this->PolySurfaceRepresentation->contains($polySurfaceRepresentation)) {
|
||||
$this->PolySurfaceRepresentation[] = $polySurfaceRepresentation;
|
||||
$polySurfaceRepresentation->setRoom($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removePolySurfaceRepresentation(PolySurface $polySurfaceRepresentation): self
|
||||
{
|
||||
if ($this->PolySurfaceRepresentation->removeElement($polySurfaceRepresentation)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($polySurfaceRepresentation->getRoom() === $this) {
|
||||
$polySurfaceRepresentation->setRoom(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getTwoDRepresentation(string $representation, int $alt) : array
|
||||
{
|
||||
if ($representation=='Cylinder') {
|
||||
$rep = $this->getCylinderRepresentation();
|
||||
if ($rep != null){
|
||||
$repPoints = $rep->getCylinderbase()->getPolygonpoint(); //Points in repository format
|
||||
$Points = new ArrayCollection();
|
||||
foreach ($repPoints as $p) {
|
||||
$xy=array([$p->getX(), $p->getY()]);
|
||||
if (!$Points->contains($xy)){
|
||||
$Points[] = $xy;
|
||||
}
|
||||
}
|
||||
return $Points;
|
||||
}
|
||||
}
|
||||
elseif ($representation=='PolySurface') {
|
||||
$rep = $this->getPolySurfaceRepresentation();
|
||||
if ($rep != null){
|
||||
$repPoints = $rep->getPolysurfaceComponent()->getPolygonpoint(); //Points in repository format
|
||||
$Points = new ArrayCollection();
|
||||
foreach ($repPoints as $p) {
|
||||
$xy=array([$p->getX(), $p->getY()]);
|
||||
if (!$Points->contains($xy)){
|
||||
$Points[] = $xy;
|
||||
}
|
||||
}
|
||||
return $Points;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user