0){y[F].left=A+x;A=A+L+x}else{y[F].left=A;A=A+L}if(H0){y[F].top=H+x;H=H+p+x}else{y[F].top=H;H=H+p}if(AMath.abs(d.y-a.y)){c="e";b="w"}else{c="s";b="n"}}else{if(a.x<=d.x&&a.y>d.y){if(Math.abs(d.x-a.x)>Math.abs(d.y-a.y)){c="e";b="w"}else{c="n";b="s"}}else{if(a.x>d.x&&a.y<=d.y){if(Math.abs(d.x-a.x)>Math.abs(d.y-a.y)){c="w";b="e"}else{c="s";b="n"}}else{if(a.x>d.x&&a.y>d.y){if(Math.abs(d.x-a.x)>Math.abs(d.y-a.y)){c="w";b="e"}else{c="n";b="s"}}}}}return[c,b]},_getShapeFromTerminal:function(b){var a;if(b){var c=b.substring(0,b.indexOf(OG.Constants.TERMINAL));a=this.getElementById(c)}return a},drawShape:function(a,b,c,d,e){throw new OG.NotImplementedException()},drawGeom:function(b,a,c){throw new OG.NotImplementedException()},drawText:function(a,d,b,c,e){throw new OG.NotImplementedException()},drawImage:function(a,d,b,c,e){throw new OG.NotImplementedException()},drawEdge:function(a,c,d,b){throw new OG.NotImplementedException()},drawLabel:function(a,c,b){throw new OG.NotImplementedException()},drawEdgeLabel:function(a,c,b){throw new OG.NotImplementedException()},redrawShape:function(a,b){throw new OG.NotImplementedException()},redrawConnectedEdge:function(a){throw new OG.NotImplementedException()},connect:function(f,b,e,d,c,a){throw new OG.NotImplementedException()},disconnect:function(a){throw new OG.NotImplementedException()},drawDropOverGuide:function(a){throw new OG.NotImplementedException()},drawGuide:function(a){throw new OG.NotImplementedException()},removeGuide:function(a){throw new OG.NotImplementedException()},removeAllGuide:function(){throw new OG.NotImplementedException()},removeConnectGuide:function(){throw new OG.NotImplementedException()},removeAllConnectGuide:function(){throw new OG.NotImplementedException()},removeOtherConnectGuide:function(){throw new OG.NotImplementedException()},removeAllVirtualEdge:function(){throw new OG.NotImplementedException()},drawEdgeGuide:function(a){throw new OG.NotImplementedException()},drawRubberBand:function(a,b,c){throw new OG.NotImplementedException()},removeRubberBand:function(a){throw new OG.NotImplementedException()},drawDraggableGuide:function(a){throw new OG.NotImplementedException()},drawCollapseGuide:function(a){throw new OG.NotImplementedException()},removeCollapseGuide:function(a){throw new OG.NotImplementedException()},group:function(a){throw new OG.NotImplementedException()},ungroup:function(a){throw new OG.NotImplementedException()},addToGroup:function(a,c,b){throw new OG.NotImplementedException()},collapse:function(a){throw new OG.NotImplementedException()},expand:function(a){throw new OG.NotImplementedException()},clear:function(){throw new OG.NotImplementedException()},removeShape:function(a){throw new OG.NotImplementedException()},remove:function(a){throw new OG.NotImplementedException()},removeChild:function(a){throw new OG.NotImplementedException()},getRootElement:function(){throw new OG.NotImplementedException()},getRootGroup:function(){return this._ROOT_GROUP.node},getElementByPoint:function(a){throw new OG.NotImplementedException()},getElementsByBBox:function(b){var a=[];$(this.getRootElement()).find("[_type="+OG.Constants.NODE_TYPE.SHAPE+"]").each(function(c,d){if(d.shape.geom&&b.isContainsAll(d.shape.geom.getVertices())){a.push(d)}});return a},setAttr:function(a,b){throw new OG.NotImplementedException()},getAttr:function(b,a){throw new OG.NotImplementedException()},setShapeStyle:function(a,b){throw new OG.NotImplementedException()},toFront:function(a){throw new OG.NotImplementedException()},toBack:function(a){throw new OG.NotImplementedException()},bringForward:function(a){throw new OG.NotImplementedException()},sendBackward:function(a){throw new OG.NotImplementedException()},getCanvasSize:function(){throw new OG.NotImplementedException()},setCanvasSize:function(a){throw new OG.NotImplementedException()},fitCanvasSize:function(b,a){throw new OG.NotImplementedException()},setViewBox:function(a,b,c){throw new OG.NotImplementedException()},getScale:function(){throw new OG.NotImplementedException()},setScale:function(a){throw new OG.NotImplementedException()},show:function(a){throw new OG.NotImplementedException()},hide:function(a){throw new OG.NotImplementedException()},appendChild:function(a,b){throw new OG.NotImplementedException()},insertAfter:function(a,b){throw new OG.NotImplementedException()},insertBefore:function(a,b){throw new OG.NotImplementedException()},move:function(a,b){throw new OG.NotImplementedException()},moveCentroid:function(b,a){throw new OG.NotImplementedException()},rotate:function(a,b){throw new OG.NotImplementedException()},resize:function(a,b){throw new OG.NotImplementedException()},resizeBox:function(b,a){throw new OG.NotImplementedException()},clone:function(a){throw new OG.NotImplementedException()},getElementById:function(a){throw new OG.NotImplementedException()},getElementsByType:function(c,a){var b=this.getRootGroup();if(c&&a){return $(b).find("[_type=SHAPE][_shape="+c+"][_shape!="+a+"]")}else{if(c){return $(b).find("[_type=SHAPE][_shape="+c+"]")}else{if(a){return $(b).find("[_type=SHAPE][_shape!="+a+"]")}else{return $(b).find("[_type=SHAPE]")}}}},getBBox:function(a){throw new OG.NotImplementedException()},getRootBBox:function(){throw new OG.NotImplementedException()},getRealRootBBox:function(){var f=Number.MAX_VALUE,d=Number.MAX_VALUE,c=Number.MIN_VALUE,a=Number.MIN_VALUE,e=this.getElementsByType(),j,k,b,h,g,l={width:0,height:0,x:0,y:0,x2:0,y2:0};for(var g=0,m=e.length;gb.x?b.x:f;d=d>b.y?b.y:d;c=c=0;b--){this._remove(this._getREleById(c[b].id))}this._ELE_MAP.remove(a.id);a.remove()}};OG.renderer.RaphaelRenderer.prototype._removeChild=function(a){var c,b;if(a){c=a.node.childNodes;for(b=c.length-1;b>=0;b--){if(c[b].tagName=="svg"){c[b].parentNode.removeChild(c[b])}else{this._remove(this._getREleById(c[b].id))}}}};OG.renderer.RaphaelRenderer.prototype._getREleById=function(a){return this._ELE_MAP.get(a)};OG.renderer.RaphaelRenderer.prototype._drawSubShape=function(f){var H=this,g,y,s,q,d,o,G,j,x,a,E,h,r,w,B,p,A,m,C,n,u,D=[];if(!f.shape.createSubShape){return}g=f.shape.createSubShape();if(!g||!g.length){return}for(var z=0,c=g.length;z=0){f.appendChild(i)}else{if(!k){f.appendChild(i)}else{f.insertBefore(i,k)}}});H._remove(H._getREleById($(t).attr("id")))}};OG.renderer.RaphaelRenderer.prototype._drawGeometry=function(groupElement,geometry,style,parentStyle,isEdge){var me=this,i=0,pathStr="",vertices,element,geomObj,_style={},connectGuideElement;var svg=me.getRootElement();var getRoundedPath=function(rectangle,radius){var rectObj,rectVert,offset1,offset2,angle,array=[],getRoundedOffset=function(coord,dist,deg){var theta=Math.PI/180*deg;return new OG.geometry.Coordinate(OG.Util.round(coord.x+dist*Math.cos(theta)),OG.Util.round(coord.y+dist*Math.sin(theta)))};rectObj=OG.JSON.decode(rectangle.toString());rectVert=rectangle.getVertices();angle=rectObj.angle;offset1=getRoundedOffset(rectVert[0],radius,90+angle);offset2=getRoundedOffset(rectVert[0],radius,angle);array=array.concat(["M",offset1.x,offset1.y,"Q",rectVert[0].x,rectVert[0].y,offset2.x,offset2.y]);offset1=getRoundedOffset(rectVert[1],radius,180+angle);offset2=getRoundedOffset(rectVert[1],radius,90+angle);array=array.concat(["L",offset1.x,offset1.y,"Q",rectVert[1].x,rectVert[1].y,offset2.x,offset2.y]);offset1=getRoundedOffset(rectVert[2],radius,270+angle);offset2=getRoundedOffset(rectVert[2],radius,180+angle);array=array.concat(["L",offset1.x,offset1.y,"Q",rectVert[2].x,rectVert[2].y,offset2.x,offset2.y]);offset1=getRoundedOffset(rectVert[3],radius,angle);offset2=getRoundedOffset(rectVert[3],radius,270+angle);array=array.concat(["L",offset1.x,offset1.y,"Q",rectVert[3].x,rectVert[3].y,offset2.x,offset2.y,"Z"]);return array.toString()},getConnectGuideStyle=function(){return me._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_EVENT_AREA},setConnectGuideAttr=function(ele){ele.attr(getConnectGuideStyle())};if(parentStyle){OG.Util.apply(_style,(style instanceof OG.geometry.Style)?style.map:style||{},OG.Util.apply({},geometry.style.map,OG.Util.apply({},parentStyle,me._CONFIG.DEFAULT_STYLE.GEOM)))}else{OG.Util.apply(_style,(style instanceof OG.geometry.Style)?style.map:style||{},OG.Util.apply({},geometry.style.map,me._CONFIG.DEFAULT_STYLE.GEOM))}var multi=_style.multi;var rootMarker=_style.marker;var rootPattern=_style.pattern;var rootAnimation=_style.animation;var marker,pattern;var drawMulti=function(vertices){var multiData,top,from,to,nodeId,multiStyle;var getSubDistance=function(nodePath,distance){var totalLenth=Raphael.getTotalLength(nodePath);var length;if(typeof distance=="number"){length=distance}else{if(typeof distance=="string"){if(distance.indexOf("px")!=-1){length=parseInt(distance.replace("px",""))}if(distance.indexOf("%")!=-1){distance=parseInt(distance.replace("%",""));length=totalLenth*(distance/100)}else{if(distance=="start"){length=0}else{if(distance=="center"){length=totalLenth/2}else{if(distance=="end"){length=totalLenth}else{if(distance.indexOf("end-")!=-1){length=totalLenth-getSubDistance(nodePath,distance.replace("end-",""))}else{distance=parseInt(distance);length=distance}}}}}}}return length};for(var m=0,lenm=multi.length;m");me._remove(me._getREleById(tempNode.id));cloneNode.removeAttr("_type");cloneNode.removeAttr("_shape");cloneNode.removeAttr("id");cloneNode.children().each(function(){$(this).removeAttr("_type");$(this).removeAttr("_shape");$(this).removeAttr("id");$(this).removeAttr("marker-end");$(this).removeAttr("marker-start");$(this).removeAttr("marker-mid")});var data={id:patternId,x:0,y:0,width:patternWidth,height:patternHeight,patternUnits:"userSpaceOnUse"};if(patternTransform){data.patternTransform=patternTransform}var el=document.createElementNS("http://www.w3.org/2000/svg","pattern");el.appendChild(cloneNode.get(0));for(var k in data){el.setAttribute(k,data[k])}$(svg).find("defs").get(0).appendChild(el);if(isEdge){if(!thickness||thickness==0){return}var pathStr;var topVertices=geometry.getParallelPath(vertices,thickness);var bottomVertices=geometry.getParallelPath(vertices,-thickness);bottomVertices=bottomVertices.reverse();var newVertices=topVertices.concat(bottomVertices);for(var l=0,lenl=newVertices.length;l");me._remove(me._getREleById(tempNode.id));if(key=="start"){cloneNode.attr("transform","rotate(180,"+size[0]/2+","+size[1]/2+")")}cloneNode.removeAttr("_type");cloneNode.removeAttr("_shape");cloneNode.removeAttr("id");cloneNode.children().each(function(){$(this).removeAttr("_type");$(this).removeAttr("_shape");$(this).removeAttr("id");$(this).removeAttr("marker-end");$(this).removeAttr("marker-start");$(this).removeAttr("marker-mid")});var data={id:markerId,refX:ref[0],refY:ref[1],markerWidth:size[0],markerHeight:size[1],orient:"auto"};var el=document.createElementNS("http://www.w3.org/2000/svg","marker");el.appendChild(cloneNode.get(0));for(var k in data){el.setAttribute(k,data[k])}$(svg).find("defs").get(0).appendChild(el);makerData[key]=data}rElement.attr("stroke-opacity","0");var totalLenth=Raphael.getTotalLength(nodePath);var from,to;if(makerData.start&&makerData.end){from=makerData.start["markerWidth"]*1.5;to=totalLenth-makerData.end["markerWidth"]*1.5}else{if(makerData.start&&!makerData.end){from=makerData.start["markerWidth"]*1.5;to=totalLenth}else{if(!makerData.start&&makerData.end){from=0;to=totalLenth-makerData.end["markerWidth"]*1.5}else{from=0;to=totalLenth}}}var subPath=Raphael.getSubpath(nodePath,from,to);var virtualNode=me._PAPER.path(subPath);virtualNode.attr(nodeStyle);for(var key in makerData){$(virtualNode.node).attr("marker-"+key,"url(#"+makerData[key].id+")")}me._add(virtualNode);groupElement.appendChild(virtualNode.node)};var drawAnimation=function(rElement,nodeStyle){var animationData=nodeStyle.animation;var animationRepeat=nodeStyle["animation-repeat"];var maxDuration=0;var monitorAnimationIndex;var delay,ms;for(var i=0,leni=animationData.length;iv._CONFIG.LABEL_MAX_SIZE){o[0]=v._CONFIG.LABEL_MAX_SIZE}}c=this._PAPER.text(w[0],w[1],m,o);c.attr(h);g=c.getBBox();r=r?(r>g.width?r:g.width):g.width;p=p?(p>g.height?p:g.height):g.height;d=OG.Util.round(w[0]-r/2);n=OG.Util.round(w[1]-p/2);s=new OG.Rectangle([d,n],r,p);if(h["label-direction"]==="vertical"){switch(j){case"start":k=s.getBoundary().getLowerCenter().y;break;case"end":k=s.getBoundary().getUpperCenter().y;break;case"middle":k=s.getBoundary().getCentroid().y;break;default:k=s.getBoundary().getCentroid().y;break}switch(h["vertical-align"]){case"top":l=OG.Util.round(s.getBoundary().getLeftCenter().x+g.height/2);break;case"bottom":l=OG.Util.round(s.getBoundary().getRightCenter().x-g.height/2);break;case"middle":l=s.getBoundary().getCentroid().x;break;default:l=s.getBoundary().getCentroid().x;break}u=-90}else{switch(j){case"start":l=s.getBoundary().getLeftCenter().x;break;case"end":l=s.getBoundary().getRightCenter().x;break;case"middle":l=s.getBoundary().getCentroid().x;break;default:l=s.getBoundary().getCentroid().x;break}switch(h["vertical-align"]){case"top":k=OG.Util.round(s.getBoundary().getUpperCenter().y+g.height/2);break;case"bottom":k=OG.Util.round(s.getBoundary().getLowerCenter().y-g.height/2);break;case"middle":k=s.getBoundary().getCentroid().y;break;default:k=s.getBoundary().getCentroid().y;break}}c.attr({x:l,y:k,stroke:"none",fill:h["font-color"]||v._CONFIG.DEFAULT_STYLE.LABEL["font-color"],"font-size":h["font-size"]||v._CONFIG.DEFAULT_STYLE.LABEL["font-size"],"fill-opacity":1});if(m!=""){$(c.node).css({"background-color":h.fill||v._CONFIG.DEFAULT_STYLE.LABEL.fill})}$(c.node).css({cursor:"move"});if(u||h["label-angle"]){if(u===0){u=parseInt(h["label-angle"],10)}c.rotate(u)}c.attr({"text-anchor":j});if(f&&m){g=c.getBBox();b=this._PAPER.rect(g.x-e/2,g.y-e/2,g.width+e,g.height+e);var a=this._CANVAS_COLOR;if(a=="transparent"){a="white"}b.attr({stroke:"none",fill:a,"fill-opacity":1});this._add(b);i.node.appendChild(b.node)}this._add(c,q+"FO");i.node.appendChild(c.node);return i.node};OG.renderer.RaphaelRenderer.prototype.drawShape=function(h,i,o,a,c,l){var d=o?o[0]:100,n=o?o[1]:100,b,k,m,e,g,f,j=this;if(i instanceof OG.shape.GeomShape){k=i.createShape();k.moveCentroid(h);k.resizeBox(d,n);b=this.drawGeom(k,a,c);i.geom=b.geom}else{if(i instanceof OG.shape.TextShape){m=i.createShape();b=this.drawText(h,m,o,a,c);i.text=b.text;i.angle=b.angle;i.geom=b.geom}else{if(i instanceof OG.shape.ImageShape){e=i.createShape();b=this.drawImage(h,e,o,a,c);i.image=b.image;i.angle=b.angle;i.geom=b.geom}else{if(i instanceof OG.shape.SvgShape){f=i.createShape();b=this.drawSvg(h,f,o,a,c);i.xml=b.xml;i.angle=b.angle;i.geom=b.geom}else{if(i instanceof OG.shape.HtmlShape){g=i.createShape();b=this.drawHtml(h,g,o,a,c);i.html=b.html;i.angle=b.angle;i.geom=b.geom}else{if(i instanceof OG.shape.EdgeShape){k=i.geom||i.createShape();b=this.drawEdge(k,a,c);i.geom=b.geom}else{if(i instanceof OG.shape.GroupShape){k=i.createShape();k.moveCentroid(h);k.resizeBox(d,n);b=this.drawGroup(k,a,c);i.geom=b.geom}}}}}}}if(i.geom){b.shape=i}b.shapeStyle=(a instanceof OG.geometry.Style)?a.map:a;$(b).attr("_shape_id",i.SHAPE_ID);j._drawSubShape(b);if(!(i instanceof OG.shape.TextShape)){this.drawLabel(b);if(i instanceof OG.shape.EdgeShape){this.drawEdgeLabel(b,null,"FROM");this.drawEdgeLabel(b,null,"TO")}}if(b.geom){if(OG.Util.isIE7()){b.removeAttribute("geom")}else{delete b.geom}}if(b.text){if(OG.Util.isIE7()){b.removeAttribute("text")}else{delete b.text}}if(b.image){if(OG.Util.isIE7()){b.removeAttribute("image")}else{delete b.image}}if(b.angle){if(OG.Util.isIE7()){b.removeAttribute("angle")}else{delete b.angle}}i.currentElement=b;i.currentCanvas=this._CANVAS;if(!l){i.onDrawShape();$(this._PAPER.canvas).trigger("drawShape",[b])}return b};OG.renderer.RaphaelRenderer.prototype.drawGeom=function(e,b,f){var c=this,d,a={};OG.Util.apply(a,(b instanceof OG.geometry.Style)?b.map:b||{});if(f===0||f){d=this._getREleById(f);if(d){this._removeChild(d)}else{d=this._PAPER.group();this._add(d,f,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.GEOM);this._ROOT_GROUP.node.appendChild(d.node)}}else{d=this._PAPER.group();this._add(d,f,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.GEOM);this._ROOT_GROUP.node.appendChild(d.node)}this._drawGeometry(d.node,e,a);d.node.geom=e;d.attr(c._CONFIG.DEFAULT_STYLE.SHAPE);if(d.node.shape){d.node.shape.geom=e;if(d.node.geom){if(OG.Util.isIE7()){d.node.removeAttribute("geom")}else{delete d.node.geom}}}return d.node};OG.renderer.RaphaelRenderer.prototype.drawText=function(r,h,j,o,l){var q=this,m=j?j[0]:null,k=j?j[1]:null,p=j?j[2]||0:0,e,a,d={},n,c,b,i,g,f;OG.Util.apply(d,(o instanceof OG.geometry.Style)?o.map:o||{},q._CONFIG.DEFAULT_STYLE.TEXT);if(l===0||l){e=this._getREleById(l);if(e){this._removeChild(e)}else{e=this._PAPER.group();this._add(e,l,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.TEXT);this._ROOT_GROUP.node.appendChild(e.node)}}else{e=this._PAPER.group();this._add(e,l,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.TEXT);this._ROOT_GROUP.node.appendChild(e.node)}a=this._PAPER.text(r[0],r[1],h,j);a.attr(d);c=a.getBBox();m=m?(m>c.width?m:c.width):c.width;k=k?(k>c.height?k:c.height):c.height;b=OG.Util.round(r[0]-m/2);i=OG.Util.round(r[1]-k/2);n=new OG.Rectangle([b,i],m,k);n.style.map=d;switch(d["text-anchor"]){case"start":g=n.getBoundary().getLeftCenter().x;break;case"end":g=n.getBoundary().getRightCenter().x;break;case"middle":g=n.getBoundary().getCentroid().x;break;default:g=n.getBoundary().getCentroid().x;break}switch(d["vertical-align"]){case"top":f=OG.Util.round(n.getBoundary().getUpperCenter().y+c.height/2);break;case"bottom":f=OG.Util.round(n.getBoundary().getLowerCenter().y-c.height/2);break;case"middle":f=n.getBoundary().getCentroid().y;break;default:f=n.getBoundary().getCentroid().y;break}a.attr({x:g,y:f});a.attr({stroke:"none",fill:d["font-color"]||q._CONFIG.DEFAULT_STYLE.LABEL["font-color"],"font-size":d["font-size"]||q._CONFIG.DEFAULT_STYLE.LABEL["font-size"]});if(p){a.rotate(p)}this._add(a);e.node.appendChild(a.node);e.node.text=h;e.node.angle=p;e.node.geom=n;e.attr(q._CONFIG.DEFAULT_STYLE.SHAPE);if(e.node.shape){e.node.shape.text=h;e.node.shape.angle=p;e.node.shape.geom=n;if(e.node.text){if(OG.Util.isIE7()){e.node.removeAttribute("text")}else{delete e.node.text}}if(e.node.angle){if(OG.Util.isIE7()){e.node.removeAttribute("angle")}else{delete e.node.angle}}if(e.node.geom){if(OG.Util.isIE7()){e.node.removeAttribute("geom")}else{delete e.node.geom}}}return e.node};OG.renderer.RaphaelRenderer.prototype.drawHtml=function(i,h,p,a,b){var j=this,c=p?p[0]:null,n=p?p[1]:null,f=p?p[2]||0:0,m,g,e={},o,l,d,k;OG.Util.apply(e,(a instanceof OG.geometry.Style)?a.map:a||{},j._CONFIG.DEFAULT_STYLE.HTML);if(b===0||b){m=this._getREleById(b);if(m){this._removeChild(m)}else{m=this._PAPER.group();this._add(m,b,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.HTML);this._ROOT_GROUP.node.appendChild(m.node)}}else{m=this._PAPER.group();this._add(m,b,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.HTML);this._ROOT_GROUP.node.appendChild(m.node)}g=this._PAPER.foreignObject(h,i[0],i[1],c,n);g.attr(e);o=g.getBBox();c=c||o.width;n=n||o.height;d=OG.Util.round(i[0]-c/2);k=OG.Util.round(i[1]-n/2);g.attr({x:d,y:k});l=new OG.Rectangle([d,k],c,n);if(f){g.rotate(f)}l.style.map=e;this._add(g);m.node.appendChild(g.node);m.node.html=h;m.node.angle=f;m.node.geom=l;m.attr(j._CONFIG.DEFAULT_STYLE.SHAPE);if(m.node.shape){m.node.shape.html=h;m.node.shape.angle=f;m.node.shape.geom=l;if(m.node.html){if(OG.Util.isIE7()){m.node.removeAttribute("html")}else{delete m.node.html}}if(m.node.angle){if(OG.Util.isIE7()){m.node.removeAttribute("angle")}else{delete m.node.angle}}if(m.node.geom){if(OG.Util.isIE7()){m.node.removeAttribute("geom")}else{delete m.node.geom}}}return m.node};OG.renderer.RaphaelRenderer.prototype.drawImage=function(h,o,p,a,b){var i=this,c=p?p[0]:null,m=p?p[1]:null,f=p?p[2]||0:0,l,g,e={},n,k,d,j;OG.Util.apply(e,(a instanceof OG.geometry.Style)?a.map:a||{},i._CONFIG.DEFAULT_STYLE.IMAGE);if(b===0||b){l=this._getREleById(b);if(l){this._removeChild(l)}else{l=this._PAPER.group();this._add(l,b,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.IMAGE);this._ROOT_GROUP.node.appendChild(l.node)}}else{l=this._PAPER.group();this._add(l,b,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.IMAGE);this._ROOT_GROUP.node.appendChild(l.node)}g=this._PAPER.image(o,h[0],h[1],c,m);g.attr(e);n=g.getBBox();c=c||n.width;m=m||n.height;d=OG.Util.round(h[0]-c/2);j=OG.Util.round(h[1]-m/2);g.attr({x:d,y:j});k=new OG.Rectangle([d,j],c,m);if(f){g.rotate(f)}k.style.map=e;this._add(g);l.node.appendChild(g.node);l.node.image=o;l.node.angle=f;l.node.geom=k;l.attr(i._CONFIG.DEFAULT_STYLE.SHAPE);if(l.node.shape){l.node.shape.image=o;l.node.shape.angle=f;l.node.shape.geom=k;if(l.node.image){if(OG.Util.isIE7()){l.node.removeAttribute("image")}else{delete l.node.image}}if(l.node.angle){if(OG.Util.isIE7()){l.node.removeAttribute("angle")}else{delete l.node.angle}}if(l.node.geom){if(OG.Util.isIE7()){l.node.removeAttribute("geom")}else{delete l.node.geom}}}return l.node};OG.renderer.RaphaelRenderer.prototype.drawSvg=function(i,h,q,a,b){var j=this,c=q?q[0]:null,o=q?q[1]:null,f=q?q[2]||0:0,n,g,e={},p,l,d,k;OG.Util.apply(e,(a instanceof OG.geometry.Style)?a.map:a||{},j._CONFIG.DEFAULT_STYLE.SVG);if(b===0||b){n=this._getREleById(b);if(n){this._removeChild(n)}else{n=this._PAPER.group();this._add(n,b,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.SVG);this._ROOT_GROUP.node.appendChild(n.node)}}else{n=this._PAPER.group();this._add(n,b,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.SVG);this._ROOT_GROUP.node.appendChild(n.node)}g=$(h);for(var m in e){g.attr(m,e[m])}d=OG.Util.round(i[0]-c/2);k=OG.Util.round(i[1]-o/2);g.attr("x",d+"px");g.attr("y",k+"px");g.attr("width",c+"px");g.attr("height",o+"px");l=new OG.Rectangle([d,k],c,o);if(f){g.rotate(f)}l.style.map=e;$(n.node).append(g);n.node.xml=h;n.node.angle=f;n.node.geom=l;n.attr(j._CONFIG.DEFAULT_STYLE.SHAPE);if(n.node.shape){n.node.shape.xml=h;n.node.shape.angle=f;n.node.shape.geom=l;if(n.node.image){if(OG.Util.isIE7()){n.node.removeAttribute("image")}else{delete n.node.image}}if(n.node.angle){if(OG.Util.isIE7()){n.node.removeAttribute("angle")}else{delete n.node.angle}}if(n.node.geom){if(OG.Util.isIE7()){n.node.removeAttribute("geom")}else{delete n.node.geom}}}return n.node};OG.renderer.RaphaelRenderer.prototype._getPointOfInflectionFromEdge=function(c){var h=null,g,e,f,d,b,a;if(c instanceof OG.geometry.PolyLine){d=c.getVertices();if(d.length!=4){return h}g=d[0];e=d[d.length-1];f=d[1];h={x:f.x-g.x,y:f.y-g.y};b=OG.Util.round((e.x-g.x)/2);a=OG.Util.round((e.y-g.y)/2);h.x=(h.x==b)?0:h.x;h.y=(h.y==a)?0:h.y}return h};OG.renderer.RaphaelRenderer.prototype.drawEdge=function(n,b,c,f,a){var h=this,m,e={},g=n.getVertices(),k=g[0],j=g[g.length-1],l=[],d,i;OG.Util.apply(e,(b instanceof OG.geometry.Style)?b.map:b||{},OG.Util.apply({},n.style.map,h._CONFIG.DEFAULT_STYLE.EDGE));if(c===0||c){m=this._getREleById(c);if(m){this._removeEdgeChild(m)}else{m=this._PAPER.group();this._add(m,c,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.EDGE);this._ROOT_GROUP.node.appendChild(m.node)}}else{m=this._PAPER.group();this._add(m,c,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.EDGE);this._ROOT_GROUP.node.appendChild(m.node)}if(f){l=[[k.x,k.y-h._CONFIG.GUIDE_RECT_SIZE/2],[k.x+h._CONFIG.GUIDE_RECT_SIZE*2,k.y-h._CONFIG.GUIDE_RECT_SIZE],[k.x+h._CONFIG.GUIDE_RECT_SIZE*2,k.y+h._CONFIG.GUIDE_RECT_SIZE],[k.x,k.y+h._CONFIG.GUIDE_RECT_SIZE/2]]}else{if(n instanceof OG.geometry.Line){switch(e["edge-type"].toLowerCase()){case OG.Constants.EDGE_TYPE.STRAIGHT:l=[k,j];break;case OG.Constants.EDGE_TYPE.PLAIN:i=this._adjustEdgeDirection([k.x,k.y],[j.x,j.y]);l=[k,j];break;case OG.Constants.EDGE_TYPE.BEZIER:i=this._adjustEdgeDirection([k.x,k.y],[j.x,j.y]);l=this._bezierCurve([k.x,k.y],[j.x,j.y],i[0],i[1]);break}}else{if(n instanceof OG.geometry.Curve){l=n.getControlPoints()}else{if(n instanceof OG.geometry.BezierCurve){l=n.getControlPoints()}else{l=g}}}}if(f){d=new OG.Curve(l)}else{if(n instanceof OG.geometry.Curve){d=new OG.Curve(l)}else{if(n instanceof OG.geometry.BezierCurve){d=new OG.BezierCurve(l)}else{if(e["edge-type"].toLowerCase()===OG.Constants.EDGE_TYPE.BEZIER){d=new OG.BezierCurve(l)}else{d=new OG.PolyLine(l)}}}}this._drawGeometry(m.node,d,e,null,true);m.node.geom=d;m.attr(h._CONFIG.DEFAULT_STYLE.SHAPE);if(m.node.shape){m.node.shape.geom=d;if(m.node.geom){if(OG.Util.isIE7()){m.node.removeAttribute("geom")}else{delete m.node.geom}}}return m.node};OG.renderer.RaphaelRenderer.prototype.drawGroup=function(m,b,c){var k=this,n,p,e={},o,h,d,a,g,j={},f;OG.Util.apply(e,(b instanceof OG.geometry.Style)?b.map:b||{});if(c===0||c){n=this._getREleById(c);if(n){o=n.node.childNodes;for(h=o.length-1;h>=0;h--){if($(o[h]).attr("_type")!==OG.Constants.NODE_TYPE.SHAPE){this._remove(this._getREleById(o[h].id))}}}else{n=this._PAPER.group();this._add(n,c,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.GROUP);this._ROOT_GROUP.node.appendChild(n.node)}}else{n=this._PAPER.group();this._add(n,c,OG.Constants.NODE_TYPE.SHAPE,OG.Constants.SHAPE_TYPE.GROUP);this._ROOT_GROUP.node.appendChild(n.node)}p=this._drawGeometry(n.node,m,e);n.node.geom=m;n.attr(k._CONFIG.DEFAULT_STYLE.SHAPE);d=m.getBoundary();g=new OG.geometry.Rectangle(d.getUpperLeft(),(d.getUpperRight().x-d.getUpperLeft().x),(d.getLowerLeft().y-d.getUpperLeft().y));OG.Util.apply(j,m.style.map,e);if(j["label-direction"]&&j["vertical-align"]==="top"){if(j["label-direction"]==="vertical"){if(j["title-size"]){a=new OG.geometry.Line([d.getUpperLeft().x+j["title-size"],d.getUpperLeft().y],[d.getLowerLeft().x+j["title-size"],d.getLowerLeft().y]);g=new OG.geometry.Rectangle(d.getUpperLeft(),j["title-size"],(d.getLowerLeft().y-d.getUpperLeft().y))}else{a=new OG.geometry.Line([d.getUpperLeft().x+20,d.getUpperLeft().y],[d.getLowerLeft().x+20,d.getLowerLeft().y]);g=new OG.geometry.Rectangle(d.getUpperLeft(),20,(d.getLowerLeft().y-d.getUpperLeft().y))}}else{if(j["title-size"]){a=new OG.geometry.Line([d.getUpperLeft().x,d.getUpperLeft().y+j["title-size"]],[d.getUpperRight().x,d.getUpperRight().y+j["title-size"]]);g=new OG.geometry.Rectangle(d.getUpperLeft(),(d.getUpperRight().x-d.getUpperLeft().x),j["title-size"])}else{a=new OG.geometry.Line([d.getUpperLeft().x,d.getUpperLeft().y+20],[d.getUpperRight().x,d.getUpperRight().y+20]);g=new OG.geometry.Rectangle(d.getUpperLeft(),(d.getUpperRight().x-d.getUpperLeft().x),20)}}this._drawGeometry(n.node,a,e);var l=JSON.parse(JSON.stringify(k._CONFIG.DEFAULT_STYLE.GROUP_HIDDEN));if(j["label-fill"]){l.fill=j["label-fill"]}if(j["label-fill-opacity"]){l["fill-opacity"]=j["label-fill-opacity"]}this._drawGeometry(n.node,g,l)}if(p.id!==n.node.firstChild.id){n.node.insertBefore(p,n.node.firstChild)}if(n.node.shape){if(!n.node.shape.isCollapsed||n.node.shape.isCollapsed===false){n.node.shape.geom=m}if(n.node.geom){if(OG.Util.isIE7()){n.node.removeAttribute("geom")}else{delete n.node.geom}}}return n.node};OG.renderer.RaphaelRenderer.prototype.drawLabel=function(k,n,b){var g=this._getREleById(OG.Util.isElement(k)?k.id:k),e,i,j,c={},o,d,m,f,l=function(r){var t,v,w,q,p=0,s,u;if(r.shape.geom.style.get("edge-type")===OG.Constants.EDGE_TYPE.BEZIER){t=r.shape.geom.getControlPoints();v=t[0];w=t[t.length-1];return new OG.geometry.Coordinate(OG.Util.round((v.x+w.x)/2),OG.Util.round((v.y+w.y)/2))}else{t=r.shape.geom.getVertices();q=r.shape.geom.getLength();for(var s=0,x=t.length-1;sq/2){u=r.shape.geom.intersectCircleToLine(t[s+1],p-q/2,t[s+1],t[s]);break}}return u[0]}};OG.Util.apply(c,(b instanceof OG.geometry.Style)?b.map:b||{});if(g&&g.node.shape){n=OG.Util.trim(n);e=g.node;j=e.shape.geom.getBoundary();d=e.shape.label;if(n!==undefined&&n!==d){var h=e.shape.onBeforeLabelChange(n,d);if(typeof h=="boolean"&&!h){return false}m=jQuery.Event("beforeLabelChange",{element:e,afterText:n,beforeText:d});$(this._PAPER.canvas).trigger(m);if(m.isPropagationStopped()){return false}n=m.afterText}OG.Util.apply(e.shape.geom.style.map,c);e.shape.label=n===undefined?e.shape.label:n;if(e.shape.label!==undefined){switch(e.shape.geom.style.get("label-position")){case"left":f=[j.getCentroid().x-j.getWidth(),j.getCentroid().y];break;case"right":f=[j.getCentroid().x+j.getWidth(),j.getCentroid().y];break;case"top":f=[j.getCentroid().x,j.getCentroid().y-j.getHeight()];break;case"bottom":f=[j.getCentroid().x,j.getCentroid().y+j.getHeight()];break;default:f=[j.getCentroid().x,j.getCentroid().y];break}o=[j.getWidth(),j.getHeight()];if(e.shape instanceof OG.shape.EdgeShape){var a=l(e);f=[a.x,a.y]}i=this._drawLabel(f,e.shape.label,o,e.shape.geom.style,e.id+OG.Constants.LABEL_SUFFIX,e.shape instanceof OG.shape.EdgeShape);e.appendChild(i);if(n!==undefined){e.shape.onDrawLabel(n);$(this._PAPER.canvas).trigger("drawLabel",[e,n])}if(n!==undefined&&d!==undefined&&n!==d){e.shape.onLabelChanged(n,d);$(this._PAPER.canvas).trigger("labelChanged",[e,n,d])}}}return i};OG.renderer.RaphaelRenderer.prototype.drawEdgeLabel=function(i,k,h){var g=this,d=this._getREleById(OG.Util.isElement(i)?i.id:i),b,e,f,c,a,j;if(d&&d.node.shape){k=OG.Util.trim(k);b=d.node;if(b.shape instanceof OG.shape.EdgeShape){e=b.shape.geom.getVertices();if(h==="FROM"){c=[e[0].x,e[0].y+g._CONFIG.FROMTO_LABEL_OFFSET_TOP];b.shape.fromLabel=k||b.shape.fromLabel;a=b.shape.fromLabel;j=OG.Constants.FROM_LABEL_SUFFIX}else{c=[e[e.length-1].x,e[e.length-1].y+g._CONFIG.FROMTO_LABEL_OFFSET_TOP];b.shape.toLabel=k||b.shape.toLabel;a=b.shape.toLabel;j=OG.Constants.TO_LABEL_SUFFIX}if(a){f=this._drawLabel(c,a,[0,0],b.shape.geom.style,b.id+j,false);b.appendChild(f)}}}return f};OG.renderer.RaphaelRenderer.prototype.redrawShape=function(e,h,i){var g=this,f,b,c,j,a;var d=function(s,n){var t,r,p,l=n.childNodes,k,q,o,m;for(q=l.length-1;q>=0;q--){if(!g.isShape(n)){return}d(s,l[q]);m=false;t=$(l[q]).attr("_fromedge");if(t){t=t.split(",");for(var o=0,u=t.length;o3){ap=at.substring(0,3)+".."}p=z._PAPER.rect(ak.x+v,ak.y,ae,ae);E=z._PAPER.path(V(0,0));D=z._PAPER.text(0,0,ap,ae);p.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);if(!Z){E.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE)}if(Z){E.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE_ESSENSIA)}F.appendChild(E);F.appendChild(D);F.appendChild(p);z._add(p,h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT+ar);z._add(E,h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT+ar+"1");z._add(D,h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT+ar+"2");if(!an.line){an.line=[]}an.line.push({node:p.node,text:at,label:aq?aq:"",shape:av});I.push(p)}function R(ap,aq){if(!C){return}p=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT+ap);E=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT+ap+"1");D=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT+ap+"2");I.push(p)}function K(){if(!B){return}M=z._PAPER.rect(ak.x+v,ak.y,ae,ae);M.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_RECT_AREA);F.appendChild(M);z._add(M,h.id+OG.Constants.GUIDE_SUFFIX.RECT);an.rect=M.node;I.push(M)}function q(){if(!B){return}M=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.RECT);I.push(M)}function c(ap){i=z._PAPER.image("resources/images/symbol/quarter-upper.png",0,0,ae,ae);i.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);F.appendChild(i);z._add(i,h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER);an.qUpper=i.node;$(i.node).click(function(){z.divideLane(t,OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER)});aa=z._PAPER.image("resources/images/symbol/quarter-bisector.png",0,0,ae,ae);aa.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);F.appendChild(aa);z._add(aa,h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR);an.qBisector=aa.node;$(aa.node).click(function(){z.divideLane(t,OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR)});Q=z._PAPER.image("resources/images/symbol/quarter-thirds.png",0,0,ae,ae);Q.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);F.appendChild(Q);z._add(Q,h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS);an.qThirds=Q.node;$(Q.node).click(function(){z.divideLane(t,OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS)});g=z._PAPER.image("resources/images/symbol/quarter-low.png",0,0,ae,ae);g.attr(z._CONFIG.DEFAULT_STYLE.GUIDE_LINE_AREA);F.appendChild(g);z._add(g,h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_LOW);an.qLow=g.node;$(g.node).click(function(){z.divideLane(t,OG.Constants.GUIDE_SUFFIX.QUARTER_LOW)});if(ap===0){af(aa);af(Q);I.push(i);I.push(g)}if(ap===1){af(Q);I.push(i);I.push(aa);I.push(g)}if(ap===2){I.push(i);I.push(aa);I.push(Q);I.push(g)}}function s(ap){i=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER);aa=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR);Q=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS);g=z._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.QUARTER_LOW);if(ap===0){af(aa);af(Q);I.push(i);I.push(g)}if(ap===1){af(Q);I.push(i);I.push(aa);I.push(g)}if(ap===2){I.push(i);I.push(aa);I.push(Q);I.push(g)}$.each(I,function(aq,ar){U(ar)})}function af(ap){ap.attr({opacity:"0",x:-100,y:-100})}function U(ap){ap.attr({opacity:"1"})}function Y(){var au=4,ap,at,ar,aq;$.each(I,function(aw,av){ar=parseInt(aw/au);aq=parseInt(aw%au);ap=ak.x+((ar+1)*(v+ae)-ae);at=ak.y+(aq*(v+ae));av.attr({x:ap,y:at});if(av.id===h.id+OG.Constants.GUIDE_SUFFIX.LINE){if(z._CONFIG.GUIDE_CONTROL_LINE_NUM==2){z._getREleById(av.id+"1").attr({path:ao(ap,at,0,8)});z._getREleById(av.id+"2").attr({path:ao(ap,at,8,8)})}else{z._getREleById(av.id+"1").attr({path:ao(ap,at,0,4)})}}if(av.id.indexOf(h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT)!=-1){var aw=av.id.replace(h.id+OG.Constants.GUIDE_SUFFIX.LINE_TEXT,"");z._getREleById(av.id+"1").attr({path:V(ap,at)});z._getREleById(av.id+"2").attr({x:ap+10,y:at+16})}})}var ad=z.getTextListInController(t);if(!ad){ad=[]}if(this._getREleById(h.id+OG.Constants.GUIDE_SUFFIX.GUIDE)){if(!ab){d();aj();if(W){s(z.enableDivideCount(t))}if(!W){q();if(ad.length){$.each(ad,function(ap,aq){R(ap,aq)})}else{ah()}}f()}if(ab){d();f()}Y();return null}else{if(ab){e();y();ai()}if(!ab){e();y();S();if(W){c(z.enableDivideCount(t))}if(!W){K();if(ad.length){$.each(ad,function(ap,aq){l(ap,aq)})}else{j()}}ai()}Y();if(n){n.insertBefore(h)}if(F){z.getRootGroup().appendChild(F.node)}$(h.node).attr("_selected","true");return an}};OG.renderer.RaphaelRenderer.prototype.drawStickGuide=function(a){if(!this._CONFIG.STICK_GUIDE){return}var d=this,e,c,b;if(!a){return}if(a.x){c=a.x*d._CONFIG.SCALE;this.removeStickGuide("vertical");e=this._PAPER.path("M"+c+",0L"+c+",10000");this._stickGuideX=e}if(a.y){b=a.y*d._CONFIG.SCALE;this.removeStickGuide("horizontal");e=this._PAPER.path("M0,"+b+"L10000,"+b);this._stickGuideY=e}if(e){e.attr("stroke-width","2");e.attr("stroke","#FFCC50");e.attr("opacity","0.7")}};OG.renderer.RaphaelRenderer.prototype.removeStickGuide=function(a){if(!this._CONFIG.STICK_GUIDE){return}if(!a){return}if(a==="vertical"){if(this._stickGuideX){this._remove(this._stickGuideX);this._stickGuideX=null}}if(a==="horizontal"){if(this._stickGuideY){this._remove(this._stickGuideY);this._stickGuideY=null}}};OG.renderer.RaphaelRenderer.prototype.removeAllStickGuide=function(){if(!this._CONFIG.STICK_GUIDE){return}this.removeStickGuide("vertical");this.removeStickGuide("horizontal")};OG.renderer.RaphaelRenderer.prototype.removeGuide=function(c){var b=this._getREleById(OG.Util.isElement(c)?c.id:c),a,d;if(b){a=this._getREleById(b.id+OG.Constants.GUIDE_SUFFIX.GUIDE);d=this._getREleById(b.id+OG.Constants.GUIDE_SUFFIX.BBOX);b.node.removeAttribute("_selected");this._remove(a);this._remove(d);this.removeAllStickGuide()}};OG.renderer.RaphaelRenderer.prototype.removeAllGuide=function(){var a=this;$(a.getRootElement()).find("[_type="+OG.Constants.NODE_TYPE.SHAPE+"][_selected=true]").each(function(b,c){if(OG.Util.isElement(c)&&c.id){a.removeGuide(c)}})};OG.renderer.RaphaelRenderer.prototype.drawEdgeGuide=function(a){return null;var s=this,m=this._getREleById(OG.Util.isElement(a)?a.id:a),e=m?m.node.shape.geom:null,f,o,h,u,p,q,t,j,k,n=[],d=s._CONFIG.GUIDE_RECT_SIZE,l=OG.Util.round(d/2),g={},r;var c=a.shape.GUIDE_BBOX?a.shape.GUIDE_BBOX:s._CONFIG.DEFAULT_STYLE.GUIDE_BBOX;if(m&&e){OG.Util.apply(g,e.style.map,s._CONFIG.DEFAULT_STYLE.EDGE);f=g["edge-type"]===OG.Constants.EDGE_TYPE.BEZIER?e.getControlPoints():e.getVertices();o=$(a).attr("_from")&&$(a).attr("_to")&&$(a).attr("_from")===$(a).attr("_to");if(this._getREleById(m.id+OG.Constants.GUIDE_SUFFIX.GUIDE)){this._remove(this._getREleById(m.id+OG.Constants.GUIDE_SUFFIX.BBOX));p="";if(g["edge-type"]===OG.Constants.EDGE_TYPE.BEZIER){for(var r=0,b=f.length;r1){for(var f=0,m=a.length;f0){for(var f=0,l=h.length;fd.shape.geom.boundary._leftCenter.x?d.shape.geom.boundary._leftCenter.x:a}});$(b.getRootElement()).find("[_selected=true]").each(function(c,d){if(d.shape.TYPE=="EDGE"){return}b.move(d,[a-d.shape.geom.boundary._leftCenter.x,0]);b.drawGuide(d)});b._CANVAS._HANDLER.selectShapes(b._CANVAS._HANDLER._getSelectedElement())};OG.renderer.RaphaelRenderer.prototype.alignRight=function(){var b=0,a=this;$(a.getRootElement()).find("[_selected=true]").each(function(c,d){if(d.shape.TYPE=="EDGE"){return}if(b==0){b=d.shape.geom.boundary._rightCenter.x}else{b=bd.shape.geom.boundary._rightCenter.y?d.shape.geom.boundary._rightCenter.y:b}});$(a.getRootElement()).find("[_selected=true]").each(function(c,d){if(d.shape.TYPE=="EDGE"){return}a.move(d,[0,b-d.shape.geom.boundary._rightCenter.y]);a.drawGuide(d)});a._CANVAS._HANDLER.selectShapes(a._CANVAS._HANDLER._getSelectedElement())};OG.renderer.RaphaelRenderer.prototype.removeShape=function(f,b){var c=this._getREleById(OG.Util.isElement(f)?f.id:f),h,e,d,g;h=c.node.childNodes;e=jQuery.Event("beforeRemoveShape",{element:c.node});if(!b){if(f.shape){var a=f.shape.onBeforeRemoveShape();if(typeof a=="boolean"&&!a){return false}}$(this._PAPER.canvas).trigger(e);if(e.isPropagationStopped()){return false}}this.removeAllConnectGuide();for(d=h.length-1;d>=0;d--){if(h[d].tagName=="svg"){h[d].parentNode.removeChild(h[d])}else{if($(h[d]).attr("_type")===OG.Constants.NODE_TYPE.SHAPE){this.removeShape(h[d])}}}this.disconnect(c.node);this.removeGuide(c.node);this.removeCollapseGuide(c.node);g=OG.Util.clone(c.node);if(!b){if(f.shape){f.shape.onRemoveShape()}}this.remove(c.node);if(!b){$(this._PAPER.canvas).trigger("removeShape",[g])}};OG.renderer.RaphaelRenderer.prototype.remove=function(b){var c=OG.Util.isElement(b)?b.id:b,a=this._getREleById(c);this._remove(a)};OG.renderer.RaphaelRenderer.prototype.removeChild=function(b){var c=OG.Util.isElement(b)?b.id:b,a=this._getREleById(c);this._removeChild(a)};OG.renderer.RaphaelRenderer.prototype.getRootElement=function(){return this._PAPER.canvas};OG.renderer.RaphaelRenderer.prototype.getElementByPoint=function(a){var b=this._PAPER.getElementByPoint(a[0],a[1]);return b?b.node.parentNode:null};OG.renderer.RaphaelRenderer.prototype.setAttr=function(b,c){var a=this._getREleById(OG.Util.isElement(b)?b.id:b);if(a){a.attr(c)}};OG.renderer.RaphaelRenderer.prototype.getAttr=function(c,b){var a=this._getREleById(OG.Util.isElement(c)?c.id:c);if(a){return a.attr(b)}return null};OG.renderer.RaphaelRenderer.prototype.setShapeStyle=function(b,c){var a=this._getREleById(OG.Util.isElement(b)?b.id:b);if(a&&b.shape&&b.shape.geom){OG.Util.apply(b.shape.geom.style.map,c||{});b.shapeStyle=b.shapeStyle||{};OG.Util.apply(b.shapeStyle,c||{});this.redrawShape(b)}};OG.renderer.RaphaelRenderer.prototype.setTextListInController=function(b,c){var a=this._getREleById(OG.Util.isElement(b)?b.id:b);if(a&&b.shape&&b.shape.geom){b.shape.textList=c}};OG.renderer.RaphaelRenderer.prototype.getTextListInController=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b);if(a&&b.shape&&b.shape.geom){return b.shape.textList}};OG.renderer.RaphaelRenderer.prototype.toFront=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b);if(a){a.toFront()}};OG.renderer.RaphaelRenderer.prototype.toBack=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b);if(a){a.toBack()}};OG.renderer.RaphaelRenderer.prototype.bringForward=function(c){var b=this._getREleById(OG.Util.isElement(c)?c.id:c);if(!b){return}c=b.node;var e=this,a=$(e.getRootGroup());if(e.isLane(c)){c=e._RENDERER.getRootLane(c)}var d=$(c).prevAll().length;a[0].insertBefore(c,OG.Util.isIE()?a[0].childNodes[d+1]:a[0].children[d+1])};OG.renderer.RaphaelRenderer.prototype.sendBackward=function(c){var b=this._getREleById(OG.Util.isElement(c)?c.id:c);if(!b){return}c=b.node;var e=this,a=$(e.getRootGroup());if(e.isLane(c)){c=e.getRootLane(c)}var d=$(c).prevAll().length;var f=d-2;if(f<0){f=0}a[0].insertBefore(c,OG.Util.isIE()?a[0].childNodes[f]:a[0].children[f])};OG.renderer.RaphaelRenderer.prototype.getCanvasSize=function(){return[this._PAPER.width,this._PAPER.height]};OG.renderer.RaphaelRenderer.prototype.setCanvasSize=function(a){this._PAPER.setSize(a[0],a[1])};OG.renderer.RaphaelRenderer.prototype.fitCanvasSize=function(a,c){var g=this,h=this.getRealRootBBox(),f,e,d=1,b=h.width+g._CONFIG.FIT_CANVAS_PADDING*2,i=h.height+g._CONFIG.FIT_CANVAS_PADDING*2;if(h.width!==0&&h.height!==0){f=h.x>g._CONFIG.FIT_CANVAS_PADDING?-1*(h.x-g._CONFIG.FIT_CANVAS_PADDING):g._CONFIG.FIT_CANVAS_PADDING-h.x;e=h.y>g._CONFIG.FIT_CANVAS_PADDING?-1*(h.y-g._CONFIG.FIT_CANVAS_PADDING):g._CONFIG.FIT_CANVAS_PADDING-h.y;this.move(this.getRootGroup(),[f,e]);this.removeAllGuide();if(a&&a.length===2){if(OG.Util.isDefined(c)&&c===true){d=a[0]/b>a[1]/i?a[1]/i:a[0]/b}b=b=0;c--){if($("#"+e[c].id)&&$("#"+e[c].id).attr("name")==OG.Constants.CONNECT_GUIDE_EVENT_AREA.NAME){b.push(e[c])}}}return b};OG.renderer.RaphaelRenderer.prototype.getNotConnectGuideElements=function(c){var e,b,d=[];var a=this._getREleById(OG.Util.isElement(c)?c.id:c);if(a){e=a.node.childNodes;for(b=e.length-1;b>=0;b--){if($("#"+e[b].id)&&$("#"+e[b].id).attr("name")!==OG.Constants.CONNECT_GUIDE_EVENT_AREA.NAME){d.push(e[b])}}}return d};OG.renderer.RaphaelRenderer.prototype.drawConnectGuide=function(e){var i=this,f=this._getREleById(OG.Util.isElement(e)?e.id:e),k=f?f.node.shape.geom:null,h,d,c,o,m,j=i._CONFIG.GUIDE_RECT_SIZE;var b=i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_SPOT_CIRCLE;var a=i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_SPOT_RECT;var l=function(){var q=k.getVertices();var s=[];for(var r=0,p=q.length;r0){var B=k.isRightAngleBetweenPoints(q[v-1],q[v]);if(B.flag){var y={x:(q[v-1].x+q[v].x)/2,y:(q[v-1].y+q[v].y)/2};if(B.type==="vertical"){var A=q[v-1].y-q[v].y;if(Math.abs(A)<50){return}var x=a.w;var u=a.h;m={x:y.x-(u/2),y:y.y-(x/2),width:u,height:x};a.cursor="ew-resize"}else{var A=q[v-1].x-q[v].x;if(Math.abs(A)<50){return}var x=a.w;var u=a.h;m={x:y.x-(x/2),y:y.y-(u/2),width:x,height:u};a.cursor="ns-resize"}var w=i._PAPER.rect(m.x,m.y,m.width,m.height);w.attr(a);i._add(w);f.appendChild(w);$(w.node).data("prev",v-1);$(w.node).data("next",v);$(w.node).data("parent",f);$(w.node).data("vertice",y);$(w.node).attr("name",OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT);$(w.node).data("type",OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT_RECT);$(w.node).data("direction",B.type);i.toFront(w);s.push(w.node)}}});return s};if(i.getSpots(e).length>0){return null}if(!i._CANVAS._HANDLER._isSelectable(e.shape)){return null}if(f&&k){h=k.getBoundary();o=h.getUpperLeft();var n={x:o.x-i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_BBOX_EXPEND,y:o.y-i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_BBOX_EXPEND,width:h.getWidth()+i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_BBOX_EXPEND*2,height:h.getHeight()+i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_BBOX_EXPEND*2};this._remove(this._getREleById(f.id+OG.Constants.CONNECT_GUIDE_SUFFIX.BBOX));c=this._PAPER.rect(n.x,n.y,n.width,n.height);c.attr(i._CONFIG.DEFAULT_STYLE.CONNECT_GUIDE_BBOX);this._add(c,f.id+OG.Constants.CONNECT_GUIDE_SUFFIX.BBOX);if($(e).attr("_shape")===OG.Constants.SHAPE_TYPE.EDGE){var g=l();d={bBox:c.node,spots:g}}else{d={bBox:c.node}}c.insertBefore(f);return d}return null};OG.renderer.RaphaelRenderer.prototype.removeConnectGuide=function(b){var d=this;var a=d._getREleById(OG.Util.isElement(b)?b.id:b);if(!a){return}var c=d._getREleById(a.id+OG.Constants.CONNECT_GUIDE_SUFFIX.BBOX);$(d.getSpots(b)).each(function(e,f){d._remove(d._getREleById(f.id))});d._remove(c)};OG.renderer.RaphaelRenderer.prototype.removeAllConnectGuide=function(){var a=this;$(a.getRootElement()).find("[_type="+OG.Constants.NODE_TYPE.SHAPE+"]").each(function(b,c){if(OG.Util.isElement(c)&&c.id){a.removeConnectGuide(c);a.removeVirtualSpot(c)}})};OG.renderer.RaphaelRenderer.prototype.removeOtherConnectGuide=function(a){var b=this;$(b.getRootElement()).find("[_type="+OG.Constants.NODE_TYPE.SHAPE+"]").each(function(c,d){if(OG.Util.isElement(d)&&d.id&&a.id!==d.id){b.removeConnectGuide(d);b.removeVirtualSpot(d)}})};OG.renderer.RaphaelRenderer.prototype.getSpots=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b),c=[];if(a){$("#"+a.id).find("[name="+OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT+"]").each(function(d,e){c.push(e)})}return c};OG.renderer.RaphaelRenderer.prototype.getCircleSpots=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b),c=[];if(a){$("#"+a.id).find("[name="+OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT+"]").each(function(d,e){if($(e).data("type")===OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT_CIRCLE){c.push(e)}})}return c};OG.renderer.RaphaelRenderer.prototype.createVirtualSpot=function(m,k,c){var j=this,e=this._getREleById(OG.Util.isElement(c)?c.id:c),l=e?e.node.shape.geom:null,h,i=[],n=0,b=[],f,d,o,a,g;j.removeVirtualSpot(c);if($(c).attr("_shape")!==OG.Constants.SHAPE_TYPE.EDGE){return null}if(e&&l){h=l.getVertices();i=[];b=[];n=0;$.each(h,function(p,q){if(p>0){var r=l.distanceToLine([m,k],[h[p-1],h[p]]);if(p==1){n=r;i=[h[p-1],h[p]];b=[p-1,p]}else{if(r=v){d=false}}if(s===OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT_RECT){var r=$(t).attr("width");if($(t).attr("height")>$(t).attr("width")){r=$(t).attr("height")}var u=a.r+parseInt(r);if(u>=v){d=false}}});if(!d){return null}g=j._PAPER.circle(o.x,o.y,a.r);g.attr(a);j._add(g);e.appendChild(g);$(g.node).data("prev",b[0]);$(g.node).data("next",b[1]);$(g.node).data("vertice",o);$(g.node).data("parent",e);$(g.node).data("type",OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT_CIRCLE);$(g.node).attr("name",OG.Constants.CONNECT_GUIDE_SUFFIX.VIRTUAL_SPOT);j.toFront(g);return g.node}return null};OG.renderer.RaphaelRenderer.prototype.getVirtualSpot=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b),d,c;if(a){c=$("#"+a.id).find("[name="+OG.Constants.CONNECT_GUIDE_SUFFIX.VIRTUAL_SPOT+"]");d=c.attr("id")}return this.getElementById(d)};OG.renderer.RaphaelRenderer.prototype.removeVirtualSpot=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b),d,c;if(a){c=$("#"+a.id).find("[name="+OG.Constants.CONNECT_GUIDE_SUFFIX.VIRTUAL_SPOT+"]");d=c.attr("id")}return this.remove(d)};OG.renderer.RaphaelRenderer.prototype.selectSpot=function(c){var d=this;var b=this._getREleById(OG.Util.isElement(c)?c.id:c);if(b){var a=$(b.node).data("parent");this._remove(this._getREleById(a.id+OG.Constants.CONNECT_GUIDE_SUFFIX.BBOX));$(d.getSpots(a.node)).each(function(f,e){if(e.id!==b.node.id){d.remove(e)}})}};OG.renderer.RaphaelRenderer.prototype._removeEdgeChild=function(b){var d,c;if(b){d=b.node.childNodes;for(c=d.length-1;c>=0;c--){var a=false;if($(d[c]).attr("name")===OG.Constants.CONNECT_GUIDE_SUFFIX.VIRTUAL_SPOT){a=true}if($(d[c]).attr("name")===OG.Constants.CONNECT_GUIDE_SUFFIX.SPOT){a=true}if(!a){this._remove(this._getREleById(d[c].id))}}}};OG.renderer.RaphaelRenderer.prototype.getChildNodes=function(c){var a=this._getREleById(OG.Util.isElement(c)?c.id:c);var d,b;if(a){d=a.node.childNodes}if(!d){return[]}else{return d}};OG.renderer.RaphaelRenderer.prototype.trimEdge=function(d){var f=this,a=this._getREleById(OG.Util.isElement(d)?d.id:d),h=a?a.node.shape.geom:null;var b=h.getVertices();var e=b.length;for(var c=b.length;c--;){if(c=f._CONFIG.TRIM_EDGE_ANGLE_SIZE){b.splice(c,1)}}}}}if(e!==b.length){d.shape.geom.setVertices(b);d=f.drawEdge(new OG.PolyLine(b),d.shape.geom.style,d.id);f.drawLabel(d);f.drawEdgeLabel(d,null,"FROM");f.drawEdgeLabel(d,null,"TO")}};OG.renderer.RaphaelRenderer.prototype.trimConnectInnerVertice=function(a){var t=this,j=this._getREleById(OG.Util.isElement(a)?a.id:a),e=j?j.node.shape.geom:null,o,b,v,h,l,p;var f=e.getVertices();o=$(a).attr("_from");b=$(a).attr("_to");if(o){v=this._getShapeFromTerminal(o);l=this._getPositionFromTerminal(o)}if(b){h=this._getShapeFromTerminal(b);p=this._getPositionFromTerminal(b)}var g;var u;var r;var k;var s;var m;var d=function(){if(r){if(k>0&&k=0;q--){if(q==f.length-1){g=f[q];u=q;continue}var n=h.shape.geom.isContainsPoint(f[q]);if(n){if(q==0){r=f[q];k=q;s=f[q+1];m=q+1}else{r=f[q-1];k=q-1;s=f[q];m=q}}}d()}if(f.length===2){a=t.drawEdge(new OG.Line(f[0],f[1]),a.shape.geom.style,a.id);a=t.trimEdgeDirection(a,v,h)}else{a.shape.geom.setVertices(f);a=t.drawEdge(new OG.PolyLine(f),a.shape.geom.style,a.id)}t.drawLabel(a);t.drawEdgeLabel(a,null,"FROM");t.drawEdgeLabel(a,null,"TO");return a};OG.renderer.RaphaelRenderer.prototype.trimConnectIntersection=function(d){var h=this,e=this._getREleById(OG.Util.isElement(d)?d.id:d),i=e?e.node.shape.geom:null,j,k,l,c,g,b,a;var f=i.getVertices();j=$(d).attr("_from");k=$(d).attr("_to");if(j){l=this._getShapeFromTerminal(j);g=this._getPositionFromTerminal(j)}if(k){c=this._getShapeFromTerminal(k);b=this._getPositionFromTerminal(k)}if(j){a=l.shape.geom.shortestIntersectToLine([f[1],[g.x,g.y]]);if(a){f[0].x=a.x;f[0].y=a.y}else{f[0].x=g.x;f[0].y=g.y}}if(k){a=c.shape.geom.shortestIntersectToLine([f[f.length-2],[b.x,b.y]]);if(a){f[f.length-1].x=a.x;f[f.length-1].y=a.y}else{f[f.length-1].x=b.x;f[f.length-1].y=b.y}}d.shape.geom.setVertices(f);d=h.drawEdge(new OG.PolyLine(f),d.shape.geom.style,d.id);h.drawLabel(d);h.drawEdgeLabel(d,null,"FROM");h.drawEdgeLabel(d,null,"TO");return d};OG.renderer.RaphaelRenderer.prototype.getBoundary=function(b){var a=this._getREleById(OG.Util.isElement(b)?b.id:b),c;if(a&&a.node&&a.node.shape&&a.node.shape.geom){c=a.node.shape.geom.getBoundary()}return c};OG.renderer.RaphaelRenderer.prototype.setHighlight=function(c,b){var a=this._getREleById(OG.Util.isElement(c)?c.id:c);var d=this;if(a){c=a.node;var e=d.getNotConnectGuideElements(c);$.each(e,function(f,i){var j={};for(var h in b){var g=d.getAttr(i,h);if(g){j[h]=g}}$(i).data("orgAttrGroup",j);d.setAttr(i,b)})}};OG.renderer.RaphaelRenderer.prototype.removeHighlight=function(c,b){var a=this._getREleById(OG.Util.isElement(c)?c.id:c);var d=this;if(a){c=a.node;var e=d.getNotConnectGuideElements(c);$.each(e,function(f,i){var j=$(i).data("orgAttrGroup");if(!j){return}for(var h in b){var g=j[h];if(!g){j[h]=null}}$(i).removeData("orgAttrGroup");d.setAttr(i,j)})}};OG.renderer.RaphaelRenderer.prototype.createTerminalString=function(e,a){var d;var b=this._getREleById(OG.Util.isElement(e)?e.id:e);if(b){var c=b.node.shape.geom.getPercentageDistanceFromPoint(a);if(c){d=b.node.id+OG.Constants.TERMINAL+"_"+c.px+"_"+c.py}}return d};OG.renderer.RaphaelRenderer.prototype.createDefaultTerminalString=function(d){var c;var a=this._getREleById(OG.Util.isElement(d)?d.id:d);if(a){var b={px:50,py:50};if(b){c=a.node.id+OG.Constants.TERMINAL+"_"+b.px+"_"+b.py}}return c};OG.renderer.RaphaelRenderer.prototype._getPercentageFromTerminal=function(c){var d;if(c){var e=c.substring(0,c.indexOf(OG.Constants.TERMINAL));var b=c.replace(e+OG.Constants.TERMINAL+"_","");var a=b.split("_");d=[parseInt(a[0]),parseInt(a[1])]}return d};OG.renderer.RaphaelRenderer.prototype._getPositionFromTerminal=function(d){var e=this;var g,f;var b={px:50,py:50};if(d){var h=d.substring(0,d.indexOf(OG.Constants.TERMINAL));var c=d.replace(h+OG.Constants.TERMINAL+"_","");f=c.split("_");var a=this._getREleById(h);if(a){g=a.node.shape.geom.getPointFromPercentageDistance(f);if(!g||isNaN(g.x)||isNaN(g.y)){g=a.node.shape.geom.getPointFromPercentageDistance([b.px,b.py])}g.x=e._CONFIG.DRAG_GRIDABLE?OG.Util.roundGrid(g.x,e._CONFIG.MOVE_SNAP_SIZE/2):g.x;g.y=e._CONFIG.DRAG_GRIDABLE?OG.Util.roundGrid(g.y,e._CONFIG.MOVE_SNAP_SIZE/2):g.y}}return g};OG.renderer.RaphaelRenderer.prototype.toFrontEdges=function(){var e=this;var a=e.getRootGroup();var c=e.getAllEdges();for(var d=0,b=c.length;dx[0]){w.x=t[0]-s}if(t[0]x[1]){w.y=t[1]-r}if(t[1]=0){b=b-1;a._CANVAS.loadJSON(c[b])}a._CONFIG.HISTORY_INDEX=b;$(this._PAPER.canvas).trigger("undo")};OG.renderer.RaphaelRenderer.prototype.redo=function(){var a=this;var c=a._CONFIG.HISTORY;var b=a._CONFIG.HISTORY_INDEX;if(b(f*3)){return 2}if(a>(f*2)){return 1}}if(this.isVerticalLane(c)){if(d>(f*3)){return 2}if(d>(f*2)){return 1}}return 0};OG.renderer.RaphaelRenderer.prototype.getExceptTitleLaneArea=function(h){var j=this;var i=j._getREleById(OG.Util.isElement(h)?h.id:h);var k=i?i.node.shape.geom:null;if(!i||!k){return null}var f=k.getBoundary();var d=k.style.map;var c=d["title-size"]?d["title-size"]:20;var b=f.getUpperLeft();var e=f.getWidth();var l=f.getHeight();var m,g,a;if(!j.isLane(h)&&!j.isPool(h)){return f}if(j.isHorizontalLane(h)||j.isHorizontalPool(h)){m=new OG.geometry.Coordinate(b.x+c,b.y);g=e-c;a=l}if(j.isVerticalLane(h)||j.isVerticalPool(h)){m=new OG.geometry.Coordinate(b.x,b.y+c);g=e;a=l-c}if(m){return new OG.geometry.Envelope(m,g,a)}return f};OG.renderer.RaphaelRenderer.prototype.divideLane=function(d,z){var w=[];var F=this;var u=F._getREleById(OG.Util.isElement(d)?d.id:d);var l=u?u.node.shape.geom:null;if(!u||!l){return}d=u.node;if(!F.isLane(d)){return}var D=z===OG.Constants.GUIDE_SUFFIX.QUARTER_UPPER;var h=z===OG.Constants.GUIDE_SUFFIX.QUARTER_LOW;var e=z===OG.Constants.GUIDE_SUFFIX.QUARTER_BISECTOR;var g=z===OG.Constants.GUIDE_SUFFIX.QUARTER_THIRDS;if(e||g){var r=e?2:3;var m=F.getExceptTitleLaneArea(d);var t=m.getUpperLeft();for(var B=0;By.y){v=H}}if(F.isVerticalLane(d)&&D){if(x.x>y.x){v=H}}if(F.isVerticalLane(d)&&h){if(x.xk){E.push(i)}}});var q=F._CANVAS.drawShape([p+(j/2),o+(G/2)],b,[j,G],null,null,n.id,true);w.push(q);$.each(E,function(x,i){F.move(i,a)});F.reEstablishLane(v);F.fitLaneOrder(v)}}if(w.length){for(var B=0,f=w.length;B0){var r=g.getParent(p);if(r&&r.id){m[r.id]=r}}});for(var l in m){n.push(m[l])}b(n)}b(d)};OG.renderer.RaphaelRenderer.prototype.getBoundaryOfElements=function(d){var b=[],f,e,c;if(d&&d.length>0){for(var c=0,a=d.length;cMath.abs(n-a)){h=Math.abs(n-a);g=p}});return g};OG.renderer.RaphaelRenderer.prototype.getBoundaryOfInnerShapesGroup=function(b){var c=this;var f=[];var a=c._getREleById(OG.Util.isElement(b)?b.id:b);if(!a){return null}b=a.node;var e;var d=[];if(c.isLane(b)){d=c.getInnerShapesOfLane(b)}else{d=c.getChilds(b)}$.each(d,function(g,h){if(!c.isLane(h)){f.push(h)}});if(!f.length){return null}return c.getBoundaryOfElements(f)};OG.renderer.RaphaelRenderer.prototype.getSmallestBaseLane=function(c){var e=this;var b=e._getREleById(OG.Util.isElement(c)?c.id:c);if(!b){return null}c=b.node;if(!e.isLane(c)){return null}var a=e.getBaseLanes(c);var f;var d;$.each(a,function(i,h){var g;var j=e.getBoundary(h);if(e.isHorizontalLane(h)){g=j.getWidth()}if(e.isVerticalLane(h)){g=j.getHeight()}if(g){if(!d){d=h;f=g}if(g0){k.resize(d[j-1],[0,(a*-1),0,0])}if(j0){k.resize(d[j-1],[0,0,(c*-1),0])}if(j