UNPKG

node-red-contrib-web-worldmap

Version:

A Node-RED node to provide a web page of a world map for plotting things on.

27 lines 779 kB
/**! * @license * The MIT License (MIT) * * Copyright (c) 2017 Måns Beckman - www.spatialillusions.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * More information can be found at www.spatialillusions.com */ !function(I,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("milsymbol",t):I.ms=t()}(this,function(){"use strict";var t={Black:{Civilian:"black",Friend:"black",Hostile:"black",Neutral:"black",Unknown:"black"},Dark:{Civilian:"rgb(80,0,80)",Friend:"rgb(0,107,140)",Hostile:"rgb(200,0,0)",Neutral:"rgb(0,160,0)",Unknown:"rgb(225,220,0)"},FrameColor:{Civilian:"rgb(255,0,255)",Friend:"rgb(0, 255, 255)",Hostile:"rgb(255, 0, 0)",Neutral:"rgb(0, 255, 0)",Unknown:"rgb(255, 255, 0)"},IconColor:{Civilian:"rgb(255,0,255)",Friend:"rgb(0, 255, 255)",Hostile:"rgb(255, 0, 0)",Neutral:"rgb(0, 255, 0)",Unknown:"rgb(255, 255, 0)"},Light:{Civilian:"rgb(255,161,255)",Friend:"rgb(128,224,255)",Hostile:"rgb(255,128,128)",Neutral:"rgb(170,255,170)",Unknown:"rgb(255,255,128)"},Medium:{Civilian:"rgb(128,0,128)",Friend:"rgb(0,168,220)",Hostile:"rgb(255,48,49)",Neutral:"rgb(0,226,110)",Unknown:"rgb(255,255,0)"},None:{Civilian:!1,Friend:!1,Hostile:!1,Neutral:!1,Unknown:!1},OffWhite:{Civilian:"rgb(239, 239, 239)",Friend:"rgb(239, 239, 239)",Hostile:"rgb(239, 239, 239)",Neutral:"rgb(239, 239, 239)",Unknown:"rgb(239, 239, 239)"},White:{Civilian:"white",Friend:"white",Hostile:"white",Neutral:"white",Unknown:"white"}};function E(I){var t,E=[],R=[],e=this.colors.frameColor[this.metadata.affiliation];if(!this.metadata.frame&&this.style.icon||void 0===this.metadata.baseGeometry.g.type)return{pre:E,post:R,bbox:this.metadata.baseGeometry.bbox};var A,C={type:this.metadata.baseGeometry.g.type};switch(C.type){case"path":C.d=this.metadata.baseGeometry.g.d;break;case"circle":C.cx=this.metadata.baseGeometry.g.cx,C.cy=this.metadata.baseGeometry.g.cy,C.r=this.metadata.baseGeometry.g.r}(C.fill=this.colors.fillColor[this.metadata.affiliation],C.fillopacity=this.style.fillOpacity,C.stroke=e,C.strokewidth=10<=this.style.size?this.style.strokeWidth:10,this.style.frame&&0<this.style.outlineWidth)&&("path"==C.type&&this.metadata.fill&&!this.style.monoColor?((A={type:this.metadata.baseGeometry.g.type}).d=this.metadata.baseGeometry.g.d+" Z",A.strokewidth=10<=this.style.size?this.style.strokeWidth:10):A=C,E.push(I.outline(A,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)));if(""==this.style.monoColor&&this.style.fill||!this.metadata.notpresent||(C.strokedasharray=this.metadata.notpresent),R.push(C),this.metadata.space&&(t={Friend:{type:"path",stroke:!1,fill:e,d:"M 100,30 C 90,30 80,35 68.65625,50 l 62.6875,0 C 120,35 110,30 100,30"},Hostile:{type:"path",stroke:!1,fill:e,d:"M67,50 L100,20 133,50 z"},Neutral:{type:"path",stroke:!1,fill:e,d:"M45,50 l0,-20 110,0 0,20 z"},Unknown:{type:"path",stroke:!1,fill:e,d:"M 100 22.5 C 85 22.5 70 31.669211 66 50 L 134 50 C 130 31.669204 115 22.5 100 22.5 z"}},R.push(t[this.metadata.affiliation])),this.metadata.activity&&(t={Friend:{type:"path",stroke:!1,fill:e,d:"m 160,135 0,15 15,0 0,-15 z m -135,0 15,0 0,15 -15,0 z m 135,-85 0,15 15,0 0,-15 z m -135,0 15,0 0,15 -15,0 z"},Hostile:{type:"path",stroke:!1,fill:e,d:"M 100 28 L 89.40625 38.59375 L 100 49.21875 L 110.59375 38.59375 L 100 28 z M 38.6875 89.3125 L 28.0625 99.9375 L 38.6875 110.53125 L 49.28125 99.9375 L 38.6875 89.3125 z M 161.40625 89.40625 L 150.78125 100 L 161.40625 110.59375 L 172 100 L 161.40625 89.40625 z M 99.9375 150.71875 L 89.3125 161.3125 L 99.9375 171.9375 L 110.53125 161.3125 L 99.9375 150.71875"},Neutral:{type:"path",stroke:!1,fill:e,d:"m 140,140 15,0 0,15 -15,0 z m -80,0 0,15 -15,0 0,-15 z m 80,-80 0,-15 15,0 0,15 z m -80,0 -15,0 0,-15 15,0 z"},Unknown:{type:"path",stroke:!1,fill:e,d:"M 107.96875 31.46875 L 92.03125 31.71875 L 92.03125 46.4375 L 107.71875 46.4375 L 107.96875 31.46875 z M 47.03125 92.5 L 31.09375 92.75 L 31.09375 107.5 L 46.78125 107.5 L 47.03125 92.5 z M 168.4375 92.5 L 152.5 92.75 L 152.5 107.5 L 168.1875 107.5 L 168.4375 92.5 z M 107.96875 153.5625 L 92.03125 153.8125 L 92.03125 168.53125 L 107.71875 168.53125 L 107.96875 153.5625 z"}},R.push(t[this.metadata.affiliation])),this.metadata.cyberspace&&(t={Friend:{type:"path",stroke:!1,fill:e,d:"m 135,150 40,-40 0,40 z"},Hostile:{type:"path",stroke:!1,fill:e,d:"m 150,78 0,44 22,-22 z"},Neutral:{type:"path",stroke:!1,fill:e,d:"m 115,155 40,-40 0,40 z"},Unknown:{type:"path",stroke:!1,fill:e,d:"M 150 65.7 L 150 134 C 176 123 176 77.2 150 65.7 z"}},R.push(t[this.metadata.affiliation])),this.style.fill&&this.style.frame&&this.metadata.notpresent&&!this.metadata.unframed){switch((C={type:this.metadata.baseGeometry.g.type}).type){case"path":C.d=this.metadata.baseGeometry.g.d;break;case"circle":C.cx=this.metadata.baseGeometry.g.cx,C.cy=this.metadata.baseGeometry.g.cy,C.r=this.metadata.baseGeometry.g.r}C.fill=!1,C.stroke=this.colors.white[this.metadata.affiliation],C.strokewidth=parseFloat(this.style.strokeWidth)+1,C.strokedasharray=this.metadata.notpresent,R.push(C)}return{pre:E,post:R,bbox:this.metadata.baseGeometry.bbox}}function R(I){var t,E,R=[],e=[],A=new I.BBox({x1:50,x2:150,y1:50,y2:150}),C=[],T=[],S=[],N=[];if(this.style.icon){var O=this.colors.fillColor[this.metadata.affiliation],G=this.colors.fillColor.Neutral;E=this.colors.iconColor[this.metadata.affiliation];var o=this.colors.iconFillColor[this.metadata.affiliation],M=this.colors.none[this.metadata.affiliation],i=this.colors.black[this.metadata.affiliation],L=this.colors.white[this.metadata.affiliation],s=(this.metadata.STD2525?"2525":"APP6")+","+this.metadata.dimension+this.metadata.affiliation+this.metadata.notpresent+this.metadata.numberSIDC+",frame:"+this.style.frame+",alternateMedal:"+this.style.alternateMedal+",colors:{fillcolor:"+O+",neutralColor"+G+",iconColor:"+E+",iconFillColor:"+o+",none:"+M+",black:"+i+",white:"+L+"}";if(C=I._iconCache.hasOwnProperty(s)?I._iconCache[s].iconParts:(I._iconCache[s]={},I._iconCache[s].iconParts=I._getIconParts(this.metadata,this.colors,this.metadata.STD2525,this.style.monoColor,this.style.alternateMedal)),this.metadata.numberSIDC||(-1!=["WMGX--","WMMX--","WMFX--","WMX---","WMSX--"].indexOf(this.metadata.functionid)&&(A.y1=10,"Unknown"!=this.metadata.affiliation&&(A.x2=this.metadata.baseGeometry.bbox.x2+20)),I._iconCache[s].hasOwnProperty("letterSIDC")?(t=I._iconCache[s].letterSIDC.icons,N=I._iconCache[s].letterSIDC.bbox):"function"==typeof I._getIcons.letter?(I._iconCache[s].letterSIDC=I._getIcons.letter(I,C,this.metadata.STD2525),t=I._iconCache[s].letterSIDC.icons,N=I._iconCache[s].letterSIDC.bbox):console.warn("ms._getIcons.letter() is not present, you will need to load functionality for letter based SIDCs")),this.metadata.numberSIDC){var n=String(this.options.sidc).substr(4,2);I._iconCache[s].hasOwnProperty("numberSIDC")?I._iconCache[s].numberSIDC.symbolSet.hasOwnProperty(n)?(t=I._iconCache[s].numberSIDC.symbolSet[n].icons,T=I._iconCache[s].numberSIDC.symbolSet[n].m1,S=I._iconCache[s].numberSIDC.symbolSet[n].m2,N=I._iconCache[s].numberSIDC.symbolSet[n].bbox):"function"==typeof I._getIcons.number?(I._iconCache[s].numberSIDC.symbolSet[n]=I._getIcons.number(I,n,C,this.metadata.STD2525),t=I._iconCache[s].numberSIDC.symbolSet[n].icons,T=I._iconCache[s].numberSIDC.symbolSet[n].m1,S=I._iconCache[s].numberSIDC.symbolSet[n].m2,N=I._iconCache[s].numberSIDC.symbolSet[n].bbox):console.warn("ms._getIcons.number() is not present, you will need to load functionality for number based SIDCs"):(I._iconCache[s].numberSIDC={},I._iconCache[s].numberSIDC.symbolSet={},"function"==typeof I._getIcons.number?(I._iconCache[s].numberSIDC.symbolSet[n]=I._getIcons.number(I,n,C,this.metadata.STD2525),t=I._iconCache[s].numberSIDC.symbolSet[n].icons,T=I._iconCache[s].numberSIDC.symbolSet[n].m1,S=I._iconCache[s].numberSIDC.symbolSet[n].m2,N=I._iconCache[s].numberSIDC.symbolSet[n].bbox):console.warn("ms._getIcons.number() is not present, you will need to load functionality for number based SIDCs"))}var a=[{type:"path",stroke:!1,fill:E=this.colors.iconColor[this.metadata.affiliation],d:"m 94.8206,78.1372 c -0.4542,6.8983 0.6532,14.323 5.3424,19.6985 4.509,5.6933 11.309,9.3573 14.98,15.7283 3.164,6.353 -0.09,14.245 -5.903,17.822 -7.268,4.817 -18.6219,2.785 -22.7328,-5.249 -1.5511,-2.796 -2.3828,-5.931 -2.8815,-9.071 -3.5048,0.416 -7.0093,0.835 -10.5142,1.252 0.8239,8.555 5.2263,17.287 13.2544,21.111 7.8232,3.736 17.1891,3.783 25.3291,1.052 8.846,-3.103 15.737,-11.958 15.171,-21.537 0.05,-6.951 -4.272,-12.85 -9.134,-17.403 -4.526,-4.6949 -11.048,-8.3862 -12.401,-15.2748 -1.215,-2.3639 -0.889,-8.129 -0.889,-8.129 z m -0.6253,-20.5177 0,11.6509 11.6527,0 0,-11.6509 z"}];if(this.metadata.numberSIDC){var l=t[this.metadata.functionid.substr(0,6)];if(void 0===l&&95<=this.metadata.functionid.substr(4,2)&&(l=t[this.metadata.functionid.substr(0,4)+"00"]),void 0===l)"000000"!=this.metadata.functionid.substr(0,6)&&""!=this.metadata.functionid.substr(0,6)&&(e.push(a),this.validIcon=!1);else{var r=Number(this.metadata.functionid.substr(0,6));this.metadata.dismounted&&110301<=r&&r<=110403&&("00"!=this.metadata.functionid.substr(6,2)&&"00"!=this.metadata.functionid.substr(8,2)&&(l=[I._scale(.5,l)]),"00"==this.metadata.functionid.substr(6,2)&&"00"!=this.metadata.functionid.substr(8,2)&&(l=[I._translate(0,-10,I._scale(.7,l))]),"00"!=this.metadata.functionid.substr(6,2)&&"00"==this.metadata.functionid.substr(8,2)&&(l=[I._translate(0,10,I._scale(.7,l))])),e.push(l)}if(N.hasOwnProperty(this.metadata.functionid.substr(0,6))&&(A=new I.BBox(N[this.metadata.functionid.substr(0,6)])),"95"==this.metadata.functionid.substr(4,2)&&e.push(C["GR.IC.FF.HEADQUARTERS OR HEADQUARTERS ELEMENT"]),"96"==this.metadata.functionid.substr(4,2)&&e.push(C["GR.IC.FF.DIVISION AND BELOW SUPPORT"]),"97"==this.metadata.functionid.substr(4,2)&&e.push(C["GR.IC.FF.CORPS SUPPORT"]),"98"==this.metadata.functionid.substr(4,2)&&e.push(C["GR.IC.FF.THEATRE SUPPORT"]),"00"!=this.metadata.functionid.substr(6,2)){var P=T[this.metadata.functionid.substr(6,2)];void 0===P?this.validIcon=!1:e.push(P)}if("00"!=this.metadata.functionid.substr(8,2)){var y=S[this.metadata.functionid.substr(8,2)];void 0===y?this.validIcon=!1:e.push(y)}}else{var c=this.options.sidc.substr(0,1)+"-"+this.options.sidc.substr(2,1)+"-"+this.options.sidc.substr(4,6);t.hasOwnProperty(c)?e.push(t[c]):"------"!=this.options.sidc.substr(4,6)&&""!=this.options.sidc.substr(4,6)&&(e.push(a),this.validIcon=!1),N[c]&&(A=new I.BBox(N[c]))}}return this.style.frame&&this.metadata.fill&&!this.style.monoColor&&!this.metadata.controlMeasure||0<this.style.outlineWidth&&R.push(I.outline(e,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),{pre:R,post:e,bbox:A}}function e(I){var t,E=[],R=[],e=new I.BBox(this.metadata.baseGeometry.bbox),A=this.style.frameColor?this.style.frameColor[this.metadata.affiliation]:this.colors.iconColor[this.metadata.affiliation],C=new I.BBox,T=Number(this.style.hqStaffLength||I._hqStaffLength);if(this.metadata.headquarters&&0<T){var S=100;-1<["AirFriend","AirNeutral","GroundFriend","GroundNeutral","SeaNeutral","SubsurfaceNeutral"].indexOf(this.metadata.dimension+this.metadata.affiliation)&&(S=e.y2),this.metadata.dimensionType+this.metadata.affiliationType=="SubsurfaceFriend"&&(S=e.y1),t={type:"path",d:"M"+e.x1+","+S+" L"+e.x1+","+(e.y2+T)},0<this.style.outlineWidth&&E.push(I.outline(t,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),R.push(t),C.y2=e.y2+T}if(this.metadata.taskForce){var N={"Corps/MEF":110,Army:145,"Army Group/front":180,"Region/Theater":215};t={type:"path",d:"M"+(100-(N=N[this.metadata.echelon]||90)/2)+","+e.y1+" L"+(100-N/2)+","+(e.y1-40)+" "+(100+N/2)+","+(e.y1-40)+" "+(100+N/2)+","+e.y1},0<this.style.outlineWidth&&E.push(I.outline(t,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),R.push(t),C.x1=Math.min(e.x1,100-N/2),C.x2=Math.max(e.x2,100+N/2),C.y1=e.y1-40}if(this.metadata.installation){var O=0;-1<["AirHostile","GroundHostile","SeaHostile"].indexOf(this.metadata.dimension+this.metadata.affiliation)&&(O=14),-1<["AirUnknown","GroundUnknown","SeaUnknown","AirFriend","SeaFriend"].indexOf(this.metadata.dimension+this.metadata.affiliation)&&(O=2),t={type:"path",fill:A,d:"M85,"+(e.y1+O-this.style.strokeWidth/2)+" 85,"+(e.y1-10)+" 115,"+(e.y1-10)+" 115,"+(e.y1+O-this.style.strokeWidth/2)+" 100,"+(e.y1-this.style.strokeWidth)+" Z"},0<this.style.outlineWidth&&E.push(I.outline(t,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),R.push(t),C.merge({y1:e.y1-10})}if(this.metadata.feintDummy){var G=e.y1-0-e.width()/2;t={type:"path",strokedasharray:I._dashArrays.feintDummy,d:"M100,"+G+" L"+e.x1+","+(e.y1-0)+" M100,"+G+" L"+e.x2+","+(e.y1-0)},0<this.style.outlineWidth&&E.push(I.outline(t,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),R.push(t),C.merge({y1:G})}if(this.metadata.echelon){var o=this.metadata.installation?15:0,M={"Team/Crew":{g:[{type:"circle",cx:100,cy:e.y1-20,r:15},{type:"path",d:"M80,"+(e.y1-10)+"L120,"+(e.y1-30)}],bbox:{y1:e.y1-40-o}},Squad:{g:[{type:"circle",fill:A,cx:100,cy:e.y1-20,r:7.5}],bbox:{y1:e.y1-20-7.5-o}},Section:{g:[{type:"circle",fill:A,cx:115,cy:e.y1-20,r:7.5},{type:"circle",fill:A,cx:85,cy:e.y1-20,r:7.5}],bbox:{y1:e.y1-20-7.5-o}},"Platoon/detachment":{g:[{type:"circle",fill:A,cx:100,cy:e.y1-20,r:7.5},{type:"circle",fill:A,cx:70,cy:e.y1-20,r:7.5},{type:"circle",fill:A,cx:130,cy:e.y1-20,r:7.5}],bbox:{y1:e.y1-20-7.5-o}},"Company/battery/troop":{g:[{type:"path",d:"M100,"+(e.y1-10)+"L100,"+(e.y1-35)}],bbox:{y1:e.y1-40-o}},"Battalion/squadron":{g:[{type:"path",d:"M90,"+(e.y1-10)+"L90,"+(e.y1-35)},{type:"path",d:"M110,"+(e.y1-10)+"L110,"+(e.y1-35)}],bbox:{y1:e.y1-40-o}},"Regiment/group":{g:[{type:"path",d:"M100,"+(e.y1-10)+"L100,"+(e.y1-35)},{type:"path",d:"M120,"+(e.y1-10)+"L120,"+(e.y1-35)},{type:"path",d:"M80,"+(e.y1-10)+"L80,"+(e.y1-35)}],bbox:{y1:e.y1-40-o}},Brigade:{g:[{type:"path",d:"M87.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25"}],bbox:{y1:e.y1-15-25-o}},Division:{g:[{type:"path",d:"M70,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M105,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25"}],bbox:{y1:e.y1-15-25-o,x1:70,x2:130}},"Corps/MEF":{g:[{type:"path",d:"M52.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M87.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M122.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25"}],bbox:{y1:e.y1-15-25-o,x1:52.5,x2:147.5}},Army:{g:[{type:"path",d:"M35,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M70,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M105,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M140,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25"}],bbox:{y1:e.y1-15-25-o,x1:35,x2:165}},"Army Group/front":{g:[{type:"path",d:"M17.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M52.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M87.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M122.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M157.5,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25"}],bbox:{y1:e.y1-15-25-o,x1:17.5,x2:182.5}},"Region/Theater":{g:[{type:"path",d:"M0,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M35,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M70,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M105,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M140,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25 M175,"+(e.y1-10)+" l25,-25 m0,25 l-25,-25"}],bbox:{y1:e.y1-15-25-o,x1:0,x2:200}},Command:{g:[{type:"path",d:"M70,"+(e.y1-22.5)+" l25,0 m-12.5,12.5 l0,-25 M105,"+(e.y1-22.5)+" l25,0 m-12.5,12.5 l0,-25"}],bbox:{y1:e.y1-15-25-o,x1:70,x2:130}}};M.hasOwnProperty(this.metadata.echelon)&&(t=M[this.metadata.echelon].g,0<this.style.outlineWidth&&E.push(I.outline({type:"translate",x:0,y:-o,draw:t},this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),R.push({type:"translate",x:0,y:-o,draw:t}),C.merge(M[this.metadata.echelon].bbox))}if(this.metadata.mobility){this.style.frame||(e.y2=this.bbox.y2),"Neutral"==this.metadata.affiliation&&("Towed"!=this.metadata.mobility&&"Short towed array"!=this.metadata.mobility&&"Long towed Array"!=this.metadata.mobility||(e.y2+=8),"Over snow (prime mover)"!=this.metadata.mobility&&"Sled"!=this.metadata.mobility||(e.y2+=13));var i={"Wheeled limited cross country":{g:[{type:"path",d:"M 53,1 l 94,0"},{type:"circle",cx:58,cy:8,r:8},{type:"circle",cx:142,cy:8,r:8}],bbox:{y2:e.y2+16}},"Wheeled cross country":{g:[{type:"path",d:"M 53,1 l 94,0"},{type:"circle",cx:58,cy:8,r:8},{type:"circle",cx:142,cy:8,r:8},{type:"circle",cx:100,cy:8,r:8}],bbox:{y2:e.y2+16}},Tracked:{g:[{type:"path",d:"M 53,1 l 100,0 c15,0 15,15 0,15 l -100,0 c-15,0 -15,-15 0,-15"}],bbox:{y2:e.y2+18,x1:42,x2:168}},"Wheeled and tracked combination":{g:[{type:"circle",cx:58,cy:8,r:8},{type:"path",d:"M 83,1 l 70,0 c15,0 15,15 0,15 l -70,0 c-15,0 -15,-15 0,-15"}],bbox:{y2:e.y2+16,x2:168}},Towed:{g:[{type:"path",d:"M 63,1 l 74,0"},{type:"circle",cx:58,cy:3,r:8},{type:"circle",cx:142,cy:3,r:8}],bbox:{y2:e.y2+10}},Rail:{g:[{type:"path",d:"M 53,1 l 96,0"},{type:"circle",cx:58,cy:8,r:8},{type:"circle",cx:73,cy:8,r:8},{type:"circle",cx:127,cy:8,r:8},{type:"circle",cx:142,cy:8,r:8}],bbox:{y2:e.y2+16}},"Over snow (prime mover)":{g:[{type:"path",d:"M 50,-9 l10,10 90,0"}],bbox:{y2:e.y2+9}},Sled:{g:[{type:"path",d:"M 145,-12 c15,0 15,15 0,15 l -90,0 c-15,0 -15,-15 0,-15"}],bbox:{y2:e.y2+15,x1:42,x2:168}},"Pack animals":{g:[{type:"path",d:"M 80,20 l 10,-20 10,20 10,-20 10,20"}],bbox:{y2:e.y2+20}},Barge:{g:[{type:"path",d:"M 50,1 l 100,0 c0,10 -100,10 -100,0"}],bbox:{y2:e.y2+10}},Amphibious:{g:[{type:"path",d:"M 65,10 c 0,-10 10,-10 10,0 0,10 10,10 10,0\t0,-10 10,-10 10,0 0,10 10,10 10,0\t0,-10 10,-10 10,0 0,10 10,10 10,0\t0,-10 10,-10 10,0"}],bbox:{y2:e.y2+20}},"Short towed array":{g:[{type:"path",fill:A,d:"M 50,5 l 100,0 M50,0 l10,0 0,10 -10,0 z M150,0 l-10,0 0,10 10,0 z M100,0 l5,5 -5,5 -5,-5 z"}],bbox:{y2:e.y2+10}},"Long towed Array":{g:[{type:"path",fill:A,d:"M 50,5 l 100,0 M50,0 l10,0 0,10 -10,0 z M150,0 l-10,0 0,10 10,0 z M105,0 l-10,0 0,10 10,0 z M75,0 l5,5 -5,5 -5,-5 z M125,0 l5,5 -5,5 -5,-5 z"}],bbox:{y2:e.y2+10}}};i.hasOwnProperty(this.metadata.mobility)&&(t=i[this.metadata.mobility].g,0<this.style.outlineWidth&&E.push(I.outline({type:"translate",x:0,y:e.y2,draw:t},this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),R.push({type:"translate",x:0,y:e.y2,draw:t}),C.merge(i[this.metadata.mobility].bbox))}if(this.metadata.leadership){var L={Friend:{type:"path",d:"m 45,60 55,-25 55,25"}}[this.metadata.affiliation];L&&(E.push(L),C.merge({y1:e.y1-20}))}for(var s=0;s<E.length;s++)E[s].hasOwnProperty("fill")||(E[s].fill=!1),E[s].hasOwnProperty("stroke")||(E[s].stroke=A),E[s].hasOwnProperty("strokewidth")||(E[s].strokewidth=this.style.strokeWidth);for(s=0;s<R.length;s++)R[s].hasOwnProperty("fill")||(R[s].fill=!1),R[s].hasOwnProperty("stroke")||(R[s].stroke=A),R[s].hasOwnProperty("strokewidth")||(R[s].strokewidth=this.style.strokeWidth);return{pre:E,post:R,bbox:C}}function A(I){var t=[],E=[],R=this.metadata.baseGeometry.bbox,e=R.y1,A=R.y2;if(this.metadata.condition)if(this.metadata.fill&&""===this.style.monoColor&&!this.style.simpleStatusModifier){!this.metadata.frame&&this.metadata.iconBottom&&(A=this.metadata.iconBottom),this.options.headquartersElement&&(A+=35),A+=this.metadata.mobility?25:5,E.push({type:"path",strokewidth:this.style.strokeWidth,fill:{FullyCapable:"rgb(0,255,0)",Damaged:"rgb(255,255,0)",Destroyed:"rgb(255,0,0)",FullToCapacity:"rgb(0, 180, 240)"}[this.metadata.condition],stroke:this.colors.frameColor[this.metadata.affiliation],d:"M"+R.x1+","+A+" l"+R.width()+",0 0,25 -"+R.width()+",0 z"}),A+=25,0<this.style.outlineWidth&&t.push(I.outline(E,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor))}else"Damaged"!=this.metadata.condition&&"Destroyed"!=this.metadata.condition||(E.push({type:"path",d:"M150,20 L50,180",strokewidth:2*this.style.strokeWidth,stroke:this.colors.frameColor[this.metadata.affiliation]}),e=20,A=180),"Destroyed"==this.metadata.condition&&E.push({type:"path",d:"M50,20 L150,180",strokewidth:2*this.style.strokeWidth,stroke:this.colors.frameColor[this.metadata.affiliation]}),0<this.style.outlineWidth&&t.push(I.outline(E,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor));return{pre:t,post:E,bbox:{y1:e,y2:A}}}function C(I){var t=[],E=[],R=this.bbox,e=R.x1,A=R.x2,C=R.y1,T=R.y2;if(""!==this.options.engagementBar){C-=6;var S=this.style.fontfamily,N=this.colors.iconColor[this.metadata.affiliation]||this.colors.iconColor.Friend;E.push({type:"text",text:this.options.engagementBar,x:100,y:R.y1-11,textanchor:"middle",fontsize:22,fontfamily:S,fontweight:"bold",fill:N,stroke:!1});var O=!1;if(this.metadata.fill&&""===this.style.monoColor){O={TARGET:"rgb(255, 0, 0)","NON-TARGET":"rgb(255, 255, 255)",EXPIRED:"rgb(255, 120, 0)"}[this.options.engagementType.toUpperCase()]||this.colors.fillColor[this.metadata.affiliation]}var G,o=Math.max(R.width(),16*this.options.engagementBar.length);if(e=Math.min(e,100-o/2),A=Math.max(A,100+o/2),E.unshift({type:"path",strokewidth:this.style.strokeWidth,fill:O,stroke:this.colors.frameColor[this.metadata.affiliation],d:"M"+(100-o/2)+","+C+" l"+o+",0 0,-25 -"+o+",0 z"}),C-=25,0<this.style.outlineWidth)G=this.metadata.fill&&""===this.style.monoColor?E[0]:E,t.push(I.outline(G,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor))}return{pre:t,post:E,bbox:{x1:e,x2:A,y1:C,y2:T}}}function T(I){var t=[],E=[],R=this.metadata.baseGeometry.bbox,e=this.colors.frameColor[this.metadata.affiliation];if(this.metadata.dimensionUnknown&&e&&E.push({type:"text",text:"?",x:100,y:127,fill:e,fontfamily:this.style.fontfamily,fontsize:80,fontweight:"bold",textanchor:"middle"}),this.metadata.baseGeometry.g&&e){var A=10;("Unknown"==this.metadata.affiliation||"Hostile"==this.metadata.affiliation&&"Subsurface"!=this.metadata.dimension)&&(A=-10),"Exercise"==this.metadata.context&&(this.metadata.joker||this.metadata.faker||E.push({type:"text",text:"X",x:R.x2+A,y:60,fill:e,fontfamily:this.style.fontfamily,fontsize:35,fontweight:"bold",textanchor:"start"}),this.metadata.joker&&E.push({type:"text",text:"J",x:R.x2+A,y:60,fill:e,fontfamily:this.style.fontfamily,fontsize:35,fontweight:"bold",textanchor:"start"}),this.metadata.faker&&E.push({type:"text",text:"K",x:R.x2+A,y:60,fill:e,fontfamily:this.style.fontfamily,fontsize:35,fontweight:"bold",textanchor:"start"}),R={x2:R.x2+A+22,y1:35}),"Simulation"==this.metadata.context&&(E.push({type:"text",text:"S",x:R.x2+A,y:60,fill:e,fontfamily:this.style.fontfamily,fontsize:35,fontweight:"bold",textanchor:"start"}),R=new I.BBox({x2:R.x2+A+22,y1:35}))}return 0<this.style.outlineWidth&&t.push(I.outline(E,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),{pre:t,post:E,bbox:R}}function S(I){var t,E,R=[],e=[],A=this.metadata.baseGeometry.bbox,S=("object"==typeof this.style.infoColor?this.style.infoColor[this.metadata.affiliation]:this.style.infoColor)||this.colors.iconColor[this.metadata.affiliation]||this.colors.iconColor.Friend,N=this.style.fontfamily,O=this.style.infoSize,C="object"==typeof this.style.infoBackground?this.style.infoBackground[this.metadata.affiliation]:this.style.infoBackground,T="object"==typeof this.style.infoBackground?this.style.infoBackground[this.metadata.affiliation]:this.style.infoBackground,G=new I.BBox,o=20;function M(I){var t,E=[];for(var R in I)if(this.options.hasOwnProperty(R)&&""!=this.options[R]){if(!I.hasOwnProperty(R))continue;for(var e=0;e<(I[R].length||1);e++){var A;if(t={y2:(A=Array.isArray(I[R])?I[R][e]:I[R]).y,y1:A.y-A.fontsize},"start"==A.textanchor&&(t.x1=A.x,t.x2=A.x+i(this.options[R])*(A.fontsize/O)),"middle"==A.textanchor){var C=i(this.options[R])*(A.fontsize/O);t.x1=A.x-C/2,t.x2=A.x+C/2}"end"==A.textanchor&&(t.x1=A.x-i(this.options[R])*(A.fontsize/O),t.x2=A.x),G.merge(t);var T={type:"text",fontfamily:N,fill:S};A.hasOwnProperty("fill")&&(T.fill=A.fill),A.hasOwnProperty("stroke")&&(T.stroke=A.stroke),A.hasOwnProperty("textanchor")&&(T.textanchor=A.textanchor),A.hasOwnProperty("fontsize")&&(T.fontsize=A.fontsize),A.hasOwnProperty("fontweight")&&(T.fontweight=A.fontweight),T.x=A.x,T.y=A.y,T.text=this.options[R],E.push(T)}}return E}function i(I){if(0==I.length)return 0;for(var t={" ":9,"!":10,'"':15,"#":17,$:17,"%":27,"&":22,"'":8,"(":10,")":10,"*":12,"+":18,",":9,"-":10,".":9,"/":9,0:17,1:17,2:17,3:17,4:17,5:17,6:17,7:17,8:17,9:17,":":10,";":10,"<":18,"=":18,">":18,"?":19,"@":30,A:22,B:22,C:22,D:22,E:21,F:19,G:24,H:22,I:9,J:17,K:22,L:19,M:25,N:22,O:24,P:21,Q:24,R:22,S:21,T:19,U:22,V:21,W:29,X:21,Y:21,Z:19,"[":10,"]":10,"^":18,_:17,"`":10,a:17,b:19,c:17,d:19,e:17,f:10,g:19,h:19,i:9,j:9,k:17,l:9,m:27,n:19,o:19,p:19,q:19,r:12,s:17,t:10,u:19,v:17,w:24,x:17,y:17,z:15,"{":12,"|":9,"}":12,"~":18},E=0,R=0;R<I.length;R++)E+=O/30*(t[I[R]]?t[I[R]]:28.5);return E+=o}if(this.metadata.numberSIDC){if(!I._labelCache.hasOwnProperty("number"))for(t in I._labelCache.number={},I._labelOverrides.number)I._labelOverrides.number.hasOwnProperty(t)&&I._labelOverrides.number[t].call(this,I._labelCache.number);if(E=this.metadata.functionid.substr(0,6),this.metadata.controlMeasure&&I._labelCache.number.hasOwnProperty(E))return e.push(M.call(this,I._labelCache.number[E])),0<this.style.outlineWidth&&R.push(I.outline(e,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),{pre:R,post:e,bbox:G}}else{if(!I._labelCache.hasOwnProperty("letter"))for(t in I._labelCache.letter={},I._labelOverrides.letter)I._labelOverrides.letter.hasOwnProperty(t)&&I._labelOverrides.letter[t].call(this,I._labelCache.letter);if(E=this.options.sidc.substr(0,1)+"-"+this.options.sidc.substr(2,1)+"-"+this.options.sidc.substr(4,6),I._labelCache.letter.hasOwnProperty(E))return e.push(M.call(this,I._labelCache.letter[E])),0<this.style.outlineWidth&&R.push(I.outline(e,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor)),{pre:R,post:e,bbox:G}}var L,s,n,a=this.options.quantity||this.options.reinforcedReduced||this.options.staffComments||this.options.additionalInformation||this.options.evaluationRating||this.options.combatEffectiveness||this.options.signatureEquipment||this.options.higherFormation||this.options.hostile||this.options.iffSif||this.options.sigint||this.options.uniqueDesignation||this.options.type||this.options.dtg||this.options.altitudeDepth||this.options.location||this.options.speed||this.options.specialHeadquarters||this.options.platformType||this.options.equipmentTeardownTime||this.options.commonIdentifier||this.options.auxiliaryEquipmentIndicator||this.options.headquartersElement||this.options.installationComposition||this.options.guardedUnit||this.options.specialDesignator;if(this.style.infoFields&&a){this.options.specialHeadquarters&&e.push((L=this.options.specialHeadquarters,s=42,n=115,1==L.length&&(s=45,n=115),3==L.length&&(s=35,n=110),4<=L.length&&(s=32,n=110),{type:"text",text:L,x:100,y:n,textanchor:"middle",fontsize:s,fontfamily:N,fill:S,stroke:!1,fontweight:"bold"})),this.options.quantity&&!this.metadata.dismounted&&(e.push({type:"text",text:this.options.quantity,x:100,y:A.y1-10,textanchor:"middle",fontsize:O,fontfamily:N,fill:S,stroke:!1}),G.y1=A.y1-10-O),this.options.headquartersElement&&(e.push({type:"text",text:this.options.headquartersElement,x:100,y:A.y2+35,textanchor:"middle",fontsize:35,fontfamily:N,fontweight:"bold",fill:S,stroke:!1}),G.y2=A.y2+35);var l,r={L1:"",L2:"",L3:"",L4:"",L5:"",R1:"",R2:"",R3:"",R4:"",R5:""};if(isNaN(this.options.sidc)||"Air"!=this.metadata.baseDimension||(r.R1=this.options.uniqueDesignation,r.R2=this.options.iffSif,r.R3=this.options.type,(this.options.speed||this.options.altitudeDepth)&&(l=[],this.options.speed&&l.push(this.options.speed),this.options.altitudeDepth&&l.push(this.options.altitudeDepth),r.R4=l.join("/")),(this.options.staffComments||this.options.additionalInformation)&&(l=[],this.options.staffComments&&l.push(this.options.staffComments),this.options.additionalInformation&&l.push(this.options.additionalInformation),r.R5=l.join("/"))),(isNaN(this.options.sidc)||"Ground"==this.metadata.baseDimension)&&(r.L1=this.options.dtg,(this.options.altitudeDepth||this.options.location)&&(l=[],this.options.altitudeDepth&&l.push(this.options.altitudeDepth),this.options.location&&l.push(this.options.location),r.L2=l.join("/")),r.L4=this.options.uniqueDesignation,r.L5=this.options.speed,r.R2=this.options.staffComments,r.R4=this.options.higherFormation,(this.options.evaluationRating||this.options.combatEffectiveness||this.options.signatureEquipment||this.options.hostile||this.options.iffSif)&&(l=[],this.options.evaluationRating&&l.push(this.options.evaluationRating),this.options.combatEffectiveness&&l.push(this.options.combatEffectiveness),this.options.signatureEquipment&&l.push(this.options.signatureEquipment),this.options.hostile&&l.push(this.options.hostile),this.options.iffSif&&l.push(this.options.iffSif),r.R5=l.join("/")),isNaN(this.options.sidc)||this.metadata.unit?((this.options.type||this.options.platformType||this.options.equipmentTeardownTime)&&(l=[],this.options.type&&l.push(this.options.type),this.options.platformType&&l.push(this.options.platformType),this.options.equipmentTeardownTime&&l.push(this.options.equipmentTeardownTime),r.L3=l.join("/")),r.R1=this.options.reinforcedReduced,this.metadata.activity&&(r.R1=this.options.country),(this.options.additionalInformation||this.options.commonIdentifier)&&(l=[],this.options.additionalInformation&&l.push(this.options.additionalInformation),this.options.commonIdentifier&&l.push(this.options.commonIdentifier),r.R3=l.join("/"))):((this.options.type||this.options.platformType||this.options.commonIdentifier||this.options.installationComposition)&&(l=[],this.options.type&&l.push(this.options.type),this.options.platformType&&l.push(this.options.platformType),this.options.commonIdentifier&&l.push(this.options.commonIdentifier),this.options.installationComposition&&l.push(this.options.installationComposition),r.L3=l.join("/")),r.R1=this.options.country,(this.options.additionalInformation||this.options.equipmentTeardownTime)&&(l=[],this.options.additionalInformation&&l.push(this.options.additionalInformation),this.options.equipmentTeardownTime&&l.push(this.options.equipmentTeardownTime),r.R3=l.join("/")))),this.metadata.dismounted&&(this.options.quantity&&(e.push({type:"text",text:this.options.quantity,x:100,y:A.y2+O,textanchor:"middle",fontsize:O,fontfamily:N,fill:S,stroke:!1}),G.y2=A.y2+O),r.L1=this.options.dtg,(this.options.altitudeDepth||this.options.location)&&(l=[],this.options.altitudeDepth&&l.push(this.options.altitudeDepth),this.options.location&&l.push(this.options.location),r.L2=l.join("/")),(this.options.type||this.options.platformType||this.options.commonIdentifier)&&(l=[],this.options.type&&l.push(this.options.type),this.options.platformType&&l.push(this.options.platformType),this.options.commonIdentifier&&l.push(this.options.commonIdentifier),r.L3=l.join("/")),r.L4=this.options.uniqueDesignation,r.L5=this.options.speed,r.R1=this.options.country,r.R2=this.options.staffComments,this.options.additionalInformation&&(l=[],this.options.additionalInformation&&l.push(this.options.additionalInformation),r.R3=l.join("/")),r.R4=this.options.higherFormation,(this.options.evaluationRating||this.options.combatEffectiveness||this.options.signatureEquipment||this.options.hostile||this.options.iffSif)&&(l=[],this.options.evaluationRating&&l.push(this.options.evaluationRating),this.options.combatEffectiveness&&l.push(this.options.combatEffectiveness),this.options.signatureEquipment&&l.push(this.options.signatureEquipment),this.options.hostile&&l.push(this.options.hostile),this.options.iffSif&&l.push(this.options.iffSif),r.R5=l.join("/"))),isNaN(this.options.sidc)||"Sea"!=this.metadata.baseDimension||((this.options.guardedUnit||this.options.specialDesignator)&&(l=[],this.options.guardedUnit&&l.push(this.options.guardedUnit),this.options.specialDesignator&&l.push(this.options.specialDesignator),r.L1=l.join("/")),r.R1=this.options.uniqueDesignation,r.R2=this.options.type,r.R3=this.options.iffSif,(this.options.staffComments||this.options.additionalInformation)&&(l=[],this.options.staffComments&&l.push(this.options.staffComments),this.options.additionalInformation&&l.push(this.options.additionalInformation),r.R4=l.join("/")),(this.options.location||this.options.speed)&&(l=[],this.options.location&&l.push(this.options.location),this.options.speed&&l.push(this.options.speed),r.R5=l.join("/"))),isNaN(this.options.sidc)||"Subsurface"!=this.metadata.baseDimension||(r.L1=this.options.specialDesignator,r.R1=this.options.uniqueDesignation,r.R2=this.options.type,r.R3=this.options.altitudeDepth,r.R4=this.options.staffComments,r.R5=this.options.additionalInformation),G.x1=A.x1-Math.max(this.options.specialHeadquarters?(i(this.options.specialHeadquarters)-this.metadata.baseGeometry.bbox.width())/2:0,this.options.quantity?(i(this.options.quantity)-this.metadata.baseGeometry.bbox.width())/2:0,i(r.L1),i(r.L2),i(r.L3),i(r.L4),i(r.L5)),G.x2=A.x2+Math.max(this.options.specialHeadquarters?(i(this.options.specialHeadquarters)-this.metadata.baseGeometry.bbox.width())/2:0,this.options.quantity?(i(this.options.quantity)-this.metadata.baseGeometry.bbox.width())/2:0,i(r.R1),i(r.R2),i(r.R3),i(r.R4),i(r.R5)),(r.L1||r.R1)&&(G.y1=Math.min(G.y1,100-2.5*O)),(r.L2||r.R2)&&(G.y1=Math.min(G.y1,100-1.5*O)),(r.L4||r.R4)&&(G.y2=Math.max(G.y2,100+1.7*O)),(r.L5||r.R5)&&(G.y2=Math.max(G.y2,100+2.7*O)),this.style.infoBackground){var P={x1:100,y1:1e3,y2:0},y={x2:100,y1:1e3,y2:0};r.L1&&(P={x1:Math.min(P.x1,A.x1-i(r.L1)),x2:A.x1-o/2,y1:Math.min(P.y1,100-2.5*O),y2:Math.max(P.y2,100-1.5*O+o/2)}),r.L2&&(P={x1:Math.min(P.x1,A.x1-i(r.L2)),x2:A.x1-o/2,y1:Math.min(P.y1,100-1.5*O),y2:Math.max(P.y2,100-.5*O+o/2)}),r.L3&&(P={x1:Math.min(P.x1,A.x1-i(r.L3)),x2:A.x1-o/2,y1:Math.min(P.y1,100-.5*O),y2:Math.max(P.y2,100+.5*O+o/2)}),r.L4&&(P={x1:Math.min(P.x1,A.x1-i(r.L4)),x2:A.x1-o/2,y1:Math.min(P.y1,100+.5*O),y2:Math.max(P.y2,100+1.5*O+o/2)}),r.L5&&(P={x1:Math.min(P.x1,A.x1-i(r.L5)),x2:A.x1-o/2,y1:Math.min(P.y1,100+1.5*O),y2:Math.max(P.y2,100+2.5*O+o/2)}),P.hasOwnProperty("x2")&&(G.x1-=O/2,e.push({type:"path",d:"M "+(P.x1-O/2)+","+(P.y1+O/2)+" "+P.x1+","+P.y1+" "+P.x2+","+P.y1+" "+P.x2+","+P.y2+" "+(P.x1-O/2)+","+P.y2+"z",fill:C,stroke:T||!1})),r.R1&&(y={x1:A.x2+o/2,x2:Math.max(y.x2,A.x2+i(r.R1)),y1:Math.min(y.y1,100-2.5*O),y2:Math.max(y.y2,100-1.5*O+o/2)}),r.R2&&(y={x1:A.x2+o/2,x2:Math.max(y.x2,A.x2+i(r.R2)),y1:Math.min(y.y1,100-1.5*O),y2:Math.max(y.y2,100-.5*O+o/2)}),r.R3&&(y={x1:A.x2+o/2,x2:Math.max(y.x2,A.x2+i(r.R3)),y1:Math.min(y.y1,100-.5*O),y2:Math.max(y.y2,100+.5*O+o/2)}),r.R4&&(y={x1:A.x2+o/2,x2:Math.max(y.x2,A.x2+i(r.R4)),y1:Math.min(y.y1,100+.5*O),y2:Math.max(y.y2,100+1.5*O+o/2)}),r.R5&&(y={x1:A.x2+o/2,x2:Math.max(y.x2,A.x2+i(r.R5)),y1:Math.min(y.y1,100+1.5*O),y2:Math.max(y.y2,100+2.5*O+o/2)}),y.hasOwnProperty("x1")&&(G.x2+=O/2,e.push({type:"path",d:"M "+y.x1+","+y.y1+" "+(y.x2+O/2)+","+y.y1+" "+(y.x2+O/2)+","+(y.y2-O/2)+" "+y.x2+","+y.y2+" "+y.x1+","+y.y2+"z",fill:C,stroke:T||!1}))}r.L1&&e.push({type:"text",text:r.L1,x:A.x1-o,y:100-1.5*O,textanchor:"end",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.L2&&e.push({type:"text",text:r.L2,x:A.x1-o,y:100-.5*O,textanchor:"end",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.L3&&e.push({type:"text",text:r.L3,x:A.x1-o,y:100+.5*O,textanchor:"end",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.L4&&e.push({type:"text",text:r.L4,x:A.x1-o,y:100+1.5*O,textanchor:"end",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.L5&&e.push({type:"text",text:r.L5,x:A.x1-o,y:100+2.5*O,textanchor:"end",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.R1&&e.push({type:"text",text:r.R1,x:A.x2+o,y:100-1.5*O,textanchor:"start",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.R2&&e.push({type:"text",text:r.R2,x:A.x2+o,y:100-.5*O,textanchor:"start",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.R3&&e.push({type:"text",text:r.R3,x:A.x2+o,y:100+.5*O,textanchor:"start",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.R4&&e.push({type:"text",text:r.R4,x:A.x2+o,y:100+1.5*O,textanchor:"start",fontsize:O,fontfamily:N,fill:S,stroke:!1}),r.R5&&e.push({type:"text",text:r.R5,x:A.x2+o,y:100+2.5*O,textanchor:"start",fontsize:O,fontfamily:N,fill:S,stroke:!1}),0<this.style.outlineWidth&&R.push(I.outline(e,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor))}return{pre:R,post:e,bbox:G}}function N(I){var t=[],E=[],R=this.metadata.baseGeometry.bbox;""==this.metadata.baseGeometry.g&&(R=this.bbox);var e,A=new I.BBox,C=this.colors.iconColor[this.metadata.affiliation]||this.colors.iconColor.Friend;if(this.style.infoFields&&""!==this.options.direction){if(0==this.options.speedLeader){e=[{type:"rotate",degree:this.options.direction,x:100,y:100,draw:[{type:"path",fill:C,stroke:C,strokewidth:this.style.strokeWidth,d:"M100,100 l0,-75 -5,3 5,-15 5,15 -5,-3"}]}],A.y1=Math.min(100-95*Math.cos(this.options.direction/360*Math.PI*2),100),A.y2=Math.max(100-95*Math.cos(this.options.direction/360*Math.PI*2),100),A.x1=Math.min(100+95*Math.sin(this.options.direction/360*Math.PI*2),100),A.x2=Math.max(100+95*Math.sin(this.options.direction/360*Math.PI*2),100),"Ground"!=this.metadata.baseDimension&&""!=this.metadata.baseDimension||(this.metadata.headquarters?(e=[{type:"translate",x:R.x1-100,y:R.y2-(100-(this.style.hqStaffLength||I._hqStaffLength)),draw:e}],A.x1+=R.x1-100,A.x2+=R.x1-100):e=[{type:"translate",x:0,y:R.y2,draw:e},{type:"path",fill:C,stroke:C,strokewidth:this.style.strokeWidth,d:"M 100,"+R.y2+"l0,100"}]),A.y2+=R.y2+parseFloat(this.style.strokeWidth),E.push(e)}else{var T=this.options.speedLeader*(100/this.style.size),S=this.options.direction*Math.PI/180,N=-T*Math.cos(S),O=T*Math.sin(S);A.x1=Math.min(100,100+O),A.x2=Math.max(100,100+O),A.y1=Math.min(100,100+N),A.y2=Math.max(100,100+N),e={type:"path",fill:C,stroke:C,strokewidth:this.style.strokeWidth,d:"M 100,100 l"+O+","+N},t.push(e)}0<this.style.outlineWidth&&t.unshift(I.outline(e,this.style.outlineWidth,this.style.strokeWidth,"object"==typeof this.style.outlineColor?this.style.outlineColor[this.metadata.affiliation]:this.style.outlineColor))}return{pre:t,post:E,bbox:A}}function I(I){return void 0===I&&(I={}),{x1:void 0!==I.x1?I.x1:100,y1:void 0!==I.y1?I.y1:100,x2:void 0!==I.x2?I.x2:100,y2:void 0!==I.y2?I.y2:100,width:function(){return this.x2-this.x1},height:function(){return this.y2-this.y1},getSize:function(){return{height:this.y2-this.y1,width:this.x2-this.x1}},merge:function(I){return this.x1=I.x1<=this.x1?I.x1:this.x1,this.y1=I.y1<=this.y1?I.y1:this.y1,this.x2=I.x2>=this.x2?I.x2:this.x2,this.y2=I.y2>=this.y2?I.y2:this.y2,this}}}var O={AirHostile:{g:{type:"path",d:"M 45,150 L45,70 100,20 155,70 155,150"},bbox:new I({x1:45,y1:20,x2:155,y2:150})},AirFriend:{g:{type:"path",d:"M 155,150 C 155,50 115,30 100,30 85,30 45,50 45,150"},bbox:new I({x1:45,y1:30,x2:155,y2:150})},AirNeutral:{g:{type:"path",d:"M 45,150 L 45,30,155,30,155,150"},bbox:new I({x1:45,y1:30,x2:155,y2:150})},AirUnknown:{g:{type:"path",d:"M 65,150 c -55,0 -50,-90 0,-90 0,-50 70,-50 70,0 50,0 55,90 0,90"},bbox:new I({x1:25,y1:20,x2:175,y2:150})},GroundHostile:{g:{type:"path",d:"M 100,28 L172,100 100,172 28,100 100,28 Z"},bbox:new I({x1:28,y1:28,x2:172,y2:172})},GroundFriend:{g:{type:"path",d:"M25,50 l150,0 0,100 -150,0 z"},bbox:new I({x1:25,y1:50,x2:175,y2:150})},GroundNeutral:{g:{type:"path",d:"M45,45 l110,0 0,110 -110,0 z"},bbox:new I({x1:45,y1:45,x2:155,y2:155})},GroundUnknown:{g:{type:"path",d:"M63,63 C63,20 137,20 137,63 C180,63 180,137 137,137 C137,180 63,180 63,137 C20,137 20,63 63,63 Z"},bbox:new I({x1:30.75,y1:30.75,x2:169.25,y2:169.25})},LandDismountedIndividualHostile:{g:{type:"path",d:"M 100,28 L172,100 100,172 28,100 100,28 Z"},bbox:new I({x1:28,y1:28,x2:172,y2:172})},LandDismountedIndividualFriend:{g:{type:"path",d:"m 100,45 55,25 0,60 -55,25 -55,-25 0,-60 z"},bbox:new I({x1:45,y1:45,x2:155,y2:155})},LandDismountedIndividualNeutral:{g:{type:"path",d:"M45,45 l110,0 0,110 -110,0 z"},bbox:new I({x1:45,y1:45,x2:155,y2:155})},LandDismountedIndividualUnknown:{g:{type:"path",d:"M63,63 C63,20 137,20 137,63 C180,63 180,137 137,137 C137,180 63,180 63,137 C20,137 20,63 63,63 Z"},bbox:new I({x1:30.75,y1:30.75,x2:169.25,y2:169.25})},SeaHostile:{g:{type:"path",d:"M100,28 L172,100 100,172 28,100 100,28 Z"},bbox:new I({x1:28,y1:28,x2:172,y2:172})},SeaFriend:{g:{type:"circle",cx:100,cy:100,r:60},bbox:new I({x1:40,y1:40,x2:160,y2:160})},SeaNeutral:{g:{type:"path",d:"M45,45 l110,0 0,110 -110,0 z"},bbox:new I({x1:45,y1:45,x2:155,y2:155})},SeaUnknown:{g:{type:"path",d:"M63,63 C63,20 137,20 137,63 C180,63 180,137 137,137 C137,180 63,180 63,137 C20,137 20,63 63,63 Z"},bbox:new I({x1:30.75,y1:30.75,x2:169.25,y2:169.25})},SubsurfaceHostile:{g:{type:"path",d:"M45,50 L45,130 100,180 155,130 155,50"},bbox:new I({x1:45,y1:50,x2:155,y2:180})},SubsurfaceFriend:{g:{type:"path",d:"m 45,50 c 0,100 40,120 55,120 15,0 55,-20 55,-120"},bbox:new I({x1:45,y1:50,x2:155,y2:170})},SubsurfaceNeutral:{g:{type:"path",d:"M45,50 L45,170 155,170 155,50"},bbox:new I({x1:45,y1:50,x2:155,y2:170})},SubsurfaceUnknown:{g:{type:"path",d:"m 65,50 c -55,0 -50,90 0,90 0,50 70,50 70,0 50,0 55,-90 0,-90"},bbox:new I({x1:25,y1:50,x2:175,y2:180})},PositionMarker:{g:{type:"circle",cx:100,cy:100,r:15},bbox:new I({x1:85,y1:85,x2:115,y2:115})}},s=new function(){this._autoValidation=!1,this.version="2.0.0","object"==typeof console&&"object"!=typeof process&&console.info("milsymbol.js "+this.version+" - Copyright (c) 2018 M"+String.fromCharCode(229)+"ns Beckman http://www.spatialillusions.com")};function G(){this.bbox=new I,this.colors={},this.metadata={},this.octagonAnchor={x:50,y:50},this.options={},this.options.quantity="",this.options.reinforcedReduced="",this.options.staffComments="",this.options.additionalInformation="",this.options.evaluationRating="",this.options.combatEffectiveness="",this.options.signatureEquipment="",this.options.higherFormation="",this.options.hostile="",this.options.iffSif="",this.options.direction="",this.options.sigint="",this.options.uniqueDesignation="",this.options.type="",this.options.dtg="",this.options.altitudeDepth="",this.options.location="",this.options.speed="",this.options.speedLeader=0,this.options.specialHeadquarters="",this.options.country="",this.options.platformType="",this.options.equipmentTeardownTime="",this.options.commonIdentifier="",this.options.auxiliaryEquipmentIndicator="",this.options.headquartersElement="",this.options.installationComposition="",this.options.engagementBar="",this.options.engagementType="",this.options.guardedUnit="",this.options.specialDesignator="",this.style={},this.style.alternateMedal=!1,this.style.civilianColor=!0,this.style.colorMode="Light",this.style.fill=!0,this.style.fillOpacity=1,this.style.fontfamily="Arial",this.style.frame=!0,this.style.frameColor="",this.style.hqStaffLength=0,this.style.icon=!0,this.style.iconColor="",this.style.infoBackground="",this.style.infoBackgroundFrame="",this.style.infoColor="",this.style.infoFields=!0,this.style.infoSize=40,this.style.monoColor="",this.style.outlineColor="rgb(239, 239, 239)",this.style.outlineWidth=0,this.style.padding=0,this.style.simpleStatusModifier=!1,this.style.size=100,this.style.square=!1,this.style.standard="",this.style.strokeWidth=4,this.symbolAnchor={x:50,y:50},this.validIcon=!0,0<arguments.length&&this.setOptions.apply(this,arguments)}function o(I,t,E){this.options.sidc=this.options.sidc.toUpperCase();var R=""!=this.options.sidc.charAt(0)?this.options.sidc.charAt(0):"-",e=""!=this.options.sidc.charAt(1)?this.options.sidc.charAt(1):"-",A=""!=this.options.sidc.charAt(2)?this.options.sidc.charAt(2):"-",C=""!=this.options.sidc.charAt(3)?this.options.sidc.charAt(3):"-",T=t.functionid=""!=this.options.sidc.substr(4,6)?this.options.sidc.substr(4,6):"------",S=""!=this.options.sidc.charAt(10)?this.options.sidc.charAt(10):"-",N=""!=this.options.sidc.charAt(11)?this.options.sidc.charAt(11):"-";if(-1<["H","S","J","K"].indexOf(e)&&(t.affiliation=E.affiliation[0]),-1<["F","A","D","M"].indexOf(e)&&(t.affiliation=E.affiliation[1]),-1<["N","L"].indexOf(e)&&(t.affiliation=E.affiliation[2]),-1<["P","U","G","W","O"].indexOf(e)&&(t.affiliation=E.affiliation[3]),-1<["P","A"].indexOf(A)&&(t.dimension=E.dimension[0]),-1<["G","Z","F","X"].indexOf(A)&&(t.dimension=E.dimension[1]),-1<["S"].indexOf(A)&&(t.dimension=E.dimension[2]),-1<["U"].indexOf(A)&&(t.dimension=E.dimension[3]),"P"==A&&"O"!=R&&(t.space=!0),"O"==R&&-1<["V","O","R"].indexOf(A)&&(t.activity=!0),"G"==R&&(t.controlMeasure=!0),"H"==S&&(t.installation=!0),this.style.frame&&"A"==C&&(t.notpresent=I._dashArrays.anticipated),this.style.frame&&-1<["P","A","S","G","M"].indexOf(e)&&(t.notpresent=I._dashArrays.pending),"C"==C&&(t.condition=E.status[2]),"D"==C&&(t.condition=E.status[3]),"X"==C&&(t.condition=E.status[4]),"F"==C&&(t.condition=E.status[5]),-1<["G","W","D","L","M","J","K"].indexOf(e)&&(t.context=E.context[1]),"O"==R&&(t.dimension=E.dimension[1]),"E"==R&&(t.dimension=E.dimension[1]),t.baseDimension=t.dimension,t.baseAffilation=t.affiliation,"J"==e&&(t.joker=!0),"K"==e&&(t.faker=!0),(t.joker||t.faker)&&(t.affiliation=E.affiliation[1]),"S"==R&&"G"==A&&"E"==T.charAt(0)&&(t.dimension=E.dimension[2]),"I"==R&&"G"==A&&(t.dimension=E.dimension[2]),"E"==R&&("O"==A&&-1<["AB----","AE----","AF----","BB----","CB----","CC----","DB----","DDB---","DEB---","DFB---","DGB---","DHB---","DIB---","DJB---","DLB---","DMB---","DOB---","EA----","EB----","EC----","ED----","EE----"].indexOf(T)||"F"==A&&-1<["BA----","MA----","MC----"].indexOf(T))&&(t.dimension=E.dimension[2]),(-1<["F","G","C","D"].indexOf(S)||"H"==S&&"B"==N)&&(t.feintDummy=!0),-1<["A","B","C","D"].indexOf(S)&&(t.headquarters=!0),"G"==A&&"UH----"==T&&(t.headquarters=!0),-1<["E","B","G","D"].indexOf(S)&&(t.taskForce=!0),"A"==N&&(t.echelon=E.echelonMobility[11]),"B"==N&&"H"!=S&&(t.echelon=E.echelonMobility[12]),"C"==N&&(t.echelon=E.echelonMobility[13]),"D"==N&&(t.echelon=E.echelonMobility[14]),"E"==N&&(t.echelon=E.echelonMobility[15]),"F"==N&&(t.echelon=E.echelonMobility[16]),"G"==N&&(t.echelon=E.echelonMobility[17]),"H"==N&&(t.echelon=E.echelonMobility[18]),"I"==N&&(t.echelon=E.echelonMobility[21]),"J"==N&&(t.echelon=E.echelonMobility[22]),"K"==N&&(t.echelon=E.echelonMobility[23]),"L"==N&&"N"!=S&&(t.echelon=E.echelonMobility[24]),"M"==N&&(t.echelon=E.echelonMobility[25]),"N"==N&&(t.echelon=E.echelonMobility[26]),"M"==S)switch(N){case"O":t.mobility=E.echelonMobility[31];break;case"P":t.mobility=E.echelonMobility[32];break;case"Q":t.mobility=E.echelonMobility[33];break;case"R":t.mobility=E.echelonMobility[34];break;case"S":t.mobility=E.echelonMobility[35];break;case"T":t.mobility=E.echelonMobility[36];break;case"U":t.mobility=E.echelonMobility[41];break;case"V":t.mobility=E.echelonMobility[42];break;case"W":t.mobility=E.echelonMobility[37];break;case"Y":t.mobility=E.echelonMobility[51];break;case"Z":t.mobility=E.echelonMobility[52];break;default:t.mobility=void 0}if("N"==S)switch(N){case"S":t.mobility=E.echelonMobility[61];break;case"L":t.mobility=E.echelonMobility[62];break;default:t.mobility=void 0}return("A"==A&&"C"==T.charAt(0)||"G"==A&&"EVC"==T.substring(0,3)||"S"==A&&"X"==T.charAt(0))&&(t.civilian=!0),"Z"!=A&&"X"!=A||(-1<["P","U","F","N","H","A","S","G","W"].indexOf(e)&&(t.dimensionUnknown=!0),-1<["F","A"].indexOf(e)&&(t.dimension="Sea"),-1<["D","L","M","J","K"].indexOf(e)&&(t.affiliation="none")),"S"==A&&-1<["O-----","ED----","EP----","EV----","ZM----","ZN----","ZI----"].indexOf(T)&&(t.frame=!1),"E"==R&&"N"==A&&-1<["AA----","AB----","AC----","AD----","AE----","AG----","BB----","BC----","BF----","BM----","-C-----","CA----","CB----","CC----","CD----","CE----"].indexO