// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
define("esri/dijit/SymbolStyler/symbolUtil","../../symbol ../../symbols/utils dojo/Deferred dojo/dom-construct dojo/on dojox/gfx".split(" "),function(g,l,p,m,n,q){var f={_pureOutlineStyles:"x,cross",isPoint:function(a){return f.isType(a,"marker")},isType:function(a,b){return a&&-1<a.type.indexOf(b+"symbol")},isLine:function(a){return f.isType(a,"line")},isPolygon:function(a){return f.isType(a,"fill")},hasPureOutlineStyle:function(a){return a&&-1<f._pureOutlineStyles.indexOf(a.style)},getOutline:function(a){return"simplelinesymbol"===
a.type||"cartographiclinesymbol"===a.type?a:a.outline},cloneSymbol:function(a){return g.jsonUtils.fromJson(a.toJson())},setOutlineWidth:function(a,b){!isNaN(b)&&a&&f.getOutline(a).setWidth(b)},setOutlineStyle:function(a,b){if(b&&a){var c=f.getOutline(a);b=c.color?b:g.SimpleLineSymbol.STYLE_NULL;c.setStyle(b)}},setLineMarker:function(a,b){a&&f.getOutline(a).setMarker(b)},setSize:function(a,b){if(a&&!isNaN(b)){var c=a.width,d=b,e;c!=d&&("picturemarkersymbol"===a.type?(e=a.url,b=f.preserveAspectRatio({dimensions:a,
targetDimension:"width",targetSize:d}),a.setHeight(b.height),a.setWidth(b.width),!e||"http://"===e||-1===e.indexOf("http://")&&-1===e.indexOf("data:")||!a.xoffset&&!a.yoffset||(d=a.width,c=d/c,a.setOffset(Math.round(a.xoffset*c),Math.round(a.yoffset*c)))):a.setSize(d))}},getMarkerLength:function(a){return isNaN(a.width)?a.size:a.width},hasColor:function(a){return a&&a.color},setFillColor:function(a,b){a.setColor(b)},setOutlineColor:function(a,b){f.getOutline(a).setColor(b)},renderOnSurface:function(a,
b){if(a){var c=80,d=30,e=f.isLine(a),k=a.outline?1.5*a.outline.width:1,h;if(e)c=250,d=a.marker?5.5*a.width:a.width;else if("simplemarkersymbol"===a.type)d=c=a.size;else if("picturemarkersymbol"===a.type){if(!a.url||"http://"===a.url||-1===a.url.indexOf("http://")&&-1===a.url.indexOf("https://")&&-1===a.url.indexOf("data:"))return;c=a.width;d=a.height}c+=k;d+=k;k=q.createSurface(b,c,d);h=g.jsonUtils.getShapeDescriptors(a);e&&(h.defaultShape.path="M -90,0 L 90,0 E");h=k.createShape(h.defaultShape).setFill(h.fill).setStroke(h.stroke);
e&&l.applyLineMarker(h,a,null,this._acquireSVGMarker);h.applyTransform({dx:.5*c,dy:.5*d});return k}},_acquireSVGMarker:function(a,b,c,d){b=l.createSVGMarker(b,"symbol-util__marker--"+d,c,d);a.getParent().defNode.appendChild(b);return b},preserveAspectRatio:function(a){var b=a.dimensions,c=a.targetSize;return"height"===("height"===a.targetDimension?"height":"width")?{height:c,width:b.width/b.height*c}:{height:b.height/b.width*c,width:c}},toFullLineStyle:function(a){switch(a){case "dot":a=g.SimpleLineSymbol.STYLE_DOT;
break;case "dash":a=g.SimpleLineSymbol.STYLE_DASH;break;case "dashdot":a=g.SimpleLineSymbol.STYLE_DASHDOT;break;case "longdashdotdot":a=g.SimpleLineSymbol.STYLE_DASHDOTDOT;break;default:a=g.SimpleLineSymbol.STYLE_SOLID}return a},toLineMarker:function(a){return a&&"none"!==a?{style:"arrow",placement:a}:null},testImageUrl:function(a){var b=new p,c=m.create("img"),d,e;d=n(c,"load",function(){0===c.width&&0===c.height?b.reject("image has both width and height of 0"):b.resolve({width:c.width,height:c.height})});
e=n(c,"error",function(a){b.reject("error ocurred while loading image",a)});c.src=a;b.promise.always(function(){d.remove();e.remove();m.destroy(c)});return b.promise}};return f});