vml.js
23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//>>built
define("dojo/_base/lang dojo/_base/declare dojo/_base/array dojo/_base/Color dojo/_base/sniff dojo/_base/config dojo/dom dojo/dom-geometry dojo/dom-style dojo/_base/kernel ./_base ./shape ./path ./arc ./gradient ./matrix".split(" "),function(n,k,w,x,t,u,A,B,C,D,h,l,v,E,F,m){function y(a,b,c){c=c||D.global;b.call(c,a);(a instanceof h.Surface||a instanceof h.Group)&&w.forEach(a.children,function(a){y(a,b,c)})}var e=h.vml={},z=function(){e.xmlns="urn:schemas-microsoft-com:vml";try{document.namespaces.add("v",
e.xmlns);var a="* group roundrect oval shape rect imagedata path textpath text".split(" "),b=0,c=1,d=document.createStyleSheet();8<=t("ie")&&(b=1,c=a.length);for(;b<c;++b)d.addRule("v\\:"+a[b],"behavior:url(#default#VML); display:inline-block")}catch(f){setTimeout(z,10)}};z();e.text_alignment={start:"left",middle:"center",end:"right"};e._parseFloat=function(a){return a.match(/^\d+f$/i)?parseInt(a)/65536:parseFloat(a)};e._bool={t:1,"true":1};e._reparentEvents=function(a,b){for(var c in b)"on"==c.substr(0,
2).toLowerCase()&&(a[c]=b[c],b[c]=null)};e.Shape=k("dojox.gfx.vml.Shape",l.Shape,{setFill:function(a){if(!a)return this.fillStyle=null,this.rawNode.filled="f",this;var b,c,d;if("object"==typeof a&&"type"in a){switch(a.type){case "linear":var f=this._getRealMatrix(),g=this.getBoundingBox(),e=this._getRealBBox?this._getRealBBox():this.getTransformedBoundingBox();d=[];this.fillStyle!==a&&(this.fillStyle=h.makeParameters(h.defaultLinearGradient,a));a=h.gradient.project(f,this.fillStyle,{x:g.x,y:g.y},
{x:g.x+g.width,y:g.y+g.height},e[0],e[2]);c=a.colors;"0.00000"!=c[0].offset.toFixed(5)&&d.push("0 "+h.normalizeColor(c[0].color).toHex());for(b=0;b<c.length;++b)d.push(c[b].offset.toFixed(5)+" "+h.normalizeColor(c[b].color).toHex());b=c.length-1;"1.00000"!=c[b].offset.toFixed(5)&&d.push("1 "+h.normalizeColor(c[b].color).toHex());b=this.rawNode.fill;b.colors.value=d.join(";");b.method="sigma";b.type="gradient";b.angle=(270-m._radToDeg(a.angle))%360;b.on=!0;break;case "radial":this.fillStyle=a=h.makeParameters(h.defaultRadialGradient,
a);var f=parseFloat(this.rawNode.style.left),g=parseFloat(this.rawNode.style.top),e=parseFloat(this.rawNode.style.width),r=parseFloat(this.rawNode.style.height),k=isNaN(e)?1:2*a.r/e;c=[];0<a.colors[0].offset&&c.push({offset:1,color:h.normalizeColor(a.colors[0].color)});w.forEach(a.colors,function(a,b){c.push({offset:1-a.offset*k,color:h.normalizeColor(a.color)})});for(b=c.length-1;0<=b&&0>c[b].offset;)--b;if(b<c.length-1){d=c[b];var l=c[b+1];l.color=x.blendColors(d.color,l.color,d.offset/(d.offset-
l.offset));for(l.offset=0;2<c.length-b;)c.pop()}b=c.length-1;d=[];for(0<c[b].offset&&d.push("0 "+c[b].color.toHex());0<=b;--b)d.push(c[b].offset.toFixed(5)+" "+c[b].color.toHex());b=this.rawNode.fill;b.colors.value=d.join(";");b.method="sigma";b.type="gradientradial";isNaN(e)||isNaN(r)||isNaN(f)||isNaN(g)?b.focusposition="0.5 0.5":b.focusposition=((a.cx-f)/e).toFixed(5)+" "+((a.cy-g)/r).toFixed(5);b.focussize="0 0";b.on=!0;break;case "pattern":this.fillStyle=a=h.makeParameters(h.defaultPattern,a),
b=this.rawNode.fill,b.type="tile",b.src=a.src,a.width&&a.height&&(b.size.x=h.px2pt(a.width),b.size.y=h.px2pt(a.height)),b.alignShape="f",b.position.x=0,b.position.y=0,b.origin.x=a.width?a.x/a.width:0,b.origin.y=a.height?a.y/a.height:0,b.on=!0}this.rawNode.fill.opacity=1;return this}this.fillStyle=h.normalizeColor(a);(b=this.rawNode.fill)||(b=this.rawNode.ownerDocument.createElement("v:fill"));b.method="any";b.type="solid";b.opacity=this.fillStyle.a;if(d=this.rawNode.filters["DXImageTransform.Microsoft.Alpha"])d.opacity=
Math.round(100*this.fillStyle.a);this.rawNode.fillcolor=this.fillStyle.toHex();this.rawNode.filled=!0;return this},setStroke:function(a){if(!a)return this.strokeStyle=null,this.rawNode.stroked="f",this;if("string"==typeof a||n.isArray(a)||a instanceof x)a={color:a};a=this.strokeStyle=h.makeParameters(h.defaultStroke,a);a.color=h.normalizeColor(a.color);var b=this.rawNode;b.stroked=!0;b.strokecolor=a.color.toCss();b.strokeweight=a.width+"px";b.stroke&&(b.stroke.opacity=a.color.a,b.stroke.endcap=this._translate(this._capMap,
a.cap),"number"==typeof a.join?(b.stroke.joinstyle="miter",b.stroke.miterlimit=a.join):b.stroke.joinstyle=a.join,b.stroke.dashstyle="none"==a.style?"Solid":a.style);return this},_capMap:{butt:"flat"},_capMapReversed:{flat:"butt"},_translate:function(a,b){return b in a?a[b]:b},_applyTransform:function(){var a=this._getRealMatrix();if(a){var b=this.rawNode.skew;if("undefined"==typeof b)for(var c=0;c<this.rawNode.childNodes.length;++c)if("skew"==this.rawNode.childNodes[c].tagName){b=this.rawNode.childNodes[c];
break}if(b){b.on="f";var c=a.xx.toFixed(8)+" "+a.xy.toFixed(8)+" "+a.yx.toFixed(8)+" "+a.yy.toFixed(8)+" 0 0",a=Math.floor(a.dx).toFixed()+"px "+Math.floor(a.dy).toFixed()+"px",d=this.rawNode.style,f=parseFloat(d.left),g=parseFloat(d.top),e=parseFloat(d.width),d=parseFloat(d.height);isNaN(f)&&(f=0);isNaN(g)&&(g=0);if(isNaN(e)||!e)e=1;if(isNaN(d)||!d)d=1;f=(-f/e-.5).toFixed(8)+" "+(-g/d-.5).toFixed(8);b.matrix=c;b.origin=f;b.offset=a;b.on=!0}}this.fillStyle&&"linear"==this.fillStyle.type&&this.setFill(this.fillStyle);
this.clip&&this.setClip(this.clip);return this},_setDimensions:function(a,b){return this},setRawNode:function(a){a.stroked="f";a.filled="f";this.rawNode=a;this.rawNode.__gfxObject__=this},_moveToFront:function(){this.rawNode.parentNode.appendChild(this.rawNode);return this},_moveToBack:function(){var a=this.rawNode,b=a.parentNode,c=b.firstChild;b.insertBefore(a,c);"rect"==c.tagName&&c.swapNode(a);return this},_getRealMatrix:function(){return this.parentMatrix?new m.Matrix2D([this.parentMatrix,this.matrix]):
this.matrix},setClip:function(a){this.inherited(arguments);var b=this.rawNode.style;if(!a)b.position="absolute",b.clip="rect(0px "+b.width+" "+b.height+" 0px)";else if("width"in a){var c=this._getRealMatrix(),d=parseFloat(b.left),f=parseFloat(b.top);isNaN(d)&&(d=0);isNaN(f)&&(f=0);var g=m.multiplyRectangle(c,a),c=m.multiplyPoint(c,{x:d,y:f});b.clip="rect("+Math.round(g.y-c.y)+"px "+Math.round(g.x-c.x+g.width)+"px "+Math.round(g.y-c.y+g.height)+"px "+Math.round(g.x-c.x)+"px)"}return this}});(function(){var a=
e.Shape,b=a.prototype.setStroke,c=a.prototype.setFill;a.prototype.setStroke=function(){var a=b.apply(this,arguments),c=this.rawNode,c=c&&c.stroke,g=this.getParent();c&&g&&(c.opacity*=void 0!==g._esriIeOpacity&&null!==g._esriIeOpacity?g._esriIeOpacity:1);return a};a.prototype.setFill=function(){var a=c.apply(this,arguments),b=this.rawNode,g=b&&b.fill,e=this.getParent();g&&e&&(e=void 0!==e._esriIeOpacity&&null!==e._esriIeOpacity?e._esriIeOpacity:1,"tile"===g.type?C.set(b,"opacity",e):g.opacity*=e);
return a}})();e.Group=k("dojox.gfx.vml.Group",e.Shape,{constructor:function(){l.Container._init.call(this)},_applyTransform:function(){for(var a=this._getRealMatrix(),b=0;b<this.children.length;++b)this.children[b]._updateParentMatrix(a);this.clip&&this.setClip(this.clip);return this},_setDimensions:function(a,b){var c=this.rawNode,d=c.style,f=this.bgNode.style;d.width=a;d.height=b;c.coordsize=a+" "+b;f.width=a;f.height=b;for(c=0;c<this.children.length;++c)this.children[c]._setDimensions(a,b);return this},
setClip:function(a){this.clip=a;var b=this.rawNode.style;if(!a)b.position="absolute",b.clip="rect(0px "+b.width+" "+b.height+" 0px)";else if("width"in a){var c=this._getRealMatrix();a=m.multiplyRectangle(c,a);var d=this.getBoundingBox(),c=(d=d?m.multiplyRectangle(c,d):null)&&0>d.x?d.x:0,d=d&&0>d.y?d.y:0;b.position="absolute";b.clip="rect("+Math.round(a.y-d)+"px "+Math.round(a.x+a.width-c)+"px "+Math.round(a.y+a.height-d)+"px "+Math.round(a.x-c)+"px)"}return this},destroy:function(){this.clear(!0);
e.Shape.prototype.destroy.apply(this,arguments)}});e.Group.nodeType="group";e.Rect=k("dojox.gfx.vml.Rect",[e.Shape,l.Rect],{setShape:function(a){a=this.shape=h.makeParameters(this.shape,a);this.bbox=null;var b=Math.min(1,a.r/Math.min(parseFloat(a.width),parseFloat(a.height))).toFixed(8),c=this.rawNode.parentNode,d=null;if(c){if(c.lastChild!==this.rawNode)for(var f=0;f<c.childNodes.length;++f)if(c.childNodes[f]===this.rawNode){d=c.childNodes[f+1];break}c.removeChild(this.rawNode)}7<t("ie")?(f=this.rawNode.ownerDocument.createElement("v:roundrect"),
f.arcsize=b,f.style.display="inline-block",e._reparentEvents(f,this.rawNode),this.rawNode=f,this.rawNode.__gfxObject__=this):this.rawNode.arcsize=b;c&&(d?c.insertBefore(this.rawNode,d):c.appendChild(this.rawNode));b=this.rawNode.style;b.left=a.x.toFixed();b.top=a.y.toFixed();b.width="string"==typeof a.width&&0<=a.width.indexOf("%")?a.width:Math.max(a.width.toFixed(),0);b.height="string"==typeof a.height&&0<=a.height.indexOf("%")?a.height:Math.max(a.height.toFixed(),0);return this.setTransform(this.matrix).setFill(this.fillStyle).setStroke(this.strokeStyle)}});
e.Rect.nodeType="roundrect";e.Ellipse=k("dojox.gfx.vml.Ellipse",[e.Shape,l.Ellipse],{setShape:function(a){a=this.shape=h.makeParameters(this.shape,a);this.bbox=null;var b=this.rawNode.style;b.left=(a.cx-a.rx).toFixed();b.top=(a.cy-a.ry).toFixed();b.width=(2*a.rx).toFixed();b.height=(2*a.ry).toFixed();return this.setTransform(this.matrix)}});e.Ellipse.nodeType="oval";e.Circle=k("dojox.gfx.vml.Circle",[e.Shape,l.Circle],{setShape:function(a){a=this.shape=h.makeParameters(this.shape,a);this.bbox=null;
var b=this.rawNode.style;b.left=(a.cx-a.r).toFixed();b.top=(a.cy-a.r).toFixed();b.width=(2*a.r).toFixed();b.height=(2*a.r).toFixed();return this}});e.Circle.nodeType="oval";e.Line=k("dojox.gfx.vml.Line",[e.Shape,l.Line],{constructor:function(a){a&&a.setAttribute("dojoGfxType","line")},setShape:function(a){a=this.shape=h.makeParameters(this.shape,a);this.bbox=null;this.rawNode.path.v="m"+a.x1.toFixed()+" "+a.y1.toFixed()+"l"+a.x2.toFixed()+" "+a.y2.toFixed()+"e";return this.setTransform(this.matrix)}});
e.Line.nodeType="shape";e.Polyline=k("dojox.gfx.vml.Polyline",[e.Shape,l.Polyline],{constructor:function(a){a&&a.setAttribute("dojoGfxType","polyline")},setShape:function(a,b){a&&a instanceof Array?(this.shape=h.makeParameters(this.shape,{points:a}),b&&this.shape.points.length&&this.shape.points.push(this.shape.points[0])):this.shape=h.makeParameters(this.shape,a);this.bbox=null;this._normalizePoints();a=[];b=this.shape.points;if(0<b.length&&(a.push("m"),a.push(b[0].x.toFixed(),b[0].y.toFixed()),
1<b.length)){a.push("l");for(var c=1;c<b.length;++c)a.push(b[c].x.toFixed(),b[c].y.toFixed())}a.push("e");this.rawNode.path.v=a.join(" ");return this.setTransform(this.matrix)}});e.Polyline.nodeType="shape";e.Image=k("dojox.gfx.vml.Image",[e.Shape,l.Image],{setShape:function(a){a=this.shape=h.makeParameters(this.shape,a);this.bbox=null;this.rawNode.firstChild.src=a.src;return this.setTransform(this.matrix)},_applyTransform:function(){var a=this._getRealMatrix(),b=this.rawNode,c=b.style,d=this.shape,
a=a?m.multiply(a,{dx:d.x,dy:d.y}):m.normalize({dx:d.x,dy:d.y});if(0==a.xy&&0==a.yx&&0<a.xx&&0<a.yy)c.filter="",c.width=Math.floor(a.xx*d.width),c.height=Math.floor(a.yy*d.height),c.left=Math.floor(a.dx),c.top=Math.floor(a.dy);else{var f=b.parentNode.style;c.left="0px";c.top="0px";c.width=f.width;c.height=f.height;a=m.multiply(a,{xx:d.width/parseInt(c.width),yy:d.height/parseInt(c.height)});(b=b.filters["DXImageTransform.Microsoft.Matrix"])?(b.M11=a.xx,b.M12=a.xy,b.M21=a.yx,b.M22=a.yy,b.Dx=a.dx,b.Dy=
a.dy):c.filter="progid:DXImageTransform.Microsoft.Matrix(M11\x3d"+a.xx+", M12\x3d"+a.xy+", M21\x3d"+a.yx+", M22\x3d"+a.yy+", Dx\x3d"+a.dx+", Dy\x3d"+a.dy+")"}return this},_setDimensions:function(a,b){var c=this.rawNode;return c.filters["DXImageTransform.Microsoft.Matrix"]?(c=c.style,c.width=a,c.height=b,this._applyTransform()):this}});e.Image.nodeType="rect";e.Text=k("dojox.gfx.vml.Text",[e.Shape,l.Text],{constructor:function(a){a&&a.setAttribute("dojoGfxType","text");this.fontStyle=null},_alignment:{start:"left",
middle:"center",end:"right"},setShape:function(a){this.shape=h.makeParameters(this.shape,a);this.bbox=null;var b=this.rawNode;a=this.shape;var c=a.x,d=a.y.toFixed();switch(a.align){case "middle":c-=5;break;case "end":c-=10}for(var d="m"+c.toFixed()+","+d+"l"+(c+10).toFixed()+","+d+"e",f=null,c=null,g=b.childNodes,q=0;q<g.length;++q){var r=g[q].tagName;if("path"==r){if(f=g[q],c)break}else if("textpath"==r&&(c=g[q],f))break}f||(f=b.ownerDocument.createElement("v:path"),b.appendChild(f));c||(c=b.ownerDocument.createElement("v:textpath"),
b.appendChild(c));f.v=d;f.textPathOk=!0;c.on=!0;b=e.text_alignment[a.align];c.style["v-text-align"]=b?b:"left";c.style["text-decoration"]=a.decoration;c.style["v-rotate-letters"]=a.rotated;c.style["v-text-kern"]=a.kerning;c.string=a.text;return this.setTransform(this.matrix)},_setFont:function(){for(var a=this.fontStyle,b=this.rawNode.childNodes,c=0;c<b.length;++c)if("textpath"==b[c].tagName){b[c].style.font=h.makeFontString(a);break}this.setTransform(this.matrix)},_getRealMatrix:function(){var a=
this.inherited(arguments);a&&(a=m.multiply(a,{dy:.35*-h.normalizedLength(this.fontStyle?this.fontStyle.size:"10pt")}));return a},getTextWidth:function(){var a=this.rawNode,b=a.style.display;a.style.display="inline";var c=h.pt2px(parseFloat(a.currentStyle.width));a.style.display=b;return c}});e.Text.nodeType="shape";e.Path=k("dojox.gfx.vml.Path",[e.Shape,v.Path],{constructor:function(a){a&&!a.getAttribute("dojoGfxType")&&a.setAttribute("dojoGfxType","path");this.vmlPath="";this.lastControl={}},_updateWithSegment:function(a){var b=
n.clone(this.last);this.inherited(arguments);1<arguments.length||(b=this[this.renderers[a.action]](a,b),"string"==typeof this.vmlPath?(this.vmlPath+=b.join(""),this.rawNode.path.v=this.vmlPath+" r0,0 e"):Array.prototype.push.apply(this.vmlPath,b))},setShape:function(a){this.vmlPath=[];this.lastControl.type="";this.inherited(arguments);this.vmlPath=this.vmlPath.join("");this.rawNode.path.v=this.vmlPath+" r0,0 e";return this},_pathVmlToSvgMap:{m:"M",l:"L",t:"m",r:"l",c:"C",v:"c",qb:"Q",x:"z",e:""},
renderers:{M:"_moveToA",m:"_moveToR",L:"_lineToA",l:"_lineToR",H:"_hLineToA",h:"_hLineToR",V:"_vLineToA",v:"_vLineToR",C:"_curveToA",c:"_curveToR",S:"_smoothCurveToA",s:"_smoothCurveToR",Q:"_qCurveToA",q:"_qCurveToR",T:"_qSmoothCurveToA",t:"_qSmoothCurveToR",A:"_arcTo",a:"_arcTo",Z:"_closePath",z:"_closePath"},_addArgs:function(a,b,c,d){for(b=b instanceof Array?b:b.args;c<d;++c)a.push(" ",b[c].toFixed())},_adjustRelCrd:function(a,b,c){b=b instanceof Array?b:b.args;var d=b.length,f=Array(d),g=0,e=
a.x;a=a.y;"number"!=typeof e&&(f[0]=e=b[0],f[1]=a=b[1],g=2);if("number"==typeof c&&2!=c)for(var h=c;h<=d;){for(;g<h;g+=2)f[g]=e+b[g],f[g+1]=a+b[g+1];e=f[h-2];a=f[h-1];h+=c}else for(;g<d;g+=2)f[g]=e+=b[g],f[g+1]=a+=b[g+1];return f},_adjustRelPos:function(a,b){b=b instanceof Array?b:b.args;for(var c=b.length,d=Array(c),f=0;f<c;++f)d[f]=a+=b[f];return d},_moveToA:function(a){var b=[" m"];a=a instanceof Array?a:a.args;var c=a.length;this._addArgs(b,a,0,2);2<c&&(b.push(" l"),this._addArgs(b,a,2,c));this.lastControl.type=
"";return b},_moveToR:function(a,b){return this._moveToA(this._adjustRelCrd(b,a))},_lineToA:function(a){var b=[" l"];a=a instanceof Array?a:a.args;this._addArgs(b,a,0,a.length);this.lastControl.type="";return b},_lineToR:function(a,b){return this._lineToA(this._adjustRelCrd(b,a))},_hLineToA:function(a,b){var c=[" l"];b=" "+b.y.toFixed();a=a instanceof Array?a:a.args;for(var d=a.length,f=0;f<d;++f)c.push(" ",a[f].toFixed(),b);this.lastControl.type="";return c},_hLineToR:function(a,b){return this._hLineToA(this._adjustRelPos(b.x,
a),b)},_vLineToA:function(a,b){var c=[" l"];b=" "+b.x.toFixed();a=a instanceof Array?a:a.args;for(var d=a.length,f=0;f<d;++f)c.push(b," ",a[f].toFixed());this.lastControl.type="";return c},_vLineToR:function(a,b){return this._vLineToA(this._adjustRelPos(b.y,a),b)},_curveToA:function(a){var b=[];a=a instanceof Array?a:a.args;for(var c=a.length,d=this.lastControl,f=0;f<c;f+=6)b.push(" c"),this._addArgs(b,a,f,f+6);d.x=a[c-4];d.y=a[c-3];d.type="C";return b},_curveToR:function(a,b){return this._curveToA(this._adjustRelCrd(b,
a,6))},_smoothCurveToA:function(a,b){var c=[];a=a instanceof Array?a:a.args;var d=a.length,f=this.lastControl,e=0;"C"!=f.type&&(c.push(" c"),this._addArgs(c,[b.x,b.y],0,2),this._addArgs(c,a,0,4),f.x=a[0],f.y=a[1],f.type="C",e=4);for(;e<d;e+=4)c.push(" c"),this._addArgs(c,[2*b.x-f.x,2*b.y-f.y],0,2),this._addArgs(c,a,e,e+4),f.x=a[e],f.y=a[e+1];return c},_smoothCurveToR:function(a,b){return this._smoothCurveToA(this._adjustRelCrd(b,a,4),b)},_qCurveToA:function(a){var b=[];a=a instanceof Array?a:a.args;
for(var c=a.length,d=this.lastControl,f=0;f<c;f+=4)b.push(" qb"),this._addArgs(b,a,f,f+4);d.x=a[c-4];d.y=a[c-3];d.type="Q";return b},_qCurveToR:function(a,b){return this._qCurveToA(this._adjustRelCrd(b,a,4))},_qSmoothCurveToA:function(a,b){var c=[];a=a instanceof Array?a:a.args;var d=a.length,f=this.lastControl,e=0;"Q"!=f.type&&(c.push(" qb"),this._addArgs(c,[f.x=b.x,f.y=b.y],0,2),f.type="Q",this._addArgs(c,a,0,2),e=2);for(;e<d;e+=2)c.push(" qb"),this._addArgs(c,[f.x=2*b.x-f.x,f.y=2*b.y-f.y],0,2),
this._addArgs(c,a,e,e+2);return c},_qSmoothCurveToR:function(a,b){return this._qSmoothCurveToA(this._adjustRelCrd(b,a,2),b)},_arcTo:function(a,b){var c=[],d=a.args,e=d.length;a="a"==a.action;for(var g=0;g<e;g+=7){var h=d[g+5],k=d[g+6];a&&(h+=b.x,k+=b.y);for(var l=E.arcAsBezier(b,d[g],d[g+1],d[g+2],d[g+3]?1:0,d[g+4]?1:0,h,k),n=0;n<l.length;++n){c.push(" c");var m=l[n];this._addArgs(c,m,0,m.length);this._updateBBox(m[0],m[1]);this._updateBBox(m[2],m[3]);this._updateBBox(m[4],m[5])}b.x=h;b.y=k}this.lastControl.type=
"";return c},_closePath:function(){this.lastControl.type="";return["x"]},_getRealBBox:function(){this._confirmSegmented();if(this.tbbox)return this.tbbox;"string"==typeof this.shape.path&&(this.shape.path="");return this.inherited(arguments)}});e.Path.nodeType="shape";e.EsriPath=k("dojox.gfx.vml.EsriPath",e.Path,{setShape:function(a){this.rawNode.path.v=this.vmlPath=a;return this}});e.EsriPath.nodeType="shape";e.TextPath=k("dojox.gfx.vml.TextPath",[e.Path,v.TextPath],{constructor:function(a){a&&a.setAttribute("dojoGfxType",
"textpath");this.fontStyle=null;"text"in this||(this.text=n.clone(h.defaultTextPath));"fontStyle"in this||(this.fontStyle=n.clone(h.defaultFont))},setText:function(a){this.text=h.makeParameters(this.text,"string"==typeof a?{text:a}:a);this._setText();return this},setFont:function(a){this.fontStyle="string"==typeof a?h.splitFontString(a):h.makeParameters(h.defaultFont,a);this._setFont();return this},_setText:function(){this.bbox=null;for(var a=this.rawNode,b=this.text,c=null,d=null,f=a.childNodes,
g=0;g<f.length;++g){var h=f[g].tagName;if("path"==h){if(c=f[g],d)break}else if("textpath"==h&&(d=f[g],c))break}c||(c=this.rawNode.ownerDocument.createElement("v:path"),a.appendChild(c));d||(d=this.rawNode.ownerDocument.createElement("v:textpath"),a.appendChild(d));c.textPathOk=!0;d.on=!0;a=e.text_alignment[b.align];d.style["v-text-align"]=a?a:"left";d.style["text-decoration"]=b.decoration;d.style["v-rotate-letters"]=b.rotated;d.style["v-text-kern"]=b.kerning;d.string=b.text},_setFont:function(){for(var a=
this.fontStyle,b=this.rawNode.childNodes,c=0;c<b.length;++c)if("textpath"==b[c].tagName){b[c].style.font=h.makeFontString(a);break}}});e.TextPath.nodeType="shape";e.Surface=k("dojox.gfx.vml.Surface",l.Surface,{constructor:function(){l.Container._init.call(this)},destroy:function(){this.clear(!0);this.inherited(arguments)},setDimensions:function(a,b){this.width=h.normalizedLength(a);this.height=h.normalizedLength(b);if(!this.rawNode)return this;var c=this.clipNode.style,d=this.rawNode,e=d.style,g=
this.bgNode.style,k=this._parent.style;k.width=a;k.height=b;c.width=a;c.height=b;c.clip="rect(0px "+a+"px "+b+"px 0px)";e.width=a;e.height=b;d.coordsize=a+" "+b;g.width=a;g.height=b;for(c=0;c<this.children.length;++c)this.children[c]._setDimensions(a,b);return this},getDimensions:function(){var a=this.rawNode?{width:h.normalizedLength(this.rawNode.style.width),height:h.normalizedLength(this.rawNode.style.height)}:null;0>=a.width&&(a.width=this.width);0>=a.height&&(a.height=this.height);return a}});
e.createSurface=function(a,b,c){if(!b&&!c){var d=B.position(a);b=b||d.w;c=c||d.h}"number"==typeof b&&(b+="px");"number"==typeof c&&(c+="px");d=new e.Surface;a=A.byId(a);var f=d.clipNode=a.ownerDocument.createElement("div"),g=d.rawNode=a.ownerDocument.createElement("v:group"),k=f.style,l=g.style;7<t("ie")&&(l.display="inline-block");d._parent=a;d._nodes.push(f);a.style.width=b;a.style.height=c;k.position="absolute";k.width=b;k.height=c;k.clip="rect(0px "+b+" "+c+" 0px)";l.position="absolute";l.width=
b;l.height=c;g.coordsize=("100%"===b?b:parseFloat(b))+" "+("100%"===c?c:parseFloat(c));g.coordorigin="0 0";var k=d.bgNode=g.ownerDocument.createElement("v:rect"),m=k.style;m.left=m.top=0;m.width=l.width;m.height=l.height;k.filled=k.stroked="f";g.appendChild(k);f.appendChild(g);a.appendChild(f);d.width=h.normalizedLength(b);d.height=h.normalizedLength(c);return d};k=function(a){if(this!=a.getParent()){var b=a.getParent();b&&b.remove(a);this.rawNode.appendChild(a.rawNode);p.add.apply(this,arguments);
y(this,function(a){"function"==typeof a.getFont&&(a.setShape(a.getShape()),a.setFont(a.getFont()));"function"==typeof a.setFill&&(a.setFill(a.getFill()),a.setStroke(a.getStroke()))})}return this};v=function(a){this!=a.getParent()&&(this.rawNode.appendChild(a.rawNode),a.getParent()||(a.setFill(a.getFill()),a.setStroke(a.getStroke())),p.add.apply(this,arguments));return this};var p=l.Container;u={add:!0===u.fixVmlAdd?k:v,remove:function(a,b){this==a.getParent()&&(this.rawNode==a.rawNode.parentNode&&
this.rawNode.removeChild(a.rawNode),p.remove.apply(this,arguments));return this},clear:function(){for(var a=this.rawNode;a.firstChild!=a.lastChild;)a.firstChild!=this.bgNode&&a.removeChild(a.firstChild),a.lastChild!=this.bgNode&&a.removeChild(a.lastChild);return p.clear.apply(this,arguments)},getBoundingBox:p.getBoundingBox,_moveChildToFront:p._moveChildToFront,_moveChildToBack:p._moveChildToBack};k={createGroup:function(){var a=this.createObject(e.Group,null),b=a.rawNode.ownerDocument.createElement("v:rect");
b.style.left=b.style.top=0;b.style.width=a.rawNode.style.width;b.style.height=a.rawNode.style.height;b.filled=b.stroked="f";a.rawNode.appendChild(b);a.bgNode=b;return a},createImage:function(a){if(!this.rawNode)return null;var b=new e.Image,c=this.rawNode.ownerDocument,d=c.createElement("v:rect");d.stroked="f";d.style.width=this.rawNode.style.width;d.style.height=this.rawNode.style.height;c=c.createElement("v:imagedata");d.appendChild(c);b.setRawNode(d);this.rawNode.appendChild(d);b.setShape(a);this.add(b);
return b},createRect:function(a){if(!this.rawNode)return null;var b=new e.Rect,c=this.rawNode.ownerDocument.createElement("v:roundrect");7<t("ie")&&(c.style.display="inline-block");b.setRawNode(c);this.rawNode.appendChild(c);b.setShape(a);this.add(b);return b},createObject:function(a,b){if(!this.rawNode)return null;var c=new a,d=this.rawNode.ownerDocument.createElement("v:"+a.nodeType);c.setRawNode(d);this.rawNode.appendChild(d);switch(a){case e.Group:case e.Line:case e.Polyline:case e.Image:case e.Text:case e.Path:case e.TextPath:this._overrideSize(d)}c.setShape(b);
this.add(c);return c},_overrideSize:function(a){var b=this.rawNode.style,c=b.width,b=b.height;a.style.width=c;a.style.height=b;a.coordsize=parseInt(c)+" "+parseInt(b)}};n.extend(e.Group,u);n.extend(e.Group,l.Creator);n.extend(e.Group,k);n.extend(e.Surface,u);n.extend(e.Surface,l.Creator);n.extend(e.Surface,k);e.fixTarget=function(a,b){a.gfxTarget||(a.gfxTarget=a.target.__gfxObject__);return!0};return e});