Skip to content

Commit

Permalink
Override api's default graphic identify function and identify dynamic…
Browse files Browse the repository at this point in the history
… layers additionally
  • Loading branch information
green3g committed Feb 1, 2017
1 parent 46a443f commit 04fd307
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions viewer/js/gis/dijit/Identify.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ define([
'esri/dijit/PopupTemplate',
'esri/layers/FeatureLayer',
'esri/TimeExtent',
'dojo/Deferred',
'dojo/text!./Identify/templates/Identify.html',
'dojo/i18n!./Identify/nls/resource',
'./Identify/Formatters',

'dijit/form/Form',
'dijit/form/FilteringSelect',
'xstyle/css!./Identify/css/Identify.css'
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, MenuItem, lang, array, all, topic, query, domStyle, domClass, Moveable, Memory, IdentifyTask, IdentifyParameters, PopupTemplate, FeatureLayer, TimeExtent, IdentifyTemplate, i18n, Formatters) {
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, MenuItem, lang, array, all, topic, query, domStyle, domClass, Moveable, Memory, IdentifyTask, IdentifyParameters, PopupTemplate, FeatureLayer, TimeExtent, Deferred, IdentifyTemplate, i18n, Formatters) {

return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
widgetsInTemplate: true,
Expand Down Expand Up @@ -133,7 +134,6 @@ define([
if (formatters.length > 0) {
layer.on('graphic-draw', lang.hitch(this, 'getFormattedFeature', layer.infoTemplate));
}
return;
}
}
}
Expand Down Expand Up @@ -203,8 +203,27 @@ define([
}
},
executeIdentifyTask: function (evt) {


var mapPoint = evt.mapPoint;
var identifyParams = this.createIdentifyParams(mapPoint);
var identifies = [];
var identifiedlayers = [];
var selectedLayer = this.getSelectedLayer();


if (!this.checkForGraphicInfoTemplate(evt)) {
return;
// return;
var layer = array.filter(this.layers, function (l) {
return l.ref.id === evt.graphic._layer.id;
})[0];
if (!layer) {
return;
}
identifiedlayers.push(layer);
var d = new Deferred();
identifies.push(d.promise);
d.resolve([{feature: evt.graphic}]);
}

this.map.infoWindow.hide();
Expand All @@ -215,11 +234,6 @@ define([
return;
}

var mapPoint = evt.mapPoint;
var identifyParams = this.createIdentifyParams(mapPoint);
var identifies = [];
var identifiedlayers = [];
var selectedLayer = this.getSelectedLayer();

array.forEach(this.layers, lang.hitch(this, function (layer) {
var layerIds = this.getLayerIds(layer, selectedLayer);
Expand Down Expand Up @@ -383,7 +397,7 @@ define([
getInfoTemplate: function (layer, layerId, result) {
var popup, config;
if (result) {
layerId = result.layerId;
layerId = result.layerId || layer.layerId;
} else if (layerId === null) {
layerId = layer.layerId;
}
Expand Down Expand Up @@ -694,4 +708,4 @@ define([
}, this);
}
});
});
});

0 comments on commit 04fd307

Please sign in to comment.