//>>built
define("dojox/drawing/stencil/Path",["dojo","dojo/_base/array","../util/oo","./_Base","../manager/_registry"],function(g,f,d,h,i){d=d.declare(h,function(){},{type:"dojox.drawing.stencil.Path",closePath:!0,baseRender:!0,closeRadius:10,closeColor:{r:255,g:255,b:0,a:0.5},_create:function(a,b){this.remove(this[a]);if(this.points.length){if("svg"==dojox.gfx.renderer){var c=[];f.forEach(this.points,function(a,b){if(!a.skip)if(0==b)c.push("M "+a.x+" "+a.y);else{var d=(a.t||"")+" ";void 0===a.x?c.push(d):
c.push(d+a.x+" "+a.y)}},this);this.closePath&&c.push("Z");this.stringPath=c.join(" ");this[a]=this.container.createPath(c.join(" ")).setStroke(b);this.closePath&&this[a].setFill(b.fill)}else this[a]=this.container.createPath({}).setStroke(b),this.closePath&&this[a].setFill(b.fill),f.forEach(this.points,function(b,c){b.skip||(0==c||"M"==b.t?this[a].moveTo(b.x,b.y):"Z"==b.t?this.closePath&&this[a].closePath():this[a].lineTo(b.x,b.y))},this),this.closePath&&this[a].closePath();this._setNodeAtts(this[a])}},
render:function(){this.onBeforeRender(this);this.renderHit&&this._create("hit",this.style.currentHit);this._create("shape",this.style.current)},getBounds:function(){var a=1E4,b=1E4,c=0,d=0;f.forEach(this.points,function(e){void 0!==e.x&&!isNaN(e.x)&&(a=Math.min(a,e.x),b=Math.min(b,e.y),c=Math.max(c,e.x),d=Math.max(d,e.y))});return{x1:a,y1:b,x2:c,y2:d,x:a,y:b,w:c-a,h:d-b}},checkClosePoint:function(a,b,c){b=this.util.distance(a.x,a.y,b.x,b.y);if(1<this.points.length)if(b<this.closeRadius&&!this.closeGuide&&
!c)this.closeGuide=this.container.createEllipse({cx:a.x,cy:a.y,rx:this.closeRadius,ry:this.closeRadius}).setFill(this.closeColor);else if(c||b>this.closeRadius&&this.closeGuide)this.remove(this.closeGuide),this.closeGuide=null;return b<this.closeRadius}});g.setObject("dojox.drawing.stencil.Path",d);i.register({name:"dojox.drawing.stencil.Path"},"stencil");return d});