正在显示
35 个修改的文件
包含
5481 行增加
和
0 行删除

3.3 KB

580 字节

108 字节

227 字节

1.3 KB

830 字节

3.2 KB

410 字节

367 字节

344 字节

601 字节

361 字节

1.4 KB

953 字节

687 字节

6.1 KB

775 字节
1 | +<html> | ||
2 | +<head> | ||
3 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
4 | + | ||
5 | + <link rel="stylesheet" href="style.css" type="text/css" media="screen"> | ||
6 | + <script src="js/jstools.js" type="text/javascript" charset="utf-8"></script> | ||
7 | + <script src="js/raphael.js" type="text/javascript" charset="utf-8"></script> | ||
8 | + | ||
9 | + <script src="js/jquery/jquery.js" type="text/javascript" charset="utf-8"></script> | ||
10 | + <script src="js/jquery/jquery.progressbar.js" type="text/javascript" charset="utf-8"></script> | ||
11 | + <script src="js/jquery/jquery.asyncqueue.js" type="text/javascript" charset="utf-8"></script> | ||
12 | + | ||
13 | + <script src="js/Color.js" type="text/javascript" charset="utf-8"></script> | ||
14 | + <script src="js/Polyline.js" type="text/javascript" charset="utf-8"></script> | ||
15 | + <script src="js/ActivityImpl.js" type="text/javascript" charset="utf-8"></script> | ||
16 | + <script src="js/ActivitiRest.js" type="text/javascript" charset="utf-8"></script> | ||
17 | + <script src="js/LineBreakMeasurer.js" type="text/javascript" charset="utf-8"></script> | ||
18 | + <script src="js/ProcessDiagramGenerator.js" type="text/javascript" charset="utf-8"></script> | ||
19 | + <script src="js/ProcessDiagramCanvas.js" type="text/javascript" charset="utf-8"></script> | ||
20 | + | ||
21 | + <style type="text/css" media="screen"> | ||
22 | + | ||
23 | + </style> | ||
24 | +</head> | ||
25 | +<body> | ||
26 | +<div class="wrapper"> | ||
27 | + <div id="pb1"></div> | ||
28 | + <div id="overlayBox" > | ||
29 | + <div id="diagramBreadCrumbs" class="diagramBreadCrumbs" onmousedown="return false" onselectstart="return false"></div> | ||
30 | + <div id="diagramHolder" class="diagramHolder"></div> | ||
31 | + <div class="diagram-info" id="diagramInfo"></div> | ||
32 | + </div> | ||
33 | +</div> | ||
34 | +<script language='javascript'> | ||
35 | +var DiagramGenerator = {}; | ||
36 | +var pb1; | ||
37 | +$(document).ready(function(){ | ||
38 | + var query_string = {}; | ||
39 | + var query = window.location.search.substring(1); | ||
40 | + var vars = query.split("&"); | ||
41 | + for (var i=0;i<vars.length;i++) { | ||
42 | + var pair = vars[i].split("="); | ||
43 | + query_string[pair[0]] = pair[1]; | ||
44 | + } | ||
45 | + | ||
46 | + var processDefinitionId = query_string["processDefinitionId"]; | ||
47 | + var processInstanceId = query_string["processInstanceId"]; | ||
48 | + | ||
49 | + console.log("Initialize progress bar"); | ||
50 | + | ||
51 | + pb1 = new $.ProgressBar({ | ||
52 | + boundingBox: '#pb1', | ||
53 | + label: 'Progressbar!', | ||
54 | + on: { | ||
55 | + complete: function() { | ||
56 | + console.log("Progress Bar COMPLETE"); | ||
57 | + this.set('label', 'complete!'); | ||
58 | + if (processInstanceId) { | ||
59 | + ProcessDiagramGenerator.drawHighLights(processInstanceId); | ||
60 | + } | ||
61 | + }, | ||
62 | + valueChange: function(e) { | ||
63 | + this.set('label', e.newVal + '%'); | ||
64 | + } | ||
65 | + }, | ||
66 | + value: 0 | ||
67 | + }); | ||
68 | + console.log("Progress bar inited"); | ||
69 | + | ||
70 | + ProcessDiagramGenerator.options = { | ||
71 | + diagramBreadCrumbsId: "diagramBreadCrumbs", | ||
72 | + diagramHolderId: "diagramHolder", | ||
73 | + diagramInfoId: "diagramInfo", | ||
74 | + on: { | ||
75 | + click: function(canvas, element, contextObject){ | ||
76 | + var mouseEvent = this; | ||
77 | + console.log("[CLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject); | ||
78 | + | ||
79 | + if (contextObject.getProperty("type") == "callActivity") { | ||
80 | + var processDefinitonKey = contextObject.getProperty("processDefinitonKey"); | ||
81 | + var processDefinitons = contextObject.getProperty("processDefinitons"); | ||
82 | + var processDefiniton = processDefinitons[0]; | ||
83 | + console.log("Load callActivity '" + processDefiniton.processDefinitionKey + "', contextObject: ", contextObject); | ||
84 | + | ||
85 | + // Load processDefinition | ||
86 | + ProcessDiagramGenerator.drawDiagram(processDefiniton.processDefinitionId); | ||
87 | + } | ||
88 | + }, | ||
89 | + rightClick: function(canvas, element, contextObject){ | ||
90 | + var mouseEvent = this; | ||
91 | + console.log("[RIGHTCLICK] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject); | ||
92 | + }, | ||
93 | + over: function(canvas, element, contextObject){ | ||
94 | + var mouseEvent = this; | ||
95 | + //console.log("[OVER] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject); | ||
96 | + | ||
97 | + // TODO: show tooltip-window with contextObject info | ||
98 | + ProcessDiagramGenerator.showActivityInfo(contextObject); | ||
99 | + }, | ||
100 | + out: function(canvas, element, contextObject){ | ||
101 | + var mouseEvent = this; | ||
102 | + //console.log("[OUT] mouseEvent: %o, canvas: %o, clicked element: %o, contextObject: %o", mouseEvent, canvas, element, contextObject); | ||
103 | + | ||
104 | + ProcessDiagramGenerator.hideInfo(); | ||
105 | + } | ||
106 | + } | ||
107 | + }; | ||
108 | + | ||
109 | + var baseUrl = window.document.location.protocol + "//" + window.document.location.host + "/"; | ||
110 | + var shortenedUrl = window.document.location.href.replace(baseUrl, ""); | ||
111 | + baseUrl = baseUrl + shortenedUrl.substring(0, shortenedUrl.indexOf("/")); | ||
112 | + | ||
113 | + ActivitiRest.options = { | ||
114 | + processInstanceHighLightsUrl: baseUrl + "/act/service/process-instance/{processInstanceId}/highlights?callback=?", | ||
115 | + processDefinitionUrl: baseUrl + "/act/service/process-definition/{processDefinitionId}/diagram-layout?callback=?", | ||
116 | + processDefinitionByKeyUrl: baseUrl + "/act/service/process-definition/{processDefinitionKey}/diagram-layout?callback=?", | ||
117 | + processInstanceUrl: baseUrl + "/act/service/process-instance/{processInstanceId}/diagram-layout?callback=?" | ||
118 | + }; | ||
119 | + | ||
120 | + if (processDefinitionId) { | ||
121 | + ProcessDiagramGenerator.drawDiagram(processDefinitionId); | ||
122 | + | ||
123 | + } else { | ||
124 | + alert("processDefinitionId parameter is required"); | ||
125 | + } | ||
126 | +}); | ||
127 | + | ||
128 | + | ||
129 | +</script> | ||
130 | +</body> | ||
131 | +</html> |
1 | +var ActivitiRest = { | ||
2 | + options: {}, | ||
3 | + getProcessDefinitionByKey: function(processDefinitionKey, callback) { | ||
4 | + var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey}); | ||
5 | + | ||
6 | + $.ajax({ | ||
7 | + url: url, | ||
8 | + dataType: 'jsonp', | ||
9 | + cache: false, | ||
10 | + async: true, | ||
11 | + success: function(data, textStatus) { | ||
12 | + var processDefinition = data; | ||
13 | + if (!processDefinition) { | ||
14 | + console.error("Process definition '" + processDefinitionKey + "' not found"); | ||
15 | + } else { | ||
16 | + callback.apply({processDefinitionId: processDefinition.id}); | ||
17 | + } | ||
18 | + } | ||
19 | + }).done(function(data, textStatus) { | ||
20 | + console.log("ajax done"); | ||
21 | + }).fail(function(jqXHR, textStatus, error){ | ||
22 | + console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, 'error: ', error, jqXHR); | ||
23 | + }); | ||
24 | + }, | ||
25 | + | ||
26 | + getProcessDefinition: function(processDefinitionId, callback) { | ||
27 | + var url = Lang.sub(this.options.processDefinitionUrl, {processDefinitionId: processDefinitionId}); | ||
28 | + | ||
29 | + $.ajax({ | ||
30 | + url: url, | ||
31 | + dataType: 'jsonp', | ||
32 | + cache: false, | ||
33 | + async: true, | ||
34 | + success: function(data, textStatus) { | ||
35 | + var processDefinitionDiagramLayout = data; | ||
36 | + if (!processDefinitionDiagramLayout) { | ||
37 | + console.error("Process definition diagram layout '" + processDefinitionId + "' not found"); | ||
38 | + return; | ||
39 | + } else { | ||
40 | + callback.apply({processDefinitionDiagramLayout: processDefinitionDiagramLayout}); | ||
41 | + } | ||
42 | + } | ||
43 | + }).done(function(data, textStatus) { | ||
44 | + console.log("ajax done"); | ||
45 | + }).fail(function(jqXHR, textStatus, error){ | ||
46 | + console.log('Get diagram layout['+processDefinitionId+'] failure: ', textStatus, jqXHR); | ||
47 | + }); | ||
48 | + }, | ||
49 | + | ||
50 | + getHighLights: function(processInstanceId, callback) { | ||
51 | + var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId}); | ||
52 | + | ||
53 | + $.ajax({ | ||
54 | + url: url, | ||
55 | + dataType: 'jsonp', | ||
56 | + cache: false, | ||
57 | + async: true, | ||
58 | + success: function(data, textStatus) { | ||
59 | + console.log("ajax returned data"); | ||
60 | + var highLights = data; | ||
61 | + if (!highLights) { | ||
62 | + console.log("highLights not found"); | ||
63 | + return; | ||
64 | + } else { | ||
65 | + callback.apply({highLights: highLights}); | ||
66 | + } | ||
67 | + } | ||
68 | + }).done(function(data, textStatus) { | ||
69 | + console.log("ajax done"); | ||
70 | + }).fail(function(jqXHR, textStatus, error){ | ||
71 | + console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR); | ||
72 | + }); | ||
73 | + } | ||
74 | +}; |
1 | +/** * * @author Tom Baeyens * @author (Javascript) Dmitry Farafonov */ var ActivityImpl = function(activityJson){ this.outgoingTransitions = []; this.outgoingTransitions = []; this.incomingTransitions = []; this.activityBehavior = null; this.parent = null; this.isScope = false; this.isAsync = false; this.isExclusive = false; this.x = -1; this.y = -1; this.width = -1; this.height = -1; this.properties = {}; //console.log("activityJson: ", activityJson); if (activityJson != undefined) { this.setId(activityJson.activityId); for (var propertyName in activityJson.properties) { this.setProperty(propertyName, activityJson.properties[propertyName]); } //this.setProperty("name", activityJson.activityName); //this.setProperty("type", activityJson.activityType); this.setX(activityJson.x); this.setY(activityJson.y); this.setWidth(activityJson.width); this.setHeight(activityJson.height); if (activityJson.multiInstance) this.setProperty("multiInstance", activityJson.multiInstance); if (activityJson.collapsed) { this.setProperty("collapsed", activityJson.collapsed); } if (activityJson.isInterrupting != undefined) this.setProperty("isInterrupting", activityJson.isInterrupting); } }; ActivityImpl.prototype = { outgoingTransitions: [], outgoingTransitions: [], incomingTransitions: [], activityBehavior: null, parent: null, isScope: false, isAsync: false, isExclusive: false, id: null, properties: {}, // Graphical information x: -1, y: -1, width: -1, height: -1, setId: function(id){ this.id = id; }, getId: function(){ return this.id; }, setProperty: function(name, value){ this.properties[name] = value; }, getProperty: function(name){ return this.properties[name]; }, createOutgoingTransition: function(transitionId){ }, toString: function(id) { return "Activity("+id+")"; }, getParentActivity: function(){ /* if (parent instanceof ActivityImpl) { 79 return (ActivityImpl) parent; 80 } 81 return null; */ return this.parent; }, // restricted setters /////////////////////////////////////////////////////// setOutgoingTransitions: function(outgoingTransitions){ this.outgoingTransitions = outgoingTransitions; }, setParent: function(parent){ this.parent = parent; }, setIncomingTransitions: function(incomingTransitions){ this.incomingTransitions = incomingTransitions; }, // getters and setters ////////////////////////////////////////////////////// getOutgoingTransitions: function(){ return this.outgoingTransitions; }, getActivityBehavior: function(){ return this.activityBehavior; }, setActivityBehavior: function(activityBehavior){ this.activityBehavior = activityBehavior; }, getParent: function(){ return this.parent; }, getIncomingTransitions: function(){ return this.incomingTransitions; }, isScope: function(){ return this.isScope; }, setScope: function(isScope){ this.isScope = isScope; }, getX: function(){ return this.x; }, setX: function(x){ this.x = x; }, getY: function(){ return this.y; }, setY: function(y){ this.y = y; }, getWidth: function(){ return this.width; }, setWidth: function(width){ this.width = width; }, getHeight: function(){ return this.height; }, setHeight: function(height){ this.height = height; }, isAsync: function() { return this.isAsync; }, setAsync: function(isAsync) { this.isAsync = isAsync; }, isExclusive: function() { return this.isExclusive; }, setExclusive: function(isExclusive) { this.isExclusive = isExclusive; }, vvoid: function(){} }; |
1 | +/** | ||
2 | + * Web color table | ||
3 | + * | ||
4 | + * @author Dmitry Farafonov | ||
5 | + */ | ||
6 | + | ||
7 | +var Color = { | ||
8 | + /** | ||
9 | + * The color white. In the default sRGB space. | ||
10 | + */ | ||
11 | + white : Raphael.getRGB("rgb(255,255,255)"), | ||
12 | + | ||
13 | + /** | ||
14 | + * The color white. In the default sRGB space. | ||
15 | + */ | ||
16 | + WHITE : this.white, | ||
17 | + | ||
18 | + /** | ||
19 | + * The color light gray. In the default sRGB space. | ||
20 | + */ | ||
21 | + lightGray : Raphael.getRGB("rgb(192, 192, 192)"), | ||
22 | + | ||
23 | + /** | ||
24 | + * The color light gray. In the default sRGB space. | ||
25 | + */ | ||
26 | + LIGHT_GRAY : this.lightGray, | ||
27 | + | ||
28 | + /** | ||
29 | + * The color gray. In the default sRGB space. | ||
30 | + */ | ||
31 | + gray : Raphael.getRGB("rgb(128, 128, 128)"), | ||
32 | + | ||
33 | + /** | ||
34 | + * The color gray. In the default sRGB space. | ||
35 | + */ | ||
36 | + GRAY : this.gray, | ||
37 | + | ||
38 | + /** | ||
39 | + * The color dark gray. In the default sRGB space. | ||
40 | + */ | ||
41 | + darkGray : Raphael.getRGB("rgb(64, 64, 64)"), | ||
42 | + | ||
43 | + /** | ||
44 | + * The color dark gray. In the default sRGB space. | ||
45 | + */ | ||
46 | + DARK_GRAY : this.darkGray, | ||
47 | + | ||
48 | + /** | ||
49 | + * The color black. In the default sRGB space. | ||
50 | + */ | ||
51 | + black : Raphael.getRGB("rgb(0, 0, 0)"), | ||
52 | + | ||
53 | + /** | ||
54 | + * The color black. In the default sRGB space. | ||
55 | + */ | ||
56 | + BLACK : this.black, | ||
57 | + | ||
58 | + /** | ||
59 | + * The color red. In the default sRGB space. | ||
60 | + */ | ||
61 | + red : Raphael.getRGB("rgb(255, 0, 0)"), | ||
62 | + | ||
63 | + /** | ||
64 | + * The color red. In the default sRGB space. | ||
65 | + */ | ||
66 | + RED : this.red, | ||
67 | + | ||
68 | + /** | ||
69 | + * The color pink. In the default sRGB space. | ||
70 | + */ | ||
71 | + pink : Raphael.getRGB("rgb(255, 175, 175)"), | ||
72 | + | ||
73 | + /** | ||
74 | + * The color pink. In the default sRGB space. | ||
75 | + */ | ||
76 | + PINK : this.pink, | ||
77 | + | ||
78 | + /** | ||
79 | + * The color orange. In the default sRGB space. | ||
80 | + */ | ||
81 | + orange : Raphael.getRGB("rgb(255, 200, 0)"), | ||
82 | + | ||
83 | + /** | ||
84 | + * The color orange. In the default sRGB space. | ||
85 | + */ | ||
86 | + ORANGE : this.orange, | ||
87 | + | ||
88 | + /** | ||
89 | + * The color yellow. In the default sRGB space. | ||
90 | + */ | ||
91 | + yellow : Raphael.getRGB("rgb(255, 255, 0)"), | ||
92 | + | ||
93 | + /** | ||
94 | + * The color yellow. In the default sRGB space. | ||
95 | + */ | ||
96 | + YELLOW : this.yellow, | ||
97 | + | ||
98 | + /** | ||
99 | + * The color green. In the default sRGB space. | ||
100 | + */ | ||
101 | + green : Raphael.getRGB("rgb(0, 255, 0)"), | ||
102 | + | ||
103 | + /** | ||
104 | + * The color green. In the default sRGB space. | ||
105 | + */ | ||
106 | + GREEN : this.green, | ||
107 | + | ||
108 | + /** | ||
109 | + * The color magenta. In the default sRGB space. | ||
110 | + */ | ||
111 | + magenta : Raphael.getRGB("rgb(255, 0, 255)"), | ||
112 | + | ||
113 | + /** | ||
114 | + * The color magenta. In the default sRGB space. | ||
115 | + */ | ||
116 | + MAGENTA : this.magenta, | ||
117 | + | ||
118 | + /** | ||
119 | + * The color cyan. In the default sRGB space. | ||
120 | + */ | ||
121 | + cyan : Raphael.getRGB("rgb(0, 255, 255)"), | ||
122 | + | ||
123 | + /** | ||
124 | + * The color cyan. In the default sRGB space. | ||
125 | + */ | ||
126 | + CYAN : this.cyan, | ||
127 | + | ||
128 | + /** | ||
129 | + * The color blue. In the default sRGB space. | ||
130 | + */ | ||
131 | + blue : Raphael.getRGB("rgb(0, 0, 255)"), | ||
132 | + | ||
133 | + /** | ||
134 | + * The color blue. In the default sRGB space. | ||
135 | + */ | ||
136 | + BLUE : this.blue, | ||
137 | + | ||
138 | + /************************************************************************/ | ||
139 | + | ||
140 | + // http://www.stm.dp.ua/web-design/color-html.php | ||
141 | + | ||
142 | + Snow : Raphael.getRGB("#FFFAFA "), // 255 250 250 | ||
143 | + GhostWhite : Raphael.getRGB("#F8F8FF "), // 248 248 255 | ||
144 | + WhiteSmoke : Raphael.getRGB("#F5F5F5 "), // 245 245 245 | ||
145 | + Gainsboro : Raphael.getRGB("#DCDCDC "), // 220 220 220 | ||
146 | + FloralWhite : Raphael.getRGB("#FFFAF0 "), // 255 250 240 | ||
147 | + OldLace : Raphael.getRGB("#FDF5E6 "), // 253 245 230 | ||
148 | + Linen : Raphael.getRGB("#FAF0E6 "), // 250 240 230 | ||
149 | + AntiqueWhite : Raphael.getRGB("#FAEBD7 "), // 250 235 215 | ||
150 | + PapayaWhip : Raphael.getRGB("#FFEFD5 "), // 255 239 213 | ||
151 | + BlanchedAlmond : Raphael.getRGB("#FFEBCD "), // 255 235 205 | ||
152 | + Bisque : Raphael.getRGB("#FFE4C4 "), // 255 228 196 | ||
153 | + PeachPuff : Raphael.getRGB("#FFDAB9 "), // 255 218 185 | ||
154 | + NavajoWhite : Raphael.getRGB("#FFDEAD "), // 255 222 173 | ||
155 | + Moccasin : Raphael.getRGB("#FFE4B5 "), // 255 228 181 | ||
156 | + Cornsilk : Raphael.getRGB("#FFF8DC "), // 255 248 220 | ||
157 | + Ivory : Raphael.getRGB("#FFFFF0 "), // 255 255 240 | ||
158 | + LemonChiffon : Raphael.getRGB("#FFFACD "), // 255 250 205 | ||
159 | + Seashell : Raphael.getRGB("#FFF5EE "), // 255 245 238 | ||
160 | + Honeydew : Raphael.getRGB("#F0FFF0 "), // 240 255 240 | ||
161 | + MintCream : Raphael.getRGB("#F5FFFA "), // 245 255 250 | ||
162 | + Azure : Raphael.getRGB("#F0FFFF "), // 240 255 255 | ||
163 | + AliceBlue : Raphael.getRGB("#F0F8FF "), // 240 248 255 | ||
164 | + lavender : Raphael.getRGB("#E6E6FA "), // 230 230 250 | ||
165 | + LavenderBlush : Raphael.getRGB("#FFF0F5 "), // 255 240 245 | ||
166 | + MistyRose : Raphael.getRGB("#FFE4E1 "), // 255 228 225 | ||
167 | + White : Raphael.getRGB("#FFFFFF "), // 255 255 255 | ||
168 | + Black : Raphael.getRGB("#000000 "), // 0 0 0 | ||
169 | + DarkSlateGray : Raphael.getRGB("#2F4F4F "), // 47 79 79 | ||
170 | + DimGrey : Raphael.getRGB("#696969 "), // 105 105 105 | ||
171 | + SlateGrey : Raphael.getRGB("#708090 "), // 112 128 144 | ||
172 | + LightSlateGray : Raphael.getRGB("#778899 "), // 119 136 153 | ||
173 | + Grey : Raphael.getRGB("#BEBEBE "), // 190 190 190 | ||
174 | + LightGray : Raphael.getRGB("#D3D3D3 "), // 211 211 211 | ||
175 | + MidnightBlue : Raphael.getRGB("#191970 "), // 25 25 112 | ||
176 | + NavyBlue : Raphael.getRGB("#000080 "), // 0 0 128 | ||
177 | + CornflowerBlue : Raphael.getRGB("#6495ED "), // 100 149 237 | ||
178 | + DarkSlateBlue : Raphael.getRGB("#483D8B "), // 72 61 139 | ||
179 | + SlateBlue : Raphael.getRGB("#6A5ACD "), // 106 90 205 | ||
180 | + MediumSlateBlue : Raphael.getRGB("#7B68EE "), // 123 104 238 | ||
181 | + LightSlateBlue : Raphael.getRGB("#8470FF "), // 132 112 255 | ||
182 | + MediumBlue : Raphael.getRGB("#0000CD "), // 0 0 205 | ||
183 | + RoyalBlue : Raphael.getRGB("#4169E1 "), // 65 105 225 | ||
184 | + Blue : Raphael.getRGB("#0000FF "), // 0 0 255 | ||
185 | + DodgerBlue : Raphael.getRGB("#1E90FF "), // 30 144 255 | ||
186 | + DeepSkyBlue : Raphael.getRGB("#00BFFF "), // 0 191 255 | ||
187 | + SkyBlue : Raphael.getRGB("#87CEEB "), // 135 206 235 | ||
188 | + LightSkyBlue : Raphael.getRGB("#87CEFA "), // 135 206 250 | ||
189 | + SteelBlue : Raphael.getRGB("#4682B4 "), // 70 130 180 | ||
190 | + LightSteelBlue : Raphael.getRGB("#B0C4DE "), // 176 196 222 | ||
191 | + LightBlue : Raphael.getRGB("#ADD8E6 "), // 173 216 230 | ||
192 | + PowderBlue : Raphael.getRGB("#B0E0E6 "), // 176 224 230 | ||
193 | + PaleTurquoise : Raphael.getRGB("#AFEEEE "), // 175 238 238 | ||
194 | + DarkTurquoise : Raphael.getRGB("#00CED1 "), // 0 206 209 | ||
195 | + MediumTurquoise : Raphael.getRGB("#48D1CC "), // 72 209 204 | ||
196 | + Turquoise : Raphael.getRGB("#40E0D0 "), // 64 224 208 | ||
197 | + Cyan : Raphael.getRGB("#00FFFF "), // 0 255 255 | ||
198 | + LightCyan : Raphael.getRGB("#E0FFFF "), // 224 255 255 | ||
199 | + CadetBlue : Raphael.getRGB("#5F9EA0 "), // 95 158 160 | ||
200 | + MediumAquamarine: Raphael.getRGB("#66CDAA "), // 102 205 170 | ||
201 | + Aquamarine : Raphael.getRGB("#7FFFD4 "), // 127 255 212 | ||
202 | + DarkGreen : Raphael.getRGB("#006400 "), // 0 100 0 | ||
203 | + DarkOliveGreen : Raphael.getRGB("#556B2F "), // 85 107 47 | ||
204 | + DarkSeaGreen : Raphael.getRGB("#8FBC8F "), // 143 188 143 | ||
205 | + SeaGreen : Raphael.getRGB("#2E8B57 "), // 46 139 87 | ||
206 | + MediumSeaGreen : Raphael.getRGB("#3CB371 "), // 60 179 113 | ||
207 | + LightSeaGreen : Raphael.getRGB("#20B2AA "), // 32 178 170 | ||
208 | + PaleGreen : Raphael.getRGB("#98FB98 "), // 152 251 152 | ||
209 | + SpringGreen : Raphael.getRGB("#00FF7F "), // 0 255 127 | ||
210 | + LawnGreen : Raphael.getRGB("#7CFC00 "), // 124 252 0 | ||
211 | + Green : Raphael.getRGB("#00FF00 "), // 0 255 0 | ||
212 | + Chartreuse : Raphael.getRGB("#7FFF00 "), // 127 255 0 | ||
213 | + MedSpringGreen : Raphael.getRGB("#00FA9A "), // 0 250 154 | ||
214 | + GreenYellow : Raphael.getRGB("#ADFF2F "), // 173 255 47 | ||
215 | + LimeGreen : Raphael.getRGB("#32CD32 "), // 50 205 50 | ||
216 | + YellowGreen : Raphael.getRGB("#9ACD32 "), // 154 205 50 | ||
217 | + ForestGreen : Raphael.getRGB("#228B22 "), // 34 139 34 | ||
218 | + OliveDrab : Raphael.getRGB("#6B8E23 "), // 107 142 35 | ||
219 | + DarkKhaki : Raphael.getRGB("#BDB76B "), // 189 183 107 | ||
220 | + PaleGoldenrod : Raphael.getRGB("#EEE8AA "), // 238 232 170 | ||
221 | + LtGoldenrodYello: Raphael.getRGB("#FAFAD2 "), // 250 250 210 | ||
222 | + LightYellow : Raphael.getRGB("#FFFFE0 "), // 255 255 224 | ||
223 | + Yellow : Raphael.getRGB("#FFFF00 "), // 255 255 0 | ||
224 | + Gold : Raphael.getRGB("#FFD700 "), // 255 215 0 | ||
225 | + LightGoldenrod : Raphael.getRGB("#EEDD82 "), // 238 221 130 | ||
226 | + goldenrod : Raphael.getRGB("#DAA520 "), // 218 165 32 | ||
227 | + DarkGoldenrod : Raphael.getRGB("#B8860B "), // 184 134 11 | ||
228 | + RosyBrown : Raphael.getRGB("#BC8F8F "), // 188 143 143 | ||
229 | + IndianRed : Raphael.getRGB("#CD5C5C "), // 205 92 92 | ||
230 | + SaddleBrown : Raphael.getRGB("#8B4513 "), // 139 69 19 | ||
231 | + Sienna : Raphael.getRGB("#A0522D "), // 160 82 45 | ||
232 | + Peru : Raphael.getRGB("#CD853F "), // 205 133 63 | ||
233 | + Burlywood : Raphael.getRGB("#DEB887 "), // 222 184 135 | ||
234 | + Beige : Raphael.getRGB("#F5F5DC "), // 245 245 220 | ||
235 | + Wheat : Raphael.getRGB("#F5DEB3 "), // 245 222 179 | ||
236 | + SandyBrown : Raphael.getRGB("#F4A460 "), // 244 164 96 | ||
237 | + Tan : Raphael.getRGB("#D2B48C "), // 210 180 140 | ||
238 | + Chocolate : Raphael.getRGB("#D2691E "), // 210 105 30 | ||
239 | + Firebrick : Raphael.getRGB("#B22222 "), // 178 34 34 | ||
240 | + Brown : Raphael.getRGB("#A52A2A "), // 165 42 42 | ||
241 | + DarkSalmon : Raphael.getRGB("#E9967A "), // 233 150 122 | ||
242 | + Salmon : Raphael.getRGB("#FA8072 "), // 250 128 114 | ||
243 | + LightSalmon : Raphael.getRGB("#FFA07A "), // 255 160 122 | ||
244 | + Orange : Raphael.getRGB("#FFA500 "), // 255 165 0 | ||
245 | + DarkOrange : Raphael.getRGB("#FF8C00 "), // 255 140 0 | ||
246 | + Coral : Raphael.getRGB("#FF7F50 "), // 255 127 80 | ||
247 | + LightCoral : Raphael.getRGB("#F08080 "), // 240 128 128 | ||
248 | + Tomato : Raphael.getRGB("#FF6347 "), // 255 99 71 | ||
249 | + OrangeRed : Raphael.getRGB("#FF4500 "), // 255 69 0 | ||
250 | + Red : Raphael.getRGB("#FF0000 "), // 255 0 0 | ||
251 | + HotPink : Raphael.getRGB("#FF69B4 "), // 255 105 180 | ||
252 | + DeepPink : Raphael.getRGB("#FF1493 "), // 255 20 147 | ||
253 | + Pink : Raphael.getRGB("#FFC0CB "), // 255 192 203 | ||
254 | + LightPink : Raphael.getRGB("#FFB6C1 "), // 255 182 193 | ||
255 | + PaleVioletRed : Raphael.getRGB("#DB7093 "), // 219 112 147 | ||
256 | + Maroon : Raphael.getRGB("#B03060 "), // 176 48 96 | ||
257 | + MediumVioletRed : Raphael.getRGB("#C71585 "), // 199 21 133 | ||
258 | + VioletRed : Raphael.getRGB("#D02090 "), // 208 32 144 | ||
259 | + Magenta : Raphael.getRGB("#FF00FF "), // 255 0 255 | ||
260 | + Violet : Raphael.getRGB("#EE82EE "), // 238 130 238 | ||
261 | + Plum : Raphael.getRGB("#DDA0DD "), // 221 160 221 | ||
262 | + Orchid : Raphael.getRGB("#DA70D6 "), // 218 112 214 | ||
263 | + MediumOrchid : Raphael.getRGB("#BA55D3 "), // 186 85 211 | ||
264 | + DarkOrchid : Raphael.getRGB("#9932CC "), // 153 50 204 | ||
265 | + DarkViolet : Raphael.getRGB("#9400D3 "), // 148 0 211 | ||
266 | + BlueViolet : Raphael.getRGB("#8A2BE2 "), // 138 43 226 | ||
267 | + Purple : Raphael.getRGB("#A020F0 "), // 160 32 240 | ||
268 | + MediumPurple : Raphael.getRGB("#9370DB "), // 147 112 219 | ||
269 | + Thistle : Raphael.getRGB("#D8BFD8 "), // 216 191 216 | ||
270 | + Snow1 : Raphael.getRGB("#FFFAFA "), // 255 250 250 | ||
271 | + Snow2 : Raphael.getRGB("#EEE9E9 "), // 238 233 233 | ||
272 | + Snow3 : Raphael.getRGB("#CDC9C9 "), // 205 201 201 | ||
273 | + Snow4 : Raphael.getRGB("#8B8989 "), // 139 137 137 | ||
274 | + Seashell1 : Raphael.getRGB("#FFF5EE "), // 255 245 238 | ||
275 | + Seashell2 : Raphael.getRGB("#EEE5DE "), // 238 229 222 | ||
276 | + Seashell3 : Raphael.getRGB("#CDC5BF "), // 205 197 191 | ||
277 | + Seashell4 : Raphael.getRGB("#8B8682 "), // 139 134 130 | ||
278 | + AntiqueWhite1 : Raphael.getRGB("#FFEFDB "), // 255 239 219 | ||
279 | + AntiqueWhite2 : Raphael.getRGB("#EEDFCC "), // 238 223 204 | ||
280 | + AntiqueWhite3 : Raphael.getRGB("#CDC0B0 "), // 205 192 176 | ||
281 | + AntiqueWhite4 : Raphael.getRGB("#8B8378 "), // 139 131 120 | ||
282 | + Bisque1 : Raphael.getRGB("#FFE4C4 "), // 255 228 196 | ||
283 | + Bisque2 : Raphael.getRGB("#EED5B7 "), // 238 213 183 | ||
284 | + Bisque3 : Raphael.getRGB("#CDB79E "), // 205 183 158 | ||
285 | + Bisque4 : Raphael.getRGB("#8B7D6B "), // 139 125 107 | ||
286 | + PeachPuff1 : Raphael.getRGB("#FFDAB9 "), // 255 218 185 | ||
287 | + PeachPuff2 : Raphael.getRGB("#EECBAD "), // 238 203 173 | ||
288 | + PeachPuff3 : Raphael.getRGB("#CDAF95 "), // 205 175 149 | ||
289 | + PeachPuff4 : Raphael.getRGB("#8B7765 "), // 139 119 101 | ||
290 | + NavajoWhite1 : Raphael.getRGB("#FFDEAD "), // 255 222 173 | ||
291 | + NavajoWhite2 : Raphael.getRGB("#EECFA1 "), // 238 207 161 | ||
292 | + NavajoWhite3 : Raphael.getRGB("#CDB38B "), // 205 179 139 | ||
293 | + NavajoWhite4 : Raphael.getRGB("#8B795E "), // 139 121 94 | ||
294 | + LemonChiffon1 : Raphael.getRGB("#FFFACD "), // 255 250 205 | ||
295 | + LemonChiffon2 : Raphael.getRGB("#EEE9BF "), // 238 233 191 | ||
296 | + LemonChiffon3 : Raphael.getRGB("#CDC9A5 "), // 205 201 165 | ||
297 | + LemonChiffon4 : Raphael.getRGB("#8B8970 "), // 139 137 112 | ||
298 | + Cornsilk1 : Raphael.getRGB("#FFF8DC "), // 255 248 220 | ||
299 | + Cornsilk2 : Raphael.getRGB("#EEE8CD "), // 238 232 205 | ||
300 | + Cornsilk3 : Raphael.getRGB("#CDC8B1 "), // 205 200 177 | ||
301 | + Cornsilk4 : Raphael.getRGB("#8B8878 "), // 139 136 120 | ||
302 | + Ivory1 : Raphael.getRGB("#FFFFF0 "), // 255 255 240 | ||
303 | + Ivory2 : Raphael.getRGB("#EEEEE0 "), // 238 238 224 | ||
304 | + Ivory3 : Raphael.getRGB("#CDCDC1 "), // 205 205 193 | ||
305 | + Ivory4 : Raphael.getRGB("#8B8B83 "), // 139 139 131 | ||
306 | + Honeydew1 : Raphael.getRGB("#F0FFF0 "), // 240 255 240 | ||
307 | + Honeydew2 : Raphael.getRGB("#E0EEE0 "), // 224 238 224 | ||
308 | + Honeydew3 : Raphael.getRGB("#C1CDC1 "), // 193 205 193 | ||
309 | + Honeydew4 : Raphael.getRGB("#838B83 "), // 131 139 131 | ||
310 | + LavenderBlush1 : Raphael.getRGB("#FFF0F5 "), // 255 240 245 | ||
311 | + LavenderBlush2 : Raphael.getRGB("#EEE0E5 "), // 238 224 229 | ||
312 | + LavenderBlush3 : Raphael.getRGB("#CDC1C5 "), // 205 193 197 | ||
313 | + LavenderBlush4 : Raphael.getRGB("#8B8386 "), // 139 131 134 | ||
314 | + MistyRose1 : Raphael.getRGB("#FFE4E1 "), // 255 228 225 | ||
315 | + MistyRose2 : Raphael.getRGB("#EED5D2 "), // 238 213 210 | ||
316 | + MistyRose3 : Raphael.getRGB("#CDB7B5 "), // 205 183 181 | ||
317 | + MistyRose4 : Raphael.getRGB("#8B7D7B "), // 139 125 123 | ||
318 | + Azure1 : Raphael.getRGB("#F0FFFF "), // 240 255 255 | ||
319 | + Azure2 : Raphael.getRGB("#E0EEEE "), // 224 238 238 | ||
320 | + Azure3 : Raphael.getRGB("#C1CDCD "), // 193 205 205 | ||
321 | + Azure4 : Raphael.getRGB("#838B8B "), // 131 139 139 | ||
322 | + SlateBlue1 : Raphael.getRGB("#836FFF "), // 131 111 255 | ||
323 | + SlateBlue2 : Raphael.getRGB("#7A67EE "), // 122 103 238 | ||
324 | + SlateBlue3 : Raphael.getRGB("#6959CD "), // 105 89 205 | ||
325 | + SlateBlue4 : Raphael.getRGB("#473C8B "), // 71 60 139 | ||
326 | + RoyalBlue1 : Raphael.getRGB("#4876FF "), // 72 118 255 | ||
327 | + RoyalBlue2 : Raphael.getRGB("#436EEE "), // 67 110 238 | ||
328 | + RoyalBlue3 : Raphael.getRGB("#3A5FCD "), // 58 95 205 | ||
329 | + RoyalBlue4 : Raphael.getRGB("#27408B "), // 39 64 139 | ||
330 | + Blue1 : Raphael.getRGB("#0000FF "), // 0 0 255 | ||
331 | + Blue2 : Raphael.getRGB("#0000EE "), // 0 0 238 | ||
332 | + Blue3 : Raphael.getRGB("#0000CD "), // 0 0 205 | ||
333 | + Blue4 : Raphael.getRGB("#00008B "), // 0 0 139 | ||
334 | + DodgerBlue1 : Raphael.getRGB("#1E90FF "), // 30 144 255 | ||
335 | + DodgerBlue2 : Raphael.getRGB("#1C86EE "), // 28 134 238 | ||
336 | + DodgerBlue3 : Raphael.getRGB("#1874CD "), // 24 116 205 | ||
337 | + DodgerBlue4 : Raphael.getRGB("#104E8B "), // 16 78 139 | ||
338 | + SteelBlue1 : Raphael.getRGB("#63B8FF "), // 99 184 255 | ||
339 | + SteelBlue2 : Raphael.getRGB("#5CACEE "), // 92 172 238 | ||
340 | + SteelBlue3 : Raphael.getRGB("#4F94CD "), // 79 148 205 | ||
341 | + SteelBlue4 : Raphael.getRGB("#36648B "), // 54 100 139 | ||
342 | + DeepSkyBlue1 : Raphael.getRGB("#00BFFF "), // 0 191 255 | ||
343 | + DeepSkyBlue2 : Raphael.getRGB("#00B2EE "), // 0 178 238 | ||
344 | + DeepSkyBlue3 : Raphael.getRGB("#009ACD "), // 0 154 205 | ||
345 | + DeepSkyBlue4 : Raphael.getRGB("#00688B "), // 0 104 139 | ||
346 | + SkyBlue1 : Raphael.getRGB("#87CEFF "), // 135 206 255 | ||
347 | + SkyBlue2 : Raphael.getRGB("#7EC0EE "), // 126 192 238 | ||
348 | + SkyBlue3 : Raphael.getRGB("#6CA6CD "), // 108 166 205 | ||
349 | + SkyBlue4 : Raphael.getRGB("#4A708B "), // 74 112 139 | ||
350 | + LightSkyBlue1 : Raphael.getRGB("#B0E2FF "), // 176 226 255 | ||
351 | + LightSkyBlue2 : Raphael.getRGB("#A4D3EE "), // 164 211 238 | ||
352 | + LightSkyBlue3 : Raphael.getRGB("#8DB6CD "), // 141 182 205 | ||
353 | + LightSkyBlue4 : Raphael.getRGB("#607B8B "), // 96 123 139 | ||
354 | + SlateGray1 : Raphael.getRGB("#C6E2FF "), // 198 226 255 | ||
355 | + SlateGray2 : Raphael.getRGB("#B9D3EE "), // 185 211 238 | ||
356 | + SlateGray3 : Raphael.getRGB("#9FB6CD "), // 159 182 205 | ||
357 | + SlateGray4 : Raphael.getRGB("#6C7B8B "), // 108 123 139 | ||
358 | + LightSteelBlue1 : Raphael.getRGB("#CAE1FF "), // 202 225 255 | ||
359 | + LightSteelBlue2 : Raphael.getRGB("#BCD2EE "), // 188 210 238 | ||
360 | + LightSteelBlue3 : Raphael.getRGB("#A2B5CD "), // 162 181 205 | ||
361 | + LightSteelBlue4 : Raphael.getRGB("#6E7B8B "), // 110 123 139 | ||
362 | + LightBlue1 : Raphael.getRGB("#BFEFFF "), // 191 239 255 | ||
363 | + LightBlue2 : Raphael.getRGB("#B2DFEE "), // 178 223 238 | ||
364 | + LightBlue3 : Raphael.getRGB("#9AC0CD "), // 154 192 205 | ||
365 | + LightBlue4 : Raphael.getRGB("#68838B "), // 104 131 139 | ||
366 | + LightCyan1 : Raphael.getRGB("#E0FFFF "), // 224 255 255 | ||
367 | + LightCyan2 : Raphael.getRGB("#D1EEEE "), // 209 238 238 | ||
368 | + LightCyan3 : Raphael.getRGB("#B4CDCD "), // 180 205 205 | ||
369 | + LightCyan4 : Raphael.getRGB("#7A8B8B "), // 122 139 139 | ||
370 | + PaleTurquoise1 : Raphael.getRGB("#BBFFFF "), // 187 255 255 | ||
371 | + PaleTurquoise2 : Raphael.getRGB("#AEEEEE "), // 174 238 238 | ||
372 | + PaleTurquoise3 : Raphael.getRGB("#96CDCD "), // 150 205 205 | ||
373 | + PaleTurquoise4 : Raphael.getRGB("#668B8B "), // 102 139 139 | ||
374 | + CadetBlue1 : Raphael.getRGB("#98F5FF "), // 152 245 255 | ||
375 | + CadetBlue2 : Raphael.getRGB("#8EE5EE "), // 142 229 238 | ||
376 | + CadetBlue3 : Raphael.getRGB("#7AC5CD "), // 122 197 205 | ||
377 | + CadetBlue4 : Raphael.getRGB("#53868B "), // 83 134 139 | ||
378 | + Turquoise1 : Raphael.getRGB("#00F5FF "), // 0 245 255 | ||
379 | + Turquoise2 : Raphael.getRGB("#00E5EE "), // 0 229 238 | ||
380 | + Turquoise3 : Raphael.getRGB("#00C5CD "), // 0 197 205 | ||
381 | + Turquoise4 : Raphael.getRGB("#00868B "), // 0 134 139 | ||
382 | + Cyan1 : Raphael.getRGB("#00FFFF "), // 0 255 255 | ||
383 | + Cyan2 : Raphael.getRGB("#00EEEE "), // 0 238 238 | ||
384 | + Cyan3 : Raphael.getRGB("#00CDCD "), // 0 205 205 | ||
385 | + Cyan4 : Raphael.getRGB("#008B8B "), // 0 139 139 | ||
386 | + DarkSlateGray1 : Raphael.getRGB("#97FFFF "), // 151 255 255 | ||
387 | + DarkSlateGray2 : Raphael.getRGB("#8DEEEE "), // 141 238 238 | ||
388 | + DarkSlateGray3 : Raphael.getRGB("#79CDCD "), // 121 205 205 | ||
389 | + DarkSlateGray4 : Raphael.getRGB("#528B8B "), // 82 139 139 | ||
390 | + Aquamarine1 : Raphael.getRGB("#7FFFD4 "), // 127 255 212 | ||
391 | + Aquamarine2 : Raphael.getRGB("#76EEC6 "), // 118 238 198 | ||
392 | + Aquamarine3 : Raphael.getRGB("#66CDAA "), // 102 205 170 | ||
393 | + Aquamarine4 : Raphael.getRGB("#458B74 "), // 69 139 116 | ||
394 | + DarkSeaGreen1 : Raphael.getRGB("#C1FFC1 "), // 193 255 193 | ||
395 | + DarkSeaGreen2 : Raphael.getRGB("#B4EEB4 "), // 180 238 180 | ||
396 | + DarkSeaGreen3 : Raphael.getRGB("#9BCD9B "), // 155 205 155 | ||
397 | + DarkSeaGreen4 : Raphael.getRGB("#698B69 "), // 105 139 105 | ||
398 | + SeaGreen1 : Raphael.getRGB("#54FF9F "), // 84 255 159 | ||
399 | + SeaGreen2 : Raphael.getRGB("#4EEE94 "), // 78 238 148 | ||
400 | + SeaGreen3 : Raphael.getRGB("#43CD80 "), // 67 205 128 | ||
401 | + SeaGreen4 : Raphael.getRGB("#2E8B57 "), // 46 139 87 | ||
402 | + PaleGreen1 : Raphael.getRGB("#9AFF9A "), // 154 255 154 | ||
403 | + PaleGreen2 : Raphael.getRGB("#90EE90 "), // 144 238 144 | ||
404 | + PaleGreen3 : Raphael.getRGB("#7CCD7C "), // 124 205 124 | ||
405 | + PaleGreen4 : Raphael.getRGB("#548B54 "), // 84 139 84 | ||
406 | + SpringGreen1 : Raphael.getRGB("#00FF7F "), // 0 255 127 | ||
407 | + SpringGreen2 : Raphael.getRGB("#00EE76 "), // 0 238 118 | ||
408 | + SpringGreen3 : Raphael.getRGB("#00CD66 "), // 0 205 102 | ||
409 | + SpringGreen4 : Raphael.getRGB("#008B45 "), // 0 139 69 | ||
410 | + Green1 : Raphael.getRGB("#00FF00 "), // 0 255 0 | ||
411 | + Green2 : Raphael.getRGB("#00EE00 "), // 0 238 0 | ||
412 | + Green3 : Raphael.getRGB("#00CD00 "), // 0 205 0 | ||
413 | + Green4 : Raphael.getRGB("#008B00 "), // 0 139 0 | ||
414 | + Chartreuse1 : Raphael.getRGB("#7FFF00 "), // 127 255 0 | ||
415 | + Chartreuse2 : Raphael.getRGB("#76EE00 "), // 118 238 0 | ||
416 | + Chartreuse3 : Raphael.getRGB("#66CD00 "), // 102 205 0 | ||
417 | + Chartreuse4 : Raphael.getRGB("#458B00 "), // 69 139 0 | ||
418 | + OliveDrab1 : Raphael.getRGB("#C0FF3E "), // 192 255 62 | ||
419 | + OliveDrab2 : Raphael.getRGB("#B3EE3A "), // 179 238 58 | ||
420 | + OliveDrab3 : Raphael.getRGB("#9ACD32 "), // 154 205 50 | ||
421 | + OliveDrab4 : Raphael.getRGB("#698B22 "), // 105 139 34 | ||
422 | + DarkOliveGreen1 : Raphael.getRGB("#CAFF70 "), // 202 255 112 | ||
423 | + DarkOliveGreen2 : Raphael.getRGB("#BCEE68 "), // 188 238 104 | ||
424 | + DarkOliveGreen3 : Raphael.getRGB("#A2CD5A "), // 162 205 90 | ||
425 | + DarkOliveGreen4 : Raphael.getRGB("#6E8B3D "), // 110 139 61 | ||
426 | + Khaki1 : Raphael.getRGB("#FFF68F "), // 255 246 143 | ||
427 | + Khaki2 : Raphael.getRGB("#EEE685 "), // 238 230 133 | ||
428 | + Khaki3 : Raphael.getRGB("#CDC673 "), // 205 198 115 | ||
429 | + Khaki4 : Raphael.getRGB("#8B864E "), // 139 134 78 | ||
430 | + LightGoldenrod1 : Raphael.getRGB("#FFEC8B "), // 255 236 139 | ||
431 | + LightGoldenrod2 : Raphael.getRGB("#EEDC82 "), // 238 220 130 | ||
432 | + LightGoldenrod3 : Raphael.getRGB("#CDBE70 "), // 205 190 112 | ||
433 | + LightGoldenrod4 : Raphael.getRGB("#8B814C "), // 139 129 76 | ||
434 | + LightYellow1 : Raphael.getRGB("#FFFFE0 "), // 255 255 224 | ||
435 | + LightYellow2 : Raphael.getRGB("#EEEED1 "), // 238 238 209 | ||
436 | + LightYellow3 : Raphael.getRGB("#CDCDB4 "), // 205 205 180 | ||
437 | + LightYellow4 : Raphael.getRGB("#8B8B7A "), // 139 139 122 | ||
438 | + Yellow1 : Raphael.getRGB("#FFFF00 "), // 255 255 0 | ||
439 | + Yellow2 : Raphael.getRGB("#EEEE00 "), // 238 238 0 | ||
440 | + Yellow3 : Raphael.getRGB("#CDCD00 "), // 205 205 0 | ||
441 | + Yellow4 : Raphael.getRGB("#8B8B00 "), // 139 139 0 | ||
442 | + Gold1 : Raphael.getRGB("#FFD700 "), // 255 215 0 | ||
443 | + Gold2 : Raphael.getRGB("#EEC900 "), // 238 201 0 | ||
444 | + Gold3 : Raphael.getRGB("#CDAD00 "), // 205 173 0 | ||
445 | + Gold4 : Raphael.getRGB("#8B7500 "), // 139 117 0 | ||
446 | + Goldenrod1 : Raphael.getRGB("#FFC125 "), // 255 193 37 | ||
447 | + Goldenrod2 : Raphael.getRGB("#EEB422 "), // 238 180 34 | ||
448 | + Goldenrod3 : Raphael.getRGB("#CD9B1D "), // 205 155 29 | ||
449 | + Goldenrod4 : Raphael.getRGB("#8B6914 "), // 139 105 20 | ||
450 | + DarkGoldenrod1 : Raphael.getRGB("#FFB90F "), // 255 185 15 | ||
451 | + DarkGoldenrod2 : Raphael.getRGB("#EEAD0E "), // 238 173 14 | ||
452 | + DarkGoldenrod3 : Raphael.getRGB("#CD950C "), // 205 149 12 | ||
453 | + DarkGoldenrod4 : Raphael.getRGB("#8B658B "), // 139 101 8 | ||
454 | + RosyBrown1 : Raphael.getRGB("#FFC1C1 "), // 255 193 193 | ||
455 | + RosyBrown2 : Raphael.getRGB("#EEB4B4 "), // 238 180 180 | ||
456 | + RosyBrown3 : Raphael.getRGB("#CD9B9B "), // 205 155 155 | ||
457 | + RosyBrown4 : Raphael.getRGB("#8B6969 "), // 139 105 105 | ||
458 | + IndianRed1 : Raphael.getRGB("#FF6A6A "), // 255 106 106 | ||
459 | + IndianRed2 : Raphael.getRGB("#EE6363 "), // 238 99 99 | ||
460 | + IndianRed3 : Raphael.getRGB("#CD5555 "), // 205 85 85 | ||
461 | + IndianRed4 : Raphael.getRGB("#8B3A3A "), // 139 58 58 | ||
462 | + Sienna1 : Raphael.getRGB("#FF8247 "), // 255 130 71 | ||
463 | + Sienna2 : Raphael.getRGB("#EE7942 "), // 238 121 66 | ||
464 | + Sienna3 : Raphael.getRGB("#CD6839 "), // 205 104 57 | ||
465 | + Sienna4 : Raphael.getRGB("#8B4726 "), // 139 71 38 | ||
466 | + Burlywood1 : Raphael.getRGB("#FFD39B "), // 255 211 155 | ||
467 | + Burlywood2 : Raphael.getRGB("#EEC591 "), // 238 197 145 | ||
468 | + Burlywood3 : Raphael.getRGB("#CDAA7D "), // 205 170 125 | ||
469 | + Burlywood4 : Raphael.getRGB("#8B7355 "), // 139 115 85 | ||
470 | + Wheat1 : Raphael.getRGB("#FFE7BA "), // 255 231 186 | ||
471 | + Wheat2 : Raphael.getRGB("#EED8AE "), // 238 216 174 | ||
472 | + Wheat3 : Raphael.getRGB("#CDBA96 "), // 205 186 150 | ||
473 | + Wheat4 : Raphael.getRGB("#8B7E66 "), // 139 126 102 | ||
474 | + Tan1 : Raphael.getRGB("#FFA54F "), // 255 165 79 | ||
475 | + Tan2 : Raphael.getRGB("#EE9A49 "), // 238 154 73 | ||
476 | + Tan3 : Raphael.getRGB("#CD853F "), // 205 133 63 | ||
477 | + Tan4 : Raphael.getRGB("#8B5A2B "), // 139 90 43 | ||
478 | + Chocolate1 : Raphael.getRGB("#FF7F24 "), // 255 127 36 | ||
479 | + Chocolate2 : Raphael.getRGB("#EE7621 "), // 238 118 33 | ||
480 | + Chocolate3 : Raphael.getRGB("#CD661D "), // 205 102 29 | ||
481 | + Chocolate4 : Raphael.getRGB("#8B4513 "), // 139 69 19 | ||
482 | + Firebrick1 : Raphael.getRGB("#FF3030 "), // 255 48 48 | ||
483 | + Firebrick2 : Raphael.getRGB("#EE2C2C "), // 238 44 44 | ||
484 | + Firebrick3 : Raphael.getRGB("#CD2626 "), // 205 38 38 | ||
485 | + Firebrick4 : Raphael.getRGB("#8B1A1A "), // 139 26 26 | ||
486 | + Brown1 : Raphael.getRGB("#FF4040 "), // 255 64 64 | ||
487 | + Brown2 : Raphael.getRGB("#EE3B3B "), // 238 59 59 | ||
488 | + Brown3 : Raphael.getRGB("#CD3333 "), // 205 51 51 | ||
489 | + Brown4 : Raphael.getRGB("#8B2323 "), // 139 35 35 | ||
490 | + Salmon1 : Raphael.getRGB("#FF8C69 "), // 255 140 105 | ||
491 | + Salmon2 : Raphael.getRGB("#EE8262 "), // 238 130 98 | ||
492 | + Salmon3 : Raphael.getRGB("#CD7054 "), // 205 112 84 | ||
493 | + Salmon4 : Raphael.getRGB("#8B4C39 "), // 139 76 57 | ||
494 | + LightSalmon1 : Raphael.getRGB("#FFA07A "), // 255 160 122 | ||
495 | + LightSalmon2 : Raphael.getRGB("#EE9572 "), // 238 149 114 | ||
496 | + LightSalmon3 : Raphael.getRGB("#CD8162 "), // 205 129 98 | ||
497 | + LightSalmon4 : Raphael.getRGB("#8B5742 "), // 139 87 66 | ||
498 | + Orange1 : Raphael.getRGB("#FFA500 "), // 255 165 0 | ||
499 | + Orange2 : Raphael.getRGB("#EE9A00 "), // 238 154 0 | ||
500 | + Orange3 : Raphael.getRGB("#CD8500 "), // 205 133 0 | ||
501 | + Orange4 : Raphael.getRGB("#8B5A00 "), // 139 90 0 | ||
502 | + DarkOrange1 : Raphael.getRGB("#FF7F00 "), // 255 127 0 | ||
503 | + DarkOrange2 : Raphael.getRGB("#EE7600 "), // 238 118 0 | ||
504 | + DarkOrange3 : Raphael.getRGB("#CD6600 "), // 205 102 0 | ||
505 | + DarkOrange4 : Raphael.getRGB("#8B4500 "), // 139 69 0 | ||
506 | + Coral1 : Raphael.getRGB("#FF7256 "), // 255 114 86 | ||
507 | + Coral2 : Raphael.getRGB("#EE6A50 "), // 238 106 80 | ||
508 | + Coral3 : Raphael.getRGB("#CD5B45 "), // 205 91 69 | ||
509 | + Coral4 : Raphael.getRGB("#8B3E2F "), // 139 62 47 | ||
510 | + Tomato1 : Raphael.getRGB("#FF6347 "), // 255 99 71 | ||
511 | + Tomato2 : Raphael.getRGB("#EE5C42 "), // 238 92 66 | ||
512 | + Tomato3 : Raphael.getRGB("#CD4F39 "), // 205 79 57 | ||
513 | + Tomato4 : Raphael.getRGB("#8B3626 "), // 139 54 38 | ||
514 | + OrangeRed1 : Raphael.getRGB("#FF4500 "), // 255 69 0 | ||
515 | + OrangeRed2 : Raphael.getRGB("#EE4000 "), // 238 64 0 | ||
516 | + OrangeRed3 : Raphael.getRGB("#CD3700 "), // 205 55 0 | ||
517 | + OrangeRed4 : Raphael.getRGB("#8B2500 "), // 139 37 0 | ||
518 | + Red1 : Raphael.getRGB("#FF0000 "), // 255 0 0 | ||
519 | + Red2 : Raphael.getRGB("#EE0000 "), // 238 0 0 | ||
520 | + Red3 : Raphael.getRGB("#CD0000 "), // 205 0 0 | ||
521 | + Red4 : Raphael.getRGB("#8B0000 "), // 139 0 0 | ||
522 | + DeepPink1 : Raphael.getRGB("#FF1493 "), // 255 20 147 | ||
523 | + DeepPink2 : Raphael.getRGB("#EE1289 "), // 238 18 137 | ||
524 | + DeepPink3 : Raphael.getRGB("#CD1076 "), // 205 16 118 | ||
525 | + DeepPink4 : Raphael.getRGB("#8B0A50 "), // 139 10 80 | ||
526 | + HotPink1 : Raphael.getRGB("#FF6EB4 "), // 255 110 180 | ||
527 | + HotPink2 : Raphael.getRGB("#EE6AA7 "), // 238 106 167 | ||
528 | + HotPink3 : Raphael.getRGB("#CD6090 "), // 205 96 144 | ||
529 | + HotPink4 : Raphael.getRGB("#8B3A62 "), // 139 58 98 | ||
530 | + Pink1 : Raphael.getRGB("#FFB5C5 "), // 255 181 197 | ||
531 | + Pink2 : Raphael.getRGB("#EEA9B8 "), // 238 169 184 | ||
532 | + Pink3 : Raphael.getRGB("#CD919E "), // 205 145 158 | ||
533 | + Pink4 : Raphael.getRGB("#8B636C "), // 139 99 108 | ||
534 | + LightPink1 : Raphael.getRGB("#FFAEB9 "), // 255 174 185 | ||
535 | + LightPink2 : Raphael.getRGB("#EEA2AD "), // 238 162 173 | ||
536 | + LightPink3 : Raphael.getRGB("#CD8C95 "), // 205 140 149 | ||
537 | + LightPink4 : Raphael.getRGB("#8B5F65 "), // 139 95 101 | ||
538 | + PaleVioletRed1 : Raphael.getRGB("#FF82AB "), // 255 130 171 | ||
539 | + PaleVioletRed2 : Raphael.getRGB("#EE799F "), // 238 121 159 | ||
540 | + PaleVioletRed3 : Raphael.getRGB("#CD6889 "), // 205 104 137 | ||
541 | + PaleVioletRed4 : Raphael.getRGB("#8B475D "), // 139 71 93 | ||
542 | + Maroon1 : Raphael.getRGB("#FF34B3 "), // 255 52 179 | ||
543 | + Maroon2 : Raphael.getRGB("#EE30A7 "), // 238 48 167 | ||
544 | + Maroon3 : Raphael.getRGB("#CD2990 "), // 205 41 144 | ||
545 | + Maroon4 : Raphael.getRGB("#8B1C62 "), // 139 28 98 | ||
546 | + VioletRed1 : Raphael.getRGB("#FF3E96 "), // 255 62 150 | ||
547 | + VioletRed2 : Raphael.getRGB("#EE3A8C "), // 238 58 140 | ||
548 | + VioletRed3 : Raphael.getRGB("#CD3278 "), // 205 50 120 | ||
549 | + VioletRed4 : Raphael.getRGB("#8B2252 "), // 139 34 82 | ||
550 | + Magenta1 : Raphael.getRGB("#FF00FF "), // 255 0 255 | ||
551 | + Magenta2 : Raphael.getRGB("#EE00EE "), // 238 0 238 | ||
552 | + Magenta3 : Raphael.getRGB("#CD00CD "), // 205 0 205 | ||
553 | + Magenta4 : Raphael.getRGB("#8B008B "), // 139 0 139 | ||
554 | + Orchid1 : Raphael.getRGB("#FF83FA "), // 255 131 250 | ||
555 | + Orchid2 : Raphael.getRGB("#EE7AE9 "), // 238 122 233 | ||
556 | + Orchid3 : Raphael.getRGB("#CD69C9 "), // 205 105 201 | ||
557 | + Orchid4 : Raphael.getRGB("#8B4789 "), // 139 71 137 | ||
558 | + Plum1 : Raphael.getRGB("#FFBBFF "), // 255 187 255 | ||
559 | + Plum2 : Raphael.getRGB("#EEAEEE "), // 238 174 238 | ||
560 | + Plum3 : Raphael.getRGB("#CD96CD "), // 205 150 205 | ||
561 | + Plum4 : Raphael.getRGB("#8B668B "), // 139 102 139 | ||
562 | + MediumOrchid1 : Raphael.getRGB("#E066FF "), // 224 102 255 | ||
563 | + MediumOrchid2 : Raphael.getRGB("#D15FEE "), // 209 95 238 | ||
564 | + MediumOrchid3 : Raphael.getRGB("#B452CD "), // 180 82 205 | ||
565 | + MediumOrchid4 : Raphael.getRGB("#7A378B "), // 122 55 139 | ||
566 | + DarkOrchid1 : Raphael.getRGB("#BF3EFF "), // 191 62 255 | ||
567 | + DarkOrchid2 : Raphael.getRGB("#B23AEE "), // 178 58 238 | ||
568 | + DarkOrchid3 : Raphael.getRGB("#9A32CD "), // 154 50 205 | ||
569 | + DarkOrchid4 : Raphael.getRGB("#68228B "), // 104 34 139 | ||
570 | + Purple1 : Raphael.getRGB("#9B30FF "), // 155 48 255 | ||
571 | + Purple2 : Raphael.getRGB("#912CEE "), // 145 44 238 | ||
572 | + Purple3 : Raphael.getRGB("#7D26CD "), // 125 38 205 | ||
573 | + Purple4 : Raphael.getRGB("#551A8B "), // 85 26 139 | ||
574 | + MediumPurple1 : Raphael.getRGB("#AB82FF "), // 171 130 255 | ||
575 | + MediumPurple2 : Raphael.getRGB("#9F79EE "), // 159 121 238 | ||
576 | + MediumPurple3 : Raphael.getRGB("#8968CD "), // 137 104 205 | ||
577 | + MediumPurple4 : Raphael.getRGB("#5D478B "), // 93 71 139 | ||
578 | + Thistle1 : Raphael.getRGB("#FFE1FF "), // 255 225 255 | ||
579 | + Thistle2 : Raphael.getRGB("#EED2EE "), // 238 210 238 | ||
580 | + Thistle3 : Raphael.getRGB("#CDB5CD "), // 205 181 205 | ||
581 | + Thistle4 : Raphael.getRGB("#8B7B8B "), // 139 123 139 | ||
582 | + grey11 : Raphael.getRGB("#1C1C1C "), // 28 28 28 | ||
583 | + grey21 : Raphael.getRGB("#363636 "), // 54 54 54 | ||
584 | + grey31 : Raphael.getRGB("#4F4F4F "), // 79 79 79 | ||
585 | + grey41 : Raphael.getRGB("#696969 "), // 105 105 105 | ||
586 | + grey51 : Raphael.getRGB("#828282 "), // 130 130 130 | ||
587 | + grey61 : Raphael.getRGB("#9C9C9C "), // 156 156 156 | ||
588 | + grey71 : Raphael.getRGB("#B5B5B5 "), // 181 181 181 | ||
589 | + gray81 : Raphael.getRGB("#CFCFCF "), // 207 207 207 | ||
590 | + gray91 : Raphael.getRGB("#E8E8E8 "), // 232 232 232 | ||
591 | + DarkGrey : Raphael.getRGB("#A9A9A9 "), // 169 169 169 | ||
592 | + DarkBlue : Raphael.getRGB("#00008B "), // 0 0 139 | ||
593 | + DarkCyan : Raphael.getRGB("#008B8B "), // 0 139 139 | ||
594 | + DarkMagenta : Raphael.getRGB("#8B008B "), // 139 0 139 | ||
595 | + DarkRed : Raphael.getRGB("#8B0000 "), // 139 0 0 | ||
596 | + LightGreen : Raphael.getRGB("#90EE90 "), // 144 238 144 | ||
597 | + | ||
598 | + | ||
599 | + | ||
600 | + get: function(R, G, B){ | ||
601 | + return Raphael.getRGB("rgb(" + R + ", " + G + ", " + B + ")"); | ||
602 | + } | ||
603 | +}; |
1 | +/** | ||
2 | + * Word wrapping | ||
3 | + * | ||
4 | + * @author (Javascript) Dmitry Farafonov | ||
5 | + */ | ||
6 | + | ||
7 | + var AttributedStringIterator = function(text){ | ||
8 | + //this.text = this.rtrim(this.ltrim(text)); | ||
9 | + text = text.replace(/(\s)+/, " "); | ||
10 | + this.text = this.rtrim(text); | ||
11 | + /* | ||
12 | + if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) { | ||
13 | + throw new IllegalArgumentException("Invalid substring range"); | ||
14 | + } | ||
15 | + */ | ||
16 | + this.beginIndex = 0; | ||
17 | + this.endIndex = this.text.length; | ||
18 | + this.currentIndex = this.beginIndex; | ||
19 | + | ||
20 | + //console.group("[AttributedStringIterator]"); | ||
21 | + var i = 0; | ||
22 | + var string = this.text; | ||
23 | + var fullPos = 0; | ||
24 | + | ||
25 | + //console.log("string: \"" + string + "\", length: " + string.length); | ||
26 | + this.startWordOffsets = []; | ||
27 | + this.startWordOffsets.push(fullPos); | ||
28 | + | ||
29 | + // TODO: remove i 1000 | ||
30 | + while (i<1000) { | ||
31 | + var pos = string.search(/[ \t\n\f-\.\,]/); | ||
32 | + if (pos == -1) | ||
33 | + break; | ||
34 | + | ||
35 | + // whitespace start | ||
36 | + fullPos += pos; | ||
37 | + string = string.substr(pos); | ||
38 | + ////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string); | ||
39 | + | ||
40 | + // remove whitespaces | ||
41 | + var pos = string.search(/[^ \t\n\f-\.\,]/); | ||
42 | + if (pos == -1) | ||
43 | + break; | ||
44 | + | ||
45 | + // whitespace end | ||
46 | + fullPos += pos; | ||
47 | + string = string.substr(pos); | ||
48 | + | ||
49 | + ////console.log("fullPos: " + fullPos); | ||
50 | + this.startWordOffsets.push(fullPos); | ||
51 | + | ||
52 | + i++; | ||
53 | + } | ||
54 | + //console.log("startWordOffsets: ", this.startWordOffsets); | ||
55 | + //console.groupEnd(); | ||
56 | + }; | ||
57 | + AttributedStringIterator.prototype = { | ||
58 | + getEndIndex: function(pos){ | ||
59 | + if (typeof(pos) == "undefined") | ||
60 | + return this.endIndex; | ||
61 | + | ||
62 | + var string = this.text.substr(pos, this.endIndex - pos); | ||
63 | + | ||
64 | + var posEndOfLine = string.search(/[\n]/); | ||
65 | + if (posEndOfLine == -1) | ||
66 | + return this.endIndex; | ||
67 | + else | ||
68 | + return pos + posEndOfLine; | ||
69 | + }, | ||
70 | + getBeginIndex: function(){ | ||
71 | + return this.beginIndex; | ||
72 | + }, | ||
73 | + isWhitespace: function(pos){ | ||
74 | + var str = this.text[pos]; | ||
75 | + var whitespaceChars = " \t\n\f"; | ||
76 | + | ||
77 | + return (whitespaceChars.indexOf(str) != -1); | ||
78 | + }, | ||
79 | + isNewLine: function(pos){ | ||
80 | + var str = this.text[pos]; | ||
81 | + var whitespaceChars = "\n"; | ||
82 | + | ||
83 | + return (whitespaceChars.indexOf(str) != -1); | ||
84 | + }, | ||
85 | + preceding: function(pos){ | ||
86 | + //console.group("[AttributedStringIterator.preceding]"); | ||
87 | + for(var i in this.startWordOffsets) { | ||
88 | + var startWordOffset = this.startWordOffsets[i]; | ||
89 | + if (pos < startWordOffset && i>0) { | ||
90 | + //console.log("startWordOffset: " + this.startWordOffsets[i-1]); | ||
91 | + //console.groupEnd(); | ||
92 | + return this.startWordOffsets[i-1]; | ||
93 | + } | ||
94 | + } | ||
95 | + //console.log("pos: " + pos); | ||
96 | + //console.groupEnd(); | ||
97 | + return this.startWordOffsets[i]; | ||
98 | + }, | ||
99 | + following: function(pos){ | ||
100 | + //console.group("[AttributedStringIterator.following]"); | ||
101 | + for(var i in this.startWordOffsets) { | ||
102 | + var startWordOffset = this.startWordOffsets[i]; | ||
103 | + if (pos < startWordOffset && i>0) { | ||
104 | + //console.log("startWordOffset: " + this.startWordOffsets[i]); | ||
105 | + //console.groupEnd(); | ||
106 | + return this.startWordOffsets[i]; | ||
107 | + } | ||
108 | + } | ||
109 | + //console.log("pos: " + pos); | ||
110 | + //console.groupEnd(); | ||
111 | + return this.startWordOffsets[i]; | ||
112 | + }, | ||
113 | + ltrim: function(str){ | ||
114 | + var patt2=/^\s+/g; | ||
115 | + return str.replace(patt2, ""); | ||
116 | + }, | ||
117 | + rtrim: function(str){ | ||
118 | + var patt2=/\s+$/g; | ||
119 | + return str.replace(patt2, ""); | ||
120 | + }, | ||
121 | + getLayout: function(start, limit){ | ||
122 | + return this.text.substr(start, limit - start); | ||
123 | + }, | ||
124 | + getCharAtPos: function(pos) { | ||
125 | + return this.text[pos]; | ||
126 | + } | ||
127 | + }; | ||
128 | + | ||
129 | + var LineBreakMeasurer = function(paper, x, y, text, fontAttrs){ | ||
130 | + this.paper = paper; | ||
131 | + this.text = new AttributedStringIterator(text); | ||
132 | + this.fontAttrs = fontAttrs; | ||
133 | + | ||
134 | + if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) { | ||
135 | + throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"}; | ||
136 | + } | ||
137 | + | ||
138 | + //this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs); | ||
139 | + this.limit = this.text.getEndIndex(); | ||
140 | + this.pos = this.start = this.text.getBeginIndex(); | ||
141 | + | ||
142 | + this.rafaelTextObject = this.paper.text(x, y, this.text.text).attr(fontAttrs).attr("text-anchor", "start"); | ||
143 | + this.svgTextObject = this.rafaelTextObject[0]; | ||
144 | + }; | ||
145 | + LineBreakMeasurer.prototype = { | ||
146 | + nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) { | ||
147 | + //console.group("[nextOffset]"); | ||
148 | + var nextOffset = this.pos; | ||
149 | + if (this.pos < this.limit) { | ||
150 | + if (offsetLimit <= this.pos) { | ||
151 | + throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"}; | ||
152 | + } | ||
153 | + | ||
154 | + var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth); | ||
155 | + //charAtMaxAdvance --; | ||
156 | + //console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]"); | ||
157 | + | ||
158 | + if (charAtMaxAdvance == this.limit) { | ||
159 | + nextOffset = this.limit; | ||
160 | + //console.log("charAtMaxAdvance == this.limit"); | ||
161 | + } else if (this.text.isNewLine(charAtMaxAdvance)) { | ||
162 | + //console.log("isNewLine"); | ||
163 | + nextOffset = charAtMaxAdvance+1; | ||
164 | + } else if (this.text.isWhitespace(charAtMaxAdvance)) { | ||
165 | + // TODO: find next noSpaceChar | ||
166 | + //return nextOffset; | ||
167 | + nextOffset = this.text.following(charAtMaxAdvance); | ||
168 | + } else { | ||
169 | + // Break is in a word; back up to previous break. | ||
170 | + /* | ||
171 | + var testPos = charAtMaxAdvance + 1; | ||
172 | + if (testPos == this.limit) { | ||
173 | + console.error("hbz..."); | ||
174 | + } else { | ||
175 | + nextOffset = this.text.preceding(charAtMaxAdvance); | ||
176 | + } | ||
177 | + */ | ||
178 | + nextOffset = this.text.preceding(charAtMaxAdvance); | ||
179 | + | ||
180 | + if (nextOffset <= this.pos) { | ||
181 | + nextOffset = Math.max(this.pos+1, charAtMaxAdvance); | ||
182 | + } | ||
183 | + } | ||
184 | + } | ||
185 | + if (nextOffset > offsetLimit) { | ||
186 | + nextOffset = offsetLimit; | ||
187 | + } | ||
188 | + //console.log("nextOffset: " + nextOffset); | ||
189 | + //console.groupEnd(); | ||
190 | + return nextOffset; | ||
191 | + }, | ||
192 | + nextLayout: function(wrappingWidth) { | ||
193 | + //console.groupCollapsed("[nextLayout]"); | ||
194 | + if (this.pos < this.limit) { | ||
195 | + var requireNextWord = false; | ||
196 | + var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord); | ||
197 | + //console.log("layoutLimit:", layoutLimit); | ||
198 | + if (layoutLimit == this.pos) { | ||
199 | + //console.groupEnd(); | ||
200 | + return null; | ||
201 | + } | ||
202 | + var result = this.text.getLayout(this.pos, layoutLimit); | ||
203 | + //console.log("layout: \"" + result + "\""); | ||
204 | + | ||
205 | + // remove end of line | ||
206 | + | ||
207 | + //var posEndOfLine = this.text.getEndIndex(this.pos); | ||
208 | + //if (posEndOfLine < result.length) | ||
209 | + // result = result.substr(0, posEndOfLine); | ||
210 | + | ||
211 | + this.pos = layoutLimit; | ||
212 | + | ||
213 | + //console.groupEnd(); | ||
214 | + return result; | ||
215 | + } else { | ||
216 | + //console.groupEnd(); | ||
217 | + return null; | ||
218 | + } | ||
219 | + }, | ||
220 | + getLineBreakIndex: function(pos, wrappingWidth) { | ||
221 | + //console.group("[getLineBreakIndex]"); | ||
222 | + //console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\""); | ||
223 | + | ||
224 | + var bb = this.rafaelTextObject.getBBox(); | ||
225 | + | ||
226 | + var charNum = -1; | ||
227 | + try { | ||
228 | + var svgPoint = this.svgTextObject.getStartPositionOfChar(pos); | ||
229 | + //var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue}); | ||
230 | + svgPoint.x = svgPoint.x + wrappingWidth; | ||
231 | + //svgPoint.y = bb.y; | ||
232 | + //console.log("svgPoint:", svgPoint); | ||
233 | + | ||
234 | + //var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red}); | ||
235 | + | ||
236 | + charNum = this.svgTextObject.getCharNumAtPosition(svgPoint); | ||
237 | + } catch (e){ | ||
238 | + console.warn("getStartPositionOfChar error, pos:" + pos); | ||
239 | + /* | ||
240 | + var testPos = pos + 1; | ||
241 | + if (testPos < this.limit) { | ||
242 | + return testPos | ||
243 | + } | ||
244 | + */ | ||
245 | + } | ||
246 | + //console.log("charNum:", charNum); | ||
247 | + if (charNum == -1) { | ||
248 | + //console.groupEnd(); | ||
249 | + return this.text.getEndIndex(pos); | ||
250 | + } else { | ||
251 | + // When case there is new line between pos and charnum then use this new line | ||
252 | + var newLineIndex = this.text.getEndIndex(pos); | ||
253 | + if (newLineIndex < charNum ) { | ||
254 | + console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "?") + "\""); | ||
255 | + //console.groupEnd(); | ||
256 | + | ||
257 | + return newLineIndex; | ||
258 | + } | ||
259 | + | ||
260 | + //var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1); | ||
261 | + var charAtMaxAdvance = this.text.getCharAtPos(charNum); | ||
262 | + //console.log("!!charAtMaxAdvance: " + charAtMaxAdvance); | ||
263 | + //console.groupEnd(); | ||
264 | + return charNum; | ||
265 | + } | ||
266 | + }, | ||
267 | + getPosition: function() { | ||
268 | + return this.pos; | ||
269 | + } | ||
270 | + }; |
1 | +/** | ||
2 | + * Class to generate polyline | ||
3 | + * | ||
4 | + * @author Dmitry Farafonov | ||
5 | + */ | ||
6 | + | ||
7 | +var ANCHOR_TYPE= { | ||
8 | + main: "main", | ||
9 | + middle: "middle", | ||
10 | + first: "first", | ||
11 | + last: "last" | ||
12 | +}; | ||
13 | + | ||
14 | +function Anchor(uuid, type, x, y) { | ||
15 | + this.uuid = uuid; | ||
16 | + this.x = x | ||
17 | + this.y = y | ||
18 | + this.type = (type == ANCHOR_TYPE.middle) ? ANCHOR_TYPE.middle : ANCHOR_TYPE.main; | ||
19 | +}; | ||
20 | +Anchor.prototype = { | ||
21 | + uuid: null, | ||
22 | + x: 0, | ||
23 | + y: 0, | ||
24 | + type: ANCHOR_TYPE.main, | ||
25 | + isFirst: false, | ||
26 | + isLast: false, | ||
27 | + ndex: 0, | ||
28 | + typeIndex: 0 | ||
29 | +}; | ||
30 | + | ||
31 | +function Polyline(uuid, points, strokeWidth) { | ||
32 | + /* Array on coordinates: | ||
33 | + * points: [{x: 410, y: 110}, 1 | ||
34 | + * {x: 570, y: 110}, 1 2 | ||
35 | + * {x: 620, y: 240}, 2 3 | ||
36 | + * {x: 750, y: 270}, 3 4 | ||
37 | + * {x: 650, y: 370}]; 4 | ||
38 | + */ | ||
39 | + this.points = points; | ||
40 | + | ||
41 | + /* | ||
42 | + * path for graph | ||
43 | + * [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]] | ||
44 | + */ | ||
45 | + this.path = []; | ||
46 | + | ||
47 | + this.anchors = []; | ||
48 | + | ||
49 | + if (strokeWidth) this.strokeWidth = strokeWidth; | ||
50 | + | ||
51 | + this.closePath = false; | ||
52 | + | ||
53 | + this.init(); | ||
54 | +}; | ||
55 | + | ||
56 | +Polyline.prototype = { | ||
57 | + id: null, | ||
58 | + points: [], | ||
59 | + path: [], | ||
60 | + anchors: [], | ||
61 | + strokeWidth: 1, | ||
62 | + radius: 15, | ||
63 | + showDetails: false, | ||
64 | + element: null, | ||
65 | + isDefaultConditionAvailable: false, | ||
66 | + closePath: false, | ||
67 | + | ||
68 | + init: function(points){ | ||
69 | + var linesCount = this.getLinesCount(); | ||
70 | + if (linesCount < 1) | ||
71 | + return; | ||
72 | + | ||
73 | + this.normalizeCoordinates(); | ||
74 | + | ||
75 | + // create anchors | ||
76 | + | ||
77 | + this.pushAnchor(ANCHOR_TYPE.first, this.getLine(0).x1, this.getLine(0).y1); | ||
78 | + | ||
79 | + for(var i = 1; i < linesCount; i++){ | ||
80 | + var line1 = this.getLine(i-1), | ||
81 | + line2 = this.getLine(i); | ||
82 | + | ||
83 | + //this.pushAnchor(ANCHOR_TYPE.middle, line1.x1 + line1.x2-line1.x1, line1.y1 + line1.y2-line1.y1); | ||
84 | + this.pushAnchor(ANCHOR_TYPE.main, line1.x2, line1.y2); | ||
85 | + //this.pushAnchor(ANCHOR_TYPE.middle, line2.x1 + line2.x2-line2.x1, line2.y1 + line2.y2-line2.y1); | ||
86 | + } | ||
87 | + | ||
88 | + this.pushAnchor(ANCHOR_TYPE.last, this.getLine(linesCount-1).x2, this.getLine(linesCount-1).y2); | ||
89 | + | ||
90 | + this.rebuildPath(); | ||
91 | + }, | ||
92 | + | ||
93 | + normalizeCoordinates: function(){ | ||
94 | + for(var i=0; i < this.points.length; i++){ | ||
95 | + this.points[i].x = parseFloat(this.points[i].x); | ||
96 | + this.points[i].y = parseFloat(this.points[i].y); | ||
97 | + } | ||
98 | + }, | ||
99 | + | ||
100 | + getLinesCount: function(){ | ||
101 | + return this.points.length-1; | ||
102 | + }, | ||
103 | + _getLine: function(i){ | ||
104 | + return {x1: this.points[i].x, y1: this.points[i].y, x2: this.points[i+1].x, y2: this.points[i+1].y}; | ||
105 | + }, | ||
106 | + getLine: function(i){ | ||
107 | + var line = this._getLine(i); | ||
108 | + line.angle = this.getLineAngle(i) ; | ||
109 | + return line; | ||
110 | + }, | ||
111 | + getLineAngle: function(i){ | ||
112 | + var line = this._getLine(i); | ||
113 | + return Math.atan2(line.y2 - line.y1, line.x2 - line.x1); | ||
114 | + }, | ||
115 | + getLineLengthX: function(i){ | ||
116 | + var line = this.getLine(i); | ||
117 | + return (line.x2 - line.x1); | ||
118 | + }, | ||
119 | + getLineLengthY: function(i){ | ||
120 | + var line = this.getLine(i); | ||
121 | + return (line.y2 - line.y1); | ||
122 | + }, | ||
123 | + getLineLength: function(i){ | ||
124 | + var line = this.getLine(i); | ||
125 | + return Math.sqrt(Math.pow(this.getLineLengthX(i), 2) + Math.pow(this.getLineLengthY(i), 2)); | ||
126 | + }, | ||
127 | + | ||
128 | + getAnchors: function(){ | ||
129 | + // | ||
130 | + // ???? | ||
131 | + return this.anchors; | ||
132 | + }, | ||
133 | + getAnchorsCount: function(type){ | ||
134 | + if (!type) | ||
135 | + return this.anchors.length; | ||
136 | + else { | ||
137 | + var count = 0; | ||
138 | + for(var i=0; i < this.getAnchorsCount(); i++){ | ||
139 | + var anchor = this.anchors[i]; | ||
140 | + if (anchor.getType() == type) { | ||
141 | + count++; | ||
142 | + } | ||
143 | + } | ||
144 | + return count; | ||
145 | + } | ||
146 | + }, | ||
147 | + | ||
148 | + pushAnchor: function(type, x, y, index){ | ||
149 | + if (type == ANCHOR_TYPE.first) { | ||
150 | + index = 0; | ||
151 | + typeIndex = 0; | ||
152 | + } else if (type == ANCHOR_TYPE.last) { | ||
153 | + index = this.getAnchorsCount(); | ||
154 | + typeIndex = 0; | ||
155 | + } else if (!index) { | ||
156 | + index = this.anchors.length; | ||
157 | + } else { | ||
158 | + // anchors, , index | ||
159 | + //var anchor = this.getAnchor() | ||
160 | + for(var i=0; i < this.getAnchorsCount(); i++){ | ||
161 | + var anchor = this.anchors[i]; | ||
162 | + if (anchor.index > index) { | ||
163 | + anchor.index++; | ||
164 | + anchor.typeIndex++; | ||
165 | + } | ||
166 | + } | ||
167 | + } | ||
168 | + | ||
169 | + var anchor = new Anchor(this.id, ANCHOR_TYPE.main, x, y, index, typeIndex); | ||
170 | + | ||
171 | + this.anchors.push(anchor); | ||
172 | + }, | ||
173 | + | ||
174 | + getAnchor: function(position){ | ||
175 | + return this.anchors[position]; | ||
176 | + }, | ||
177 | + | ||
178 | + getAnchorByType: function(type, position){ | ||
179 | + if (type == ANCHOR_TYPE.first) | ||
180 | + return this.anchors[0]; | ||
181 | + if (type == ANCHOR_TYPE.last) | ||
182 | + return this.anchors[this.getAnchorsCount()-1]; | ||
183 | + | ||
184 | + for(var i=0; i < this.getAnchorsCount(); i++){ | ||
185 | + var anchor = this.anchors[i]; | ||
186 | + if (anchor.type == type) { | ||
187 | + if( position == anchor.position) | ||
188 | + return anchor; | ||
189 | + } | ||
190 | + } | ||
191 | + return null; | ||
192 | + }, | ||
193 | + | ||
194 | + addNewPoint: function(position, x, y){ | ||
195 | + // | ||
196 | + for(var i = 0; i < this.getLinesCount(); i++){ | ||
197 | + var line = this.getLine(i); | ||
198 | + if (x > line.x1 && x < line.x2 && y > line.y1 && y < line.y2) { | ||
199 | + this.points.splice(i+1,0,{x: x, y: y}); | ||
200 | + break; | ||
201 | + } | ||
202 | + } | ||
203 | + | ||
204 | + this.rebuildPath(); | ||
205 | + }, | ||
206 | + | ||
207 | + rebuildPath: function(){ | ||
208 | + var path = []; | ||
209 | + | ||
210 | + for(var i = 0; i < this.getAnchorsCount(); i++){ | ||
211 | + var anchor = this.getAnchor(i); | ||
212 | + | ||
213 | + var pathType = "" | ||
214 | + if (i==0) | ||
215 | + pathType = "M"; | ||
216 | + else | ||
217 | + pathType = "L"; | ||
218 | + | ||
219 | +// TODO: save previous points and calculate new path just if points are updated, and then save currents values as previous | ||
220 | + | ||
221 | + var targetX = anchor.x, targetY = anchor.y; | ||
222 | + if (i>0 && i < this.getAnchorsCount()-1) { | ||
223 | + // get new x,y | ||
224 | + var cx = anchor.x, cy = anchor.y; | ||
225 | + | ||
226 | + // pivot point of prev line | ||
227 | + var AO = this.getLineLength(i-1); | ||
228 | + if (AO < this.radius) { | ||
229 | + AO = this.radius; | ||
230 | + } | ||
231 | + | ||
232 | + this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10)); | ||
233 | + //console.log("isDefaultConditionAvailable", this.isDefaultConditionAvailable); | ||
234 | + | ||
235 | + var ED = this.getLineLengthY(i-1) * this.radius / AO; | ||
236 | + var OD = this.getLineLengthX(i-1) * this.radius / AO; | ||
237 | + targetX = anchor.x - OD; | ||
238 | + targetY = anchor.y - ED; | ||
239 | + | ||
240 | + if (AO < 2*this.radius && i>1) { | ||
241 | + targetX = anchor.x - this.getLineLengthX(i-1)/2; | ||
242 | + targetY = anchor.y - this.getLineLengthY(i-1)/2;; | ||
243 | + } | ||
244 | + | ||
245 | + // pivot point of next line | ||
246 | + var AO = this.getLineLength(i); | ||
247 | + if (AO < this.radius) { | ||
248 | + AO = this.radius; | ||
249 | + } | ||
250 | + var ED = this.getLineLengthY(i) * this.radius / AO; | ||
251 | + var OD = this.getLineLengthX(i) * this.radius / AO; | ||
252 | + var nextSrcX = anchor.x + OD; | ||
253 | + var nextSrcY = anchor.y + ED; | ||
254 | + | ||
255 | + if (AO < 2*this.radius && i<this.getAnchorsCount()-2) { | ||
256 | + nextSrcX = anchor.x + this.getLineLengthX(i)/2; | ||
257 | + nextSrcY = anchor.y + this.getLineLengthY(i)/2;; | ||
258 | + } | ||
259 | + | ||
260 | + | ||
261 | + var dx0 = (cx - targetX) / 3, | ||
262 | + dy0 = (cy - targetY) / 3, | ||
263 | + ax = cx - dx0, | ||
264 | + ay = cy - dy0, | ||
265 | + | ||
266 | + dx1 = (cx - nextSrcX) / 3, | ||
267 | + dy1 = (cy - nextSrcY) / 3, | ||
268 | + bx = cx - dx1, | ||
269 | + by = cy - dy1, | ||
270 | + | ||
271 | + zx=nextSrcX, zy=nextSrcY; | ||
272 | + | ||
273 | + if (this.showDetails) { | ||
274 | + var c = ProcessDiagramCanvas.g.path("M"+targetX+","+targetY+"L"+ax+","+ay).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "}); | ||
275 | + var c = ProcessDiagramCanvas.g.path("M"+nextSrcX+","+nextSrcY+"L"+bx+","+by).attr({stroke: Color.get(255, 153, 51), "stroke-dasharray": "- "}); | ||
276 | + var c = ProcessDiagramCanvas.g.ellipse(ax, ay, 2, 2).attr({stroke: Color.SlateGrey}); | ||
277 | + var c = ProcessDiagramCanvas.g.ellipse(bx, by, 2, 2).attr({stroke: Color.SlateGrey}); | ||
278 | + var c = ProcessDiagramCanvas.g.ellipse(cx, cy, this.radius, this.radius).attr({stroke: Color.Gainsboro}); | ||
279 | + var c = ProcessDiagramCanvas.g.ellipse(targetX, targetY, 2, 2).attr({fill: Color.red}); | ||
280 | + var c = ProcessDiagramCanvas.g.ellipse(nextSrcX, nextSrcY, 2, 2).attr({fill: Color.red}); | ||
281 | + } | ||
282 | + } else if (i==1 && this.getAnchorsCount() == 2){ | ||
283 | + var AO = this.getLineLength(i-1); | ||
284 | + if (AO < this.radius) { | ||
285 | + AO = this.radius; | ||
286 | + } | ||
287 | + this.isDefaultConditionAvailable = (this.isDefaultConditionAvailable || (i == 1 && AO > 10)); | ||
288 | + //console.log("-- isDefaultConditionAvailable", this.isDefaultConditionAvailable); | ||
289 | + } | ||
290 | + | ||
291 | + // anti smoothing | ||
292 | + if (this.strokeWidth%2 == 1) { | ||
293 | + targetX += 0.5; | ||
294 | + targetY += 0.5; | ||
295 | + } | ||
296 | + | ||
297 | + path.push([pathType, targetX, targetY]); | ||
298 | + | ||
299 | + if (i>0 && i < this.getAnchorsCount()-1) { | ||
300 | + path.push(["C", ax, ay, bx, by, zx, zy]); | ||
301 | + } | ||
302 | + } | ||
303 | + | ||
304 | + if (this.closePath) { | ||
305 | + console.log("closePath:", this.closePath); | ||
306 | + path.push(["Z"]); | ||
307 | + } | ||
308 | + | ||
309 | + this.path = path; | ||
310 | + }, | ||
311 | + | ||
312 | + transform: function(transformation){ | ||
313 | + this.element.transform(transformation); | ||
314 | + }, | ||
315 | + attr: function(attrs){ | ||
316 | + //console.log("attrs: " +attrs, "", this.element); | ||
317 | + // TODO: foreach and set each | ||
318 | + this.element.attr(attrs); | ||
319 | + } | ||
320 | +}; | ||
321 | + | ||
322 | +function Polygone(points, strokeWidth) { | ||
323 | + /* Array on coordinates: | ||
324 | + * points: [{x: 410, y: 110}, 1 | ||
325 | + * {x: 570, y: 110}, 1 2 | ||
326 | + * {x: 620, y: 240}, 2 3 | ||
327 | + * {x: 750, y: 270}, 3 4 | ||
328 | + * {x: 650, y: 370}]; 4 | ||
329 | + */ | ||
330 | + this.points = points; | ||
331 | + | ||
332 | + /* | ||
333 | + * path for graph | ||
334 | + * [["M", x1, y1], ["L", x2, y2], ["C", ax, ay, bx, by, x3, y3], ["L", x3, y3]] | ||
335 | + */ | ||
336 | + this.path = []; | ||
337 | + | ||
338 | + this.anchors = []; | ||
339 | + | ||
340 | + if (strokeWidth) this.strokeWidth = strokeWidth; | ||
341 | + | ||
342 | + this.closePath = true; | ||
343 | + this.init(); | ||
344 | +}; | ||
345 | + | ||
346 | + | ||
347 | +/* | ||
348 | + * Poligone is inherited from Poliline: draws closedPath of polyline | ||
349 | + */ | ||
350 | + | ||
351 | +var Foo = function () { }; | ||
352 | +Foo.prototype = Polyline.prototype; | ||
353 | + | ||
354 | +Polygone.prototype = new Foo(); | ||
355 | + | ||
356 | +Polygone.prototype.rebuildPath = function(){ | ||
357 | + var path = []; | ||
358 | + //console.log("Polygone rebuildPath"); | ||
359 | + for(var i = 0; i < this.getAnchorsCount(); i++){ | ||
360 | + var anchor = this.getAnchor(i); | ||
361 | + | ||
362 | + var pathType = "" | ||
363 | + if (i==0) | ||
364 | + pathType = "M"; | ||
365 | + else | ||
366 | + pathType = "L"; | ||
367 | + | ||
368 | + var targetX = anchor.x, targetY = anchor.y; | ||
369 | + | ||
370 | + // anti smoothing | ||
371 | + if (this.strokeWidth%2 == 1) { | ||
372 | + targetX += 0.5; | ||
373 | + targetY += 0.5; | ||
374 | + } | ||
375 | + | ||
376 | + path.push([pathType, targetX, targetY]); | ||
377 | + } | ||
378 | + if (this.closePath) | ||
379 | + path.push(["Z"]); | ||
380 | + | ||
381 | + this.path = path; | ||
382 | +}; | ||
383 | +/* | ||
384 | +Polygone.prototype.transform = function(transformation){ | ||
385 | + this.element.transform(transformation); | ||
386 | +}; | ||
387 | +*/ |
1 | +/** | ||
2 | + * Represents a canvas on which BPMN 2.0 constructs can be drawn. | ||
3 | + * | ||
4 | + * Some of the icons used are licenced under a Creative Commons Attribution 2.5 | ||
5 | + * License, see http://www.famfamfam.com/lab/icons/silk/ | ||
6 | + * | ||
7 | + * @see ProcessDiagramGenerator | ||
8 | + * @author (Java) Joram Barrez | ||
9 | + * @author (Javascript) Dmitry Farafonov | ||
10 | + */ | ||
11 | + | ||
12 | +//Color.Cornsilk | ||
13 | + | ||
14 | +var ARROW_HEAD_SIMPLE = "simple"; | ||
15 | +var ARROW_HEAD_EMPTY = "empty"; | ||
16 | +var ARROW_HEAD_FILL = "FILL"; | ||
17 | +var MULTILINE_VERTICAL_ALIGN_TOP = "top"; | ||
18 | +var MULTILINE_VERTICAL_ALIGN_MIDDLE = "middle"; | ||
19 | +var MULTILINE_VERTICAL_ALIGN_BOTTOM = "bottom"; | ||
20 | +var MULTILINE_HORIZONTAL_ALIGN_LEFT = "start"; | ||
21 | +var MULTILINE_HORIZONTAL_ALIGN_MIDDLE = "middle"; | ||
22 | +var MULTILINE_HORIZONTAL_ALIGN_RIGHT = "end"; | ||
23 | + | ||
24 | +// Predefined sized | ||
25 | +var TEXT_PADDING = 3; | ||
26 | +var ARROW_WIDTH = 4; | ||
27 | +var CONDITIONAL_INDICATOR_WIDTH = 16; | ||
28 | +var MARKER_WIDTH = 12; | ||
29 | +var ANNOTATION_TEXT_PADDING = 7; | ||
30 | + | ||
31 | +// Colors | ||
32 | +var TASK_COLOR = Color.OldLace; // original: Color.get(255, 255, 204); | ||
33 | +var TASK_STROKE_COLOR = Color.black; /*Color.SlateGrey; */ | ||
34 | +//var EXPANDED_SUBPROCESS_ATTRS = Color.black; /*Color.SlateGrey; */ | ||
35 | +var BOUNDARY_EVENT_COLOR = Color.white; | ||
36 | +var CONDITIONAL_INDICATOR_COLOR = Color.get(255, 255, 255); | ||
37 | +var HIGHLIGHT_COLOR = Color.Firebrick1; | ||
38 | +//var SEQUENCEFLOW_COLOR = Color.DimGrey; | ||
39 | +var SEQUENCEFLOW_COLOR = Color.black; | ||
40 | + | ||
41 | +var CATCHING_EVENT_COLOR = Color.black; /* Color.SlateGrey; */ | ||
42 | +var START_EVENT_COLOR = Color.get(251,251,251); | ||
43 | +var START_EVENT_STROKE_COLOR = Color.black; /* Color.SlateGrey; */ | ||
44 | +var END_EVENT_COLOR = Color.get(251,251,251); | ||
45 | +//var END_EVENT_STROKE_COLOR = Color.black; | ||
46 | +var NONE_END_EVENT_COLOR = Color.Firebrick4; | ||
47 | +var NONE_END_EVENT_STROKE_COLOR = Color.Firebrick4; | ||
48 | +var ERROR_END_EVENT_COLOR = Color.Firebrick; | ||
49 | +var ERROR_END_EVENT_STROKE_COLOR = Color.Firebrick; | ||
50 | +//var LABEL_COLOR = Color.get(112, 146, 190); | ||
51 | +var LABEL_COLOR = Color.get(72, 106, 150); | ||
52 | + | ||
53 | +// Fonts | ||
54 | +var NORMAL_FONT = {font: "10px Arial", opacity: 1, fill: Color.black}; | ||
55 | +var LABEL_FONT = {font: "11px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR}; | ||
56 | +var LABEL_FONT_SMOOTH = {font: "10px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR, stroke: LABEL_COLOR, "stroke-width":.4}; | ||
57 | +var TASK_FONT = {font: "11px Arial", opacity: 1, fill: Color.black}; | ||
58 | +var TASK_FONT_SMOOTH = {font: "11px Arial", opacity: 1, fill: Color.black, stroke: LABEL_COLOR, "stroke-width":.4}; | ||
59 | +var POOL_LANE_FONT = {font: "11px Arial", opacity: 1, fill: Color.black}; | ||
60 | +var EXPANDED_SUBPROCESS_FONT = {font: "11px Arial", opacity: 1, fill: Color.black}; | ||
61 | + | ||
62 | +// Strokes | ||
63 | +var NORMAL_STROKE = 1; | ||
64 | +var SEQUENCEFLOW_STROKE = 1.5; | ||
65 | +var SEQUENCEFLOW_HIGHLIGHT_STROKE = 2; | ||
66 | +var THICK_TASK_BORDER_STROKE = 2.5; | ||
67 | +var GATEWAY_TYPE_STROKE = 3.2; | ||
68 | +var END_EVENT_STROKE = NORMAL_STROKE+2; | ||
69 | +var MULTI_INSTANCE_STROKE = 1.3; | ||
70 | +var EVENT_SUBPROCESS_ATTRS = {"stroke": Color.black, "stroke-width": NORMAL_STROKE, "stroke-dasharray": ". "}; | ||
71 | +//var EXPANDED_SUBPROCESS_ATTRS = {"stroke": Color.black, "stroke-width": NORMAL_STROKE, "fill": Color.FloralWhite}; | ||
72 | +var EXPANDED_SUBPROCESS_ATTRS = {"stroke": Color.black, "stroke-width": NORMAL_STROKE, "fill": Color.WhiteSmoke}; | ||
73 | +var NON_INTERRUPTING_EVENT_STROKE = "- "; | ||
74 | + | ||
75 | +var TASK_CORNER_ROUND = 10; | ||
76 | +var EXPANDED_SUBPROCESS_CORNER_ROUND = 10; | ||
77 | + | ||
78 | +// icons | ||
79 | +var ICON_SIZE = 16; | ||
80 | +var ICON_PADDING = 4; | ||
81 | +var USERTASK_IMAGE = "images/deployer/user.png"; | ||
82 | +var SCRIPTTASK_IMAGE = "images/deployer/script.png"; | ||
83 | +var SERVICETASK_IMAGE = "images/deployer/service.png"; | ||
84 | +var RECEIVETASK_IMAGE = "images/deployer/receive.png"; | ||
85 | +var SENDTASK_IMAGE = "images/deployer/send.png"; | ||
86 | +var MANUALTASK_IMAGE = "images/deployer/manual.png"; | ||
87 | +var BUSINESS_RULE_TASK_IMAGE = "images/deployer/business_rule.png"; | ||
88 | +var TIMER_IMAGE = "images/deployer/timer.png"; | ||
89 | +var MESSAGE_CATCH_IMAGE = "images/deployer/message_catch.png"; | ||
90 | +var MESSAGE_THROW_IMAGE = "images/deployer/message_throw.png"; | ||
91 | +var ERROR_THROW_IMAGE = "images/deployer/error_throw.png"; | ||
92 | +var ERROR_CATCH_IMAGE = "images/deployer/error_catch.png"; | ||
93 | +var SIGNAL_CATCH_IMAGE = "images/deployer/signal_catch.png"; | ||
94 | +var SIGNAL_THROW_IMAGE = "images/deployer/signal_throw.png"; | ||
95 | +var MULTIPLE_CATCH_IMAGE = "images/deployer/multiple_catch.png"; | ||
96 | + | ||
97 | + | ||
98 | +var ObjectType = { | ||
99 | + ELLIPSE: "ellipse", | ||
100 | + FLOW: "flow", | ||
101 | + RECT: "rect", | ||
102 | + RHOMBUS: "rhombus" | ||
103 | +}; | ||
104 | + | ||
105 | +function OBJ(type){ | ||
106 | + this.c = null; | ||
107 | + this.type = type; | ||
108 | + this.nestedElements = []; | ||
109 | +}; | ||
110 | +OBJ.prototype = { | ||
111 | + | ||
112 | +}; | ||
113 | + | ||
114 | +var CONNECTION_TYPE = { | ||
115 | + SEQUENCE_FLOW: "sequence_flow", | ||
116 | + MESSAGE_FLOW: "message_flow", | ||
117 | + ASSOCIATION: "association" | ||
118 | +}; | ||
119 | + | ||
120 | +var ProcessDiagramCanvas = function(){ | ||
121 | +}; | ||
122 | +ProcessDiagramCanvas.prototype = { | ||
123 | +// var DefaultProcessDiagramCanvas = { | ||
124 | + canvasHolder: "holder", | ||
125 | + canvasWidth: 0, | ||
126 | + canvasHeight: 0, | ||
127 | + paint: Color.black, | ||
128 | + strokeWidth: 0, | ||
129 | + font: null, | ||
130 | + fontSmoothing: null, | ||
131 | + | ||
132 | + g: null, | ||
133 | + ninjaPaper: null, | ||
134 | + | ||
135 | + objects: [], | ||
136 | + | ||
137 | + processDefinitionId: null, | ||
138 | + activity: null, | ||
139 | + | ||
140 | + frame: null, | ||
141 | + | ||
142 | + | ||
143 | + debug: false, | ||
144 | + | ||
145 | + /** | ||
146 | + * Creates an empty canvas with given width and height. | ||
147 | + */ | ||
148 | + init: function(width, height, processDefinitionId){ | ||
149 | + this.canvasWidth = width; | ||
150 | + this.canvasHeight = height; | ||
151 | + | ||
152 | + // TODO: name it as 'canvasName' | ||
153 | + if (!processDefinitionId) | ||
154 | + processDefinitionId = "holder"; | ||
155 | + | ||
156 | + this.processDefinitionId = processDefinitionId; | ||
157 | + this.canvasHolder = this.processDefinitionId; | ||
158 | + | ||
159 | + var h = document.getElementById(this.canvasHolder); | ||
160 | + if (!h) return; | ||
161 | + | ||
162 | + h.style.width = this.canvasWidth; | ||
163 | + h.style.height = this.canvasHeight; | ||
164 | + | ||
165 | + this.g = Raphael(this.canvasHolder); | ||
166 | + this.g.clear(); | ||
167 | + | ||
168 | + //this.setPaint(Color.DimGrey); | ||
169 | + this.setPaint(Color.black); | ||
170 | + //this.setPaint(Color.white); | ||
171 | + this.setStroke(NORMAL_STROKE); | ||
172 | + | ||
173 | + //this.setFont("Arial", 11); | ||
174 | + this.setFont(NORMAL_FONT); | ||
175 | + //this.font = this.g.getFont("Arial"); | ||
176 | + | ||
177 | + this.fontSmoothing = true; | ||
178 | + | ||
179 | + // ninja! | ||
180 | + var RaphaelOriginal = Raphael; | ||
181 | + this.ninjaPaper =(function (local_raphael) { | ||
182 | + var paper = local_raphael(1, 1, 1, 1, processDefinitionId); | ||
183 | + return paper; | ||
184 | + })(Raphael.ninja()); | ||
185 | + Raphael = RaphaelOriginal; | ||
186 | + }, | ||
187 | + setPaint: function(color){ | ||
188 | + this.paint = color; | ||
189 | + }, | ||
190 | + getPaint: function(){ | ||
191 | + return this.paint; | ||
192 | + }, | ||
193 | + setStroke: function(strokeWidth){ | ||
194 | + this.strokeWidth = strokeWidth; | ||
195 | + }, | ||
196 | + getStroke: function(){ | ||
197 | + return this.strokeWidth; | ||
198 | + }, | ||
199 | + /* | ||
200 | + setFont: function(family, weight, style, stretch){ | ||
201 | + this.font = this.g.getFont(family, weight); | ||
202 | + }, | ||
203 | + */ | ||
204 | + setFont: function(font){ | ||
205 | + this.font = font; | ||
206 | + }, | ||
207 | + getFont: function(){ | ||
208 | + return this.font; | ||
209 | + }, | ||
210 | + drawShaddow: function(object){ | ||
211 | + var border = object.clone(); | ||
212 | + border.attr({"stroke-width": this.strokeWidth + 6, | ||
213 | + "stroke": Color.white, | ||
214 | + "fill": Color.white, | ||
215 | + "opacity": 1, | ||
216 | + "stroke-dasharray":null}); | ||
217 | + //border.toBack(); | ||
218 | + object.toFront(); | ||
219 | + | ||
220 | + return border; | ||
221 | + }, | ||
222 | + | ||
223 | + setConextObject: function(obj){ | ||
224 | + this.contextObject = obj; | ||
225 | + }, | ||
226 | + getConextObject: function(){ | ||
227 | + return this.contextObject; | ||
228 | + }, | ||
229 | + setContextToElement: function(object){ | ||
230 | + var contextObject = this.getConextObject(); | ||
231 | + object.id = contextObject.id; | ||
232 | + object.data("contextObject", contextObject); | ||
233 | + }, | ||
234 | + onClick: function(event, instance, element){ | ||
235 | + var overlay = element; | ||
236 | + var set = overlay.data("set"); | ||
237 | + var contextObject = overlay.data("contextObject"); | ||
238 | + //console.log("["+contextObject.getProperty("type")+"], activityId: " + contextObject.getId()); | ||
239 | + if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.click) { | ||
240 | + var args = [instance, element, contextObject]; | ||
241 | + ProcessDiagramGenerator.options.on.click.apply(event, args); | ||
242 | + } | ||
243 | + }, | ||
244 | + onRightClick: function(event, instance, element){ | ||
245 | + var overlay = element; | ||
246 | + var set = overlay.data("set"); | ||
247 | + var contextObject = overlay.data("contextObject"); | ||
248 | + //console.log("[%s], activityId: %s (RIGHTCLICK)", contextObject.getProperty("type"), contextObject.getId()); | ||
249 | + | ||
250 | + if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.rightClick) { | ||
251 | + var args = [instance, element, contextObject]; | ||
252 | + ProcessDiagramGenerator.options.on.rightClick.apply(event, args); | ||
253 | + } | ||
254 | + }, | ||
255 | + onHoverIn: function(event, instance, element){ | ||
256 | + var overlay = element; | ||
257 | + var set = overlay.data("set"); | ||
258 | + var contextObject = overlay.data("contextObject"); | ||
259 | + | ||
260 | + var border = instance.g.getById(contextObject.id + "_border"); | ||
261 | + border.attr("opacity", 0.3); | ||
262 | + | ||
263 | + // provide callback | ||
264 | + if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.over) { | ||
265 | + var args = [instance, element, contextObject]; | ||
266 | + ProcessDiagramGenerator.options.on.over.apply(event, args); | ||
267 | + } | ||
268 | + }, | ||
269 | + onHoverOut: function(event, instance, element){ | ||
270 | + var overlay = element; | ||
271 | + var set = overlay.data("set"); | ||
272 | + var contextObject = overlay.data("contextObject"); | ||
273 | + | ||
274 | + var border = instance.g.getById(contextObject.id + "_border"); | ||
275 | + border.attr("opacity", 0.0); | ||
276 | + // provide callback | ||
277 | + if (ProcessDiagramGenerator.options && ProcessDiagramGenerator.options.on && ProcessDiagramGenerator.options.on.out) { | ||
278 | + var args = [instance, element, contextObject]; | ||
279 | + ProcessDiagramGenerator.options.on.out.apply(event, args); | ||
280 | + } | ||
281 | + }, | ||
282 | + addHandlers: function(set, x, y, width, height, type){ | ||
283 | + var contextObject = this.getConextObject(); | ||
284 | + | ||
285 | + var cx = x+width/2, cy = y+height/2; | ||
286 | + if (type == "event") { | ||
287 | + var border = this.g.ellipse(cx, cy, width/2+4, height/2+4); | ||
288 | + var overlay = this.g.ellipse(cx, cy, width/2, height/2); | ||
289 | + } else if (type == "gateway") { | ||
290 | + // rhombus | ||
291 | + var border = this.g.path( "M" + (x - 4) + " " + (y + (height / 2)) + | ||
292 | + "L" + (x + (width / 2)) + " " + (y + height + 4) + | ||
293 | + "L" + (x + width + 4) + " " + (y + (height / 2)) + | ||
294 | + "L" + (x + (width / 2)) + " " + (y - 4) + | ||
295 | + "z" ); | ||
296 | + var overlay = this.g.path( "M" + x + " " + (y + (height / 2)) + | ||
297 | + "L" + (x + (width / 2)) + " " + (y + height) + | ||
298 | + "L" + (x + width) + " " + (y + (height / 2)) + | ||
299 | + "L" + (x + (width / 2)) + " " + y + | ||
300 | + "z" ); | ||
301 | + } else if (type == "task") { | ||
302 | + var border = this.g.rect(x - 4, y - 4, width+9, height+9, TASK_CORNER_ROUND+4); | ||
303 | + var overlay = this.g.rect(x, y, width, height, TASK_CORNER_ROUND); | ||
304 | + } | ||
305 | + | ||
306 | + border.attr({stroke: Color.get(132,112,255)/*Color.Tan1*/,"stroke-width": 4, opacity: 0.0}); | ||
307 | + border.id = contextObject.id + "_border"; | ||
308 | + | ||
309 | + set.push(border); | ||
310 | + | ||
311 | + overlay.attr({stroke: Color.Orange,"stroke-width": 3, fill: Color.get(0,0,0), opacity: 0.0, cursor: "hand"}); | ||
312 | + overlay.data("set",set); | ||
313 | + overlay.id = contextObject.id; | ||
314 | + overlay.data("contextObject",contextObject); | ||
315 | + | ||
316 | + var instance = this; | ||
317 | + overlay.mousedown(function(event){if (event.button == 2) instance.onRightClick(event, instance, this);}); | ||
318 | + overlay.click(function(event){instance.onClick(event, instance, this);}); | ||
319 | + overlay.hover(function(event){instance.onHoverIn(event, instance, this);}, function(event){instance.onHoverOut(event, instance, this);}); | ||
320 | + }, | ||
321 | + | ||
322 | + /* | ||
323 | + * Start Events: | ||
324 | + * | ||
325 | + * drawNoneStartEvent | ||
326 | + * drawTimerStartEvent | ||
327 | + * drawMessageStartEvent | ||
328 | + * drawErrorStartEvent | ||
329 | + * drawSignalStartEvent | ||
330 | + * _drawStartEventImage | ||
331 | + * _drawStartEvent | ||
332 | + */ | ||
333 | + | ||
334 | + drawNoneStartEvent: function(x, y, width, height) { | ||
335 | + this.g.setStart(); | ||
336 | + | ||
337 | + var isInterrupting = undefined; | ||
338 | + this._drawStartEvent(x, y, width, height, isInterrupting, null); | ||
339 | + | ||
340 | + var set = this.g.setFinish(); | ||
341 | + this.addHandlers(set, x, y, width, height, "event"); | ||
342 | + }, | ||
343 | + | ||
344 | + drawTimerStartEvent: function(x, y, width, height, isInterrupting, name) { | ||
345 | + this.g.setStart(); | ||
346 | + | ||
347 | + this._drawStartEvent(x, y, width, height, isInterrupting, null); | ||
348 | + | ||
349 | + var cx = x + width/2 - this.getStroke()/4; | ||
350 | + var cy = y + height/2 - this.getStroke()/4; | ||
351 | + | ||
352 | + var w = width*.9;// - this.getStroke()*2; | ||
353 | + var h = height*.9;// - this.getStroke()*2; | ||
354 | + | ||
355 | + this._drawClock(cx, cy, w, h); | ||
356 | + | ||
357 | + if (this.gebug) | ||
358 | + var center = this.g.ellipse(cx, cy, 3, 3).attr({stroke:"none", fill: Color.green}); | ||
359 | + | ||
360 | + var set = this.g.setFinish(); | ||
361 | + this.addHandlers(set, x, y, width, height, "event"); | ||
362 | + }, | ||
363 | + | ||
364 | + drawMessageStartEvent: function(x, y, width, height, isInterrupting, name) { | ||
365 | + this.g.setStart(); | ||
366 | + | ||
367 | + this._drawStartEvent(x, y, width, height, isInterrupting, null); | ||
368 | + | ||
369 | + this._drawStartEventImage(x, y, width, height, MESSAGE_CATCH_IMAGE); | ||
370 | + | ||
371 | + var set = this.g.setFinish(); | ||
372 | + this.addHandlers(set, x, y, width, height, "event"); | ||
373 | + }, | ||
374 | + | ||
375 | + drawErrorStartEvent: function(x, y, width, height, name) { | ||
376 | + this.g.setStart(); | ||
377 | + var isInterrupting = undefined; | ||
378 | + this._drawStartEvent(x, y, width, height, isInterrupting); | ||
379 | + | ||
380 | + this._drawStartEventImage(x, y, width, height, ERROR_CATCH_IMAGE); | ||
381 | + | ||
382 | + var set = this.g.setFinish(); | ||
383 | + this.addHandlers(set, x, y, width, height, "event"); | ||
384 | + }, | ||
385 | + | ||
386 | + drawSignalStartEvent: function(x, y, width, height, isInterrupting, name) { | ||
387 | + this.g.setStart(); | ||
388 | + this._drawStartEvent(x, y, width, height, isInterrupting, null); | ||
389 | + | ||
390 | + this._drawStartEventImage(x, y, width, height, SIGNAL_CATCH_IMAGE); | ||
391 | + | ||
392 | + var set = this.g.setFinish(); | ||
393 | + this.addHandlers(set, x, y, width, height, "event"); | ||
394 | + }, | ||
395 | + | ||
396 | + drawMultipleStartEvent: function(x, y, width, height, isInterrupting, name) { | ||
397 | + this.g.setStart(); | ||
398 | + | ||
399 | + this._drawStartEvent(x, y, width, height, isInterrupting, null); | ||
400 | + | ||
401 | + var cx = x + width/2 - this.getStroke()/4; | ||
402 | + var cy = y + height/2 - this.getStroke()/4; | ||
403 | + | ||
404 | + var w = width*1; | ||
405 | + var h = height*1; | ||
406 | + | ||
407 | + this._drawPentagon(cx, cy, w, h); | ||
408 | + | ||
409 | + var set = this.g.setFinish(); | ||
410 | + this.addHandlers(set, x, y, width, height, "event"); | ||
411 | + }, | ||
412 | + | ||
413 | + _drawStartEventImage: function(x, y, width, height, image){ | ||
414 | + var cx = x + width/2 - this.getStroke()/2; | ||
415 | + var cy = y + height/2 - this.getStroke()/2; | ||
416 | + | ||
417 | + var w = width*.65;// - this.getStroke()*2; | ||
418 | + var h = height*.65;// - this.getStroke()*2; | ||
419 | + | ||
420 | + var img = this.g.image(image, cx-w/2, cy-h/2, w, h); | ||
421 | + }, | ||
422 | + _drawStartEvent: function(x, y, width, height, isInterrupting){ | ||
423 | + var originalPaint = this.getPaint(); | ||
424 | + if (typeof(START_EVENT_STROKE_COLOR) != "undefined") | ||
425 | + this.setPaint(START_EVENT_STROKE_COLOR); | ||
426 | + | ||
427 | + | ||
428 | + width -= this.strokeWidth / 2; | ||
429 | + height -= this.strokeWidth / 2; | ||
430 | + | ||
431 | + x = x + width/2; | ||
432 | + y = y + height/2; | ||
433 | + | ||
434 | + var circle = this.g.ellipse(x, y, width/2, height/2); | ||
435 | + | ||
436 | + circle.attr({"stroke-width": this.strokeWidth, | ||
437 | + "stroke": this.paint, | ||
438 | + //"stroke": START_EVENT_STROKE_COLOR, | ||
439 | + "fill": START_EVENT_COLOR}); | ||
440 | + | ||
441 | + // white shaddow | ||
442 | + this.drawShaddow(circle); | ||
443 | + | ||
444 | + if (isInterrupting!=null && isInterrupting!=undefined && !isInterrupting) | ||
445 | + circle.attr({"stroke-dasharray": NON_INTERRUPTING_EVENT_STROKE}); | ||
446 | + | ||
447 | + this.setContextToElement(circle); | ||
448 | + | ||
449 | + | ||
450 | + this.setPaint(originalPaint); | ||
451 | + }, | ||
452 | + | ||
453 | + /* | ||
454 | + * End Events: | ||
455 | + * | ||
456 | + * drawNoneEndEvent | ||
457 | + * drawErrorEndEvent | ||
458 | + * drawMessageEndEvent | ||
459 | + * drawSignalEndEvent | ||
460 | + * drawMultipleEndEvent | ||
461 | + * _drawEndEventImage | ||
462 | + * _drawNoneEndEvent | ||
463 | + */ | ||
464 | + | ||
465 | + drawNoneEndEvent: function(x, y, width, height) { | ||
466 | + this.g.setStart(); | ||
467 | + | ||
468 | + this._drawNoneEndEvent(x, y, width, height, null, "noneEndEvent"); | ||
469 | + | ||
470 | + var set = this.g.setFinish(); | ||
471 | + this.addHandlers(set, x, y, width, height, "event"); | ||
472 | + }, | ||
473 | + | ||
474 | + drawErrorEndEvent: function(x, y, width, height) { | ||
475 | + this.g.setStart(); | ||
476 | + var type = "errorEndEvent"; | ||
477 | + this._drawNoneEndEvent(x, y, width, height, null, type); | ||
478 | + | ||
479 | + this._drawEndEventImage(x, y, width, height, ERROR_THROW_IMAGE); | ||
480 | + | ||
481 | + var set = this.g.setFinish(); | ||
482 | + this.addHandlers(set, x, y, width, height, "event"); | ||
483 | + }, | ||
484 | + | ||
485 | + drawMessageEndEvent: function(x, y, width, height, name) { | ||
486 | + this.g.setStart(); | ||
487 | + var type = "errorEndEvent"; | ||
488 | + this._drawNoneEndEvent(x, y, width, height, null, type); | ||
489 | + | ||
490 | + this._drawEndEventImage(x, y, width, height, MESSAGE_THROW_IMAGE); | ||
491 | + | ||
492 | + var set = this.g.setFinish(); | ||
493 | + this.addHandlers(set, x, y, width, height, "event"); | ||
494 | + }, | ||
495 | + | ||
496 | + drawSignalEndEvent: function(x, y, width, height, name) { | ||
497 | + this.g.setStart(); | ||
498 | + var type = "errorEndEvent"; | ||
499 | + this._drawNoneEndEvent(x, y, width, height, null, type); | ||
500 | + | ||
501 | + this._drawEndEventImage(x, y, width, height, SIGNAL_THROW_IMAGE); | ||
502 | + | ||
503 | + var set = this.g.setFinish(); | ||
504 | + this.addHandlers(set, x, y, width, height, "event"); | ||
505 | + }, | ||
506 | + | ||
507 | + drawMultipleEndEvent: function(x, y, width, height, name) { | ||
508 | + this.g.setStart(); | ||
509 | + var type = "errorEndEvent"; | ||
510 | + this._drawNoneEndEvent(x, y, width, height, null, type); | ||
511 | + | ||
512 | + var cx = x + width/2;// - this.getStroke(); | ||
513 | + var cy = y + height/2;// - this.getStroke(); | ||
514 | + | ||
515 | + var w = width*1; | ||
516 | + var h = height*1; | ||
517 | + | ||
518 | + var filled = true; | ||
519 | + this._drawPentagon(cx, cy, w, h, filled); | ||
520 | + | ||
521 | + var set = this.g.setFinish(); | ||
522 | + this.addHandlers(set, x, y, width, height, "event"); | ||
523 | + }, | ||
524 | + | ||
525 | + drawTerminateEndEvent: function(x, y, width, height) { | ||
526 | + this.g.setStart(); | ||
527 | + var type = "errorEndEvent"; | ||
528 | + this._drawNoneEndEvent(x, y, width, height, null, type); | ||
529 | + | ||
530 | + var cx = x + width/2;// - this.getStroke()/2; | ||
531 | + var cy = y + height/2;// - this.getStroke()/2; | ||
532 | + | ||
533 | + var w = width/2*.6; | ||
534 | + var h = height/2*.6; | ||
535 | + | ||
536 | + var circle = this.g.ellipse(cx, cy, w, h).attr({fill: Color.black}); | ||
537 | + | ||
538 | + var set = this.g.setFinish(); | ||
539 | + this.addHandlers(set, x, y, width, height, "event"); | ||
540 | + }, | ||
541 | + | ||
542 | + _drawEndEventImage: function(x, y, width, height, image){ | ||
543 | + var cx = x + width/2 - this.getStroke()/2; | ||
544 | + var cy = y + height/2 - this.getStroke()/2; | ||
545 | + | ||
546 | + var w = width*.65; | ||
547 | + var h = height*.65; | ||
548 | + | ||
549 | + var img = this.g.image(image, cx-w/2, cy-h/2, w, h); | ||
550 | + }, | ||
551 | + | ||
552 | + _drawNoneEndEvent: function(x, y, width, height, image, type) { | ||
553 | + var originalPaint = this.getPaint(); | ||
554 | + if (typeof(CATCHING_EVENT_COLOR) != "undefined") | ||
555 | + this.setPaint(CATCHING_EVENT_COLOR); | ||
556 | + | ||
557 | + var strokeColor = this.getPaint(); | ||
558 | + var fillColor = this.getPaint(); | ||
559 | + | ||
560 | + if (type == "errorEndEvent") { | ||
561 | + strokeColor = ERROR_END_EVENT_STROKE_COLOR; | ||
562 | + fillColor = ERROR_END_EVENT_COLOR; | ||
563 | + } else if (type == "noneEndEvent") { | ||
564 | + strokeColor = NONE_END_EVENT_STROKE_COLOR; | ||
565 | + fillColor = NONE_END_EVENT_COLOR; | ||
566 | + } else | ||
567 | + | ||
568 | + // event circles | ||
569 | + width -= this.strokeWidth / 2; | ||
570 | + height -= this.strokeWidth / 2; | ||
571 | + | ||
572 | + x = x + width/2;// + this.strokeWidth/2; | ||
573 | + y = y + width/2;// + this.strokeWidth/2; | ||
574 | + | ||
575 | + // outerCircle | ||
576 | + var outerCircle = this.g.ellipse(x, y, width/2, height/2); | ||
577 | + | ||
578 | + // white shaddow | ||
579 | + var shaddow = this.drawShaddow(outerCircle); | ||
580 | + | ||
581 | + outerCircle.attr({"stroke-width": this.strokeWidth, | ||
582 | + "stroke": strokeColor, | ||
583 | + "fill": fillColor}); | ||
584 | + | ||
585 | + var innerCircleX = x; | ||
586 | + var innerCircleY = y; | ||
587 | + var innerCircleWidth = width/2 - 2; | ||
588 | + var innerCircleHeight = height/2 - 2; | ||
589 | + var innerCircle = this.g.ellipse(innerCircleX, innerCircleY, innerCircleWidth, innerCircleHeight); | ||
590 | + innerCircle.attr({"stroke-width": this.strokeWidth, | ||
591 | + "stroke": strokeColor, | ||
592 | + "fill": Color.white}); | ||
593 | + | ||
594 | + // TODO: implement it | ||
595 | + //var originalPaint = this.getPaint(); | ||
596 | + //this.g.setPaint(BOUNDARY_EVENT_COLOR); | ||
597 | + | ||
598 | + this.setPaint(originalPaint); | ||
599 | + }, | ||
600 | + | ||
601 | + /* | ||
602 | + * Catching Events: | ||
603 | + * | ||
604 | + * drawCatchingTimerEvent | ||
605 | + * drawCatchingErrorEvent | ||
606 | + * drawCatchingSignalEvent | ||
607 | + * drawCatchingMessageEvent | ||
608 | + * drawCatchingMultipleEvent | ||
609 | + * _drawCatchingEventImage | ||
610 | + * _drawCatchingEvent | ||
611 | + */ | ||
612 | + | ||
613 | + | ||
614 | + drawCatchingTimerEvent: function(x, y, width, height, isInterrupting, name) { | ||
615 | + this.g.setStart(); | ||
616 | + this._drawCatchingEvent(x, y, width, height, isInterrupting, null); | ||
617 | + | ||
618 | + var innerCircleWidth = width - 4; | ||
619 | + var innerCircleHeight = height - 4; | ||
620 | + | ||
621 | + var cx = x + width/2 - this.getStroke()/4; | ||
622 | + var cy = y + height/2 - this.getStroke()/4; | ||
623 | + | ||
624 | + var w = innerCircleWidth*.9;// - this.getStroke()*2; | ||
625 | + var h = innerCircleHeight*.9;// - this.getStroke()*2; | ||
626 | + | ||
627 | + this._drawClock(cx, cy, w, h); | ||
628 | + | ||
629 | + var set = this.g.setFinish(); | ||
630 | + this.addHandlers(set, x, y, width, height, "event"); | ||
631 | + }, | ||
632 | + | ||
633 | + drawCatchingErrorEvent: function(x, y, width, height, isInterrupting, name) { | ||
634 | + this.g.setStart(); | ||
635 | + this._drawCatchingEvent(x, y, width, height, isInterrupting, null); | ||
636 | + | ||
637 | + this._drawCatchingEventImage(x, y, width, height, ERROR_CATCH_IMAGE); | ||
638 | + | ||
639 | + var set = this.g.setFinish(); | ||
640 | + this.addHandlers(set, x, y, width, height, "event"); | ||
641 | + }, | ||
642 | + | ||
643 | + drawCatchingSignalEvent: function(x, y, width, height, isInterrupting, name) { | ||
644 | + this.g.setStart(); | ||
645 | + this._drawCatchingEvent(x, y, width, height, isInterrupting, null); | ||
646 | + | ||
647 | + this._drawCatchingEventImage(x, y, width, height, SIGNAL_CATCH_IMAGE); | ||
648 | + | ||
649 | + var set = this.g.setFinish(); | ||
650 | + this.addHandlers(set, x, y, width, height, "event"); | ||
651 | + }, | ||
652 | + | ||
653 | + drawCatchingMessageEvent: function(x, y, width, height, isInterrupting, name) { | ||
654 | + this.g.setStart(); | ||
655 | + this._drawCatchingEvent(x, y, width, height, isInterrupting, null); | ||
656 | + | ||
657 | + this._drawCatchingEventImage(x, y, width, height, MESSAGE_CATCH_IMAGE); | ||
658 | + | ||
659 | + var set = this.g.setFinish(); | ||
660 | + this.addHandlers(set, x, y, width, height, "event"); | ||
661 | + }, | ||
662 | + | ||
663 | + drawCatchingMultipleEvent: function(x, y, width, height, isInterrupting, name) { | ||
664 | + this.g.setStart(); | ||
665 | + this._drawCatchingEvent(x, y, width, height, isInterrupting, null); | ||
666 | + | ||
667 | + var cx = x + width/2 - this.getStroke(); | ||
668 | + var cy = y + height/2 - this.getStroke(); | ||
669 | + | ||
670 | + var w = width*.9; | ||
671 | + var h = height*.9; | ||
672 | + | ||
673 | + this._drawPentagon(cx, cy, w, h); | ||
674 | + | ||
675 | + var set = this.g.setFinish(); | ||
676 | + this.addHandlers(set, x, y, width, height, "event"); | ||
677 | + }, | ||
678 | + | ||
679 | + _drawCatchingEventImage: function(x, y, width, height, image){ | ||
680 | + var innerCircleWidth = width - 4; | ||
681 | + var innerCircleHeight = height - 4; | ||
682 | + | ||
683 | + var cx = x + width/2 - this.getStroke()/2; | ||
684 | + var cy = y + height/2 - this.getStroke()/2; | ||
685 | + | ||
686 | + var w = innerCircleWidth*.6;// - this.getStroke()*2; | ||
687 | + var h = innerCircleHeight*.6;// - this.getStroke()*2; | ||
688 | + | ||
689 | + var img = this.g.image(image, cx-w/2, cy-h/2, w, h); | ||
690 | + }, | ||
691 | + | ||
692 | + _drawCatchingEvent: function(x, y, width, height, isInterrupting, image) { | ||
693 | + var originalPaint = this.getPaint(); | ||
694 | + if (typeof(CATCHING_EVENT_COLOR) != "undefined") | ||
695 | + this.setPaint(CATCHING_EVENT_COLOR); | ||
696 | + | ||
697 | + // event circles | ||
698 | + width -= this.strokeWidth / 2; | ||
699 | + height -= this.strokeWidth / 2; | ||
700 | + | ||
701 | + x = x + width/2;// + this.strokeWidth/2; | ||
702 | + y = y + width/2;// + this.strokeWidth/2; | ||
703 | + | ||
704 | + // outerCircle | ||
705 | + var outerCircle = this.g.ellipse(x, y, width/2, height/2); | ||
706 | + | ||
707 | + // white shaddow | ||
708 | + var shaddow = this.drawShaddow(outerCircle); | ||
709 | + | ||
710 | + //console.log("isInterrupting: " + isInterrupting, "x:" , x, "y:",y); | ||
711 | + if (isInterrupting!=null && isInterrupting!=undefined && !isInterrupting) | ||
712 | + outerCircle.attr({"stroke-dasharray": NON_INTERRUPTING_EVENT_STROKE}); | ||
713 | + | ||
714 | + outerCircle.attr({"stroke-width": this.strokeWidth, | ||
715 | + "stroke": this.getPaint(), | ||
716 | + "fill": BOUNDARY_EVENT_COLOR}); | ||
717 | + | ||
718 | + var innerCircleX = x; | ||
719 | + var innerCircleY = y; | ||
720 | + var innerCircleRadiusX = width/2 - 4; | ||
721 | + var innerCircleRadiusY = height/2 - 4; | ||
722 | + var innerCircle = this.g.ellipse(innerCircleX, innerCircleY, innerCircleRadiusX, innerCircleRadiusY); | ||
723 | + innerCircle.attr({"stroke-width": this.strokeWidth, | ||
724 | + "stroke": this.getPaint()}); | ||
725 | + | ||
726 | + if (image) { | ||
727 | + var imageWidth = imageHeight = innerCircleRadiusX*1.2 + this.getStroke()*2; | ||
728 | + var imageX = innerCircleX-imageWidth/2 - this.strokeWidth/2; | ||
729 | + var imageY = innerCircleY-imageWidth/2 - this.strokeWidth/2; | ||
730 | + var img = this.g.image(image, imageX, imageY, imageWidth, imageHeight); | ||
731 | + } | ||
732 | + | ||
733 | + this.setPaint(originalPaint); | ||
734 | + | ||
735 | + var set = this.g.set(); | ||
736 | + set.push(outerCircle, innerCircle, shaddow); | ||
737 | + this.setContextToElement(outerCircle); | ||
738 | + | ||
739 | + // TODO: add shapes to set | ||
740 | + | ||
741 | + /* | ||
742 | + var st = this.g.set(); | ||
743 | + st.push( | ||
744 | + this.g.ellipse(innerCircleX, innerCircleY, 2, 2), | ||
745 | + this.g.ellipse(imageX, imageY, 2, 2) | ||
746 | + ); | ||
747 | + st.attr({fill: "red", "stroke-width":0}); | ||
748 | + */ | ||
749 | + }, | ||
750 | + | ||
751 | + /* | ||
752 | + * Catching Events: | ||
753 | + * | ||
754 | + * drawThrowingNoneEvent | ||
755 | + * drawThrowingSignalEvent | ||
756 | + * drawThrowingMessageEvent | ||
757 | + * drawThrowingMultipleEvent | ||
758 | + */ | ||
759 | + | ||
760 | + drawThrowingNoneEvent: function(x, y, width, height, name) { | ||
761 | + this.g.setStart(); | ||
762 | + this._drawCatchingEvent(x, y, width, height, null, null); | ||
763 | + | ||
764 | + var set = this.g.setFinish(); | ||
765 | + this.addHandlers(set, x, y, width, height, "event"); | ||
766 | + }, | ||
767 | + | ||
768 | + drawThrowingSignalEvent: function(x, y, width, height, name) { | ||
769 | + this.g.setStart(); | ||
770 | + this._drawCatchingEvent(x, y, width, height, null, null); | ||
771 | + | ||
772 | + this._drawCatchingEventImage(x, y, width, height, SIGNAL_THROW_IMAGE); | ||
773 | + | ||
774 | + var set = this.g.setFinish(); | ||
775 | + this.addHandlers(set, x, y, width, height, "event"); | ||
776 | + }, | ||
777 | + | ||
778 | + drawThrowingMessageEvent: function(x, y, width, height, name) { | ||
779 | + this.g.setStart(); | ||
780 | + this._drawCatchingEvent(x, y, width, height, null, null); | ||
781 | + | ||
782 | + this._drawCatchingEventImage(x, y, width, height, MESSAGE_THROW_IMAGE); | ||
783 | + | ||
784 | + var set = this.g.setFinish(); | ||
785 | + this.addHandlers(set, x, y, width, height, "event"); | ||
786 | + }, | ||
787 | + | ||
788 | + drawThrowingMultipleEvent: function(x, y, width, height, name) { | ||
789 | + this.g.setStart(); | ||
790 | + this._drawCatchingEvent(x, y, width, height, null, null); | ||
791 | + | ||
792 | + var cx = x + width/2 - this.getStroke(); | ||
793 | + var cy = y + height/2 - this.getStroke(); | ||
794 | + | ||
795 | + var w = width*.9; | ||
796 | + var h = height*.9; | ||
797 | + | ||
798 | + var filled = true; | ||
799 | + this._drawPentagon(cx, cy, w, h, filled); | ||
800 | + | ||
801 | + var set = this.g.setFinish(); | ||
802 | + this.addHandlers(set, x, y, width, height, "event"); | ||
803 | + }, | ||
804 | + | ||
805 | + /* | ||
806 | + * Draw flows: | ||
807 | + * | ||
808 | + * _connectFlowToActivity | ||
809 | + * _drawFlow | ||
810 | + * _drawDefaultSequenceFlowIndicator | ||
811 | + * drawSequenceflow | ||
812 | + * drawMessageflow | ||
813 | + * drawAssociation | ||
814 | + * _drawCircleTail | ||
815 | + * _drawArrowHead | ||
816 | + * _drawConditionalSequenceFlowIndicator | ||
817 | + * drawSequenceflowWithoutArrow | ||
818 | + */ | ||
819 | + | ||
820 | + _connectFlowToActivity: function(sourceActivityId, destinationActivityId, waypoints){ | ||
821 | + var sourceActivity = this.g.getById(sourceActivityId); | ||
822 | + var destinationActivity = this.g.getById(destinationActivityId); | ||
823 | + if (sourceActivity == null || destinationActivity == null) { | ||
824 | + if (sourceActivity == null) | ||
825 | + console.error("source activity["+sourceActivityId+"] not found"); | ||
826 | + else | ||
827 | + console.error("destination activity["+destinationActivityId+"] not found"); | ||
828 | + return null; | ||
829 | + } | ||
830 | + var bbSourceActivity = sourceActivity.getBBox() | ||
831 | + var bbDestinationActivity = destinationActivity.getBBox() | ||
832 | + | ||
833 | + var path = []; | ||
834 | + var newWaypoints = []; | ||
835 | + for(var i = 0; i < waypoints.length; i++){ | ||
836 | + var pathType = "" | ||
837 | + if (i==0) | ||
838 | + pathType = "M"; | ||
839 | + else | ||
840 | + pathType = "L"; | ||
841 | + | ||
842 | + path.push([pathType, waypoints[i].x, waypoints[i].y]); | ||
843 | + newWaypoints.push({x:waypoints[i].x, y:waypoints[i].y}); | ||
844 | + } | ||
845 | + | ||
846 | + var ninjaPathSourceActivity = this.ninjaPaper.path(sourceActivity.realPath); | ||
847 | + var ninjaPathDestinationActivity = this.ninjaPaper.path(destinationActivity.realPath); | ||
848 | + var ninjaBBSourceActivity = ninjaPathSourceActivity.getBBox(); | ||
849 | + var ninjaBBDestinationActivity = ninjaPathDestinationActivity.getBBox(); | ||
850 | + | ||
851 | + // set target of the flow to the center of the taskObject | ||
852 | + var newPath = path; | ||
853 | + var originalSource = {x: newPath[0][1], y: newPath[0][2]}; | ||
854 | + var originalTarget = {x: newPath[newPath.length-1][1], y: newPath[newPath.length-1][2]}; | ||
855 | + newPath[0][1] = ninjaBBSourceActivity.x + (ninjaBBSourceActivity.x2 - ninjaBBSourceActivity.x ) / 2; | ||
856 | + newPath[0][2] = ninjaBBSourceActivity.y + (ninjaBBSourceActivity.y2 - ninjaBBSourceActivity.y ) / 2; | ||
857 | + newPath[newPath.length-1][1] = ninjaBBDestinationActivity.x + (ninjaBBDestinationActivity.x2 - ninjaBBDestinationActivity.x ) / 2; | ||
858 | + newPath[newPath.length-1][2] = ninjaBBDestinationActivity.y + (ninjaBBDestinationActivity.y2 - ninjaBBDestinationActivity.y ) / 2; | ||
859 | + | ||
860 | + var ninjaPathFlowObject = this.ninjaPaper.path(newPath); | ||
861 | + var ninjaBBFlowObject = ninjaPathFlowObject.getBBox(); | ||
862 | + | ||
863 | + var intersectionsSource = Raphael.pathIntersection(ninjaPathSourceActivity.realPath, ninjaPathFlowObject.realPath); | ||
864 | + var intersectionsDestination = Raphael.pathIntersection(ninjaPathDestinationActivity.realPath, ninjaPathFlowObject.realPath); | ||
865 | + var intersectionSource = intersectionsSource.pop(); | ||
866 | + var intersectionDestination = intersectionsDestination.pop(); | ||
867 | + | ||
868 | + if (intersectionSource != undefined) { | ||
869 | + if (this.gebug) { | ||
870 | + var diameter = 5; | ||
871 | + var dotOriginal = this.g.ellipse(originalSource.x, originalSource.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Pink}); | ||
872 | + var dot = this.g.ellipse(intersectionSource.x, intersectionSource.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Green}); | ||
873 | + } | ||
874 | + | ||
875 | + newWaypoints[0].x = intersectionSource.x; | ||
876 | + newWaypoints[0].y = intersectionSource.y; | ||
877 | + } | ||
878 | + if (intersectionDestination != undefined) { | ||
879 | + if (this.gebug) { | ||
880 | + var diameter = 5; | ||
881 | + var dotOriginal = this.g.ellipse(originalTarget.x, originalTarget.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Red}); | ||
882 | + var dot = this.g.ellipse(intersectionDestination.x, intersectionDestination.y, diameter, diameter).attr({"fill": Color.white, "stroke": Color.Blue}); | ||
883 | + } | ||
884 | + | ||
885 | + newWaypoints[newWaypoints.length-1].x = intersectionDestination.x; | ||
886 | + newWaypoints[newWaypoints.length-1].y = intersectionDestination.y; | ||
887 | + } | ||
888 | + | ||
889 | + this.ninjaPaper.clear(); | ||
890 | + return newWaypoints; | ||
891 | + }, | ||
892 | + | ||
893 | + _drawFlow: function(waypoints, conditional, isDefault, highLighted, withArrowHead, connectionType){ | ||
894 | + var originalPaint = this.getPaint(); | ||
895 | + var originalStroke = this.getStroke(); | ||
896 | + | ||
897 | + this.setPaint(SEQUENCEFLOW_COLOR); | ||
898 | + this.setStroke(SEQUENCEFLOW_STROKE); | ||
899 | + | ||
900 | + if (highLighted) { | ||
901 | + this.setPaint(HIGHLIGHT_COLOR); | ||
902 | + this.setStroke(SEQUENCEFLOW_HIGHLIGHT_STROKE); | ||
903 | + } | ||
904 | + | ||
905 | +// TODO: generate polylineId or do something!! | ||
906 | + var uuid = Raphael.createUUID(); | ||
907 | + | ||
908 | + var contextObject = this.getConextObject(); | ||
909 | + var newWaypoints = waypoints; | ||
910 | + if (contextObject) { | ||
911 | + var newWaypoints = this._connectFlowToActivity(contextObject.sourceActivityId, contextObject.destinationActivityId, waypoints); | ||
912 | + | ||
913 | + if (!newWaypoints) { | ||
914 | + console.error("Error draw flow from '"+contextObject.sourceActivityId+"' to '"+contextObject.destinationActivityId+"' "); | ||
915 | + return; | ||
916 | + } | ||
917 | + } | ||
918 | + var polyline = new Polyline(uuid, newWaypoints, this.getStroke()); | ||
919 | + //var polyline = new Polyline(waypoints, 3); | ||
920 | + | ||
921 | + polyline.element = this.g.path(polyline.path); | ||
922 | + polyline.element.attr("stroke-width", this.getStroke()); | ||
923 | + polyline.element.attr("stroke", this.getPaint()); | ||
924 | + | ||
925 | + if (contextObject) { | ||
926 | + polyline.element.id = contextObject.id; | ||
927 | + polyline.element.data("contextObject", contextObject); | ||
928 | + } else { | ||
929 | + polyline.element.id = uuid; | ||
930 | + } | ||
931 | + | ||
932 | + | ||
933 | + /* | ||
934 | + polyline.element.mouseover(function(){ | ||
935 | + this.attr({"stroke-width": NORMAL_STROKE + 2}); | ||
936 | + }).mouseout(function(){ | ||
937 | + this.attr({"stroke-width": NORMAL_STROKE}); | ||
938 | + }); | ||
939 | + */ | ||
940 | + | ||
941 | + var last = polyline.getAnchorsCount()-1; | ||
942 | + var x = polyline.getAnchor(last).x; | ||
943 | + var y = polyline.getAnchor(last).y; | ||
944 | + //var c = this.g.ellipse(x, y, 5, 5); | ||
945 | + | ||
946 | + var lastLineIndex = polyline.getLinesCount()-1; | ||
947 | + var line = polyline.getLine(lastLineIndex); | ||
948 | + var firstLine = polyline.getLine(0); | ||
949 | + | ||
950 | + var arrowHead = null, | ||
951 | + circleTail = null, | ||
952 | + defaultSequenceFlowIndicator = null, | ||
953 | + conditionalSequenceFlowIndicator = null; | ||
954 | + | ||
955 | + if (connectionType == CONNECTION_TYPE.MESSAGE_FLOW) { | ||
956 | + circleTail = this._drawCircleTail(firstLine, connectionType); | ||
957 | + } | ||
958 | + if(withArrowHead) | ||
959 | + arrowHead = this._drawArrowHead(line, connectionType); | ||
960 | + | ||
961 | + //console.log("isDefault: ", isDefault, ", isDefaultConditionAvailable: ", polyline.isDefaultConditionAvailable); | ||
962 | + if (isDefault && polyline.isDefaultConditionAvailable) { | ||
963 | + //var angle = polyline.getLineAngle(0); | ||
964 | + //console.log("firstLine", firstLine); | ||
965 | + defaultSequenceFlowIndicator = this._drawDefaultSequenceFlowIndicator(firstLine); | ||
966 | + } | ||
967 | + | ||
968 | + if (conditional) { | ||
969 | + conditionalSequenceFlowIndicator = this._drawConditionalSequenceFlowIndicator(firstLine); | ||
970 | + } | ||
971 | + | ||
972 | + // draw flow name | ||
973 | + var flowName = contextObject.name; | ||
974 | + if (flowName) { | ||
975 | + var xPointArray = contextObject.xPointArray; | ||
976 | + var yPointArray = contextObject.yPointArray; | ||
977 | + var textX = xPointArray[0] < xPointArray[1] ? xPointArray[0] : xPointArray[1]; | ||
978 | + var textY = yPointArray[0] < yPointArray[1] ? yPointArray[1] : yPointArray[0]; | ||
979 | + // fix xy | ||
980 | + textX += 20; | ||
981 | + textY -= 10; | ||
982 | + this.g.text(textX, textY, flowName).attr(LABEL_FONT); | ||
983 | + } | ||
984 | + | ||
985 | + var st = this.g.set(); | ||
986 | + st.push(polyline.element, arrowHead, circleTail, conditionalSequenceFlowIndicator); | ||
987 | + polyline.element.data("set", st); | ||
988 | + polyline.element.data("withArrowHead", withArrowHead); | ||
989 | + | ||
990 | + var polyCloneAttrNormal = {"stroke-width": this.getStroke() + 5, stroke: Color.get(132,112,255), opacity: 0.0, cursor: "hand"}; | ||
991 | + var polyClone = st.clone().attr(polyCloneAttrNormal).hover(function () { | ||
992 | + //if (polyLine.data("isSelected")) return; | ||
993 | + polyClone.attr({opacity: 0.2}); | ||
994 | + }, function () { | ||
995 | + //if (polyLine.data("isSelected")) return; | ||
996 | + polyClone.attr({opacity: 0.0}); | ||
997 | + }); | ||
998 | + polyClone.data("objectId", polyline.element.id); | ||
999 | + polyClone.click(function(){ | ||
1000 | + var instance = this; | ||
1001 | + var objectId = instance.data("objectId"); | ||
1002 | + var object = this.paper.getById(objectId); | ||
1003 | + var contextObject = object.data("contextObject"); | ||
1004 | + if (contextObject) { | ||
1005 | + console.log("[flow], objectId: " + object.id +", flow: " + contextObject.flow); | ||
1006 | + ProcessDiagramGenerator.showFlowInfo(contextObject); | ||
1007 | + } | ||
1008 | + }).dblclick(function(){ | ||
1009 | + console.log("!!! DOUBLE CLICK !!!"); | ||
1010 | + }).hover(function (mouseEvent) { | ||
1011 | + var instance = this; | ||
1012 | + var objectId = instance.data("objectId"); | ||
1013 | + var object = this.paper.getById(objectId); | ||
1014 | + var contextObject = object.data("contextObject"); | ||
1015 | + if (contextObject) | ||
1016 | + ProcessDiagramGenerator.showFlowInfo(contextObject); | ||
1017 | + }); | ||
1018 | + polyClone.data("parentId", uuid); | ||
1019 | + | ||
1020 | + if (!connectionType || connectionType == CONNECTION_TYPE.SEQUENCE_FLOW) | ||
1021 | + polyline.element.attr("stroke-width", this.getStroke()); | ||
1022 | + else if (connectionType == CONNECTION_TYPE.MESSAGE_FLOW) | ||
1023 | + polyline.element.attr({"stroke-dasharray": "--"}); | ||
1024 | + else if (connectionType == CONNECTION_TYPE.ASSOCIATION) | ||
1025 | + polyline.element.attr({"stroke-dasharray": ". "}); | ||
1026 | + | ||
1027 | + this.setPaint(originalPaint); | ||
1028 | + this.setStroke(originalStroke); | ||
1029 | + }, | ||
1030 | + | ||
1031 | + _drawDefaultSequenceFlowIndicator: function(line) { | ||
1032 | + //console.log("line: ", line); | ||
1033 | + | ||
1034 | + var len = 10; c = len/2, f = 8; | ||
1035 | + var defaultIndicator = this.g.path("M" + (-c) + " " + 0 + "L" + (c) + " " + 0); | ||
1036 | + defaultIndicator.attr("stroke-width", this.getStroke()+0); | ||
1037 | + defaultIndicator.attr("stroke", this.getPaint()); | ||
1038 | + | ||
1039 | + | ||
1040 | + var cosAngle = Math.cos((line.angle)); | ||
1041 | + var sinAngle = Math.sin((line.angle)); | ||
1042 | + | ||
1043 | + var dx = f * cosAngle; | ||
1044 | + var dy = f * sinAngle; | ||
1045 | + | ||
1046 | + var x1 = line.x1 + dx + 0*c*cosAngle; | ||
1047 | + var y1 = line.y1 + dy + 0*c*sinAngle; | ||
1048 | + | ||
1049 | + defaultIndicator.transform("t" + (x1) + "," + (y1) + ""); | ||
1050 | + defaultIndicator.transform("...r" + Raphael.deg(line.angle - 3*Math.PI / 4) + " " + 0 + " " + 0); | ||
1051 | + /* | ||
1052 | + var c0 = this.g.ellipse(0, 0, 1, 1).attr({stroke: Color.Blue}); | ||
1053 | + c0.transform("t" + (line.x1) + "," + (line.y1) + ""); | ||
1054 | + var center = this.g.ellipse(0, 0, 1, 1).attr({stroke: Color.Red}); | ||
1055 | + center.transform("t" + (line.x1+dx) + "," + (line.y1+dy) + ""); | ||
1056 | + */ | ||
1057 | + | ||
1058 | + return defaultIndicator; | ||
1059 | + }, | ||
1060 | + | ||
1061 | + drawSequenceflow: function(waypoints, conditional, isDefault, highLighted) { | ||
1062 | + var withArrowHead = true; | ||
1063 | + this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.SEQUENCE_FLOW); | ||
1064 | + }, | ||
1065 | + | ||
1066 | + drawMessageflow: function(waypoints, highLighted) { | ||
1067 | + var withArrowHead = true; | ||
1068 | + var conditional=isDefault=false; | ||
1069 | + this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.MESSAGE_FLOW); | ||
1070 | + }, | ||
1071 | + | ||
1072 | + drawAssociation: function(waypoints, withArrowHead, highLighted) { | ||
1073 | + var withArrowHead = withArrowHead; | ||
1074 | + var conditional=isDefault=false; | ||
1075 | + this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.ASSOCIATION); | ||
1076 | + }, | ||
1077 | + | ||
1078 | + _drawCircleTail: function(line, connectionType){ | ||
1079 | + var diameter = ARROW_WIDTH/2*1.5; | ||
1080 | + | ||
1081 | + // anti smoothing | ||
1082 | + if (this.strokeWidth%2 == 1) | ||
1083 | + line.x1 += .5, line.y1 += .5; | ||
1084 | + | ||
1085 | + var circleTail = this.g.ellipse(line.x1, line.y1, diameter, diameter); | ||
1086 | + circleTail.attr("fill", Color.white); | ||
1087 | + circleTail.attr("stroke", this.getPaint()); | ||
1088 | + | ||
1089 | + return circleTail; | ||
1090 | + }, | ||
1091 | + | ||
1092 | + _drawArrowHead: function(line, connectionType){ | ||
1093 | + var doubleArrowWidth = 2 * ARROW_WIDTH; | ||
1094 | + | ||
1095 | + if (connectionType == CONNECTION_TYPE.ASSOCIATION) | ||
1096 | + var arrowHead = this.g.path("M-" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth + "L 0 0 L" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth); | ||
1097 | + else | ||
1098 | + var arrowHead = this.g.path("M0 0L-" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth + "L" + (ARROW_WIDTH/2+.5) + " -" + doubleArrowWidth + "z"); | ||
1099 | + | ||
1100 | + //arrowHead.transform("t" + 0 + ",-" + this.getStroke() + ""); | ||
1101 | + | ||
1102 | + // anti smoothing | ||
1103 | + if (this.strokeWidth%2 == 1) | ||
1104 | + line.x2 += .5, line.y2 += .5; | ||
1105 | + | ||
1106 | + arrowHead.transform("t" + line.x2 + "," + line.y2 + ""); | ||
1107 | + arrowHead.transform("...r" + Raphael.deg(line.angle - Math.PI / 2) + " " + 0 + " " + 0); | ||
1108 | + | ||
1109 | + if (!connectionType || connectionType == CONNECTION_TYPE.SEQUENCE_FLOW) | ||
1110 | + arrowHead.attr("fill", this.getPaint()); | ||
1111 | + else if (connectionType == CONNECTION_TYPE.MESSAGE_FLOW) | ||
1112 | + arrowHead.attr("fill", Color.white); | ||
1113 | + | ||
1114 | + arrowHead.attr("stroke-width", this.getStroke()); | ||
1115 | + arrowHead.attr("stroke", this.getPaint()); | ||
1116 | + | ||
1117 | + return arrowHead; | ||
1118 | + }, | ||
1119 | + | ||
1120 | + /* | ||
1121 | + drawArrowHead2: function(srcX, srcY, targetX, targetY) { | ||
1122 | + var doubleArrowWidth = 2 * ARROW_WIDTH; | ||
1123 | + | ||
1124 | + //var arrowHead = this.g.path("M-" + ARROW_WIDTH/2 + " -" + doubleArrowWidth + "L0 0" + "L" + ARROW_WIDTH/2 + " -" + doubleArrowWidth + "z"); | ||
1125 | + | ||
1126 | + var arrowHead = this.g.path("M0 0L-" + ARROW_WIDTH/1.5 + " -" + doubleArrowWidth + "L" + ARROW_WIDTH/1.5 + " -" + doubleArrowWidth + "z"); | ||
1127 | + //var c = DefaultProcessDiagramCanvas.g.ellipse(0, 0, 3, 3); | ||
1128 | + //c.transform("t"+targetX+","+targetY+""); | ||
1129 | + | ||
1130 | + var angle = Math.atan2(targetY - srcY, targetX - srcX); | ||
1131 | + | ||
1132 | + arrowHead.transform("t"+targetX+","+targetY+""); | ||
1133 | + arrowHead.transform("...r" + Raphael.deg(angle - Math.PI / 2) + " "+0+" "+0); | ||
1134 | + | ||
1135 | + //console.log(arrowHead.transform()); | ||
1136 | + //console.log("--> " + Raphael.deg(angle - Math.PI / 2)); | ||
1137 | + | ||
1138 | + arrowHead.attr("fill", this.getPaint()); | ||
1139 | + arrowHead.attr("stroke", this.getPaint()); | ||
1140 | + | ||
1141 | + / * | ||
1142 | + // shaddow | ||
1143 | + var c0 = arrowHead.clone(); | ||
1144 | + c0.transform("...t-1 1"); | ||
1145 | + c0.attr("stroke-width", this.strokeWidth); | ||
1146 | + c0.attr("stroke", Color.black); | ||
1147 | + c0.attr("opacity", 0.15); | ||
1148 | + c0.toBack(); | ||
1149 | + * / | ||
1150 | + }, | ||
1151 | + */ | ||
1152 | + | ||
1153 | + _drawConditionalSequenceFlowIndicator: function(line){ | ||
1154 | + var horizontal = (CONDITIONAL_INDICATOR_WIDTH * 0.7); | ||
1155 | + var halfOfHorizontal = horizontal / 2; | ||
1156 | + var halfOfVertical = CONDITIONAL_INDICATOR_WIDTH / 2; | ||
1157 | + | ||
1158 | + var uuid = null; | ||
1159 | + var waypoints = [{x: 0, y: 0}, | ||
1160 | + {x: -halfOfHorizontal, y: halfOfVertical}, | ||
1161 | + {x: 0, y: CONDITIONAL_INDICATOR_WIDTH}, | ||
1162 | + {x: halfOfHorizontal, y: halfOfVertical}]; | ||
1163 | + /* | ||
1164 | + var polyline = new Polyline(uuid, waypoints, this.getStroke()); | ||
1165 | + polyline.element = this.g.path(polyline.path); | ||
1166 | + polyline.element.attr("stroke-width", this.getStroke()); | ||
1167 | + polyline.element.attr("stroke", this.getPaint()); | ||
1168 | + polyline.element.id = uuid; | ||
1169 | + */ | ||
1170 | + var polygone = new Polygone(waypoints, this.getStroke()); | ||
1171 | + polygone.element = this.g.path(polygone.path); | ||
1172 | + polygone.element.attr("fill", Color.white); | ||
1173 | + | ||
1174 | + polygone.transform("t" + line.x1 + "," + line.y1 + ""); | ||
1175 | + polygone.transform("...r" + Raphael.deg(line.angle - Math.PI / 2) + " " + 0 + " " + 0); | ||
1176 | + | ||
1177 | + | ||
1178 | + var cosAngle = Math.cos((line.angle)); | ||
1179 | + var sinAngle = Math.sin((line.angle)); | ||
1180 | + | ||
1181 | + //polygone.element.attr("stroke-width", this.getStroke()); | ||
1182 | + //polygone.element.attr("stroke", this.getPaint()); | ||
1183 | + | ||
1184 | + polygone.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()}); | ||
1185 | + | ||
1186 | + return polygone.element; | ||
1187 | + }, | ||
1188 | + | ||
1189 | + drawSequenceflowWithoutArrow: function(waypoints, conditional, isDefault, highLighted) { | ||
1190 | + var withArrowHead = false; | ||
1191 | + this._drawFlow(waypoints, conditional, isDefault, highLighted, withArrowHead, CONNECTION_TYPE.SEQUENCE_FLOW); | ||
1192 | + }, | ||
1193 | + | ||
1194 | + /* | ||
1195 | + * Draw artifacts | ||
1196 | + */ | ||
1197 | + | ||
1198 | + drawPoolOrLane: function(x, y, width, height, name){ | ||
1199 | + // anti smoothing | ||
1200 | + if (this.strokeWidth%2 == 1) | ||
1201 | + x = Math.round(x) + .5, y = Math.round(y) + .5; | ||
1202 | + | ||
1203 | + // shape | ||
1204 | + var rect = this.g.rect(x, y, width, height); | ||
1205 | + var attr = {"stroke-width": NORMAL_STROKE, stroke: TASK_STROKE_COLOR}; | ||
1206 | + rect.attr(attr); | ||
1207 | + | ||
1208 | + // Add the name as text, vertical | ||
1209 | + if(name != null && name.length > 0) { | ||
1210 | + var attr = POOL_LANE_FONT; | ||
1211 | + | ||
1212 | + // Include some padding | ||
1213 | + var availableTextSpace = height - 6; | ||
1214 | + | ||
1215 | + // Create rotation for derived font | ||
1216 | + var truncated = this.fitTextToWidth(name, availableTextSpace); | ||
1217 | + var realWidth = this.getStringWidth(truncated, attr); | ||
1218 | + var realHeight = this.getStringHeight(truncated, attr); | ||
1219 | + | ||
1220 | + //console.log("truncated:", truncated, ", height:", height, ", realHeight:", realHeight, ", availableTextSpace:", availableTextSpace, ", realWidth:", realWidth); | ||
1221 | + var newX = x + 2 + realHeight*1 - realHeight/2; | ||
1222 | + var newY = 3 + y + availableTextSpace - (availableTextSpace - realWidth) / 2 - realWidth/2; | ||
1223 | + var textElement = this.g.text(newX, newY, truncated).attr(attr); | ||
1224 | + //console.log(".getBBox(): ", t.getBBox()); | ||
1225 | + textElement.transform("r" + Raphael.deg(270 * Math.PI/180) + " " + newX + " " + newY); | ||
1226 | + } | ||
1227 | + | ||
1228 | + // TODO: add to set | ||
1229 | + }, | ||
1230 | + | ||
1231 | + _drawTask: function(name, x, y, width, height, thickBorder) { | ||
1232 | + var originalPaint = this.getPaint(); | ||
1233 | + this.setPaint(TASK_COLOR); | ||
1234 | + | ||
1235 | + // anti smoothing | ||
1236 | + if (this.strokeWidth%2 == 1) | ||
1237 | + x = Math.round(x) + .5, y = Math.round(y) + .5; | ||
1238 | + | ||
1239 | + // shape | ||
1240 | + var shape = this.g.rect(x, y, width, height, TASK_CORNER_ROUND); | ||
1241 | + var attr = {"stroke-width": this.strokeWidth, stroke: TASK_STROKE_COLOR, fill: this.getPaint()}; | ||
1242 | + shape.attr(attr); | ||
1243 | + //shape.attr({fill: "90-"+this.getPaint()+"-" + Color.get(250, 250, 244)}); | ||
1244 | + | ||
1245 | + var contextObject = this.getConextObject(); | ||
1246 | + if (contextObject) { | ||
1247 | + shape.id = contextObject.id; | ||
1248 | + shape.data("contextObject", contextObject); | ||
1249 | + } | ||
1250 | + | ||
1251 | + //var activity = this.getConextObject(); | ||
1252 | + //console.log("activity: " + activity.getId(), activity); | ||
1253 | + //Object.clone(activity); | ||
1254 | + | ||
1255 | + /* | ||
1256 | + c.mouseover(function(){ | ||
1257 | + this.attr({"stroke-width": NORMAL_STROKE + 2}); | ||
1258 | + }).mouseout(function(){ | ||
1259 | + this.attr({"stroke-width": NORMAL_STROKE}); | ||
1260 | + }); | ||
1261 | + */ | ||
1262 | + | ||
1263 | + this.setPaint(originalPaint); | ||
1264 | + | ||
1265 | + // white shaddow | ||
1266 | + this.drawShaddow(shape); | ||
1267 | + | ||
1268 | + | ||
1269 | + if (thickBorder) { | ||
1270 | + shape.attr({"stroke-width": THICK_TASK_BORDER_STROKE}); | ||
1271 | + } else { | ||
1272 | + //g.draw(rect); | ||
1273 | + } | ||
1274 | + | ||
1275 | + // text | ||
1276 | + if (name) { | ||
1277 | + var fontAttr = TASK_FONT; | ||
1278 | + | ||
1279 | + // Include some padding | ||
1280 | + var paddingX = 5; | ||
1281 | + var paddingY = 5; | ||
1282 | + var availableTextSpace = width - paddingX*2; | ||
1283 | + | ||
1284 | + // TODO: this.setFont | ||
1285 | + // var originalFont = this.getFont(); | ||
1286 | + // this.setFont(TASK_FONT) | ||
1287 | + /* | ||
1288 | + var truncated = this.fitTextToWidth(name, availableTextSpace); | ||
1289 | + var realWidth = this.getStringWidth(truncated, fontAttr); | ||
1290 | + var realHeight = this.getStringHeight(truncated, fontAttr); | ||
1291 | + | ||
1292 | + //var t = this.g.text(x + width/2 + realWidth*0/2 + paddingX*0, y + height/2, truncated).attr(fontAttr); | ||
1293 | + */ | ||
1294 | + //console.log("draw task name: " + name); | ||
1295 | + var boxWidth = width - (2 * TEXT_PADDING); | ||
1296 | + var boxHeight = height - ICON_SIZE - ICON_PADDING - ICON_PADDING - MARKER_WIDTH - 2 - 2; | ||
1297 | + var boxX = x + width/2 - boxWidth/2; | ||
1298 | + var boxY = y + height/2 - boxHeight/2 + ICON_PADDING + ICON_PADDING - 2 - 2; | ||
1299 | + /* | ||
1300 | + var boxWidth = width - (2 * ANNOTATION_TEXT_PADDING); | ||
1301 | + var boxHeight = height - (2 * ANNOTATION_TEXT_PADDING); | ||
1302 | + var boxX = x + width/2 - boxWidth/2; | ||
1303 | + var boxY = y + height/2 - boxHeight/2; | ||
1304 | + */ | ||
1305 | + | ||
1306 | + this.drawTaskLabel(name, boxX, boxY, boxWidth, boxHeight); | ||
1307 | + } | ||
1308 | + }, | ||
1309 | + | ||
1310 | + drawTaskLabel: function(text, x, y, boxWidth, boxHeight){ | ||
1311 | + var originalFont = this.getFont(); | ||
1312 | + this.setFont(TASK_FONT); | ||
1313 | + | ||
1314 | + this._drawMultilineText(text, x, y, boxWidth, boxHeight, MULTILINE_VERTICAL_ALIGN_MIDDLE, MULTILINE_HORIZONTAL_ALIGN_MIDDLE); | ||
1315 | + | ||
1316 | + this.setFont(originalFont); | ||
1317 | + }, | ||
1318 | + | ||
1319 | + drawAnnotationText: function(text, x, y, width, height){ | ||
1320 | + //this._drawMultilineText(text, x, y, width, height, "start"); | ||
1321 | + | ||
1322 | + var originalPaint = this.getPaint(); | ||
1323 | + var originalFont = this.getFont(); | ||
1324 | + | ||
1325 | + this.setPaint(Color.black); | ||
1326 | + this.setFont(TASK_FONT); | ||
1327 | + | ||
1328 | + this._drawMultilineText(text, x, y, width, height, MULTILINE_VERTICAL_ALIGN_TOP, MULTILINE_HORIZONTAL_ALIGN_LEFT); | ||
1329 | + | ||
1330 | + this.setPaint(originalPaint); | ||
1331 | + this.setFont(originalFont); | ||
1332 | + }, | ||
1333 | + | ||
1334 | + drawLabel: function(text, x, y, width, height){ | ||
1335 | + //this._drawMultilineText(text, x, y, width, height, "start"); | ||
1336 | + | ||
1337 | + var originalPaint = this.getPaint(); | ||
1338 | + var originalFont = this.getFont(); | ||
1339 | + | ||
1340 | + this.setPaint(LABEL_COLOR); | ||
1341 | + //this.setFont(LABEL_FONT); | ||
1342 | + this.setFont(LABEL_FONT_SMOOTH); | ||
1343 | + | ||
1344 | + // predefined box width for labels | ||
1345 | + // TODO: use label width as is, but not height (for stretching) | ||
1346 | + if (!width || !height) { | ||
1347 | + width = 100; | ||
1348 | + height = 0; | ||
1349 | + } | ||
1350 | + | ||
1351 | + // TODO: remove it. It is debug | ||
1352 | + x = x - width/2; | ||
1353 | + | ||
1354 | + this._drawMultilineText(text, x, y, width, height, MULTILINE_VERTICAL_ALIGN_TOP, MULTILINE_HORIZONTAL_ALIGN_MIDDLE); | ||
1355 | + | ||
1356 | + this.setPaint(originalPaint); | ||
1357 | + this.setFont(originalFont); | ||
1358 | + }, | ||
1359 | + | ||
1360 | + /* | ||
1361 | + drawMultilineLabel: function(text, x, y){ | ||
1362 | + var originalFont = this.getFont(); | ||
1363 | + this.setFont(LABEL_FONT_SMOOTH); | ||
1364 | + | ||
1365 | + var boxWidth = 80; | ||
1366 | + x = x - boxWidth/2 | ||
1367 | + | ||
1368 | + this._drawMultilineText(text, x, y, boxWidth, null, "middle"); | ||
1369 | + this.setFont(originalFont); | ||
1370 | + }, | ||
1371 | + */ | ||
1372 | + | ||
1373 | + getStringWidth: function(text, fontAttrs){ | ||
1374 | + var textElement = this.g.text(0, 0, text).attr(fontAttrs).hide(); | ||
1375 | + var bb = textElement.getBBox(); | ||
1376 | + | ||
1377 | + //console.log("string width: ", t.getBBox().width); | ||
1378 | + return textElement.getBBox().width; | ||
1379 | + }, | ||
1380 | + getStringHeight: function(text, fontAttrs){ | ||
1381 | + var textElement = this.g.text(0, 0, text).attr(fontAttrs).hide(); | ||
1382 | + var bb = textElement.getBBox(); | ||
1383 | + | ||
1384 | + //console.log("string height: ", t.getBBox().height); | ||
1385 | + return textElement.getBBox().height; | ||
1386 | + }, | ||
1387 | + fitTextToWidth: function(original, width) { | ||
1388 | + var text = original; | ||
1389 | + | ||
1390 | + // TODO: move attr on parameters | ||
1391 | + var attr = {font: "11px Arial", opacity: 0}; | ||
1392 | + | ||
1393 | + // remove length for "..." | ||
1394 | + var dots = this.g.text(0, 0, "...").attr(attr).hide(); | ||
1395 | + var dotsBB = dots.getBBox(); | ||
1396 | + | ||
1397 | + var maxWidth = width - dotsBB.width; | ||
1398 | + | ||
1399 | + var textElement = this.g.text(0, 0, text).attr(attr).hide(); | ||
1400 | + var bb = textElement.getBBox(); | ||
1401 | + | ||
1402 | + // it's a little bit incorrect with "..." | ||
1403 | + while (bb.width > maxWidth && text.length > 0) { | ||
1404 | + text = text.substring(0, text.length - 1); | ||
1405 | + textElement.attr({"text": text}); | ||
1406 | + bb = textElement.getBBox(); | ||
1407 | + } | ||
1408 | + | ||
1409 | + // remove element from paper | ||
1410 | + textElement.remove(); | ||
1411 | + | ||
1412 | + if (text != original) { | ||
1413 | + text = text + "..."; | ||
1414 | + } | ||
1415 | + | ||
1416 | + return text; | ||
1417 | + }, | ||
1418 | + wrapTextToWidth: function(original, width){ | ||
1419 | + | ||
1420 | + //return original; | ||
1421 | + | ||
1422 | + var text = original; | ||
1423 | + var wrappedText = "\n"; | ||
1424 | + | ||
1425 | + // TODO: move attr on parameters | ||
1426 | + var attr = {font: "11px Arial", opacity: 0}; | ||
1427 | + | ||
1428 | + var textElement = this.g.text(0, 0, wrappedText).attr(attr).hide(); | ||
1429 | + var bb = textElement.getBBox(); | ||
1430 | + | ||
1431 | + var resultText = ""; | ||
1432 | + var i = 0, j = 0; | ||
1433 | + while (text.length > 0) { | ||
1434 | + while (bb.width < width && text.length>0) { | ||
1435 | + // remove "\n" | ||
1436 | + wrappedText = wrappedText.substring(0,wrappedText.length-1); | ||
1437 | + // add new char, add "\n" | ||
1438 | + wrappedText = wrappedText + text.substring(0,1) + "\n"; | ||
1439 | + text = text.substring(1); | ||
1440 | + | ||
1441 | + textElement.attr({"text": wrappedText}); | ||
1442 | + bb = textElement.getBBox(); | ||
1443 | + i++; | ||
1444 | + if (i>200) break; | ||
1445 | + } | ||
1446 | + // remove "\n" | ||
1447 | + wrappedText = wrappedText.substring(0, wrappedText.length - 1); | ||
1448 | + | ||
1449 | + if (text.length == 0) { | ||
1450 | + resultText += wrappedText; | ||
1451 | + break; | ||
1452 | + } | ||
1453 | + | ||
1454 | + // return last char to text | ||
1455 | + text = wrappedText.substring(wrappedText.length-1) + text; | ||
1456 | + // remove last char from wrappedText | ||
1457 | + wrappedText = wrappedText.substring(0, wrappedText.length-1) + "\n"; | ||
1458 | + | ||
1459 | + textElement.attr({"text": wrappedText}); | ||
1460 | + bb = textElement.getBBox(); | ||
1461 | + | ||
1462 | + //console.log(">> ", wrappedText, ", ", text); | ||
1463 | + resultText += wrappedText; | ||
1464 | + wrappedText = "\n"; | ||
1465 | + | ||
1466 | + j++; | ||
1467 | + if (j>20) break; | ||
1468 | + } | ||
1469 | + // remove element from paper | ||
1470 | + textElement.remove(); | ||
1471 | + | ||
1472 | + return resultText; | ||
1473 | + }, | ||
1474 | + | ||
1475 | + wrapTextToWidth2: function(original, width){ | ||
1476 | + var text = original; | ||
1477 | + var wrappedText = "\n"; | ||
1478 | + | ||
1479 | + // TODO: move attr on parameters | ||
1480 | + var attr = {font: "11px Arial", opacity: 0}; | ||
1481 | + | ||
1482 | + var textElement = this.g.text(0, 0, wrappedText).attr(attr).hide(); | ||
1483 | + var bb = textElement.getBBox(); | ||
1484 | + | ||
1485 | + var resultText = ""; | ||
1486 | + var i = 0, j = 0; | ||
1487 | + while (text.length > 0) { | ||
1488 | + while (bb.width < width && text.length>0) { | ||
1489 | + // remove "\n" | ||
1490 | + wrappedText = wrappedText.substring(0,wrappedText.length-1); | ||
1491 | + // add new char, add "\n" | ||
1492 | + wrappedText = wrappedText + text.substring(0,1) + "\n"; | ||
1493 | + text = text.substring(1); | ||
1494 | + | ||
1495 | + textElement.attr({"text": wrappedText}); | ||
1496 | + bb = textElement.getBBox(); | ||
1497 | + i++; | ||
1498 | + if (i>200) break; | ||
1499 | + } | ||
1500 | + // remove "\n" | ||
1501 | + wrappedText = wrappedText.substring(0, wrappedText.length - 1); | ||
1502 | + | ||
1503 | + if (text.length == 0) { | ||
1504 | + resultText += wrappedText; | ||
1505 | + break; | ||
1506 | + } | ||
1507 | + | ||
1508 | + // return last char to text | ||
1509 | + text = wrappedText.substring(wrappedText.length-1) + text; | ||
1510 | + // remove last char from wrappedText | ||
1511 | + wrappedText = wrappedText.substring(0, wrappedText.length-1) + "\n"; | ||
1512 | + | ||
1513 | + textElement.attr({"text": wrappedText}); | ||
1514 | + bb = textElement.getBBox(); | ||
1515 | + | ||
1516 | + //console.log(">> ", wrappedText, ", ", text); | ||
1517 | + resultText += wrappedText; | ||
1518 | + wrappedText = "\n"; | ||
1519 | + | ||
1520 | + j++; | ||
1521 | + if (j>20) break; | ||
1522 | + } | ||
1523 | + // remove element from paper | ||
1524 | + textElement.remove(); | ||
1525 | + | ||
1526 | + return resultText; | ||
1527 | + }, | ||
1528 | + | ||
1529 | + drawUserTask: function(name, x, y, width, height) { | ||
1530 | + this.g.setStart(); | ||
1531 | + this._drawTask(name, x, y, width, height); | ||
1532 | + var img = this.g.image(USERTASK_IMAGE, x + ICON_PADDING, y + ICON_PADDING, ICON_SIZE, ICON_SIZE); | ||
1533 | + var set = this.g.setFinish(); | ||
1534 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1535 | + }, | ||
1536 | + | ||
1537 | + drawScriptTask: function(name, x, y, width, height) { | ||
1538 | + this.g.setStart(); | ||
1539 | + this._drawTask(name, x, y, width, height); | ||
1540 | + var img = this.g.image(SCRIPTTASK_IMAGE, x + ICON_PADDING, y + ICON_PADDING, ICON_SIZE, ICON_SIZE); | ||
1541 | + var set = this.g.setFinish(); | ||
1542 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1543 | + }, | ||
1544 | + | ||
1545 | + drawServiceTask: function(name, x, y, width, height) { | ||
1546 | + this.g.setStart(); | ||
1547 | + this._drawTask(name, x, y, width, height); | ||
1548 | + var img = this.g.image(SERVICETASK_IMAGE, x + ICON_PADDING, y + ICON_PADDING, ICON_SIZE, ICON_SIZE); | ||
1549 | + var set = this.g.setFinish(); | ||
1550 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1551 | + }, | ||
1552 | + | ||
1553 | + drawReceiveTask: function(name, x, y, width, height) { | ||
1554 | + this.g.setStart(); | ||
1555 | + this._drawTask(name, x, y, width, height); | ||
1556 | + var img = this.g.image(RECEIVETASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE); | ||
1557 | + var set = this.g.setFinish(); | ||
1558 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1559 | + }, | ||
1560 | + | ||
1561 | + drawSendTask: function(name, x, y, width, height) { | ||
1562 | + this.g.setStart(); | ||
1563 | + this._drawTask(name, x, y, width, height); | ||
1564 | + var img = this.g.image(SENDTASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE); | ||
1565 | + var set = this.g.setFinish(); | ||
1566 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1567 | + }, | ||
1568 | + | ||
1569 | + drawManualTask: function(name, x, y, width, height) { | ||
1570 | + this.g.setStart(); | ||
1571 | + this._drawTask(name, x, y, width, height); | ||
1572 | + var img = this.g.image(MANUALTASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE); | ||
1573 | + var set = this.g.setFinish(); | ||
1574 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1575 | + }, | ||
1576 | + | ||
1577 | + drawBusinessRuleTask: function(name, x, y, width, height) { | ||
1578 | + this.g.setStart(); | ||
1579 | + this._drawTask(name, x, y, width, height); | ||
1580 | + var img = this.g.image(BUSINESS_RULE_TASK_IMAGE, x + 7, y + 7, ICON_SIZE, ICON_SIZE); | ||
1581 | + var set = this.g.setFinish(); | ||
1582 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1583 | + }, | ||
1584 | + | ||
1585 | + drawExpandedSubProcess: function(name, x, y, width, height, isTriggeredByEvent){ | ||
1586 | + this.g.setStart(); | ||
1587 | + // anti smoothing | ||
1588 | + if (this.strokeWidth%2 == 1) | ||
1589 | + x = Math.round(x) + .5, y = Math.round(y) + .5; | ||
1590 | + | ||
1591 | + // shape | ||
1592 | + var rect = this.g.rect(x, y, width, height, EXPANDED_SUBPROCESS_CORNER_ROUND); | ||
1593 | + | ||
1594 | + // Use different stroke (dashed) | ||
1595 | + if(isTriggeredByEvent) { | ||
1596 | + rect.attr(EVENT_SUBPROCESS_ATTRS); | ||
1597 | + } else { | ||
1598 | + rect.attr(EXPANDED_SUBPROCESS_ATTRS); | ||
1599 | + } | ||
1600 | + | ||
1601 | + this.setContextToElement(rect); | ||
1602 | + | ||
1603 | + var fontAttr = EXPANDED_SUBPROCESS_FONT; | ||
1604 | + | ||
1605 | + // Include some padding | ||
1606 | + var paddingX = 10; | ||
1607 | + var paddingY = 5; | ||
1608 | + var availableTextSpace = width - paddingX*2; | ||
1609 | + | ||
1610 | + var truncated = this.fitTextToWidth(name, availableTextSpace); | ||
1611 | + var realWidth = this.getStringWidth(truncated, fontAttr); | ||
1612 | + var realHeight = this.getStringHeight(truncated, fontAttr); | ||
1613 | + | ||
1614 | + var textElement = this.g.text(x + width/2 - realWidth*0/2 + 0*paddingX, y + realHeight/2 + paddingY, truncated).attr(fontAttr); | ||
1615 | + | ||
1616 | + var set = this.g.setFinish(); | ||
1617 | + // TODO: Expanded Sub Process may has specific handlers | ||
1618 | + //this.addHandlers(set, x, y, width, height, "task"); | ||
1619 | + }, | ||
1620 | + | ||
1621 | + drawCollapsedSubProcess: function(name, x, y, width, height, isTriggeredByEvent) { | ||
1622 | + this.g.setStart(); | ||
1623 | + this._drawCollapsedTask(name, x, y, width, height, false); | ||
1624 | + var set = this.g.setFinish(); | ||
1625 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1626 | + }, | ||
1627 | + | ||
1628 | + drawCollapsedCallActivity: function(name, x, y, width, height) { | ||
1629 | + this.g.setStart(); | ||
1630 | + this._drawCollapsedTask(name, x, y, width, height, true); | ||
1631 | + var set = this.g.setFinish(); | ||
1632 | + this.addHandlers(set, x, y, width, height, "task"); | ||
1633 | + }, | ||
1634 | + | ||
1635 | + _drawCollapsedTask: function(name, x, y, width, height, thickBorder) { | ||
1636 | + // The collapsed marker is now visualized separately | ||
1637 | + this._drawTask(name, x, y, width, height, thickBorder); | ||
1638 | + }, | ||
1639 | + | ||
1640 | + drawCollapsedMarker: function(x, y, width, height){ | ||
1641 | + // rectangle | ||
1642 | + var rectangleWidth = MARKER_WIDTH; | ||
1643 | + var rectangleHeight = MARKER_WIDTH; | ||
1644 | + | ||
1645 | + // anti smoothing | ||
1646 | + if (this.strokeWidth%2 == 1) | ||
1647 | + y += .5; | ||
1648 | + | ||
1649 | + var rect = this.g.rect(x + (width - rectangleWidth) / 2, y + height - rectangleHeight - 3, rectangleWidth, rectangleHeight); | ||
1650 | + | ||
1651 | + // plus inside rectangle | ||
1652 | + var cx = rect.attr("x") + rect.attr("width")/2; | ||
1653 | + var cy = rect.attr("y") + rect.attr("height")/2; | ||
1654 | + | ||
1655 | + var line = this.g.path( | ||
1656 | + "M" + cx + " " + (cy+2) + "L" + cx + " " + (cy-2) + | ||
1657 | + "M" + (cx-2) + " " + cy + "L" + (cx+2) + " " + cy | ||
1658 | + ).attr({"stroke-width": this.strokeWidth}); | ||
1659 | + | ||
1660 | + }, | ||
1661 | + | ||
1662 | + drawActivityMarkers: function(x, y, width, height, multiInstanceSequential, multiInstanceParallel, collapsed){ | ||
1663 | + if (collapsed) { | ||
1664 | + if (!multiInstanceSequential && !multiInstanceParallel) { | ||
1665 | + this.drawCollapsedMarker(x, y, width, height); | ||
1666 | + } else { | ||
1667 | + this.drawCollapsedMarker(x - MARKER_WIDTH / 2 - 2, y, width, height); | ||
1668 | + if (multiInstanceSequential) { | ||
1669 | + console.log("is collapsed and multiInstanceSequential"); | ||
1670 | + this.drawMultiInstanceMarker(true, x + MARKER_WIDTH / 2 + 2, y, width, height); | ||
1671 | + } else if (multiInstanceParallel) { | ||
1672 | + console.log("is collapsed and multiInstanceParallel"); | ||
1673 | + this.drawMultiInstanceMarker(false, x + MARKER_WIDTH / 2 + 2, y, width, height); | ||
1674 | + } | ||
1675 | + } | ||
1676 | + } else { | ||
1677 | + if (multiInstanceSequential) { | ||
1678 | + console.log("is multiInstanceSequential"); | ||
1679 | + this.drawMultiInstanceMarker(true, x, y, width, height); | ||
1680 | + } else if (multiInstanceParallel) { | ||
1681 | + console.log("is multiInstanceParallel"); | ||
1682 | + this.drawMultiInstanceMarker(false, x, y, width, height); | ||
1683 | + } | ||
1684 | + } | ||
1685 | + }, | ||
1686 | + | ||
1687 | + drawGateway: function(x, y, width, height) { | ||
1688 | + | ||
1689 | + var rhombus = this.g.path( "M" + x + " " + (y + (height / 2)) + | ||
1690 | + "L" + (x + (width / 2)) + " " + (y + height) + | ||
1691 | + "L" + (x + width) + " " + (y + (height / 2)) + | ||
1692 | + "L" + (x + (width / 2)) + " " + y + | ||
1693 | + "z" | ||
1694 | + ); | ||
1695 | + | ||
1696 | + // white shaddow | ||
1697 | + this.drawShaddow(rhombus); | ||
1698 | + | ||
1699 | + rhombus.attr("stroke-width", this.strokeWidth); | ||
1700 | + rhombus.attr("stroke", Color.SlateGrey); | ||
1701 | + rhombus.attr({fill: Color.white}); | ||
1702 | + | ||
1703 | + this.setContextToElement(rhombus); | ||
1704 | + | ||
1705 | + return rhombus; | ||
1706 | + }, | ||
1707 | + | ||
1708 | + drawParallelGateway: function(x, y, width, height) { | ||
1709 | + this.g.setStart(); | ||
1710 | + | ||
1711 | + // rhombus | ||
1712 | + this.drawGateway(x, y, width, height); | ||
1713 | + | ||
1714 | + // plus inside rhombus | ||
1715 | + var originalStroke = this.getStroke(); | ||
1716 | + this.setStroke(GATEWAY_TYPE_STROKE); | ||
1717 | + | ||
1718 | + var plus = this.g.path( | ||
1719 | + "M" + (x + 10) + " " + (y + height / 2) + "L" + (x + width - 10) + " " + (y + height / 2) + // horizontal | ||
1720 | + "M" + (x + width / 2) + " " + (y + height - 10) + "L" + (x + width / 2) + " " + (y + 10) // vertical | ||
1721 | + ); | ||
1722 | + plus.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()}); | ||
1723 | + | ||
1724 | + this.setStroke(originalStroke); | ||
1725 | + | ||
1726 | + var set = this.g.setFinish(); | ||
1727 | + this.addHandlers(set, x, y, width, height, "gateway"); | ||
1728 | + }, | ||
1729 | + | ||
1730 | + drawExclusiveGateway: function(x, y, width, height) { | ||
1731 | + this.g.setStart(); | ||
1732 | + | ||
1733 | + // rhombus | ||
1734 | + var rhombus = this.drawGateway(x, y, width, height); | ||
1735 | + | ||
1736 | + var quarterWidth = width / 4; | ||
1737 | + var quarterHeight = height / 4; | ||
1738 | + | ||
1739 | + // X inside rhombus | ||
1740 | + var originalStroke = this.getStroke(); | ||
1741 | + this.setStroke(GATEWAY_TYPE_STROKE); | ||
1742 | + | ||
1743 | + var iks = this.g.path( | ||
1744 | + "M" + (x + quarterWidth + 3) + " " + (y + quarterHeight + 3) + "L" + (x + 3 * quarterWidth - 3) + " " + (y + 3 * quarterHeight - 3) + | ||
1745 | + "M" + (x + quarterWidth + 3) + " " + (y + 3 * quarterHeight - 3) + "L" + (x + 3 * quarterWidth - 3) + " " + (y + quarterHeight + 3) | ||
1746 | + ); | ||
1747 | + iks.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()}); | ||
1748 | + | ||
1749 | + this.setStroke(originalStroke); | ||
1750 | + | ||
1751 | + var set = this.g.setFinish(); | ||
1752 | + this.addHandlers(set, x, y, width, height, "gateway"); | ||
1753 | + }, | ||
1754 | + | ||
1755 | + drawInclusiveGateway: function(x, y, width, height){ | ||
1756 | + this.g.setStart(); | ||
1757 | + | ||
1758 | + // rhombus | ||
1759 | + this.drawGateway(x, y, width, height); | ||
1760 | + | ||
1761 | + var diameter = width / 4; | ||
1762 | + | ||
1763 | + // circle inside rhombus | ||
1764 | + var originalStroke = this.getStroke(); | ||
1765 | + this.setStroke(GATEWAY_TYPE_STROKE); | ||
1766 | + var circle = this.g.ellipse(width/2 + x, height/2 + y, diameter, diameter); | ||
1767 | + circle.attr({"stroke-width": this.getStroke(), "stroke": this.getPaint()}); | ||
1768 | + | ||
1769 | + this.setStroke(originalStroke); | ||
1770 | + | ||
1771 | + var set = this.g.setFinish(); | ||
1772 | + this.addHandlers(set, x, y, width, height, "gateway"); | ||
1773 | + }, | ||
1774 | + | ||
1775 | + drawEventBasedGateway: function(x, y, width, height){ | ||
1776 | + this.g.setStart(); | ||
1777 | + | ||
1778 | + // rhombus | ||
1779 | + this.drawGateway(x, y, width, height); | ||
1780 | + | ||
1781 | + var diameter = width / 2; | ||
1782 | + | ||
1783 | + // rombus inside rhombus | ||
1784 | + var originalStroke = this.getStroke(); | ||
1785 | + this.setStroke(GATEWAY_TYPE_STROKE); | ||
1786 | + | ||
1787 | + | ||
1788 | + // draw GeneralPath (polygon) | ||
1789 | + var n=5; | ||
1790 | + var angle = 2*Math.PI/n; | ||
1791 | + var x1Points = []; | ||
1792 | + var y1Points = []; | ||
1793 | + | ||
1794 | + for ( var index = 0; index < n; index++ ) { | ||
1795 | + var v = index*angle - Math.PI/2; | ||
1796 | + x1Points[index] = x + parseInt(Math.round(width/2)) + parseInt(Math.round((width/4)*Math.cos(v))); | ||
1797 | + y1Points[index] = y + parseInt(Math.round(height/2)) + parseInt(Math.round((height/4)*Math.sin(v))); | ||
1798 | + } | ||
1799 | + //g.drawPolygon(x1Points, y1Points, n); | ||
1800 | + | ||
1801 | + var path = ""; | ||
1802 | + for ( var index = 0; index < n; index++ ) { | ||
1803 | + if (index == 0) | ||
1804 | + path += "M"; | ||
1805 | + else | ||
1806 | + path += "L"; | ||
1807 | + path += x1Points[index] + "," + y1Points[index]; | ||
1808 | + } | ||
1809 | + path += "z"; | ||
1810 | + var polygone = this.g.path(path); | ||
1811 | + polygone.attr("stroke-width", this.strokeWidth); | ||
1812 | + polygone.attr("stroke", this.getPaint()); | ||
1813 | + | ||
1814 | + this.setStroke(originalStroke); | ||
1815 | + | ||
1816 | + var set = this.g.setFinish(); | ||
1817 | + this.addHandlers(set, x, y, width, height, "gateway"); | ||
1818 | + }, | ||
1819 | + | ||
1820 | + /* | ||
1821 | + * drawMultiInstanceMarker | ||
1822 | + * drawHighLight | ||
1823 | + * highLightFlow | ||
1824 | + */ | ||
1825 | + | ||
1826 | + drawMultiInstanceMarker: function(sequential, x, y, width, height) { | ||
1827 | + var rectangleWidth = MARKER_WIDTH; | ||
1828 | + var rectangleHeight = MARKER_WIDTH; | ||
1829 | + | ||
1830 | + // anti smoothing | ||
1831 | + if (this.strokeWidth%2 == 1) | ||
1832 | + x += .5;//, y += .5; | ||
1833 | + | ||
1834 | + var lineX = x + (width - rectangleWidth) / 2; | ||
1835 | + var lineY = y + height - rectangleHeight - 3; | ||
1836 | + | ||
1837 | + var originalStroke = this.getStroke(); | ||
1838 | + this.setStroke(MULTI_INSTANCE_STROKE); | ||
1839 | + | ||
1840 | + if (sequential) { | ||
1841 | + var line = this.g.path( | ||
1842 | + "M" + lineX + " " + lineY + "L" + (lineX + rectangleWidth) + " " + lineY + | ||
1843 | + "M" + lineX + " " + (lineY + rectangleHeight / 2) + "L" + (lineX + rectangleWidth) + " " + (lineY + rectangleHeight / 2) + | ||
1844 | + "M" + lineX + " " + (lineY + rectangleHeight) + "L" + (lineX + rectangleWidth) + " " + (lineY + rectangleHeight) | ||
1845 | + ).attr({"stroke-width": this.strokeWidth}); | ||
1846 | + } else { | ||
1847 | + var line = this.g.path( | ||
1848 | + "M" + lineX + " " + lineY + "L" + lineX + " " + (lineY + rectangleHeight) + | ||
1849 | + "M" + (lineX + rectangleWidth / 2) + " " + lineY + "L" + (lineX + rectangleWidth / 2) + " " + (lineY + rectangleHeight) + | ||
1850 | + "M" + (lineX + rectangleWidth) + " " + lineY + "L" + (lineX + rectangleWidth) + " " + (lineY + rectangleHeight) | ||
1851 | + ).attr({"stroke-width": this.strokeWidth}); | ||
1852 | + } | ||
1853 | + | ||
1854 | + this.setStroke(originalStroke); | ||
1855 | + }, | ||
1856 | + | ||
1857 | + drawHighLight: function(x, y, width, height){ | ||
1858 | + var originalPaint = this.getPaint(); | ||
1859 | + var originalStroke = this.getStroke(); | ||
1860 | + | ||
1861 | + this.setPaint(HIGHLIGHT_COLOR); | ||
1862 | + this.setStroke(THICK_TASK_BORDER_STROKE); | ||
1863 | + | ||
1864 | + //var c = this.g.rect(x - width/2 - THICK_TASK_BORDER_STROKE, y - height/2 - THICK_TASK_BORDER_STROKE, width + THICK_TASK_BORDER_STROKE*2, height + THICK_TASK_BORDER_STROKE*2, 5); | ||
1865 | + var rect = this.g.rect(x - THICK_TASK_BORDER_STROKE, y - THICK_TASK_BORDER_STROKE, width + THICK_TASK_BORDER_STROKE*2, height + THICK_TASK_BORDER_STROKE*2, TASK_CORNER_ROUND); | ||
1866 | + rect.attr("stroke-width", this.strokeWidth); | ||
1867 | + rect.attr("stroke", this.getPaint()); | ||
1868 | + | ||
1869 | + this.setPaint(originalPaint); | ||
1870 | + this.setStroke(originalStroke); | ||
1871 | + }, | ||
1872 | + | ||
1873 | + highLightActivity: function(activityId){ | ||
1874 | + var shape = this.g.getById(activityId); | ||
1875 | + if (!shape) { | ||
1876 | + console.error("Activity " + activityId + " not found"); | ||
1877 | + return; | ||
1878 | + } | ||
1879 | + | ||
1880 | + var contextObject = shape.data("contextObject"); | ||
1881 | + if (contextObject) | ||
1882 | + console.log("--> highLightActivity: ["+contextObject.getProperty("type")+"], activityId: " + contextObject.getId()); | ||
1883 | + else | ||
1884 | + console.log("--> highLightActivity: ", shape, shape.data("contextObject")); | ||
1885 | + | ||
1886 | + shape.attr("stroke-width", THICK_TASK_BORDER_STROKE); | ||
1887 | + shape.attr("stroke", HIGHLIGHT_COLOR); | ||
1888 | + }, | ||
1889 | + | ||
1890 | + highLightFlow: function(flowId){ | ||
1891 | + var shapeFlow = this.g.getById(flowId); | ||
1892 | + if (!shapeFlow) { | ||
1893 | + console.error("Flow " + flowId + " not found"); | ||
1894 | + return; | ||
1895 | + } | ||
1896 | + | ||
1897 | + var contextObject = shapeFlow.data("contextObject"); | ||
1898 | + if (contextObject) | ||
1899 | + console.log("--> highLightFlow: ["+contextObject.id+"] " + contextObject.flow); | ||
1900 | + //console.log("--> highLightFlow: ", flow.flow, flow.data("set")); | ||
1901 | + | ||
1902 | + var st = shapeFlow.data("set"); | ||
1903 | + | ||
1904 | + st.attr("stroke-width", SEQUENCEFLOW_HIGHLIGHT_STROKE); | ||
1905 | + st.attr("stroke", HIGHLIGHT_COLOR); | ||
1906 | + var withArrowHead = shapeFlow.data("withArrowHead"); | ||
1907 | + if (withArrowHead) | ||
1908 | + st[1].attr("fill", HIGHLIGHT_COLOR); | ||
1909 | + | ||
1910 | + st.forEach(function(el){ | ||
1911 | + //console.log("---->", el); | ||
1912 | + //el.attr("") | ||
1913 | + }); | ||
1914 | + }, | ||
1915 | + | ||
1916 | + | ||
1917 | + _drawClock: function(cx, cy, width, height){ | ||
1918 | + | ||
1919 | + var circle = this.g.ellipse(cx, cy, 1, 1).attr({stroke:"none", fill: Color.get(232, 239, 241)}); | ||
1920 | + //var c = this.g.ellipse(cx, cy, width, height).attr({stroke:"none", fill: Color.red}); | ||
1921 | + //x = cx - width/2; | ||
1922 | + //y = cy - height/2; | ||
1923 | + | ||
1924 | + var clock = this.g.path( | ||
1925 | + /* outer circle */ "M15.5,2.374 C8.251,2.375,2.376,8.251,2.374,15.5 C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374z" + | ||
1926 | + /* inner circle */ "M15.5,26.623 C8.909,26.615,4.385,22.09,4.375,15.5 C4.385,8.909,8.909,4.384,15.5,4.374c4.59,0.01,11.115,3.535,11.124,11.125C26.615,22.09,22.091,26.615,15.5,26.623z" + | ||
1927 | + /* 9 */ "M8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5z" + | ||
1928 | + /* 8 */ "M8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572z" + | ||
1929 | + /* 10 */ "M9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696z" + | ||
1930 | + /* 2 */ "M22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428z" + | ||
1931 | + /* 7 */ "M12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455z" + | ||
1932 | + /* 11 */ "M12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545z" + | ||
1933 | + /* 4 */ "M22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572z" + | ||
1934 | + /* 2 */ "M19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813z" + | ||
1935 | + /* 3 */ "M23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5z" + | ||
1936 | + /* arrows */ "M15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624z" + | ||
1937 | + /* 9 */ "M15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377z" + | ||
1938 | + /* 8 */ "M18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z" + | ||
1939 | + ""); | ||
1940 | + clock.attr({fill: Color.black, stroke: "none"}); | ||
1941 | + //clock.transform("t " + (cx-29.75/2) + " " + (cy-29.75/2)); | ||
1942 | + //clock.transform("...s 0.85"); | ||
1943 | + | ||
1944 | + //clock.transform("...s " + .85 + " " + .85); | ||
1945 | + clock.transform("t " + (-2.374) + " " + (-2.374) ); | ||
1946 | + clock.transform("...t -" + (15.5-2.374) + " -" + (15.5-2.374) ); | ||
1947 | + clock.transform("...s " + 1*(width/35) + " " + 1*(height/35)); | ||
1948 | + clock.transform("...T " + cx + " " + cy); | ||
1949 | + //clock.transform("t " + (cx-width/2) + " " + (cy-height/2)); | ||
1950 | + | ||
1951 | + //console.log(".getBBox(): ", clock.getBBox()); | ||
1952 | + //console.log(".attr(): ", c.attrs); | ||
1953 | + circle.attr("rx", clock.getBBox().width/2); | ||
1954 | + circle.attr("ry", clock.getBBox().height/2); | ||
1955 | + | ||
1956 | + //return circle | ||
1957 | + }, | ||
1958 | + | ||
1959 | + _drawPentagon: function(cx, cy, width, height, filled){ | ||
1960 | + // draw GeneralPath (polygon) | ||
1961 | + var n=5; | ||
1962 | + var angle = 2*Math.PI/n; | ||
1963 | + var waypoints = []; | ||
1964 | + | ||
1965 | + for ( var index = 0; index < n; index++ ) { | ||
1966 | + var v = index*angle - Math.PI/2; | ||
1967 | + var point = {}; | ||
1968 | + point.x = -width*1.2/2 + parseInt(Math.round(width*1.2/2)) + parseInt(Math.round((width*1.2/4)*Math.cos(v))); | ||
1969 | + point.y = -height*1.2/2 + parseInt(Math.round(height*1.2/2)) + parseInt(Math.round((height*1.2/4)*Math.sin(v))); | ||
1970 | + waypoints[index] = point; | ||
1971 | + } | ||
1972 | + | ||
1973 | + var polygone = new Polygone(waypoints, this.getStroke()); | ||
1974 | + polygone.element = this.g.path(polygone.path); | ||
1975 | + if (filled) | ||
1976 | + polygone.element.attr("fill", Color.black); | ||
1977 | + else | ||
1978 | + polygone.element.attr("fill", Color.white); | ||
1979 | + | ||
1980 | + polygone.element.transform("s " + 1*(width/35) + " " + 1*(height/35)); | ||
1981 | + polygone.element.transform("...T " + cx + " " + cy); | ||
1982 | + }, | ||
1983 | + | ||
1984 | + //_drawMultilineText: function(text, x, y, boxWidth, boxHeight, textAnchor) { | ||
1985 | + _drawMultilineText: function(text, x, y, boxWidth, boxHeight, verticalAlign, horizontalAlign) { | ||
1986 | + if (!text || text == "") | ||
1987 | + return; | ||
1988 | + | ||
1989 | + // Autostretch boxHeight if boxHeight is 0 | ||
1990 | + if (boxHeight == 0) | ||
1991 | + verticalAlign = MULTILINE_VERTICAL_ALIGN_TOP; | ||
1992 | + | ||
1993 | + //var TEXT_PADDING = 3; | ||
1994 | + var width = boxWidth; | ||
1995 | + if (boxHeight) | ||
1996 | + var height = boxHeight; | ||
1997 | + | ||
1998 | + var layouts = []; | ||
1999 | + | ||
2000 | + //var font = {font: "11px Arial", opacity: 1, "fill": LABEL_COLOR}; | ||
2001 | + var font = this.getFont(); | ||
2002 | + var measurer = new LineBreakMeasurer(this.g, x, y, text, font); | ||
2003 | + var lineHeight = measurer.rafaelTextObject.getBBox().height; | ||
2004 | + //console.log("text: ", text.replace(/\n/g, "?")); | ||
2005 | + | ||
2006 | + if (height) { | ||
2007 | + var availableLinesCount = parseInt(height/lineHeight); | ||
2008 | + //console.log("availableLinesCount: " + availableLinesCount); | ||
2009 | + } | ||
2010 | + | ||
2011 | + var i = 1; | ||
2012 | + while (measurer.getPosition() < measurer.text.getEndIndex()) { | ||
2013 | + var layout = measurer.nextLayout(width); | ||
2014 | + //console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition()); | ||
2015 | + | ||
2016 | + if (layout != null) { | ||
2017 | + // TODO: and check if measurer has next layout. If no then don't draw dots | ||
2018 | + if (!availableLinesCount || i < availableLinesCount) { | ||
2019 | + layouts.push(layout); | ||
2020 | + } else { | ||
2021 | + layouts.push(this.fitTextToWidth(layout + "...", boxWidth)); | ||
2022 | + break; | ||
2023 | + } | ||
2024 | + } | ||
2025 | + i++; | ||
2026 | + }; | ||
2027 | + //console.log(layouts); | ||
2028 | + | ||
2029 | + measurer.rafaelTextObject.attr({"text": layouts.join("\n")}); | ||
2030 | + | ||
2031 | + if (horizontalAlign) | ||
2032 | + measurer.rafaelTextObject.attr({"text-anchor": horizontalAlign}); // end, middle, start | ||
2033 | + | ||
2034 | + var bb = measurer.rafaelTextObject.getBBox(); | ||
2035 | + // TODO: there is somethin wrong with wertical align. May be: measurer.rafaelTextObject.attr({"y": y + height/2 - bb.height/2}) | ||
2036 | + measurer.rafaelTextObject.attr({"y": y + bb.height/2}); | ||
2037 | + //var bb = measurer.rafaelTextObject.getBBox(); | ||
2038 | + | ||
2039 | + if (measurer.rafaelTextObject.attr("text-anchor") == MULTILINE_HORIZONTAL_ALIGN_MIDDLE ) | ||
2040 | + measurer.rafaelTextObject.attr("x", x + boxWidth/2); | ||
2041 | + else if (measurer.rafaelTextObject.attr("text-anchor") == MULTILINE_HORIZONTAL_ALIGN_RIGHT ) | ||
2042 | + measurer.rafaelTextObject.attr("x", x + boxWidth); | ||
2043 | + | ||
2044 | + var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "}; | ||
2045 | + //var box = this.g.rect(x+.5, y + .5, width, height).attr(boxStyle); | ||
2046 | + var textAreaCX = x + boxWidth/2; | ||
2047 | + var height = boxHeight; | ||
2048 | + if (!height) height = bb.height; | ||
2049 | + var textAreaCY = y + height/2; | ||
2050 | + var dotLeftTop = this.g.ellipse(x, y, 3, 3).attr({"stroke-width": 0, fill: Color.LightSteelBlue, stroke: "none"}).hide(); | ||
2051 | + var dotCenter = this.g.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"}).hide(); | ||
2052 | + | ||
2053 | + /* | ||
2054 | + // real bbox | ||
2055 | + var bb = measurer.rafaelTextObject.getBBox(); | ||
2056 | + var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1}); | ||
2057 | + */ | ||
2058 | + var rect = this.g.rect(x, y, boxWidth, height).attr({"stroke-width": 1}).attr(boxStyle).hide(); | ||
2059 | + var debugSet = this.g.set(); | ||
2060 | + debugSet.push(dotLeftTop, dotCenter, rect); | ||
2061 | + //debugSet.show(); | ||
2062 | + }, | ||
2063 | + | ||
2064 | + drawTextAnnotation: function(text, x, y, width, height){ | ||
2065 | + var lineLength = 18; | ||
2066 | + var path = []; | ||
2067 | + path.push(["M", x + lineLength, y]); | ||
2068 | + path.push(["L", x, y]); | ||
2069 | + path.push(["L", x, y + height]); | ||
2070 | + path.push(["L", x + lineLength, y + height]); | ||
2071 | + | ||
2072 | + path.push(["L", x + lineLength, y + height -1]); | ||
2073 | + path.push(["L", x + 1, y + height -1]); | ||
2074 | + path.push(["L", x + 1, y + 1]); | ||
2075 | + path.push(["L", x + lineLength, y + 1]); | ||
2076 | + path.push(["z"]); | ||
2077 | + | ||
2078 | + var textAreaLines = this.g.path(path); | ||
2079 | + | ||
2080 | + var boxWidth = width - (2 * ANNOTATION_TEXT_PADDING); | ||
2081 | + var boxHeight = height - (2 * ANNOTATION_TEXT_PADDING); | ||
2082 | + var boxX = x + width/2 - boxWidth/2; | ||
2083 | + var boxY = y + height/2 - boxHeight/2; | ||
2084 | + | ||
2085 | + // for debug | ||
2086 | + var rectStyle = {stroke: Color(112, 146, 190), "stroke-width": 1.0, "stroke-dasharray": "- "}; | ||
2087 | + var r = this.g.rect(boxX, boxY, boxWidth, boxHeight).attr(rectStyle); | ||
2088 | + // | ||
2089 | + | ||
2090 | + this.drawAnnotationText(text, boxX, boxY, boxWidth, boxHeight); | ||
2091 | + }, | ||
2092 | + | ||
2093 | + drawLabel111111111: function(text, x, y, width, height, labelAttrs){ | ||
2094 | + var debug = false; | ||
2095 | + | ||
2096 | + // text | ||
2097 | + if (text != null && text != undefined && text != "") { | ||
2098 | + var attr = LABEL_FONT; | ||
2099 | + | ||
2100 | + //console.log("x", x, "y", y, "width", width, "height", height ); | ||
2101 | + | ||
2102 | + wrappedText = text; | ||
2103 | + if (labelAttrs && labelAttrs.wrapWidth) { | ||
2104 | + wrappedText = this.wrapTextToWidth(wrappedText, labelAttrs.wrapWidth); | ||
2105 | + } | ||
2106 | + var realWidth = this.getStringWidth(wrappedText, attr); | ||
2107 | + var realHeight = this.getStringHeight(wrappedText, attr); | ||
2108 | + | ||
2109 | + var textAreaCX = x + width/2; | ||
2110 | + var textAreaCY = y + 3 + height + this.getStringHeight(wrappedText, attr)/2; | ||
2111 | + | ||
2112 | + var textX = textAreaCX; | ||
2113 | + var textY = textAreaCY; | ||
2114 | + | ||
2115 | + var textAttrs = {}; | ||
2116 | + if (labelAttrs && labelAttrs.align) { | ||
2117 | + switch (labelAttrs.align) { | ||
2118 | + case "left": | ||
2119 | + textAttrs["text-anchor"] = "start"; | ||
2120 | + textX = textX - realWidth/2; | ||
2121 | + break; | ||
2122 | + case "center": | ||
2123 | + textAttrs["text-anchor"] = "middle"; | ||
2124 | + break; | ||
2125 | + case "right": | ||
2126 | + textAttrs["text-anchor"] = "end"; | ||
2127 | + textX = textX + realWidth/2; | ||
2128 | + break; | ||
2129 | + } | ||
2130 | + } | ||
2131 | + if (labelAttrs && labelAttrs.wrapWidth) { | ||
2132 | + if (true) { | ||
2133 | + // Draw frameborder | ||
2134 | + var textAreaStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "}; | ||
2135 | + var textAreaX = textAreaCX - realWidth/2; | ||
2136 | + var textAreaY = textAreaCY+.5 - realHeight/2; | ||
2137 | + var textArea = this.g.rect(textAreaX, textAreaY, realWidth, realHeight).attr(textAreaStyle); | ||
2138 | + | ||
2139 | + var textAreaLines = this.g.path("M" + textAreaX + " " + textAreaY + "L" + (textAreaX+realWidth) + " " + (textAreaY+realHeight) + "M" + + (textAreaX+realWidth) + " " + textAreaY + "L" + textAreaX + " " + (textAreaY+realHeight)); | ||
2140 | + textAreaLines.attr(textAreaStyle); | ||
2141 | + | ||
2142 | + this.g.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"}); | ||
2143 | + } | ||
2144 | + } | ||
2145 | + | ||
2146 | + var label = this.g.text(textX, textY, wrappedText).attr(attr).attr(textAttrs); | ||
2147 | + //label.id = Raphael.createUUID(); | ||
2148 | + //console.log("label ", label.id, ", ", wrappedText); | ||
2149 | + | ||
2150 | + if (this.fontSmoothing) { | ||
2151 | + label.attr({stroke: LABEL_COLOR, "stroke-width":.4}); | ||
2152 | + } | ||
2153 | + | ||
2154 | + // debug | ||
2155 | + if (debug) { | ||
2156 | + var imageAreaStyle = {stroke: Color.grey61, "stroke-width": 1.0, "stroke-dasharray": "- "}; | ||
2157 | + var imageArea = this.g.rect(x+.5, y+.5, width, height).attr(imageAreaStyle); | ||
2158 | + var imageAreaLines = this.g.path("M" + x + " " + y + "L" + (x+width) + " " + (y+height) + "M" + + (x+width) + " " + y + "L" + x + " " + (y+height)); | ||
2159 | + imageAreaLines.attr(imageAreaStyle); | ||
2160 | + var dotStyle = {fill: Color.Coral, stroke: "none"}; | ||
2161 | + this.g.ellipse(x, y, 3, 3).attr(dotStyle); | ||
2162 | + this.g.ellipse(x+width, y, 2, 2).attr(dotStyle); | ||
2163 | + this.g.ellipse(x+width, y+height, 2, 2).attr(dotStyle); | ||
2164 | + this.g.ellipse(x, y+height, 2, 2).attr(dotStyle); | ||
2165 | + } | ||
2166 | + | ||
2167 | + return label; | ||
2168 | + } | ||
2169 | + }, | ||
2170 | + | ||
2171 | + vvoid: function(){} | ||
2172 | +}; |
1 | + /** | ||
2 | + * Class to generate an image based the diagram interchange information in a | ||
3 | + * BPMN 2.0 process. | ||
4 | + * | ||
5 | + * @author (Javascript) Dmitry Farafonov | ||
6 | + */ | ||
7 | + | ||
8 | +var ProcessDiagramGenerator = { | ||
9 | + options: {}, | ||
10 | + | ||
11 | + processDiagramCanvas: [], | ||
12 | + | ||
13 | + activityDrawInstructions:{}, | ||
14 | + | ||
15 | + processDiagrams: {}, | ||
16 | + | ||
17 | + diagramBreadCrumbs: null, | ||
18 | + | ||
19 | + init: function(){ | ||
20 | + // start event | ||
21 | + this.activityDrawInstructions["startEvent"] = function(){ | ||
22 | + var activityImpl = this.activity; | ||
23 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
24 | + processDiagramCanvas.setConextObject(activityImpl); | ||
25 | + | ||
26 | + processDiagramCanvas.drawNoneStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
27 | + }; | ||
28 | + | ||
29 | + // start timer event | ||
30 | + this.activityDrawInstructions["startTimerEvent"] = function(){ | ||
31 | + var activityImpl = this.activity; | ||
32 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
33 | + processDiagramCanvas.setConextObject(activityImpl); | ||
34 | + | ||
35 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
36 | + processDiagramCanvas.drawTimerStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name")); | ||
37 | + }; | ||
38 | + | ||
39 | + // start event | ||
40 | + this.activityDrawInstructions["messageStartEvent"] = function(){ | ||
41 | + var activityImpl = this.activity; | ||
42 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
43 | + processDiagramCanvas.setConextObject(activityImpl); | ||
44 | + | ||
45 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
46 | + processDiagramCanvas.drawMessageStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name")); | ||
47 | + }; | ||
48 | + | ||
49 | + // start signal event | ||
50 | + this.activityDrawInstructions["startSignalEvent"] = function(){ | ||
51 | + var activityImpl = this.activity; | ||
52 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
53 | + processDiagramCanvas.setConextObject(activityImpl); | ||
54 | + | ||
55 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
56 | + processDiagramCanvas.drawSignalStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name")); | ||
57 | + }; | ||
58 | + | ||
59 | + // start multiple event | ||
60 | + this.activityDrawInstructions["startMultipleEvent"] = function(){ | ||
61 | + var activityImpl = this.activity; | ||
62 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
63 | + processDiagramCanvas.setConextObject(activityImpl); | ||
64 | + | ||
65 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
66 | + processDiagramCanvas.drawMultipleStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name")); | ||
67 | + }; | ||
68 | + | ||
69 | + // signal catch | ||
70 | + this.activityDrawInstructions["intermediateSignalCatch"] = function(){ | ||
71 | + var activityImpl = this.activity; | ||
72 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
73 | + processDiagramCanvas.setConextObject(activityImpl); | ||
74 | + | ||
75 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
76 | + processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
77 | + | ||
78 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
79 | + if (label) | ||
80 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
81 | + }; | ||
82 | + | ||
83 | + // message catch | ||
84 | + this.activityDrawInstructions["intermediateMessageCatch"] = function(){ | ||
85 | + var activityImpl = this.activity; | ||
86 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
87 | + processDiagramCanvas.setConextObject(activityImpl); | ||
88 | + | ||
89 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
90 | + processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
91 | + | ||
92 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
93 | + if (label) | ||
94 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
95 | + }; | ||
96 | + | ||
97 | + // multiple catch | ||
98 | + this.activityDrawInstructions["intermediateMultipleCatch"] = function(){ | ||
99 | + var activityImpl = this.activity; | ||
100 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
101 | + processDiagramCanvas.setConextObject(activityImpl); | ||
102 | + | ||
103 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
104 | + processDiagramCanvas.drawCatchingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
105 | + | ||
106 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
107 | + if (label) | ||
108 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
109 | + }; | ||
110 | + | ||
111 | + | ||
112 | + | ||
113 | + // signal throw | ||
114 | + this.activityDrawInstructions["intermediateSignalThrow"] = function(){ | ||
115 | + var activityImpl = this.activity; | ||
116 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
117 | + processDiagramCanvas.setConextObject(activityImpl); | ||
118 | + | ||
119 | + processDiagramCanvas.drawThrowingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name")); | ||
120 | + | ||
121 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
122 | + if (label) | ||
123 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
124 | + }; | ||
125 | + | ||
126 | + // message throw | ||
127 | + this.activityDrawInstructions["intermediateMessageThrow"] = function(){ | ||
128 | + var activityImpl = this.activity; | ||
129 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
130 | + processDiagramCanvas.setConextObject(activityImpl); | ||
131 | + | ||
132 | + processDiagramCanvas.drawThrowingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name")); | ||
133 | + | ||
134 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
135 | + if (label) | ||
136 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
137 | + }; | ||
138 | + | ||
139 | + // multiple throw | ||
140 | + this.activityDrawInstructions["intermediateMultipleThrow"] = function(){ | ||
141 | + var activityImpl = this.activity; | ||
142 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
143 | + processDiagramCanvas.setConextObject(activityImpl); | ||
144 | + | ||
145 | + processDiagramCanvas.drawThrowingMultipleEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name")); | ||
146 | + | ||
147 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
148 | + if (label) | ||
149 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
150 | + }; | ||
151 | + | ||
152 | + // none throw | ||
153 | + this.activityDrawInstructions["intermediateThrowEvent"] = function() { | ||
154 | + var activityImpl = this.activity; | ||
155 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
156 | + processDiagramCanvas.setConextObject(activityImpl); | ||
157 | + | ||
158 | + processDiagramCanvas.drawThrowingNoneEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name")); | ||
159 | + | ||
160 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
161 | + if (label) | ||
162 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
163 | + }; | ||
164 | + | ||
165 | + // end event | ||
166 | + this.activityDrawInstructions["endEvent"] = function(){ | ||
167 | + var activityImpl = this.activity; | ||
168 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
169 | + processDiagramCanvas.setConextObject(activityImpl); | ||
170 | + | ||
171 | + processDiagramCanvas.drawNoneEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
172 | + }; | ||
173 | + | ||
174 | + // error end event | ||
175 | + this.activityDrawInstructions["errorEndEvent"] = function(){ | ||
176 | + var activityImpl = this.activity; | ||
177 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
178 | + processDiagramCanvas.setConextObject(activityImpl); | ||
179 | + | ||
180 | + processDiagramCanvas.drawErrorEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null); | ||
181 | + | ||
182 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
183 | + if (label) | ||
184 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
185 | + }; | ||
186 | + | ||
187 | + // message end event | ||
188 | + this.activityDrawInstructions["messageEndEvent"] = function(){ | ||
189 | + var activityImpl = this.activity; | ||
190 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
191 | + processDiagramCanvas.setConextObject(activityImpl); | ||
192 | + | ||
193 | + processDiagramCanvas.drawMessageEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null); | ||
194 | + | ||
195 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
196 | + if (label) | ||
197 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
198 | + }; | ||
199 | + | ||
200 | + // signal end event | ||
201 | + this.activityDrawInstructions["signalEndEvent"] = function(){ | ||
202 | + var activityImpl = this.activity; | ||
203 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
204 | + processDiagramCanvas.setConextObject(activityImpl); | ||
205 | + | ||
206 | + processDiagramCanvas.drawSignalEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null); | ||
207 | + | ||
208 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
209 | + if (label) | ||
210 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
211 | + }; | ||
212 | + | ||
213 | + // multiple end event | ||
214 | + this.activityDrawInstructions["multipleEndEvent"] = function(){ | ||
215 | + var activityImpl = this.activity; | ||
216 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
217 | + processDiagramCanvas.setConextObject(activityImpl); | ||
218 | + | ||
219 | + processDiagramCanvas.drawMultipleEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), null); | ||
220 | + | ||
221 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
222 | + if (label) | ||
223 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
224 | + }; | ||
225 | + | ||
226 | + // terminate end event | ||
227 | + this.activityDrawInstructions["terminateEndEvent"] = function(){ | ||
228 | + var activityImpl = this.activity; | ||
229 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
230 | + processDiagramCanvas.setConextObject(activityImpl); | ||
231 | + | ||
232 | + processDiagramCanvas.drawTerminateEndEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
233 | + | ||
234 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
235 | + if (label) | ||
236 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
237 | + }; | ||
238 | + | ||
239 | + // error start event | ||
240 | + this.activityDrawInstructions["errorStartEvent"] = function(){ | ||
241 | + var activityImpl = this.activity; | ||
242 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
243 | + processDiagramCanvas.setConextObject(activityImpl); | ||
244 | + | ||
245 | + processDiagramCanvas.drawErrorStartEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), activityImpl.getProperty("name")); | ||
246 | + | ||
247 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
248 | + if (label) | ||
249 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
250 | + }; | ||
251 | + | ||
252 | + // task | ||
253 | + this.activityDrawInstructions["task"] = function(){ | ||
254 | + var activityImpl = this.activity; | ||
255 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
256 | + processDiagramCanvas.setConextObject(activityImpl); | ||
257 | + | ||
258 | + // TODO: | ||
259 | + //console.error("task is not implemented yet"); | ||
260 | + /* | ||
261 | + var activityImpl = this; | ||
262 | + processDiagramCanvas.drawTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), thickBorder); | ||
263 | + */ | ||
264 | + }; | ||
265 | + | ||
266 | + | ||
267 | + // user task | ||
268 | + this.activityDrawInstructions["userTask"] = function(){ | ||
269 | + var activityImpl = this.activity; | ||
270 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
271 | + processDiagramCanvas.setConextObject(activityImpl); | ||
272 | + | ||
273 | + processDiagramCanvas.drawUserTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
274 | + }; | ||
275 | + | ||
276 | + // script task | ||
277 | + this.activityDrawInstructions["scriptTask"] = function(){ | ||
278 | + var activityImpl = this.activity; | ||
279 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
280 | + processDiagramCanvas.setConextObject(activityImpl); | ||
281 | + | ||
282 | + processDiagramCanvas.drawScriptTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
283 | + }; | ||
284 | + | ||
285 | + // service task | ||
286 | + this.activityDrawInstructions["serviceTask"] = function(){ | ||
287 | + var activityImpl = this.activity; | ||
288 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
289 | + processDiagramCanvas.setConextObject(activityImpl); | ||
290 | + | ||
291 | + processDiagramCanvas.drawServiceTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
292 | + }; | ||
293 | + | ||
294 | + // receive task | ||
295 | + this.activityDrawInstructions["receiveTask"] = function(){ | ||
296 | + var activityImpl = this.activity; | ||
297 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
298 | + processDiagramCanvas.setConextObject(activityImpl); | ||
299 | + | ||
300 | + processDiagramCanvas.drawReceiveTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
301 | + }; | ||
302 | + | ||
303 | + // send task | ||
304 | + this.activityDrawInstructions["sendTask"] = function(){ | ||
305 | + var activityImpl = this.activity; | ||
306 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
307 | + processDiagramCanvas.setConextObject(activityImpl); | ||
308 | + | ||
309 | + processDiagramCanvas.drawSendTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
310 | + }; | ||
311 | + | ||
312 | + // manual task | ||
313 | + this.activityDrawInstructions["manualTask"] = function(){ | ||
314 | + var activityImpl = this.activity; | ||
315 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
316 | + processDiagramCanvas.setConextObject(activityImpl); | ||
317 | + | ||
318 | + processDiagramCanvas.drawManualTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
319 | + }; | ||
320 | + | ||
321 | + // businessRuleTask task | ||
322 | + this.activityDrawInstructions["businessRuleTask"] = function(){ | ||
323 | + var activityImpl = this.activity; | ||
324 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
325 | + processDiagramCanvas.setConextObject(activityImpl); | ||
326 | + | ||
327 | + processDiagramCanvas.drawBusinessRuleTask(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
328 | + }; | ||
329 | + | ||
330 | + // exclusive gateway | ||
331 | + this.activityDrawInstructions["exclusiveGateway"] = function(){ | ||
332 | + var activityImpl = this.activity; | ||
333 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
334 | + processDiagramCanvas.setConextObject(activityImpl); | ||
335 | + | ||
336 | + processDiagramCanvas.drawExclusiveGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
337 | + }; | ||
338 | + | ||
339 | + // inclusive gateway | ||
340 | + this.activityDrawInstructions["inclusiveGateway"] = function(){ | ||
341 | + var activityImpl = this.activity; | ||
342 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
343 | + processDiagramCanvas.setConextObject(activityImpl); | ||
344 | + | ||
345 | + processDiagramCanvas.drawInclusiveGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
346 | + }; | ||
347 | + | ||
348 | + // parallel gateway | ||
349 | + this.activityDrawInstructions["parallelGateway"] = function(){ | ||
350 | + var activityImpl = this.activity; | ||
351 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
352 | + processDiagramCanvas.setConextObject(activityImpl); | ||
353 | + | ||
354 | + processDiagramCanvas.drawParallelGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
355 | + }; | ||
356 | + | ||
357 | + // eventBasedGateway | ||
358 | + this.activityDrawInstructions["eventBasedGateway"] = function(){ | ||
359 | + var activityImpl = this.activity; | ||
360 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
361 | + processDiagramCanvas.setConextObject(activityImpl); | ||
362 | + | ||
363 | + processDiagramCanvas.drawEventBasedGateway(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
364 | + }; | ||
365 | + | ||
366 | + // Boundary timer | ||
367 | + this.activityDrawInstructions["boundaryTimer"] = function(){ | ||
368 | + var activityImpl = this.activity; | ||
369 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
370 | + processDiagramCanvas.setConextObject(activityImpl); | ||
371 | + | ||
372 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
373 | + processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
374 | + | ||
375 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
376 | + if (label) | ||
377 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
378 | + }; | ||
379 | + | ||
380 | + // Boundary catch error | ||
381 | + this.activityDrawInstructions["boundaryError"] = function(){ | ||
382 | + var activityImpl = this.activity; | ||
383 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
384 | + processDiagramCanvas.setConextObject(activityImpl); | ||
385 | + | ||
386 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
387 | + processDiagramCanvas.drawCatchingErrorEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
388 | + | ||
389 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
390 | + if (label) | ||
391 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
392 | + }; | ||
393 | + | ||
394 | + // Boundary signal event | ||
395 | + this.activityDrawInstructions["boundarySignal"] = function(){ | ||
396 | + var activityImpl = this.activity; | ||
397 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
398 | + processDiagramCanvas.setConextObject(activityImpl); | ||
399 | + | ||
400 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
401 | + processDiagramCanvas.drawCatchingSignalEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
402 | + | ||
403 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
404 | + if (label) | ||
405 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
406 | + }; | ||
407 | + | ||
408 | + // Boundary message event | ||
409 | + this.activityDrawInstructions["boundaryMessage"] = function(){ | ||
410 | + var activityImpl = this.activity; | ||
411 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
412 | + processDiagramCanvas.setConextObject(activityImpl); | ||
413 | + | ||
414 | + var isInterrupting = activityImpl.getProperty("isInterrupting"); | ||
415 | + processDiagramCanvas.drawCatchingMessageEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, null); | ||
416 | + | ||
417 | + var label = ProcessDiagramGenerator.getActivitiLabel(activityImpl); | ||
418 | + if (label) | ||
419 | + processDiagramCanvas.drawLabel(label.text, label.x, label.y, label.width, label.height); | ||
420 | + }; | ||
421 | + | ||
422 | + // timer catch event | ||
423 | + this.activityDrawInstructions["intermediateTimer"] = function(){ | ||
424 | + var activityImpl = this.activity; | ||
425 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
426 | + processDiagramCanvas.setConextObject(activityImpl); | ||
427 | + | ||
428 | + var isInterrupting = null; | ||
429 | + processDiagramCanvas.drawCatchingTimerEvent(activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight(), isInterrupting, activityImpl.getProperty("name")); | ||
430 | + }; | ||
431 | + | ||
432 | + // subprocess | ||
433 | + this.activityDrawInstructions["subProcess"] = function(){ | ||
434 | + var activityImpl = this.activity; | ||
435 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
436 | + // TODO: | ||
437 | + | ||
438 | + processDiagramCanvas.setConextObject(activityImpl); | ||
439 | + | ||
440 | + var isExpanded = activityImpl.getProperty("isExpanded"); | ||
441 | + var isTriggeredByEvent = activityImpl.getProperty("triggeredByEvent"); | ||
442 | + if(isTriggeredByEvent == undefined) { | ||
443 | + isTriggeredByEvent = true; | ||
444 | + } | ||
445 | + // TODO: check why isTriggeredByEvent = true when undefined | ||
446 | + isTriggeredByEvent = false; | ||
447 | + | ||
448 | + if (isExpanded != undefined && isExpanded == false) { | ||
449 | + processDiagramCanvas.drawCollapsedSubProcess(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), | ||
450 | + activityImpl.getWidth(), activityImpl.getHeight(), isTriggeredByEvent); | ||
451 | + } else { | ||
452 | + processDiagramCanvas.drawExpandedSubProcess(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), | ||
453 | + activityImpl.getWidth(), activityImpl.getHeight(), isTriggeredByEvent); | ||
454 | + } | ||
455 | + | ||
456 | + //console.error("subProcess is not implemented yet"); | ||
457 | + }; | ||
458 | + | ||
459 | + // call activity | ||
460 | + this.activityDrawInstructions["callActivity"] = function(){ | ||
461 | + var activityImpl = this.activity; | ||
462 | + var processDiagramCanvas = this.processDiagramCanvas; | ||
463 | + processDiagramCanvas.setConextObject(activityImpl); | ||
464 | + processDiagramCanvas.drawCollapsedCallActivity(activityImpl.getProperty("name"), activityImpl.getX(), activityImpl.getY(), activityImpl.getWidth(), activityImpl.getHeight()); | ||
465 | + }; | ||
466 | + | ||
467 | + $(document).ready(function(){ | ||
468 | + // Protect right click on SVG elements (and on canvas too) | ||
469 | + document.body.oncontextmenu = function(event) { | ||
470 | + if (window.event.srcElement.tagName == "shape" || window.event.srcElement.tagName == "DIV" && window.event.srcElement.parentElement.className == "diagram") { | ||
471 | + | ||
472 | + // IE DIAGRAM CANVAS OR SHAPE DETECTED! | ||
473 | + return false; | ||
474 | + } | ||
475 | + return (!Object.isSVGElement(window.event.srcElement)); | ||
476 | + }; | ||
477 | + }); | ||
478 | + }, | ||
479 | + | ||
480 | + getActivitiLabel:function(activityImpl){ | ||
481 | + /* | ||
482 | + TODO: Label object should be in activityImpl and looks like: | ||
483 | + { | ||
484 | + x: 250, | ||
485 | + y: 250, | ||
486 | + width: 80, | ||
487 | + height: 30 | ||
488 | + } | ||
489 | + And then: | ||
490 | + if (!activityImpl.label) | ||
491 | + return null; | ||
492 | + var label = activityImpl.label; | ||
493 | + label.text = activityImpl.name; | ||
494 | + return label; | ||
495 | + */ | ||
496 | + | ||
497 | + // But now default label for all events is: | ||
498 | + return { | ||
499 | + text: activityImpl.getProperty("name"), | ||
500 | + x: activityImpl.getX() + .5 + activityImpl.getWidth()/2, | ||
501 | + y: activityImpl.getY() + .5 + activityImpl.getHeight() + ICON_PADDING, | ||
502 | + width: 100, | ||
503 | + height: 0 | ||
504 | + }; | ||
505 | + }, | ||
506 | + | ||
507 | + generateDiagram: function(processDefinitionDiagramLayout){ | ||
508 | + // Init canvas | ||
509 | + var processDefinitionId = processDefinitionDiagramLayout.processDefinition.id; | ||
510 | + //console.log("Init canvas ", processDefinitionId); | ||
511 | + | ||
512 | + if (this.getProcessDiagram(processDefinitionId) != undefined) { | ||
513 | + // TODO: may be reset canvas if exists.. Or just show | ||
514 | + //console.log("ProcessDiagram '" + processDefinitionId + "' is already generated. Just show it."); | ||
515 | + return; | ||
516 | + } | ||
517 | + var processDiagram = this.initProcessDiagramCanvas(processDefinitionDiagramLayout); | ||
518 | + var processDiagramCanvas = processDiagram.diagramCanvas; | ||
519 | + | ||
520 | + // Draw pool shape, if process is participant in collaboration | ||
521 | + | ||
522 | + if(processDefinitionDiagramLayout.participantProcess != undefined) { | ||
523 | + //console.log("Draw pool shape"); | ||
524 | + var pProc = processDefinitionDiagramLayout.participantProcess; | ||
525 | + processDiagramCanvas.drawPoolOrLane(pProc.x, pProc.y, pProc.width, pProc.height, pProc.name); | ||
526 | + } | ||
527 | + | ||
528 | + var laneSets = processDefinitionDiagramLayout.laneSets; | ||
529 | + var activities = processDefinitionDiagramLayout.activities; | ||
530 | + var sequenceFlows = processDefinitionDiagramLayout.sequenceFlows; | ||
531 | + | ||
532 | + | ||
533 | + pb1.set('value', 0); | ||
534 | + var cnt = 0; | ||
535 | + if (laneSets) | ||
536 | + for(var i in laneSets) { | ||
537 | + cnt += laneSets[i].lanes.length; | ||
538 | + } | ||
539 | + if (activities) | ||
540 | + cnt += activities.length; | ||
541 | + if (sequenceFlows) | ||
542 | + cnt += sequenceFlows.length; | ||
543 | + var step = (cnt>0)? 100/cnt : 0; | ||
544 | + var progress = 0; | ||
545 | + //console.log("progress bar step: ", step); | ||
546 | + | ||
547 | + var task1 = new $.AsyncQueue(); | ||
548 | + | ||
549 | + // Draw lanes | ||
550 | + | ||
551 | + task1.add(function (task1) { | ||
552 | + if (!laneSets) laneSets = []; | ||
553 | + //console.log("> draw lane sets, count:", laneSets.length) | ||
554 | + }); | ||
555 | + | ||
556 | + for(var i in laneSets) { | ||
557 | + var laneSet = laneSets[i]; | ||
558 | + //laneSet.id, laneSet.name | ||
559 | + | ||
560 | + task1.add(laneSet.lanes,function (task1, lane) { | ||
561 | + progress += step; | ||
562 | + pb1.set('value', parseInt(progress)); | ||
563 | + | ||
564 | + //console.log("--> laneId: " + lane.name + ", name: " + lane.name); | ||
565 | + | ||
566 | + processDiagramCanvas.drawPoolOrLane(lane.x, lane.y, lane.width, lane.height, lane.name); | ||
567 | + }); | ||
568 | + } | ||
569 | + | ||
570 | + // Draw activities | ||
571 | + | ||
572 | + task1.add(function (task1) { | ||
573 | + if (!activities) activities = []; | ||
574 | + //console.log("> draw activities, count:", activities.length) | ||
575 | + }); | ||
576 | + | ||
577 | + var activitiesLength = activities.length; | ||
578 | + task1.add(activities,function (task1, activityJson) { | ||
579 | + var activity = new ActivityImpl(activityJson); | ||
580 | + activitiesLength --; | ||
581 | + progress += step; | ||
582 | + pb1.set('value', parseInt(progress)); | ||
583 | + //console.log(activitiesLength, "--> activityId: " + activity.getId() + ", name: " + activity.getProperty("name")); | ||
584 | + ProcessDiagramGenerator.drawActivity(processDiagramCanvas, activity); | ||
585 | + }); | ||
586 | + | ||
587 | + // Draw sequence-flows | ||
588 | + | ||
589 | + task1.add(function (task1) { | ||
590 | + if (!sequenceFlows) sequenceFlows = []; | ||
591 | + //console.log("> draw sequence flows, count:", sequenceFlows.length) | ||
592 | + }); | ||
593 | + | ||
594 | + var flowsLength = sequenceFlows.length; | ||
595 | + task1.add(sequenceFlows,function (task1, flow) { | ||
596 | + var waypoints = []; | ||
597 | + for(var j in flow.xPointArray) { | ||
598 | + waypoints[j] = {x: flow.xPointArray[j], y: flow.yPointArray[j]}; | ||
599 | + } | ||
600 | + var isDefault = flow.isDefault; | ||
601 | + var isConditional = flow.isConditional; | ||
602 | + var isHighLighted = flow.isHighLighted; | ||
603 | + | ||
604 | + // TODO: add source and destination for sequence flows in REST | ||
605 | + // parse for test | ||
606 | + var f = flow.flow; | ||
607 | + var matches = f.match(/\((.*)\)--.*-->\((.*)\)/); | ||
608 | + var sourceActivityId, destinationActivityId; | ||
609 | + if (matches != null) { | ||
610 | + sourceActivityId = matches[1]; | ||
611 | + destinationActivityId = matches[2]; | ||
612 | + } | ||
613 | + flow.sourceActivityId = sourceActivityId; | ||
614 | + flow.destinationActivityId = destinationActivityId; | ||
615 | + // | ||
616 | + flowsLength--; | ||
617 | + progress += step; | ||
618 | + pb1.set('value', parseInt(progress)); | ||
619 | + | ||
620 | + //console.log(flowsLength, "--> flow: " + flow.flow); | ||
621 | + | ||
622 | + processDiagramCanvas.setConextObject(flow); | ||
623 | + processDiagramCanvas.drawSequenceflow(waypoints, isConditional, isDefault, isHighLighted); | ||
624 | + }); | ||
625 | + | ||
626 | + task1.onComplete(function(){ | ||
627 | + if (progress<100) | ||
628 | + pb1.set('value', 100); | ||
629 | + //console.log("COMPLETE!!!"); | ||
630 | + | ||
631 | + //console.timeEnd('generateDiagram'); | ||
632 | + }); | ||
633 | + | ||
634 | + task1.run(); | ||
635 | + }, | ||
636 | + | ||
637 | + getProcessDiagram: function (processDefinitionId) { | ||
638 | + return this.processDiagrams[processDefinitionId]; | ||
639 | + }, | ||
640 | + | ||
641 | + initProcessDiagramCanvas: function (processDefinitionDiagramLayout) { | ||
642 | + var minX = 0; | ||
643 | + var maxX = 0; | ||
644 | + var minY = 0; | ||
645 | + var maxY = 0; | ||
646 | + | ||
647 | + if(processDefinitionDiagramLayout.participantProcess != undefined) { | ||
648 | + var pProc = processDefinitionDiagramLayout.participantProcess; | ||
649 | + | ||
650 | + minX = pProc.x; | ||
651 | + maxX = pProc.x + pProc.width; | ||
652 | + minY = pProc.y; | ||
653 | + maxY = pProc.y + pProc.height; | ||
654 | + } | ||
655 | + | ||
656 | + var activities = processDefinitionDiagramLayout.activities; | ||
657 | + for(var i in activities) { | ||
658 | + var activityJson = activities[i]; | ||
659 | + var activity = new ActivityImpl(activityJson); | ||
660 | + | ||
661 | + // width | ||
662 | + if (activity.getX() + activity.getWidth() > maxX) { | ||
663 | + maxX = activity.getX() + activity.getWidth(); | ||
664 | + } | ||
665 | + if (activity.getX() < minX) { | ||
666 | + minX = activity.getX(); | ||
667 | + } | ||
668 | + // height | ||
669 | + if (activity.getY() + activity.getHeight() > maxY) { | ||
670 | + maxY = activity.getY() + activity.getHeight(); | ||
671 | + } | ||
672 | + if (activity.getY() < minY) { | ||
673 | + minY = activity.getY(); | ||
674 | + } | ||
675 | + } | ||
676 | + | ||
677 | + var sequenceFlows = processDefinitionDiagramLayout.sequenceFlows; | ||
678 | + for(var i in sequenceFlows) { | ||
679 | + var flow = sequenceFlows[i]; | ||
680 | + var waypoints = []; | ||
681 | + for(var j in flow.xPointArray) { | ||
682 | + waypoints[j] = {x: flow.xPointArray[j], y: flow.yPointArray[j]}; | ||
683 | + | ||
684 | + // width | ||
685 | + if (waypoints[j].x > maxX) { | ||
686 | + maxX = waypoints[j].x; | ||
687 | + } | ||
688 | + if (waypoints[j].x < minX) { | ||
689 | + minX = waypoints[j].x; | ||
690 | + } | ||
691 | + // height | ||
692 | + if (waypoints[j].y > maxY) { | ||
693 | + maxY = waypoints[j].y; | ||
694 | + } | ||
695 | + if (waypoints[j].y < minY) { | ||
696 | + minY = waypoints[j].y; | ||
697 | + } | ||
698 | + } | ||
699 | + } | ||
700 | + | ||
701 | + var laneSets = processDefinitionDiagramLayout.laneSets; | ||
702 | + for(var i in laneSets) { | ||
703 | + var laneSet = laneSets[i]; | ||
704 | + //laneSet.id, laneSet.name | ||
705 | + | ||
706 | + for(var j in laneSet.lanes) { | ||
707 | + var lane = laneSet.lanes[j]; | ||
708 | + // width | ||
709 | + if (lane.x + lane.width > maxX) { | ||
710 | + maxX = lane.x + lane.width; | ||
711 | + } | ||
712 | + if (lane.x < minX) { | ||
713 | + minX = lane.x; | ||
714 | + } | ||
715 | + // height | ||
716 | + if (lane.y + lane.height > maxY) { | ||
717 | + maxY = lane.y + lane.height; | ||
718 | + } | ||
719 | + if (lane.y < minY) { | ||
720 | + minY = lane.y; | ||
721 | + } | ||
722 | + } | ||
723 | + } | ||
724 | + | ||
725 | + var diagramCanvas = new ProcessDiagramCanvas(); | ||
726 | + if (diagramCanvas) { | ||
727 | + | ||
728 | + // create div in diagramHolder | ||
729 | + var diagramHolder = document.getElementById(this.options.diagramHolderId); | ||
730 | + if (!diagramHolder) | ||
731 | + throw {msg: "Diagram holder not found", error: "diagramHolderNotFound"}; | ||
732 | + var div = document.createElement("DIV"); | ||
733 | + div.id = processDefinitionDiagramLayout.processDefinition.id; | ||
734 | + div.className = "diagram"; | ||
735 | + diagramHolder.appendChild(div); | ||
736 | + | ||
737 | + diagramCanvas.init(maxX + 20, maxY + 20, processDefinitionDiagramLayout.processDefinition.id); | ||
738 | + this.processDiagrams[processDefinitionDiagramLayout.processDefinition.id] = { | ||
739 | + processDefinitionDiagramLayout: processDefinitionDiagramLayout, | ||
740 | + diagramCanvas: diagramCanvas | ||
741 | + }; | ||
742 | + } | ||
743 | + return this.getProcessDiagram(processDefinitionDiagramLayout.processDefinition.id); | ||
744 | + //return new DefaultProcessDiagramCanvas(maxX + 10, maxY + 10, minX, minY); | ||
745 | + }, | ||
746 | + | ||
747 | + drawActivity: function(processDiagramCanvas, activity, highLightedActivities) { | ||
748 | + var type = activity.getProperty("type"); | ||
749 | + var drawInstruction = this.activityDrawInstructions[type]; | ||
750 | + if (drawInstruction != null) { | ||
751 | + drawInstruction.apply({processDiagramCanvas:processDiagramCanvas, activity:activity}); | ||
752 | + } else { | ||
753 | + //console.error("no drawInstruction for " + type + ": ", activity); | ||
754 | + } | ||
755 | + | ||
756 | + // Actually draw the markers | ||
757 | + if (activity.getProperty("multiInstance") != undefined || activity.getProperty("collapsed") != undefined) { | ||
758 | + //console.log(activity.getProperty("name"), activity.properties); | ||
759 | + var multiInstanceSequential = (activity.getProperty("multiInstance") == "sequential"); | ||
760 | + var multiInstanceParallel = (activity.getProperty("multiInstance") == "parrallel"); | ||
761 | + var collapsed = activity.getProperty("collapsed"); | ||
762 | + processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(), | ||
763 | + multiInstanceSequential, multiInstanceParallel, collapsed); | ||
764 | + } | ||
765 | + /* | ||
766 | + processDiagramCanvas.drawActivityMarkers(activity.getX(), activity.getY(), activity.getWidth(), activity.getHeight(), multiInstanceSequential, | ||
767 | + multiInstanceParallel, collapsed); | ||
768 | + */ | ||
769 | + | ||
770 | + // TODO: Draw highlighted activities if they are present | ||
771 | + | ||
772 | + }, | ||
773 | + | ||
774 | + setHighLights: function(highLights){ | ||
775 | + if (highLights.processDefinitionId == undefined) { | ||
776 | + //console.error("Process instance " + highLights.processInstanceId + " doesn't exist"); | ||
777 | + return; | ||
778 | + } | ||
779 | + | ||
780 | + var processDiagram = this.getProcessDiagram(highLights.processDefinitionId); | ||
781 | + if (processDiagram == undefined) { | ||
782 | + //console.error("Process diagram " + highLights.processDefinitionId + " not found"); | ||
783 | + return; | ||
784 | + } | ||
785 | + | ||
786 | + var processDiagramCanvas = processDiagram.diagramCanvas; | ||
787 | + | ||
788 | + // TODO: remove highLightes from all activities before set new highLight | ||
789 | + for (var i in highLights.activities) { | ||
790 | + var activityId = highLights.activities[i]; | ||
791 | + processDiagramCanvas.highLightActivity(activityId); | ||
792 | + } | ||
793 | + | ||
794 | + // TODO: remove highLightes from all flows before set new highLight | ||
795 | + for (var i in highLights.flows) { | ||
796 | + var flowId = highLights.flows[i]; | ||
797 | + var object = processDiagramCanvas.g.getById(flowId); | ||
798 | + var flow = object.data("contextObject"); | ||
799 | + flow.isHighLighted = true; | ||
800 | + processDiagramCanvas.highLightFlow(flowId); | ||
801 | + } | ||
802 | + }, | ||
803 | + | ||
804 | + drawHighLights: function(processInstanceId) { | ||
805 | + // Load highLights for the processInstanceId | ||
806 | + /* | ||
807 | + var url = Lang.sub(this.options.processInstanceHighLightsUrl, {processInstanceId: processInstanceId}); | ||
808 | + $.ajax({ | ||
809 | + url: url, | ||
810 | + type: 'GET', | ||
811 | + dataType: 'json', | ||
812 | + cache: false, | ||
813 | + async: true, | ||
814 | + }).done(function(data) { | ||
815 | + var highLights = data; | ||
816 | + if (!highLights) { | ||
817 | + console.log("highLights not found"); | ||
818 | + return; | ||
819 | + } | ||
820 | + | ||
821 | + console.log("highLights[" + highLights.processDefinitionId + "][" + processInstanceId + "]: ", highLights); | ||
822 | + | ||
823 | + ProcessDiagramGenerator.setHighLights(highLights); | ||
824 | + }).fail(function(jqXHR, textStatus){ | ||
825 | + console.log('Get HighLights['+processDefinitionId+'] failure: ', textStatus, jqXHR); | ||
826 | + }); | ||
827 | + */ | ||
828 | + // 解决无流程实例的时候抛出异常问题。 | ||
829 | + var url = Lang.sub(ActivitiRest.options.processInstanceUrl, {processInstanceId: processInstanceId}); | ||
830 | + var _drawHighLights = this._drawHighLights; | ||
831 | + $.ajax({ | ||
832 | + url: url, | ||
833 | + type: 'GET', | ||
834 | + dataType: 'json', | ||
835 | + cache: false, | ||
836 | + async: true, | ||
837 | + }).done(function(data) { | ||
838 | + ActivitiRest.getHighLights(processInstanceId, _drawHighLights); | ||
839 | + }).fail(function(jqXHR, textStatus){ | ||
840 | + console.log('Get HighLights['+processInstanceId+'] failure: ', textStatus, jqXHR); | ||
841 | + }); | ||
842 | + //ActivitiRest.getHighLights(processInstanceId, this._drawHighLights); | ||
843 | + }, | ||
844 | + _drawHighLights: function() { | ||
845 | + var highLights = this.highLights; | ||
846 | + ProcessDiagramGenerator.setHighLights(highLights); | ||
847 | + }, | ||
848 | + | ||
849 | + // Load processDefinition | ||
850 | + | ||
851 | + drawDiagram: function(processDefinitionId) { | ||
852 | + // Hide all diagrams | ||
853 | + var diagrams = $("#" + this.options.diagramHolderId + " div.diagram"); | ||
854 | + diagrams.addClass("hidden"); | ||
855 | + | ||
856 | + | ||
857 | + // If processDefinitionId doesn't contain ":" then it's a "processDefinitionKey", not an id. | ||
858 | + // Get process definition by key | ||
859 | + if (processDefinitionId.indexOf(":") < 0) { | ||
860 | + ActivitiRest.getProcessDefinitionByKey(processDefinitionId, this._drawDiagram); | ||
861 | + } else { | ||
862 | + this._drawDiagram.apply({processDefinitionId: processDefinitionId}); | ||
863 | + } | ||
864 | + }, | ||
865 | + _drawDiagram: function() { | ||
866 | + var processDefinitionId = this.processDefinitionId; | ||
867 | + | ||
868 | + ProcessDiagramGenerator.addBreadCrumbsItem(processDefinitionId); | ||
869 | + | ||
870 | + | ||
871 | + // Check if processDefinition is already loaded and rendered | ||
872 | + | ||
873 | + | ||
874 | + var processDiagram = ProcessDiagramGenerator.getProcessDiagram(processDefinitionId); | ||
875 | + | ||
876 | + if (processDiagram != undefined && processDiagram != null) { | ||
877 | + //console.log("Process diagram " + processDefinitionId + " is already loaded"); | ||
878 | + //return; | ||
879 | + | ||
880 | + var diagram = document.getElementById(processDefinitionId); | ||
881 | + $(diagram).removeClass("hidden"); | ||
882 | + | ||
883 | + // Regenerate image | ||
884 | + var processDefinitionDiagramLayout = processDiagram.processDefinitionDiagramLayout; | ||
885 | + ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout); | ||
886 | + | ||
887 | + return; | ||
888 | + } | ||
889 | + | ||
890 | + //console.time('loadDiagram'); | ||
891 | + | ||
892 | + // Load processDefinition | ||
893 | + | ||
894 | + ActivitiRest.getProcessDefinition(processDefinitionId, ProcessDiagramGenerator._generateDiagram); | ||
895 | + | ||
896 | + }, | ||
897 | + _generateDiagram: function() { | ||
898 | + var processDefinitionDiagramLayout = this.processDefinitionDiagramLayout; | ||
899 | + | ||
900 | + //console.log("process-definition-diagram-layout["+processDefinitionDiagramLayout.processDefinition.id+"]: ", processDefinitionDiagramLayout); | ||
901 | + | ||
902 | + //console.timeEnd('loadDiagram'); | ||
903 | + //console.time('generateDiagram'); | ||
904 | + | ||
905 | + pb1.set('value', 0); | ||
906 | + ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout); | ||
907 | + }, | ||
908 | + | ||
909 | + getProcessDefinitionByKey: function(processDefinitionKey) { | ||
910 | + var url = Lang.sub(this.options.processDefinitionByKeyUrl, {processDefinitionKey: processDefinitionKey}); | ||
911 | + | ||
912 | + var processDefinition; | ||
913 | + $.ajax({ | ||
914 | + url: url, | ||
915 | + type: 'POST', | ||
916 | + dataType: 'json', | ||
917 | + cache: false, | ||
918 | + async: false | ||
919 | + }).done(function(data) { | ||
920 | + //console.log("ajax returned data"); | ||
921 | + //console.log("ajax returned data:", data); | ||
922 | + processDefinition = data; | ||
923 | + if (!processDefinition) { | ||
924 | + //console.error("Process definition '" + processDefinitionKey + "' not found"); | ||
925 | + } | ||
926 | + }).fail(function(jqXHR, textStatus){ | ||
927 | + //console.error('Get diagram layout['+processDefinitionKey+'] failure: ', textStatus, jqXHR); | ||
928 | + }); | ||
929 | + | ||
930 | + if (processDefinition) { | ||
931 | + //console.log("Get process definition by key '" + processDefinitionKey + "': ", processDefinition.id); | ||
932 | + return processDefinition; | ||
933 | + } else { | ||
934 | + return null; | ||
935 | + } | ||
936 | + }, | ||
937 | + | ||
938 | + addBreadCrumbsItem: function(processDefinitionId){ | ||
939 | + var TPL_UL_CONTAINER = '<ul></ul>', | ||
940 | + TPL_LI_CONTAINER = '<li id="{id}", processDefinitionId="{processDefinitionId}"><span>{name}</span></li>'; | ||
941 | + | ||
942 | + if (!this.diagramBreadCrumbs) | ||
943 | + this.diagramBreadCrumbs = $("#" + this.options.diagramBreadCrumbsId); | ||
944 | + if (!this.diagramBreadCrumbs) return; | ||
945 | + | ||
946 | + | ||
947 | + var ul = this.diagramBreadCrumbs.find("ul"); | ||
948 | + //console.log("ul: ", ul); | ||
949 | + if (ul.size() == 0) { | ||
950 | + ul = $(TPL_UL_CONTAINER); | ||
951 | + this.diagramBreadCrumbs.append(ul); | ||
952 | + | ||
953 | + } | ||
954 | + var liListOld = ul.find("li"); | ||
955 | + //console.warn("liListOld", liListOld); | ||
956 | + | ||
957 | + // TODO: if there is any items after current then remove that before adding new item (m.b. it is a duplicate) | ||
958 | + var currentBreadCrumbsItemId = this.currentBreadCrumbsItemId; | ||
959 | + found = false; | ||
960 | + liListOld.each( | ||
961 | + function(index, item) { | ||
962 | + //console.warn("item:", $(this)); | ||
963 | + if (!found && currentBreadCrumbsItemId == $(this).attr("id")) { | ||
964 | + found = true; | ||
965 | + return; | ||
966 | + } | ||
967 | + if (found) { | ||
968 | + //console.warn("remove ", $(this).attr("id")); | ||
969 | + $(this).remove(); | ||
970 | + } | ||
971 | + } | ||
972 | + ); | ||
973 | + | ||
974 | + var liListNew = ul.find("li"); | ||
975 | + | ||
976 | + //console.log("liListNew size: ", liListNew.size()); | ||
977 | + var values = { | ||
978 | + id: 'breadCrumbsItem_' + liListNew.size(), | ||
979 | + processDefinitionId: processDefinitionId, | ||
980 | + name: processDefinitionId | ||
981 | + }; | ||
982 | + | ||
983 | + | ||
984 | + var tpl = Lang.sub(TPL_LI_CONTAINER, values); | ||
985 | + //console.log("tpl: ", tpl); | ||
986 | + ul.append(tpl); | ||
987 | + | ||
988 | + var li = ul.find("#" + values.id); | ||
989 | + //console.warn("li:", li); | ||
990 | + $('#' + values.id).on('click', this._breadCrumbsItemClick); | ||
991 | + | ||
992 | + ul.find("li").removeClass("selected"); | ||
993 | + li.attr("num", liListNew.size()); | ||
994 | + li.addClass("selected"); | ||
995 | + this.currentBreadCrumbsItemId = li.attr("id"); | ||
996 | + }, | ||
997 | + _breadCrumbsItemClick: function(){ | ||
998 | + var li = $(this), | ||
999 | + id = li.attr("id"), | ||
1000 | + processDefinitionId = li.attr("processDefinitionId"); | ||
1001 | + //console.warn("_breadCrumbsItemClick: ", id, ", processDefinitionId: ", processDefinitionId); | ||
1002 | + | ||
1003 | + var ul = ProcessDiagramGenerator.diagramBreadCrumbs.one("ul"); | ||
1004 | + ul.find("li").removeClass("selected"); | ||
1005 | + li.addClass("selected"); | ||
1006 | + ProcessDiagramGenerator.currentBreadCrumbsItemId = li.attr("id"); | ||
1007 | + | ||
1008 | + // Hide all diagrams | ||
1009 | + var diagrams = $("#"+ProcessDiagramGenerator.options.diagramHolderId+" div.diagram"); | ||
1010 | + diagrams.addClass("hidden"); | ||
1011 | + | ||
1012 | + var processDiagram = ProcessDiagramGenerator.getProcessDiagram(processDefinitionId); | ||
1013 | + | ||
1014 | + var diagram = document.getElementById(processDefinitionId); | ||
1015 | + if (!diagram) return; | ||
1016 | + $(diagram).removeClass("hidden"); | ||
1017 | + | ||
1018 | + // Regenerate image | ||
1019 | + var processDefinitionDiagramLayout = processDiagram.processDefinitionDiagramLayout; | ||
1020 | + ProcessDiagramGenerator.generateDiagram(processDefinitionDiagramLayout); | ||
1021 | + }, | ||
1022 | + | ||
1023 | + showFlowInfo: function(flow){ | ||
1024 | + var diagramInfo = $("#" + this.options.diagramInfoId); | ||
1025 | + if (!diagramInfo) return; | ||
1026 | + | ||
1027 | + var values = { | ||
1028 | + flow: flow.flow, | ||
1029 | + isDefault: (flow.isDefault)? "true":"", | ||
1030 | + isConditional: (flow.isConditional)? "true":"", | ||
1031 | + isHighLighted: (flow.isHighLighted)? "true":"", | ||
1032 | + sourceActivityId: flow.sourceActivityId, | ||
1033 | + destinationActivityId: flow.destinationActivityId | ||
1034 | + }; | ||
1035 | + var TPL_FLOW_INFO = '<div>{flow}</div>' | ||
1036 | + + '<div><b>sourceActivityId</b>: {sourceActivityId}</div>' | ||
1037 | + + '<div><b>destinationActivityId</b>: {destinationActivityId}</div>' | ||
1038 | + + '<div><b>isDefault</b>: {isDefault}</div>' | ||
1039 | + + '<div><b>isConditional</b>: {isConditional}</div>' | ||
1040 | + + '<div><b>isHighLighted</b>: {isHighLighted}</div>'; | ||
1041 | + var tpl = Lang.sub(TPL_FLOW_INFO, values); | ||
1042 | + //console.log("info: ", tpl); | ||
1043 | + diagramInfo.html(tpl); | ||
1044 | + }, | ||
1045 | + | ||
1046 | + showActivityInfo: function(activity){ | ||
1047 | + var diagramInfo = $("#" + this.options.diagramInfoId); | ||
1048 | + if (!diagramInfo) return; | ||
1049 | + | ||
1050 | + var values = { | ||
1051 | + activityId: activity.getId(), | ||
1052 | + name: activity.getProperty("name"), | ||
1053 | + type: activity.getProperty("type") | ||
1054 | + }; | ||
1055 | + var TPL_ACTIVITY_INFO = '' | ||
1056 | + + '<div><b>activityId</b>: {activityId}</div>' | ||
1057 | + + '<div><b>name</b>: {name}</div>' | ||
1058 | + + '<div><b>type</b>: {type}</div>'; | ||
1059 | + var TPL_CALLACTIVITY_INFO = '' | ||
1060 | + + '<div><b>collapsed</b>: {collapsed}</div>' | ||
1061 | + + '<div><b>processDefinitonKey</b>: {processDefinitonKey}</div>'; | ||
1062 | + | ||
1063 | + var template = TPL_ACTIVITY_INFO; | ||
1064 | + if (activity.getProperty("type") == "callActivity") { | ||
1065 | + values.collapsed = activity.getProperty("collapsed"); | ||
1066 | + values.processDefinitonKey = activity.getProperty("processDefinitonKey"); | ||
1067 | + template += TPL_CALLACTIVITY_INFO; | ||
1068 | + } else if (activity.getProperty("type") == "callActivity") { | ||
1069 | + | ||
1070 | + } | ||
1071 | + | ||
1072 | + var tpl = Lang.sub(template, values); | ||
1073 | + //console.log("info: ", tpl); | ||
1074 | + diagramInfo.html(tpl); | ||
1075 | + }, | ||
1076 | + | ||
1077 | + hideInfo: function(){ | ||
1078 | + var diagramInfo = $("#" + this.options.diagramInfoId); | ||
1079 | + if (!diagramInfo) return; | ||
1080 | + diagramInfo.html(""); | ||
1081 | + }, | ||
1082 | + | ||
1083 | + vvoid: function(){} | ||
1084 | +}; | ||
1085 | + | ||
1086 | +var Lang = { | ||
1087 | + SUBREGEX: /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g, | ||
1088 | + UNDEFINED: 'undefined', | ||
1089 | + isUndefined: function(o) { | ||
1090 | + return typeof o === Lang.UNDEFINED; | ||
1091 | + }, | ||
1092 | + sub: function(s, o) { | ||
1093 | + return ((s.replace) ? s.replace(Lang.SUBREGEX, function(match, key) { | ||
1094 | + return (!Lang.isUndefined(o[key])) ? o[key] : match; | ||
1095 | + }) : s); | ||
1096 | + } | ||
1097 | +}; | ||
1098 | + | ||
1099 | +if (Lang.isUndefined(console)) { | ||
1100 | + console = { log: function() {}, warn: function() {}, error: function() {}}; | ||
1101 | +} | ||
1102 | +ProcessDiagramGenerator.init(); |
1 | +/* | ||
2 | +* This file is part of the jquery plugin "asyncQueue". | ||
3 | +* | ||
4 | +* (c) Sebastien Roch <roch.sebastien@gmail.com> | ||
5 | +* @author (parallel) Dmitry Farafonov | ||
6 | +* | ||
7 | +* For the full copyright and license information, please view the LICENSE | ||
8 | +* file that was distributed with this source code. | ||
9 | +*/ | ||
10 | +(function($){ | ||
11 | + $.AsyncQueue = function() { | ||
12 | + var that = this, | ||
13 | + queue = [], | ||
14 | + completeFunc, | ||
15 | + failureFunc, | ||
16 | + paused = false, | ||
17 | + lastCallbackData, | ||
18 | + _run, | ||
19 | + _complete, | ||
20 | + inQueue = 0, | ||
21 | + defaultTimeOut = 10; | ||
22 | + | ||
23 | + _run = function() { | ||
24 | + var f = queue.shift(); | ||
25 | + | ||
26 | + if (f) { | ||
27 | + inQueue++; | ||
28 | + setTimeout(function(){ | ||
29 | + f.fn.apply(that, [that]); | ||
30 | + | ||
31 | + if (!f.isParallel) | ||
32 | + if (paused === false) { | ||
33 | + _run(); | ||
34 | + } | ||
35 | + inQueue --; | ||
36 | + if (inQueue == 0 && queue.length == 0) | ||
37 | + _complete(); | ||
38 | + }, f.timeOut); | ||
39 | + | ||
40 | + if (f.isParallel) | ||
41 | + if (paused === false) { | ||
42 | + _run(); | ||
43 | + } | ||
44 | + } | ||
45 | + }; | ||
46 | + | ||
47 | + _complete = function(){ | ||
48 | + if (completeFunc) | ||
49 | + completeFunc.apply(that, [that]); | ||
50 | + }; | ||
51 | + | ||
52 | + this.onComplete = function(func) { | ||
53 | + completeFunc = func; | ||
54 | + }; | ||
55 | + | ||
56 | + this.onFailure = function(func) { | ||
57 | + failureFunc = func; | ||
58 | + }; | ||
59 | + | ||
60 | + this.add = function(func) { | ||
61 | + // TODO: add callback for queue[i] complete | ||
62 | + | ||
63 | + var obj = arguments[0]; | ||
64 | + if (obj && Object.prototype.toString.call(obj) === "[object Array]") { | ||
65 | + var fn = arguments[1]; | ||
66 | + var timeOut = (typeof(arguments[2]) != "undefined")? arguments[2] : defaultTimeOut; | ||
67 | + if (typeof(fn) == "function") { | ||
68 | + for(var i = 0; i < obj.length; i++) { | ||
69 | + var f = function(objx){ | ||
70 | + queue.push({isParallel: true, fn: function(){fn.apply(that, [that, objx]);}, timeOut: timeOut}); | ||
71 | + }(obj[i]) | ||
72 | + } | ||
73 | + } | ||
74 | + } else { | ||
75 | + var fn = arguments[0]; | ||
76 | + var timeOut = (typeof(arguments[1]) != "undefined")? arguments[2] : defaultTimeOut; | ||
77 | + queue.push({isParallel: false, fn: func, timeOut: timeOut}); | ||
78 | + } | ||
79 | + return this; | ||
80 | + }; | ||
81 | + | ||
82 | + this.addParallel = function(func, timeOut) { | ||
83 | + // TODO: add callback for queue[i] complete | ||
84 | + | ||
85 | + queue.push({isParallel: true, fn: func, timeOut: timeOut}); | ||
86 | + return this; | ||
87 | + }; | ||
88 | + | ||
89 | + this.storeData = function(dataObject) { | ||
90 | + lastCallbackData = dataObject; | ||
91 | + return this; | ||
92 | + }; | ||
93 | + | ||
94 | + this.lastCallbackData = function () { | ||
95 | + return lastCallbackData; | ||
96 | + }; | ||
97 | + | ||
98 | + this.run = function() { | ||
99 | + paused = false; | ||
100 | + _run(); | ||
101 | + }; | ||
102 | + | ||
103 | + this.pause = function () { | ||
104 | + paused = true; | ||
105 | + return this; | ||
106 | + }; | ||
107 | + | ||
108 | + this.failure = function() { | ||
109 | + paused = true; | ||
110 | + if (failureFunc) { | ||
111 | + var args = [that]; | ||
112 | + for(i = 0; i < arguments.length; i++) { | ||
113 | + args.push(arguments[i]); | ||
114 | + } | ||
115 | + failureFunc.apply(that, args); | ||
116 | + } | ||
117 | + }; | ||
118 | + | ||
119 | + this.size = function(){ | ||
120 | + return queue.length; | ||
121 | + }; | ||
122 | + | ||
123 | + return this; | ||
124 | + } | ||
125 | +})(jQuery); |
此 diff 太大无法显示。
1 | +/* | ||
2 | + * @ Dmitry Farafonov | ||
3 | + */ | ||
4 | + | ||
5 | +(function($){ | ||
6 | +$.ProgressBar = function(options) { | ||
7 | + this.element = $(options.boundingBox); | ||
8 | + if (options.on && options.on.complete){ | ||
9 | + this.onComplete = options.on.complete; | ||
10 | + } | ||
11 | + if (options.on && options.on.valueChange){ | ||
12 | + this.onValueChange = options.on.valueChange; | ||
13 | + } | ||
14 | + | ||
15 | + this._create(); | ||
16 | + | ||
17 | + if (options.label) | ||
18 | + this.set("label", options.label); | ||
19 | + if (options.value) | ||
20 | + this.value(options.value); | ||
21 | + if (options.max) | ||
22 | + this.set("max", options.max); | ||
23 | +}; | ||
24 | +$.ProgressBar.prototype = { | ||
25 | + options: { | ||
26 | + value: 0, | ||
27 | + max: 100 | ||
28 | + }, | ||
29 | + | ||
30 | + min: 0, | ||
31 | + | ||
32 | + _create: function() { | ||
33 | + this.element | ||
34 | + .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) | ||
35 | + .attr({ | ||
36 | + role: "progressbar", | ||
37 | + "aria-valuemin": this.min, | ||
38 | + "aria-valuemax": this.options.max, | ||
39 | + "aria-valuenow": this._value() | ||
40 | + }); | ||
41 | + | ||
42 | + this.valueDiv = $( "<div class='ui-progressbar-label'></div>" ) | ||
43 | + .appendTo( this.element ); | ||
44 | + | ||
45 | + this.valueDiv = $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" ) | ||
46 | + .appendTo( this.element ); | ||
47 | + | ||
48 | + this.oldValue = this._value(); | ||
49 | + this._refreshValue(); | ||
50 | + }, | ||
51 | + | ||
52 | + _destroy: function() { | ||
53 | + this.element | ||
54 | + .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) | ||
55 | + .removeAttr( "role" ) | ||
56 | + .removeAttr( "aria-valuemin" ) | ||
57 | + .removeAttr( "aria-valuemax" ) | ||
58 | + .removeAttr( "aria-valuenow" ); | ||
59 | + | ||
60 | + this.valueDiv.remove(); | ||
61 | + }, | ||
62 | + | ||
63 | + value: function( newValue ) { | ||
64 | + if ( newValue === undefined ) { | ||
65 | + return this._value(); | ||
66 | + } | ||
67 | + | ||
68 | + this._setOption( "value", newValue ); | ||
69 | + return this; | ||
70 | + }, | ||
71 | + | ||
72 | + _setOption: function( key, value ) { | ||
73 | + if ( key === "value" ) { | ||
74 | + //var oldVal = this.options.value; | ||
75 | + this.options.value = value; | ||
76 | + this._refreshValue(); | ||
77 | + | ||
78 | + if (this.onValueChange) | ||
79 | + this.onValueChange.apply(this, [{oldVal: this.oldValue, newVal: value}]); | ||
80 | + | ||
81 | + if ( this._value() === this.options.max ) { | ||
82 | + //this._trigger( "complete" ); | ||
83 | + if (this.onComplete) | ||
84 | + this.onComplete.apply(this); | ||
85 | + } | ||
86 | + } else if (key === "label") { | ||
87 | + $(this.element).find(".ui-progressbar-label").html(value); | ||
88 | + } else if (key === "max") { | ||
89 | + this.options.max = value; | ||
90 | + } | ||
91 | + | ||
92 | + //this._super( key, value ); | ||
93 | + }, | ||
94 | + | ||
95 | + _value: function() { | ||
96 | + var val = this.options.value; | ||
97 | + // normalize invalid value | ||
98 | + if ( typeof val !== "number" ) { | ||
99 | + val = 0; | ||
100 | + } | ||
101 | + return Math.min( this.options.max, Math.max( this.min, val ) ); | ||
102 | + }, | ||
103 | + | ||
104 | + _percentage: function() { | ||
105 | + return 100 * this._value() / this.options.max; | ||
106 | + }, | ||
107 | + | ||
108 | + _refreshValue: function() { | ||
109 | + var value = this.value(), | ||
110 | + percentage = this._percentage(); | ||
111 | + | ||
112 | + if ( this.oldValue !== value ) { | ||
113 | + this.oldValue = value; | ||
114 | + //this._trigger( "change" ); | ||
115 | + } | ||
116 | + | ||
117 | + this.valueDiv | ||
118 | + .toggle( value > this.min ) | ||
119 | + .toggleClass( "ui-corner-right", value === this.options.max ) | ||
120 | + .width( percentage.toFixed(0) + "%" ); | ||
121 | + this.element.attr( "aria-valuenow", value ); | ||
122 | + | ||
123 | + //$(this.element).find(".ui-progressbar-label").html(value + "%"); | ||
124 | + }, | ||
125 | + | ||
126 | + set: function(key, value){ | ||
127 | + this._setOption(key, value); | ||
128 | + } | ||
129 | +}; | ||
130 | + | ||
131 | +})( jQuery ); |
1 | +if (typeof(console) == "undefined") { | ||
2 | + var console = { | ||
3 | + info: function(){}, | ||
4 | + warn: function(){}, | ||
5 | + error: function(){}, | ||
6 | + log: function(){}, | ||
7 | + time: function(){}, | ||
8 | + timeEnd: function(){} | ||
9 | + }; | ||
10 | +} | ||
11 | + | ||
12 | +if(!Array.isArray) { | ||
13 | + Array.isArray = function (vArg) { | ||
14 | + return Object.prototype.toString.call(vArg) === "[object Array]"; | ||
15 | + }; | ||
16 | +} | ||
17 | + | ||
18 | +if (!Object.isSVGElement) { | ||
19 | + Object.isSVGElement = function(vArg) { | ||
20 | + var str = Object.prototype.toString.call(vArg); | ||
21 | + return (str.indexOf("[object SVG") == 0); | ||
22 | + }; | ||
23 | +} |
1 | +// ┌────────────────────────────────────────────────────────────────────┐ \\ | ||
2 | +// │ Raphaël 2.1.1 - JavaScript Vector Library │ \\ | ||
3 | +// ├────────────────────────────────────────────────────────────────────┤ \\ | ||
4 | +// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ | ||
5 | +// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\ | ||
6 | +// ├────────────────────────────────────────────────────────────────────┤ \\ | ||
7 | +// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ | ||
8 | +// └────────────────────────────────────────────────────────────────────┘ \\ | ||
9 | + | ||
10 | +(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p<q;p++){var r=b[p];if(r[0]=="M")e=i=r[1],f=j=r[2];else{r[0]=="C"?(m=[e,f].concat(r.slice(1)),e=m[6],f=m[7]):(m=[e,f,e,f,i,j,i,j],e=i,f=j);for(var s=0,t=c.length;s<t;s++){var u=c[s];if(u[0]=="M")g=k=u[1],h=l=u[2];else{u[0]=="C"?(n=[g,h].concat(u.slice(1)),g=n[6],h=n[7]):(n=[g,h,g,h,k,l,k,l],g=k,h=l);var v=bG(m,n,d);if(d)o+=v;else{for(var w=0,x=v.length;w<x;w++)v[w].segment1=p,v[w].segment2=s,v[w].bez1=m,v[w].bez2=n;o=o.concat(v)}}}}}return o}function bG(b,c,d){var e=a.bezierBBox(b),f=a.bezierBBox(c);if(!a.isBBoxIntersect(e,f))return d?0:[];var g=bB.apply(0,b),h=bB.apply(0,c),i=~~(g/5),j=~~(h/5),k=[],l=[],m={},n=d?0:[];for(var o=0;o<i+1;o++){var p=a.findDotsAtSegment.apply(a,b.concat(o/i));k.push({x:p.x,y:p.y,t:o/i})}for(o=0;o<j+1;o++)p=a.findDotsAtSegment.apply(a,c.concat(o/j)),l.push({x:p.x,y:p.y,t:o/j});for(o=0;o<i;o++)for(var q=0;q<j;q++){var r=k[o],s=k[o+1],t=l[q],u=l[q+1],v=z(s.x-r.x)<.001?"y":"x",w=z(u.x-t.x)<.001?"y":"x",x=bD(r.x,r.y,s.x,s.y,t.x,t.y,u.x,u.y);if(x){if(m[x.x.toFixed(4)]==x.y.toFixed(4))continue;m[x.x.toFixed(4)]=x.y.toFixed(4);var y=r.t+z((x[v]-r[v])/(s[v]-r[v]))*(s.t-r.t),A=t.t+z((x[w]-t[w])/(u[w]-t[w]))*(u.t-t.t);y>=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)<y(e,g)||y(a,c)>x(e,g)||x(b,d)<y(f,h)||y(b,d)>x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)<i)){var j=1,k=j/2,l=j-k,m,n=.01;m=bB(a,b,c,d,e,f,g,h,l);while(z(m-i)>n)k/=2,l+=(m<i?1:-1)*k,m=bB(a,b,c,d,e,f,g,h,l);return l}}function bB(a,b,c,d,e,f,g,h,i){i==null&&(i=1),i=i>1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;o<k;o++){var p=j*l[o]+j,q=bA(p,a,c,e,g),r=bA(p,b,d,f,h),s=q*q+r*r;n+=m[o]*w.sqrt(s)}return j*n}function bA(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function by(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function bm(a){if(Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[g](c)&&(b[c]=bm(a[c]));return b}function a(c){if(a.is(c,"function"))return b?c():eve.on("raphael.DOMload",c);if(a.is(c,E))return a._engine.create[m](a,c.splice(0,3+a.is(c[0],C))).add(c);var d=Array.prototype.slice.call(arguments,0);if(a.is(d[d.length-1],"function")){var e=d.pop();return b?e.call(a._engine.create[m](a,d)):eve.on("raphael.DOMload",function(){e.call(a._engine.create[m](a,d))})}return a._engine.create[m](a,arguments)}a.version="2.1.0",a.eve=eve;var b,c=/[, ]+/,d={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},e=/\{(\d+)\}/g,f="prototype",g="hasOwnProperty",h={doc:document,win:window},i={was:Object.prototype[g].call(h.win,"Raphael"),is:h.win.Raphael},j=function(){this.ca=this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in h.doc,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v=r.prototype.toLowerCase,w=Math,x=w.max,y=w.min,z=w.abs,A=w.pow,B=w.PI,C="number",D="string",E="array",F="toString",G="fill",H=Object.prototype.toString,I={},J="push",K=a._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,L=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,M={NaN:1,Infinity:1,"-Infinity":1},N=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,O=w.round,P="setAttribute",Q=parseFloat,R=parseInt,S=r.prototype.toUpperCase,T=a._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},U=a._availableAnimAttrs={blur:C,"clip-rect":"csv",cx:C,cy:C,fill:"colour","fill-opacity":C,"font-size":C,height:C,opacity:C,path:"path",r:C,rx:C,ry:C,stroke:"colour","stroke-opacity":C,"stroke-width":C,transform:"transform",width:C,x:C,y:C},V=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,W=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,X={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,$=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,_=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,ba=a._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,bb={},bc=function(a,b){return a.key-b.key},bd=function(a,b){return Q(a)-Q(b)},be=function(){},bf=function(a){return a},bg=a._rectPath=function(a,b,c,d,e){if(e)return[["M",a+e,b],["l",c-e*2,0],["a",e,e,0,0,1,e,e],["l",0,d-e*2],["a",e,e,0,0,1,-e,e],["l",e*2-c,0],["a",e,e,0,0,1,-e,-e],["l",0,e*2-d],["a",e,e,0,0,1,e,-e],["z"]];return[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},bh=function(a,b,c,d){d==null&&(d=c);return[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},bi=a._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return bg(b.x,b.y,b.width,b.height)}},bj=a.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;a=bR(a);for(e=0,g=a.length;e<g;e++){i=a[e];for(f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d}return a};a._g=h,a.type=h.win.SVGAngle||h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bk=h.doc.createElement("div"),bl;bk.innerHTML='<v:shape adj="1"/>',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r<t)&&(z+=180);return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:x,y:y},alpha:z}},a.bezierBBox=function(b,c,d,e,f,g,h,i){a.is(b,"array")||(b=[b,c,d,e,f,g,h,i]);var j=bQ.apply(null,b);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},a.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.x<c.x2&&b.x>c.x||c.x<b.x2&&c.x>b.x)&&(b.y<c.y2&&b.y>c.y||c.y<b.y2&&c.y>b.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return bm(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h<i;h++){g=a[h];if(g[0]=="M")c=g[1],d=g[2],e.push(c),f.push(d);else{var j=bQ(c,d,g[1],g[2],g[3],g[4],g[5],g[6]);e=e[n](j.min.x,j.max.x),f=f[n](j.min.y,j.max.y),c=g[5],d=g[6]}}var k=y[m](0,e),l=y[m](0,f),o=x[m](0,e),p=x[m](0,f),q={x:k,y:l,x2:o,y2:p,width:o-k,height:p-l};b.bbox=bm(q);return q},bJ=function(b){var c=bm(b);c.toString=a._path2string;return c},bK=a._pathToRelative=function(b){var c=bz(b);if(c.rel)return bJ(c.rel);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=b[0][1],f=b[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=b.length;j<k;j++){var l=d[j]=[],m=b[j];if(m[0]!=v.call(m[0])){l[0]=v.call(m[0]);switch(l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}}else{l=d[j]=[],m[0]=="m"&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}d.toString=a._path2string,c.rel=bJ(d);return d},bL=a._pathToAbsolute=function(b){var c=bz(b);if(c.abs)return bJ(c.abs);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);if(!b||!b.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=+b[0][1],f=+b[0][2],g=e,h=f,i++,d[0]=["M",e,f]);var j=b.length==3&&b[0][0]=="M"&&b[1][0].toUpperCase()=="R"&&b[2][0].toUpperCase()=="Z";for(var k,l,m=i,o=b.length;m<o;m++){d.push(k=[]),l=b[m];if(l[0]!=S.call(l[0])){k[0]=S.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":var p=[e,f][n](l.slice(1));for(var q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[n](by(p,j));break;case"M":g=+l[1]+e,h=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}}else if(l[0]=="R")p=[e,f][n](l.slice(1)),d.pop(),d=d[n](by(p,j)),k=["R"][n](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=h;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],h=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}d.toString=a._path2string,c.abs=bJ(d);return d},bM=function(a,b,c,d){return[a,b,c,d,c,d]},bN=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bO=function(a,b,c,d,e,f,g,h,i,j){var k=B*120/180,l=B/180*(+e||0),m=[],o,p=bv(function(a,b,c){var d=a*w.cos(c)-b*w.sin(c),e=a*w.sin(c)+b*w.cos(c);return{x:d,y:e}});if(!j){o=p(a,b,-l),a=o.x,b=o.y,o=p(h,i,-l),h=o.x,i=o.y;var q=w.cos(B/180*e),r=w.sin(B/180*e),t=(a-h)/2,u=(b-i)/2,v=t*t/(c*c)+u*u/(d*d);v>1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=a<C?B-E:E,F=h<C?B-F:F,E<0&&(E=B*2+E),F<0&&(F=B*2+F),g&&E>F&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W<X;W++)V[W]=W%2?p(m[W-1],m[W],l).y:p(m[W],m[W+1],l).x;return V},bP=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},bQ=bv(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);k<l;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var o=d[k],p=e&&e[k],q=o.length,r=e&&p.length;f.x=o[q-2],f.y=o[q-1],f.bx=Q(o[q-4])||f.x,f.by=Q(o[q-3])||f.y,g.bx=e&&(Q(p[r-4])||g.x),g.by=e&&(Q(p[r-3])||g.y),g.x=e&&p[r-2],g.y=e&&p[r-1]}e||(c.curve=bJ(d));return e?[d,e]:d},null,bJ),bS=a._parseDots=bv(function(b){var c=[];for(var d=0,e=b.length;d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){var h=Q(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=Q(i);var k=(i-h)/(j-d+1);for(;d<j;d++)h+=k,c[d].offset=h+"%"}return c}),bT=a._tear=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)},bU=a._tofront=function(a,b){b.top!==a&&(bT(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},bV=a._toback=function(a,b){b.bottom!==a&&(bT(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},bW=a._insertafter=function(a,b,c){bT(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bX=a._insertbefore=function(a,b,c){bT(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bY=a.toMatrix=function(a,b){var c=bI(a),d={_:{transform:p},getBBox:function(){return c}};b$(d,b);return d.matrix},bZ=a.transformPath=function(a,b){return bj(a,bY(a,b))},b$=a._extractTransform=function(b,c){if(c==null)return b._.transform;c=r(c).replace(/\.{3}|\u2026/g,b._.transform||p);var d=a.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=b._,k=new cb;j.transform=d||[];if(d)for(var l=0,m=d.length;l<m;l++){var n=d[l],o=n.length,q=r(n[0]).toLowerCase(),s=n[0]!=q,t=s?k.invert():0,u,v,w,x,y;q=="t"&&o==3?s?(u=t.x(0,0),v=t.y(0,0),w=t.x(n[1],n[2]),x=t.y(n[1],n[2]),k.translate(w-u,x-v)):k.translate(n[1],n[2]):q=="r"?o==2?(y=y||b.getBBox(1),k.rotate(n[1],y.x+y.width/2,y.y+y.height/2),e+=n[1]):o==4&&(s?(w=t.x(n[2],n[3]),x=t.y(n[2],n[3]),k.rotate(n[1],w,x)):k.rotate(n[1],n[2],n[3]),e+=n[1]):q=="s"?o==2||o==3?(y=y||b.getBBox(1),k.scale(n[1],n[o-1],y.x+y.width/2,y.y+y.height/2),h*=n[1],i*=n[o-1]):o==5&&(s?(w=t.x(n[3],n[4]),x=t.y(n[3],n[4]),k.scale(n[1],n[2],w,x)):k.scale(n[1],n[2],n[3],n[4]),h*=n[1],i*=n[2]):q=="m"&&o==7&&k.add(n[1],n[2],n[3],n[4],n[5],n[6]),j.dirtyT=1,b.matrix=k}b.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,h==1&&i==1&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1},b_=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return a.length==4?[b,0,a[2],a[3]]:[b,0];case"s":return a.length==5?[b,1,1,a[3],a[4]]:a.length==3?[b,1,1]:[b,1]}},ca=a._equaliseTransform=function(b,c){c=r(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];var d=x(b.length,c.length),e=[],f=[],g=0,h,i,j,k;for(;g<d;g++){j=b[g]||b_(c[g]),k=c[g]||b_(j);if(j[0]!=k[0]||j[0].toLowerCase()=="r"&&(j[2]!=k[2]||j[3]!=k[3])||j[0].toLowerCase()=="s"&&(j[3]!=k[3]||j[4]!=k[4]))return;e[g]=[],f[g]=[];for(h=0,i=x(j.length,k.length);h<i;h++)h in j&&(e[g][h]=j[h]),h in k&&(f[g][h]=k[h])}return{from:e,to:f}};a._getContainer=function(b,c,d,e){var f;f=e==null&&!a.is(b,"object")?h.doc.getElementById(b):b;if(f!=null){if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d};return{container:1,x:b,y:c,width:d,height:e}}},a.pathToRelative=bK,a._engine={},a.path2curve=bR,a.matrix=function(a,b,c,d,e,f){return new cb(a,b,c,d,e,f)},function(b){function d(a){var b=w.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}function c(a){return a[0]*a[0]+a[1]*a[1]}b.add=function(a,b,c,d,e,f){var g=[[],[],[]],h=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],i=[[a,c,e],[b,d,f],[0,0,1]],j,k,l,m;a&&a instanceof cb&&(i=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]);for(j=0;j<3;j++)for(k=0;k<3;k++){m=0;for(l=0;l<3;l++)m+=h[j][l]*i[l][k];g[j][k]=m}this.a=g[0][0],this.b=g[1][0],this.c=g[0][1],this.d=g[1][1],this.e=g[0][2],this.f=g[1][2]},b.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new cb(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},b.clone=function(){return new cb(this.a,this.b,this.c,this.d,this.e,this.f)},b.translate=function(a,b){this.add(1,0,0,1,a,b)},b.scale=function(a,b,c,d){b==null&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},b.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var e=+w.cos(b).toFixed(9),f=+w.sin(b).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},b.x=function(a,b){return a*this.a+b*this.c+this.e},b.y=function(a,b){return a*this.b+b*this.d+this.f},b.get=function(a){return+this[r.fromCharCode(97+a)].toFixed(4)},b.toString=function(){return a.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},b.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},b.split=function(){var b={};b.dx=this.e,b.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];b.scalex=w.sqrt(c(e[0])),d(e[0]),b.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*b.shear,e[1][1]-e[0][1]*b.shear],b.scaley=w.sqrt(c(e[1])),d(e[1]),b.shear/=b.scaley;var f=-e[0][1],g=e[1][1];g<0?(b.rotate=a.deg(w.acos(g)),f<0&&(b.rotate=360-b.rotate)):b.rotate=a.deg(w.asin(f)),b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b},b.toTransformString=function(a){var b=a||this[s]();if(b.isSimple){b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4);return(b.dx||b.dy?"t"+[b.dx,b.dy]:p)+(b.scalex!=1||b.scaley!=1?"s"+[b.scalex,b.scaley,0,0]:p)+(b.rotate?"r"+[b.rotate,0,0]:p)}return"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(cb.prototype);var cc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(cc&&cc[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&cc&&cc[1]<8?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:k.safari=be;var cd=function(){this.returnValue=!1},ce=function(){return this.originalEvent.preventDefault()},cf=function(){this.cancelBubble=!0},cg=function(){return this.originalEvent.stopPropagation()},ch=function(){if(h.doc.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,f=function(e){var f=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,i=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,j=e.clientX+i,k=e.clientY+f;if(o&&u[g](b))for(var l=0,m=e.targetTouches&&e.targetTouches.length;l<m;l++)if(e.targetTouches[l].target==a){var n=e;e=e.targetTouches[l],e.originalEvent=n,e.preventDefault=ce,e.stopPropagation=cg;break}return c.call(d,e,j,k)};a.addEventListener(e,f,!1);return function(){a.removeEventListener(e,f,!1);return!0}};if(h.doc.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.win.event;var b=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;a.preventDefault=a.preventDefault||cd,a.stopPropagation=a.stopPropagation||cf;return c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return!0};return f}}(),ci=[],cj=function(a){var b=a.clientX,c=a.clientY,d=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f,g=ci.length;while(g--){f=ci[g];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX,c=j.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();var k=f.el.node,l,m=k.nextSibling,n=k.parentNode,p=k.style.display;h.win.opera&&n.removeChild(k),k.style.display="none",l=f.el.paper.getElementByPoint(b,c),k.style.display=p,h.win.opera&&(m?n.insertBefore(k,m):n.appendChild(k)),l&&eve("raphael.drag.over."+f.el.id,f.el,l),b+=e,c+=d,eve("raphael.drag.move."+f.el.id,f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},ck=function(b){a.unmousemove(cj).unmouseup(ck);var c=ci.length,d;while(c--)d=ci[c],d.el._drag={},eve("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,b);ci=[]},cl=a.el={};for(var cm=t.length;cm--;)(function(b){a[b]=cl[b]=function(c,d){a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:ch(this.shape||this.node||h.doc,b,c,d||this)}));return this},a["un"+b]=cl["un"+b]=function(a){var c=this.events||[],d=c.length;while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind(),c.splice(d,1),!c.length&&delete this.events;return this}return this}})(t[cm]);cl.data=function(b,c){var d=bb[this.id]=bb[this.id]||{};if(arguments.length==1){if(a.is(b,"object")){for(var e in b)b[g](e)&&this.data(e,b[e]);return this}eve("raphael.data.get."+this.id,this,d[b],b);return d[b]}d[b]=c,eve("raphael.data.set."+this.id,this,c,b);return this},cl.removeData=function(a){a==null?bb[this.id]={}:bb[this.id]&&delete bb[this.id][a];return this},cl.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},cl.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var cn=[];cl.drag=function(b,c,d,e,f,g){function i(i){(i.originalEvent||i).preventDefault();var j=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,k=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft;this._drag.x=i.clientX+k,this._drag.y=i.clientY+j,this._drag.id=i.identifier,!ci.length&&a.mousemove(cj).mouseup(ck),ci.push({el:this,move_scope:e,start_scope:f,end_scope:g}),c&&eve.on("raphael.drag.start."+this.id,c),b&&eve.on("raphael.drag.move."+this.id,b),d&&eve.on("raphael.drag.end."+this.id,d),eve("raphael.drag.start."+this.id,f||e||this,i.clientX+k,i.clientY+j,i)}this._drag={},cn.push({el:this,start:i}),this.mousedown(i);return this},cl.onDragOver=function(a){a?eve.on("raphael.drag.over."+this.id,a):eve.unbind("raphael.drag.over."+this.id)},cl.undrag=function(){var b=cn.length;while(b--)cn[b].el==this&&(this.unmousedown(cn[b].start),cn.splice(b,1),eve.unbind("raphael.drag.*."+this.id));!cn.length&&a.unmousemove(cj).unmouseup(ck)},k.circle=function(b,c,d){var e=a._engine.circle(this,b||0,c||0,d||0);this.__set__&&this.__set__.push(e);return e},k.rect=function(b,c,d,e,f){var g=a._engine.rect(this,b||0,c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.ellipse=function(b,c,d,e){var f=a._engine.ellipse(this,b||0,c||0,d||0,e||0);this.__set__&&this.__set__.push(f);return f},k.path=function(b){b&&!a.is(b,D)&&!a.is(b[0],E)&&(b+=p);var c=a._engine.path(a.format[m](a,arguments),this);this.__set__&&this.__set__.push(c);return c},k.image=function(b,c,d,e,f){var g=a._engine.image(this,b||"about:blank",c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.text=function(b,c,d){var e=a._engine.text(this,b||0,c||0,r(d));this.__set__&&this.__set__.push(e);return e},k.set=function(b){!a.is(b,"array")&&(b=Array.prototype.splice.call(arguments,0,arguments.length));var c=new cG(b);this.__set__&&this.__set__.push(c);return c},k.setStart=function(a){this.__set__=a||this.set()},k.setFinish=function(a){var b=this.__set__;delete this.__set__;return b},k.setSize=function(b,c){return a._engine.setSize.call(this,b,c)},k.setViewBox=function(b,c,d,e,f){return a._engine.setViewBox.call(this,b,c,d,e,f)},k.top=k.bottom=null,k.raphael=a;var co=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,i=b.top+(h.win.pageYOffset||e.scrollTop||d.scrollTop)-f,j=b.left+(h.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:i,x:j}};k.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=h.doc.elementFromPoint(a,b);if(h.win.opera&&e.tagName=="svg"){var f=co(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var i=d.getIntersectionList(g,null);i.length&&(e=i[i.length-1])}if(!e)return null;while(e.parentNode&&e!=d.parentNode&&!e.raphael)e=e.parentNode;e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null;return e},k.getById=function(a){var b=this.bottom;while(b){if(b.id==a)return b;b=b.next}return null},k.forEach=function(a,b){var c=this.bottom;while(c){if(a.call(b,c)===!1)return this;c=c.next}return this},k.getElementsByPoint=function(a,b){var c=this.set();this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)});return c},cl.isPointInside=function(b,c){var d=this.realPath=this.realPath||bi[this.type](this);return a.isPointInsidePath(d,b,c)},cl.getBBox=function(a){if(this.removed)return{};var b=this._;if(a){if(b.dirty||!b.bboxwt)this.realPath=bi[this.type](this),b.bboxwt=bI(this.realPath),b.bboxwt.toString=cq,b.dirty=0;return bm(b.bboxwt)}if(b.dirty||b.dirtyT||!b.bbox){if(b.dirty||!this.realPath)b.bboxwt=0,this.realPath=bi[this.type](this);b.bbox=bI(bj(this.realPath,this.matrix)),b.bbox.toString=cq,b.dirty=b.dirtyT=0}return bm(b.bbox)},cl.getBBoxWOTransform=function(){return this.getBBox(1)},cl.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(a);return a},cl.glow=function(a){if(this.type=="text")return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||bi[this.type](this);f=this.matrix?bj(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cr={},cs=function(b,c,d,e,f,g,h,i,j){return j==null?bB(b,c,d,e,f,g,h,i):a.findDotsAtSegment(b,c,d,e,f,g,h,i,bC(b,c,d,e,f,g,h,i,j))},ct=function(b,c){return function(d,e,f){d=bR(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c<cy.length;c++){var d=cy[c];if(d.el.removed||d.paused)continue;var e=b-d.start,f=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,o={},p,r={},s;d.initstatus?(e=(d.initstatus*d.anim.top-d.prev)/(d.percent-d.prev)*f,d.status=d.initstatus,delete d.initstatus,d.stop&&cy.splice(c--,1)):d.status=(d.prev+(d.percent-d.prev)*(e/f))/d.anim.top;if(e<0)continue;if(e<f){var t=h(e/f);for(var u in i)if(i[g](u)){switch(U[u]){case C:p=+i[u]+t*f*j[u];break;case"colour":p="rgb("+[cB(O(i[u].r+t*f*j[u].r)),cB(O(i[u].g+t*f*j[u].g)),cB(O(i[u].b+t*f*j[u].b))].join(",")+")";break;case"path":p=[];for(var v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(var x=1,y=i[u][v].length;x<y;x++)p[v][x]=+i[u][v][x]+t*f*j[u][v][x];p[v]=p[v].join(q)}p=p.join(q);break;case"transform":if(j[u].real){p=[];for(v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(x=1,y=i[u][v].length;x<y;x++)p[v][x]=i[u][v][x]+t*f*j[u][v][x]}}else{var z=function(a){return+i[u][a]+t*f*j[u][a]};p=[["m",z(0),z(1),z(2),z(3),z(4),z(5)]]}break;case"csv":if(u=="clip-rect"){p=[],v=4;while(v--)p[v]=+i[u][v]+t*f*j[u][v]}break;default:var A=[][n](i[u]);p=[],v=m.paper.customAttributes[u].length;while(v--)p[v]=+A[v]+t*f*j[u][v]}o[u]=p}m.attr(o),function(a,b,c){setTimeout(function(){eve("raphael.anim.frame."+a,b,c)})}(m.id,m,d.anim)}else{(function(b,c,d){setTimeout(function(){eve("raphael.anim.frame."+c.id,c,d),eve("raphael.anim.finish."+c.id,c,d),a.is(b,"function")&&b.call(c)})})(d.callback,m,d.anim),m.attr(k),cy.splice(c--,1);if(d.repeat>1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l<m;l++)if(cy[l].anim==c&&cy[l].el==b){cy[m-1].start=cy[l].start;break}return h},cl.onAnimation=function(a){a?eve.on("raphael.anim.frame."+this.id,a):eve.unbind("raphael.anim.frame."+this.id);return this},cD.prototype.delay=function(a){var b=new cD(this.anim,this.ms);b.times=this.times,b.del=+a||0;return b},cD.prototype.repeat=function(a){var b=new cD(this.anim,this.ms);b.del=this.del,b.times=w.floor(x(a,0))||1;return b},a.animation=function(b,c,d,e){if(b instanceof cD)return b;if(a.is(d,"function")||!d)e=e||d||null,d=null;b=Object(b),c=+c||0;var f={},h,i;for(i in b)b[g](i)&&Q(i)!=i&&Q(i)+"%"!=i&&(h=!0,f[i]=b[i]);if(!h)return new cD(b,c);d&&(f.easing=d),e&&(f.callback=e);return new cD({100:f},c)},cl.animate=function(b,c,d,e){var f=this;if(f.removed){e&&e.call(f);return f}var g=b instanceof cD?b:a.animation(b,c,d,e);cE(g,f,g.percents[0],null,f.attr());return f},cl.setTime=function(a,b){a&&b!=null&&this.status(a,y(b,a.ms)/a.ms);return this},cl.status=function(a,b){var c=[],d=0,e,f;if(b!=null){cE(a,this,-1,y(b,1));return this}e=cy.length;for(;d<e;d++){f=cy[d];if(f.el.id==this.id&&(!a||f.anim==a)){if(a)return f.status;c.push({anim:f.anim,status:f.status})}}if(a)return 0;return c},cl.pause=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.pause."+this.id,this,cy[b].anim)!==!1&&(cy[b].paused=!0);return this},cl.resume=function(a){for(var b=0;b<cy.length;b++)if(cy[b].el.id==this.id&&(!a||cy[b].anim==a)){var c=cy[b];eve("raphael.anim.resume."+this.id,this,c.anim)!==!1&&(delete c.paused,this.status(c.anim,c.status))}return this},cl.stop=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.stop."+this.id,this,cy[b].anim)!==!1&&cy.splice(b--,1);return this},eve.on("raphael.remove",cF),eve.on("raphael.clear",cF),cl.toString=function(){return"Raphaël’s object"};var cG=function(a){this.items=[],this.length=0,this.type="set";if(a)for(var b=0,c=a.length;b<c;b++)a[b]&&(a[b].constructor==cl.constructor||a[b].constructor==cG)&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},cH=cG.prototype;cH.push=function(){var a,b;for(var c=0,d=arguments.length;c<d;c++)a=arguments[c],a&&(a.constructor==cl.constructor||a.constructor==cG)&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},cH.pop=function(){this.length&&delete this[this.length--];return this.items.pop()},cH.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var cI in cl)cl[g](cI)&&(cH[cI]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][m](c,b)})}}(cI));cH.attr=function(b,c){if(b&&a.is(b,E)&&a.is(b[0],"object"))for(var d=0,e=b.length;d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(b,c);return this},cH.clear=function(){while(this.length)this.pop()},cH.splice=function(a,b,c){a=a<0?x(this.length+a,0):a,b=x(0,y(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;g<arguments.length;g++)f.push(arguments[g]);for(g=0;g<b;g++)e.push(this[a+g]);for(;g<this.length-a;g++)d.push(this[a+g]);var h=f.length;for(g=0;g<h+d.length;g++)this.items[a+g]=this[a+g]=g<h?f[g]:d[g-h];g=this.items.length=this.length-=b-h;while(this[g])delete this[g++];return new cG(e)},cH.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a){this.splice(b,1);return!0}},cH.animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items.length,g=f,h,i=this,j;if(!f)return this;e&&(j=function(){!--f&&e.call(i)}),d=a.is(d,D)?d:j;var k=a.animation(b,c,d,j);h=this.items[--g].animate(k);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,k,k);return this},cH.insertAfter=function(a){var b=this.items.length;while(b--)this.items[b].insertAfter(a);return this},cH.getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}a=y[m](0,a),b=y[m](0,b),c=x[m](0,c),d=x[m](0,d);return{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},cH.clone=function(a){a=new cG;for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},cH.toString=function(){return"Raphaël‘s set"},a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[g](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=R(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[g](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var h in f.k)f[g](h)&&(b.glyphs[e].k[h]=f.k[h])}}return a},k.getFont=function(b,c,d,e){e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400;if(!!a.fonts){var f=a.fonts[b];if(!f){var h=new RegExp("(^|\\s)"+b.replace(/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[g](i)&&h.test(i)){f=a.fonts[i];break}}var j;if(f)for(var k=0,l=f.length;k<l;k++){j=f[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j}},k.print=function(b,d,e,f,g,h,i){h=h||"middle",i=x(y(i||0,1),-1);var j=r(e)[s](p),k=0,l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox[s](c),q=+o[0],t=o[3]-o[1],u=0,v=+o[1]+(h=="baseline"?t+ +f.face.descent:t/2);for(var w=0,z=j.length;w<z;w++){if(j[w]=="\n")k=0,B=0,l=0,u+=t;else{var A=l&&f.glyphs[j[w-1]]||{},B=f.glyphs[j[w]];k+=l?(A.w||f.w)+(A.k&&A.k[j[w]]||0)+f.w*i:0,l=1}B&&B.d&&(m+=a.transformPath(B.d,["t",k*n,u*n,"s",n,n,q,v,"t",(b-q)/n,(d-v)/n]))}}return this.path(m).attr({fill:"#000",stroke:"none"})},k.add=function(b){if(a.is(b,"array")){var c=this.set(),e=0,f=b.length,h;for(;e<f;e++)h=b[e]||{},d[g](h.type)&&c.push(this[h.type]().attr(h))}return c},a.format=function(b,c){var d=a.is(c,E)?[0][n](c):arguments;b&&a.is(b,D)&&d.length-1&&(b=b.replace(e,function(a,b){return d[++b]==null?p:d[b]}));return b||p},a.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),typeof e=="function"&&f&&(e=e()))}),e=(e==null||e==d?a:e)+"";return e};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),a.ninja=function(){i.was?h.win.Raphael=i.is:delete Raphael;return a},a.st=cH,function(b,c,d){function e(){/in/.test(b.readyState)?setTimeout(e,9):a.eve("raphael.DOMload")}b.readyState==null&&b.addEventListener&&(b.addEventListener(c,d=function(){b.removeEventListener(c,d,!1),b.readyState="complete"},!1),b.readyState="loading"),e()}(document,"DOMContentLoaded"),i.was?h.win.Raphael=a:Raphael=a,eve.on("raphael.DOMload",function(){b=!0})}(),window.Raphael.svg&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){typeof d=="string"&&(d=q(d));for(var f in e)e[b](f)&&(f.substring(0,6)=="xlink:"?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){e=c(e).replace(a._radial_gradient,function(a,b,c){j="radial";if(b&&c){m=d(b),n=d(c);var e=(n>.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1;return 1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if(d.type=="path"){var g=c(e).toLowerCase().split("-"),h=d.paper,i=f?"end":"start",j=d.node,k=d.attrs,m=k["stroke-width"],n=g.length,r="classic",s,t,u,v,w,x=3,y=3,z=5;while(n--)switch(g[n]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":r=g[n];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}r=="open"?(x+=2,y+=2,z+=2,u=1,v=f?4:1,w={fill:"none",stroke:k.stroke}):(v=u=x/2,w={fill:k.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={};if(r!="none"){var A="raphael-marker-"+r,B="raphael-marker-"+i+r+x+y;a._g.doc.getElementById(A)?p[A]++:(h.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[r],id:A})),p[A]=1);var C=a._g.doc.getElementById(B),D;C?(p[B]++,D=C.getElementsByTagName("use")[0]):(C=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:v,refY:y/2}),D=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),C.appendChild(D),h.defs.appendChild(C),p[B]=1),q(D,w);var F=u*(r!="diamond"&&r!="oval");f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-F*m):(s=F*m,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),w={},w["marker-"+i]="url(#"+B+")";if(t||s)w.d=Raphael.getSubpath(k.path,s,t);q(j,w),d._.arrows[i+"Path"]=A,d._.arrows[i+"Marker"]=B,d._.arrows[i+"dx"]=F,d._.arrows[i+"Type"]=r,d._.arrows[i+"String"]=e}else f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-s):(s=0,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),d._.arrows[i+"Path"]&&q(j,{d:Raphael.getSubpath(k.path,s,t)}),delete d._.arrows[i+"Path"],delete d._.arrows[i+"Marker"],delete d._.arrows[i+"dx"],delete d._.arrows[i+"Type"],delete d._.arrows[i+"String"];for(w in p)if(p[b](w)&&!p[w]){var G=a._g.doc.getElementById(w);G&&G.parentNode.removeChild(G)}}},u={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},v=function(a,b,d){b=u[c(b).toLowerCase()];if(b){var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;while(h--)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}};k.on("raphael.util.attr.blur",function(a){this.blur(a)}),k.on("raphael.util.attr.cursor",function(a){this.node.style.cursor=a});var w=function(d,f){var i=d.node,m=d.attrs,o=i.style.visibility;i.style.visibility="hidden";for(var p in f){k("raphael.util.attr."+p,d,f[p]);if(f[b](p)){if(!a._availableAttrs[b](p))continue;var u=f[p];m[p]=u;switch(p){case"blur":d.blur(u);break;case"href":case"title":case"target":var w=i.parentNode;if(w.tagName.toLowerCase()!="a"){var x=q("a");w.insertBefore(x,i),x.appendChild(i),w=x}p=="target"?w.setAttributeNS(n,"show",u=="blank"?"new":u):w.setAttributeNS(n,p,u);break;case"cursor":break;case"transform":d.transform(u);break;case"arrow-start":t(d,u);break;case"arrow-end":t(d,u,1);break;case"clip-rect":var z=c(u).split(j);if(z.length==4){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var A=q("clipPath"),B=q("rect");A.id=a.createUUID(),q(B,{x:z[0],y:z[1],width:z[2],height:z[3]}),A.appendChild(B),d.paper.defs.appendChild(A),q(i,{"clip-path":"url(#"+A.id+")"}),d.clip=B}if(!u){var C=i.getAttribute("clip-path");if(C){var D=a._g.doc.getElementById(C.replace(/(^url\(#|\)$)/g,l));D&&D.parentNode.removeChild(D),q(i,{"clip-path":l}),delete d.clip}}break;case"path":d.type=="path"&&(q(i,{d:u?m.path=a._pathToAbsolute(u):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":i.setAttribute(p,u),d._.dirty=1;if(m.fx)p="x",u=m.x;else break;case"x":m.fx&&(u=-m.x-(m.width||0));case"rx":if(p=="rx"&&d.type=="rect")break;case"cx":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"height":i.setAttribute(p,u),d._.dirty=1;if(m.fy)p="y",u=m.y;else break;case"y":m.fy&&(u=-m.y-(m.height||0));case"ry":if(p=="ry"&&d.type=="rect")break;case"cy":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"r":d.type=="rect"?q(i,{rx:u,ry:u}):i.setAttribute(p,u),d._.dirty=1;break;case"src":d.type=="image"&&i.setAttributeNS(n,"href",u);break;case"stroke-width":if(d._.sx!=1||d._.sy!=1)u/=g(h(d._.sx),h(d._.sy))||1;d.paper._vbSize&&(u*=d.paper._vbSize),i.setAttribute(p,u),m["stroke-dasharray"]&&v(d,m["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,u,f);break;case"fill":var F=c(u).match(a._ISURL);if(F){A=q("pattern");var G=q("image");A.id=a.createUUID(),q(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(G,{x:0,y:0,"xlink:href":F[1]}),A.appendChild(G),function(b){a._preload(F[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(G,{width:a,height:c}),d.paper.safari()})}(A),d.paper.defs.appendChild(A),q(i,{fill:"url(#"+A.id+")"}),d.pattern=A,d.pattern&&s(d);break}var H=a.getRGB(u);if(!H.error)delete f.gradient,delete m.gradient,!a.is(m.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:m.opacity}),!a.is(m["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":m["fill-opacity"]});else if((d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u)){if("opacity"in m||"fill-opacity"in m){var I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(I){var J=I.getElementsByTagName("stop");q(J[J.length-1],{"stop-opacity":("opacity"in m?m.opacity:1)*("fill-opacity"in m?m["fill-opacity"]:1)})}}m.gradient=u,m.fill="none";break}H[b]("opacity")&&q(i,{"fill-opacity":H.opacity>1?H.opacity/100:H.opacity});case"stroke":H=a.getRGB(u),i.setAttribute(p,H.hex),p=="stroke"&&H[b]("opacity")&&q(i,{"stroke-opacity":H.opacity>1?H.opacity/100:H.opacity}),p=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u);break;case"opacity":m.gradient&&!m[b]("stroke-opacity")&&q(i,{"stroke-opacity":u>1?u/100:u});case"fill-opacity":if(m.gradient){I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(J=I.getElementsByTagName("stop"),q(J[J.length-1],{"stop-opacity":u}));break};default:p=="font-size"&&(u=e(u,10)+"px");var K=p.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[K]=u,d._.dirty=1,i.setAttribute(p,u)}}}y(d,f),i.style.visibility=o},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n<o;n++)m=q("tspan"),n&&q(m,{dy:i*x,x:g.x}),m.appendChild(a._g.doc.createTextNode(j[n])),h.appendChild(m),k[n]=m}else{k=h.getElementsByTagName("tspan");for(n=0,o=k.length;n<o;n++)n?q(k[n],{dy:i*x,x:g.x}):q(k[0],{dy:0})}q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(k[0],{dy:r})}},z=function(b,c){var d=0,e=0;this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},A=a.el;z.prototype=A,A.constructor=z,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);d.type="path",w(d,{fill:"none",stroke:"#000",path:a});return d},A.rotate=function(a,b,e){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this.transform(this._.transform.concat([["r",a,b,e]]));return this},A.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]]));return this},A.translate=function(a,b){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]]));return this},A.transform=function(c){var d=this._;if(c==null)return d.transform;a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix});if(d.sx!=1||d.sy!=1){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){!this.removed&&this.paper.safari(this.node.style.display="none");return this},A.show=function(){!this.removed&&this.paper.safari(this.node.style.display="");return this},A.remove=function(){if(!this.removed&&!!this.node.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),a._tear(this,b),this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var c in this)this[c]=typeof this[c]=="function"?a._removedFactory(c):null;this.removed=!0}},A._getBBox=function(){if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}a&&this.hide();return b},A.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(c=="transform")return this._.transform;var g=c.split(j),h={};for(var i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(d==null&&a.is(c,"array")){h={};for(i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(d!=null){var m={};m[c]=d}else c!=null&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}w(this,m);return this},A.toFront=function(){if(this.removed)return this;this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var b=this.paper;b.top!=this&&a._tofront(this,b);return this},A.toBack=function(){if(this.removed)return this;var b=this.node.parentNode;b.tagName.toLowerCase()=="a"?b.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):b.firstChild!=this.node&&b.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper);var c=this.paper;return this},A.insertAfter=function(b){if(this.removed)return this;var c=b.node||b[b.length-1].node;c.nextSibling?c.parentNode.insertBefore(this.node,c.nextSibling):c.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},A.insertBefore=function(b){if(this.removed)return this;var c=b.node||b[0].node;c.parentNode.insertBefore(this.node,c),a._insertbefore(this,b,this.paper);return this},A.blur=function(b){var c=this;if(+b!==0){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter")},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs);return f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs);return h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs);return g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image";return h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new z(f,b);g.attrs={x:c,y:d,"text-anchor":"middle",text:e,font:a._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs);return g},a._engine.setSize=function(a,b){this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox);return this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h=q("svg"),i="overflow:hidden;",j;d=d||0,e=e||0,f=f||512,g=g||342,q(h,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),c==1?(h.style.cssText=i+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(h),j=1):(h.style.cssText=i+"position:relative",c.firstChild?c.insertBefore(h,c.firstChild):c.appendChild(h)),c=new a._Paper,c.width=f,c.height=g,c.canvas=h,c.clear(),c._left=c._top=0,j&&(c.renderfix=function(){}),c.renderfix();return c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f=g(c/this.width,d/this.height),h=this.top,i=e?"meet":"xMinYMin",j,l;a==null?(this._vbSize&&(f=1),delete this._vbSize,j="0 0 "+this.width+m+this.height):(this._vbSize=f,j=a+m+b+m+c+m+d),q(this.canvas,{viewBox:j,preserveAspectRatio:i});while(f&&h)l="stroke-width"in h.attrs?h.attrs["stroke-width"]:1,h.attr({"stroke-width":l}),h._.dirty=1,h._.dirtyT=1,h=h.prev;this._viewBox=[a,b,c,d,!!e];return this},a.prototype.renderfix=function(){var a=this.canvas,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}var e=-c.e%1,f=-c.f%1;if(e||f)e&&(this._left=(this._left+e)%1,b.left=this._left+"px"),f&&(this._top=(this._top+f)%1,b.top=this._top+"px")},a.prototype.clear=function(){a.eve("raphael.clear",this);var b=this.canvas;while(b.firstChild)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null};var B=a.st;for(var C in A)A[b](C)&&!B[b](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}(window.Raphael),window.Raphael.vml&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/ig,e=a._pathToAbsolute;c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g;if(e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e=b.toLowerCase()=="m",g=p[b];c.replace(s,function(a){e&&d.length==2&&(g+=d+p[b=="m"?"l":"L"],d=[]),d.push(f(a*u))});return g+d});return g}var h=e(b),i,j;g=[];for(var k=0,l=h.length;k<l;k++){i=h[k],j=h[k][0].toLowerCase(),j=="z"&&(j="x");for(var m=1,r=i.length;m<r;m++)j+=f(i[m]*u)+(m!=r-1?",":o);g.push(j)}return g.join(n)},y=function(b,c,d){var e=a.matrix();e.rotate(-b,.5,.5);return{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q,r=u/b,s=u/c;m.visibility="hidden";if(!!b&&!!c){l.coordsize=i(r)+n+i(s),m.rotation=f*(b*c<0?-1:1);if(f){var t=y(f,d,e);d=t.dx,e=t.dy}b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-r+n+e*-s;if(k||g.fillsize){var v=l.getElementsByTagName(j);v=v&&v[0],l.removeChild(v),k&&(t=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),v.position=t.dx*o+n+t.dy*o),g.fillsize&&(v.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(v)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";while(g--)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q,r=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),s=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),t=e;for(var y in i)i[b](y)&&(m[y]=i[y]);r&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur);if(i.path&&e.type=="path"||r)l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e.type=="image"&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0));"transform"in i&&e.transform(i.transform);if(s){var B=+m.cx,D=+m.cy,E=+m.rx||+m.r||0,G=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((B-E)*u),f((D-G)*u),f((B+E)*u),f((D+G)*u),f(B*u))}if("clip-rect"in i){var H=c(i["clip-rect"]).split(k);if(H.length==4){H[2]=+H[2]+ +H[0],H[3]=+H[3]+ +H[1];var I=l.clipRect||a._g.doc.createElement("div"),J=I.style;J.clip=a.format("rect({1}px {2}px {3}px {0}px)",H),l.clipRect||(J.position="absolute",J.top=0,J.left=0,J.width=e.paper.width+"px",J.height=e.paper.height+"px",l.parentNode.insertBefore(I,l),I.appendChild(l),l.clipRect=I)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var K=e.textpath.style;i.font&&(K.font=i.font),i["font-family"]&&(K.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(K.fontSize=i["font-size"]),i["font-weight"]&&(K.fontWeight=i["font-weight"]),i["font-style"]&&(K.fontStyle=i["font-style"])}"arrow-start"in i&&A(t,i["arrow-start"]),"arrow-end"in i&&A(t,i["arrow-end"],1);if(i.opacity!=null||i["stroke-width"]!=null||i.fill!=null||i.src!=null||i.stroke!=null||i["stroke-width"]!=null||i["stroke-opacity"]!=null||i["fill-opacity"]!=null||i["stroke-dasharray"]!=null||i["stroke-miterlimit"]!=null||i["stroke-linejoin"]!=null||i["stroke-linecap"]!=null){var L=l.getElementsByTagName(j),M=!1;L=L&&L[0],!L&&(M=L=F(j)),e.type=="image"&&i.src&&(L.src=i.src),i.fill&&(L.on=!0);if(L.on==null||i.fill=="none"||i.fill===null)L.on=!1;if(L.on&&i.fill){var N=c(i.fill).match(a._ISURL);if(N){L.parentNode==l&&l.removeChild(L),L.rotate=!0,L.src=N[1],L.type="tile";var O=e.getBBox(1);L.position=O.x+n+O.y,e._.fillpos=[O.x,O.y],a._preload(N[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else L.color=a.getRGB(i.fill).hex,L.src=o,L.type="solid",a.getRGB(i.fill).error&&(t.type in{circle:1,ellipse:1}||c(i.fill).charAt()!="r")&&C(t,i.fill,L)&&(m.fill="none",m.gradient=i.fill,L.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var P=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);P=h(g(P,0),1),L.opacity=P,L.src&&(L.color="none")}l.appendChild(L);var Q=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],T=!1;!Q&&(T=Q=F("stroke"));if(i.stroke&&i.stroke!="none"||i["stroke-width"]||i["stroke-opacity"]!=null||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])Q.on=!0;(i.stroke=="none"||i.stroke===null||Q.on==null||i.stroke==0||i["stroke-width"]==0)&&(Q.on=!1);var U=a.getRGB(i.stroke);Q.on&&i.stroke&&(Q.color=U.hex),P=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+U.o+1||2)-1);var V=(d(i["stroke-width"])||1)*.75;P=h(g(P,0),1),i["stroke-width"]==null&&(V=m["stroke-width"]),i["stroke-width"]&&(Q.weight=V),V&&V<1&&(P*=V)&&(Q.weight=1),Q.opacity=P,i["stroke-linejoin"]&&(Q.joinstyle=i["stroke-linejoin"]||"miter"),Q.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(Q.endcap=i["stroke-linecap"]=="butt"?"flat":i["stroke-linecap"]=="square"?"square":"round");if(i["stroke-dasharray"]){var W={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Q.dashstyle=W[b](i["stroke-dasharray"])?W[i["stroke-dasharray"]]:o}T&&l.appendChild(Q)}if(t.type=="text"){t.paper.canvas.style.display=o;var X=t.paper.span,Y=100,Z=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=X.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),Z=d(m["font-size"]||Z&&Z[0])||10,p.fontSize=Z*Y+"px",t.textpath.string&&(X.innerHTML=c(t.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba<bb;ba++)if(_[ba]in i){t._.dirty=1;break}switch(m["text-anchor"]){case"start":t.textpath.style["v-text-align"]="left",t.bbx=t.W/2;break;case"end":t.textpath.style["v-text-align"]="right",t.bbx=-t.W/2;break;default:t.textpath.style["v-text-align"]="center",t.bbx=0}t.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=b.attrs,i=Math.pow,j,k,l="linear",m=".5 .5";b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){l="radial",b&&c&&(b=d(b),c=d(c),i(b-.5,2)+i(c-.5,2)>.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s<t;s++)q[s].offset&&r.push(q[s].offset+n+q[s].color);g.colors=r.length?r.join():"0% "+g.color,l=="radial"?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=m,g.angle=0):(g.type="gradient",g.angle=(270-p)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(b==null)return this._.transform;var d=this.paper._viewBoxShift,e=d?"s"+[d.scale,d.scale]+"-1-1t"+[d.dx,d.dy]:o,f;d&&(f=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,e+b);var g=this.matrix.clone(),h=this.skew,i=this.node,j,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");g.translate(-0.5,-0.5);if(l||k||this.type=="image"){h.matrix="1 0 0 1",h.offset="0 0",j=g.split();if(k&&j.noRotation||!j.isSimple){i.style.filter=g.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;i.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else i.style.filter=o,z(this,j.scalex,j.scaley,j.dx,j.dy,j.rotate)}else i.style.filter=o,h.matrix=c(g),h.offset=g.offset();f&&(this._.transform=f);return this},E.rotate=function(a,b,e){if(this.removed)return this;if(a!=null){a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]]));return this}},E.translate=function(a,b){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]]));return this},E.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1;return this},E.hide=function(){!this.removed&&(this.node.style.display="none");return this},E.show=function(){!this.removed&&(this.node.style.display=o);return this},E._getBBox=function(){if(this.removed)return{};return{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&!!this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c==j&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var g=c.split(k),h={};for(var i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&d==null&&a.is(c,"array")){h={};for(i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;d!=null&&(n={},n[c]=d),d==null&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&this.type=="text"&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper);return this},E.toBack=function(){if(this.removed)return this;this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper));return this},E.insertAfter=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},E.insertBefore=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper);return this},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(r,o),+b!==0?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur)},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");f.on=!0,c.appendChild(f),d.skew=f,d.transform(o);return d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect";return i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path(),g=f.attrs;f.X=b-d,f.Y=c-e,f.W=d*2,f.H=e*2,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e});return f},a._engine.circle=function(a,b,c,d){var e=a.path(),f=e.attrs;e.X=b-d,e.Y=c-d,e.W=e.H=d*2,e.type="circle",B(e,{cx:b,cy:c,r:d});return e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0);return i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");m.on=!0,h.appendChild(m),k.skew=m,k.transform(o);return k},a._engine.setSize=function(b,c){var d=this.canvas.style;this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox);return this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var h=this.width,i=this.height,j=1/g(d/h,e/i),k,l;f&&(k=i/e,l=h/d,d*k<h&&(b-=(h-d*k)/2/k),e*l<i&&(c-=(i-e*l)/2/l)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:j},this.forEach(function(a){a.transform("...")});return this};var F;a._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael) |
1 | +// ┌────────────────────────────────────────────────────────────────────┐ \\ | ||
2 | +// │ Raphaël 2.1.1 - JavaScript Vector Library │ \\ | ||
3 | +// ├────────────────────────────────────────────────────────────────────┤ \\ | ||
4 | +// │ Copyright © 2008-2012 Dmitry Baranovskiy (http://raphaeljs.com) │ \\ | ||
5 | +// │ Copyright © 2008-2012 Sencha Labs (http://sencha.com) │ \\ | ||
6 | +// ├────────────────────────────────────────────────────────────────────┤ \\ | ||
7 | +// │ Licensed under the MIT (http://raphaeljs.com/license.html) license.│ \\ | ||
8 | +// └────────────────────────────────────────────────────────────────────┘ \\ | ||
9 | + | ||
10 | +(function(a){var b="0.3.4",c="hasOwnProperty",d=/[\.\/]/,e="*",f=function(){},g=function(a,b){return a-b},h,i,j={n:{}},k=function(a,b){var c=j,d=i,e=Array.prototype.slice.call(arguments,2),f=k.listeners(a),l=0,m=!1,n,o=[],p={},q=[],r=h,s=[];h=a,i=0;for(var t=0,u=f.length;t<u;t++)"zIndex"in f[t]&&(o.push(f[t].zIndex),f[t].zIndex<0&&(p[f[t].zIndex]=f[t]));o.sort(g);while(o[l]<0){n=p[o[l++]],q.push(n.apply(b,e));if(i){i=d;return q}}for(t=0;t<u;t++){n=f[t];if("zIndex"in n)if(n.zIndex==o[l]){q.push(n.apply(b,e));if(i)break;do{l++,n=p[o[l]],n&&q.push(n.apply(b,e));if(i)break}while(n)}else p[n.zIndex]=n;else{q.push(n.apply(b,e));if(i)break}}i=d,h=r;return q.length?q:null};k.listeners=function(a){var b=a.split(d),c=j,f,g,h,i,k,l,m,n,o=[c],p=[];for(i=0,k=b.length;i<k;i++){n=[];for(l=0,m=o.length;l<m;l++){c=o[l].n,g=[c[b[i]],c[e]],h=2;while(h--)f=g[h],f&&(n.push(f),p=p.concat(f.f||[]))}o=n}return p},k.on=function(a,b){var c=a.split(d),e=j;for(var g=0,h=c.length;g<h;g++)e=e.n,!e[c[g]]&&(e[c[g]]={n:{}}),e=e[c[g]];e.f=e.f||[];for(g=0,h=e.f.length;g<h;g++)if(e.f[g]==b)return f;e.f.push(b);return function(a){+a==+a&&(b.zIndex=+a)}},k.stop=function(){i=1},k.nt=function(a){if(a)return(new RegExp("(?:\\.|\\/|^)"+a+"(?:\\.|\\/|$)")).test(h);return h},k.off=k.unbind=function(a,b){var f=a.split(d),g,h,i,k,l,m,n,o=[j];for(k=0,l=f.length;k<l;k++)for(m=0;m<o.length;m+=i.length-2){i=[m,1],g=o[m].n;if(f[k]!=e)g[f[k]]&&i.push(g[f[k]]);else for(h in g)g[c](h)&&i.push(g[h]);o.splice.apply(o,i)}for(k=0,l=o.length;k<l;k++){g=o[k];while(g.n){if(b){if(g.f){for(m=0,n=g.f.length;m<n;m++)if(g.f[m]==b){g.f.splice(m,1);break}!g.f.length&&delete g.f}for(h in g.n)if(g.n[c](h)&&g.n[h].f){var p=g.n[h].f;for(m=0,n=p.length;m<n;m++)if(p[m]==b){p.splice(m,1);break}!p.length&&delete g.n[h].f}}else{delete g.f;for(h in g.n)g.n[c](h)&&g.n[h].f&&delete g.n[h].f}g=g.n}}},k.once=function(a,b){var c=function(){var d=b.apply(this,arguments);k.unbind(a,c);return d};return k.on(a,c)},k.version=b,k.toString=function(){return"You are running Eve "+b},typeof module!="undefined"&&module.exports?module.exports=k:typeof define!="undefined"?define("eve",[],function(){return k}):a.eve=k})(this),function(){function cF(a){for(var b=0;b<cy.length;b++)cy[b].el.paper==a&&cy.splice(b--,1)}function cE(b,d,e,f,h,i){e=Q(e);var j,k,l,m=[],o,p,q,t=b.ms,u={},v={},w={};if(f)for(y=0,z=cy.length;y<z;y++){var x=cy[y];if(x.el.id==d.id&&x.anim==b){x.percent!=e?(cy.splice(y,1),l=1):k=x,d.attr(x.totalOrigin);break}}else f=+v;for(var y=0,z=b.percents.length;y<z;y++){if(b.percents[y]==e||b.percents[y]>f*b.top){e=b.percents[y],p=b.percents[y-1]||0,t=t/b.top*(e-p),o=b.percents[y+1],j=b.anim[e];break}f&&d.attr(b.anim[b.percents[y]])}if(!!j){if(!k){for(var A in j)if(j[g](A))if(U[g](A)||d.paper.customAttributes[g](A)){u[A]=d.attr(A),u[A]==null&&(u[A]=T[A]),v[A]=j[A];switch(U[A]){case C:w[A]=(v[A]-u[A])/t;break;case"colour":u[A]=a.getRGB(u[A]);var B=a.getRGB(v[A]);w[A]={r:(B.r-u[A].r)/t,g:(B.g-u[A].g)/t,b:(B.b-u[A].b)/t};break;case"path":var D=bR(u[A],v[A]),E=D[1];u[A]=D[0],w[A]=[];for(y=0,z=u[A].length;y<z;y++){w[A][y]=[0];for(var F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(E[y][F]-u[A][y][F])/t}break;case"transform":var H=d._,I=ca(H[A],v[A]);if(I){u[A]=I.from,v[A]=I.to,w[A]=[],w[A].real=!0;for(y=0,z=u[A].length;y<z;y++){w[A][y]=[u[A][y][0]];for(F=1,G=u[A][y].length;F<G;F++)w[A][y][F]=(v[A][y][F]-u[A][y][F])/t}}else{var J=d.matrix||new cb,K={_:{transform:H.transform},getBBox:function(){return d.getBBox(1)}};u[A]=[J.a,J.b,J.c,J.d,J.e,J.f],b$(K,v[A]),v[A]=K._.transform,w[A]=[(K.matrix.a-J.a)/t,(K.matrix.b-J.b)/t,(K.matrix.c-J.c)/t,(K.matrix.d-J.d)/t,(K.matrix.e-J.e)/t,(K.matrix.f-J.f)/t]}break;case"csv":var L=r(j[A])[s](c),M=r(u[A])[s](c);if(A=="clip-rect"){u[A]=M,w[A]=[],y=M.length;while(y--)w[A][y]=(L[y]-u[A][y])/t}v[A]=L;break;default:L=[][n](j[A]),M=[][n](u[A]),w[A]=[],y=d.paper.customAttributes[A].length;while(y--)w[A][y]=((L[y]||0)-(M[y]||0))/t}}var O=j.easing,P=a.easing_formulas[O];if(!P){P=r(O).match(N);if(P&&P.length==5){var R=P;P=function(a){return cC(a,+R[1],+R[2],+R[3],+R[4],t)}}else P=bf}q=j.start||b.start||+(new Date),x={anim:b,percent:e,timestamp:q,start:q+(b.del||0),status:0,initstatus:f||0,stop:!1,ms:t,easing:P,from:u,diff:w,to:v,el:d,callback:j.callback,prev:p,next:o,repeat:i||b.times,origin:d.attr(),totalOrigin:h},cy.push(x);if(f&&!k&&!l){x.stop=!0,x.start=new Date-t*f;if(cy.length==1)return cA()}l&&(x.start=new Date-x.ms*f),cy.length==1&&cz(cA)}else k.initstatus=f,k.start=new Date-k.ms*f;eve("raphael.anim.start."+d.id,d,b)}}function cD(a,b){var c=[],d={};this.ms=b,this.times=1;if(a){for(var e in a)a[g](e)&&(d[Q(e)]=a[e],c.push(Q(e)));c.sort(bd)}this.anim=d,this.top=c[c.length-1],this.percents=c}function cC(a,b,c,d,e,f){function o(a,b){var c,d,e,f,j,k;for(e=a,k=0;k<8;k++){f=m(e)-a;if(z(f)<b)return e;j=(3*i*e+2*h)*e+g;if(z(j)<1e-6)break;e=e-f/j}c=0,d=1,e=a;if(e<c)return c;if(e>d)return d;while(c<d){f=m(e);if(z(f-a)<b)return e;a>f?c=e:d=e,e=(d-c)/2+c}return e}function n(a,b){var c=o(a,b);return((l*c+k)*c+j)*c}function m(a){return((i*a+h)*a+g)*a}var g=3*b,h=3*(d-b)-g,i=1-g-h,j=3*c,k=3*(e-c)-j,l=1-j-k;return n(a,1/(200*f))}function cq(){return this.x+q+this.y+q+this.width+" × "+this.height}function cp(){return this.x+q+this.y}function cb(a,b,c,d,e,f){a!=null?(this.a=+a,this.b=+b,this.c=+c,this.d=+d,this.e=+e,this.f=+f):(this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0)}function bH(b,c,d){b=a._path2curve(b),c=a._path2curve(c);var e,f,g,h,i,j,k,l,m,n,o=d?0:[];for(var p=0,q=b.length;p<q;p++){var r=b[p];if(r[0]=="M")e=i=r[1],f=j=r[2];else{r[0]=="C"?(m=[e,f].concat(r.slice(1)),e=m[6],f=m[7]):(m=[e,f,e,f,i,j,i,j],e=i,f=j);for(var s=0,t=c.length;s<t;s++){var u=c[s];if(u[0]=="M")g=k=u[1],h=l=u[2];else{u[0]=="C"?(n=[g,h].concat(u.slice(1)),g=n[6],h=n[7]):(n=[g,h,g,h,k,l,k,l],g=k,h=l);var v=bG(m,n,d);if(d)o+=v;else{for(var w=0,x=v.length;w<x;w++)v[w].segment1=p,v[w].segment2=s,v[w].bez1=m,v[w].bez2=n;o=o.concat(v)}}}}}return o}function bG(b,c,d){var e=a.bezierBBox(b),f=a.bezierBBox(c);if(!a.isBBoxIntersect(e,f))return d?0:[];var g=bB.apply(0,b),h=bB.apply(0,c),i=~~(g/5),j=~~(h/5),k=[],l=[],m={},n=d?0:[];for(var o=0;o<i+1;o++){var p=a.findDotsAtSegment.apply(a,b.concat(o/i));k.push({x:p.x,y:p.y,t:o/i})}for(o=0;o<j+1;o++)p=a.findDotsAtSegment.apply(a,c.concat(o/j)),l.push({x:p.x,y:p.y,t:o/j});for(o=0;o<i;o++)for(var q=0;q<j;q++){var r=k[o],s=k[o+1],t=l[q],u=l[q+1],v=z(s.x-r.x)<.001?"y":"x",w=z(u.x-t.x)<.001?"y":"x",x=bD(r.x,r.y,s.x,s.y,t.x,t.y,u.x,u.y);if(x){if(m[x.x.toFixed(4)]==x.y.toFixed(4))continue;m[x.x.toFixed(4)]=x.y.toFixed(4);var y=r.t+z((x[v]-r[v])/(s[v]-r[v]))*(s.t-r.t),A=t.t+z((x[w]-t[w])/(u[w]-t[w]))*(u.t-t.t);y>=0&&y<=1&&A>=0&&A<=1&&(d?n++:n.push({x:x.x,y:x.y,t1:y,t2:A}))}}return n}function bF(a,b){return bG(a,b,1)}function bE(a,b){return bG(a,b)}function bD(a,b,c,d,e,f,g,h){if(!(x(a,c)<y(e,g)||y(a,c)>x(e,g)||x(b,d)<y(f,h)||y(b,d)>x(f,h))){var i=(a*d-b*c)*(e-g)-(a-c)*(e*h-f*g),j=(a*d-b*c)*(f-h)-(b-d)*(e*h-f*g),k=(a-c)*(f-h)-(b-d)*(e-g);if(!k)return;var l=i/k,m=j/k,n=+l.toFixed(2),o=+m.toFixed(2);if(n<+y(a,c).toFixed(2)||n>+x(a,c).toFixed(2)||n<+y(e,g).toFixed(2)||n>+x(e,g).toFixed(2)||o<+y(b,d).toFixed(2)||o>+x(b,d).toFixed(2)||o<+y(f,h).toFixed(2)||o>+x(f,h).toFixed(2))return;return{x:l,y:m}}}function bC(a,b,c,d,e,f,g,h,i){if(!(i<0||bB(a,b,c,d,e,f,g,h)<i)){var j=1,k=j/2,l=j-k,m,n=.01;m=bB(a,b,c,d,e,f,g,h,l);while(z(m-i)>n)k/=2,l+=(m<i?1:-1)*k,m=bB(a,b,c,d,e,f,g,h,l);return l}}function bB(a,b,c,d,e,f,g,h,i){i==null&&(i=1),i=i>1?1:i<0?0:i;var j=i/2,k=12,l=[-0.1252,.1252,-0.3678,.3678,-0.5873,.5873,-0.7699,.7699,-0.9041,.9041,-0.9816,.9816],m=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],n=0;for(var o=0;o<k;o++){var p=j*l[o]+j,q=bA(p,a,c,e,g),r=bA(p,b,d,f,h),s=q*q+r*r;n+=m[o]*w.sqrt(s)}return j*n}function bA(a,b,c,d,e){var f=-3*b+9*c-9*d+3*e,g=a*f+6*b-12*c+6*d;return a*g-3*b+3*c}function by(a,b){var c=[];for(var d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4==d?f[3]={x:+a[0],y:+a[1]}:e-2==d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4==d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function bx(){return this.hex}function bv(a,b,c){function d(){var e=Array.prototype.slice.call(arguments,0),f=e.join("␀"),h=d.cache=d.cache||{},i=d.count=d.count||[];if(h[g](f)){bu(i,f);return c?c(h[f]):h[f]}i.length>=1e3&&delete h[i.shift()],i.push(f),h[f]=a[m](b,e);return c?c(h[f]):h[f]}return d}function bu(a,b){for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return a.push(a.splice(c,1)[0])}function bm(a){if(Object(a)!==a)return a;var b=new a.constructor;for(var c in a)a[g](c)&&(b[c]=bm(a[c]));return b}function a(c){if(a.is(c,"function"))return b?c():eve.on("raphael.DOMload",c);if(a.is(c,E))return a._engine.create[m](a,c.splice(0,3+a.is(c[0],C))).add(c);var d=Array.prototype.slice.call(arguments,0);if(a.is(d[d.length-1],"function")){var e=d.pop();return b?e.call(a._engine.create[m](a,d)):eve.on("raphael.DOMload",function(){e.call(a._engine.create[m](a,d))})}return a._engine.create[m](a,arguments)}a.version="2.1.0",a.eve=eve;var b,c=/[, ]+/,d={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},e=/\{(\d+)\}/g,f="prototype",g="hasOwnProperty",h={doc:document,win:window},i={was:Object.prototype[g].call(h.win,"Raphael"),is:h.win.Raphael},j=function(){this.ca=this.customAttributes={}},k,l="appendChild",m="apply",n="concat",o="createTouch"in h.doc,p="",q=" ",r=String,s="split",t="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend touchcancel"[s](q),u={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},v=r.prototype.toLowerCase,w=Math,x=w.max,y=w.min,z=w.abs,A=w.pow,B=w.PI,C="number",D="string",E="array",F="toString",G="fill",H=Object.prototype.toString,I={},J="push",K=a._ISURL=/^url\(['"]?([^\)]+?)['"]?\)$/i,L=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+%?(?:\s*,\s*[\d\.]+%?)?)\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i,M={NaN:1,Infinity:1,"-Infinity":1},N=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,O=w.round,P="setAttribute",Q=parseFloat,R=parseInt,S=r.prototype.toUpperCase,T=a._availableAttrs={"arrow-end":"none","arrow-start":"none",blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/","letter-spacing":0,opacity:1,path:"M0,0",r:0,rx:0,ry:0,src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",transform:"",width:0,x:0,y:0},U=a._availableAnimAttrs={blur:C,"clip-rect":"csv",cx:C,cy:C,fill:"colour","fill-opacity":C,"font-size":C,height:C,opacity:C,path:"path",r:C,rx:C,ry:C,stroke:"colour","stroke-opacity":C,"stroke-width":C,transform:"transform",width:C,x:C,y:C},V=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]/g,W=/[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/,X={hs:1,rg:1},Y=/,?([achlmqrstvxz]),?/gi,Z=/([achlmrqstvz])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,$=/([rstm])[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029,]*((-?\d*\.?\d*(?:e[\-+]?\d+)?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*)+)/ig,_=/(-?\d*\.?\d*(?:e[\-+]?\d+)?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,?[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*/ig,ba=a._radial_gradient=/^r(?:\(([^,]+?)[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*,[\x09\x0a\x0b\x0c\x0d\x20\xa0\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028\u2029]*([^\)]+?)\))?/,bb={},bc=function(a,b){return a.key-b.key},bd=function(a,b){return Q(a)-Q(b)},be=function(){},bf=function(a){return a},bg=a._rectPath=function(a,b,c,d,e){if(e)return[["M",a+e,b],["l",c-e*2,0],["a",e,e,0,0,1,e,e],["l",0,d-e*2],["a",e,e,0,0,1,-e,e],["l",e*2-c,0],["a",e,e,0,0,1,-e,-e],["l",0,e*2-d],["a",e,e,0,0,1,e,-e],["z"]];return[["M",a,b],["l",c,0],["l",0,d],["l",-c,0],["z"]]},bh=function(a,b,c,d){d==null&&(d=c);return[["M",a,b],["m",0,-d],["a",c,d,0,1,1,0,2*d],["a",c,d,0,1,1,0,-2*d],["z"]]},bi=a._getPath={path:function(a){return a.attr("path")},circle:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.r)},ellipse:function(a){var b=a.attrs;return bh(b.cx,b.cy,b.rx,b.ry)},rect:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height,b.r)},image:function(a){var b=a.attrs;return bg(b.x,b.y,b.width,b.height)},text:function(a){var b=a._getBBox();return bg(b.x,b.y,b.width,b.height)}},bj=a.mapPath=function(a,b){if(!b)return a;var c,d,e,f,g,h,i;a=bR(a);for(e=0,g=a.length;e<g;e++){i=a[e];for(f=1,h=i.length;f<h;f+=2)c=b.x(i[f],i[f+1]),d=b.y(i[f],i[f+1]),i[f]=c,i[f+1]=d}return a};a._g=h,a.type=h.win.SVGAngle||h.doc.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(a.type=="VML"){var bk=h.doc.createElement("div"),bl;bk.innerHTML='<v:shape adj="1"/>',bl=bk.firstChild,bl.style.behavior="url(#default#VML)";if(!bl||typeof bl.adj!="object")return a.type=p;bk=null}a.svg=!(a.vml=a.type=="VML"),a._Paper=j,a.fn=k=j.prototype=a.prototype,a._id=0,a._oid=0,a.is=function(a,b){b=v.call(b);if(b=="finite")return!M[g](+a);if(b=="array")return a instanceof Array;return b=="null"&&a===null||b==typeof a&&a!==null||b=="object"&&a===Object(a)||b=="array"&&Array.isArray&&Array.isArray(a)||H.call(a).slice(8,-1).toLowerCase()==b},a.angle=function(b,c,d,e,f,g){if(f==null){var h=b-d,i=c-e;if(!h&&!i)return 0;return(180+w.atan2(-i,-h)*180/B+360)%360}return a.angle(b,c,f,g)-a.angle(d,e,f,g)},a.rad=function(a){return a%360*B/180},a.deg=function(a){return a*180/B%360},a.snapTo=function(b,c,d){d=a.is(d,"finite")?d:10;if(a.is(b,E)){var e=b.length;while(e--)if(z(b[e]-c)<=d)return b[e]}else{b=+b;var f=c%b;if(f<d)return c-f;if(f>b-d)return c-f+b}return c};var bn=a.createUUID=function(a,b){return function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(a,b).toUpperCase()}}(/[xy]/g,function(a){var b=w.random()*16|0,c=a=="x"?b:b&3|8;return c.toString(16)});a.setWindow=function(b){eve("raphael.setWindow",a,h.win,b),h.win=b,h.doc=h.win.document,a._engine.initWin&&a._engine.initWin(h.win)};var bo=function(b){if(a.vml){var c=/^\s+|\s+$/g,d;try{var e=new ActiveXObject("htmlfile");e.write("<body>"),e.close(),d=e.body}catch(f){d=createPopup().document.body}var g=d.createTextRange();bo=bv(function(a){try{d.style.color=r(a).replace(c,p);var b=g.queryCommandValue("ForeColor");b=(b&255)<<16|b&65280|(b&16711680)>>>16;return"#"+("000000"+b.toString(16)).slice(-6)}catch(e){return"none"}})}else{var i=h.doc.createElement("i");i.title="Raphaël Colour Picker",i.style.display="none",h.doc.body.appendChild(i),bo=bv(function(a){i.style.color=a;return h.doc.defaultView.getComputedStyle(i,p).getPropertyValue("color")})}return bo(b)},bp=function(){return"hsb("+[this.h,this.s,this.b]+")"},bq=function(){return"hsl("+[this.h,this.s,this.l]+")"},br=function(){return this.hex},bs=function(b,c,d){c==null&&a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b&&(d=b.b,c=b.g,b=b.r);if(c==null&&a.is(b,D)){var e=a.getRGB(b);b=e.r,c=e.g,d=e.b}if(b>1||c>1||d>1)b/=255,c/=255,d/=255;return[b,c,d]},bt=function(b,c,d,e){b*=255,c*=255,d*=255;var f={r:b,g:c,b:d,hex:a.rgb(b,c,d),toString:br};a.is(e,"finite")&&(f.opacity=e);return f};a.color=function(b){var c;a.is(b,"object")&&"h"in b&&"s"in b&&"b"in b?(c=a.hsb2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):a.is(b,"object")&&"h"in b&&"s"in b&&"l"in b?(c=a.hsl2rgb(b),b.r=c.r,b.g=c.g,b.b=c.b,b.hex=c.hex):(a.is(b,"string")&&(b=a.getRGB(b)),a.is(b,"object")&&"r"in b&&"g"in b&&"b"in b?(c=a.rgb2hsl(b),b.h=c.h,b.s=c.s,b.l=c.l,c=a.rgb2hsb(b),b.v=c.b):(b={hex:"none"},b.r=b.g=b.b=b.h=b.s=b.v=b.l=-1)),b.toString=br;return b},a.hsb2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"b"in a&&(c=a.b,b=a.s,a=a.h,d=a.o),a*=360;var e,f,g,h,i;a=a%360/60,i=c*b,h=i*(1-z(a%2-1)),e=f=g=c-i,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.hsl2rgb=function(a,b,c,d){this.is(a,"object")&&"h"in a&&"s"in a&&"l"in a&&(c=a.l,b=a.s,a=a.h);if(a>1||b>1||c>1)a/=360,b/=100,c/=100;a*=360;var e,f,g,h,i;a=a%360/60,i=2*b*(c<.5?c:1-c),h=i*(1-z(a%2-1)),e=f=g=c-i/2,a=~~a,e+=[i,h,0,0,h,i][a],f+=[h,i,i,h,0,0][a],g+=[0,0,h,i,i,h][a];return bt(e,f,g,d)},a.rgb2hsb=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g;f=x(a,b,c),g=f-y(a,b,c),d=g==0?null:f==a?(b-c)/g:f==b?(c-a)/g+2:(a-b)/g+4,d=(d+360)%6*60/360,e=g==0?0:g/f;return{h:d,s:e,b:f,toString:bp}},a.rgb2hsl=function(a,b,c){c=bs(a,b,c),a=c[0],b=c[1],c=c[2];var d,e,f,g,h,i;g=x(a,b,c),h=y(a,b,c),i=g-h,d=i==0?null:g==a?(b-c)/i:g==b?(c-a)/i+2:(a-b)/i+4,d=(d+360)%6*60/360,f=(g+h)/2,e=i==0?0:f<.5?i/(2*f):i/(2-2*f);return{h:d,s:e,l:f,toString:bq}},a._path2string=function(){return this.join(",").replace(Y,"$1")};var bw=a._preload=function(a,b){var c=h.doc.createElement("img");c.style.cssText="position:absolute;left:-9999em;top:-9999em",c.onload=function(){b.call(this),this.onload=null,h.doc.body.removeChild(this)},c.onerror=function(){h.doc.body.removeChild(this)},h.doc.body.appendChild(c),c.src=a};a.getRGB=bv(function(b){if(!b||!!((b=r(b)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx};if(b=="none")return{r:-1,g:-1,b:-1,hex:"none",toString:bx};!X[g](b.toLowerCase().substring(0,2))&&b.charAt()!="#"&&(b=bo(b));var c,d,e,f,h,i,j,k=b.match(L);if(k){k[2]&&(f=R(k[2].substring(5),16),e=R(k[2].substring(3,5),16),d=R(k[2].substring(1,3),16)),k[3]&&(f=R((i=k[3].charAt(3))+i,16),e=R((i=k[3].charAt(2))+i,16),d=R((i=k[3].charAt(1))+i,16)),k[4]&&(j=k[4][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),k[1].toLowerCase().slice(0,4)=="rgba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100));if(k[5]){j=k[5][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsba"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsb2rgb(d,e,f,h)}if(k[6]){j=k[6][s](W),d=Q(j[0]),j[0].slice(-1)=="%"&&(d*=2.55),e=Q(j[1]),j[1].slice(-1)=="%"&&(e*=2.55),f=Q(j[2]),j[2].slice(-1)=="%"&&(f*=2.55),(j[0].slice(-3)=="deg"||j[0].slice(-1)=="°")&&(d/=360),k[1].toLowerCase().slice(0,4)=="hsla"&&(h=Q(j[3])),j[3]&&j[3].slice(-1)=="%"&&(h/=100);return a.hsl2rgb(d,e,f,h)}k={r:d,g:e,b:f,toString:bx},k.hex="#"+(16777216|f|e<<8|d<<16).toString(16).slice(1),a.is(h,"finite")&&(k.opacity=h);return k}return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:bx}},a),a.hsb=bv(function(b,c,d){return a.hsb2rgb(b,c,d).hex}),a.hsl=bv(function(b,c,d){return a.hsl2rgb(b,c,d).hex}),a.rgb=bv(function(a,b,c){return"#"+(16777216|c|b<<8|a<<16).toString(16).slice(1)}),a.getColor=function(a){var b=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||.75},c=this.hsb2rgb(b.h,b.s,b.b);b.h+=.075,b.h>1&&(b.h=0,b.s-=.2,b.s<=0&&(this.getColor.start={h:0,s:1,b:b.b}));return c.hex},a.getColor.reset=function(){delete this.start},a.parsePathString=function(b){if(!b)return null;var c=bz(b);if(c.arr)return bJ(c.arr);var d={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},e=[];a.is(b,E)&&a.is(b[0],E)&&(e=bJ(b)),e.length||r(b).replace(Z,function(a,b,c){var f=[],g=b.toLowerCase();c.replace(_,function(a,b){b&&f.push(+b)}),g=="m"&&f.length>2&&(e.push([b][n](f.splice(0,2))),g="l",b=b=="m"?"l":"L");if(g=="r")e.push([b][n](f));else while(f.length>=d[g]){e.push([b][n](f.splice(0,d[g])));if(!d[g])break}}),e.toString=a._path2string,c.arr=bJ(e);return e},a.parseTransformString=bv(function(b){if(!b)return null;var c={r:3,s:4,t:2,m:6},d=[];a.is(b,E)&&a.is(b[0],E)&&(d=bJ(b)),d.length||r(b).replace($,function(a,b,c){var e=[],f=v.call(b);c.replace(_,function(a,b){b&&e.push(+b)}),d.push([b][n](e))}),d.toString=a._path2string;return d});var bz=function(a){var b=bz.ps=bz.ps||{};b[a]?b[a].sleep=100:b[a]={sleep:100},setTimeout(function(){for(var c in b)b[g](c)&&c!=a&&(b[c].sleep--,!b[c].sleep&&delete b[c])});return b[a]};a.findDotsAtSegment=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=A(j,3),l=A(j,2),m=i*i,n=m*i,o=k*a+l*3*i*c+j*3*i*i*e+n*g,p=k*b+l*3*i*d+j*3*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,x=j*e+i*g,y=j*f+i*h,z=90-w.atan2(q-s,r-t)*180/B;(q>s||r<t)&&(z+=180);return{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:x,y:y},alpha:z}},a.bezierBBox=function(b,c,d,e,f,g,h,i){a.is(b,"array")||(b=[b,c,d,e,f,g,h,i]);var j=bQ.apply(null,b);return{x:j.min.x,y:j.min.y,x2:j.max.x,y2:j.max.y,width:j.max.x-j.min.x,height:j.max.y-j.min.y}},a.isPointInsideBBox=function(a,b,c){return b>=a.x&&b<=a.x2&&c>=a.y&&c<=a.y2},a.isBBoxIntersect=function(b,c){var d=a.isPointInsideBBox;return d(c,b.x,b.y)||d(c,b.x2,b.y)||d(c,b.x,b.y2)||d(c,b.x2,b.y2)||d(b,c.x,c.y)||d(b,c.x2,c.y)||d(b,c.x,c.y2)||d(b,c.x2,c.y2)||(b.x<c.x2&&b.x>c.x||c.x<b.x2&&c.x>b.x)&&(b.y<c.y2&&b.y>c.y||c.y<b.y2&&c.y>b.y)},a.pathIntersection=function(a,b){return bH(a,b)},a.pathIntersectionNumber=function(a,b){return bH(a,b,1)},a.isPointInsidePath=function(b,c,d){var e=a.pathBBox(b);return a.isPointInsideBBox(e,c,d)&&bH(b,[["M",c,d],["H",e.x2+10]],1)%2==1},a._removedFactory=function(a){return function(){eve("raphael.log",null,"Raphaël: you are calling to method “"+a+"” of removed object",a)}};var bI=a.pathBBox=function(a){var b=bz(a);if(b.bbox)return bm(b.bbox);if(!a)return{x:0,y:0,width:0,height:0,x2:0,y2:0};a=bR(a);var c=0,d=0,e=[],f=[],g;for(var h=0,i=a.length;h<i;h++){g=a[h];if(g[0]=="M")c=g[1],d=g[2],e.push(c),f.push(d);else{var j=bQ(c,d,g[1],g[2],g[3],g[4],g[5],g[6]);e=e[n](j.min.x,j.max.x),f=f[n](j.min.y,j.max.y),c=g[5],d=g[6]}}var k=y[m](0,e),l=y[m](0,f),o=x[m](0,e),p=x[m](0,f),q={x:k,y:l,x2:o,y2:p,width:o-k,height:p-l};b.bbox=bm(q);return q},bJ=function(b){var c=bm(b);c.toString=a._path2string;return c},bK=a._pathToRelative=function(b){var c=bz(b);if(c.rel)return bJ(c.rel);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=b[0][1],f=b[0][2],g=e,h=f,i++,d.push(["M",e,f]));for(var j=i,k=b.length;j<k;j++){var l=d[j]=[],m=b[j];if(m[0]!=v.call(m[0])){l[0]=v.call(m[0]);switch(l[0]){case"a":l[1]=m[1],l[2]=m[2],l[3]=m[3],l[4]=m[4],l[5]=m[5],l[6]=+(m[6]-e).toFixed(3),l[7]=+(m[7]-f).toFixed(3);break;case"v":l[1]=+(m[1]-f).toFixed(3);break;case"m":g=m[1],h=m[2];default:for(var n=1,o=m.length;n<o;n++)l[n]=+(m[n]-(n%2?e:f)).toFixed(3)}}else{l=d[j]=[],m[0]=="m"&&(g=m[1]+e,h=m[2]+f);for(var p=0,q=m.length;p<q;p++)d[j][p]=m[p]}var r=d[j].length;switch(d[j][0]){case"z":e=g,f=h;break;case"h":e+=+d[j][r-1];break;case"v":f+=+d[j][r-1];break;default:e+=+d[j][r-2],f+=+d[j][r-1]}}d.toString=a._path2string,c.rel=bJ(d);return d},bL=a._pathToAbsolute=function(b){var c=bz(b);if(c.abs)return bJ(c.abs);if(!a.is(b,E)||!a.is(b&&b[0],E))b=a.parsePathString(b);if(!b||!b.length)return[["M",0,0]];var d=[],e=0,f=0,g=0,h=0,i=0;b[0][0]=="M"&&(e=+b[0][1],f=+b[0][2],g=e,h=f,i++,d[0]=["M",e,f]);var j=b.length==3&&b[0][0]=="M"&&b[1][0].toUpperCase()=="R"&&b[2][0].toUpperCase()=="Z";for(var k,l,m=i,o=b.length;m<o;m++){d.push(k=[]),l=b[m];if(l[0]!=S.call(l[0])){k[0]=S.call(l[0]);switch(k[0]){case"A":k[1]=l[1],k[2]=l[2],k[3]=l[3],k[4]=l[4],k[5]=l[5],k[6]=+(l[6]+e),k[7]=+(l[7]+f);break;case"V":k[1]=+l[1]+f;break;case"H":k[1]=+l[1]+e;break;case"R":var p=[e,f][n](l.slice(1));for(var q=2,r=p.length;q<r;q++)p[q]=+p[q]+e,p[++q]=+p[q]+f;d.pop(),d=d[n](by(p,j));break;case"M":g=+l[1]+e,h=+l[2]+f;default:for(q=1,r=l.length;q<r;q++)k[q]=+l[q]+(q%2?e:f)}}else if(l[0]=="R")p=[e,f][n](l.slice(1)),d.pop(),d=d[n](by(p,j)),k=["R"][n](l.slice(-2));else for(var s=0,t=l.length;s<t;s++)k[s]=l[s];switch(k[0]){case"Z":e=g,f=h;break;case"H":e=k[1];break;case"V":f=k[1];break;case"M":g=k[k.length-2],h=k[k.length-1];default:e=k[k.length-2],f=k[k.length-1]}}d.toString=a._path2string,c.abs=bJ(d);return d},bM=function(a,b,c,d){return[a,b,c,d,c,d]},bN=function(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]},bO=function(a,b,c,d,e,f,g,h,i,j){var k=B*120/180,l=B/180*(+e||0),m=[],o,p=bv(function(a,b,c){var d=a*w.cos(c)-b*w.sin(c),e=a*w.sin(c)+b*w.cos(c);return{x:d,y:e}});if(!j){o=p(a,b,-l),a=o.x,b=o.y,o=p(h,i,-l),h=o.x,i=o.y;var q=w.cos(B/180*e),r=w.sin(B/180*e),t=(a-h)/2,u=(b-i)/2,v=t*t/(c*c)+u*u/(d*d);v>1&&(v=w.sqrt(v),c=v*c,d=v*d);var x=c*c,y=d*d,A=(f==g?-1:1)*w.sqrt(z((x*y-x*u*u-y*t*t)/(x*u*u+y*t*t))),C=A*c*u/d+(a+h)/2,D=A*-d*t/c+(b+i)/2,E=w.asin(((b-D)/d).toFixed(9)),F=w.asin(((i-D)/d).toFixed(9));E=a<C?B-E:E,F=h<C?B-F:F,E<0&&(E=B*2+E),F<0&&(F=B*2+F),g&&E>F&&(E=E-B*2),!g&&F>E&&(F=F-B*2)}else E=j[0],F=j[1],C=j[2],D=j[3];var G=F-E;if(z(G)>k){var H=F,I=h,J=i;F=E+k*(g&&F>E?1:-1),h=C+c*w.cos(F),i=D+d*w.sin(F),m=bO(h,i,c,d,e,0,g,I,J,[F,H,C,D])}G=F-E;var K=w.cos(E),L=w.sin(E),M=w.cos(F),N=w.sin(F),O=w.tan(G/4),P=4/3*c*O,Q=4/3*d*O,R=[a,b],S=[a+P*L,b-Q*K],T=[h+P*N,i-Q*M],U=[h,i];S[0]=2*R[0]-S[0],S[1]=2*R[1]-S[1];if(j)return[S,T,U][n](m);m=[S,T,U][n](m).join()[s](",");var V=[];for(var W=0,X=m.length;W<X;W++)V[W]=W%2?p(m[W-1],m[W],l).y:p(m[W],m[W+1],l).x;return V},bP=function(a,b,c,d,e,f,g,h,i){var j=1-i;return{x:A(j,3)*a+A(j,2)*3*i*c+j*3*i*i*e+A(i,3)*g,y:A(j,3)*b+A(j,2)*3*i*d+j*3*i*i*f+A(i,3)*h}},bQ=bv(function(a,b,c,d,e,f,g,h){var i=e-2*c+a-(g-2*e+c),j=2*(c-a)-2*(e-c),k=a-c,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,o=[b,h],p=[a,g],q;z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y)),i=f-2*d+b-(h-2*f+d),j=2*(d-b)-2*(f-d),k=b-d,l=(-j+w.sqrt(j*j-4*i*k))/2/i,n=(-j-w.sqrt(j*j-4*i*k))/2/i,z(l)>"1e12"&&(l=.5),z(n)>"1e12"&&(n=.5),l>0&&l<1&&(q=bP(a,b,c,d,e,f,g,h,l),p.push(q.x),o.push(q.y)),n>0&&n<1&&(q=bP(a,b,c,d,e,f,g,h,n),p.push(q.x),o.push(q.y));return{min:{x:y[m](0,p),y:y[m](0,o)},max:{x:x[m](0,p),y:x[m](0,o)}}}),bR=a._path2curve=bv(function(a,b){var c=!b&&bz(a);if(!b&&c.curve)return bJ(c.curve);var d=bL(a),e=b&&bL(b),f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},h=function(a,b){var c,d;if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];!(a[0]in{T:1,Q:1})&&(b.qx=b.qy=null);switch(a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"][n](bO[m](0,[b.x,b.y][n](a.slice(1))));break;case"S":c=b.x+(b.x-(b.bx||b.x)),d=b.y+(b.y-(b.by||b.y)),a=["C",c,d][n](a.slice(1));break;case"T":b.qx=b.x+(b.x-(b.qx||b.x)),b.qy=b.y+(b.y-(b.qy||b.y)),a=["C"][n](bN(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"][n](bN(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"][n](bM(b.x,b.y,a[1],a[2]));break;case"H":a=["C"][n](bM(b.x,b.y,a[1],b.y));break;case"V":a=["C"][n](bM(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"][n](bM(b.x,b.y,b.X,b.Y))}return a},i=function(a,b){if(a[b].length>7){a[b].shift();var c=a[b];while(c.length)a.splice(b++,0,["C"][n](c.splice(0,6)));a.splice(b,1),l=x(d.length,e&&e.length||0)}},j=function(a,b,c,f,g){a&&b&&a[g][0]=="M"&&b[g][0]!="M"&&(b.splice(g,0,["M",f.x,f.y]),c.bx=0,c.by=0,c.x=a[g][1],c.y=a[g][2],l=x(d.length,e&&e.length||0))};for(var k=0,l=x(d.length,e&&e.length||0);k<l;k++){d[k]=h(d[k],f),i(d,k),e&&(e[k]=h(e[k],g)),e&&i(e,k),j(d,e,f,g,k),j(e,d,g,f,k);var o=d[k],p=e&&e[k],q=o.length,r=e&&p.length;f.x=o[q-2],f.y=o[q-1],f.bx=Q(o[q-4])||f.x,f.by=Q(o[q-3])||f.y,g.bx=e&&(Q(p[r-4])||g.x),g.by=e&&(Q(p[r-3])||g.y),g.x=e&&p[r-2],g.y=e&&p[r-1]}e||(c.curve=bJ(d));return e?[d,e]:d},null,bJ),bS=a._parseDots=bv(function(b){var c=[];for(var d=0,e=b.length;d<e;d++){var f={},g=b[d].match(/^([^:]*):?([\d\.]*)/);f.color=a.getRGB(g[1]);if(f.color.error)return null;f.color=f.color.hex,g[2]&&(f.offset=g[2]+"%"),c.push(f)}for(d=1,e=c.length-1;d<e;d++)if(!c[d].offset){var h=Q(c[d-1].offset||0),i=0;for(var j=d+1;j<e;j++)if(c[j].offset){i=c[j].offset;break}i||(i=100,j=e),i=Q(i);var k=(i-h)/(j-d+1);for(;d<j;d++)h+=k,c[d].offset=h+"%"}return c}),bT=a._tear=function(a,b){a==b.top&&(b.top=a.prev),a==b.bottom&&(b.bottom=a.next),a.next&&(a.next.prev=a.prev),a.prev&&(a.prev.next=a.next)},bU=a._tofront=function(a,b){b.top!==a&&(bT(a,b),a.next=null,a.prev=b.top,b.top.next=a,b.top=a)},bV=a._toback=function(a,b){b.bottom!==a&&(bT(a,b),a.next=b.bottom,a.prev=null,b.bottom.prev=a,b.bottom=a)},bW=a._insertafter=function(a,b,c){bT(a,c),b==c.top&&(c.top=a),b.next&&(b.next.prev=a),a.next=b.next,a.prev=b,b.next=a},bX=a._insertbefore=function(a,b,c){bT(a,c),b==c.bottom&&(c.bottom=a),b.prev&&(b.prev.next=a),a.prev=b.prev,b.prev=a,a.next=b},bY=a.toMatrix=function(a,b){var c=bI(a),d={_:{transform:p},getBBox:function(){return c}};b$(d,b);return d.matrix},bZ=a.transformPath=function(a,b){return bj(a,bY(a,b))},b$=a._extractTransform=function(b,c){if(c==null)return b._.transform;c=r(c).replace(/\.{3}|\u2026/g,b._.transform||p);var d=a.parseTransformString(c),e=0,f=0,g=0,h=1,i=1,j=b._,k=new cb;j.transform=d||[];if(d)for(var l=0,m=d.length;l<m;l++){var n=d[l],o=n.length,q=r(n[0]).toLowerCase(),s=n[0]!=q,t=s?k.invert():0,u,v,w,x,y;q=="t"&&o==3?s?(u=t.x(0,0),v=t.y(0,0),w=t.x(n[1],n[2]),x=t.y(n[1],n[2]),k.translate(w-u,x-v)):k.translate(n[1],n[2]):q=="r"?o==2?(y=y||b.getBBox(1),k.rotate(n[1],y.x+y.width/2,y.y+y.height/2),e+=n[1]):o==4&&(s?(w=t.x(n[2],n[3]),x=t.y(n[2],n[3]),k.rotate(n[1],w,x)):k.rotate(n[1],n[2],n[3]),e+=n[1]):q=="s"?o==2||o==3?(y=y||b.getBBox(1),k.scale(n[1],n[o-1],y.x+y.width/2,y.y+y.height/2),h*=n[1],i*=n[o-1]):o==5&&(s?(w=t.x(n[3],n[4]),x=t.y(n[3],n[4]),k.scale(n[1],n[2],w,x)):k.scale(n[1],n[2],n[3],n[4]),h*=n[1],i*=n[2]):q=="m"&&o==7&&k.add(n[1],n[2],n[3],n[4],n[5],n[6]),j.dirtyT=1,b.matrix=k}b.matrix=k,j.sx=h,j.sy=i,j.deg=e,j.dx=f=k.e,j.dy=g=k.f,h==1&&i==1&&!e&&j.bbox?(j.bbox.x+=+f,j.bbox.y+=+g):j.dirtyT=1},b_=function(a){var b=a[0];switch(b.toLowerCase()){case"t":return[b,0,0];case"m":return[b,1,0,0,1,0,0];case"r":return a.length==4?[b,0,a[2],a[3]]:[b,0];case"s":return a.length==5?[b,1,1,a[3],a[4]]:a.length==3?[b,1,1]:[b,1]}},ca=a._equaliseTransform=function(b,c){c=r(c).replace(/\.{3}|\u2026/g,b),b=a.parseTransformString(b)||[],c=a.parseTransformString(c)||[];var d=x(b.length,c.length),e=[],f=[],g=0,h,i,j,k;for(;g<d;g++){j=b[g]||b_(c[g]),k=c[g]||b_(j);if(j[0]!=k[0]||j[0].toLowerCase()=="r"&&(j[2]!=k[2]||j[3]!=k[3])||j[0].toLowerCase()=="s"&&(j[3]!=k[3]||j[4]!=k[4]))return;e[g]=[],f[g]=[];for(h=0,i=x(j.length,k.length);h<i;h++)h in j&&(e[g][h]=j[h]),h in k&&(f[g][h]=k[h])}return{from:e,to:f}};a._getContainer=function(b,c,d,e){var f;f=e==null&&!a.is(b,"object")?h.doc.getElementById(b):b;if(f!=null){if(f.tagName)return c==null?{container:f,width:f.style.pixelWidth||f.offsetWidth,height:f.style.pixelHeight||f.offsetHeight}:{container:f,width:c,height:d};return{container:1,x:b,y:c,width:d,height:e}}},a.pathToRelative=bK,a._engine={},a.path2curve=bR,a.matrix=function(a,b,c,d,e,f){return new cb(a,b,c,d,e,f)},function(b){function d(a){var b=w.sqrt(c(a));a[0]&&(a[0]/=b),a[1]&&(a[1]/=b)}function c(a){return a[0]*a[0]+a[1]*a[1]}b.add=function(a,b,c,d,e,f){var g=[[],[],[]],h=[[this.a,this.c,this.e],[this.b,this.d,this.f],[0,0,1]],i=[[a,c,e],[b,d,f],[0,0,1]],j,k,l,m;a&&a instanceof cb&&(i=[[a.a,a.c,a.e],[a.b,a.d,a.f],[0,0,1]]);for(j=0;j<3;j++)for(k=0;k<3;k++){m=0;for(l=0;l<3;l++)m+=h[j][l]*i[l][k];g[j][k]=m}this.a=g[0][0],this.b=g[1][0],this.c=g[0][1],this.d=g[1][1],this.e=g[0][2],this.f=g[1][2]},b.invert=function(){var a=this,b=a.a*a.d-a.b*a.c;return new cb(a.d/b,-a.b/b,-a.c/b,a.a/b,(a.c*a.f-a.d*a.e)/b,(a.b*a.e-a.a*a.f)/b)},b.clone=function(){return new cb(this.a,this.b,this.c,this.d,this.e,this.f)},b.translate=function(a,b){this.add(1,0,0,1,a,b)},b.scale=function(a,b,c,d){b==null&&(b=a),(c||d)&&this.add(1,0,0,1,c,d),this.add(a,0,0,b,0,0),(c||d)&&this.add(1,0,0,1,-c,-d)},b.rotate=function(b,c,d){b=a.rad(b),c=c||0,d=d||0;var e=+w.cos(b).toFixed(9),f=+w.sin(b).toFixed(9);this.add(e,f,-f,e,c,d),this.add(1,0,0,1,-c,-d)},b.x=function(a,b){return a*this.a+b*this.c+this.e},b.y=function(a,b){return a*this.b+b*this.d+this.f},b.get=function(a){return+this[r.fromCharCode(97+a)].toFixed(4)},b.toString=function(){return a.svg?"matrix("+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)].join()+")":[this.get(0),this.get(2),this.get(1),this.get(3),0,0].join()},b.toFilter=function(){return"progid:DXImageTransform.Microsoft.Matrix(M11="+this.get(0)+", M12="+this.get(2)+", M21="+this.get(1)+", M22="+this.get(3)+", Dx="+this.get(4)+", Dy="+this.get(5)+", sizingmethod='auto expand')"},b.offset=function(){return[this.e.toFixed(4),this.f.toFixed(4)]},b.split=function(){var b={};b.dx=this.e,b.dy=this.f;var e=[[this.a,this.c],[this.b,this.d]];b.scalex=w.sqrt(c(e[0])),d(e[0]),b.shear=e[0][0]*e[1][0]+e[0][1]*e[1][1],e[1]=[e[1][0]-e[0][0]*b.shear,e[1][1]-e[0][1]*b.shear],b.scaley=w.sqrt(c(e[1])),d(e[1]),b.shear/=b.scaley;var f=-e[0][1],g=e[1][1];g<0?(b.rotate=a.deg(w.acos(g)),f<0&&(b.rotate=360-b.rotate)):b.rotate=a.deg(w.asin(f)),b.isSimple=!+b.shear.toFixed(9)&&(b.scalex.toFixed(9)==b.scaley.toFixed(9)||!b.rotate),b.isSuperSimple=!+b.shear.toFixed(9)&&b.scalex.toFixed(9)==b.scaley.toFixed(9)&&!b.rotate,b.noRotation=!+b.shear.toFixed(9)&&!b.rotate;return b},b.toTransformString=function(a){var b=a||this[s]();if(b.isSimple){b.scalex=+b.scalex.toFixed(4),b.scaley=+b.scaley.toFixed(4),b.rotate=+b.rotate.toFixed(4);return(b.dx||b.dy?"t"+[b.dx,b.dy]:p)+(b.scalex!=1||b.scaley!=1?"s"+[b.scalex,b.scaley,0,0]:p)+(b.rotate?"r"+[b.rotate,0,0]:p)}return"m"+[this.get(0),this.get(1),this.get(2),this.get(3),this.get(4),this.get(5)]}}(cb.prototype);var cc=navigator.userAgent.match(/Version\/(.*?)\s/)||navigator.userAgent.match(/Chrome\/(\d+)/);navigator.vendor=="Apple Computer, Inc."&&(cc&&cc[1]<4||navigator.platform.slice(0,2)=="iP")||navigator.vendor=="Google Inc."&&cc&&cc[1]<8?k.safari=function(){var a=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});setTimeout(function(){a.remove()})}:k.safari=be;var cd=function(){this.returnValue=!1},ce=function(){return this.originalEvent.preventDefault()},cf=function(){this.cancelBubble=!0},cg=function(){return this.originalEvent.stopPropagation()},ch=function(){if(h.doc.addEventListener)return function(a,b,c,d){var e=o&&u[b]?u[b]:b,f=function(e){var f=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,i=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,j=e.clientX+i,k=e.clientY+f;if(o&&u[g](b))for(var l=0,m=e.targetTouches&&e.targetTouches.length;l<m;l++)if(e.targetTouches[l].target==a){var n=e;e=e.targetTouches[l],e.originalEvent=n,e.preventDefault=ce,e.stopPropagation=cg;break}return c.call(d,e,j,k)};a.addEventListener(e,f,!1);return function(){a.removeEventListener(e,f,!1);return!0}};if(h.doc.attachEvent)return function(a,b,c,d){var e=function(a){a=a||h.win.event;var b=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f=a.clientX+e,g=a.clientY+b;a.preventDefault=a.preventDefault||cd,a.stopPropagation=a.stopPropagation||cf;return c.call(d,a,f,g)};a.attachEvent("on"+b,e);var f=function(){a.detachEvent("on"+b,e);return!0};return f}}(),ci=[],cj=function(a){var b=a.clientX,c=a.clientY,d=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,e=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft,f,g=ci.length;while(g--){f=ci[g];if(o){var i=a.touches.length,j;while(i--){j=a.touches[i];if(j.identifier==f.el._drag.id){b=j.clientX,c=j.clientY,(a.originalEvent?a.originalEvent:a).preventDefault();break}}}else a.preventDefault();var k=f.el.node,l,m=k.nextSibling,n=k.parentNode,p=k.style.display;h.win.opera&&n.removeChild(k),k.style.display="none",l=f.el.paper.getElementByPoint(b,c),k.style.display=p,h.win.opera&&(m?n.insertBefore(k,m):n.appendChild(k)),l&&eve("raphael.drag.over."+f.el.id,f.el,l),b+=e,c+=d,eve("raphael.drag.move."+f.el.id,f.move_scope||f.el,b-f.el._drag.x,c-f.el._drag.y,b,c,a)}},ck=function(b){a.unmousemove(cj).unmouseup(ck);var c=ci.length,d;while(c--)d=ci[c],d.el._drag={},eve("raphael.drag.end."+d.el.id,d.end_scope||d.start_scope||d.move_scope||d.el,b);ci=[]},cl=a.el={};for(var cm=t.length;cm--;)(function(b){a[b]=cl[b]=function(c,d){a.is(c,"function")&&(this.events=this.events||[],this.events.push({name:b,f:c,unbind:ch(this.shape||this.node||h.doc,b,c,d||this)}));return this},a["un"+b]=cl["un"+b]=function(a){var c=this.events||[],d=c.length;while(d--)if(c[d].name==b&&c[d].f==a){c[d].unbind(),c.splice(d,1),!c.length&&delete this.events;return this}return this}})(t[cm]);cl.data=function(b,c){var d=bb[this.id]=bb[this.id]||{};if(arguments.length==1){if(a.is(b,"object")){for(var e in b)b[g](e)&&this.data(e,b[e]);return this}eve("raphael.data.get."+this.id,this,d[b],b);return d[b]}d[b]=c,eve("raphael.data.set."+this.id,this,c,b);return this},cl.removeData=function(a){a==null?bb[this.id]={}:bb[this.id]&&delete bb[this.id][a];return this},cl.hover=function(a,b,c,d){return this.mouseover(a,c).mouseout(b,d||c)},cl.unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};var cn=[];cl.drag=function(b,c,d,e,f,g){function i(i){(i.originalEvent||i).preventDefault();var j=h.doc.documentElement.scrollTop||h.doc.body.scrollTop,k=h.doc.documentElement.scrollLeft||h.doc.body.scrollLeft;this._drag.x=i.clientX+k,this._drag.y=i.clientY+j,this._drag.id=i.identifier,!ci.length&&a.mousemove(cj).mouseup(ck),ci.push({el:this,move_scope:e,start_scope:f,end_scope:g}),c&&eve.on("raphael.drag.start."+this.id,c),b&&eve.on("raphael.drag.move."+this.id,b),d&&eve.on("raphael.drag.end."+this.id,d),eve("raphael.drag.start."+this.id,f||e||this,i.clientX+k,i.clientY+j,i)}this._drag={},cn.push({el:this,start:i}),this.mousedown(i);return this},cl.onDragOver=function(a){a?eve.on("raphael.drag.over."+this.id,a):eve.unbind("raphael.drag.over."+this.id)},cl.undrag=function(){var b=cn.length;while(b--)cn[b].el==this&&(this.unmousedown(cn[b].start),cn.splice(b,1),eve.unbind("raphael.drag.*."+this.id));!cn.length&&a.unmousemove(cj).unmouseup(ck)},k.circle=function(b,c,d){var e=a._engine.circle(this,b||0,c||0,d||0);this.__set__&&this.__set__.push(e);return e},k.rect=function(b,c,d,e,f){var g=a._engine.rect(this,b||0,c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.ellipse=function(b,c,d,e){var f=a._engine.ellipse(this,b||0,c||0,d||0,e||0);this.__set__&&this.__set__.push(f);return f},k.path=function(b){b&&!a.is(b,D)&&!a.is(b[0],E)&&(b+=p);var c=a._engine.path(a.format[m](a,arguments),this);this.__set__&&this.__set__.push(c);return c},k.image=function(b,c,d,e,f){var g=a._engine.image(this,b||"about:blank",c||0,d||0,e||0,f||0);this.__set__&&this.__set__.push(g);return g},k.text=function(b,c,d){var e=a._engine.text(this,b||0,c||0,r(d));this.__set__&&this.__set__.push(e);return e},k.set=function(b){!a.is(b,"array")&&(b=Array.prototype.splice.call(arguments,0,arguments.length));var c=new cG(b);this.__set__&&this.__set__.push(c);return c},k.setStart=function(a){this.__set__=a||this.set()},k.setFinish=function(a){var b=this.__set__;delete this.__set__;return b},k.setSize=function(b,c){return a._engine.setSize.call(this,b,c)},k.setViewBox=function(b,c,d,e,f){return a._engine.setViewBox.call(this,b,c,d,e,f)},k.top=k.bottom=null,k.raphael=a;var co=function(a){var b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,i=b.top+(h.win.pageYOffset||e.scrollTop||d.scrollTop)-f,j=b.left+(h.win.pageXOffset||e.scrollLeft||d.scrollLeft)-g;return{y:i,x:j}};k.getElementByPoint=function(a,b){var c=this,d=c.canvas,e=h.doc.elementFromPoint(a,b);if(h.win.opera&&e.tagName=="svg"){var f=co(d),g=d.createSVGRect();g.x=a-f.x,g.y=b-f.y,g.width=g.height=1;var i=d.getIntersectionList(g,null);i.length&&(e=i[i.length-1])}if(!e)return null;while(e.parentNode&&e!=d.parentNode&&!e.raphael)e=e.parentNode;e==c.canvas.parentNode&&(e=d),e=e&&e.raphael?c.getById(e.raphaelid):null;return e},k.getById=function(a){var b=this.bottom;while(b){if(b.id==a)return b;b=b.next}return null},k.forEach=function(a,b){var c=this.bottom;while(c){if(a.call(b,c)===!1)return this;c=c.next}return this},k.getElementsByPoint=function(a,b){var c=this.set();this.forEach(function(d){d.isPointInside(a,b)&&c.push(d)});return c},cl.isPointInside=function(b,c){var d=this.realPath=this.realPath||bi[this.type](this);return a.isPointInsidePath(d,b,c)},cl.getBBox=function(a){if(this.removed)return{};var b=this._;if(a){if(b.dirty||!b.bboxwt)this.realPath=bi[this.type](this),b.bboxwt=bI(this.realPath),b.bboxwt.toString=cq,b.dirty=0;return bm(b.bboxwt)}if(b.dirty||b.dirtyT||!b.bbox){if(b.dirty||!this.realPath)b.bboxwt=0,this.realPath=bi[this.type](this);b.bbox=bI(bj(this.realPath,this.matrix)),b.bbox.toString=cq,b.dirty=b.dirtyT=0}return bm(b.bbox)},cl.getBBoxWOTransform=function(){return this.getBBox(1)},cl.clone=function(){if(this.removed)return null;var a=this.paper[this.type]().attr(this.attr());this.__set__&&this.__set__.push(a);return a},cl.glow=function(a){if(this.type=="text")return null;a=a||{};var b={width:(a.width||10)+(+this.attr("stroke-width")||1),fill:a.fill||!1,opacity:a.opacity||.5,offsetx:a.offsetx||0,offsety:a.offsety||0,color:a.color||"#000"},c=b.width/2,d=this.paper,e=d.set(),f=this.realPath||bi[this.type](this);f=this.matrix?bj(f,this.matrix):f;for(var g=1;g<c+1;g++)e.push(d.path(f).attr({stroke:b.color,fill:b.fill?b.color:"none","stroke-linejoin":"round","stroke-linecap":"round","stroke-width":+(b.width/c*g).toFixed(3),opacity:+(b.opacity/c).toFixed(3)}));return e.insertBefore(this).translate(b.offsetx,b.offsety)};var cr={},cs=function(b,c,d,e,f,g,h,i,j){return j==null?bB(b,c,d,e,f,g,h,i):a.findDotsAtSegment(b,c,d,e,f,g,h,i,bC(b,c,d,e,f,g,h,i,j))},ct=function(b,c){return function(d,e,f){d=bR(d);var g,h,i,j,k="",l={},m,n=0;for(var o=0,p=d.length;o<p;o++){i=d[o];if(i[0]=="M")g=+i[1],h=+i[2];else{j=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6]);if(n+j>e){if(c&&!l.start){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n),k+=["C"+m.start.x,m.start.y,m.m.x,m.m.y,m.x,m.y];if(f)return k;l.start=k,k=["M"+m.x,m.y+"C"+m.n.x,m.n.y,m.end.x,m.end.y,i[5],i[6]].join(),n+=j,g=+i[5],h=+i[6];continue}if(!b&&!c){m=cs(g,h,i[1],i[2],i[3],i[4],i[5],i[6],e-n);return{x:m.x,y:m.y,alpha:m.alpha}}}n+=j,g=+i[5],h=+i[6]}k+=i.shift()+i}l.end=k,m=b?n:c?l:a.findDotsAtSegment(g,h,i[0],i[1],i[2],i[3],i[4],i[5],1),m.alpha&&(m={x:m.x,y:m.y,alpha:m.alpha});return m}},cu=ct(1),cv=ct(),cw=ct(0,1);a.getTotalLength=cu,a.getPointAtLength=cv,a.getSubpath=function(a,b,c){if(this.getTotalLength(a)-c<1e-6)return cw(a,b).end;var d=cw(a,c,1);return b?cw(d,b).end:d},cl.getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return cu(this.attrs.path)}},cl.getPointAtLength=function(a){if(this.type=="path")return cv(this.attrs.path,a)},cl.getSubpath=function(b,c){if(this.type=="path")return a.getSubpath(this.attrs.path,b,c)};var cx=a.easing_formulas={linear:function(a){return a},"<":function(a){return A(a,1.7)},">":function(a){return A(a,.48)},"<>":function(a){var b=.48-a/1.04,c=w.sqrt(.1734+b*b),d=c-b,e=A(z(d),1/3)*(d<0?-1:1),f=-c-b,g=A(z(f),1/3)*(f<0?-1:1),h=e+g+.5;return(1-h)*3*h*h+h*h*h},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a=a-1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==!!a)return a;return A(2,-10*a)*w.sin((a-.075)*2*B/.3)+1},bounce:function(a){var b=7.5625,c=2.75,d;a<1/c?d=b*a*a:a<2/c?(a-=1.5/c,d=b*a*a+.75):a<2.5/c?(a-=2.25/c,d=b*a*a+.9375):(a-=2.625/c,d=b*a*a+.984375);return d}};cx.easeIn=cx["ease-in"]=cx["<"],cx.easeOut=cx["ease-out"]=cx[">"],cx.easeInOut=cx["ease-in-out"]=cx["<>"],cx["back-in"]=cx.backIn,cx["back-out"]=cx.backOut;var cy=[],cz=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a){setTimeout(a,16)},cA=function(){var b=+(new Date),c=0;for(;c<cy.length;c++){var d=cy[c];if(d.el.removed||d.paused)continue;var e=b-d.start,f=d.ms,h=d.easing,i=d.from,j=d.diff,k=d.to,l=d.t,m=d.el,o={},p,r={},s;d.initstatus?(e=(d.initstatus*d.anim.top-d.prev)/(d.percent-d.prev)*f,d.status=d.initstatus,delete d.initstatus,d.stop&&cy.splice(c--,1)):d.status=(d.prev+(d.percent-d.prev)*(e/f))/d.anim.top;if(e<0)continue;if(e<f){var t=h(e/f);for(var u in i)if(i[g](u)){switch(U[u]){case C:p=+i[u]+t*f*j[u];break;case"colour":p="rgb("+[cB(O(i[u].r+t*f*j[u].r)),cB(O(i[u].g+t*f*j[u].g)),cB(O(i[u].b+t*f*j[u].b))].join(",")+")";break;case"path":p=[];for(var v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(var x=1,y=i[u][v].length;x<y;x++)p[v][x]=+i[u][v][x]+t*f*j[u][v][x];p[v]=p[v].join(q)}p=p.join(q);break;case"transform":if(j[u].real){p=[];for(v=0,w=i[u].length;v<w;v++){p[v]=[i[u][v][0]];for(x=1,y=i[u][v].length;x<y;x++)p[v][x]=i[u][v][x]+t*f*j[u][v][x]}}else{var z=function(a){return+i[u][a]+t*f*j[u][a]};p=[["m",z(0),z(1),z(2),z(3),z(4),z(5)]]}break;case"csv":if(u=="clip-rect"){p=[],v=4;while(v--)p[v]=+i[u][v]+t*f*j[u][v]}break;default:var A=[][n](i[u]);p=[],v=m.paper.customAttributes[u].length;while(v--)p[v]=+A[v]+t*f*j[u][v]}o[u]=p}m.attr(o),function(a,b,c){setTimeout(function(){eve("raphael.anim.frame."+a,b,c)})}(m.id,m,d.anim)}else{(function(b,c,d){setTimeout(function(){eve("raphael.anim.frame."+c.id,c,d),eve("raphael.anim.finish."+c.id,c,d),a.is(b,"function")&&b.call(c)})})(d.callback,m,d.anim),m.attr(k),cy.splice(c--,1);if(d.repeat>1&&!d.next){for(s in k)k[g](s)&&(r[s]=d.totalOrigin[s]);d.el.attr(r),cE(d.anim,d.el,d.anim.percents[0],null,d.totalOrigin,d.repeat-1)}d.next&&!d.stop&&cE(d.anim,d.el,d.next,null,d.totalOrigin,d.repeat)}}a.svg&&m&&m.paper&&m.paper.safari(),cy.length&&cz(cA)},cB=function(a){return a>255?255:a<0?0:a};cl.animateWith=function(b,c,d,e,f,g){var h=this;if(h.removed){g&&g.call(h);return h}var i=d instanceof cD?d:a.animation(d,e,f,g),j,k;cE(i,h,i.percents[0],null,h.attr());for(var l=0,m=cy.length;l<m;l++)if(cy[l].anim==c&&cy[l].el==b){cy[m-1].start=cy[l].start;break}return h},cl.onAnimation=function(a){a?eve.on("raphael.anim.frame."+this.id,a):eve.unbind("raphael.anim.frame."+this.id);return this},cD.prototype.delay=function(a){var b=new cD(this.anim,this.ms);b.times=this.times,b.del=+a||0;return b},cD.prototype.repeat=function(a){var b=new cD(this.anim,this.ms);b.del=this.del,b.times=w.floor(x(a,0))||1;return b},a.animation=function(b,c,d,e){if(b instanceof cD)return b;if(a.is(d,"function")||!d)e=e||d||null,d=null;b=Object(b),c=+c||0;var f={},h,i;for(i in b)b[g](i)&&Q(i)!=i&&Q(i)+"%"!=i&&(h=!0,f[i]=b[i]);if(!h)return new cD(b,c);d&&(f.easing=d),e&&(f.callback=e);return new cD({100:f},c)},cl.animate=function(b,c,d,e){var f=this;if(f.removed){e&&e.call(f);return f}var g=b instanceof cD?b:a.animation(b,c,d,e);cE(g,f,g.percents[0],null,f.attr());return f},cl.setTime=function(a,b){a&&b!=null&&this.status(a,y(b,a.ms)/a.ms);return this},cl.status=function(a,b){var c=[],d=0,e,f;if(b!=null){cE(a,this,-1,y(b,1));return this}e=cy.length;for(;d<e;d++){f=cy[d];if(f.el.id==this.id&&(!a||f.anim==a)){if(a)return f.status;c.push({anim:f.anim,status:f.status})}}if(a)return 0;return c},cl.pause=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.pause."+this.id,this,cy[b].anim)!==!1&&(cy[b].paused=!0);return this},cl.resume=function(a){for(var b=0;b<cy.length;b++)if(cy[b].el.id==this.id&&(!a||cy[b].anim==a)){var c=cy[b];eve("raphael.anim.resume."+this.id,this,c.anim)!==!1&&(delete c.paused,this.status(c.anim,c.status))}return this},cl.stop=function(a){for(var b=0;b<cy.length;b++)cy[b].el.id==this.id&&(!a||cy[b].anim==a)&&eve("raphael.anim.stop."+this.id,this,cy[b].anim)!==!1&&cy.splice(b--,1);return this},eve.on("raphael.remove",cF),eve.on("raphael.clear",cF),cl.toString=function(){return"Raphaël’s object"};var cG=function(a){this.items=[],this.length=0,this.type="set";if(a)for(var b=0,c=a.length;b<c;b++)a[b]&&(a[b].constructor==cl.constructor||a[b].constructor==cG)&&(this[this.items.length]=this.items[this.items.length]=a[b],this.length++)},cH=cG.prototype;cH.push=function(){var a,b;for(var c=0,d=arguments.length;c<d;c++)a=arguments[c],a&&(a.constructor==cl.constructor||a.constructor==cG)&&(b=this.items.length,this[b]=this.items[b]=a,this.length++);return this},cH.pop=function(){this.length&&delete this[this.length--];return this.items.pop()},cH.forEach=function(a,b){for(var c=0,d=this.items.length;c<d;c++)if(a.call(b,this.items[c],c)===!1)return this;return this};for(var cI in cl)cl[g](cI)&&(cH[cI]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a][m](c,b)})}}(cI));cH.attr=function(b,c){if(b&&a.is(b,E)&&a.is(b[0],"object"))for(var d=0,e=b.length;d<e;d++)this.items[d].attr(b[d]);else for(var f=0,g=this.items.length;f<g;f++)this.items[f].attr(b,c);return this},cH.clear=function(){while(this.length)this.pop()},cH.splice=function(a,b,c){a=a<0?x(this.length+a,0):a,b=x(0,y(this.length-a,b));var d=[],e=[],f=[],g;for(g=2;g<arguments.length;g++)f.push(arguments[g]);for(g=0;g<b;g++)e.push(this[a+g]);for(;g<this.length-a;g++)d.push(this[a+g]);var h=f.length;for(g=0;g<h+d.length;g++)this.items[a+g]=this[a+g]=g<h?f[g]:d[g-h];g=this.items.length=this.length-=b-h;while(this[g])delete this[g++];return new cG(e)},cH.exclude=function(a){for(var b=0,c=this.length;b<c;b++)if(this[b]==a){this.splice(b,1);return!0}},cH.animate=function(b,c,d,e){(a.is(d,"function")||!d)&&(e=d||null);var f=this.items.length,g=f,h,i=this,j;if(!f)return this;e&&(j=function(){!--f&&e.call(i)}),d=a.is(d,D)?d:j;var k=a.animation(b,c,d,j);h=this.items[--g].animate(k);while(g--)this.items[g]&&!this.items[g].removed&&this.items[g].animateWith(h,k,k);return this},cH.insertAfter=function(a){var b=this.items.length;while(b--)this.items[b].insertAfter(a);return this},cH.getBBox=function(){var a=[],b=[],c=[],d=[];for(var e=this.items.length;e--;)if(!this.items[e].removed){var f=this.items[e].getBBox();a.push(f.x),b.push(f.y),c.push(f.x+f.width),d.push(f.y+f.height)}a=y[m](0,a),b=y[m](0,b),c=x[m](0,c),d=x[m](0,d);return{x:a,y:b,x2:c,y2:d,width:c-a,height:d-b}},cH.clone=function(a){a=new cG;for(var b=0,c=this.items.length;b<c;b++)a.push(this.items[b].clone());return a},cH.toString=function(){return"Raphaël‘s set"},a.registerFont=function(a){if(!a.face)return a;this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)a.face[g](d)&&(b.face[d]=a.face[d]);this.fonts[c]?this.fonts[c].push(b):this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=R(a.face["units-per-em"],10);for(var e in a.glyphs)if(a.glyphs[g](e)){var f=a.glyphs[e];b.glyphs[e]={w:f.w,k:{},d:f.d&&"M"+f.d.replace(/[mlcxtrv]/g,function(a){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[a]||"M"})+"z"};if(f.k)for(var h in f.k)f[g](h)&&(b.glyphs[e].k[h]=f.k[h])}}return a},k.getFont=function(b,c,d,e){e=e||"normal",d=d||"normal",c=+c||{normal:400,bold:700,lighter:300,bolder:800}[c]||400;if(!!a.fonts){var f=a.fonts[b];if(!f){var h=new RegExp("(^|\\s)"+b.replace(/[^\w\d\s+!~.:_-]/g,p)+"(\\s|$)","i");for(var i in a.fonts)if(a.fonts[g](i)&&h.test(i)){f=a.fonts[i];break}}var j;if(f)for(var k=0,l=f.length;k<l;k++){j=f[k];if(j.face["font-weight"]==c&&(j.face["font-style"]==d||!j.face["font-style"])&&j.face["font-stretch"]==e)break}return j}},k.print=function(b,d,e,f,g,h,i){h=h||"middle",i=x(y(i||0,1),-1);var j=r(e)[s](p),k=0,l=0,m=p,n;a.is(f,e)&&(f=this.getFont(f));if(f){n=(g||16)/f.face["units-per-em"];var o=f.face.bbox[s](c),q=+o[0],t=o[3]-o[1],u=0,v=+o[1]+(h=="baseline"?t+ +f.face.descent:t/2);for(var w=0,z=j.length;w<z;w++){if(j[w]=="\n")k=0,B=0,l=0,u+=t;else{var A=l&&f.glyphs[j[w-1]]||{},B=f.glyphs[j[w]];k+=l?(A.w||f.w)+(A.k&&A.k[j[w]]||0)+f.w*i:0,l=1}B&&B.d&&(m+=a.transformPath(B.d,["t",k*n,u*n,"s",n,n,q,v,"t",(b-q)/n,(d-v)/n]))}}return this.path(m).attr({fill:"#000",stroke:"none"})},k.add=function(b){if(a.is(b,"array")){var c=this.set(),e=0,f=b.length,h;for(;e<f;e++)h=b[e]||{},d[g](h.type)&&c.push(this[h.type]().attr(h))}return c},a.format=function(b,c){var d=a.is(c,E)?[0][n](c):arguments;b&&a.is(b,D)&&d.length-1&&(b=b.replace(e,function(a,b){return d[++b]==null?p:d[b]}));return b||p},a.fullfill=function(){var a=/\{([^\}]+)\}/g,b=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g,c=function(a,c,d){var e=d;c.replace(b,function(a,b,c,d,f){b=b||d,e&&(b in e&&(e=e[b]),typeof e=="function"&&f&&(e=e()))}),e=(e==null||e==d?a:e)+"";return e};return function(b,d){return String(b).replace(a,function(a,b){return c(a,b,d)})}}(),a.ninja=function(){i.was?h.win.Raphael=i.is:delete Raphael;return a},a.st=cH,function(b,c,d){function e(){/in/.test(b.readyState)?setTimeout(e,9):a.eve("raphael.DOMload")}b.readyState==null&&b.addEventListener&&(b.addEventListener(c,d=function(){b.removeEventListener(c,d,!1),b.readyState="complete"},!1),b.readyState="loading"),e()}(document,"DOMContentLoaded"),i.was?h.win.Raphael=a:Raphael=a,eve.on("raphael.DOMload",function(){b=!0})}(),window.Raphael.svg&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=parseInt,f=Math,g=f.max,h=f.abs,i=f.pow,j=/[, ]+/,k=a.eve,l="",m=" ",n="http://www.w3.org/1999/xlink",o={block:"M5,0 0,2.5 5,5z",classic:"M5,0 0,2.5 5,5 3.5,3 3.5,2z",diamond:"M2.5,0 5,2.5 2.5,5 0,2.5z",open:"M6,1 1,3.5 6,6",oval:"M2.5,0A2.5,2.5,0,0,1,2.5,5 2.5,2.5,0,0,1,2.5,0z"},p={};a.toString=function(){return"Your browser supports SVG.\nYou are running Raphaël "+this.version};var q=function(d,e){if(e){typeof d=="string"&&(d=q(d));for(var f in e)e[b](f)&&(f.substring(0,6)=="xlink:"?d.setAttributeNS(n,f.substring(6),c(e[f])):d.setAttribute(f,c(e[f])))}else d=a._g.doc.createElementNS("http://www.w3.org/2000/svg",d),d.style&&(d.style.webkitTapHighlightColor="rgba(0,0,0,0)");return d},r=function(b,e){var j="linear",k=b.id+e,m=.5,n=.5,o=b.node,p=b.paper,r=o.style,s=a._g.doc.getElementById(k);if(!s){e=c(e).replace(a._radial_gradient,function(a,b,c){j="radial";if(b&&c){m=d(b),n=d(c);var e=(n>.5)*2-1;i(m-.5,2)+i(n-.5,2)>.25&&(n=f.sqrt(.25-i(m-.5,2))*e+.5)&&n!=.5&&(n=n.toFixed(5)-1e-5*e)}return l}),e=e.split(/\s*\-\s*/);if(j=="linear"){var t=e.shift();t=-d(t);if(isNaN(t))return null;var u=[0,0,f.cos(a.rad(t)),f.sin(a.rad(t))],v=1/(g(h(u[2]),h(u[3]))||1);u[2]*=v,u[3]*=v,u[2]<0&&(u[0]=-u[2],u[2]=0),u[3]<0&&(u[1]=-u[3],u[3]=0)}var w=a._parseDots(e);if(!w)return null;k=k.replace(/[\(\)\s,\xb0#]/g,"_"),b.gradient&&k!=b.gradient.id&&(p.defs.removeChild(b.gradient),delete b.gradient);if(!b.gradient){s=q(j+"Gradient",{id:k}),b.gradient=s,q(s,j=="radial"?{fx:m,fy:n}:{x1:u[0],y1:u[1],x2:u[2],y2:u[3],gradientTransform:b.matrix.invert()}),p.defs.appendChild(s);for(var x=0,y=w.length;x<y;x++)s.appendChild(q("stop",{offset:w[x].offset?w[x].offset:x?"100%":"0%","stop-color":w[x].color||"#fff"}))}}q(o,{fill:"url(#"+k+")",opacity:1,"fill-opacity":1}),r.fill=l,r.opacity=1,r.fillOpacity=1;return 1},s=function(a){var b=a.getBBox(1);q(a.pattern,{patternTransform:a.matrix.invert()+" translate("+b.x+","+b.y+")"})},t=function(d,e,f){if(d.type=="path"){var g=c(e).toLowerCase().split("-"),h=d.paper,i=f?"end":"start",j=d.node,k=d.attrs,m=k["stroke-width"],n=g.length,r="classic",s,t,u,v,w,x=3,y=3,z=5;while(n--)switch(g[n]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":r=g[n];break;case"wide":y=5;break;case"narrow":y=2;break;case"long":x=5;break;case"short":x=2}r=="open"?(x+=2,y+=2,z+=2,u=1,v=f?4:1,w={fill:"none",stroke:k.stroke}):(v=u=x/2,w={fill:k.stroke,stroke:"none"}),d._.arrows?f?(d._.arrows.endPath&&p[d._.arrows.endPath]--,d._.arrows.endMarker&&p[d._.arrows.endMarker]--):(d._.arrows.startPath&&p[d._.arrows.startPath]--,d._.arrows.startMarker&&p[d._.arrows.startMarker]--):d._.arrows={};if(r!="none"){var A="raphael-marker-"+r,B="raphael-marker-"+i+r+x+y;a._g.doc.getElementById(A)?p[A]++:(h.defs.appendChild(q(q("path"),{"stroke-linecap":"round",d:o[r],id:A})),p[A]=1);var C=a._g.doc.getElementById(B),D;C?(p[B]++,D=C.getElementsByTagName("use")[0]):(C=q(q("marker"),{id:B,markerHeight:y,markerWidth:x,orient:"auto",refX:v,refY:y/2}),D=q(q("use"),{"xlink:href":"#"+A,transform:(f?"rotate(180 "+x/2+" "+y/2+") ":l)+"scale("+x/z+","+y/z+")","stroke-width":(1/((x/z+y/z)/2)).toFixed(4)}),C.appendChild(D),h.defs.appendChild(C),p[B]=1),q(D,w);var F=u*(r!="diamond"&&r!="oval");f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-F*m):(s=F*m,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),w={},w["marker-"+i]="url(#"+B+")";if(t||s)w.d=Raphael.getSubpath(k.path,s,t);q(j,w),d._.arrows[i+"Path"]=A,d._.arrows[i+"Marker"]=B,d._.arrows[i+"dx"]=F,d._.arrows[i+"Type"]=r,d._.arrows[i+"String"]=e}else f?(s=d._.arrows.startdx*m||0,t=a.getTotalLength(k.path)-s):(s=0,t=a.getTotalLength(k.path)-(d._.arrows.enddx*m||0)),d._.arrows[i+"Path"]&&q(j,{d:Raphael.getSubpath(k.path,s,t)}),delete d._.arrows[i+"Path"],delete d._.arrows[i+"Marker"],delete d._.arrows[i+"dx"],delete d._.arrows[i+"Type"],delete d._.arrows[i+"String"];for(w in p)if(p[b](w)&&!p[w]){var G=a._g.doc.getElementById(w);G&&G.parentNode.removeChild(G)}}},u={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},v=function(a,b,d){b=u[c(b).toLowerCase()];if(b){var e=a.attrs["stroke-width"]||"1",f={round:e,square:e,butt:0}[a.attrs["stroke-linecap"]||d["stroke-linecap"]]||0,g=[],h=b.length;while(h--)g[h]=b[h]*e+(h%2?1:-1)*f;q(a.node,{"stroke-dasharray":g.join(",")})}};k.on("raphael.util.attr.blur",function(a){this.blur(a)}),k.on("raphael.util.attr.cursor",function(a){this.node.style.cursor=a});var w=function(d,f){var i=d.node,m=d.attrs,o=i.style.visibility;i.style.visibility="hidden";for(var p in f){k("raphael.util.attr."+p,d,f[p]);if(f[b](p)){if(!a._availableAttrs[b](p))continue;var u=f[p];m[p]=u;switch(p){case"blur":d.blur(u);break;case"href":case"title":case"target":var w=i.parentNode;if(w.tagName.toLowerCase()!="a"){var x=q("a");w.insertBefore(x,i),x.appendChild(i),w=x}p=="target"?w.setAttributeNS(n,"show",u=="blank"?"new":u):w.setAttributeNS(n,p,u);break;case"cursor":break;case"transform":d.transform(u);break;case"arrow-start":t(d,u);break;case"arrow-end":t(d,u,1);break;case"clip-rect":var z=c(u).split(j);if(z.length==4){d.clip&&d.clip.parentNode.parentNode.removeChild(d.clip.parentNode);var A=q("clipPath"),B=q("rect");A.id=a.createUUID(),q(B,{x:z[0],y:z[1],width:z[2],height:z[3]}),A.appendChild(B),d.paper.defs.appendChild(A),q(i,{"clip-path":"url(#"+A.id+")"}),d.clip=B}if(!u){var C=i.getAttribute("clip-path");if(C){var D=a._g.doc.getElementById(C.replace(/(^url\(#|\)$)/g,l));D&&D.parentNode.removeChild(D),q(i,{"clip-path":l}),delete d.clip}}break;case"path":d.type=="path"&&(q(i,{d:u?m.path=a._pathToAbsolute(u):"M0,0"}),d._.dirty=1,d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1)));break;case"width":i.setAttribute(p,u),d._.dirty=1;if(m.fx)p="x",u=m.x;else break;case"x":m.fx&&(u=-m.x-(m.width||0));case"rx":if(p=="rx"&&d.type=="rect")break;case"cx":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"height":i.setAttribute(p,u),d._.dirty=1;if(m.fy)p="y",u=m.y;else break;case"y":m.fy&&(u=-m.y-(m.height||0));case"ry":if(p=="ry"&&d.type=="rect")break;case"cy":i.setAttribute(p,u),d.pattern&&s(d),d._.dirty=1;break;case"r":d.type=="rect"?q(i,{rx:u,ry:u}):i.setAttribute(p,u),d._.dirty=1;break;case"src":d.type=="image"&&i.setAttributeNS(n,"href",u);break;case"stroke-width":if(d._.sx!=1||d._.sy!=1)u/=g(h(d._.sx),h(d._.sy))||1;d.paper._vbSize&&(u*=d.paper._vbSize),i.setAttribute(p,u),m["stroke-dasharray"]&&v(d,m["stroke-dasharray"],f),d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"stroke-dasharray":v(d,u,f);break;case"fill":var F=c(u).match(a._ISURL);if(F){A=q("pattern");var G=q("image");A.id=a.createUUID(),q(A,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),q(G,{x:0,y:0,"xlink:href":F[1]}),A.appendChild(G),function(b){a._preload(F[1],function(){var a=this.offsetWidth,c=this.offsetHeight;q(b,{width:a,height:c}),q(G,{width:a,height:c}),d.paper.safari()})}(A),d.paper.defs.appendChild(A),q(i,{fill:"url(#"+A.id+")"}),d.pattern=A,d.pattern&&s(d);break}var H=a.getRGB(u);if(!H.error)delete f.gradient,delete m.gradient,!a.is(m.opacity,"undefined")&&a.is(f.opacity,"undefined")&&q(i,{opacity:m.opacity}),!a.is(m["fill-opacity"],"undefined")&&a.is(f["fill-opacity"],"undefined")&&q(i,{"fill-opacity":m["fill-opacity"]});else if((d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u)){if("opacity"in m||"fill-opacity"in m){var I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l));if(I){var J=I.getElementsByTagName("stop");q(J[J.length-1],{"stop-opacity":("opacity"in m?m.opacity:1)*("fill-opacity"in m?m["fill-opacity"]:1)})}}m.gradient=u,m.fill="none";break}H[b]("opacity")&&q(i,{"fill-opacity":H.opacity>1?H.opacity/100:H.opacity});case"stroke":H=a.getRGB(u),i.setAttribute(p,H.hex),p=="stroke"&&H[b]("opacity")&&q(i,{"stroke-opacity":H.opacity>1?H.opacity/100:H.opacity}),p=="stroke"&&d._.arrows&&("startString"in d._.arrows&&t(d,d._.arrows.startString),"endString"in d._.arrows&&t(d,d._.arrows.endString,1));break;case"gradient":(d.type=="circle"||d.type=="ellipse"||c(u).charAt()!="r")&&r(d,u);break;case"opacity":m.gradient&&!m[b]("stroke-opacity")&&q(i,{"stroke-opacity":u>1?u/100:u});case"fill-opacity":if(m.gradient){I=a._g.doc.getElementById(i.getAttribute("fill").replace(/^url\(#|\)$/g,l)),I&&(J=I.getElementsByTagName("stop"),q(J[J.length-1],{"stop-opacity":u}));break};default:p=="font-size"&&(u=e(u,10)+"px");var K=p.replace(/(\-.)/g,function(a){return a.substring(1).toUpperCase()});i.style[K]=u,d._.dirty=1,i.setAttribute(p,u)}}}y(d,f),i.style.visibility=o},x=1.2,y=function(d,f){if(d.type=="text"&&!!(f[b]("text")||f[b]("font")||f[b]("font-size")||f[b]("x")||f[b]("y"))){var g=d.attrs,h=d.node,i=h.firstChild?e(a._g.doc.defaultView.getComputedStyle(h.firstChild,l).getPropertyValue("font-size"),10):10;if(f[b]("text")){g.text=f.text;while(h.firstChild)h.removeChild(h.firstChild);var j=c(f.text).split("\n"),k=[],m;for(var n=0,o=j.length;n<o;n++)m=q("tspan"),n&&q(m,{dy:i*x,x:g.x}),m.appendChild(a._g.doc.createTextNode(j[n])),h.appendChild(m),k[n]=m}else{k=h.getElementsByTagName("tspan");for(n=0,o=k.length;n<o;n++)n?q(k[n],{dy:i*x,x:g.x}):q(k[0],{dy:0})}q(h,{x:g.x,y:g.y}),d._.dirty=1;var p=d._getBBox(),r=g.y-(p.y+p.height/2);r&&a.is(r,"finite")&&q(k[0],{dy:r})}},z=function(b,c){var d=0,e=0;this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.matrix=a.matrix(),this.realPath=null,this.paper=c,this.attrs=this.attrs||{},this._={transform:[],sx:1,sy:1,deg:0,dx:0,dy:0,dirty:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},A=a.el;z.prototype=A,A.constructor=z,a._engine.path=function(a,b){var c=q("path");b.canvas&&b.canvas.appendChild(c);var d=new z(c,b);d.type="path",w(d,{fill:"none",stroke:"#000",path:a});return d},A.rotate=function(a,b,e){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this.transform(this._.transform.concat([["r",a,b,e]]));return this},A.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3])),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]]));return this},A.translate=function(a,b){if(this.removed)return this;a=c(a).split(j),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this.transform(this._.transform.concat([["t",a,b]]));return this},A.transform=function(c){var d=this._;if(c==null)return d.transform;a._extractTransform(this,c),this.clip&&q(this.clip,{transform:this.matrix.invert()}),this.pattern&&s(this),this.node&&q(this.node,{transform:this.matrix});if(d.sx!=1||d.sy!=1){var e=this.attrs[b]("stroke-width")?this.attrs["stroke-width"]:1;this.attr({"stroke-width":e})}return this},A.hide=function(){!this.removed&&this.paper.safari(this.node.style.display="none");return this},A.show=function(){!this.removed&&this.paper.safari(this.node.style.display="");return this},A.remove=function(){if(!this.removed&&!!this.node.parentNode){var b=this.paper;b.__set__&&b.__set__.exclude(this),k.unbind("raphael.*.*."+this.id),this.gradient&&b.defs.removeChild(this.gradient),a._tear(this,b),this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.removeChild(this.node.parentNode):this.node.parentNode.removeChild(this.node);for(var c in this)this[c]=typeof this[c]=="function"?a._removedFactory(c):null;this.removed=!0}},A._getBBox=function(){if(this.node.style.display=="none"){this.show();var a=!0}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=b||{}}a&&this.hide();return b},A.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c=="fill"&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;if(c=="transform")return this._.transform;var g=c.split(j),h={};for(var i=0,l=g.length;i<l;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return l-1?h:h[g[0]]}if(d==null&&a.is(c,"array")){h={};for(i=0,l=c.length;i<l;i++)h[c[i]]=this.attr(c[i]);return h}if(d!=null){var m={};m[c]=d}else c!=null&&a.is(c,"object")&&(m=c);for(var n in m)k("raphael.attr."+n+"."+this.id,this,m[n]);for(n in this.paper.customAttributes)if(this.paper.customAttributes[b](n)&&m[b](n)&&a.is(this.paper.customAttributes[n],"function")){var o=this.paper.customAttributes[n].apply(this,[].concat(m[n]));this.attrs[n]=m[n];for(var p in o)o[b](p)&&(m[p]=o[p])}w(this,m);return this},A.toFront=function(){if(this.removed)return this;this.node.parentNode.tagName.toLowerCase()=="a"?this.node.parentNode.parentNode.appendChild(this.node.parentNode):this.node.parentNode.appendChild(this.node);var b=this.paper;b.top!=this&&a._tofront(this,b);return this},A.toBack=function(){if(this.removed)return this;var b=this.node.parentNode;b.tagName.toLowerCase()=="a"?b.parentNode.insertBefore(this.node.parentNode,this.node.parentNode.parentNode.firstChild):b.firstChild!=this.node&&b.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper);var c=this.paper;return this},A.insertAfter=function(b){if(this.removed)return this;var c=b.node||b[b.length-1].node;c.nextSibling?c.parentNode.insertBefore(this.node,c.nextSibling):c.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},A.insertBefore=function(b){if(this.removed)return this;var c=b.node||b[0].node;c.parentNode.insertBefore(this.node,c),a._insertbefore(this,b,this.paper);return this},A.blur=function(b){var c=this;if(+b!==0){var d=q("filter"),e=q("feGaussianBlur");c.attrs.blur=b,d.id=a.createUUID(),q(e,{stdDeviation:+b||1.5}),d.appendChild(e),c.paper.defs.appendChild(d),c._blur=d,q(c.node,{filter:"url(#"+d.id+")"})}else c._blur&&(c._blur.parentNode.removeChild(c._blur),delete c._blur,delete c.attrs.blur),c.node.removeAttribute("filter")},a._engine.circle=function(a,b,c,d){var e=q("circle");a.canvas&&a.canvas.appendChild(e);var f=new z(e,a);f.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"},f.type="circle",q(e,f.attrs);return f},a._engine.rect=function(a,b,c,d,e,f){var g=q("rect");a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:b,y:c,width:d,height:e,r:f||0,rx:f||0,ry:f||0,fill:"none",stroke:"#000"},h.type="rect",q(g,h.attrs);return h},a._engine.ellipse=function(a,b,c,d,e){var f=q("ellipse");a.canvas&&a.canvas.appendChild(f);var g=new z(f,a);g.attrs={cx:b,cy:c,rx:d,ry:e,fill:"none",stroke:"#000"},g.type="ellipse",q(f,g.attrs);return g},a._engine.image=function(a,b,c,d,e,f){var g=q("image");q(g,{x:c,y:d,width:e,height:f,preserveAspectRatio:"none"}),g.setAttributeNS(n,"href",b),a.canvas&&a.canvas.appendChild(g);var h=new z(g,a);h.attrs={x:c,y:d,width:e,height:f,src:b},h.type="image";return h},a._engine.text=function(b,c,d,e){var f=q("text");b.canvas&&b.canvas.appendChild(f);var g=new z(f,b);g.attrs={x:c,y:d,"text-anchor":"middle",text:e,font:a._availableAttrs.font,stroke:"none",fill:"#000"},g.type="text",w(g,g.attrs);return g},a._engine.setSize=function(a,b){this.width=a||this.width,this.height=b||this.height,this.canvas.setAttribute("width",this.width),this.canvas.setAttribute("height",this.height),this._viewBox&&this.setViewBox.apply(this,this._viewBox);return this},a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b&&b.container,d=b.x,e=b.y,f=b.width,g=b.height;if(!c)throw new Error("SVG container not found.");var h=q("svg"),i="overflow:hidden;",j;d=d||0,e=e||0,f=f||512,g=g||342,q(h,{height:g,version:1.1,width:f,xmlns:"http://www.w3.org/2000/svg"}),c==1?(h.style.cssText=i+"position:absolute;left:"+d+"px;top:"+e+"px",a._g.doc.body.appendChild(h),j=1):(h.style.cssText=i+"position:relative",c.firstChild?c.insertBefore(h,c.firstChild):c.appendChild(h)),c=new a._Paper,c.width=f,c.height=g,c.canvas=h,c.clear(),c._left=c._top=0,j&&(c.renderfix=function(){}),c.renderfix();return c},a._engine.setViewBox=function(a,b,c,d,e){k("raphael.setViewBox",this,this._viewBox,[a,b,c,d,e]);var f=g(c/this.width,d/this.height),h=this.top,i=e?"meet":"xMinYMin",j,l;a==null?(this._vbSize&&(f=1),delete this._vbSize,j="0 0 "+this.width+m+this.height):(this._vbSize=f,j=a+m+b+m+c+m+d),q(this.canvas,{viewBox:j,preserveAspectRatio:i});while(f&&h)l="stroke-width"in h.attrs?h.attrs["stroke-width"]:1,h.attr({"stroke-width":l}),h._.dirty=1,h._.dirtyT=1,h=h.prev;this._viewBox=[a,b,c,d,!!e];return this},a.prototype.renderfix=function(){var a=this.canvas,b=a.style,c;try{c=a.getScreenCTM()||a.createSVGMatrix()}catch(d){c=a.createSVGMatrix()}var e=-c.e%1,f=-c.f%1;if(e||f)e&&(this._left=(this._left+e)%1,b.left=this._left+"px"),f&&(this._top=(this._top+f)%1,b.top=this._top+"px")},a.prototype.clear=function(){a.eve("raphael.clear",this);var b=this.canvas;while(b.firstChild)b.removeChild(b.firstChild);this.bottom=this.top=null,(this.desc=q("desc")).appendChild(a._g.doc.createTextNode("Created with Raphaël "+a.version)),b.appendChild(this.desc),b.appendChild(this.defs=q("defs"))},a.prototype.remove=function(){k("raphael.remove",this),this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null};var B=a.st;for(var C in A)A[b](C)&&!B[b](C)&&(B[C]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(C))}(window.Raphael),window.Raphael.vml&&function(a){var b="hasOwnProperty",c=String,d=parseFloat,e=Math,f=e.round,g=e.max,h=e.min,i=e.abs,j="fill",k=/[, ]+/,l=a.eve,m=" progid:DXImageTransform.Microsoft",n=" ",o="",p={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},q=/([clmz]),?([^clmz]*)/gi,r=/ progid:\S+Blur\([^\)]+\)/g,s=/-?[^,\s-]+/g,t="position:absolute;left:0;top:0;width:1px;height:1px",u=21600,v={path:1,rect:1,image:1},w={circle:1,ellipse:1},x=function(b){var d=/[ahqstv]/ig,e=a._pathToAbsolute;c(b).match(d)&&(e=a._path2curve),d=/[clmz]/g;if(e==a._pathToAbsolute&&!c(b).match(d)){var g=c(b).replace(q,function(a,b,c){var d=[],e=b.toLowerCase()=="m",g=p[b];c.replace(s,function(a){e&&d.length==2&&(g+=d+p[b=="m"?"l":"L"],d=[]),d.push(f(a*u))});return g+d});return g}var h=e(b),i,j;g=[];for(var k=0,l=h.length;k<l;k++){i=h[k],j=h[k][0].toLowerCase(),j=="z"&&(j="x");for(var m=1,r=i.length;m<r;m++)j+=f(i[m]*u)+(m!=r-1?",":o);g.push(j)}return g.join(n)},y=function(b,c,d){var e=a.matrix();e.rotate(-b,.5,.5);return{dx:e.x(c,d),dy:e.y(c,d)}},z=function(a,b,c,d,e,f){var g=a._,h=a.matrix,k=g.fillpos,l=a.node,m=l.style,o=1,p="",q,r=u/b,s=u/c;m.visibility="hidden";if(!!b&&!!c){l.coordsize=i(r)+n+i(s),m.rotation=f*(b*c<0?-1:1);if(f){var t=y(f,d,e);d=t.dx,e=t.dy}b<0&&(p+="x"),c<0&&(p+=" y")&&(o=-1),m.flip=p,l.coordorigin=d*-r+n+e*-s;if(k||g.fillsize){var v=l.getElementsByTagName(j);v=v&&v[0],l.removeChild(v),k&&(t=y(f,h.x(k[0],k[1]),h.y(k[0],k[1])),v.position=t.dx*o+n+t.dy*o),g.fillsize&&(v.size=g.fillsize[0]*i(b)+n+g.fillsize[1]*i(c)),l.appendChild(v)}m.visibility="visible"}};a.toString=function(){return"Your browser doesn’t support SVG. Falling down to VML.\nYou are running Raphaël "+this.version};var A=function(a,b,d){var e=c(b).toLowerCase().split("-"),f=d?"end":"start",g=e.length,h="classic",i="medium",j="medium";while(g--)switch(e[g]){case"block":case"classic":case"oval":case"diamond":case"open":case"none":h=e[g];break;case"wide":case"narrow":j=e[g];break;case"long":case"short":i=e[g]}var k=a.node.getElementsByTagName("stroke")[0];k[f+"arrow"]=h,k[f+"arrowlength"]=i,k[f+"arrowwidth"]=j},B=function(e,i){e.attrs=e.attrs||{};var l=e.node,m=e.attrs,p=l.style,q,r=v[e.type]&&(i.x!=m.x||i.y!=m.y||i.width!=m.width||i.height!=m.height||i.cx!=m.cx||i.cy!=m.cy||i.rx!=m.rx||i.ry!=m.ry||i.r!=m.r),s=w[e.type]&&(m.cx!=i.cx||m.cy!=i.cy||m.r!=i.r||m.rx!=i.rx||m.ry!=i.ry),t=e;for(var y in i)i[b](y)&&(m[y]=i[y]);r&&(m.path=a._getPath[e.type](e),e._.dirty=1),i.href&&(l.href=i.href),i.title&&(l.title=i.title),i.target&&(l.target=i.target),i.cursor&&(p.cursor=i.cursor),"blur"in i&&e.blur(i.blur);if(i.path&&e.type=="path"||r)l.path=x(~c(m.path).toLowerCase().indexOf("r")?a._pathToAbsolute(m.path):m.path),e.type=="image"&&(e._.fillpos=[m.x,m.y],e._.fillsize=[m.width,m.height],z(e,1,1,0,0,0));"transform"in i&&e.transform(i.transform);if(s){var B=+m.cx,D=+m.cy,E=+m.rx||+m.r||0,G=+m.ry||+m.r||0;l.path=a.format("ar{0},{1},{2},{3},{4},{1},{4},{1}x",f((B-E)*u),f((D-G)*u),f((B+E)*u),f((D+G)*u),f(B*u))}if("clip-rect"in i){var H=c(i["clip-rect"]).split(k);if(H.length==4){H[2]=+H[2]+ +H[0],H[3]=+H[3]+ +H[1];var I=l.clipRect||a._g.doc.createElement("div"),J=I.style;J.clip=a.format("rect({1}px {2}px {3}px {0}px)",H),l.clipRect||(J.position="absolute",J.top=0,J.left=0,J.width=e.paper.width+"px",J.height=e.paper.height+"px",l.parentNode.insertBefore(I,l),I.appendChild(l),l.clipRect=I)}i["clip-rect"]||l.clipRect&&(l.clipRect.style.clip="auto")}if(e.textpath){var K=e.textpath.style;i.font&&(K.font=i.font),i["font-family"]&&(K.fontFamily='"'+i["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,o)+'"'),i["font-size"]&&(K.fontSize=i["font-size"]),i["font-weight"]&&(K.fontWeight=i["font-weight"]),i["font-style"]&&(K.fontStyle=i["font-style"])}"arrow-start"in i&&A(t,i["arrow-start"]),"arrow-end"in i&&A(t,i["arrow-end"],1);if(i.opacity!=null||i["stroke-width"]!=null||i.fill!=null||i.src!=null||i.stroke!=null||i["stroke-width"]!=null||i["stroke-opacity"]!=null||i["fill-opacity"]!=null||i["stroke-dasharray"]!=null||i["stroke-miterlimit"]!=null||i["stroke-linejoin"]!=null||i["stroke-linecap"]!=null){var L=l.getElementsByTagName(j),M=!1;L=L&&L[0],!L&&(M=L=F(j)),e.type=="image"&&i.src&&(L.src=i.src),i.fill&&(L.on=!0);if(L.on==null||i.fill=="none"||i.fill===null)L.on=!1;if(L.on&&i.fill){var N=c(i.fill).match(a._ISURL);if(N){L.parentNode==l&&l.removeChild(L),L.rotate=!0,L.src=N[1],L.type="tile";var O=e.getBBox(1);L.position=O.x+n+O.y,e._.fillpos=[O.x,O.y],a._preload(N[1],function(){e._.fillsize=[this.offsetWidth,this.offsetHeight]})}else L.color=a.getRGB(i.fill).hex,L.src=o,L.type="solid",a.getRGB(i.fill).error&&(t.type in{circle:1,ellipse:1}||c(i.fill).charAt()!="r")&&C(t,i.fill,L)&&(m.fill="none",m.gradient=i.fill,L.rotate=!1)}if("fill-opacity"in i||"opacity"in i){var P=((+m["fill-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+a.getRGB(i.fill).o+1||2)-1);P=h(g(P,0),1),L.opacity=P,L.src&&(L.color="none")}l.appendChild(L);var Q=l.getElementsByTagName("stroke")&&l.getElementsByTagName("stroke")[0],T=!1;!Q&&(T=Q=F("stroke"));if(i.stroke&&i.stroke!="none"||i["stroke-width"]||i["stroke-opacity"]!=null||i["stroke-dasharray"]||i["stroke-miterlimit"]||i["stroke-linejoin"]||i["stroke-linecap"])Q.on=!0;(i.stroke=="none"||i.stroke===null||Q.on==null||i.stroke==0||i["stroke-width"]==0)&&(Q.on=!1);var U=a.getRGB(i.stroke);Q.on&&i.stroke&&(Q.color=U.hex),P=((+m["stroke-opacity"]+1||2)-1)*((+m.opacity+1||2)-1)*((+U.o+1||2)-1);var V=(d(i["stroke-width"])||1)*.75;P=h(g(P,0),1),i["stroke-width"]==null&&(V=m["stroke-width"]),i["stroke-width"]&&(Q.weight=V),V&&V<1&&(P*=V)&&(Q.weight=1),Q.opacity=P,i["stroke-linejoin"]&&(Q.joinstyle=i["stroke-linejoin"]||"miter"),Q.miterlimit=i["stroke-miterlimit"]||8,i["stroke-linecap"]&&(Q.endcap=i["stroke-linecap"]=="butt"?"flat":i["stroke-linecap"]=="square"?"square":"round");if(i["stroke-dasharray"]){var W={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};Q.dashstyle=W[b](i["stroke-dasharray"])?W[i["stroke-dasharray"]]:o}T&&l.appendChild(Q)}if(t.type=="text"){t.paper.canvas.style.display=o;var X=t.paper.span,Y=100,Z=m.font&&m.font.match(/\d+(?:\.\d*)?(?=px)/);p=X.style,m.font&&(p.font=m.font),m["font-family"]&&(p.fontFamily=m["font-family"]),m["font-weight"]&&(p.fontWeight=m["font-weight"]),m["font-style"]&&(p.fontStyle=m["font-style"]),Z=d(m["font-size"]||Z&&Z[0])||10,p.fontSize=Z*Y+"px",t.textpath.string&&(X.innerHTML=c(t.textpath.string).replace(/</g,"<").replace(/&/g,"&").replace(/\n/g,"<br>"));var $=X.getBoundingClientRect();t.W=m.w=($.right-$.left)/Y,t.H=m.h=($.bottom-$.top)/Y,t.X=m.x,t.Y=m.y+t.H/2,("x"in i||"y"in i)&&(t.path.v=a.format("m{0},{1}l{2},{1}",f(m.x*u),f(m.y*u),f(m.x*u)+1));var _=["x","y","text","font","font-family","font-weight","font-style","font-size"];for(var ba=0,bb=_.length;ba<bb;ba++)if(_[ba]in i){t._.dirty=1;break}switch(m["text-anchor"]){case"start":t.textpath.style["v-text-align"]="left",t.bbx=t.W/2;break;case"end":t.textpath.style["v-text-align"]="right",t.bbx=-t.W/2;break;default:t.textpath.style["v-text-align"]="center",t.bbx=0}t.textpath.style["v-text-kern"]=!0}},C=function(b,f,g){b.attrs=b.attrs||{};var h=b.attrs,i=Math.pow,j,k,l="linear",m=".5 .5";b.attrs.gradient=f,f=c(f).replace(a._radial_gradient,function(a,b,c){l="radial",b&&c&&(b=d(b),c=d(c),i(b-.5,2)+i(c-.5,2)>.25&&(c=e.sqrt(.25-i(b-.5,2))*((c>.5)*2-1)+.5),m=b+n+c);return o}),f=f.split(/\s*\-\s*/);if(l=="linear"){var p=f.shift();p=-d(p);if(isNaN(p))return null}var q=a._parseDots(f);if(!q)return null;b=b.shape||b.node;if(q.length){b.removeChild(g),g.on=!0,g.method="none",g.color=q[0].color,g.color2=q[q.length-1].color;var r=[];for(var s=0,t=q.length;s<t;s++)q[s].offset&&r.push(q[s].offset+n+q[s].color);g.colors=r.length?r.join():"0% "+g.color,l=="radial"?(g.type="gradientTitle",g.focus="100%",g.focussize="0 0",g.focusposition=m,g.angle=0):(g.type="gradient",g.angle=(270-p)%360),b.appendChild(g)}return 1},D=function(b,c){this[0]=this.node=b,b.raphael=!0,this.id=a._oid++,b.raphaelid=this.id,this.X=0,this.Y=0,this.attrs={},this.paper=c,this.matrix=a.matrix(),this._={transform:[],sx:1,sy:1,dx:0,dy:0,deg:0,dirty:1,dirtyT:1},!c.bottom&&(c.bottom=this),this.prev=c.top,c.top&&(c.top.next=this),c.top=this,this.next=null},E=a.el;D.prototype=E,E.constructor=D,E.transform=function(b){if(b==null)return this._.transform;var d=this.paper._viewBoxShift,e=d?"s"+[d.scale,d.scale]+"-1-1t"+[d.dx,d.dy]:o,f;d&&(f=b=c(b).replace(/\.{3}|\u2026/g,this._.transform||o)),a._extractTransform(this,e+b);var g=this.matrix.clone(),h=this.skew,i=this.node,j,k=~c(this.attrs.fill).indexOf("-"),l=!c(this.attrs.fill).indexOf("url(");g.translate(-0.5,-0.5);if(l||k||this.type=="image"){h.matrix="1 0 0 1",h.offset="0 0",j=g.split();if(k&&j.noRotation||!j.isSimple){i.style.filter=g.toFilter();var m=this.getBBox(),p=this.getBBox(1),q=m.x-p.x,r=m.y-p.y;i.coordorigin=q*-u+n+r*-u,z(this,1,1,q,r,0)}else i.style.filter=o,z(this,j.scalex,j.scaley,j.dx,j.dy,j.rotate)}else i.style.filter=o,h.matrix=c(g),h.offset=g.offset();f&&(this._.transform=f);return this},E.rotate=function(a,b,e){if(this.removed)return this;if(a!=null){a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2])),a=d(a[0]),e==null&&(b=e);if(b==null||e==null){var f=this.getBBox(1);b=f.x+f.width/2,e=f.y+f.height/2}this._.dirtyT=1,this.transform(this._.transform.concat([["r",a,b,e]]));return this}},E.translate=function(a,b){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1])),a=d(a[0])||0,b=+b||0,this._.bbox&&(this._.bbox.x+=a,this._.bbox.y+=b),this.transform(this._.transform.concat([["t",a,b]]));return this},E.scale=function(a,b,e,f){if(this.removed)return this;a=c(a).split(k),a.length-1&&(b=d(a[1]),e=d(a[2]),f=d(a[3]),isNaN(e)&&(e=null),isNaN(f)&&(f=null)),a=d(a[0]),b==null&&(b=a),f==null&&(e=f);if(e==null||f==null)var g=this.getBBox(1);e=e==null?g.x+g.width/2:e,f=f==null?g.y+g.height/2:f,this.transform(this._.transform.concat([["s",a,b,e,f]])),this._.dirtyT=1;return this},E.hide=function(){!this.removed&&(this.node.style.display="none");return this},E.show=function(){!this.removed&&(this.node.style.display=o);return this},E._getBBox=function(){if(this.removed)return{};return{x:this.X+(this.bbx||0)-this.W/2,y:this.Y-this.H,width:this.W,height:this.H}},E.remove=function(){if(!this.removed&&!!this.node.parentNode){this.paper.__set__&&this.paper.__set__.exclude(this),a.eve.unbind("raphael.*.*."+this.id),a._tear(this,this.paper),this.node.parentNode.removeChild(this.node),this.shape&&this.shape.parentNode.removeChild(this.shape);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;this.removed=!0}},E.attr=function(c,d){if(this.removed)return this;if(c==null){var e={};for(var f in this.attrs)this.attrs[b](f)&&(e[f]=this.attrs[f]);e.gradient&&e.fill=="none"&&(e.fill=e.gradient)&&delete e.gradient,e.transform=this._.transform;return e}if(d==null&&a.is(c,"string")){if(c==j&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;var g=c.split(k),h={};for(var i=0,m=g.length;i<m;i++)c=g[i],c in this.attrs?h[c]=this.attrs[c]:a.is(this.paper.customAttributes[c],"function")?h[c]=this.paper.customAttributes[c].def:h[c]=a._availableAttrs[c];return m-1?h:h[g[0]]}if(this.attrs&&d==null&&a.is(c,"array")){h={};for(i=0,m=c.length;i<m;i++)h[c[i]]=this.attr(c[i]);return h}var n;d!=null&&(n={},n[c]=d),d==null&&a.is(c,"object")&&(n=c);for(var o in n)l("raphael.attr."+o+"."+this.id,this,n[o]);if(n){for(o in this.paper.customAttributes)if(this.paper.customAttributes[b](o)&&n[b](o)&&a.is(this.paper.customAttributes[o],"function")){var p=this.paper.customAttributes[o].apply(this,[].concat(n[o]));this.attrs[o]=n[o];for(var q in p)p[b](q)&&(n[q]=p[q])}n.text&&this.type=="text"&&(this.textpath.string=n.text),B(this,n)}return this},E.toFront=function(){!this.removed&&this.node.parentNode.appendChild(this.node),this.paper&&this.paper.top!=this&&a._tofront(this,this.paper);return this},E.toBack=function(){if(this.removed)return this;this.node.parentNode.firstChild!=this.node&&(this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild),a._toback(this,this.paper));return this},E.insertAfter=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[b.length-1]),b.node.nextSibling?b.node.parentNode.insertBefore(this.node,b.node.nextSibling):b.node.parentNode.appendChild(this.node),a._insertafter(this,b,this.paper);return this},E.insertBefore=function(b){if(this.removed)return this;b.constructor==a.st.constructor&&(b=b[0]),b.node.parentNode.insertBefore(this.node,b.node),a._insertbefore(this,b,this.paper);return this},E.blur=function(b){var c=this.node.runtimeStyle,d=c.filter;d=d.replace(r,o),+b!==0?(this.attrs.blur=b,c.filter=d+n+m+".Blur(pixelradius="+(+b||1.5)+")",c.margin=a.format("-{0}px 0 0 -{0}px",f(+b||1.5))):(c.filter=d,c.margin=0,delete this.attrs.blur)},a._engine.path=function(a,b){var c=F("shape");c.style.cssText=t,c.coordsize=u+n+u,c.coordorigin=b.coordorigin;var d=new D(c,b),e={fill:"none",stroke:"#000"};a&&(e.path=a),d.type="path",d.path=[],d.Path=o,B(d,e),b.canvas.appendChild(c);var f=F("skew");f.on=!0,c.appendChild(f),d.skew=f,d.transform(o);return d},a._engine.rect=function(b,c,d,e,f,g){var h=a._rectPath(c,d,e,f,g),i=b.path(h),j=i.attrs;i.X=j.x=c,i.Y=j.y=d,i.W=j.width=e,i.H=j.height=f,j.r=g,j.path=h,i.type="rect";return i},a._engine.ellipse=function(a,b,c,d,e){var f=a.path(),g=f.attrs;f.X=b-d,f.Y=c-e,f.W=d*2,f.H=e*2,f.type="ellipse",B(f,{cx:b,cy:c,rx:d,ry:e});return f},a._engine.circle=function(a,b,c,d){var e=a.path(),f=e.attrs;e.X=b-d,e.Y=c-d,e.W=e.H=d*2,e.type="circle",B(e,{cx:b,cy:c,r:d});return e},a._engine.image=function(b,c,d,e,f,g){var h=a._rectPath(d,e,f,g),i=b.path(h).attr({stroke:"none"}),k=i.attrs,l=i.node,m=l.getElementsByTagName(j)[0];k.src=c,i.X=k.x=d,i.Y=k.y=e,i.W=k.width=f,i.H=k.height=g,k.path=h,i.type="image",m.parentNode==l&&l.removeChild(m),m.rotate=!0,m.src=c,m.type="tile",i._.fillpos=[d,e],i._.fillsize=[f,g],l.appendChild(m),z(i,1,1,0,0,0);return i},a._engine.text=function(b,d,e,g){var h=F("shape"),i=F("path"),j=F("textpath");d=d||0,e=e||0,g=g||"",i.v=a.format("m{0},{1}l{2},{1}",f(d*u),f(e*u),f(d*u)+1),i.textpathok=!0,j.string=c(g),j.on=!0,h.style.cssText=t,h.coordsize=u+n+u,h.coordorigin="0 0";var k=new D(h,b),l={fill:"#000",stroke:"none",font:a._availableAttrs.font,text:g};k.shape=h,k.path=i,k.textpath=j,k.type="text",k.attrs.text=c(g),k.attrs.x=d,k.attrs.y=e,k.attrs.w=1,k.attrs.h=1,B(k,l),h.appendChild(j),h.appendChild(i),b.canvas.appendChild(h);var m=F("skew");m.on=!0,h.appendChild(m),k.skew=m,k.transform(o);return k},a._engine.setSize=function(b,c){var d=this.canvas.style;this.width=b,this.height=c,b==+b&&(b+="px"),c==+c&&(c+="px"),d.width=b,d.height=c,d.clip="rect(0 "+b+" "+c+" 0)",this._viewBox&&a._engine.setViewBox.apply(this,this._viewBox);return this},a._engine.setViewBox=function(b,c,d,e,f){a.eve("raphael.setViewBox",this,this._viewBox,[b,c,d,e,f]);var h=this.width,i=this.height,j=1/g(d/h,e/i),k,l;f&&(k=i/e,l=h/d,d*k<h&&(b-=(h-d*k)/2/k),e*l<i&&(c-=(i-e*l)/2/l)),this._viewBox=[b,c,d,e,!!f],this._viewBoxShift={dx:-b,dy:-c,scale:j},this.forEach(function(a){a.transform("...")});return this};var F;a._engine.initWin=function(a){var b=a.document;b.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!b.namespaces.rvml&&b.namespaces.add("rvml","urn:schemas-microsoft-com:vml"),F=function(a){return b.createElement("<rvml:"+a+' class="rvml">')}}catch(c){F=function(a){return b.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},a._engine.initWin(a._g.win),a._engine.create=function(){var b=a._getContainer.apply(0,arguments),c=b.container,d=b.height,e,f=b.width,g=b.x,h=b.y;if(!c)throw new Error("VML container not found.");var i=new a._Paper,j=i.canvas=a._g.doc.createElement("div"),k=j.style;g=g||0,h=h||0,f=f||512,d=d||342,i.width=f,i.height=d,f==+f&&(f+="px"),d==+d&&(d+="px"),i.coordsize=u*1e3+n+u*1e3,i.coordorigin="0 0",i.span=a._g.doc.createElement("span"),i.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",j.appendChild(i.span),k.cssText=a.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",f,d),c==1?(a._g.doc.body.appendChild(j),k.left=g+"px",k.top=h+"px",k.position="absolute"):c.firstChild?c.insertBefore(j,c.firstChild):c.appendChild(j),i.renderfix=function(){};return i},a.prototype.clear=function(){a.eve("raphael.clear",this),this.canvas.innerHTML=o,this.span=a._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},a.prototype.remove=function(){a.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas);for(var b in this)this[b]=typeof this[b]=="function"?a._removedFactory(b):null;return!0};var G=a.st;for(var H in E)E[b](H)&&!G[b](H)&&(G[H]=function(a){return function(){var b=arguments;return this.forEach(function(c){c[a].apply(c,b)})}}(H))}(window.Raphael) |
此 diff 太大无法显示。
1 | + window.onload = function () { | ||
2 | + var paper = Raphael("holder"); | ||
3 | + | ||
4 | + //var curve = paper.ellipse(100, 100, 1, 1).attr({"stroke-width": 0, fill: Color.red}); | ||
5 | + | ||
6 | + var text = "Betty Botter bought some butter but, she said, the butter's bitter. If I put it in my batter, it will make my batter bitter. But a bit of better butter will make my batter better. So, she bought a bit of butter, better than her bitter butter, and she put it in her batter, and the batter was not bitter. It was better Betty Botter bought a bit better butter."; | ||
7 | + var font = {font: "11px Arial", "font-style":"italic", opacity: 1, "fill": LABEL_COLOR, stroke: LABEL_COLOR, "stroke-width":.3}; | ||
8 | + var font = {font: "11px Arial", opacity: 1, "fill": LABEL_COLOR}; | ||
9 | + var boxWidth = 100 | ||
10 | + | ||
11 | + var AttributedStringIterator = function(text){ | ||
12 | + //this.text = this.rtrim(this.ltrim(text)); | ||
13 | + text = text.replace(/(\s)+/, " "); | ||
14 | + this.text = this.rtrim(text); | ||
15 | + /* | ||
16 | + if (beginIndex < 0 || beginIndex > endIndex || endIndex > length()) { | ||
17 | + throw new IllegalArgumentException("Invalid substring range"); | ||
18 | + } | ||
19 | + */ | ||
20 | + this.beginIndex = 0; | ||
21 | + this.endIndex = this.text.length; | ||
22 | + this.currentIndex = this.beginIndex; | ||
23 | + | ||
24 | + //console.group("[AttributedStringIterator]"); | ||
25 | + var i = 0; | ||
26 | + var string = this.text; | ||
27 | + var fullPos = 0; | ||
28 | + | ||
29 | + //console.log("string: \"" + string + "\", length: " + string.length); | ||
30 | + this.startWordOffsets = []; | ||
31 | + this.startWordOffsets.push(fullPos); | ||
32 | + | ||
33 | + // TODO: remove i 1000 | ||
34 | + while (i<1000) { | ||
35 | + var pos = string.search(/[ \t\n\f-\.\,]/); | ||
36 | + if (pos == -1) | ||
37 | + break; | ||
38 | + | ||
39 | + // whitespace start | ||
40 | + fullPos += pos; | ||
41 | + string = string.substr(pos); | ||
42 | + ////console.log("fullPos: " + fullPos + ", pos: " + pos + ", string: ", string); | ||
43 | + | ||
44 | + // remove whitespaces | ||
45 | + var pos = string.search(/[^ \t\n\f-\.\,]/); | ||
46 | + if (pos == -1) | ||
47 | + break; | ||
48 | + | ||
49 | + // whitespace end | ||
50 | + fullPos += pos; | ||
51 | + string = string.substr(pos); | ||
52 | + | ||
53 | + ////console.log("fullPos: " + fullPos); | ||
54 | + this.startWordOffsets.push(fullPos); | ||
55 | + | ||
56 | + i++; | ||
57 | + } | ||
58 | + //console.log("startWordOffsets: ", this.startWordOffsets); | ||
59 | + //console.groupEnd(); | ||
60 | + }; | ||
61 | + AttributedStringIterator.prototype = { | ||
62 | + getEndIndex: function(pos){ | ||
63 | + if (typeof(pos) == "undefined") | ||
64 | + return this.endIndex; | ||
65 | + | ||
66 | + var string = this.text.substr(pos, this.endIndex - pos); | ||
67 | + | ||
68 | + var posEndOfLine = string.search(/[\n]/); | ||
69 | + if (posEndOfLine == -1) | ||
70 | + return this.endIndex; | ||
71 | + else | ||
72 | + return pos + posEndOfLine; | ||
73 | + }, | ||
74 | + getBeginIndex: function(){ | ||
75 | + return this.beginIndex; | ||
76 | + }, | ||
77 | + isWhitespace: function(pos){ | ||
78 | + var str = this.text[pos]; | ||
79 | + var whitespaceChars = " \t\n\f"; | ||
80 | + | ||
81 | + return (whitespaceChars.indexOf(str) != -1); | ||
82 | + }, | ||
83 | + isNewLine: function(pos){ | ||
84 | + var str = this.text[pos]; | ||
85 | + var whitespaceChars = "\n"; | ||
86 | + | ||
87 | + return (whitespaceChars.indexOf(str) != -1); | ||
88 | + }, | ||
89 | + preceding: function(pos){ | ||
90 | + //console.group("[AttributedStringIterator.preceding]"); | ||
91 | + for(var i in this.startWordOffsets) { | ||
92 | + var startWordOffset = this.startWordOffsets[i]; | ||
93 | + if (pos < startWordOffset && i>0) { | ||
94 | + //console.log("startWordOffset: " + this.startWordOffsets[i-1]); | ||
95 | + //console.groupEnd(); | ||
96 | + return this.startWordOffsets[i-1]; | ||
97 | + } | ||
98 | + } | ||
99 | + //console.log("pos: " + pos); | ||
100 | + //console.groupEnd(); | ||
101 | + return this.startWordOffsets[i]; | ||
102 | + }, | ||
103 | + following: function(pos){ | ||
104 | + //console.group("[AttributedStringIterator.following]"); | ||
105 | + for(var i in this.startWordOffsets) { | ||
106 | + var startWordOffset = this.startWordOffsets[i]; | ||
107 | + if (pos < startWordOffset && i>0) { | ||
108 | + //console.log("startWordOffset: " + this.startWordOffsets[i]); | ||
109 | + //console.groupEnd(); | ||
110 | + return this.startWordOffsets[i]; | ||
111 | + } | ||
112 | + } | ||
113 | + //console.log("pos: " + pos); | ||
114 | + //console.groupEnd(); | ||
115 | + return this.startWordOffsets[i]; | ||
116 | + }, | ||
117 | + ltrim: function(str){ | ||
118 | + var patt2=/^\s+/g; | ||
119 | + return str.replace(patt2, ""); | ||
120 | + }, | ||
121 | + rtrim: function(str){ | ||
122 | + var patt2=/\s+$/g; | ||
123 | + return str.replace(patt2, ""); | ||
124 | + }, | ||
125 | + getLayout: function(start, limit){ | ||
126 | + return this.text.substr(start, limit - start); | ||
127 | + }, | ||
128 | + getCharAtPos: function(pos) { | ||
129 | + return this.text[pos]; | ||
130 | + } | ||
131 | + }; | ||
132 | + | ||
133 | + /* | ||
134 | + var TextMeasurer = function(paper, text, fontAttrs){ | ||
135 | + this.text = text; | ||
136 | + this.paper = paper; | ||
137 | + this.fontAttrs = fontAttrs; | ||
138 | + | ||
139 | + this.fStart = this.text.getBeginIndex(); | ||
140 | + | ||
141 | + }; | ||
142 | + TextMeasurer.prototype = { | ||
143 | + getLineBreakIndex: function(start, maxAdvance){ | ||
144 | + var localStart = start - this.fStart; | ||
145 | + }, | ||
146 | + getLayout: function(){ | ||
147 | + } | ||
148 | + } | ||
149 | + */ | ||
150 | + | ||
151 | + | ||
152 | + var LineBreakMeasurer = function(paper, text, fontAttrs){ | ||
153 | + this.paper = paper; | ||
154 | + this.text = new AttributedStringIterator(text); | ||
155 | + this.fontAttrs = fontAttrs; | ||
156 | + | ||
157 | + if (this.text.getEndIndex() - this.text.getBeginIndex() < 1) { | ||
158 | + throw {message: "Text must contain at least one character.", code: "IllegalArgumentException"}; | ||
159 | + } | ||
160 | + | ||
161 | + //this.measurer = new TextMeasurer(paper, this.text, this.fontAttrs); | ||
162 | + this.limit = this.text.getEndIndex(); | ||
163 | + this.pos = this.start = this.text.getBeginIndex(); | ||
164 | + | ||
165 | + this.rafaelTextObject = this.paper.text(100, 100, this.text.text).attr(fontAttrs).attr("text-anchor", "start"); | ||
166 | + this.svgTextObject = this.rafaelTextObject[0]; | ||
167 | + }; | ||
168 | + LineBreakMeasurer.prototype = { | ||
169 | + nextOffset: function(wrappingWidth, offsetLimit, requireNextWord) { | ||
170 | + //console.group("[nextOffset]"); | ||
171 | + var nextOffset = this.pos; | ||
172 | + if (this.pos < this.limit) { | ||
173 | + if (offsetLimit <= this.pos) { | ||
174 | + throw {message: "offsetLimit must be after current position", code: "IllegalArgumentException"}; | ||
175 | + } | ||
176 | + | ||
177 | + var charAtMaxAdvance = this.getLineBreakIndex(this.pos, wrappingWidth); | ||
178 | + //charAtMaxAdvance --; | ||
179 | + //console.log("charAtMaxAdvance:", charAtMaxAdvance, ", [" + this.text.getCharAtPos(charAtMaxAdvance) + "]"); | ||
180 | + | ||
181 | + if (charAtMaxAdvance == this.limit) { | ||
182 | + nextOffset = this.limit; | ||
183 | + //console.log("charAtMaxAdvance == this.limit"); | ||
184 | + } else if (this.text.isNewLine(charAtMaxAdvance)) { | ||
185 | + console.log("isNewLine"); | ||
186 | + nextOffset = charAtMaxAdvance+1; | ||
187 | + } else if (this.text.isWhitespace(charAtMaxAdvance)) { | ||
188 | + // TODO: find next noSpaceChar | ||
189 | + //return nextOffset; | ||
190 | + nextOffset = this.text.following(charAtMaxAdvance); | ||
191 | + } else { | ||
192 | + // Break is in a word; back up to previous break. | ||
193 | + /* | ||
194 | + var testPos = charAtMaxAdvance + 1; | ||
195 | + if (testPos == this.limit) { | ||
196 | + console.error("hbz..."); | ||
197 | + } else { | ||
198 | + nextOffset = this.text.preceding(charAtMaxAdvance); | ||
199 | + } | ||
200 | + */ | ||
201 | + nextOffset = this.text.preceding(charAtMaxAdvance); | ||
202 | + | ||
203 | + if (nextOffset <= this.pos) { | ||
204 | + nextOffset = Math.max(this.pos+1, charAtMaxAdvance); | ||
205 | + } | ||
206 | + } | ||
207 | + } | ||
208 | + if (nextOffset > offsetLimit) { | ||
209 | + nextOffset = offsetLimit; | ||
210 | + } | ||
211 | + //console.log("nextOffset: " + nextOffset); | ||
212 | + //console.groupEnd(); | ||
213 | + return nextOffset; | ||
214 | + }, | ||
215 | + nextLayout: function(wrappingWidth) { | ||
216 | + //console.groupCollapsed("[nextLayout]"); | ||
217 | + if (this.pos < this.limit) { | ||
218 | + var requireNextWord = false; | ||
219 | + var layoutLimit = this.nextOffset(wrappingWidth, this.limit, requireNextWord); | ||
220 | + //console.log("layoutLimit:", layoutLimit); | ||
221 | + if (layoutLimit == this.pos) { | ||
222 | + //console.groupEnd(); | ||
223 | + return null; | ||
224 | + } | ||
225 | + var result = this.text.getLayout(this.pos, layoutLimit); | ||
226 | + //console.log("layout: \"" + result + "\""); | ||
227 | + | ||
228 | + // remove end of line | ||
229 | + | ||
230 | + //var posEndOfLine = this.text.getEndIndex(this.pos); | ||
231 | + //if (posEndOfLine < result.length) | ||
232 | + // result = result.substr(0, posEndOfLine); | ||
233 | + | ||
234 | + this.pos = layoutLimit; | ||
235 | + | ||
236 | + //console.groupEnd(); | ||
237 | + return result; | ||
238 | + } else { | ||
239 | + //console.groupEnd(); | ||
240 | + return null; | ||
241 | + } | ||
242 | + }, | ||
243 | + getLineBreakIndex: function(pos, wrappingWidth) { | ||
244 | + //console.group("[getLineBreakIndex]"); | ||
245 | + //console.log("pos:"+pos + ", text: \""+ this.text.text.replace(/\n/g, "_").substr(pos, 1) + "\""); | ||
246 | + | ||
247 | + var bb = this.rafaelTextObject.getBBox(); | ||
248 | + | ||
249 | + var charNum = -1; | ||
250 | + try { | ||
251 | + var svgPoint = this.svgTextObject.getStartPositionOfChar(pos); | ||
252 | + //var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.blue}); | ||
253 | + svgPoint.x = svgPoint.x + wrappingWidth; | ||
254 | + //svgPoint.y = bb.y; | ||
255 | + //console.log("svgPoint:", svgPoint); | ||
256 | + | ||
257 | + //var dot = this.paper.ellipse(svgPoint.x, svgPoint.y, 1, 1).attr({"stroke-width": 0, fill: Color.red}); | ||
258 | + | ||
259 | + charNum = this.svgTextObject.getCharNumAtPosition(svgPoint); | ||
260 | + } catch (e){ | ||
261 | + console.warn("getStartPositionOfChar error, pos:" + pos); | ||
262 | + /* | ||
263 | + var testPos = pos + 1; | ||
264 | + if (testPos < this.limit) { | ||
265 | + return testPos | ||
266 | + } | ||
267 | + */ | ||
268 | + } | ||
269 | + //console.log("charNum:", charNum); | ||
270 | + if (charNum == -1) { | ||
271 | + //console.groupEnd(); | ||
272 | + return this.text.getEndIndex(pos); | ||
273 | + } else { | ||
274 | + // When case there is new line between pos and charnum then use this new line | ||
275 | + var newLineIndex = this.text.getEndIndex(pos); | ||
276 | + if (newLineIndex < charNum ) { | ||
277 | + console.log("newLineIndex <= charNum, newLineIndex:"+newLineIndex+", charNum:"+charNum, "\"" + this.text.text.substr(newLineIndex+1).replace(/\n/g, "↵") + "\""); | ||
278 | + //console.groupEnd(); | ||
279 | + | ||
280 | + return newLineIndex; | ||
281 | + } | ||
282 | + | ||
283 | + //var charAtMaxAdvance = this.text.text.substring(charNum, charNum + 1); | ||
284 | + var charAtMaxAdvance = this.text.getCharAtPos(charNum); | ||
285 | + //console.log("!!charAtMaxAdvance: " + charAtMaxAdvance); | ||
286 | + //console.groupEnd(); | ||
287 | + return charNum; | ||
288 | + } | ||
289 | + }, | ||
290 | + getPosition: function() { | ||
291 | + return this.pos; | ||
292 | + } | ||
293 | + }; | ||
294 | + | ||
295 | + | ||
296 | + | ||
297 | + // ****** | ||
298 | + function drawMultilineText(text, x, y, boxWidth, boxHeight, options) { | ||
299 | + var TEXT_PADDING = 3; | ||
300 | + var width = boxWidth - (2 * TEXT_PADDING); | ||
301 | + if (boxHeight) | ||
302 | + var height = boxHeight - (2 * TEXT_PADDING); | ||
303 | + | ||
304 | + var layouts = []; | ||
305 | + | ||
306 | + var measurer = new LineBreakMeasurer(paper, text, font); | ||
307 | + var lineHeight = measurer.rafaelTextObject.getBBox().height; | ||
308 | + console.log("text: ", text.replace(/\n/g, "↵")); | ||
309 | + | ||
310 | + if (height) { | ||
311 | + var availableLinesCount = parseInt(height/lineHeight); | ||
312 | + console.log("availableLinesCount: " + availableLinesCount); | ||
313 | + } | ||
314 | + | ||
315 | + var i = 1; | ||
316 | + while (measurer.getPosition() < measurer.text.getEndIndex()) { | ||
317 | + var layout = measurer.nextLayout(width); | ||
318 | + //console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition()); | ||
319 | + | ||
320 | + if (layout != null) { | ||
321 | + if (!availableLinesCount || i < availableLinesCount) { | ||
322 | + layouts.push(layout); | ||
323 | + } else { | ||
324 | + layouts.push(fitTextToWidth(layout + "...", boxWidth)); | ||
325 | + break; | ||
326 | + } | ||
327 | + } | ||
328 | + i++; | ||
329 | + }; | ||
330 | + console.log(layouts); | ||
331 | + | ||
332 | + measurer.rafaelTextObject.attr({"text": layouts.join("\n")}); | ||
333 | + //measurer.rafaelTextObject.attr({"text-anchor": "end"}); | ||
334 | + //measurer.rafaelTextObject.attr({"text-anchor": "middle"}); | ||
335 | + if (options) | ||
336 | + measurer.rafaelTextObject.attr({"text-anchor": options["text-anchor"]}); | ||
337 | + | ||
338 | + var bb = measurer.rafaelTextObject.getBBox(); | ||
339 | + //measurer.rafaelTextObject.attr({"x": x + boxWidth/2}); | ||
340 | + if (options["vertical-align"] == "top") | ||
341 | + measurer.rafaelTextObject.attr({"y": y + bb.height/2 + TEXT_PADDING}); | ||
342 | + else | ||
343 | + measurer.rafaelTextObject.attr({"y": y + height/2}); | ||
344 | + //var bb = measurer.rafaelTextObject.getBBox(); | ||
345 | + | ||
346 | + if (measurer.rafaelTextObject.attr("text-anchor") == "middle" ) | ||
347 | + measurer.rafaelTextObject.attr("x", x + boxWidth/2 + TEXT_PADDING/2); | ||
348 | + else if (measurer.rafaelTextObject.attr("text-anchor") == "end" ) | ||
349 | + measurer.rafaelTextObject.attr("x", x + boxWidth + TEXT_PADDING/2); | ||
350 | + else | ||
351 | + measurer.rafaelTextObject.attr("x", x + boxWidth/2 - bb.width/2 + TEXT_PADDING/2); | ||
352 | + | ||
353 | + var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "}; | ||
354 | + /* | ||
355 | + var box = paper.rect(x+.0 + boxWidth/2 - bb.width/2+ TEXT_PADDING/2, y + .5 + boxHeight/2 - bb.height/2, width, height).attr(boxStyle); | ||
356 | + box.attr("height", bb.height); | ||
357 | + */ | ||
358 | + //var box = paper.rect(bb.x - .5 + bb.width/2 + TEXT_PADDING, bb.y + bb.height/2, bb.width, bb.height).attr(boxStyle); | ||
359 | + | ||
360 | + var textAreaCX = x + boxWidth/2; | ||
361 | + var textAreaCY = y + height/2; | ||
362 | + var dotLeftTop = paper.ellipse(x, y, 3, 3).attr({"stroke-width": 0, fill: Color.LightSteelBlue, stroke: "none"}); | ||
363 | + var dotCenter = paper.ellipse(textAreaCX, textAreaCY, 3, 3).attr({fill: Color.LightSteelBlue2, stroke: "none"}); | ||
364 | + | ||
365 | + /* | ||
366 | + // real bbox | ||
367 | + var bb = measurer.rafaelTextObject.getBBox(); | ||
368 | + var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1}); | ||
369 | + */ | ||
370 | + var boxStyle = {stroke: Color.LightSteelBlue2, "stroke-width": 1.0, "stroke-dasharray": "- "}; | ||
371 | + var rect = paper.rect(x+.5, y + .5, boxWidth, boxHeight).attr(boxStyle); | ||
372 | + } | ||
373 | + | ||
374 | + | ||
375 | + | ||
376 | + | ||
377 | + /* | ||
378 | + for (var i=0; i<1; i++) { | ||
379 | + var t = text; | ||
380 | + //var t = "Высококвалифицирова"; | ||
381 | + | ||
382 | + var text = paper.text(300, 100, t).attr(font).attr("text-anchor", "start"); | ||
383 | + var bbText = text.getBBox(); | ||
384 | + paper.rect(300+.5, 100 + .5, bbText.width, bbText.height).attr({"stroke-width": 1}); | ||
385 | + console.log("t: ", t.replace(/\n/g, "↵")); | ||
386 | + | ||
387 | + while (measurer.getPosition() < measurer.text.getEndIndex()) { | ||
388 | + var layout = measurer.nextLayout(width); | ||
389 | + //console.log("LAYOUT: " + layout + ", getPosition: " + measurer.getPosition()); | ||
390 | + if (layout != null) | ||
391 | + layouts.push(layout); | ||
392 | + }; | ||
393 | + | ||
394 | + measurer.rafaelTextObject.attr("text", layouts.join("\n")); | ||
395 | + var bb = measurer.rafaelTextObject.getBBox(); | ||
396 | + var rect = paper.rect(bb.x+.5, bb.y + .5, bb.width, bb.height).attr({"stroke-width": 1}); | ||
397 | + | ||
398 | + lay.push(layouts); | ||
399 | + console.log(layouts); | ||
400 | + } | ||
401 | + */ | ||
402 | + | ||
403 | + | ||
404 | + var fitTextToWidth = function(original, width) { | ||
405 | + var text = original; | ||
406 | + | ||
407 | + // TODO: move attr on parameters | ||
408 | + var attr = {font: "11px Arial", opacity: 0}; | ||
409 | + | ||
410 | + // remove length for "..." | ||
411 | + var dots = paper.text(0, 0, "...").attr(attr).hide(); | ||
412 | + var dotsBB = dots.getBBox(); | ||
413 | + | ||
414 | + var maxWidth = width - dotsBB.width; | ||
415 | + | ||
416 | + var textElement = paper.text(0, 0, text).attr(attr).hide(); | ||
417 | + var bb = textElement.getBBox(); | ||
418 | + | ||
419 | + // it's a little bit incorrect with "..." | ||
420 | + while (bb.width > maxWidth && text.length > 0) { | ||
421 | + text = text.substring(0, text.length - 1); | ||
422 | + textElement.attr({"text": text}); | ||
423 | + bb = textElement.getBBox(); | ||
424 | + } | ||
425 | + | ||
426 | + // remove element from paper | ||
427 | + textElement.remove(); | ||
428 | + | ||
429 | + if (text != original) { | ||
430 | + text = text + "..."; | ||
431 | + } | ||
432 | + | ||
433 | + return text; | ||
434 | + } | ||
435 | + | ||
436 | + | ||
437 | + var x=100, y=90, height=20; | ||
438 | + var options = {"text-anchor": "middle", "boxHeight": 150, "vertical-align": "top"}; | ||
439 | + var options = {"boxHeight": 150, "vertical-align": "top"}; | ||
440 | + drawMultilineText(text, x, y, 150, 100, options); | ||
441 | + }; |
src/main/webapp/act/diagram-viewer/style.css
0 → 100644
1 | +body { background: #fafafa; color: #708090; /* font: 300 100.1% "Helvetica Neue", Helvetica, "Arial Unicode MS", Arial, sans-serif; */ font-family: Verdana, sans-serif, Arial; font-size: 10px;}.wrapper{ height: 100%; position: relative; width: 100%;}/* #holder { height: 480px; width: 640px; b_ackground: #F8F8FF; -moz-border-radius: 10px; -webkit-border-radius: 10px; -webkit-box-shadow: 0 1px 3px #666; background: #DDD url(./images/bg.png); /* background: #DDD url(./images/checker-bg.png); * / b_order:0px solid #dedede; } */div.diagramHolder { float:left; }div.diagram{ border:1px solid #dedede; margin: 5px; padding: 5px; background: #FFF;}div.diagram.hidden{ display:none;}svg { background: #DDD url(./images/bg.png);} div.diagram-info { float:left; position: relative; padding: 5px;} /* Breadcrumbs */ #diagramBreadCrumbs { margin-left: 2px; margin-right: 2px; margin-top: 10px;}#diagramBreadCrumbs ul { list-style: none; background-color: white; border: 1px solid #DEDEDE; border-color: #C0C2C5; margin: 0; margin-bottom: 10px; margin-left: 0; -webkit-padding-start: 0px; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;}#diagramBreadCrumbs li { /*text-decoration: underline;*/ display: inline-block; vertical-align: middle; padding-left: .75em; padding-right: 0; cursor: pointer;}#diagramBreadCrumbs li.selected { color: #9370DB; color: #4876FF; color: #4F94CD; font-weight: bold;}#diagramBreadCrumbs li span { background: url(images/breadcrumbs.png) no-repeat 100% 50%; display: block; padding: .5em 15px .5em 0;} /* Progress bar */ .ui-progressbar { height: 25px; /*height:2em; text-align: left; overflow: hidden; */ background: white; border: 1px solid #949DAD; margin: 2px; overflow: hidden; padding: 1px; position: relative; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;}.ui-progressbar .ui-progressbar-value { m_argin: -1px; height:100%; background: #D4E4FF; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px;}.ui-widget-header a { color: #222222/*{fcHeader}*/; } .ui-progressbar .ui-progressbar-label{ position: absolute; margin-top: 7px; border:0px solid red; width: 100%; text-align: center;} |
-
请 注册 或 登录 后发表评论