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