//>>built
define("dojox/dgauges/RectangularGauge",["dojo/_base/declare","./GaugeBase","dojox/gfx/matrix"],function(_1,_2,_3){
return _1("dojox.dgauges.RectangularGauge",_2,{orientation:"horizontal",_middleParts:null,_leadingParts:null,_trailingParts:null,_baseParts:null,_classParts:null,_layoutInfos:{},constructor:function(){
this.orientation="horizontal";
this._middleParts=[];
this._leadingParts=[];
this._trailingParts=[];
this._baseParts=[];
this._classParts=[];
this._layoutInfos={leading:{x:0,y:0,w:0,h:0},middle:{x:0,y:0,w:0,h:0},trailing:{x:0,y:0,w:0,h:0}};
this.addInvalidatingProperties(["orientation"]);
},addElement:function(_4,_5,_6){
this.inherited(arguments);
var _7=this._elements[this._elements.length-1];
if(_6=="middle"){
this._middleParts.push(_7);
}else{
if(_6=="leading"){
this._leadingParts.push(_7);
}else{
if(_6=="trailing"){
this._trailingParts.push(_7);
}else{
if(_7._isGFX){
this._baseParts.push(_7);
}else{
this._classParts.push(_7);
}
}
}
}
},removeElement:function(_8){
var _9=this.getElement(_8);
if(_9){
if(this._middleParts&&this._middleParts.indexOf(_9)>=0){
this._middleParts.splice(this._middleParts.indexOf(_9),1);
}else{
if(this._leadingParts&&this._leadingParts.indexOf(_9)>=0){
this._leadingParts.splice(this._leadingParts.indexOf(_9),1);
}else{
if(this._trailingParts&&this._trailingParts.indexOf(_9)>=0){
this._trailingParts.splice(this._trailingParts.indexOf(_9),1);
}else{
if(this._baseParts&&this._baseParts.indexOf(_9)>=0){
this._baseParts.splice(this._baseParts.indexOf(_9),1);
}else{
if(this._classParts&&this._classParts.indexOf(_9)>=0){
this._classParts.splice(this._classParts.indexOf(_9),1);
}
}
}
}
}
}
this.inherited(arguments);
},_computeArrayBoundingBox:function(_a){
if(_a.length==0){
return {x:0,y:0,w:0,h:0};
}
var _b=null;
var _c,_d,_e,_f;
_c=_d=+Infinity;
_e=_f=-Infinity;
for(var i=0;i<_a.length;i++){
_b=this._computeBoundingBox(_a[i]._gfxGroup);
if(_c>_b.x){
_c=_b.x;
}
if(_d>_b.y){
_d=_b.y;
}
if(_e<_b.x+_b.width){
_e=_b.x+_b.width;
}
if(_f<_b.y+_b.height){
_f=_b.y+_b.height;
}
}
return {x:_c,y:_d,w:_e-_c,h:_f-_d};
},refreshRendering:function(){
if(this._widgetBox.w<=0||this._widgetBox.h<=0){
return;
}
var i;
if(this._baseParts){
for(i=0;i<this._baseParts.length;i++){
this._baseParts[i].width=this._widgetBox.w;
this._baseParts[i].height=this._widgetBox.h;
this._elementsRenderers[this._baseParts[i]._name]=this._baseParts[i].refreshRendering();
}
}
if(this._leadingParts){
for(i=0;i<this._leadingParts.length;i++){
this._elementsRenderers[this._leadingParts[i]._name]=this._leadingParts[i].refreshRendering();
}
}
if(this._trailingParts){
for(i=0;i<this._trailingParts.length;i++){
this._elementsRenderers[this._trailingParts[i]._name]=this._trailingParts[i].refreshRendering();
}
}
var _10=this._computeArrayBoundingBox(this._leadingParts);
var _11=this._computeArrayBoundingBox(this._trailingParts);
var _12={};
if(this.orientation=="horizontal"){
_12.x=_10.x+_10.w;
_12.y=0;
_12.w=this._widgetBox.w-_10.w-_11.w;
_12.h=this._widgetBox.h;
}else{
_12.x=0;
_12.y=_10.y+_10.h;
_12.w=this._widgetBox.w;
_12.h=this._widgetBox.h-_10.h-_11.h;
}
this._layoutInfos={leading:_10,middle:_12,trailing:_11};
for(i=0;i<this._middleParts.length;i++){
this._middleParts[i]._gfxGroup.setTransform([_3.translate(_12.x,_12.y)]);
}
if(this._trailingParts){
for(i=0;i<this._trailingParts.length;i++){
this._trailingParts[i]._gfxGroup.setTransform(_3.translate(this._widgetBox.w-_11.w,0));
}
}
for(i=0;i<this._classParts.length;i++){
this._elementsRenderers[this._classParts[i]._name]=this._classParts[i].refreshRendering();
}
}});
});
