c80_map_floors 0.1.0.9 → 0.1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/lib/awesomplete.js +450 -0
- data/app/assets/javascripts/map_objects/area.js +12 -8
- data/app/assets/javascripts/map_objects/building.js +23 -6
- data/app/assets/javascripts/src/main.js +12 -2
- data/app/assets/javascripts/src/state_controller.js +50 -8
- data/app/assets/javascripts/svg_elements/admin_building_label.js +6 -6
- data/app/assets/javascripts/svg_elements/building_label.js +88 -60
- data/app/assets/javascripts/ui/tabs/tabs.js +55 -2
- data/app/assets/javascripts/view/building_info/building_info.js +85 -8
- data/app/assets/javascripts/view/building_info/mobj_info_parser.js +316 -12
- data/app/assets/javascripts/view/search_gui.js +295 -0
- data/app/assets/stylesheets/c80_map_floors.scss +3 -1
- data/app/assets/stylesheets/lib/awesomplete.scss +104 -0
- data/app/assets/stylesheets/lib_custom/awesomplete.scss +8 -0
- data/app/assets/stylesheets/map.scss +61 -16
- data/app/assets/stylesheets/ui/search_gui.scss +51 -0
- data/app/assets/stylesheets/ui/tabs_js.scss +25 -0
- data/app/assets/stylesheets/view/buttons/back_to_map_button.scss +1 -1
- data/app/assets/stylesheets/view/elems/building_info.scss +1 -1
- data/app/assets/stylesheets/view/elems/free_areas_label.scss +6 -1
- data/app/controllers/c80_map_floors/ajax_controller.rb +82 -0
- data/app/helpers/c80_map_floors/search_gui_helper.rb +19 -0
- data/app/models/c80_map_floors/area.rb +1 -1
- data/app/models/c80_map_floors/area_representator.rb +13 -22
- data/app/models/c80_map_floors/building_representator.rb +8 -1
- data/app/models/c80_map_floors/floor.rb +1 -1
- data/app/models/c80_map_floors/map_building.rb +2 -2
- data/app/models/c80_map_floors/map_json.rb +2 -1
- data/app/views/c80_map_floors/_map_row_index.html.erb +5 -0
- data/app/views/c80_map_floors/shared/map_row/_search_gui.html.erb +11 -0
- data/config/routes.rb +2 -0
- data/lib/c80_map_floors/version.rb +1 -1
- metadata +9 -2
@@ -113,6 +113,9 @@ function StateController() {
|
|
113
113
|
//Показать все админские лейблы.
|
114
114
|
_map.admin_label_show_all();
|
115
115
|
|
116
|
+
// скроем форму поиска
|
117
|
+
_map.search_gui_klass.position_hide();
|
118
|
+
|
116
119
|
//</editor-fold>
|
117
120
|
break;
|
118
121
|
|
@@ -182,6 +185,11 @@ function StateController() {
|
|
182
185
|
//Скрыть все админские лейблы.
|
183
186
|
_map.admin_label_hide_all();
|
184
187
|
|
188
|
+
// форму поиска покажем в исходном (нормальном) состоянии
|
189
|
+
if (_map.search_gui_klass != null) {
|
190
|
+
_map.search_gui_klass.position_init();
|
191
|
+
}
|
192
|
+
|
185
193
|
//</editor-fold>
|
186
194
|
break;
|
187
195
|
|
@@ -247,6 +255,10 @@ function StateController() {
|
|
247
255
|
|
248
256
|
// скроем подсказки - сколько свободных площадей где есть
|
249
257
|
_map.hide_free_areas_hint();
|
258
|
+
|
259
|
+
// сдвинем форму поиска так, чтобы её не загораживала инфо-панель
|
260
|
+
_map.search_gui_klass.position_inside();
|
261
|
+
|
250
262
|
//</editor-fold>
|
251
263
|
break;
|
252
264
|
|
@@ -290,22 +302,38 @@ function StateController() {
|
|
290
302
|
|
291
303
|
_map.save_button_klass.show();
|
292
304
|
_map.save_button_klass.check_and_enable();
|
305
|
+
|
306
|
+
// скроем форму поиска
|
307
|
+
_map.search_gui_klass.position_hide();
|
308
|
+
|
293
309
|
//</editor-fold>
|
294
310
|
break;
|
295
311
|
|
296
312
|
// вошли в площадь
|
297
313
|
case "view_area":
|
298
314
|
//<editor-fold desc="...">
|
315
|
+
|
316
|
+
// покажем кнопку "обратно на карту"
|
299
317
|
_map.back_to_map_button_klass.show();
|
318
|
+
|
319
|
+
//
|
300
320
|
_this.masked.removeClass('hiddn');
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
//
|
306
|
-
|
307
|
-
_this.
|
308
|
-
_this.
|
321
|
+
|
322
|
+
// выдвигаем инфо-панель
|
323
|
+
_this.building_info.css("top", _this.building_info.data("init"));
|
324
|
+
|
325
|
+
// TODO:: реализовать показ кнопки 'оставить заявку'
|
326
|
+
//<editor-fold desc="// спозиционируем и покажем кнопку 'оставить заявку'">
|
327
|
+
//var t = _this.building_info.height() + _this.building_info.offset().top;
|
328
|
+
//var tt = _this.building_info.css("left");
|
329
|
+
//var tq = (_this.building_info.width() + 40) + "px";
|
330
|
+
//_this.area_order_button.css("top", t + "px");
|
331
|
+
_this.area_order_button.css("bottom","400px");
|
332
|
+
//_this.area_order_button.css("left", tt);
|
333
|
+
//_this.area_order_button.css("width", tq);
|
334
|
+
//_this.area_order_button.css('display', 'block');
|
335
|
+
//</editor-fold>
|
336
|
+
|
309
337
|
_map.edit_button_klass.setState('view_area', true); // [a1x7]
|
310
338
|
|
311
339
|
// скроем кнопку "связать площадь с полигоном"
|
@@ -337,6 +365,13 @@ function StateController() {
|
|
337
365
|
OpacityButtonsUtils.show(_this.edit_button);
|
338
366
|
|
339
367
|
_map.edit_button_klass.setState('edit_area', true); // [a1x7]
|
368
|
+
|
369
|
+
// спрячем инфу о здании
|
370
|
+
_this.building_info.css("top", -500);
|
371
|
+
|
372
|
+
// скроем форму поиска
|
373
|
+
_map.search_gui_klass.position_hide();
|
374
|
+
|
340
375
|
//</editor-fold>
|
341
376
|
break;
|
342
377
|
|
@@ -386,6 +421,10 @@ function StateController() {
|
|
386
421
|
|
387
422
|
// скроем подсказки - сколько свободных площадей где есть
|
388
423
|
_map.hide_free_areas_hint();
|
424
|
+
|
425
|
+
// сдвинем форму поиска так, чтобы её не загораживала инфо-панель
|
426
|
+
_map.search_gui_klass.position_inside();
|
427
|
+
|
389
428
|
//</editor-fold>
|
390
429
|
break;
|
391
430
|
|
@@ -431,6 +470,9 @@ function StateController() {
|
|
431
470
|
_map.save_button_klass.show();
|
432
471
|
_map.save_button_klass.check_and_enable();
|
433
472
|
|
473
|
+
// скроем форму поиска
|
474
|
+
_map.search_gui_klass.position_hide();
|
475
|
+
|
434
476
|
//</editor-fold>
|
435
477
|
break;
|
436
478
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
/**
|
4
4
|
*
|
5
|
-
* @param options - Это C80MapFloors::MapBuilding.
|
5
|
+
* @param options - Это C80MapFloors::MapBuilding.my_as_json5
|
6
6
|
* @param link_to_map - ссылка на класс карты
|
7
7
|
* @param params - вспомогательные параметры для отрисовки (например, координаты центра)
|
8
8
|
* @constructor
|
@@ -18,7 +18,7 @@ var AdminBuildingLabel = function (options, link_to_map, params) {
|
|
18
18
|
this._text_element_ns = null;
|
19
19
|
|
20
20
|
console.log('<AdminBuildingLabel> Пытаемся создать админский лейбл для Здания, options["data"] = ' + options["data"]);
|
21
|
-
// options["data"] - это C80MapFloors::BuildingRepresentator::InstanceMethods.
|
21
|
+
// options["data"] - это C80MapFloors::BuildingRepresentator::InstanceMethods.my_as_json6
|
22
22
|
if (options["data"] != null && typeof options["data"]["id"] != 'undefined') {
|
23
23
|
console.log('<Building.init> Для полигона id=' + options["id"] + ' создаём админский лейбл title=' + options["data"]["title"]);
|
24
24
|
|
@@ -35,11 +35,11 @@ var AdminBuildingLabel = function (options, link_to_map, params) {
|
|
35
35
|
this._text_element_ns = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
36
36
|
this._text_element_ns.setAttribute('x', this._x);
|
37
37
|
this._text_element_ns.setAttribute('y', this._y);
|
38
|
-
this._text_element_ns.setAttribute('fill', '#
|
39
|
-
this._text_element_ns.setAttribute('style', 'font-size:
|
38
|
+
this._text_element_ns.setAttribute('fill', '#0000ff');
|
39
|
+
this._text_element_ns.setAttribute('style', 'font-size:15px;font-weight:bold;');
|
40
40
|
|
41
|
-
// помещаем текст: id=<id_привязанного_
|
42
|
-
this._text_element_ns.textContent = "
|
41
|
+
// помещаем текст: title=<Заголовок_привязанного_здания>, id=<id_привязанного_Здания>
|
42
|
+
this._text_element_ns.textContent = "'" + options["data"]["title"] + "', id=" + options["data"]["id"];
|
43
43
|
|
44
44
|
// "антагонист" метода destroy()
|
45
45
|
this._map.addNodeToSvg(this._g, false);
|
@@ -1,65 +1,93 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var BuildingLabel = function (options, link_to_map) {
|
4
|
-
|
5
|
-
if ( options["rent_building_hash"] != undefined &&
|
6
|
-
typeof options["rent_building_hash"].id != 'undefined' &&
|
7
|
-
options["rent_building_hash"].props.free_areas_count != 0
|
8
|
-
) {
|
9
|
-
|
10
|
-
this._x = options.coords[0];
|
11
|
-
this._y = options.coords[1];
|
12
|
-
this._map = link_to_map;
|
13
|
-
|
14
|
-
var center_for_cicrle_x = this._x;
|
15
|
-
var center_for_cicrle_y = this._y - 100;
|
16
|
-
|
17
|
-
// создадим узел, который будет помещён в дерево и будет виден пользователю
|
18
|
-
this._g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
19
|
-
this._g.setAttribute("class","free_areas_label");
|
20
|
-
|
21
|
-
this._bg_pulse = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
22
|
-
this._bg_pulse.setAttribute("cx",center_for_cicrle_x);
|
23
|
-
this._bg_pulse.setAttribute("cy",center_for_cicrle_y);
|
24
|
-
this._bg_pulse.setAttribute("r", 40);
|
25
|
-
this._bg_pulse.setAttribute("class","pulse");
|
26
|
-
|
27
|
-
this._bg_pulse2 = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
28
|
-
this._bg_pulse2.setAttribute("cx",center_for_cicrle_x);
|
29
|
-
this._bg_pulse2.setAttribute("cy",center_for_cicrle_y);
|
30
|
-
this._bg_pulse2.setAttribute("r", 40);
|
31
|
-
this._bg_pulse2.setAttribute("class","pulse2");
|
32
|
-
|
33
|
-
this._bg_circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
34
|
-
this._bg_circle.setAttribute("cx",center_for_cicrle_x);
|
35
|
-
this._bg_circle.setAttribute("cy",center_for_cicrle_y);
|
36
|
-
this._bg_circle.setAttribute("r",40);
|
37
|
-
this._bg_circle.setAttribute("class","circle");
|
38
|
-
|
39
|
-
this._text_element_ns = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
40
|
-
this._text_element_ns.setAttribute('x', center_for_cicrle_x);
|
41
|
-
this._text_element_ns.setAttribute('y', center_for_cicrle_y);
|
42
|
-
this._text_element_ns.setAttribute('class', 'text');
|
43
|
-
this._text_element_ns.textContent = options["rent_building_hash"].props.free_areas_count;
|
44
|
-
|
45
|
-
this._aLine = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
46
|
-
this._aLine.setAttribute('x1', this._x);
|
47
|
-
this._aLine.setAttribute('y1', this._y);
|
48
|
-
this._aLine.setAttribute('x2', center_for_cicrle_x);
|
49
|
-
this._aLine.setAttribute('y2', center_for_cicrle_y);
|
50
|
-
this._aLine.setAttribute('stroke', '#39BD5F');
|
51
|
-
this._aLine.setAttribute('stroke-width', '2');
|
52
|
-
|
53
|
-
|
54
|
-
// цепляем НЕ в #svg_overlay (об этом нам говорит is_overlay = false аргумент)
|
55
|
-
this._map.addNodeToSvg(this._g, false);
|
56
|
-
|
57
|
-
this._g.appendChild(this._aLine);
|
58
|
-
this._g.appendChild(this._bg_pulse);
|
59
|
-
this._g.appendChild(this._bg_pulse2);
|
60
|
-
this._g.appendChild(this._bg_circle);
|
61
|
-
this._g.appendChild(this._text_element_ns);
|
62
|
-
|
63
|
-
}
|
64
4
|
|
5
|
+
this._x = String(options['x']);
|
6
|
+
this._y = String(options['y']);
|
7
|
+
this._count = options['count'];
|
8
|
+
this._map = link_to_map;
|
9
|
+
|
10
|
+
var _this = this;
|
11
|
+
var center_for_circle_x = String(this._x);
|
12
|
+
var center_for_circle_y = String(this._y - 50);
|
13
|
+
|
14
|
+
// создадим узел, который будет помещён в дерево и будет виден пользователю
|
15
|
+
this._g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
16
|
+
this._g.setAttribute("class", "free_areas_label");
|
17
|
+
|
18
|
+
// кружок
|
19
|
+
this._bg_pulse = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
20
|
+
this._bg_pulse.setAttribute("cx", center_for_circle_x);
|
21
|
+
this._bg_pulse.setAttribute("cy", center_for_circle_y);
|
22
|
+
this._bg_pulse.setAttribute("r", '40');
|
23
|
+
this._bg_pulse.setAttribute("class", "pulse");
|
24
|
+
|
25
|
+
// кружок
|
26
|
+
this._bg_pulse2 = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
27
|
+
this._bg_pulse2.setAttribute("cx", center_for_circle_x);
|
28
|
+
this._bg_pulse2.setAttribute("cy", center_for_circle_y);
|
29
|
+
this._bg_pulse2.setAttribute("r", '40');
|
30
|
+
this._bg_pulse2.setAttribute("class", "pulse2");
|
31
|
+
|
32
|
+
// кружок
|
33
|
+
this._bg_circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
|
34
|
+
this._bg_circle.setAttribute("cx", center_for_circle_x);
|
35
|
+
this._bg_circle.setAttribute("cy", center_for_circle_y);
|
36
|
+
this._bg_circle.setAttribute("r", '40');
|
37
|
+
this._bg_circle.setAttribute("class", "circle");
|
38
|
+
|
39
|
+
// текст
|
40
|
+
this._text_element_ns = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
41
|
+
this._text_element_ns.setAttribute('x', center_for_circle_x);
|
42
|
+
this._text_element_ns.setAttribute('y', center_for_circle_y);
|
43
|
+
this._text_element_ns.setAttribute('class', this._count > 9 ? 'text':'text one_digit');
|
44
|
+
this._text_element_ns.textContent = this._count;
|
45
|
+
|
46
|
+
// вертикальная линия
|
47
|
+
this._aLine = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
48
|
+
this._aLine.setAttribute('x1', this._x);
|
49
|
+
this._aLine.setAttribute('y1', this._y);
|
50
|
+
this._aLine.setAttribute('x2', center_for_circle_x);
|
51
|
+
this._aLine.setAttribute('y2', center_for_circle_y);
|
52
|
+
this._aLine.setAttribute('stroke', '#39BD5F');
|
53
|
+
this._aLine.setAttribute('stroke-width', '2');
|
54
|
+
|
55
|
+
// цепляем НЕ в #svg_overlay (об этом нам говорит is_overlay = false аргумент)
|
56
|
+
this._map.addNodeToSvg(this._g, false);
|
57
|
+
|
58
|
+
// собираем
|
59
|
+
this._g.appendChild(this._aLine);
|
60
|
+
this._g.appendChild(this._bg_pulse);
|
61
|
+
this._g.appendChild(this._bg_pulse2);
|
62
|
+
this._g.appendChild(this._bg_circle);
|
63
|
+
this._g.appendChild(this._text_element_ns);
|
64
|
+
|
65
|
+
//--[ public ]------------------------------------------------------------------------------------------------------
|
66
|
+
|
67
|
+
this.destroy = function () {
|
68
|
+
if (this._map != null) {
|
69
|
+
console.log('<BuildingLabel.destroy> Уничтожаем метку с кол-вом магазинов.');
|
70
|
+
|
71
|
+
_this._map.removeNodeFromSvg(_this._g, false);
|
72
|
+
|
73
|
+
if (_this._g != null) {
|
74
|
+
|
75
|
+
_this._g.removeChild(_this._aLine);
|
76
|
+
_this._g.removeChild(_this._bg_pulse);
|
77
|
+
_this._g.removeChild(_this._bg_pulse2);
|
78
|
+
_this._g.removeChild(_this._bg_circle);
|
79
|
+
_this._g.removeChild(_this._text_element_ns);
|
80
|
+
|
81
|
+
delete _this._aLine;
|
82
|
+
delete _this._bg_pulse;
|
83
|
+
delete _this._bg_pulse2;
|
84
|
+
delete _this._bg_circle;
|
85
|
+
delete _this._text_element_ns;
|
86
|
+
|
87
|
+
delete _this._g;
|
88
|
+
}
|
89
|
+
|
90
|
+
}
|
91
|
+
};
|
92
|
+
|
65
93
|
};
|
@@ -102,6 +102,30 @@ function Tabs(options) {
|
|
102
102
|
.click();
|
103
103
|
};
|
104
104
|
|
105
|
+
/**
|
106
|
+
* Подсветить кнопки-табы, чей id присутствует в search_results_floors, а именно: снабдить красным кружочком с цифрой
|
107
|
+
*
|
108
|
+
* @param search_results_floors - [map_floors_ids]: айдишники полигонов этажей.
|
109
|
+
* @param search_results_count - [Number]: кол-во магазинов на соответствующих этажах из search_results_floors
|
110
|
+
*/
|
111
|
+
this.searchResultsShowFloors = function (search_results_floors, search_results_count) {
|
112
|
+
console.log('<Tabs.searchResultsShowFloors> Подсветить кнопки-табы, search_results_floors=['+search_results_floors.join(',')+']');
|
113
|
+
|
114
|
+
var $ibtn, iindex, icount;
|
115
|
+
for (var tab_id in _data) {
|
116
|
+
//noinspection JSUnfilteredForInLoop
|
117
|
+
$ibtn = _data[tab_id]['tab_button'];
|
118
|
+
iindex = search_results_floors.indexOf(Number(tab_id));
|
119
|
+
if (iindex != -1) { // если айдишник вкладки имеется в массиве с результатами поиска
|
120
|
+
icount = search_results_count[iindex];
|
121
|
+
_this._buttonRedCircleAdd($ibtn, icount);
|
122
|
+
} else {
|
123
|
+
_this._buttonRedCircleRemove($ibtn);
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
};
|
128
|
+
|
105
129
|
//--[ controller ]----------------------------------------------------------------------------------------------------------------------
|
106
130
|
|
107
131
|
this._onTabButtonClick = function (e) {
|
@@ -211,6 +235,35 @@ function Tabs(options) {
|
|
211
235
|
$a_button.off('click', _this._onTabButtonClick);
|
212
236
|
};
|
213
237
|
|
238
|
+
/**
|
239
|
+
* Снабдить кнопку красным кружочком с цифрой,
|
240
|
+
* т.е. показать, что на этом этаже имеется такое-то кол-во магазинов,
|
241
|
+
* удовлетворяющих поиску.
|
242
|
+
*
|
243
|
+
* @param $a_button
|
244
|
+
* @param count
|
245
|
+
* @private
|
246
|
+
*/
|
247
|
+
this._buttonRedCircleAdd = function ($a_button, count) {
|
248
|
+
|
249
|
+
$a_button.addClass('red')
|
250
|
+
.attr('data-search-count', count);
|
251
|
+
|
252
|
+
console.log('<Tabs._buttonRedCircleAdd> Добавляем красный индикатор на кнопку: data-id='+$a_button.attr('data-id'));
|
253
|
+
};
|
254
|
+
|
255
|
+
/**
|
256
|
+
* Удалить у кнопки красный кружок с цифрой.
|
257
|
+
* @param $a_button
|
258
|
+
* @private
|
259
|
+
*/
|
260
|
+
this._buttonRedCircleRemove = function ($a_button) {
|
261
|
+
console.log('<Tabs._buttonRedCircleRemove> Убираем красный индикатор с кнопки.');
|
262
|
+
|
263
|
+
$a_button.removeClass('red')
|
264
|
+
.attr('data-search-count', '');
|
265
|
+
};
|
266
|
+
|
214
267
|
//this._contentRemove = function () {
|
215
268
|
//
|
216
269
|
//};
|
@@ -247,7 +300,7 @@ function Tabs(options) {
|
|
247
300
|
}
|
248
301
|
|
249
302
|
if (mark_error_occurs) {
|
250
|
-
|
303
|
+
alert('data error, refer log for details.');
|
251
304
|
console.log('<_displayContent> [ERROR] Что-то не то с данными.');
|
252
305
|
}
|
253
306
|
|
@@ -271,4 +324,4 @@ function Tabs(options) {
|
|
271
324
|
|
272
325
|
this._fInit(options);
|
273
326
|
|
274
|
-
}
|
327
|
+
}
|
@@ -1,10 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
|
3
|
+
/**
|
4
|
+
* Содержит компонент Tabs, пользуется им для отображения информации об этажах здания.
|
5
|
+
* Имеется возможность подсветить результаты поиска.
|
6
|
+
*
|
7
|
+
* @param options - { onFloorTabChange - при клике по табам вызывается этот callback }
|
8
|
+
* @constructor
|
9
|
+
*/
|
4
10
|
|
5
11
|
function BuildingInfo(options) {
|
6
12
|
|
7
|
-
|
13
|
+
var _this = this;
|
14
|
+
|
15
|
+
// текуще отображаемое здание (Это данные от C80MapFloors::MapBuilding, метод my_as_json5)
|
8
16
|
var _cur_map_building_json;
|
9
17
|
|
10
18
|
// настраиваемые параметры
|
@@ -21,15 +29,28 @@ function BuildingInfo(options) {
|
|
21
29
|
// компонент "вкладки"
|
22
30
|
var _tabs = null;
|
23
31
|
|
32
|
+
// todo-clear22:: необходимо сбрасывать это значение после того, как сбросили поиск
|
33
|
+
// текущий результат поиска - какие этажи имеют искомые магазины
|
34
|
+
var _search_results_floors = null;
|
35
|
+
|
36
|
+
// todo-clear22:: необходимо сбрасывать это значение после того, как сбросили поиск
|
37
|
+
// текущий результат поиска - кол-во магазинов на соответствющих этажах в _search_results_floors
|
38
|
+
var _search_results_floors_shops_count = null;
|
39
|
+
|
40
|
+
// todo-clear22:: необходимо сбрасывать это значение после того, как сбросили поиск
|
41
|
+
// текущий результат поиска - какие полигоны площадей соответствуют поиску и содержат искомые магазины
|
42
|
+
var _search_results_areas = null;
|
43
|
+
|
24
44
|
// привязка данных об этажах здания ко вкладкам в этом удобном хэше
|
25
45
|
// NOTE:: но нахуя он был добавлен - пока загадка. В комменты его. Детективная история, главная улика - слово "удобный".
|
26
46
|
//var _tabs_floors_data = {};
|
27
47
|
|
28
48
|
//-[ public ]-----------------------------------------------------------------------------------------------------------------------
|
29
49
|
|
30
|
-
/**
|
50
|
+
/**
|
51
|
+
* Получить данные для отображения.
|
31
52
|
*
|
32
|
-
* @param map_building_json Это данные от C80MapFloors::MapBuilding
|
53
|
+
* @param map_building_json - Это данные от C80MapFloors::MapBuilding, метод my_as_json5
|
33
54
|
*/
|
34
55
|
this.setData = function (map_building_json) {
|
35
56
|
console.log('<BuildingInfo.setData> Получили данные для отображения - map_building_json.');
|
@@ -44,13 +65,61 @@ function BuildingInfo(options) {
|
|
44
65
|
};
|
45
66
|
|
46
67
|
/**
|
47
|
-
*
|
68
|
+
* Войти на этаж с указанным номером (др.словами: индексом).
|
69
|
+
* (например: у первого этажа индекс равен 0)
|
48
70
|
* @param floor_index
|
49
71
|
*/
|
50
72
|
this.setSelectedFloor = function (floor_index) {
|
51
73
|
_tabs.setSelectedIndex(floor_index);
|
52
74
|
};
|
53
75
|
|
76
|
+
/**
|
77
|
+
* Подсветить результаты поиска: добавить на табы красные кружки с цифрами.
|
78
|
+
* Вызывается как и в момент прихода результата поиска,
|
79
|
+
* так и после установки данных в компонент. Для 2-го случая была введена
|
80
|
+
* переменная _search_results_floors.
|
81
|
+
*
|
82
|
+
* @param search_results - { buildings: [map_buildings_ias], floors: [map_floors_ids], areas: [map_areas_ids] }
|
83
|
+
* Т.е. объект массивов айдишников элементов карты.
|
84
|
+
*/
|
85
|
+
this.searchResultsShow = function (search_results) {
|
86
|
+
|
87
|
+
if (search_results['floors'] != undefined) {
|
88
|
+
|
89
|
+
_search_results_floors = search_results['floors'];
|
90
|
+
_search_results_floors_shops_count = search_results['floors_shops_count'];
|
91
|
+
|
92
|
+
if (_tabs != null) {
|
93
|
+
_tabs.searchResultsShowFloors(search_results['floors'], search_results['floors_shops_count']);
|
94
|
+
} else {
|
95
|
+
console.log('<BuildingInfo.searchResultsShow> [ERROR] Нет компонента: _tabs = null.');
|
96
|
+
}
|
97
|
+
|
98
|
+
}
|
99
|
+
|
100
|
+
else {
|
101
|
+
console.log('<BuildingInfo.searchResultsShow> [ERROR] Нет данных: search_results["floors"] = null.');
|
102
|
+
}
|
103
|
+
|
104
|
+
// в случае наличия данных про полигоны площадей (удовлетворяющих поиску) - отдадим эти данные парсеру
|
105
|
+
if (search_results['areas'] != undefined) {
|
106
|
+
|
107
|
+
_search_results_areas = search_results['areas'];
|
108
|
+
|
109
|
+
// парсер будет ориентироваться на них, и в случае их присутствия
|
110
|
+
// будет понимать, что поиск активен и надо при формировании HTML строки
|
111
|
+
// обнаружить искомое в данных и (в таком случае) отобразить только их
|
112
|
+
if (_mobj_info_parser != undefined) {
|
113
|
+
_mobj_info_parser.setSearchResultAreas(_search_results_areas);
|
114
|
+
}
|
115
|
+
|
116
|
+
}
|
117
|
+
|
118
|
+
else {
|
119
|
+
console.log('<BuildingInfo.searchResultsShow> [ERROR] Нет данных: search_results["areas"] = null.');
|
120
|
+
}
|
121
|
+
};
|
122
|
+
|
54
123
|
//------------------------------------------------------------------------------------------------------------------------
|
55
124
|
|
56
125
|
/**
|
@@ -90,14 +159,18 @@ function BuildingInfo(options) {
|
|
90
159
|
console.log('<BuildingInfo._parseData> Парсим map_building_json, заполняем Tabs компонент:');
|
91
160
|
|
92
161
|
// установим заголовок окна
|
93
|
-
|
162
|
+
var titl = _cur_map_building_json["title"];
|
163
|
+
if (_cur_map_building_json['data'] != undefined) {
|
164
|
+
titl = _cur_map_building_json['data']['title'];
|
165
|
+
}
|
166
|
+
_$title.text(titl);
|
94
167
|
|
95
168
|
// обойдём этажи, построим вкладки
|
96
169
|
for (var i = 0; i < _cur_map_building_json['floors'].length; i++) {
|
97
170
|
|
98
171
|
var ifloor_data = _cur_map_building_json['floors'][i];
|
99
|
-
var ifloor_id = ifloor_data["id"]; // NOTE:fidfid
|
100
|
-
|
172
|
+
var ifloor_id = ifloor_data["id"]; // NOTE: fidfid: айди полигона этажа равен айдишнику вкладки
|
173
|
+
console.log(ifloor_data); // => see C80MapFloors::Floor.as_json
|
101
174
|
|
102
175
|
// создадим вкладку
|
103
176
|
_tabs.addTab(ifloor_data["title"], ifloor_id, this._onTabShow, {
|
@@ -113,6 +186,10 @@ function BuildingInfo(options) {
|
|
113
186
|
|
114
187
|
this._updateView = function () {
|
115
188
|
|
189
|
+
if (_search_results_floors != null) {
|
190
|
+
_this.searchResultsShow(_search_results_floors);
|
191
|
+
}
|
192
|
+
|
116
193
|
};
|
117
194
|
|
118
195
|
// очистим данные и вью
|