|
|
@ -53,6 +53,9 @@ class TaskController extends AbstractController |
|
|
|
$task = $createForm->getData(); |
|
|
|
|
|
|
|
try { |
|
|
|
if (!$task->hasGeojson()) { |
|
|
|
$task->setGeojson('{}'); |
|
|
|
} |
|
|
|
$task->setCreatedBy($this->getUser()); |
|
|
|
$entityManager->persist($task); |
|
|
|
$entityManager->flush(); |
|
|
@ -104,9 +107,6 @@ class TaskController extends AbstractController |
|
|
|
'label' => 'Commenter', |
|
|
|
]); |
|
|
|
|
|
|
|
$geom = \geoPHP::load($task->getGeojson(), 'json'); |
|
|
|
$bbox = $geom->getBBox(); |
|
|
|
|
|
|
|
$josmCommands = [ |
|
|
|
'imagery' => [ |
|
|
|
'id' => $project->hasImagery() ? $project->getImagery() : 'osmfr', |
|
|
@ -120,7 +120,13 @@ class TaskController extends AbstractController |
|
|
|
UrlGeneratorInterface::ABSOLUTE_URL |
|
|
|
), |
|
|
|
], |
|
|
|
'zoom' => [ |
|
|
|
]; |
|
|
|
|
|
|
|
if ($task->hasGeojson()) { |
|
|
|
$geom = \geoPHP::load($task->getGeojson(), 'json'); |
|
|
|
$bbox = $geom->getBBox(); |
|
|
|
|
|
|
|
$josmCommands['zoom'] = [ |
|
|
|
'bottom' => $bbox['miny'], |
|
|
|
'top' => $bbox['maxy'], |
|
|
|
'left' => $bbox['minx'], |
|
|
@ -128,8 +134,8 @@ class TaskController extends AbstractController |
|
|
|
'changeset_comment' => sprintf('%s %s', $project->getName(), $task->getName()), |
|
|
|
'changeset_source' => $project->getSource(), |
|
|
|
'changeset_hashtags' => $project->getHashtags(), |
|
|
|
], |
|
|
|
]; |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
return $this->render('task/show.html.twig', [ |
|
|
|
'task' => $task, |
|
|
@ -329,6 +335,10 @@ class TaskController extends AbstractController |
|
|
|
return $this->redirect($request->headers->get('Referer')); |
|
|
|
} |
|
|
|
|
|
|
|
if (!$task->hasGeojson()) { |
|
|
|
return new Response('Not found', 404); |
|
|
|
} |
|
|
|
|
|
|
|
$response = JsonResponse::fromJsonString($task->getGeojson()); |
|
|
|
|
|
|
|
$response->headers->set('Content-Disposition', HeaderUtils::makeDisposition( |
|
|
@ -353,6 +363,10 @@ class TaskController extends AbstractController |
|
|
|
return $this->redirect($request->headers->get('Referer')); |
|
|
|
} |
|
|
|
|
|
|
|
if (!$task->hasGeojson()) { |
|
|
|
return new Response('Not found', 404); |
|
|
|
} |
|
|
|
|
|
|
|
$geom = \geoPHP::load($task->getGeojson(), 'json'); |
|
|
|
$gpx = $geom->out('gpx'); |
|
|
|
|
|
|
|