From b120a86db859d706032400d15f1299d4ca8e99e2 Mon Sep 17 00:00:00 2001 From: Timoxa Date: Sun, 24 Jun 2018 16:38:08 +0300 Subject: [PATCH 1/2] add yandexMap page --- rest/web/WEB-INF/views/css/yandex-map.css | 4 + rest/web/WEB-INF/views/helloPage.jsp | 2 +- .../WEB-INF/views/js/multiroute_driving.js | 150 ++++++++++++++++++ rest/web/WEB-INF/views/js/yandex.map.js | 17 -- rest/web/WEB-INF/views/parts/body.jsp | 6 +- rest/web/WEB-INF/views/parts/yaMap.jsp | 45 ++++++ 6 files changed, 201 insertions(+), 23 deletions(-) create mode 100644 rest/web/WEB-INF/views/js/multiroute_driving.js delete mode 100644 rest/web/WEB-INF/views/js/yandex.map.js create mode 100644 rest/web/WEB-INF/views/parts/yaMap.jsp diff --git a/rest/web/WEB-INF/views/css/yandex-map.css b/rest/web/WEB-INF/views/css/yandex-map.css index 1143d31..6db2d3f 100644 --- a/rest/web/WEB-INF/views/css/yandex-map.css +++ b/rest/web/WEB-INF/views/css/yandex-map.css @@ -1,4 +1,8 @@ #yandexMap{ width: 100%; height: 400px; +} +#map { + width: 100%; + height: 400px; } \ No newline at end of file diff --git a/rest/web/WEB-INF/views/helloPage.jsp b/rest/web/WEB-INF/views/helloPage.jsp index 0d030c4..d38a272 100644 --- a/rest/web/WEB-INF/views/helloPage.jsp +++ b/rest/web/WEB-INF/views/helloPage.jsp @@ -41,7 +41,7 @@ - + diff --git a/rest/web/WEB-INF/views/js/multiroute_driving.js b/rest/web/WEB-INF/views/js/multiroute_driving.js new file mode 100644 index 0000000..3d7e1ba --- /dev/null +++ b/rest/web/WEB-INF/views/js/multiroute_driving.js @@ -0,0 +1,150 @@ +function init () { + multiRoute = new ymaps.multiRouter.MultiRoute({ + referencePoints: rout, + params: { + results: 1 + } + }, { + editorMidPointsType: "via", + editorDrawOver: false + + }); + //routMake(multiRoute); + + buttonEditor = new ymaps.control.Button({ + data: { content: "Режим редактирования" } + }); + + buttonEditor.events.add("select", function () { + multiRoute.editor.start({ + addWayPoints: true, + removeWayPoints: true + }); + }); + + buttonEditor.events.add("deselect", function () { + // Выключение режима редактирования. + multiRoute.editor.stop(); + routMake(multiRoute); + + }); + + myMap = new ymaps.Map('map', { + center: rout[1], + zoom: 7, + controls: ['default', 'routeButtonControl', buttonEditor] + }, { + buttonMaxWidth: 300 + }); + myMap.geoObjects.add(multiRoute); + +} +function routMake(multiRoute) { + var JSONObject = multiRoute.model.getJson(); + var length = JSONObject.properties.waypoints.length; + var routJson =[]; + for (var i = 0; i -
-

На многих коммерческих сайтах есть контактная информация с местом расположения их офиса. Иногда, - это просто изображение со схемой проезда, но очень часто встречается использование Яндекс.Карт

-
-
+ diff --git a/rest/web/WEB-INF/views/parts/yaMap.jsp b/rest/web/WEB-INF/views/parts/yaMap.jsp new file mode 100644 index 0000000..090f7bf --- /dev/null +++ b/rest/web/WEB-INF/views/parts/yaMap.jsp @@ -0,0 +1,45 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + +
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+ +
+
+ +

TYPE NAME OF ROUT

+
+
+
+ @ + +
+
+
+ +
+
+ +
+
+ + + +
+
+ + From c831677fbec3c11ac38ed341abea44b1402463f9 Mon Sep 17 00:00:00 2001 From: Timoxa Date: Sun, 24 Jun 2018 16:54:23 +0300 Subject: [PATCH 2/2] reformat code --- rest/web/WEB-INF/views/js/multiroute_driving.js | 5 ----- rest/web/WEB-INF/views/parts/yaMap.jsp | 1 - 2 files changed, 6 deletions(-) diff --git a/rest/web/WEB-INF/views/js/multiroute_driving.js b/rest/web/WEB-INF/views/js/multiroute_driving.js index 3d7e1ba..56cbeec 100644 --- a/rest/web/WEB-INF/views/js/multiroute_driving.js +++ b/rest/web/WEB-INF/views/js/multiroute_driving.js @@ -7,9 +7,7 @@ function init () { }, { editorMidPointsType: "via", editorDrawOver: false - }); - //routMake(multiRoute); buttonEditor = new ymaps.control.Button({ data: { content: "Режим редактирования" } @@ -23,10 +21,8 @@ function init () { }); buttonEditor.events.add("deselect", function () { - // Выключение режима редактирования. multiRoute.editor.stop(); routMake(multiRoute); - }); myMap = new ymaps.Map('map', { @@ -106,7 +102,6 @@ function getById() { $('#id').val(result.id); $('#name').val(result.name); $('#description').val(result.description); - rout = null; rout = []; for (var i = 0; i -