Добавлена кластеризация
This commit is contained in:
parent
6e8c83d4a5
commit
b32b81de5b
|
|
@ -23,12 +23,15 @@ class IndexController extends Controller
|
|||
self::addScript('/js/map.js?ver='.App::getConfig('version'));
|
||||
self::addScript('/js/leaflet-routing-machine.js');
|
||||
self::addScript('/js/route.js?ver='.App::getConfig('version'));
|
||||
self::addScript('/js/leaflet.markercluster.js');
|
||||
|
||||
self::addStyle('/css/style.css?ver='.App::getConfig('version'));
|
||||
self::addStyle('http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css');
|
||||
self::addStyle('/css/bootstrap.min.css');
|
||||
self::addStyle('/css/bootstrap-theme.min.css');
|
||||
self::addStyle('/css/leaflet-routing-machine.css');
|
||||
self::addStyle('/css/MarkerCluster.css');
|
||||
self::addStyle('/css/MarkerCluster.Default.css');
|
||||
|
||||
if (!App::$user )
|
||||
self::addScript('//ulogin.ru/js/ulogin.js');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
.marker-cluster-small {
|
||||
background-color: rgba(181, 226, 140, 0.6);
|
||||
}
|
||||
.marker-cluster-small div {
|
||||
background-color: rgba(110, 204, 57, 0.6);
|
||||
}
|
||||
|
||||
.marker-cluster-medium {
|
||||
background-color: rgba(241, 211, 87, 0.6);
|
||||
}
|
||||
.marker-cluster-medium div {
|
||||
background-color: rgba(240, 194, 12, 0.6);
|
||||
}
|
||||
|
||||
.marker-cluster-large {
|
||||
background-color: rgba(253, 156, 115, 0.6);
|
||||
}
|
||||
.marker-cluster-large div {
|
||||
background-color: rgba(241, 128, 23, 0.6);
|
||||
}
|
||||
|
||||
/* IE 6-8 fallback colors */
|
||||
.leaflet-oldie .marker-cluster-small {
|
||||
background-color: rgb(181, 226, 140);
|
||||
}
|
||||
.leaflet-oldie .marker-cluster-small div {
|
||||
background-color: rgb(110, 204, 57);
|
||||
}
|
||||
|
||||
.leaflet-oldie .marker-cluster-medium {
|
||||
background-color: rgb(241, 211, 87);
|
||||
}
|
||||
.leaflet-oldie .marker-cluster-medium div {
|
||||
background-color: rgb(240, 194, 12);
|
||||
}
|
||||
|
||||
.leaflet-oldie .marker-cluster-large {
|
||||
background-color: rgb(253, 156, 115);
|
||||
}
|
||||
.leaflet-oldie .marker-cluster-large div {
|
||||
background-color: rgb(241, 128, 23);
|
||||
}
|
||||
|
||||
.marker-cluster {
|
||||
background-clip: padding-box;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.marker-cluster div {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
|
||||
text-align: center;
|
||||
border-radius: 15px;
|
||||
font: 12px "Helvetica Neue", Arial, Helvetica, sans-serif;
|
||||
}
|
||||
.marker-cluster span {
|
||||
line-height: 30px;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.leaflet-cluster-anim .leaflet-marker-icon, .leaflet-cluster-anim .leaflet-marker-shadow {
|
||||
-webkit-transition: -webkit-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
-moz-transition: -moz-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
-o-transition: -o-transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
transition: transform 0.3s ease-out, opacity 0.3s ease-in;
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.2 KiB |
File diff suppressed because one or more lines are too long
|
|
@ -6,6 +6,7 @@ var myMap;
|
|||
var categories = Array();
|
||||
var points = Array();
|
||||
var pointsSources = Array();
|
||||
var markers;
|
||||
var search;
|
||||
var route = false;
|
||||
var addPointInProcess = false;
|
||||
|
|
@ -40,6 +41,7 @@ ymaps.ready(function(){
|
|||
*/
|
||||
function init(lat, lng) {
|
||||
myMap = L.map('map',{zoomControl: false}).setView([lat, lng], 11);
|
||||
markers = new L.MarkerClusterGroup({showCoverageOnHover: false});
|
||||
|
||||
layers['quest'] = L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png', {attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://mapbox.com">Mapbox</a>',maxZoom: 18});
|
||||
layers['osm'] = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery ©</a>',maxZoom: 18});
|
||||
|
|
@ -119,8 +121,9 @@ function initPoints()
|
|||
url: "/json/points/",
|
||||
success: function(data) {
|
||||
for (var k in data) {
|
||||
constructPoint(data[k]).addTo(myMap);
|
||||
markers.addLayer(constructPoint(data[k]));
|
||||
}
|
||||
myMap.addLayer(markers);
|
||||
|
||||
if (getURLParameter('point') != 'null')
|
||||
{
|
||||
|
|
@ -337,7 +340,7 @@ function addPoint()
|
|||
obj.categoryId = $('#addPointCategoryId').val();
|
||||
|
||||
setTimeout(function() {
|
||||
constructPoint(obj).addTo(myMap);
|
||||
markers.addLayer(constructPoint(obj));
|
||||
}, 2000);
|
||||
|
||||
$('#addPointModal').modal('hide');
|
||||
|
|
@ -443,11 +446,11 @@ function filter()
|
|||
{
|
||||
if (selected.length == 0 || points[key].options.categoryId == undefined || selected.indexOf(points[key].options.categoryId) != -1)
|
||||
{
|
||||
points[key].addTo(myMap);
|
||||
markers.addLayer(points[key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
myMap.removeLayer(points[key]);
|
||||
markers.removeLayer(points[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue