/* 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.shape"]){dojo._hasResource["dojox.gfx.shape"]=true;dojo.provide("dojox.gfx.shape");dojo.require("dojox.gfx._base");dojo.declare("dojox.gfx.Shape",null,{constructor:function(){this.rawNode=null;this.shape=null;this.matrix=null;this.fillStyle=null;this.strokeStyle=null;this.bbox=null;this.parent=null;this.parentMatrix=null;},getNode:function(){return this.rawNode;},getShape:function(){return this.shape;},getTransform:function(){return this.matrix;},getFill:function(){return this.fillStyle;},getStroke:function(){return this.strokeStyle;},getParent:function(){return this.parent;},getBoundingBox:function(){return this.bbox;},getTransformedBoundingBox:function(){var b=this.getBoundingBox();if(!b){return null;}var m=this._getRealMatrix();gm=dojox.gfx.matrix;return [gm.multiplyPoint(m,b.x,b.y),gm.multiplyPoint(m,b.x+b.width,b.y),gm.multiplyPoint(m,b.x+b.width,b.y+b.height),gm.multiplyPoint(m,b.x,b.y+b.height)];},getEventSource:function(){return this.rawNode;},setShape:function(_1){this.shape=dojox.gfx.makeParameters(this.shape,_1);this.bbox=null;return this;},setFill:function(_2){if(!_2){this.fillStyle=null;return this;}var f=null;if(typeof (_2)=="object"&&"type" in _2){switch(_2.type){case "linear":f=dojox.gfx.makeParameters(dojox.gfx.defaultLinearGradient,_2);break;case "radial":f=dojox.gfx.makeParameters(dojox.gfx.defaultRadialGradient,_2);break;case "pattern":f=dojox.gfx.makeParameters(dojox.gfx.defaultPattern,_2);break;}}else{f=dojox.gfx.normalizeColor(_2);}this.fillStyle=f;return this;},setStroke:function(_3){if(!_3){this.strokeStyle=null;return this;}if(typeof _3=="string"||dojo.isArray(_3)||_3 instanceof dojo.Color){_3={color:_3};}var s=this.strokeStyle=dojox.gfx.makeParameters(dojox.gfx.defaultStroke,_3);s.color=dojox.gfx.normalizeColor(s.color);return this;},setTransform:function(_4){this.matrix=dojox.gfx.matrix.clone(_4?dojox.gfx.matrix.normalize(_4):dojox.gfx.matrix.identity);return this._applyTransform();},_applyTransform:function(){return this;},moveToFront:function(){var p=this.getParent();if(p){p._moveChildToFront(this);this._moveToFront();}return this;},moveToBack:function(){var p=this.getParent();if(p){p._moveChildToBack(this);this._moveToBack();}return this;},_moveToFront:function(){},_moveToBack:function(){},applyRightTransform:function(_5){return _5?this.setTransform([this.matrix,_5]):this;},applyLeftTransform:function(_6){return _6?this.setTransform([_6,this.matrix]):this;},applyTransform:function(_7){return _7?this.setTransform([this.matrix,_7]):this;},removeShape:function(_8){if(this.parent){this.parent.remove(this,_8);}return this;},_setParent:function(_9,_a){this.parent=_9;return this._updateParentMatrix(_a);},_updateParentMatrix:function(_b){this.parentMatrix=_b?dojox.gfx.matrix.clone(_b):null;return this._applyTransform();},_getRealMatrix:function(){var m=this.matrix;var p=this.parent;while(p){if(p.matrix){m=dojox.gfx.matrix.multiply(p.matrix,m);}p=p.parent;}return m;}});dojox.gfx.shape._eventsProcessing={connect:function(_c,_d,_e){return arguments.length>2?dojo.connect(this.getEventSource(),_c,_d,_e):dojo.connect(this.getEventSource(),_c,_d);},disconnect:function(_f){dojo.disconnect(_f);}};dojo.extend(dojox.gfx.Shape,dojox.gfx.shape._eventsProcessing);dojox.gfx.shape.Container={_init:function(){this.children=[];},openBatch:function(){},closeBatch:function(){},add:function(_10){var _11=_10.getParent();if(_11){_11.remove(_10,true);}this.children.push(_10);return _10._setParent(this,this._getRealMatrix());},remove:function(_12,_13){for(var i=0;it.x){_25.l=t.x;}if(_25.rt.y){_25.t=t.y;}if(_25.b