{"size": 4871, "ext": "js", "max_stars_repo_path": "libs/arcgis_js_api_3.34/esri/layers/vectorTiles/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js", "max_stars_repo_name": "GitHubYangZhiwen/arcgis-js-siteapp-3.x", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "libs/arcgis_js_api_3.34/esri/layers/vectorTiles/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js", "max_issues_repo_name": "GitHubYangZhiwen/arcgis-js-siteapp-3.x", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "libs/arcgis_js_api_3.34/esri/layers/vectorTiles/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate.js", "max_forks_repo_name": "GitHubYangZhiwen/arcgis-js-siteapp-3.x", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 374.6923076923, "max_line_length": 525, "alphanum_fraction": 0.7199753644}
// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.34/esri/copyright.txt for details.
//>>built
define("esri/layers/vectorTiles/views/2d/engine/webgl/mesh/templates/WGLMarkerTemplate","require exports ../../../../../../core/tsSupport/extendsHelper ../../../../../../core/Logger ../../../../../../core/screenUtils ../../../../../../core/libs/gl-matrix/mat2d ../../../../../../core/libs/gl-matrix/vec2 ../../color ../../definitions ../../enums ../../number ../../WGLDisplayRecord ./WGLMeshTemplate".split(" "),function(u,A,C,D,t,y,v,B,E,w,r,F,G){Object.defineProperty(A,"__esModule",{value:!0});var z=
D.getLogger("esri.views.2d.engine.webgl.WGLMeshTemplate");u=function(u){function d(c,a,b,n,h,m,l,k,f,d,p){if(255<l||255<k)z.error("mapview-oversized-resource","Marker size was clamped to the maximum allowed value of 200x200 pixels"),l>k?(k*=255/l,l=255):(l*=255/k,k=255);var g=u.call(this)||this;g.geometryType=w.WGLGeometryType.MARKER;var e=v.create(),q=y.create(),x=p.sdf?.5:1;y.translate(q,q,new Float32Array([x*b,x*-n]));h&&y.rotate(q,q,3.14159265359/180*h);g._materialStore=c;g.vvFlags=a;g._materialId=
c.createSpriteMaterial(p,g.geometryType,a);g._fillColor=m;g._outlineColor=f;g._sizeOutlineWidth=r.i8888to32(l,k,d,0);c=Math.round(p.rect.x/4);a=Math.round(p.rect.y/4);h=c+Math.round(p.rect.width/4);p=a+Math.round(p.rect.height/4);e.set([-.5*l,-.5*k]);v.transformMat2d(e,e,q);g._offsetUpperLeft=r.i1616to32(e[0],e[1]);g._texUpperLeft=r.i8888to32(c,a,0,0);e.set([.5*l,-.5*k]);v.transformMat2d(e,e,q);g._offsetUpperRight=r.i1616to32(e[0],e[1]);g._texUpperRight=r.i8888to32(h,a,0,0);e.set([-.5*l,.5*k]);v.transformMat2d(e,
e,q);g._offsetBottomLeft=r.i1616to32(e[0],e[1]);g._texBottomLeft=r.i8888to32(c,p,0,0);e.set([.5*l,.5*k]);v.transformMat2d(e,e,q);g._offsetBottomRight=r.i1616to32(e[0],e[1]);g._texBottomRight=r.i8888to32(h,p,0,0);g.height=k;g.width=l;g.xOffset=b;g.yOffset=n;return g}C(d,u);d.fromPictureMarker=function(c,a,b,n,h){h=Math.round(t.pt2px(b.width));var m=Math.round(t.pt2px(b.height)),l=E.PICTURE_FILL_COLOR,k=Math.round(t.pt2px(b.xoffset||0)),f=Math.round(t.pt2px(b.yoffset||0));return new d(c,a,k,f,b.angle,
l,h,m,0,0,n)};d.fromSimpleMarker=function(c,a,b,n,h){h=B.premultiplyAlphaRGBA(b.color);var m=Math.round(t.pt2px(b.size)),l=Math.round(t.pt2px(b.xoffset||0)),k=Math.round(t.pt2px(b.yoffset||0)),f=b.outline,x=(f&&f.color&&B.premultiplyAlphaRGBA(f.color))|0,f=(f&&f.width&&Math.round(t.pt2px(f.width)))|0;return new d(c,a,l,k,b.angle,h,m,m,x,f,n)};d.prototype.writeMesh=function(c,a,b,n,h,m,l){m=this._materialStore.get(this._materialId);var k=a.indexVector;a=a.get("geometry");var f=new F(n,this.geometryType,
this._materialId),d=this._getOffset(a,m);c.push(f);f.vertexFrom=d;f.indexFrom=k.length;switch(b){case "esriGeometryPoint":b=h.geometry;c=b.x;b=b.y;this._writeVertices(f,a,n,this._getPos(c,b),m,l);this._writeIndices(f,k,d);break;case "esriGeometryPolyline":this._writeMany(f,k,a,d,n,h.geometry.paths[0],m,l);break;case "esriGeometryPolygon":(b=h.centroid)?(c=b.x,b=b.y,this._writeVertices(f,a,n,this._getPos(c,b),m,l),this._writeIndices(f,k,d)):z.error("Tried to render polygon geometries as markers, but found no centroid!");
break;case "esriGeometryMultipoint":this._writeMany(f,k,a,d,n,h.geometry.points,m,l);break;default:z.error("Unable to handle geometryType: "+b)}};d.prototype._getPos=function(c,a){return r.i1616to32(c,a)};d.prototype._writeMany=function(c,a,b,d,h,m,l,k){for(var f=0,n=0,p=0,g=0;g<m.length;g++){var e=m[g],q=e[0],e=e[1];this._writeVertices(c,b,h,this._getPos(q+f,e+n),l,k);this._writeIndices(c,a,d+p);f+=q;n+=e;p+=4}};d.prototype._getOffset=function(c,a){a=a.materialKeyInfo.hasVV()?11:7;return c.length/
a};d.prototype._writeVertices=function(c,a,b,d,h,m){a.push(d);a.push(this._offsetUpperLeft);a.push(this._texUpperLeft);a.push(b);a.push(this._fillColor);a.push(this._outlineColor);a.push(this._sizeOutlineWidth);this._writeVV(a,m,h);a.push(d);a.push(this._offsetUpperRight);a.push(this._texUpperRight);a.push(b);a.push(this._fillColor);a.push(this._outlineColor);a.push(this._sizeOutlineWidth);this._writeVV(a,m,h);a.push(d);a.push(this._offsetBottomLeft);a.push(this._texBottomLeft);a.push(b);a.push(this._fillColor);
a.push(this._outlineColor);a.push(this._sizeOutlineWidth);this._writeVV(a,m,h);a.push(d);a.push(this._offsetBottomRight);a.push(this._texBottomRight);a.push(b);a.push(this._fillColor);a.push(this._outlineColor);a.push(this._sizeOutlineWidth);this._writeVV(a,m,h);c.vertexCount+=4};d.prototype._writeVV=function(c,a,b){b.materialKeyInfo.hasVV()&&(c.push(a[w.VVType.SIZE]),c.push(a[w.VVType.COLOR]),c.push(a[w.VVType.OPACITY]),c.push(a[w.VVType.ROTATION]))};d.prototype._writeIndices=function(c,a,b){a.push(b+
0);a.push(b+1);a.push(b+2);a.push(b+1);a.push(b+3);a.push(b+2);c.indexCount+=6};return d}(G.default);A.default=u});