node-red-contrib-jwht-map/worldmap/leaflet/milsymbol.js

27 lines
761 KiB
JavaScript
Raw Normal View History

/**!
* @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
2018-06-01 00:32:29 +08:00
*/
!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.affilia