This commit is contained in:
parent
8b0afa9fcb
commit
ba533e8942
@ -233,7 +233,19 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
},
|
},
|
||||||
deselect() {
|
deselect() {
|
||||||
var style = {};
|
var style = {};
|
||||||
style['color'] = '#3388ff';
|
if(this.options.attributes.type == 'ga') {
|
||||||
|
style['color'] = 'green';
|
||||||
|
} else if(this.options.attributes.type == 'cargo') {
|
||||||
|
style['color'] = 'yellow';
|
||||||
|
} else if(this.options.attributes.type == 'gate') {
|
||||||
|
style['color'] = '#3388ff';
|
||||||
|
} else if(this.options.attributes.type == 'mil-fighter') {
|
||||||
|
style['color'] = 'red';
|
||||||
|
} else if(this.options.attributes.type == 'mil-cargo') {
|
||||||
|
style['color'] = 'DarkRed';
|
||||||
|
} else {
|
||||||
|
style['color'] = '#3388ff';
|
||||||
|
}
|
||||||
this.setStyle(style);
|
this.setStyle(style);
|
||||||
if(this.direction) {
|
if(this.direction) {
|
||||||
this.direction.setStyle(style);
|
this.direction.setStyle(style);
|
||||||
@ -247,17 +259,17 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
},
|
},
|
||||||
setInteractive(interactive) {
|
setInteractive(interactive) {
|
||||||
if (interactive) {
|
if (interactive) {
|
||||||
if(this.direction) {
|
if(this.direction&&this.direction._path) {
|
||||||
L.DomUtil.addClass(this.direction._path, 'leaflet-interactive');
|
L.DomUtil.addClass(this.direction._path, 'leaflet-interactive');
|
||||||
}
|
}
|
||||||
if(this.box) {
|
if(this.box&&this.box._path) {
|
||||||
L.DomUtil.addClass(this.box._path, 'leaflet-interactive');
|
L.DomUtil.addClass(this.box._path, 'leaflet-interactive');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(this.direction) {
|
if(this.direction&&this.direction._path) {
|
||||||
L.DomUtil.removeClass(this.direction._path, 'leaflet-interactive');
|
L.DomUtil.removeClass(this.direction._path, 'leaflet-interactive');
|
||||||
}
|
}
|
||||||
if(this.box) {
|
if(this.box&&this.box._path) {
|
||||||
L.DomUtil.removeClass(this.box._path, 'leaflet-interactive');
|
L.DomUtil.removeClass(this.box._path, 'leaflet-interactive');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,13 +448,13 @@ var parkingSpot = function (n, layerGroup) {
|
|||||||
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
|
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
|
||||||
//console.log(latlon.decimalLatitude);
|
//console.log(latlon.decimalLatitude);
|
||||||
//console.log(convert(n.attr('lat') + " " + n.attr('lon')).decimalLongitude);
|
//console.log(convert(n.attr('lat') + " " + n.attr('lon')).decimalLongitude);
|
||||||
const circle = new L.ParkingSpot([latlon.decimalLatitude, latlon.decimalLongitude], { radius: n.attr('radius'), attributes: {} });
|
const parking = new L.ParkingSpot([latlon.decimalLatitude, latlon.decimalLongitude], { radius: n.attr('radius'), attributes: {} });
|
||||||
circle.on('editable:enable', function (event) {
|
parking.on('editable:enable', function (event) {
|
||||||
// event.target.createDirection();
|
// event.target.createDirection();
|
||||||
});
|
});
|
||||||
circle.id = n.attr('index');
|
parking.id = n.attr('index');
|
||||||
circle.glueindex = n.attr('index');
|
parking.glueindex = n.attr('index');
|
||||||
circle.feature = { properties: { searchTerm: n.attr('index') + ' ' + n.attr('name')}};
|
parking.feature = { properties: { searchTerm: n.attr('index') + ' ' + n.attr('name')}};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
<Parking index="2"
|
<Parking index="2"
|
||||||
@ -459,17 +471,18 @@ airlineCodes="VIR,KAL,DAL,KLM" />
|
|||||||
//circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) };
|
//circle.attributes = { type: n.attr('type'), name: n.attr('name'), radius: Number(n.attr('radius')), airlineCodes: n.attr('airlineCodes'), heading: Number(n.attr('heading')) };
|
||||||
|
|
||||||
$.each( n.attrs, function( key, value ) {
|
$.each( n.attrs, function( key, value ) {
|
||||||
console.debug( '$', circle.id, key , value);
|
console.debug( '$', parking.id, key , value);
|
||||||
|
|
||||||
if(isNaN(value))
|
if(isNaN(value))
|
||||||
circle.options.attributes[ key ] = value;
|
parking.options.attributes[ key ] = value;
|
||||||
else
|
else
|
||||||
circle.options.attributes[ key ] = Number( value);
|
parking.options.attributes[ key ] = Number( value);
|
||||||
});
|
});
|
||||||
circle.addListeners();
|
parking.addListeners();
|
||||||
|
|
||||||
circle.addTo(layerGroup);
|
parking.addTo(layerGroup);
|
||||||
return circle;
|
parking.deselect();
|
||||||
|
return parking;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = parkingSpot;
|
module.exports = parkingSpot;
|
Loading…
Reference in New Issue
Block a user