Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
92 righe
2.0 KiB
92 righe
2.0 KiB
2 anni fa
|
/**
|
||
|
* Created by PRadostev on 10.03.2015.
|
||
|
*/
|
||
|
var idlayer;
|
||
|
L.DeletePopup = L.Toolbar2.Action.extend({
|
||
|
options: {
|
||
|
toolbarIcon: {className: 'fal fa-trash-alt fa-3x'}
|
||
|
},
|
||
|
|
||
|
initialize: function (map, shape, options) {
|
||
|
this._map = map;
|
||
|
this._layer = shape;
|
||
|
|
||
|
L.Toolbar2.Action.prototype.initialize.call(this, map, options);
|
||
|
},
|
||
|
|
||
|
addHooks: function () {
|
||
|
this._map.removeLayer(this._layer);
|
||
|
this._map.removeLayer(this.toolbar);
|
||
|
this._map.fire('editable:delete', {layer: this._layer});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
L.LinkPopup = L.Toolbar2.Action.extend({
|
||
|
options: {
|
||
|
toolbarIcon: {className: 'fal fa-passport fa-3x', tooltip: 'COMPLETA DATI DELLA SCHEDA'}
|
||
|
},
|
||
|
|
||
|
initialize: function (map, shape, options) {
|
||
|
this._map = map;
|
||
|
this._layer = shape;
|
||
|
|
||
|
L.Toolbar2.Action.prototype.initialize.call(this, map, options);
|
||
|
},
|
||
|
|
||
|
addHooks: function () {
|
||
|
var idlayer = this._layer.feature.id;
|
||
|
window.open('routine_feature?mode=new&id=' + idlayer, '_top');
|
||
|
}
|
||
|
|
||
|
});
|
||
|
|
||
|
L.EditPopup = L.Toolbar2.Action.extend({
|
||
|
options: {
|
||
|
toolbarIcon: {className: 'fal fa-edit fa-3x'}
|
||
|
},
|
||
|
|
||
|
initialize: function (map, shape, options) {
|
||
|
this._map = map;
|
||
|
this._layer = shape;
|
||
|
|
||
|
L.Toolbar2.Action.prototype.initialize.call(this, map, options);
|
||
|
},
|
||
|
|
||
|
enable: function () {
|
||
|
var map = this._map,
|
||
|
layer = this._layer;
|
||
|
|
||
|
layer.enableEdit();
|
||
|
map.removeLayer(this.toolbar); //?????????????????
|
||
|
|
||
|
map.once('click', function () {
|
||
|
layer.disableEdit();
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
L.EditPopupToolbar = L.Toolbar2.Popup.extend({
|
||
|
options: {
|
||
|
actions: [
|
||
|
L.EditPopup,
|
||
|
L.LinkPopup,
|
||
|
L.DeletePopup
|
||
|
]
|
||
|
},
|
||
|
|
||
|
onAdd: function (map) {
|
||
|
var shape = this._arguments[1];
|
||
|
|
||
|
if (shape instanceof L.Marker) {
|
||
|
/* Adjust the toolbar position so that it doesn't cover the marker. */
|
||
|
this.options.anchor = L.point(shape.options.icon.options.popupAnchor);
|
||
|
}
|
||
|
var that = this;
|
||
|
map.once('click', function () {
|
||
|
map.removeLayer(that);
|
||
|
});
|
||
|
|
||
|
L.Toolbar2.Popup.prototype.onAdd.call(this, map);
|
||
|
}
|
||
|
});
|