Mercurial > pub > ImplabJs
comparison src/djol/VectorLayer.js @ 10:8705103f074f
Слияние
| author | cin |
|---|---|
| date | Mon, 21 Aug 2017 18:03:00 +0300 |
| parents | f0035923ff3e |
| children |
comparison
equal
deleted
inserted
replaced
| 9:37e9e6bbe87a | 10:8705103f074f |
|---|---|
| 1 define([ | |
| 2 "implab/guard", | |
| 3 "implab/text/template-compile", | |
| 4 "dojo/_base/declare", | |
| 5 "dojo/_base/lang", | |
| 6 "dojo/Deferred", | |
| 7 "ol"], | |
| 8 function (guard, compile, declare, lang, Deferred, ol) { | |
| 9 return declare([ol.layer.Vector], { | |
| 10 | |
| 11 map: null, | |
| 12 | |
| 13 _olMap: null, | |
| 14 | |
| 15 name: null, | |
| 16 | |
| 17 displayName: null, | |
| 18 | |
| 19 identifyResultTemplate: null, | |
| 20 | |
| 21 identifyCompiledTemplate:null, | |
| 22 | |
| 23 searchResultTemplate: null, | |
| 24 | |
| 25 searchCompiledTemplate: null, | |
| 26 | |
| 27 constructor: function () { | |
| 28 lang.mixin(this, arguments[0]); | |
| 29 this._olMap = this.map.olMap; | |
| 30 var identifyCompiledTemplate = null, searchCompiledTemplate = null; | |
| 31 if (this.identifyResultTemplate) { | |
| 32 this.identifyCompiledTemplate = compile(this.identifyResultTemplate); | |
| 33 } | |
| 34 if (this.searchResultTemplate) { | |
| 35 this.searchCompiledTemplate = compile(this.searchResultTemplate); | |
| 36 } | |
| 37 }, | |
| 38 | |
| 39 /** Возвращает массив строк, каждая строка - результат поиска приведенный к шаблонному виду | |
| 40 @options {Object} | |
| 41 @str {String} поисковая строка | |
| 42 @bbox {Object} bound box, в рамках которого осуществлять поиск | |
| 43 */ | |
| 44 getSearchResult: function (options) { | |
| 45 return null; | |
| 46 }, | |
| 47 | |
| 48 _getIdentifyResult: function (options) { | |
| 49 var me = this; | |
| 50 var features = []; | |
| 51 //TODO: добавить фильтр по layer равный ему самому | |
| 52 this._olMap.forEachFeatureAtPixel(options.pixel, function (feature, layer) { | |
| 53 features.push({ feature: feature, layer: layer }); | |
| 54 }, null, function (layer) { | |
| 55 return layer == me; | |
| 56 }); | |
| 57 console.log(features); | |
| 58 return features; | |
| 59 }, | |
| 60 /** Возвращает массив строк, каждая строка - результат идентификации приведенный к шаблонному виду | |
| 61 @options {Object} | |
| 62 @coordinates {Array} массив описывающий координаты точки идентификации | |
| 63 */ | |
| 64 getIdentifyResult: function (coordinates) { | |
| 65 return guard(this, "_getIdentifyResult", [coordinates]); | |
| 66 } | |
| 67 }); | |
| 68 }) |
