/*
Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
Available via Academic Free License >= 2.1 OR the modified BSD license.
see: http://dojotoolkit.org/license for details
*/
if(!dojo._hasResource["dojox.gfx.silverlight"]){dojo._hasResource["dojox.gfx.silverlight"]=true;dojo.provide("dojox.gfx.silverlight");dojo.require("dojox.gfx._base");dojo.require("dojox.gfx.shape");dojo.require("dojox.gfx.path");dojo.experimental("dojox.gfx.silverlight");dojox.gfx.silverlight.dasharray={solid:"none",shortdash:[4,1],shortdot:[1,1],shortdashdot:[4,1,1,1],shortdashdotdot:[4,1,1,1,1,1],dot:[1,3],dash:[4,3],longdash:[8,3],dashdot:[4,3,1,3],longdashdot:[8,3,1,3],longdashdotdot:[8,3,1,3,1,3]};dojox.gfx.silverlight.fontweight={normal:400,bold:700};dojox.gfx.silverlight.caps={butt:"Flat",round:"Round",square:"Square"};dojox.gfx.silverlight.joins={bevel:"Bevel",round:"Round"};dojox.gfx.silverlight.fonts={serif:"Times New Roman",times:"Times New Roman","sans-serif":"Arial",helvetica:"Arial",monotone:"Courier New",courier:"Courier New"};dojox.gfx.silverlight.hexColor=function(_1){var c=dojox.gfx.normalizeColor(_1),t=c.toHex(),a=Math.round(c.a*255);a=(a<0?0:a>255?255:a).toString(16);return "#"+(a.length<2?"0"+a:a)+t.slice(1);};dojo.extend(dojox.gfx.Shape,{setFill:function(_2){var p=this.rawNode.getHost().content,r=this.rawNode,f;if(!_2){this.fillStyle=null;this._setFillAttr(null);return this;}if(typeof (_2)=="object"&&"type" in _2){switch(_2.type){case "linear":this.fillStyle=f=dojox.gfx.makeParameters(dojox.gfx.defaultLinearGradient,_2);var _3=p.createFromXaml("");_3.mappingMode="Absolute";_3.startPoint=f.x1+","+f.y1;_3.endPoint=f.x2+","+f.y2;dojo.forEach(f.colors,function(c){var t=p.createFromXaml("");t.offset=c.offset;t.color=dojox.gfx.silverlight.hexColor(c.color);_3.gradientStops.add(t);});this._setFillAttr(_3);break;case "radial":this.fillStyle=f=dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient,_2);var _4=p.createFromXaml(""),c=dojox.gfx.matrix.multiplyPoint(dojox.gfx.matrix.invert(this._getAdjustedMatrix()),f.cx,f.cy),pt=c.x+","+c.y;_4.mappingMode="Absolute";_4.gradientOrigin=pt;_4.center=pt;_4.radiusX=_4.radiusY=f.r;dojo.forEach(f.colors,function(c){var t=p.createFromXaml("");t.offset=c.offset;t.color=dojox.gfx.silverlight.hexColor(c.color);_4.gradientStops.add(t);});this._setFillAttr(_4);break;case "pattern":this.fillStyle=null;this._setFillAttr(null);break;}return this;}this.fillStyle=f=dojox.gfx.normalizeColor(_2);var _5=p.createFromXaml("");_5.color=f.toHex();_5.opacity=f.a;this._setFillAttr(_5);return this;},_setFillAttr:function(f){this.rawNode.fill=f;},setStroke:function(_6){var p=this.rawNode.getHost().content,r=this.rawNode;if(!_6){this.strokeStyle=null;r.stroke=null;return this;}if(typeof _6=="string"||dojo.isArray(_6)||_6 instanceof dojo.Color){_6={color:_6};}var s=this.strokeStyle=dojox.gfx.makeParameters(dojox.gfx.defaultStroke,_6);s.color=dojox.gfx.normalizeColor(s.color);if(s){var _7=p.createFromXaml("");_7.color=s.color.toHex();_7.opacity=s.color.a;r.stroke=_7;r.strokeThickness=s.width;r.strokeStartLineCap=r.strokeEndLineCap=r.strokeDashCap=dojox.gfx.silverlight.caps[s.cap];if(typeof s.join=="number"){r.strokeLineJoin="Miter";r.strokeMiterLimit=s.join;}else{r.strokeLineJoin=dojox.gfx.silverlight.joins[s.join];}var da=s.style.toLowerCase();if(da in dojox.gfx.silverlight.dasharray){da=dojox.gfx.silverlight.dasharray[da];}if(da instanceof Array){da=dojo.clone(da);var i;if(s.cap!="butt"){for(i=0;i"),mm=p.createFromXaml("");mm.m11=tm.xx;mm.m21=tm.xy;mm.m12=tm.yx;mm.m22=tm.yy;mm.offsetX=tm.dx;mm.offsetY=tm.dy;m.matrix=mm;r.renderTransform=m;}else{r.renderTransform=null;}return this;},setRawNode:function(_9){_9.fill=null;_9.stroke=null;this.rawNode=_9;},_moveToFront:function(){var c=this.parent.rawNode.children,r=this.rawNode;c.remove(r);c.add(r);return this;},_moveToBack:function(){var c=this.parent.rawNode.children,r=this.rawNode;c.remove(r);c.insert(0,r);return this;},_getAdjustedMatrix:function(){return this.matrix;}});dojo.declare("dojox.gfx.Group",dojox.gfx.Shape,{constructor:function(){dojox.gfx.silverlight.Container._init.call(this);},setRawNode:function(_a){this.rawNode=_a;}});dojox.gfx.Group.nodeType="Canvas";dojo.declare("dojox.gfx.Rect",dojox.gfx.shape.Rect,{setShape:function(_b){this.shape=dojox.gfx.makeParameters(this.shape,_b);this.bbox=null;var r=this.rawNode,n=this.shape;r.width=n.width;r.height=n.height;r.radiusX=r.radiusY=n.r;return this._applyTransform();},_getAdjustedMatrix:function(){var m=this.matrix,s=this.shape,d={dx:s.x,dy:s.y};return new dojox.gfx.Matrix2D(m?[m,d]:d);}});dojox.gfx.Rect.nodeType="Rectangle";dojo.declare("dojox.gfx.Ellipse",dojox.gfx.shape.Ellipse,{setShape:function(_c){this.shape=dojox.gfx.makeParameters(this.shape,_c);this.bbox=null;var r=this.rawNode,n=this.shape;r.width=2*n.rx;r.height=2*n.ry;return this._applyTransform();},_getAdjustedMatrix:function(){var m=this.matrix,s=this.shape,d={dx:s.cx-s.rx,dy:s.cy-s.ry};return new dojox.gfx.Matrix2D(m?[m,d]:d);}});dojox.gfx.Ellipse.nodeType="Ellipse";dojo.declare("dojox.gfx.Circle",dojox.gfx.shape.Circle,{setShape:function(_d){this.shape=dojox.gfx.makeParameters(this.shape,_d);this.bbox=null;var r=this.rawNode,n=this.shape;r.width=r.height=2*n.r;return this._applyTransform();},_getAdjustedMatrix:function(){var m=this.matrix,s=this.shape,d={dx:s.cx-s.r,dy:s.cy-s.r};return new dojox.gfx.Matrix2D(m?[m,d]:d);}});dojox.gfx.Circle.nodeType="Ellipse";dojo.declare("dojox.gfx.Line",dojox.gfx.shape.Line,{setShape:function(_e){this.shape=dojox.gfx.makeParameters(this.shape,_e);this.bbox=null;var r=this.rawNode,n=this.shape;r.x1=n.x1;r.y1=n.y1;r.x2=n.x2;r.y2=n.y2;return this;}});dojox.gfx.Line.nodeType="Line";dojo.declare("dojox.gfx.Polyline",dojox.gfx.shape.Polyline,{setShape:function(_f,_10){if(_f&&_f instanceof Array){this.shape=dojox.gfx.makeParameters(this.shape,{points:_f});if(_10&&this.shape.points.length){this.shape.points.push(this.shape.points[0]);}}else{this.shape=dojox.gfx.makeParameters(this.shape,_f);}this.bbox=null;this._normalizePoints();var p=this.shape.points,rp=[];for(var i=0;i";_1b.parentNode.insertBefore(t,_1b);s._nodes.push(t);var obj,_1e=dojox.gfx._base._getUniqueId(),_1f="__"+dojox.gfx._base._getUniqueId()+"_onLoad";s._onLoadName=_1f;window[_1f]=function(_20){if(!s.rawNode){s.rawNode=dojo.byId(_1e).content.root;dojox.gfx.silverlight.surfaces[s.rawNode.name]=_1b;s.onLoad(s);}};if(dojo.isSafari){obj="";}else{obj="";}_1b.innerHTML=obj;var _21=dojo.byId(_1e);if(_21.content&&_21.content.root){s.rawNode=_21.content.root;dojox.gfx.silverlight.surfaces[s.rawNode.name]=_1b;}else{s.rawNode=null;s.isLoaded=false;}s._nodes.push(_21);s.width=dojox.gfx.normalizedLength(_1c);s.height=dojox.gfx.normalizedLength(_1d);return s;};__dojoSilverlightError=function(_22,err){var t="Silverlight Error:\n"+"Code: "+err.ErrorCode+"\n"+"Type: "+err.ErrorType+"\n"+"Message: "+err.ErrorMessage+"\n";switch(err.ErrorType){case "ParserError":t+="XamlFile: "+err.xamlFile+"\n"+"Line: "+err.lineNumber+"\n"+"Position: "+err.charPosition+"\n";break;case "RuntimeError":t+="MethodName: "+err.methodName+"\n";if(err.lineNumber!=0){t+="Line: "+err.lineNumber+"\n"+"Position: "+err.charPosition+"\n";}break;}};dojox.gfx.silverlight.Font={_setFont:function(){var f=this.fontStyle,r=this.rawNode,fw=dojox.gfx.silverlight.fontweight,fo=dojox.gfx.silverlight.fonts,t=f.family.toLowerCase();r.fontStyle=f.style=="italic"?"Italic":"Normal";r.fontWeight=f.weight in fw?fw[f.weight]:f.weight;r.fontSize=dojox.gfx.normalizedLength(f.size);r.fontFamily=t in fo?fo[t]:f.family;if(!this._delay){this._delay=window.setTimeout(dojo.hitch(this,"_delayAlignment"),10);}}};dojox.gfx.silverlight.Container={_init:function(){dojox.gfx.shape.Container._init.call(this);},add:function(_23){if(this!=_23.getParent()){dojox.gfx.shape.Container.add.apply(this,arguments);this.rawNode.children.add(_23.rawNode);}return this;},remove:function(_24,_25){if(this==_24.getParent()){var _26=_24.rawNode.getParent();if(_26){_26.children.remove(_24.rawNode);}dojox.gfx.shape.Container.remove.apply(this,arguments);}return this;},clear:function(){this.rawNode.children.clear();return dojox.gfx.shape.Container.clear.apply(this,arguments);},_moveChildToFront:dojox.gfx.shape.Container._moveChildToFront,_moveChildToBack:dojox.gfx.shape.Container._moveChildToBack};dojo.mixin(dojox.gfx.shape.Creator,{createObject:function(_27,_28){if(!this.rawNode){return null;}var _29=new _27();var _2a=this.rawNode.getHost().content.createFromXaml("<"+_27.nodeType+"/>");_29.setRawNode(_2a);_29.setShape(_28);this.add(_29);return _29;}});dojo.extend(dojox.gfx.Text,dojox.gfx.silverlight.Font);dojo.extend(dojox.gfx.Group,dojox.gfx.silverlight.Container);dojo.extend(dojox.gfx.Group,dojox.gfx.shape.Creator);dojo.extend(dojox.gfx.Surface,dojox.gfx.silverlight.Container);dojo.extend(dojox.gfx.Surface,dojox.gfx.shape.Creator);(function(){var _2b=dojox.gfx.silverlight.surfaces;var _2c=function(s,a){var ev={target:s,currentTarget:s,preventDefault:function(){},stopPropagation:function(){}};if(a){try{ev.ctrlKey=a.ctrl;ev.shiftKey=a.shift;var p=a.getPosition(null);ev.x=ev.offsetX=ev.layerX=p.x;ev.y=ev.offsetY=ev.layerY=p.y;var _2d=_2b[s.getHost().content.root.name];var t=dojo.position(_2d);ev.clientX=t.x+p.x;ev.clientY=t.y+p.y;}catch(e){}}return ev;};var _2e=function(s,a){var ev={keyCode:a.platformKeyCode,ctrlKey:a.ctrl,shiftKey:a.shift};return ev;};var _2f={onclick:{name:"MouseLeftButtonUp",fix:_2c},onmouseenter:{name:"MouseEnter",fix:_2c},onmouseleave:{name:"MouseLeave",fix:_2c},onmouseover:{name:"MouseEnter",fix:_2c},onmouseout:{name:"MouseLeave",fix:_2c},onmousedown:{name:"MouseLeftButtonDown",fix:_2c},onmouseup:{name:"MouseLeftButtonUp",fix:_2c},onmousemove:{name:"MouseMove",fix:_2c},onkeydown:{name:"KeyDown",fix:_2e},onkeyup:{name:"KeyUp",fix:_2e}};var _30={connect:function(_31,_32,_33){var _34,n=_31 in _2f?_2f[_31]:{name:_31,fix:function(){return {};}};if(arguments.length>2){_34=this.getEventSource().addEventListener(n.name,function(s,a){dojo.hitch(_32,_33)(n.fix(s,a));});}else{_34=this.getEventSource().addEventListener(n.name,function(s,a){_32(n.fix(s,a));});}return {name:n.name,token:_34};},disconnect:function(_35){this.getEventSource().removeEventListener(_35.name,_35.token);}};dojo.extend(dojox.gfx.Shape,_30);dojo.extend(dojox.gfx.Surface,_30);dojox.gfx.equalSources=function(a,b){return a&&b&&a.equals(b);};})();}