32 lines
678 KiB
JavaScript
32 lines
678 KiB
JavaScript
|
!function(I,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("milsymbol",[],t):"object"==typeof exports?exports.milsymbol=t():I.ms=t()}(this,function(){return function(I){function t(R){if(E[R])return E[R].exports;var C=E[R]={i:R,l:!1,exports:{}};return I[R].call(C.exports,C,C.exports,t),C.l=!0,C.exports}var E={};return t.m=I,t.c=E,t.d=function(I,E,R){t.o(I,E)||Object.defineProperty(I,E,{configurable:!1,enumerable:!0,get:R})},t.n=function(I){var E=I&&I.__esModule?function(){return I.default}:function(){return I};return t.d(E,"a",E),E},t.o=function(I,t){return Object.prototype.hasOwnProperty.call(I,t)},t.p="",t(t.s=3)}([function(I,t,E){"use strict";/*!
|
||
|
==========================================================================================
|
||
|
|
||
|
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.
|
||
|
|
||
|
------------------------------------------------------------------------------------------
|
||
|
|
||
|
For updates and more information go to http://www.spatialillusions.com
|
||
|
|
||
|
==========================================================================================
|
||
|
*/
|
||
|
var R=new function(){this._colorModes={},this._dashArrays={pending:"4,4",anticipated:"8,12",feintDummy:"8,8"},this._hqStafLength=100,this._iconCache={},this._iconParts=[],this._labelCache={},this._labelOverrides={},this._letterSIDCicons=[],this._numberSIDCicons=[],this._STD2525=!0,this._svgNS="http://www.w3.org/2000/svg",this._symbolParts=[],this.autoSVG=!1,this.version="1.3.3","object"==typeof console&&console.info("milsymbol.js "+this.version+" - Copyright (c) 2017 Måns Beckman http://www.spatialillusions.com")};R._parseXML=function(I,t){t=t||document;var E=(new DOMParser).parseFromString(I,"text/xml");return t.adoptNode(E.documentElement)},R._scale=function(I,t){return{type:"translate",x:100-100*I,y:100-100*I,draw:[{type:"scale",factor:I,draw:[t]}]}},R._translate=function(I,t,E){return{type:"translate",x:I,y:t,draw:[E]}},R.addIconParts=function(I){return"function"==typeof I&&-1==this._iconParts.indexOf(I)&&(this._iconParts=this._iconParts.concat(I)),R},R.addLabelOverrides=function(I,t){return"function"==typeof I&&(this._labelOverrides.hasOwnProperty(t)||(this._labelOverrides[t]=[]),this._labelOverrides[t]=this._labelOverrides[t].concat(I)),R},R.addSIDCicons=function(I,t){return"function"==typeof I&&(this["_"+t+"SIDCicons"]=this["_"+t+"SIDCicons"].concat(I)),R},R.addSymbolPart=function(I){return"function"==typeof I&&R.setSymbolParts(R.getSymbolParts().concat(I)),R},R.BBox=E(4),R.ColorMode=function(I,t,E,R,C){var A={};return A.Civilian=I,A.Friend=t,A.Hostile=E,A.Neutral=R,A.Unknown=C,A},R.getColorMode=function(I){var t=this._colorModes[I];return new R.ColorMode(t.Civilian,t.Friend,t.Hostile,t.Neutral,t.Unknown)},R.getDashArrays=function(){return this._dashArrays},R.getHqStafLength=function(){return this._hqStafLength},R.getSymbolParts=function(){return this._symbolParts.slice(0)},R.getVersion=function(){return this.version},R.outline=function(I,t,E,C){var A;if(Array.isArray(I)){A=[];for(var e in I)A.push(R.outline(I[e],t,E,C))}else{A={};for(var S in I)-1==["fill","fillopacity"].indexOf(S)&&(A[S]=I[S]);if("translate"==I.type||"rotate"==I.type||"scale"==I.type){A.draw=[];for(var T in I.draw)A.draw.push(R.outline(I.draw[T],t,E,C))}else A.strokewidth=0!=A.stroke?Number(A.strokewidth||E)+2*t:2*t,A.stroke=C,A.fill=!1,A.linecap="round"}return A},R.setAutoSVG=function(I){return this.autoSVG=I,this.autoSVG},R.setColorMode=function(I,t){return this._colorModes[I]={},this._colorModes[I].Hostile=t.Hostile,this._colorModes[I].Friend=t.Friend,this._colorModes[I].Neutral=t.Neutral,this._colorModes[I].Unknown=t.Unknown,this._colorModes[I].Civilian=t.Civilian,this._colorModes[I]},R.setDashArrays=function(I,t,E){return this._dashArrays.pending=I,this._dashArrays.anticipated=t,this._dashArrays.feintDummy=E,this._dashArrays},R.setHqStafLength=function(I){return this._hqStafLength=I,this._hqStafLength},R.setSymbolParts=function(I){return this._symbolParts=I,R},R.setStandard=E(5),I.exports=R},function(I,t){I.exports=function(I,t,E,R,C,A){function e(I){var t=30;return 3==I.length&&(t=25),I.length>=4&&(t=22),{type:"text",stroke:!1,textanchor:"middle",x:100,y:77,fontsize:t,text:I}}function S(I){if("object"==typeof I){if(Array.isArray(I)){for(var t=0;t<I.length;t++)S.call(this,I[t]);return}return I.icon=!0,"text"==I.type&&(I.hasOwnProperty("fontfamily")||(I.fontfamily="Arial"),I.hasOwnProperty("fontweight")||(I.fontweight="bold"),I.hasOwnProperty("textanchor")||(I.textanchor="middle"),I.hasOwnProperty("stroke")||(I.stroke=!1)),I.hasOwnProperty("fill")||(I.fill=N),void(I.hasOwnProperty("stroke")||(I.stroke=N))}}var T=t.affiliation||"Friend",N=E.iconColor[T],G={};G["SI.IC.COMMUNICATIONS"]={type:"path",d:"m 93,120 14,0 0,0 m -7,-27 0,27 m 2,-25 8,2 -5,5 13,3 m -20,-10 -8,2 5,5 -14,3 m 21,-13 8,-2 -5,-5 13,-3 m -37,0 14,3 -5,5 8,2",fill:!1},G["SI.IC.RADAR"]={type:"path",d:"m 115,90 -15,15 0,-15 -15,15 M 80,85 c 0,25 15,35 35,35",fill:!1},G["SI.M1.ANTI-AIRCRAFT FIRE CONTROL"]=e("AA"),G["SI.M1.AIRBORNE SEARCH AND BOMBING"]=e("AB"),G["SI.M1.AIRBORNE INTERCEPT"]=e("AI"),G["SI.M1.ALTIMETER"]=e("AL"),G["SI.M1.AIRBORNE RECONNAISSANCE AND MAPPING"]=e("AM
|