@armyc2.c5isr.renderer/mil-sym-ts-web 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/C5Ren.umd.js CHANGED
@@ -66,7 +66,7 @@ May denote: 1) local/remote status 2) engagement status 3) weapon type.`;case e.
66
66
  `;let re,ie=i.getImageBounds().getX()*-1,U=i.getImageBounds().getY()*-1,ae=i.getSymbolCenterPoint(),W=i.getImageBounds();(ie>0||U>0)&&(Me.offset(ae,ie,U),Me.offset(M,ie,U),Me.offset(W,ie,U),re=`<g transform="translate(`+ie+`,`+U+`)">
67
67
  `),W.setRect(W.getX(),W.getY(),V,H),i=new ee(i.getSVG(),ae,M,W);let oe=``;oe+=k,oe+=this.makeDescTag(i),oe+=this.makeMetadataTag(e,i),re!=null&&(oe+=re),oe+=i.getSVG(),re!=null&&(oe+=`
68
68
  </g>`),oe+=`
69
- </svg>`,i=new ee(oe.toString().valueOf(),ae,M,W)}catch(e){if(e instanceof Error)r.LogException(`SinglePointSVGRenderer`,`renderUnit`,e);else throw e}return i}RenderSP(e,t,n){let i=null,a=50,o=null,s=null,c=-1,l=!0,u=!1,d=!1,f=!1,p=!1,m=null,h=null,g=null,_=null,x=null,S=0,C=0,w=0,D=0,O=null,k=0,M=null;try{m=A.getInstance().getMSLInfo(e);let r=E.getSymbolSet(e),N=E.getEntityCode(e),F=0,I=!1;if(m?.getDrawRule(),b.getInstance().getActionPointDefaultFill()&&((j.isActionPoint(e)||Math.round(N/100)===2135||N===180100||N===180200||N===180400)&&E.getSymbolSet(e)===E.SymbolSet_ControlMeasure&&(o=`#000000`,I=!0),o??=y.colorToHexString(j.getDefaultLineColor(e),!1)),n!=null&&(n.has(P.PixelSize)&&(a=parseInt(n.get(P.PixelSize))),n.has(P.LineColor)&&(o=n.get(P.LineColor)),n.has(P.FillColor)&&(s=n.get(P.FillColor)),n.has(P.Alpha)&&(c=parseInt(n.get(P.Alpha))),n.has(P.DrawAsIcon)&&(u=n.get(P.DrawAsIcon).toLowerCase()===`true`),n.has(P.KeepUnitRatio)&&(l=n.get(P.KeepUnitRatio).toLowerCase()===`true`),u===!0||I===!0||(p=n.has(P.OutlineSymbol)?n.get(P.OutlineSymbol).toLowerCase()===`true`:b.getInstance().getOutlineSPControlMeasures(),r==25&&N>=36e4&&N<360400&&(p=!1)),j.isMultiPoint(e)&&(p=!1)),r===E.SymbolSet_ControlMeasure&&N===270701&&(F=E.getModifier1(e),F>=13&&F<=50||(e=E.setModifier1(e,13))),i==null){let t=E.getVersion(e),n;if(h=T.getMainIconID(e),g=T.getInstance().getSVGLInfo(h,t),g==null)return null;_=T.getMod1ID(e),x=T.getInstance().getSVGLInfo(_,t);let r=0;if(p&&g!=null&&(r=y.findWidestStrokeWidth(g.getSVG())),j.getBasicSymbolID(e).startsWith(`461206`)){let e=g.getBbox().getHeight()*.025,t=g.getBbox().getWidth()*.025;g.getBbox().setRect(g.getBbox().getX(),g.getBbox().getY()-e,g.getBbox().getWidth()+t,g.getBbox().getHeight()+e)}S=Math.floor(g.getBbox().getY()),C=Math.floor(g.getBbox().getX()),w=Math.ceil(g.getBbox().getWidth()+(g.getBbox().getX()-C)),D=Math.ceil(g.getBbox().getHeight()+(g.getBbox().getY()-S));let c;if(l){let t=Math.max(w/D,D/w);t<1.2&&(t=1.2),t>2&&(t=2),j.isCBRNEvent(e)||(a=Math.ceil(a/1.5*t))}if(I){let t;t=s??y.colorToHexString(j.getFillColorOfAffiliation(e),!1),g=new v(g.getID(),g.getBbox(),g.getSVG().replaceAll(`fill="none"`,`fill="`+t+`"`))}if(g=y.setAffiliationDashArray(e,g),m.getSymbolSet()===E.SymbolSet_ControlMeasure&&(o!=null||s!=null)?(c=p?y.setSVGSPCMColors(e,g.getSVG(),y.getIdealOutlineColor(y.getColorFromHexString(o)),y.getColorFromHexString(s),!0):``,c+=y.setSVGSPCMColors(e,g.getSVG(),y.getColorFromHexString(o),y.getColorFromHexString(s),!1)):c=g.getSVG(),E.getEntityCode(e)===270701&&x!=null&&(p&&(c+=y.setSVGSPCMColors(_,x.getSVG(),y.getIdealOutlineColor(y.getColorFromHexString(`#00A651`)),y.getColorFromHexString(`#00A651`),!0)),c+=y.setSVGSPCMColors(_,x.getSVG(),y.getColorFromHexString(o),y.getColorFromHexString(s),!1)),a>0){M=Ae.toRectangle2D(C,S,w,D),n=Ae.copyRect(M);let e=a,t=n.getHeight(),i=n.getWidth();k=Math.min(e/t,e/i),M=Ae.toRectangle2D(0,0,i*k,t*k),i=M.getWidth(),t=M.getHeight(),r>t*.1?r=t*.1:r>i*.1&&(r=i*.1)}let u,d=0;m.getSymbolSet()===E.SymbolSet_ControlMeasure&&p&&r!==0&&(u=Ae.toRectangle2D(0,0,(n.getWidth()+r)*k,(n.getHeight()+r)*k),M=u,d=r/2,Ae.grow(n,d));let f=``;j.isActionPoint(e)&&(f=` stroke-linejoin="round" `);let b=``;g!=null&&(b+=`<g transform="translate(`+n.getX()*-k+`,`+n.getY()*-k+`) scale(`+k+`,`+k+`)"`+f+`>`,b+=c,b+=`</g>`);let O=j.getCMSymbolAnchorPoint(e,Ae.makeRectangle2DFromRect(0,0,M.getWidth(),M.getHeight()));i=new ee(b.toString().valueOf(),O.toPoint2D(),M,M)}let L=null;d=Re.hasDisplayModifiers(e,t),f=Re.hasTextModifiers(e,t),j.isMultiPoint(e)&&(f=!1,d=!1);let R;if(d||f){let e=Be.getCanvas(2,2);R=Be.getContext(e)}if(u===!1&&(f||d)){let r,a=y.getColorFromHexString(o);r=j.isSPWithSpecialModifierLayout(e)?Re.ProcessTGSPWithSpecialModifierLayout(i,e,t,n,a,R):Re.ProcessTGSPModifiers(i,e,t,n,a,R),L=r instanceof ee?r:null}L!=null&&(i=L),L=null;let z=``;c>=0&&c<=255&&(z=` opacity="`+c/255+`"`),O=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="`+i.getImageBounds().getWidth()+`" height="`+i.getImageBounds().getHeight()+`" viewBox="0 0 `+i.getImageBounds().getWidth()+` `+i.getImageBounds().getHeight()+`"`+z+`>
69
+ </svg>`,i=new ee(oe.toString().valueOf(),ae,M,W)}catch(e){if(e instanceof Error)r.LogException(`SinglePointSVGRenderer`,`renderUnit`,e);else throw e}return i}RenderSP(e,t,n){let i=null,a=50,o=null,s=null,c=-1,l=!0,u=!1,d=!1,f=!1,p=!1,m=null,h=null,g=null,_=null,x=null,S=0,C=0,w=0,D=0,O=null,k=0,M=null;try{m=A.getInstance().getMSLInfo(e);let r=E.getSymbolSet(e),N=E.getEntityCode(e),F=0,I=!1;if(m?.getDrawRule(),b.getInstance().getActionPointDefaultFill()&&(j.isActionPoint(e)||Math.round(N/100)===2135||N===180100||N===180200||N===180400)&&E.getSymbolSet(e)===E.SymbolSet_ControlMeasure&&(o=`#000000`,I=!0),o??=y.colorToHexString(j.getDefaultLineColor(e),!1),n!=null&&(n.has(P.PixelSize)&&(a=parseInt(n.get(P.PixelSize))),n.has(P.LineColor)&&(o=n.get(P.LineColor)),n.has(P.FillColor)&&(s=n.get(P.FillColor)),n.has(P.Alpha)&&(c=parseInt(n.get(P.Alpha))),n.has(P.DrawAsIcon)&&(u=n.get(P.DrawAsIcon).toLowerCase()===`true`),n.has(P.KeepUnitRatio)&&(l=n.get(P.KeepUnitRatio).toLowerCase()===`true`),u===!0||I===!0||(p=n.has(P.OutlineSymbol)?n.get(P.OutlineSymbol).toLowerCase()===`true`:b.getInstance().getOutlineSPControlMeasures(),r==25&&N>=36e4&&N<360400&&(p=!1)),j.isMultiPoint(e)&&(p=!1)),r===E.SymbolSet_ControlMeasure&&N===270701&&(F=E.getModifier1(e),F>=13&&F<=50||(e=E.setModifier1(e,13))),i==null){let t=E.getVersion(e),n;if(h=T.getMainIconID(e),g=T.getInstance().getSVGLInfo(h,t),g==null)return null;_=T.getMod1ID(e),x=T.getInstance().getSVGLInfo(_,t);let r=0;if(p&&g!=null&&(r=y.findWidestStrokeWidth(g.getSVG())),j.getBasicSymbolID(e).startsWith(`461206`)){let e=g.getBbox().getHeight()*.025,t=g.getBbox().getWidth()*.025;g.getBbox().setRect(g.getBbox().getX(),g.getBbox().getY()-e,g.getBbox().getWidth()+t,g.getBbox().getHeight()+e)}S=Math.floor(g.getBbox().getY()),C=Math.floor(g.getBbox().getX()),w=Math.ceil(g.getBbox().getWidth()+(g.getBbox().getX()-C)),D=Math.ceil(g.getBbox().getHeight()+(g.getBbox().getY()-S));let c;if(l){let t=Math.max(w/D,D/w);t<1.2&&(t=1.2),t>2&&(t=2),j.isCBRNEvent(e)||(a=Math.ceil(a/1.5*t))}if(I){let t;t=s??y.colorToHexString(j.getFillColorOfAffiliation(e),!1),g=new v(g.getID(),g.getBbox(),g.getSVG().replaceAll(`fill="none"`,`fill="`+t+`"`))}if(g=y.setAffiliationDashArray(e,g),m.getSymbolSet()===E.SymbolSet_ControlMeasure&&(o!=null||s!=null)?(c=p?y.setSVGSPCMColors(e,g.getSVG(),y.getIdealOutlineColor(y.getColorFromHexString(o)),y.getColorFromHexString(s),!0):``,c+=y.setSVGSPCMColors(e,g.getSVG(),y.getColorFromHexString(o),y.getColorFromHexString(s),!1)):c=g.getSVG(),E.getEntityCode(e)===270701&&x!=null&&(p&&(c+=y.setSVGSPCMColors(_,x.getSVG(),y.getIdealOutlineColor(y.getColorFromHexString(`#00A651`)),y.getColorFromHexString(`#00A651`),!0)),c+=y.setSVGSPCMColors(_,x.getSVG(),y.getColorFromHexString(o),y.getColorFromHexString(s),!1)),a>0){M=Ae.toRectangle2D(C,S,w,D),n=Ae.copyRect(M);let e=a,t=n.getHeight(),i=n.getWidth();k=Math.min(e/t,e/i),M=Ae.toRectangle2D(0,0,i*k,t*k),i=M.getWidth(),t=M.getHeight(),r>t*.1?r=t*.1:r>i*.1&&(r=i*.1)}let u,d=0;m.getSymbolSet()===E.SymbolSet_ControlMeasure&&p&&r!==0&&(u=Ae.toRectangle2D(0,0,(n.getWidth()+r)*k,(n.getHeight()+r)*k),M=u,d=r/2,Ae.grow(n,d));let f=``;j.isActionPoint(e)&&(f=` stroke-linejoin="round" `);let b=``;g!=null&&(b+=`<g transform="translate(`+n.getX()*-k+`,`+n.getY()*-k+`) scale(`+k+`,`+k+`)"`+f+`>`,b+=c,b+=`</g>`);let O=j.getCMSymbolAnchorPoint(e,Ae.makeRectangle2DFromRect(0,0,M.getWidth(),M.getHeight()));i=new ee(b.toString().valueOf(),O.toPoint2D(),M,M)}let L=null;d=Re.hasDisplayModifiers(e,t),f=Re.hasTextModifiers(e,t),j.isMultiPoint(e)&&(f=!1,d=!1);let R;if(d||f){let e=Be.getCanvas(2,2);R=Be.getContext(e)}if(u===!1&&(f||d)){let r,a=y.getColorFromHexString(o);r=j.isSPWithSpecialModifierLayout(e)?Re.ProcessTGSPWithSpecialModifierLayout(i,e,t,n,a,R):Re.ProcessTGSPModifiers(i,e,t,n,a,R),L=r instanceof ee?r:null}L!=null&&(i=L),L=null;let z=``;c>=0&&c<=255&&(z=` opacity="`+c/255+`"`),O=`<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="`+i.getImageBounds().getWidth()+`" height="`+i.getImageBounds().getHeight()+`" viewBox="0 0 `+i.getImageBounds().getWidth()+` `+i.getImageBounds().getHeight()+`"`+z+`>
70
70
  `;let B,te=i.getImageBounds().getX()*-1,V=i.getImageBounds().getY()*-1,H=i.getSymbolCenterPoint(),ne=i.getImageBounds();(te>0||V>0)&&(Me.offset(H,te,V),Me.offset(M,te,V),Me.offset(ne,te,V),B=`<g transform="translate(`+te+`,`+V+`)">
71
71
  `),i=new ee(i.getSVG(),H,M,ne);let re=``;re+=O,re+=this.makeDescTag(i),re+=this.makeMetadataTag(e,i),B!=null&&(re+=B),re+=i.getSVG(),B!=null&&(re+=`
72
72
  </g>`),re+=`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armyc2.c5isr.renderer/mil-sym-ts-web",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "MIL-STD-2525 D/E symbol rendering TypeScript library",
5
5
  "type": "module",
6
6
  "main": "C5Ren.mjs",