Skip to content

Commit

Permalink
Merge pull request #3589 from MTES-MCT/hotfix/3588-wkt-missing-parsing
Browse files Browse the repository at this point in the history
[Auto-affectation] Prise en compte de format wkt spécifique
  • Loading branch information
numew authored Jan 21, 2025
2 parents 23b7c44 + 515e7d1 commit 1edc71f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public function __invoke(SignalementAddressUpdateAndAutoAssignMessage $signaleme
try {
$signalement = $this->signalementRepository->find($signalementAddressUpdateAndAutoAssignMessage->getSignalementId());
$this->signalementAddressUpdater->updateAddressOccupantFromBanData($signalement);
$this->autoAssigner->assign($signalement);
$this->entityManager->flush();
$this->autoAssigner->assign($signalement);
} catch (\Throwable $exception) {
$this->logger->error(
sprintf(
Expand Down
8 changes: 8 additions & 0 deletions src/Specification/Affectation/CodeInseeSpecification.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,21 @@ private function isSignalementInZone(Signalement $signalement, Zone $zone): bool

private function isPointInPolygon(Coordinate $point, array $polygonData): bool
{
// special case : POLYGON ((X1 Y1, X2 Y2)))
if (1 === \count($polygonData)) {
$polygonData = $polygonData[0];
}
$polygon = $this->buildPolygon($polygonData);

return $polygon->contains($point);
}

private function isPointInMultiPolygon(Coordinate $point, array $multiPolygonData): bool
{
// special case : MULTIPOLYGON (((X1 Y1, X2 Y2),(X3 Y3, X4 Y4)))
if (1 === \count($multiPolygonData)) {
$multiPolygonData = $multiPolygonData[0];
}
foreach ($multiPolygonData as $polygonData) {
if ($this->isPointInPolygon($point, $polygonData)) {
return true;
Expand Down

0 comments on commit 1edc71f

Please sign in to comment.