Add rank in feature.extendedProperties() and use it for icon symbol
cf #527
This commit is contained in:
parent
af6c7fba26
commit
563839b9a6
3 changed files with 20 additions and 11 deletions
|
@ -436,6 +436,24 @@ L.U.FeatureMixin = {
|
||||||
layer.isDirty = true;
|
layer.isDirty = true;
|
||||||
layer.edit();
|
layer.edit();
|
||||||
return layer;
|
return layer;
|
||||||
|
},
|
||||||
|
|
||||||
|
extendedProperties: function () {
|
||||||
|
// Include context properties
|
||||||
|
properties = this.map.getGeoContext();
|
||||||
|
center = this.getCenter();
|
||||||
|
properties.lat = center.lat;
|
||||||
|
properties.lon = center.lng;
|
||||||
|
properties.lng = center.lng;
|
||||||
|
properties.rank = this.getRank() + 1;
|
||||||
|
if (typeof this.getMeasure !== 'undefined') {
|
||||||
|
properties.measure = this.getMeasure();
|
||||||
|
}
|
||||||
|
return L.extend(properties, this.properties);
|
||||||
|
},
|
||||||
|
|
||||||
|
getRank: function () {
|
||||||
|
return this.datalayer._index.indexOf(L.stamp(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ L.U.Icon = L.DivIcon.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
formatUrl: function (url, feature) {
|
formatUrl: function (url, feature) {
|
||||||
return L.Util.greedyTemplate(url || '', feature ? feature.properties : {});
|
return L.Util.greedyTemplate(url || '', feature ? feature.extendedProperties() : {});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,16 +23,7 @@ L.U.Popup = L.Popup.extend({
|
||||||
container = L.DomUtil.create('div', ''),
|
container = L.DomUtil.create('div', ''),
|
||||||
content, properties, center;
|
content, properties, center;
|
||||||
if (this.options.parseTemplate) {
|
if (this.options.parseTemplate) {
|
||||||
// Include context properties
|
properties = this.feature.extendedProperties();
|
||||||
properties = this.feature.map.getGeoContext();
|
|
||||||
center = this.feature.getCenter();
|
|
||||||
properties.lat = center.lat;
|
|
||||||
properties.lon = center.lng;
|
|
||||||
properties.lng = center.lng;
|
|
||||||
if (typeof this.feature.getMeasure !== 'undefined') {
|
|
||||||
properties.measure = this.feature.getMeasure();
|
|
||||||
}
|
|
||||||
properties = L.extend(properties, this.feature.properties);
|
|
||||||
// Resolve properties inside description
|
// Resolve properties inside description
|
||||||
properties.description = L.Util.greedyTemplate(this.feature.properties.description || '', properties);
|
properties.description = L.Util.greedyTemplate(this.feature.properties.description || '', properties);
|
||||||
content = L.Util.greedyTemplate(template, properties);
|
content = L.Util.greedyTemplate(template, properties);
|
||||||
|
|
Loading…
Reference in a new issue