|
|
@ -630,7 +630,14 @@ var Map = function (parent) { |
|
|
|
dataType: 'text', |
|
|
|
url: '/Point/Query', |
|
|
|
success: function (result) { |
|
|
|
console.log(result) |
|
|
|
var data = JSON.parse(result); |
|
|
|
data.forEach(function (item, index) { |
|
|
|
var point = { |
|
|
|
lat: item.Latitude, |
|
|
|
lng: item.Longitude |
|
|
|
}; |
|
|
|
this.AddInfoPoint(point, item.Title, item.Icon, item.Id) |
|
|
|
}.bind(this)) |
|
|
|
}.bind(this) |
|
|
|
}); |
|
|
|
}; |
|
|
@ -652,22 +659,19 @@ var Map = function (parent) { |
|
|
|
}; |
|
|
|
|
|
|
|
this.AddInfoPoint = function (point, title, icon, id) { |
|
|
|
let trans = point.lat.toString().replace('.', ''); |
|
|
|
let label = '<div class="info-point-block info-point{0}"><div class="info-point-top"><p>{1}</p><div class="remove-info-point""><span class="remove-info-point-btn" id="close-btn{2}"></span></div></div><div class="icon icon{3}"/></div></div>'.format(trans, title, trans, icon.slice(0, 1)); |
|
|
|
let label = '<div class="info-point-block info-point{0}"><div class="info-point-top"><p>{1}</p><div class="remove-info-point""><span class="remove-info-point-btn" id="close-btn{2}"></span></div></div><div class="icon icon{3}"/></div></div>'.format(id, title, id, icon.slice(0, 1)); |
|
|
|
L.marker([point.lat, point.lng], { |
|
|
|
icon: L.divIcon({ |
|
|
|
className: 'info-point-content', |
|
|
|
html: label |
|
|
|
}) |
|
|
|
}).addTo(this.map); |
|
|
|
|
|
|
|
var button = $('#close-btn{0}'.format(trans)); |
|
|
|
button.on('click', this.RemoveInfoPoint.bind(this, trans, id)); |
|
|
|
}; |
|
|
|
|
|
|
|
this.RemoveInfoPoint = function (trans, id, event) { |
|
|
|
$('.info-point{0}'.format(trans)).hide(); |
|
|
|
var button = $('#close-btn{0}'.format(id)); |
|
|
|
button.on('click', this.RemoveInfoPoint.bind(this, id)); |
|
|
|
}; |
|
|
|
|
|
|
|
this.RemoveInfoPoint = function (id, event) { |
|
|
|
$.ajax({ |
|
|
|
type: "POST", |
|
|
|
dataType: 'text', |
|
|
@ -675,8 +679,8 @@ var Map = function (parent) { |
|
|
|
data: { |
|
|
|
id: id, |
|
|
|
}, |
|
|
|
success: function (result) { |
|
|
|
console.log(result) |
|
|
|
success: function () { |
|
|
|
$('.info-point{0}'.format(id)).hide(); |
|
|
|
}.bind(this) |
|
|
|
}); |
|
|
|
} |
|
|
|