text: // All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  // See http://js.arcgis.com/3.25/esri/copyright.txt for details.
  //>>built
  define("esri/layers/vectorTiles/views/2d/engine/webgl/CIMSymbolDrawHelper","require exports ../../../../core/tsSupport/extendsHelper ../../../../core/tsSupport/decorateHelper ./GeometryUtils ./Rect".split(" "),function(h,l,n,p,q,r){Object.defineProperty(l,"__esModule",{value:!0});var m=function(){function c(a){this._t=a}c.createIdentity=function(){return new c([1,0,0,0,1,0])};c.prototype.clone=function(){return new c(this._t.slice())};c.prototype.transform=function(a){var b=this._t;return[b[0]*a[0]+
  b[1]*a[1]+b[2],b[3]*a[0]+b[4]*a[1]+b[5]]};c.createScale=function(a,b){return new c([a,0,0,0,b,0])};c.prototype.scale=function(a,b){var d=this._t;d[0]*=a;d[1]*=a;d[2]*=a;d[3]*=b;d[4]*=b;d[5]*=b;return this};c.prototype.scaleRatio=function(){return Math.sqrt(this._t[0]*this._t[0]+this._t[1]*this._t[1])};c.createTranslate=function(a,b){return new c([0,0,a,0,0,b])};c.prototype.translate=function(a,b){var d=this._t;d[2]+=a;d[5]+=b;return this};c.createRotate=function(a){var b=Math.cos(a);a=Math.sin(a);
  return new c([b,-a,0,a,b,0])};c.prototype.rotate=function(a){return this.multiply(c.createRotate(a))};c.prototype.multiply=function(a){var b=this._t;a=a._t;var d=b[1]*a[0]+b[4]*a[1],t=b[2]*a[0]+b[5]*a[1]+a[2],c=b[0]*a[3]+b[3]*a[4],f=b[1]*a[3]+b[4]*a[4],e=b[2]*a[3]+b[5]*a[4]+a[5];b[0]=b[0]*a[0]+b[3]*a[1];b[1]=d;b[2]=t;b[3]=c;b[4]=f;b[5]=e;return this};return c}();l.Transformation=m;h=function(){function c(a){this._transfos=[];this._sizeTransfos=[];this._transfos.push(a||m.createIdentity());this._sizeTransfos.push(a?
  a.scaleRatio():1)}c.prototype.transformPt=function(a){return this._transfos[this._transfos.length-1].transform(a)};c.prototype.transformSize=function(a){return a*this._sizeTransfos[this._sizeTransfos.length-1]};c.prototype.back=function(){return this._transfos[this._transfos.length-1]};c.prototype.push=function(a){var b=a.scaleRatio();a.multiply(this.back());this._transfos.push(a);this._sizeTransfos.push(this._sizeTransfos[this._sizeTransfos.length-1]*b)};c.prototype.pop=function(){this._transfos.splice(-1,
  1);this._sizeTransfos.splice(-1,1)};c.prototype.drawSolidFill=function(a,b){};c.prototype.drawSolidStroke=function(a,b,d){};c.prototype.drawSymbol=function(a,b){if(a)switch(a.type){case "CIMPointSymbol":case "CIMLineSymbol":case "CIMPolygonSymbol":this.drawMultiLayerSymbol(a,b)}};c.prototype.drawMultiLayerSymbol=function(a,b){if(a&&(a=a.symbolLayers))for(var d=a.length;d--;){var c=a[d];if(c&&c.enable)switch(c.type){case "CIMSolidFill":this.drawSolidFill(b,c.color);break;case "CIMSolidStroke":this.drawSolidStroke(b,
  c.color,c.width);break;case "CIMVectorMarker":this.drawVectorMarker(c,b)}}};c.prototype.drawVectorMarker=function(a,b){if(a){var d=a.markerGraphics;if(d){var c=a.size,k=a.frame,f=k?k.ymax-k.ymin:0,f=c&&f?c/f:1,e=m.createIdentity();k&&e.translate(.5*-(k.xmax+k.xmin),.5*-(k.ymax+k.ymin));var g=a.anchorPt;if(g){var h=g.x,g=g.y;"relative"===a.anchorPtUnits&&k&&(h*=(k.xmax-k.xmin)*f,g*=c);e.translate(-h,-g)}1!==f&&e.scale(f,f);a.rotation&&e.rotate(a.rotation*q.C_DEG_TO_RAD);e.translate(a.offsetX||0,a.offsetY||
  0);e.translate(b.x,b.y);this.push(e);for(a=0;a<d.length;a++)(b=d[a])&&this.drawSymbol(b.symbol,b.geometry);this.pop()}}};return c}();l.CIMSymbolDrawHelper=h;p=function(c){function a(){var b=c.call(this)||this;b._xmin=b._ymin=Infinity;b._xmax=b._ymax=-Infinity;return b}n(a,c);a.prototype.envelope=function(){return new r(this._xmin,this._ymin,this._xmax-this._xmin,this._ymax-this._ymin)};a.prototype._merge=function(b,a){b[0]-a<this._xmin&&(this._xmin=b[0]-a);b[0]+a>this._xmax&&(this._xmax=b[0]+a);b[1]-
  a<this._ymin&&(this._ymin=b[1]-a);b[1]+a>this._ymax&&(this._ymax=b[1]+a)};a.prototype.drawSolidFill=function(a,d){d=0;for(a=a.rings;d<a.length;d++){var b=a[d],c=b?b.length:0;if(2<c){this._merge(this.transformPt(b[0]),0);for(var f=1;f<c;++f)this._merge(this.transformPt(b[f]),0)}}};a.prototype.drawSolidStroke=function(a,d,c){d=.5*this.transformSize(c);c=0;for(a=a.rings||a.paths;c<a.length;c++){var b=a[c],f=b?b.length:0;if(1<f){this._merge(this.transformPt(b[0]),d);for(var e=1;e<f;++e)this._merge(this.transformPt(b[e]),
  d)}}};return a}(h);l.EnvDrawHelper=p;h=function(c){function a(a,d){d=c.call(this,d)||this;d._ctx=a;return d}n(a,c);a.prototype.drawSolidFill=function(a,c){var b=this._ctx;b.fillStyle="rgba("+Math.round(c[0])+","+Math.round(c[1])+","+Math.round(c[2])+","+c[3]/255+")";b.beginPath();c=0;for(a=a.rings;c<a.length;c++){var d=a[c],f=d?d.length:0;if(2<f){var e=this.transformPt(d[0]);b.moveTo(e[0],e[1]);for(var g=1;g<f;++g)e=this.transformPt(d[g]),b.lineTo(e[0],e[1]);b.closePath()}}b.fill("evenodd")};a.prototype.drawSolidStroke=
  function(a,c,h){var b=this._ctx;b.strokeStyle="rgba("+Math.round(c[0])+","+Math.round(c[1])+","+Math.round(c[2])+","+c[3]/255+")";b.lineWidth=this.transformSize(h)+.5;b.beginPath();c=!!a.rings;h=0;for(a=a.rings||a.paths;h<a.length;h++){var d=a[h],e=d?d.length:0;if(1<e){var g=this.transformPt(d[0]);b.moveTo(g[0],g[1]);for(var l=1;l<e;++l)g=this.transformPt(d[l]),b.lineTo(g[0],g[1]);c&&b.closePath()}}b.stroke()};return a}(h);l.CanvasDrawHelper=h});