L.Marker.MovingMarker.zt = L.Marker.MovingMarker.extend({ initialize: function (latlngs, durations, options) { L.AngleMarker.prototype.initialize.call(this, latlngs[0], options); this._latlngs = latlngs.map(function (e, index) { return L.latLng(e); }); if (durations instanceof Array) { this._durations = durations; } else { this._durations = this._createDurations(this._latlngs, durations); } this._currentDuration = 0; this._currentIndex = 0; this._state = L.Marker.MovingMarker.notStartedState; this._startTime = 0; this._startTimeStamp = 0; // timestamp given by requestAnimFrame this._pauseStartTime = 0; this._animId = 0; this._animRequested = false; this._currentLine = []; this._stations = {}; this._gjLayer = L.layerGroup().addTo(window.map); this.circleLayer = [] this.isFollow = false }, _loadLine: function (index) { this._currentIndex = index; this._currentDuration = this._durations[index]; this._currentLine = this._latlngs.slice(index, index + 2); // this.setIcon(new L.AngleIcon({ // course: this.options.courses[index + 1], // speed: this.options.speeds[index + 1], // iconUrl: this.options.iconUrl // , label: this.options.title // , showTitle: this.options.showTitle // , labelPosition: this.options.labelPosition // })); //处理过虚拟位置不打点 // if (!(index in this.options.noRealtimeGjList)) { // var title = formatDate(this.options.collectimes[index] * 1000); // var circlePoint = L.circleMarker(this._latlngs[index], { zIndexOffset: 10, title: title, radius: 3, color: 'blue' }).addTo(this._gjLayer); // this.circleLayer.push(circlePoint) // circlePoint.attributes = this.options.gjData[index]; // circlePoint.bindPopup(this.options.markerPopup(circlePoint.attributes), { autoPan: false, closeButton: false, offset: L.point(130, 255) }); //autoPanPaddingBottomRight ,,{autoPan:false,closeButton:false,offset:L.point(120,185)} // // var url = _this._jsonUrl+"?format=json&layer="+_this.options.gjLayer+"&customsQuery="+encodeURIComponent("{\"must\":[{\"term\":{\"attributes._targetID\":\""+attr.attributes._targetID+"\"}},{\"range\":{\"attributes.collectime\":{\"lte\":"+endTime+",\"gt\":"+startTime+"}}}]}")+"&sort=collectime:asc"; // let _this = this; // circlePoint.on('mouseover', function (ev) { // if (_this.options.pupopOpenHander) { // clearTimeout(_this.options.pupopOpenHander); // } // _this.options.pupopOpenHander = setTimeout(function () { // ev.target.openPopup(); // }, 500); // if (_this.options.markerDrawJ) { // _this.options.layerGroup.removeLayer(_this.options.markerDrawJ) // } // _this.options.markerDrawJ = L.marker(ev.target.getLatLng(), { icon: new L.AngleIcon({ iconSize: new L.Point(32, 32) }) }).addTo(_this.options.layerGroup); // _this.options.markerDrawJ.options.icon.drawJ(); // }); // if (this.options.gjTimeMarker && this.options.layerGroup) { // if (this.options.gjTimeMarker[index]) { // this.options.gjTimeMarker[index].addTo(this.options.layerGroup); // } // } // } //console.log(this._latlngs); //console.log(this._currentLine); //console.log(index); // console.log(this.options.courses[index+1]); } }); L.Marker.movingMarker.zt = function (latlngs, duration, options) { return new L.Marker.MovingMarker.zt(latlngs, duration, options); };