diff --git a/dist/leaflet-ais-tracksymbol.js b/dist/leaflet-ais-tracksymbol.js index 0107582..df47bcb 100644 --- a/dist/leaflet-ais-tracksymbol.js +++ b/dist/leaflet-ais-tracksymbol.js @@ -1052,30 +1052,30 @@ L.AISTrackSymbol = L.TrackSymbol.extend({ var popupContent = L.DomUtil.create('div','ais-popup-content',content); var table = ""; - table += this._getTableRow("MSSI",this.getMmsi()); - - if(this.getName()) table += this._getTableRow("Name",this.getName()); - if(this.getImoNumber()) table += this._getTableRow("IMO",this.getImoNumber()); - if(this.getCallSign()) table += this._getTableRow("Callsign",this.getCallSign()); - if(this.getSog()) table += this._getTableRow("Speed",this.getSog()," kn" + " | " + this.getSogKmH() + " km/h "); - if(this.getCogDeg()) table += this._getTableRow("Course",this.getCogDeg(),"°"); - if(this.getTrueHeadingDeg()) table += this._getTableRow("Heading",this.getTrueHeadingDeg(),"°"); - if(this.getDestination()) table += this._getTableRow("Destination",this.getDestination()); - if(this.getEta()) table += this._getTableRow("ETA",this.getEta()); - if(this.getNavigationStatusText()) table += this._getTableRow("Nav. Status",this.getNavigationStatusText()); - if(this.getShipLength()) table += this._getTableRow("Length",this.getShipLength()," m"); - if(this.getShipWidth()) table += this._getTableRow("Width",this.getShipWidth()," m"); - if(this.getTypeOfShipText()) table += this._getTableRow("TypeOfShip",this.getTypeOfShipText()); - if(this.getMaxPresentStaticDraught()) table += this._getTableRow("Draught",this.getMaxPresentStaticDraught()," m"); - - if(this.getTypeOfDeviceText()) table += this._getTableRow("TypeOfDevice",this.getTypeOfDeviceText()); - if(this.getUTCTime()) table += this._getTableRow("Time",this.getUTCTime()); - - if(this.getTypeOfAtoNText()) table += this._getTableRow("TypeOfAtoN",this.getTypeOfAtoNText()); - if(this.getVirtualAtoNFlagText()) table += this._getTableRow("VirtualAtoN",this.getVirtualAtoNFlagText()); - if(this.getAssignedModeFlagText()) table += this._getTableRow("AssignedMode",this.getAssignedModeFlagText()); - - table += this._getTableRow("Last AIS Messsage",this.getLastUpdate()); + table += this.getTableRow("MSSI",this.getMmsi()); + + if(this.getName()) table += this.getTableRow("Name",this.getName()); + if(this.getImoNumber()) table += this.getTableRow("IMO",this.getImoNumber()); + if(this.getCallSign()) table += this.getTableRow("Callsign",this.getCallSign()); + if(this.getSog()) table += this.getTableRow("Speed",this.getSog()," kn" + " | " + this.getSogKmH() + " km/h "); + if(this.getCogDeg()) table += this.getTableRow("Course",this.getCogDeg(),"°"); + if(this.getTrueHeadingDeg()) table += this.getTableRow("Heading",this.getTrueHeadingDeg(),"°"); + if(this.getDestination()) table += this.getTableRow("Destination",this.getDestination()); + if(this.getEta()) table += this.getTableRow("ETA",this.getEta()); + if(this.getNavigationStatusText()) table += this.getTableRow("Nav. Status",this.getNavigationStatusText()); + if(this.getShipLength()) table += this.getTableRow("Length",this.getShipLength()," m"); + if(this.getShipWidth()) table += this.getTableRow("Width",this.getShipWidth()," m"); + if(this.getTypeOfShipText()) table += this.getTableRow("TypeOfShip",this.getTypeOfShipText()); + if(this.getMaxPresentStaticDraught()) table += this.getTableRow("Draught",this.getMaxPresentStaticDraught()," m"); + + if(this.getTypeOfDeviceText()) table += this.getTableRow("TypeOfDevice",this.getTypeOfDeviceText()); + if(this.getUTCTime()) table += this.getTableRow("Time",this.getUTCTime()); + + if(this.getTypeOfAtoNText()) table += this.getTableRow("TypeOfAtoN",this.getTypeOfAtoNText()); + if(this.getVirtualAtoNFlagText()) table += this.getTableRow("VirtualAtoN",this.getVirtualAtoNFlagText()); + if(this.getAssignedModeFlagText()) table += this.getTableRow("AssignedMode",this.getAssignedModeFlagText()); + + table += this.getTableRow("Last AIS Messsage",this.getLastUpdate()); table += "
"; @@ -1105,9 +1105,8 @@ L.AISTrackSymbol = L.TrackSymbol.extend({ * @param content * @param unit * @returns {*} - * @private */ - _getTableRow: function(title,content,unit){ + getTableRow: function(title,content,unit){ if(!unit) unit = ""; if(content) diff --git a/dist/leaflet-ais-tracksymbol.min.js b/dist/leaflet-ais-tracksymbol.min.js index 9fcac85..7d47297 100644 --- a/dist/leaflet-ais-tracksymbol.min.js +++ b/dist/leaflet-ais-tracksymbol.min.js @@ -1,3 +1,3 @@ -/*! leaflet-ais-tracksymbol 2016-09-15 Copyright by */ -!function(a){var b;if("function"==typeof define&&define.amd)define(["leaflet"],a);else if("undefined"!=typeof module)b=require("leaflet"),module.exports=a(b);else{if("undefined"==typeof window.L)throw new Error("Leaflet must be loaded first");a(window.L)}}(function(a){a.Map.mergeOptions({contextmenuItems:[]}),a.Map.ContextMenu=a.Handler.extend({_touchstart:a.Browser.msPointer?"MSPointerDown":a.Browser.pointer?"pointerdown":"touchstart",statics:{BASE_CLS:"leaflet-contextmenu"},initialize:function(b){a.Handler.prototype.initialize.call(this,b),this._items=[],this._visible=!1;var c=this._container=a.DomUtil.create("div",a.Map.ContextMenu.BASE_CLS,b._container);c.style.zIndex=1e4,c.style.position="absolute",b.options.contextmenuWidth&&(c.style.width=b.options.contextmenuWidth+"px"),this._createItems(),a.DomEvent.on(c,"click",a.DomEvent.stop).on(c,"mousedown",a.DomEvent.stop).on(c,"dblclick",a.DomEvent.stop).on(c,"contextmenu",a.DomEvent.stop)},addHooks:function(){var b=this._map.getContainer();a.DomEvent.on(b,"mouseleave",this._hide,this).on(document,"keydown",this._onKeyDown,this),a.Browser.touch&&a.DomEvent.on(document,this._touchstart,this._hide,this),this._map.on({contextmenu:this._show,mousedown:this._hide,movestart:this._hide,zoomstart:this._hide},this)},removeHooks:function(){var b=this._map.getContainer();a.DomEvent.off(b,"mouseleave",this._hide,this).off(document,"keydown",this._onKeyDown,this),a.Browser.touch&&a.DomEvent.off(document,this._touchstart,this._hide,this),this._map.off({contextmenu:this._show,mousedown:this._hide,movestart:this._hide,zoomstart:this._hide},this)},showAt:function(b,c){b instanceof a.LatLng&&(b=this._map.latLngToContainerPoint(b)),this._showAtPoint(b,c)},hide:function(){this._hide()},addItem:function(a){return this.insertItem(a)},insertItem:function(a,b){b=void 0!==b?b:this._items.length;var c=this._createItem(this._container,a,b);return this._items.push(c),this._sizeChanged=!0,this._map.fire("contextmenu.additem",{contextmenu:this,el:c.el,index:b}),c.el},removeItem:function(b){var c=this._container;isNaN(b)||(b=c.children[b]),b&&(this._removeItem(a.Util.stamp(b)),this._sizeChanged=!0,this._map.fire("contextmenu.removeitem",{contextmenu:this,el:b}))},removeAllItems:function(){for(var b;this._container.children.length;)b=this._container.children[0],this._removeItem(a.Util.stamp(b))},hideAllItems:function(){var a,b,c;for(b=0,c=this._items.length;b':c.iconCls&&(i=''),g.innerHTML=i+c.text,g.href="#",a.DomEvent.on(g,"mouseover",this._onItemMouseOver,this).on(g,"mouseout",this._onItemMouseOut,this).on(g,"mousedown",a.DomEvent.stopPropagation).on(g,"click",h),{id:a.Util.stamp(g),el:g,callback:h}},_removeItem:function(b){var c,d,e,f,g;for(e=0,f=this._items.length;ed.x?(e.style.left="auto",e.style.right=Math.max(d.x-b.x,0)+"px"):(e.style.left=Math.max(b.x,0)+"px",e.style.right="auto"),b.y+f.y>d.y?(e.style.top="auto",e.style.bottom=Math.max(d.y-b.y,0)+"px"):(e.style.top=Math.max(b.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(a){var b=this._size,c=a.style.display;return b&&!this._sizeChanged||(b={},a.style.left="-999999px",a.style.right="auto",a.style.display="block",b.x=a.offsetWidth,b.y=a.offsetHeight,a.style.left="auto",a.style.display=c,this._sizeChanged=!1),b},_onKeyDown:function(a){var b=a.keyCode;27===b&&this._hide()},_onItemMouseOver:function(b){a.DomUtil.addClass(b.target||b.srcElement,"over")},_onItemMouseOut:function(b){a.DomUtil.removeClass(b.target||b.srcElement,"over")}}),a.Map.addInitHook("addHandler","contextmenu",a.Map.ContextMenu),a.Mixin.ContextMenu={bindContextMenu:function(b){return a.setOptions(this,b),this._initContextMenu(),this},unbindContextMenu:function(){return this.off("contextmenu",this._showContextMenu,this),this},addContextMenuItem:function(a){this.options.contextmenuItems.push(a)},removeContextMenuItemWithIndex:function(a){for(var b=[],c=0;c";e+=this._getTableRow("MSSI",this.getMmsi()),this.getName()&&(e+=this._getTableRow("Name",this.getName())),this.getImoNumber()&&(e+=this._getTableRow("IMO",this.getImoNumber())),this.getCallSign()&&(e+=this._getTableRow("Callsign",this.getCallSign())),this.getSog()&&(e+=this._getTableRow("Speed",this.getSog()," kn | "+this.getSogKmH()+" km/h ")),this.getCogDeg()&&(e+=this._getTableRow("Course",this.getCogDeg(),"°")),this.getTrueHeadingDeg()&&(e+=this._getTableRow("Heading",this.getTrueHeadingDeg(),"°")),this.getDestination()&&(e+=this._getTableRow("Destination",this.getDestination())),this.getEta()&&(e+=this._getTableRow("ETA",this.getEta())),this.getNavigationStatusText()&&(e+=this._getTableRow("Nav. Status",this.getNavigationStatusText())),this.getShipLength()&&(e+=this._getTableRow("Length",this.getShipLength()," m")),this.getShipWidth()&&(e+=this._getTableRow("Width",this.getShipWidth()," m")),this.getTypeOfShipText()&&(e+=this._getTableRow("TypeOfShip",this.getTypeOfShipText())),this.getMaxPresentStaticDraught()&&(e+=this._getTableRow("Draught",this.getMaxPresentStaticDraught()," m")),this.getTypeOfDeviceText()&&(e+=this._getTableRow("TypeOfDevice",this.getTypeOfDeviceText())),this.getUTCTime()&&(e+=this._getTableRow("Time",this.getUTCTime())),this.getTypeOfAtoNText()&&(e+=this._getTableRow("TypeOfAtoN",this.getTypeOfAtoNText())),this.getVirtualAtoNFlagText()&&(e+=this._getTableRow("VirtualAtoN",this.getVirtualAtoNFlagText())),this.getAssignedModeFlagText()&&(e+=this._getTableRow("AssignedMode",this.getAssignedModeFlagText())),e+=this._getTableRow("Last AIS Messsage",this.getLastUpdate()),e+="",d.innerHTML=e;var f=L.DomUtil.create("div","ais-popup-footer",a);return f.innerHTML="More Details on MarineTraffic.com",a},getPopup:function(){return this._popup},openMarineTraffic:function(){var a=window.open("http://www.marinetraffic.com/en/ais/details/ships/mmsi:"+this.getMmsi(),"_blank");a.focus()},_getTableRow:function(a,b,c){return c||(c=""),b?""+a+""+b+c+"":""},_setColorByTypeOfDevice:function(){this.setColor("#61380b"),this.setFillColor("#ffffff")},_setColorByTypeOfAtoN:function(){this.setColor("#61380b"),this.setFillColor("#CEF6CE")},setNameByMMSITable:function(){"undefined"!=typeof MMSI&&MMSI[this.getMmsi()]&&this.setName(MMSI[this.getMmsi()])},_setColorsByTypeOfShip:function(){switch(this.getTypeOfShipAndCargo()){case 0:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 1:case 2:case 3:case 4:case 5:case 6:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 29:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 30:this.setColor("#800000"),this.setFillColor("#ffa07a");break;case 31:case 32:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 33:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 34:case 35:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 36:this.setColor("#8b008b"),this.setFillColor("#ff00ff");break;case 37:this.setColor("#8b008b"),this.setFillColor("#ff00ff");break;case 38:case 39:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:this.setColor("#00008b"),this.setFillColor("#ffff00");break;case 50:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 51:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 52:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 53:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 54:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 55:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 56:case 57:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 58:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 59:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 60:case 61:case 62:case 63:case 64:case 65:case 66:case 67:case 68:case 69:this.setColor("#00008b"),this.setFillColor("#0000ff");break;case 70:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 71:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 72:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 73:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 74:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 75:case 76:case 77:case 78:case 79:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 80:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 81:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 82:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 83:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 84:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 85:case 86:case 87:case 88:case 89:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;default:this.setColor("#000000"),this.setFillColor("#d3d3d3")}},getMsgId:function(){return this._msgId},setMsgId:function(a){this._msgId=a},getMmsi:function(){return this._mmsi},setMmsi:function(a){this._mmsi=a,this._leaflet_id=a},getAisVersionIndicator:function(){return this._aisVersionIndicator},setAisVersionIndicator:function(a){this._aisVersionIndicator=a},getImoNumber:function(){return this._imoNumber},setImoNumber:function(a){this._imoNumber=a},getCallSign:function(){return this._callSign},setCallSign:function(a){this._callSign=a},getName:function(){return this._name},setName:function(a){this._name=a},getTypeOfShipAndCargo:function(){return this._typeOfShipAndCargo},setTypeOfShipAndCargo:function(a){this._typeOfShipAndCargo=a,this._setColorsByTypeOfShip()},getTypeOfAtoN:function(){return this._typeOfAtoN},getTypeOfAtoNText:function(){switch(this.getTypeOfAtoN()){case 0:return"Default, Type of AtoN not specified";case 1:return"Reference point";case 2:return"RACON";case 3:return"Fixed structures off-shore";case 4:return"Emergency Wreck Marking Buoy";case 5:return"Light, without sectors";case 6:return"Light, with sectors";case 7:return"Leading Light Front";case 8:return"Leading Light Rear";case 9:return"Beacon, Cardinal N";case 10:return"Beacon, Cardinal E";case 11:return"Beacon, Cardinal S";case 12:return"Beacon, Cardinal W";case 13:return"Beacon, Port hand";case 14:return"Beacon, Starboard hand";case 15:return"Beacon, Preferred Channel port hand";case 16:return"Beacon, Preferred Channel starboard hand";case 17:return"Beacon, Isolated danger";case 18:return"Beacon, Safe water";case 19:return"Beacon, Special mark";case 20:return"Cardinal Mark N";case 21:return"Cardinal Mark E";case 22:return"Cardinal Mark S";case 23:return"Cardinal Mark W";case 24:return"Port hand Mark";case 25:return"Starboard hand Mark";case 26:return"Preferred Channel Port hand";case 27:return"Preferred Channel Starboard hand";case 28:return"Isolated danger";case 29:return"Safe Water";case 30:return"Special Mark";case 31:return"Light Vessel/LANBY/Rigs"}},setTypeOfAtoN:function(a){this._typeOfAtoN=a},getNameOfAtoN:function(){return this._nameOfAtoN},setVirtualAtoNFlag:function(a){this._virtualAtoNFlag=a},getVirtualAtoNFlag:function(){return this._virtualAtoNFlag},getVirtualAtoNFlagText:function(){switch(this.getVirtualAtoNFlag()){case 0:return"real AtoN at indicated position";case 1:return"virtual AtoN, does not physically exist"}},setAssignedModeFlag:function(a){this._assignedModeFlag=a},getAssignedModeFlag:function(){return this._assignedModeFlag},getAssignedModeFlagText:function(){switch(this.getAssignedModeFlag()){case 0:return"Station operating in autonomous and continuous mode";case 1:return"Station operating in assigned mode"}},setNameOfAtoN:function(a){this._nameOfAtoN=a},setUTCYear:function(a){this._utcYear=a},getUTCYear:function(){return this._utcYear},setUTCMonth:function(a){a>=10?this._utcMonth=a:this._utcMonth="0"+a},getUTCMonth:function(){return this._utcMonth},setUTCDay:function(a){a>=10?this._utcDay=a:this._utcDay="0"+a},getUTCDay:function(){return this._utcDay},setUTCHour:function(a){a>=10?this._utcHour=a:this._utcHour="0"+a},getUTCHour:function(){return this._utcHour},setUTCMinute:function(a){a>=10?this._utcMinute=a:this._utcMinute="0"+a},getUTCMinute:function(){return this._utcMinute},setUTCSecond:function(a){a>=10?this._utcSecond=a:this._utcSecond="0"+a},getUTCSecond:function(){return this._utcSecond},getUTCTime:function(){return"undefined"==typeof this.getUTCYear()?null:this.getUTCYear()+"."+this.getUTCMonth()+"."+this.getUTCDay()+" "+this.getUTCHour()+":"+this.getUTCMinute()+":"+this.getUTCSecond()+" UTC"},getTypeOfDevice:function(){return this._typeOfDevice},getTypeOfDeviceText:function(){switch(this.getTypeOfDevice()){case 0:return"undefined (default)";case 1:return"global positioning system (GPS)";case 2:return"GNSS (GLONASS)";case 3:return"combined GPS/GLONASS";case 4:return"Loran-C";case 5:return"Chayka";case 6:return"integrated navigation system";case 7:return"surveyed";case 8:return"Galileo";case 9:case 10:case 11:case 12:case 13:case 14:case 15:return"internal GNSS"}},setTypeOfDevice:function(a){this._typeOfDevice=a},getEta:function(){return this._eta},setEta:function(a){this._eta=a},getMaxPresentStaticDraught:function(){return this._maxPresentStaticDraught},setMaxPresentStaticDraught:function(a){this._maxPresentStaticDraught=a},getDestination:function(){return this._destination},setDestination:function(a){0===a.length&&(a=!1),this._destination=a},getDte:function(){return this._dte},setDte:function(a){this._dte=a},getNavigationStatus:function(){return this._navigationStatus},getNavigationStatusText:function(){switch(this.getNavigationStatus()){case 0:return"under way using engine";case 1:return"at anchor";case 2:return"not under command";case 3:return"restricted manoeuvrability";case 4:return"constrained by her draught";case 5:return"moored";case 6:return"aground";case 7:return"engaged in fishing";case 8:return"under way sailing";case 9:case 10:case 11:return"power-driven vessel towing astern";case 12:return"power-driven vessel pushing ahead or towing alongside";case 13:return"reserved for future use";case 14:return"AIS-SART (active)";case 15:return"undefined"}},setNavigationStatus:function(a){this._navigationStatus=a},getRot:function(){return this._rot},setRot:function(a){this._rot=a},getSogKmH:function(){var a=1.852*this._sog;return a.toFixed(1)},getSog:function(){return this._sog},setSog:function(a){this._sog=a,this.setSpeed(a)},getPositionAccuracy:function(){return this._positionAccuracy},setPositionAccuracy:function(a){this._positionAccuracy=a},getLatitude:function(){return this._latitude},setLatitude:function(a){this._latitude=parseFloat(a)},getLongitude:function(){return this._longitude},setLongitude:function(a){this._longitude=parseFloat(a),this._popup&&this._popup.setLatLng(L.latLng(this.getLatitude(),this.getLongitude())),this.updateTracksymolLabelLatLng(L.latLng(this.getLatitude(),this.getLongitude()))},getLatLng:function(){return L.latLng(this.getLatitude(),this.getLongitude())},getCog:function(){return this._cog},getCogDeg:function(){return Math.round(this.getCog()*(180/Math.PI))},setCog:function(a){this._cog=a,this.setCourse(a)},getTrueHeading:function(){return this._trueHeading},getTrueHeadingDeg:function(){return Math.round(this.getTrueHeading()*(180/Math.PI))},setTrueHeading:function(a){this._trueHeading=a,this.setHeading(a)},getTimeStamp:function(){return this._timeStamp},setTimeStamp:function(a){this._timeStamp=a},getSpecialManoeuvreIndicator:function(){return this._specialManoeuvreIndicator},setSpecialManoeuvreIndicator:function(a){this._specialManoeuvreIndicator=a},getRaimFlag:function(){return this._raimFlag},setRaimFlag:function(a){this._raimFlag=a},getCommunicationState:function(){return this._communicationState},setCommunicationState:function(a){this._communicationState=a},getReferencePositions:function(){return!!(this.getReferencePositionA()&&this.getReferencePositionB()&&this.getReferencePositionC()&&this.getReferencePositionD())&&[this.getReferencePositionA(),this.getReferencePositionB(),this.getReferencePositionC(),this.getReferencePositionD()]},getReferencePositionA:function(){return this._referencePositionA},setReferencePositionA:function(a){this._referencePositionA=a},getReferencePositionB:function(){return this._referencePositionB},setReferencePositionB:function(a){this._referencePositionB=a},getReferencePositionC:function(){return this._referencePositionC},setReferencePositionC:function(a){this._referencePositionC=a},getReferencePositionD:function(){return this._referencePositionD},setReferencePositionD:function(a){this._referencePositionD=a},getShipLength:function(){return this._referencePositionA+this._referencePositionB},getShipWidth:function(){return this._referencePositionC+this._referencePositionD},getTypeOfShipText:function(){switch(this.getTypeOfShipAndCargo()){case 0:return"NOT AVAILABLE OR NO SHIP";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:return"RESERVED";case 20:return"Wing In Grnd";case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:return"Wing In Grnd";case 30:return"Fishing";case 31:case 32:return"Tug";case 33:return"Dredger";case 34:return"Dive Vessel";case 35:return"Military Ops";case 36:return"Sailing Vessel";case 37:return"Pleasure Craft";case 38:case 39:return"RESERVED";case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:return"High-Speed Craft";case 50:return"Pilot Vessel";case 51:return"SAR";case 52:return"Tug";case 53:return"Port Tender";case 54:return"Anti-Pollution";case 55:return"Law Enforce";case 56:case 57:return"Local Vessel";case 58:return"Medical Trans";case 59:return"Special Craft";case 60:case 61:case 62:case 63:case 64:case 65:case 66:case 67:case 68:case 69:return"Passenger";case 70:return"Cargo";case 71:return"Cargo - Hazard A";case 72:return"Cargo - Hazard B";case 73:return"Cargo - Hazard C";case 74:return"Cargo - Hazard D";case 75:case 76:case 77:case 78:case 79:return"Cargo";case 80:return"Tanker";case 81:return"Tanker - Hazard A";case 82:return"Tanker - Hazard B";case 83:return"Tanker - Hazard C";case 84:return"Tanker - Hazard D";case 85:case 86:case 87:case 88:case 89:return"Tanker";case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:return"Other";default:return"Other"}},getLastUpdate:function(){return this._lastUpdate},setLastUpdate:function(){this._lastUpdate=new Date},setColor:function(a){return this.setStyle({color:a}),this.redraw()},setFillOpacity:function(a){return this.setStyle({fillOpacity:a}),this.redraw()},setOpacity:function(a){return this.setStyle({opacity:a}),this.redraw()},setWeight:function(a){return this.setStyle({weight:a}),this.redraw()},setFill:function(a){return this.setStyle({fill:a}),this.redraw()},setStroke:function(a){return this.setStyle({stroke:a}),this.redraw()},setFillColor:function(a){this.setStyle({fillColor:a})}}),L.aisTrackSymbol=function(a){return new L.AISTrackSymbol(a)},L.AISTrackSymbolLayer=L.FeatureGroup.extend({initialize:function(a){L.LayerGroup.prototype.initialize.call(this,a),this._intervalDeadObjs=setInterval(this._checkDeadObjects,1e3,this),this.setRemoveTime(10)},addAisData:function(a){var b,c=a.mmsi;this.getLayer(c)?(b=this.getLayer(c),b.addData(a)):(b=L.aisTrackSymbol({contextmenu:!0,contextmenuItems:[{text:"Details", -callback:this.showDetails,index:0},{text:"MarineTraffic.com",callback:this.openMarineTraffic,index:1},{separator:!0,index:2}]}),b.addData(a),this.addLayer(b))},openMarineTraffic:function(a){a.relatedTarget.openMarineTraffic()},showDetails:function(a){a.relatedTarget.openPopup()},_checkDeadObjects:function(a){var b=new Date;a.eachLayer(function(c){b-c.getLastUpdate()>60*a.getRemoveTime()*1e3&&a.removeLayer(c)})},searchTrack:function(a){for(var b=0;b':c.iconCls&&(i=''),g.innerHTML=i+c.text,g.href="#",a.DomEvent.on(g,"mouseover",this._onItemMouseOver,this).on(g,"mouseout",this._onItemMouseOut,this).on(g,"mousedown",a.DomEvent.stopPropagation).on(g,"click",h),{id:a.Util.stamp(g),el:g,callback:h}},_removeItem:function(b){var c,d,e,f,g;for(e=0,f=this._items.length;ed.x?(e.style.left="auto",e.style.right=Math.max(d.x-b.x,0)+"px"):(e.style.left=Math.max(b.x,0)+"px",e.style.right="auto"),b.y+f.y>d.y?(e.style.top="auto",e.style.bottom=Math.max(d.y-b.y,0)+"px"):(e.style.top=Math.max(b.y,0)+"px",e.style.bottom="auto")},_getElementSize:function(a){var b=this._size,c=a.style.display;return b&&!this._sizeChanged||(b={},a.style.left="-999999px",a.style.right="auto",a.style.display="block",b.x=a.offsetWidth,b.y=a.offsetHeight,a.style.left="auto",a.style.display=c,this._sizeChanged=!1),b},_onKeyDown:function(a){var b=a.keyCode;27===b&&this._hide()},_onItemMouseOver:function(b){a.DomUtil.addClass(b.target||b.srcElement,"over")},_onItemMouseOut:function(b){a.DomUtil.removeClass(b.target||b.srcElement,"over")}}),a.Map.addInitHook("addHandler","contextmenu",a.Map.ContextMenu),a.Mixin.ContextMenu={bindContextMenu:function(b){return a.setOptions(this,b),this._initContextMenu(),this},unbindContextMenu:function(){return this.off("contextmenu",this._showContextMenu,this),this},addContextMenuItem:function(a){this.options.contextmenuItems.push(a)},removeContextMenuItemWithIndex:function(a){for(var b=[],c=0;c";e+=this.getTableRow("MSSI",this.getMmsi()),this.getName()&&(e+=this.getTableRow("Name",this.getName())),this.getImoNumber()&&(e+=this.getTableRow("IMO",this.getImoNumber())),this.getCallSign()&&(e+=this.getTableRow("Callsign",this.getCallSign())),this.getSog()&&(e+=this.getTableRow("Speed",this.getSog()," kn | "+this.getSogKmH()+" km/h ")),this.getCogDeg()&&(e+=this.getTableRow("Course",this.getCogDeg(),"°")),this.getTrueHeadingDeg()&&(e+=this.getTableRow("Heading",this.getTrueHeadingDeg(),"°")),this.getDestination()&&(e+=this.getTableRow("Destination",this.getDestination())),this.getEta()&&(e+=this.getTableRow("ETA",this.getEta())),this.getNavigationStatusText()&&(e+=this.getTableRow("Nav. Status",this.getNavigationStatusText())),this.getShipLength()&&(e+=this.getTableRow("Length",this.getShipLength()," m")),this.getShipWidth()&&(e+=this.getTableRow("Width",this.getShipWidth()," m")),this.getTypeOfShipText()&&(e+=this.getTableRow("TypeOfShip",this.getTypeOfShipText())),this.getMaxPresentStaticDraught()&&(e+=this.getTableRow("Draught",this.getMaxPresentStaticDraught()," m")),this.getTypeOfDeviceText()&&(e+=this.getTableRow("TypeOfDevice",this.getTypeOfDeviceText())),this.getUTCTime()&&(e+=this.getTableRow("Time",this.getUTCTime())),this.getTypeOfAtoNText()&&(e+=this.getTableRow("TypeOfAtoN",this.getTypeOfAtoNText())),this.getVirtualAtoNFlagText()&&(e+=this.getTableRow("VirtualAtoN",this.getVirtualAtoNFlagText())),this.getAssignedModeFlagText()&&(e+=this.getTableRow("AssignedMode",this.getAssignedModeFlagText())),e+=this.getTableRow("Last AIS Messsage",this.getLastUpdate()),e+="",d.innerHTML=e;var f=L.DomUtil.create("div","ais-popup-footer",a);return f.innerHTML="More Details on MarineTraffic.com",a},getPopup:function(){return this._popup},openMarineTraffic:function(){var a=window.open("http://www.marinetraffic.com/en/ais/details/ships/mmsi:"+this.getMmsi(),"_blank");a.focus()},getTableRow:function(a,b,c){return c||(c=""),b?""+a+""+b+c+"":""},_setColorByTypeOfDevice:function(){this.setColor("#61380b"),this.setFillColor("#ffffff")},_setColorByTypeOfAtoN:function(){this.setColor("#61380b"),this.setFillColor("#CEF6CE")},setNameByMMSITable:function(){"undefined"!=typeof MMSI&&MMSI[this.getMmsi()]&&this.setName(MMSI[this.getMmsi()])},_setColorsByTypeOfShip:function(){switch(this.getTypeOfShipAndCargo()){case 0:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 1:case 2:case 3:case 4:case 5:case 6:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 20:case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 29:this.setColor("#000000"),this.setFillColor("#d3d3d3");break;case 30:this.setColor("#800000"),this.setFillColor("#ffa07a");break;case 31:case 32:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 33:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 34:case 35:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 36:this.setColor("#8b008b"),this.setFillColor("#ff00ff");break;case 37:this.setColor("#8b008b"),this.setFillColor("#ff00ff");break;case 38:case 39:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:this.setColor("#00008b"),this.setFillColor("#ffff00");break;case 50:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 51:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 52:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 53:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 54:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 55:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 56:case 57:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 58:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 59:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;case 60:case 61:case 62:case 63:case 64:case 65:case 66:case 67:case 68:case 69:this.setColor("#00008b"),this.setFillColor("#0000ff");break;case 70:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 71:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 72:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 73:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 74:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 75:case 76:case 77:case 78:case 79:this.setColor("#006400"),this.setFillColor("#90ee90");break;case 80:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 81:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 82:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 83:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 84:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 85:case 86:case 87:case 88:case 89:this.setColor("#8b0000"),this.setFillColor("#ff0000");break;case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:this.setColor("#008b8b"),this.setFillColor("#00ffff");break;default:this.setColor("#000000"),this.setFillColor("#d3d3d3")}},getMsgId:function(){return this._msgId},setMsgId:function(a){this._msgId=a},getMmsi:function(){return this._mmsi},setMmsi:function(a){this._mmsi=a,this._leaflet_id=a},getAisVersionIndicator:function(){return this._aisVersionIndicator},setAisVersionIndicator:function(a){this._aisVersionIndicator=a},getImoNumber:function(){return this._imoNumber},setImoNumber:function(a){this._imoNumber=a},getCallSign:function(){return this._callSign},setCallSign:function(a){this._callSign=a},getName:function(){return this._name},setName:function(a){this._name=a},getTypeOfShipAndCargo:function(){return this._typeOfShipAndCargo},setTypeOfShipAndCargo:function(a){this._typeOfShipAndCargo=a,this._setColorsByTypeOfShip()},getTypeOfAtoN:function(){return this._typeOfAtoN},getTypeOfAtoNText:function(){switch(this.getTypeOfAtoN()){case 0:return"Default, Type of AtoN not specified";case 1:return"Reference point";case 2:return"RACON";case 3:return"Fixed structures off-shore";case 4:return"Emergency Wreck Marking Buoy";case 5:return"Light, without sectors";case 6:return"Light, with sectors";case 7:return"Leading Light Front";case 8:return"Leading Light Rear";case 9:return"Beacon, Cardinal N";case 10:return"Beacon, Cardinal E";case 11:return"Beacon, Cardinal S";case 12:return"Beacon, Cardinal W";case 13:return"Beacon, Port hand";case 14:return"Beacon, Starboard hand";case 15:return"Beacon, Preferred Channel port hand";case 16:return"Beacon, Preferred Channel starboard hand";case 17:return"Beacon, Isolated danger";case 18:return"Beacon, Safe water";case 19:return"Beacon, Special mark";case 20:return"Cardinal Mark N";case 21:return"Cardinal Mark E";case 22:return"Cardinal Mark S";case 23:return"Cardinal Mark W";case 24:return"Port hand Mark";case 25:return"Starboard hand Mark";case 26:return"Preferred Channel Port hand";case 27:return"Preferred Channel Starboard hand";case 28:return"Isolated danger";case 29:return"Safe Water";case 30:return"Special Mark";case 31:return"Light Vessel/LANBY/Rigs"}},setTypeOfAtoN:function(a){this._typeOfAtoN=a},getNameOfAtoN:function(){return this._nameOfAtoN},setVirtualAtoNFlag:function(a){this._virtualAtoNFlag=a},getVirtualAtoNFlag:function(){return this._virtualAtoNFlag},getVirtualAtoNFlagText:function(){switch(this.getVirtualAtoNFlag()){case 0:return"real AtoN at indicated position";case 1:return"virtual AtoN, does not physically exist"}},setAssignedModeFlag:function(a){this._assignedModeFlag=a},getAssignedModeFlag:function(){return this._assignedModeFlag},getAssignedModeFlagText:function(){switch(this.getAssignedModeFlag()){case 0:return"Station operating in autonomous and continuous mode";case 1:return"Station operating in assigned mode"}},setNameOfAtoN:function(a){this._nameOfAtoN=a},setUTCYear:function(a){this._utcYear=a},getUTCYear:function(){return this._utcYear},setUTCMonth:function(a){a>=10?this._utcMonth=a:this._utcMonth="0"+a},getUTCMonth:function(){return this._utcMonth},setUTCDay:function(a){a>=10?this._utcDay=a:this._utcDay="0"+a},getUTCDay:function(){return this._utcDay},setUTCHour:function(a){a>=10?this._utcHour=a:this._utcHour="0"+a},getUTCHour:function(){return this._utcHour},setUTCMinute:function(a){a>=10?this._utcMinute=a:this._utcMinute="0"+a},getUTCMinute:function(){return this._utcMinute},setUTCSecond:function(a){a>=10?this._utcSecond=a:this._utcSecond="0"+a},getUTCSecond:function(){return this._utcSecond},getUTCTime:function(){return"undefined"==typeof this.getUTCYear()?null:this.getUTCYear()+"."+this.getUTCMonth()+"."+this.getUTCDay()+" "+this.getUTCHour()+":"+this.getUTCMinute()+":"+this.getUTCSecond()+" UTC"},getTypeOfDevice:function(){return this._typeOfDevice},getTypeOfDeviceText:function(){switch(this.getTypeOfDevice()){case 0:return"undefined (default)";case 1:return"global positioning system (GPS)";case 2:return"GNSS (GLONASS)";case 3:return"combined GPS/GLONASS";case 4:return"Loran-C";case 5:return"Chayka";case 6:return"integrated navigation system";case 7:return"surveyed";case 8:return"Galileo";case 9:case 10:case 11:case 12:case 13:case 14:case 15:return"internal GNSS"}},setTypeOfDevice:function(a){this._typeOfDevice=a},getEta:function(){return this._eta},setEta:function(a){this._eta=a},getMaxPresentStaticDraught:function(){return this._maxPresentStaticDraught},setMaxPresentStaticDraught:function(a){this._maxPresentStaticDraught=a},getDestination:function(){return this._destination},setDestination:function(a){0===a.length&&(a=!1),this._destination=a},getDte:function(){return this._dte},setDte:function(a){this._dte=a},getNavigationStatus:function(){return this._navigationStatus},getNavigationStatusText:function(){switch(this.getNavigationStatus()){case 0:return"under way using engine";case 1:return"at anchor";case 2:return"not under command";case 3:return"restricted manoeuvrability";case 4:return"constrained by her draught";case 5:return"moored";case 6:return"aground";case 7:return"engaged in fishing";case 8:return"under way sailing";case 9:case 10:case 11:return"power-driven vessel towing astern";case 12:return"power-driven vessel pushing ahead or towing alongside";case 13:return"reserved for future use";case 14:return"AIS-SART (active)";case 15:return"undefined"}},setNavigationStatus:function(a){this._navigationStatus=a},getRot:function(){return this._rot},setRot:function(a){this._rot=a},getSogKmH:function(){var a=1.852*this._sog;return a.toFixed(1)},getSog:function(){return this._sog},setSog:function(a){this._sog=a,this.setSpeed(a)},getPositionAccuracy:function(){return this._positionAccuracy},setPositionAccuracy:function(a){this._positionAccuracy=a},getLatitude:function(){return this._latitude},setLatitude:function(a){this._latitude=parseFloat(a)},getLongitude:function(){return this._longitude},setLongitude:function(a){this._longitude=parseFloat(a),this._popup&&this._popup.setLatLng(L.latLng(this.getLatitude(),this.getLongitude())),this.updateTracksymolLabelLatLng(L.latLng(this.getLatitude(),this.getLongitude()))},getLatLng:function(){return L.latLng(this.getLatitude(),this.getLongitude())},getCog:function(){return this._cog},getCogDeg:function(){return Math.round(this.getCog()*(180/Math.PI))},setCog:function(a){this._cog=a,this.setCourse(a)},getTrueHeading:function(){return this._trueHeading},getTrueHeadingDeg:function(){return Math.round(this.getTrueHeading()*(180/Math.PI))},setTrueHeading:function(a){this._trueHeading=a,this.setHeading(a)},getTimeStamp:function(){return this._timeStamp},setTimeStamp:function(a){this._timeStamp=a},getSpecialManoeuvreIndicator:function(){return this._specialManoeuvreIndicator},setSpecialManoeuvreIndicator:function(a){this._specialManoeuvreIndicator=a},getRaimFlag:function(){return this._raimFlag},setRaimFlag:function(a){this._raimFlag=a},getCommunicationState:function(){return this._communicationState},setCommunicationState:function(a){this._communicationState=a},getReferencePositions:function(){return!!(this.getReferencePositionA()&&this.getReferencePositionB()&&this.getReferencePositionC()&&this.getReferencePositionD())&&[this.getReferencePositionA(),this.getReferencePositionB(),this.getReferencePositionC(),this.getReferencePositionD()]},getReferencePositionA:function(){return this._referencePositionA},setReferencePositionA:function(a){this._referencePositionA=a},getReferencePositionB:function(){return this._referencePositionB},setReferencePositionB:function(a){this._referencePositionB=a},getReferencePositionC:function(){return this._referencePositionC},setReferencePositionC:function(a){this._referencePositionC=a},getReferencePositionD:function(){return this._referencePositionD},setReferencePositionD:function(a){this._referencePositionD=a},getShipLength:function(){return this._referencePositionA+this._referencePositionB},getShipWidth:function(){return this._referencePositionC+this._referencePositionD},getTypeOfShipText:function(){switch(this.getTypeOfShipAndCargo()){case 0:return"NOT AVAILABLE OR NO SHIP";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:return"RESERVED";case 20:return"Wing In Grnd";case 21:case 22:case 23:case 24:case 25:case 26:case 27:case 28:case 29:return"Wing In Grnd";case 30:return"Fishing";case 31:case 32:return"Tug";case 33:return"Dredger";case 34:return"Dive Vessel";case 35:return"Military Ops";case 36:return"Sailing Vessel";case 37:return"Pleasure Craft";case 38:case 39:return"RESERVED";case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 48:case 49:return"High-Speed Craft";case 50:return"Pilot Vessel";case 51:return"SAR";case 52:return"Tug";case 53:return"Port Tender";case 54:return"Anti-Pollution";case 55:return"Law Enforce";case 56:case 57:return"Local Vessel";case 58:return"Medical Trans";case 59:return"Special Craft";case 60:case 61:case 62:case 63:case 64:case 65:case 66:case 67:case 68:case 69:return"Passenger";case 70:return"Cargo";case 71:return"Cargo - Hazard A";case 72:return"Cargo - Hazard B";case 73:return"Cargo - Hazard C";case 74:return"Cargo - Hazard D";case 75:case 76:case 77:case 78:case 79:return"Cargo";case 80:return"Tanker";case 81:return"Tanker - Hazard A";case 82:return"Tanker - Hazard B";case 83:return"Tanker - Hazard C";case 84:return"Tanker - Hazard D";case 85:case 86:case 87:case 88:case 89:return"Tanker";case 90:case 91:case 92:case 93:case 94:case 95:case 96:case 97:case 98:case 99:return"Other";default:return"Other"}},getLastUpdate:function(){return this._lastUpdate},setLastUpdate:function(){this._lastUpdate=new Date},setColor:function(a){return this.setStyle({color:a}),this.redraw()},setFillOpacity:function(a){return this.setStyle({fillOpacity:a}),this.redraw()},setOpacity:function(a){return this.setStyle({opacity:a}),this.redraw()},setWeight:function(a){return this.setStyle({weight:a}),this.redraw()},setFill:function(a){return this.setStyle({fill:a}),this.redraw()},setStroke:function(a){return this.setStyle({stroke:a}),this.redraw()},setFillColor:function(a){this.setStyle({fillColor:a})}}),L.aisTrackSymbol=function(a){return new L.AISTrackSymbol(a)},L.AISTrackSymbolLayer=L.FeatureGroup.extend({initialize:function(a){L.LayerGroup.prototype.initialize.call(this,a),this._intervalDeadObjs=setInterval(this._checkDeadObjects,1e3,this),this.setRemoveTime(10)},addAisData:function(a){var b,c=a.mmsi;this.getLayer(c)?(b=this.getLayer(c),b.addData(a)):(b=L.aisTrackSymbol({contextmenu:!0,contextmenuItems:[{text:"Details",callback:this.showDetails, +index:0},{text:"MarineTraffic.com",callback:this.openMarineTraffic,index:1},{separator:!0,index:2}]}),b.addData(a),this.addLayer(b))},openMarineTraffic:function(a){a.relatedTarget.openMarineTraffic()},showDetails:function(a){a.relatedTarget.openPopup()},_checkDeadObjects:function(a){var b=new Date;a.eachLayer(function(c){b-c.getLastUpdate()>60*a.getRemoveTime()*1e3&&a.removeLayer(c)})},searchTrack:function(a){for(var b=0;b