From ade2c3b5de36fa488d792a8d917eef67cfa43a69 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Tue, 3 Dec 2019 09:42:23 +0000 Subject: [PATCH] Add map manager interface. #270 --- config/services.yaml | 10 ++ src/Controller/HomeController.php | 9 +- src/Service/GISManager/Bing.php | 17 ++++ src/Service/GISManager/Google.php | 17 ++++ src/Service/GISManager/OpenStreet.php | 17 ++++ src/Service/GISManagerInterface.php | 10 ++ templates/home.html.twig | 135 ++------------------------ templates/map/.initGoogleMap.js.swo | Bin 0 -> 12288 bytes templates/map/initBingMap.js | 36 +++++++ templates/map/initGoogleMap.js | 22 +++++ templates/map/initOpenStreetMap.js | 23 +++++ 11 files changed, 168 insertions(+), 128 deletions(-) create mode 100644 src/Service/GISManager/Bing.php create mode 100644 src/Service/GISManager/Google.php create mode 100644 src/Service/GISManager/OpenStreet.php create mode 100644 src/Service/GISManagerInterface.php create mode 100644 templates/map/.initGoogleMap.js.swo create mode 100644 templates/map/initBingMap.js create mode 100644 templates/map/initGoogleMap.js create mode 100644 templates/map/initOpenStreetMap.js diff --git a/config/services.yaml b/config/services.yaml index 0c620dd1..7f359bca 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -159,3 +159,13 @@ services: # rider assignment interface App\Service\RiderAssignmentHandlerInterface: "@App\\Service\\RiderAssignmentHandler\\CMBRiderAssignmentHandler" + + # map manager + #App\Service\GISManager\Bing: ~ + #App\Service\GISManager\OpenStreet: ~ + App\Service\GISManager\Google: ~ + + #App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Bing" + #App\Service\GISManagerInterface: "@App\\Service\\GISManager\\OpenStreet" + App\Service\GISManagerInterface: "@App\\Service\\GISManager\\Google" + diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 6afa57c5..99b4da36 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -8,6 +8,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Doctrine\ORM\EntityManagerInterface; use App\Service\RiderTracker; +use App\Service\GISManagerInterface; use App\Entity\Rider; @@ -17,9 +18,13 @@ class HomeController extends Controller /** * @Menu(selected="home") */ - public function index(EntityManagerInterface $em, RiderTracker $rider_tracker) + public function index(EntityManagerInterface $em, RiderTracker $rider_tracker, + GISManagerInterface $gis_manager) { - return $this->render('home.html.twig'); + // get map + $params['map_js_file'] = $gis_manager->getJSInitFile(); + + return $this->render('home.html.twig', $params); } public function getRiderLocations(EntityManagerInterface $em, RiderTracker $rider_tracker) diff --git a/src/Service/GISManager/Bing.php b/src/Service/GISManager/Bing.php new file mode 100644 index 00000000..7c5f02ce --- /dev/null +++ b/src/Service/GISManager/Bing.php @@ -0,0 +1,17 @@ +
-
+
@@ -42,135 +42,18 @@ {% endblock %} -{% block scripts %} +{% block js_end %} +{{ include('map/' ~ map_js_file) }} - -{# - - - - - -#} - {% endblock %} + diff --git a/templates/map/.initGoogleMap.js.swo b/templates/map/.initGoogleMap.js.swo new file mode 100644 index 0000000000000000000000000000000000000000..c1c22fd575a38454736e77c64e9c352e9dafab32 GIT binary patch literal 12288 zcmeI2!EVz)5QevKL$shGaRO-x5=n&REl>%`G)1DSP!74#o^t;PxNzhJ`UK3{aYDF6;s%gT)b z_b54Z2+5Q(HoVT19;j2P*DWJ#!ZViVIm@K}z>JL3h#RR{%u^O7p?R%T5Xl}--QoJp z)@H*6NB{|}64)fqo<7;Jv4@QZ^v?Ft>SdfE0VIF~kN^@u0!RP}AOR%sUlTCt2KfjT zUYl2WcRp_XG0vwrAOR$R1dsp{Kmter2_OL^fCP{L5AiJ1YLl>fE4I0=ooYa+6LVOeTV%nK^LHJpsygC;}ZxC2_OL^ zfCP{L5Kf>p=2p0zF zN#HC>bjpWjv+UJRxAv&cM5n=Q6TEikq=kyhIpb-_hWh157M{@3JZ(_>4s;quo*Fjf6J8~3P_BzaP+%&v{pCyc3$PdMU;qFB literal 0 HcmV?d00001 diff --git a/templates/map/initBingMap.js b/templates/map/initBingMap.js new file mode 100644 index 00000000..0183fe54 --- /dev/null +++ b/templates/map/initBingMap.js @@ -0,0 +1,36 @@ + + + + diff --git a/templates/map/initGoogleMap.js b/templates/map/initGoogleMap.js new file mode 100644 index 00000000..51349ae2 --- /dev/null +++ b/templates/map/initGoogleMap.js @@ -0,0 +1,22 @@ + + + diff --git a/templates/map/initOpenStreetMap.js b/templates/map/initOpenStreetMap.js new file mode 100644 index 00000000..6bf85690 --- /dev/null +++ b/templates/map/initOpenStreetMap.js @@ -0,0 +1,23 @@ + + +