Mercurial > pub > ImplabJs
comparison src/djol/IdentifyGroup.js @ 8:f0035923ff3e
добавлена библиотека для работы с openlayers 3+
author | cin |
---|---|
date | Mon, 21 Aug 2017 17:47:00 +0300 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
7:9c0943c68a90 | 8:f0035923ff3e |
---|---|
1 define( | |
2 [ | |
3 "implab/safe", | |
4 'dijit/_WidgetBase', | |
5 'dijit/_TemplatedMixin', | |
6 "dijit/_WidgetsInTemplateMixin", | |
7 "dijit/layout/_LayoutWidget", | |
8 "dijit/layout/ContentPane", | |
9 "dojo/_base/declare", | |
10 "dojo/dom-construct", | |
11 "dojo/on", | |
12 "ol3/IdentifyItem" ], | |
13 function( | |
14 safe, | |
15 _WidgetBase, | |
16 _TemplatedMixin, | |
17 _WidgetsInTemplateMixin, | |
18 _LayoutWidget, | |
19 ContentPane, | |
20 declare, | |
21 domConstruct, | |
22 on, | |
23 IdentifyItem) { | |
24 | |
25 return declare( | |
26 [ _LayoutWidget, _TemplatedMixin, _WidgetsInTemplateMixin ], | |
27 { | |
28 | |
29 /** | |
30 */ | |
31 _empty : true, | |
32 /** | |
33 */ | |
34 layerName : null, | |
35 /** | |
36 * Шаблон всего widget | |
37 */ | |
38 templateString : "<div class='identify-item-group'><div data-dojo-attach-point='identifyItemGroupTitle' class='identify-item-group-title'></div><div class='identify-item-group-content-container' data-dojo-attach-point='containerNode'></div></div>", | |
39 | |
40 itemTemplate : "", | |
41 | |
42 title : null, | |
43 | |
44 /** | |
45 * Метод из widget.lifecycle | |
46 */ | |
47 postCreate : function() { | |
48 var me = this; | |
49 if (typeof this.title == "string") { | |
50 this.identifyItemGroupTitle.innerHTML = me.title; | |
51 } else if (me.title && me.title.placeAt) { | |
52 me.title.placeAt(me.identifyItemGroupTitle, "only"); | |
53 } else { | |
54 domConstruct.place( | |
55 me.title, | |
56 me.identifyItemGroupTitle, | |
57 "only"); | |
58 } | |
59 on(this.domNode, "click", function() { | |
60 if ("function" == typeof me.callback) { | |
61 me.callback(); | |
62 } | |
63 }); | |
64 }, | |
65 | |
66 addItem : function(options) { | |
67 safe.argumentNotNull(options, "options"); | |
68 safe.argumentNotNull(options.model, "options.model"); | |
69 | |
70 if (options.model) { | |
71 | |
72 var item = new IdentifyItem({ | |
73 title : options.title || this.itemTemplate, | |
74 model : options.model, | |
75 callback : options.callback | |
76 }); | |
77 this.addChild(item); | |
78 this._empty = false; | |
79 } else { | |
80 console | |
81 .error("Не задано необходимое свойство layerFeature"); | |
82 } | |
83 }, | |
84 | |
85 isEmpty : function() { | |
86 return this._empty; | |
87 } | |
88 }); | |
89 }); |