1/**
2 * $Id: mxBasic.js,v 1.5 2016/04/1 12:32:06 mate Exp $
3 * Copyright (c) 2006-2018, JGraph Ltd
4 */
5//**********************************************************************************************************************************************************
6// Cross
7//**********************************************************************************************************************************************************
8/**
9* Extends mxShape.
10*/
11function mxShapeBasicCross(bounds, fill, stroke, strokewidth)
12{
13	mxShape.call(this);
14	this.bounds = bounds;
15	this.fill = fill;
16	this.stroke = stroke;
17	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
18	this.dx = 0.5;
19};
20
21/**
22* Extends mxShape.
23*/
24mxUtils.extend(mxShapeBasicCross, mxActor);
25
26mxShapeBasicCross.prototype.cst = {CROSS : 'mxgraph.basic.cross2'};
27
28/**
29* Function: paintVertexShape
30*
31* Paints the vertex shape.
32*/
33mxShapeBasicCross.prototype.paintVertexShape = function(c, x, y, w, h)
34{
35	c.translate(x, y);
36
37	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
38
39	c.begin();
40	c.moveTo(w * 0.5 + dx, 0);
41	c.lineTo(w * 0.5 + dx, h * 0.5 - dx);
42	c.lineTo(w, h * 0.5 - dx);
43	c.lineTo(w, h * 0.5 + dx);
44	c.lineTo(w * 0.5 + dx, h * 0.5 + dx);
45	c.lineTo(w * 0.5 + dx, h);
46	c.lineTo(w * 0.5 - dx, h);
47	c.lineTo(w * 0.5 - dx, h * 0.5 + dx);
48	c.lineTo(0, h * 0.5 + dx);
49	c.lineTo(0, h * 0.5 - dx);
50	c.lineTo(w * 0.5 - dx, h * 0.5 - dx);
51	c.lineTo(w * 0.5 - dx, 0);
52	c.close();
53	c.fillAndStroke();
54};
55
56mxCellRenderer.registerShape(mxShapeBasicCross.prototype.cst.CROSS, mxShapeBasicCross);
57
58mxShapeBasicCross.prototype.constraints = null;
59
60Graph.handleFactory[mxShapeBasicCross.prototype.cst.CROSS] = function(state)
61{
62	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
63	{
64		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
65
66		return new mxPoint(bounds.x + bounds.width / 2 + dx, bounds.y + bounds.height / 2 - dx);
67	}, function(bounds, pt)
68	{
69		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x - bounds.width / 2))) / 100;
70	})];
71
72	return handles;
73};
74
75//**********************************************************************************************************************************************************
76// Rectangular Callout
77//**********************************************************************************************************************************************************
78/**
79* Extends mxShape.
80*/
81function mxShapeBasicRectCallout(bounds, fill, stroke, strokewidth)
82{
83	mxShape.call(this);
84	this.bounds = bounds;
85	this.fill = fill;
86	this.stroke = stroke;
87	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
88	this.dy = 0.5;
89	this.dx = 0.5;
90};
91
92/**
93* Extends mxShape.
94*/
95mxUtils.extend(mxShapeBasicRectCallout, mxActor);
96
97mxShapeBasicRectCallout.prototype.customProperties = [
98	{name: 'dx', dispName: 'Callout Position', type: 'float', min:0, defVal:30},
99	{name: 'dy', dispName: 'Callout Size', type: 'float', min:0, defVal:15}
100];
101
102mxShapeBasicRectCallout.prototype.cst = {RECT_CALLOUT : 'mxgraph.basic.rectCallout'};
103
104/**
105* Function: paintVertexShape
106*
107* Paints the vertex shape.
108*/
109mxShapeBasicRectCallout.prototype.paintVertexShape = function(c, x, y, w, h)
110{
111	c.translate(x, y);
112
113	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
114	var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
115
116	c.begin();
117	c.moveTo(dx - dy * 0.5, h - dy);
118	c.lineTo(0, h - dy);
119	c.lineTo(0, 0);
120	c.lineTo(w, 0);
121	c.lineTo(w, h - dy);
122	c.lineTo(dx + dy * 0.5, h - dy);
123	c.lineTo(dx - dy, h);
124	c.close();
125	c.fillAndStroke();
126};
127
128mxShapeBasicRectCallout.prototype.getLabelMargins = function()
129{
130	if (mxUtils.getValue(this.style, 'boundedLbl', false))
131	{
132		return new mxRectangle(0, 0, 0, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy)) * this.scale);
133	}
134
135	return null;
136};
137
138mxCellRenderer.registerShape(mxShapeBasicRectCallout.prototype.cst.RECT_CALLOUT, mxShapeBasicRectCallout);
139
140Graph.handleFactory[mxShapeBasicRectCallout.prototype.cst.RECT_CALLOUT] = function(state)
141{
142	var handles = [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
143	{
144		var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
145		var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
146
147		return new mxPoint(bounds.x + dx, bounds.y + bounds.height - dy);
148	}, function(bounds, pt)
149	{
150		var y = parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) * 0.6;
151		this.state.style['dx'] = Math.round(100 * Math.max(y, Math.min(bounds.width - y, pt.x - bounds.x))) / 100;
152		this.state.style['dy'] = Math.round(Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y)));
153	})];
154
155	return handles;
156};
157
158mxShapeBasicRectCallout.prototype.getConstraints = function(style, w, h)
159{
160	var constr = [];
161	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
162	var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
163
164	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
165	constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
166	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
167	constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
168	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
169	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.5));
170	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy));
171	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx - dy, h));
172	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy));
173	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.5));
174
175	return (constr);
176}
177
178//**********************************************************************************************************************************************************
179// Rounded Rectangular Callout
180//**********************************************************************************************************************************************************
181/**
182* Extends mxShape.
183*/
184function mxShapeBasicRoundRectCallout(bounds, fill, stroke, strokewidth)
185{
186	mxShape.call(this);
187	this.bounds = bounds;
188	this.fill = fill;
189	this.stroke = stroke;
190	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
191	this.dy = 0.5;
192	this.dx = 0.5;
193	this.size = 10;
194};
195
196/**
197* Extends mxShape.
198*/
199mxUtils.extend(mxShapeBasicRoundRectCallout, mxActor);
200
201mxShapeBasicRoundRectCallout.prototype.cst = {ROUND_RECT_CALLOUT : 'mxgraph.basic.roundRectCallout'};
202
203mxShapeBasicRoundRectCallout.prototype.getLabelMargins = mxShapeBasicRectCallout.prototype.getLabelMargins;
204
205mxShapeBasicRoundRectCallout.prototype.customProperties = [
206	{name: 'size', dispName: 'Arc Size', type: 'float', min:0, defVal:5},
207	{name: 'dx', dispName: 'Callout Position', type: 'float', min:0, defVal:30},
208	{name: 'dy', dispName: 'Callout Size', type: 'float', min:0, defVal:15}
209];
210
211/**
212* Function: paintVertexShape
213*
214* Paints the vertex shape.
215*/
216mxShapeBasicRoundRectCallout.prototype.paintVertexShape = function(c, x, y, w, h)
217{
218	c.translate(x, y);
219
220	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
221	var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
222	var r = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'size', this.size))));
223
224	r = Math.min((h - dy) / 2, w / 2, r);
225	dx = Math.max(r + dy * 0.5, dx);
226	dx = Math.min(w - r - dy * 0.5, dx);
227
228	c.begin();
229	c.moveTo(dx - dy * 0.5, h - dy);
230	c.lineTo(r, h - dy);
231	c.arcTo(r, r, 0, 0, 1, 0, h - dy - r);
232	c.lineTo(0, r);
233	c.arcTo(r, r, 0, 0, 1, r, 0);
234	c.lineTo(w - r, 0);
235	c.arcTo(r, r, 0, 0, 1, w, r);
236	c.lineTo(w, h - dy - r);
237	c.arcTo(r, r, 0, 0, 1, w - r, h - dy);
238	c.lineTo(dx + dy * 0.5, h - dy);
239	c.arcTo(1.9 * dy, 1.4 * dy, 0, 0, 1, dx - dy, h);
240	c.arcTo(0.9 * dy, 1.4 * dy, 0, 0, 0, dx - dy * 0.5, h - dy);
241	c.close();
242	c.fillAndStroke();
243};
244
245mxCellRenderer.registerShape(mxShapeBasicRoundRectCallout.prototype.cst.ROUND_RECT_CALLOUT, mxShapeBasicRoundRectCallout);
246
247mxShapeBasicRoundRectCallout.prototype.constraints = null;
248
249Graph.handleFactory[mxShapeBasicRoundRectCallout.prototype.cst.ROUND_RECT_CALLOUT] = function(state)
250{
251	return [Graph.createHandle(state, ['dx', 'dy'], function(bounds)
252	{
253		var dx = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
254		var dy = Math.max(0, Math.min(bounds.height, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
255
256		return new mxPoint(bounds.x + dx, bounds.y + bounds.height - dy);
257	}, function(bounds, pt)
258	{
259		var y = parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy)) * 0.6;
260		this.state.style['dx'] = Math.round(100 * Math.max(y, Math.min(bounds.width - y, pt.x - bounds.x))) / 100;
261		this.state.style['dy'] = Math.round(Math.max(0, Math.min(bounds.height, bounds.y + bounds.height - pt.y)));
262	}), Graph.createHandle(state, ['size'], function(bounds)
263	{
264		var size = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'size', this.size))));
265
266		return new mxPoint(bounds.x + bounds.width - size, bounds.y + 10);
267	}, function(bounds, pt)
268	{
269		var dy = parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy));
270		this.state.style['size'] = Math.round(100 * Math.max(0, Math.min(bounds.width / 2, (bounds.height - dy) / 2, bounds.x + bounds.width - pt.x))) / 100;
271	})];
272};
273
274mxShapeBasicRoundRectCallout.prototype.getConstraints = function(style, w, h)
275{
276	var constr = [];
277	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
278	var dy = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
279	var r = Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'size', this.size))));
280
281	r = Math.min((h - dy) / 2, w / 2, r);
282	dx = Math.max(r + dy * 0.5, dx);
283	dx = Math.min(w - r - dy * 0.5, dx);
284
285	if (r < w * 0.25)
286	{
287		constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
288		constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
289	}
290
291	if (r < (h - dy) * 0.25)
292	{
293		constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.25));
294		constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.75));
295		constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.25));
296		constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.75));
297	}
298
299	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, r * 0.293, r * 0.293));
300	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
301	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - r * 0.293, r * 0.293));
302	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dy) * 0.5));
303	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dy) * 0.5));
304	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - r * 0.293, h - dy - r * 0.293));
305	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, r * 0.293, h - dy - r * 0.293));
306	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx - dy, h));
307
308	return (constr);
309}
310
311//**********************************************************************************************************************************************************
312// Wave
313//**********************************************************************************************************************************************************
314/**
315* Extends mxShape.
316*/
317function mxShapeBasicWave(bounds, fill, stroke, strokewidth)
318{
319	mxShape.call(this);
320	this.bounds = bounds;
321	this.fill = fill;
322	this.stroke = stroke;
323	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
324	this.dy = 0.5;
325};
326
327/**
328* Extends mxShape.
329*/
330mxUtils.extend(mxShapeBasicWave, mxActor);
331
332mxShapeBasicWave.prototype.customProperties = [
333	{name: 'dy', dispName: 'Wave Size', type: 'float', min:0, max:1, defVal: 0.3}
334];
335
336mxShapeBasicWave.prototype.cst = {WAVE : 'mxgraph.basic.wave2'};
337
338/**
339* Function: paintVertexShape
340*
341* Paints the vertex shape.
342*/
343mxShapeBasicWave.prototype.paintVertexShape = function(c, x, y, w, h)
344{
345	c.translate(x, y);
346
347	var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
348	var fy = 1.4
349
350	c.begin();
351	c.moveTo(0, dy / 2);
352	c.quadTo(w / 6, dy * (1 - fy), w / 3, dy / 2);
353	c.quadTo(w / 2, dy * fy, w * 2 / 3, dy / 2);
354	c.quadTo(w * 5 / 6, dy * (1 - fy), w, dy / 2);
355	c.lineTo(w, h - dy / 2);
356	c.quadTo(w * 5 / 6, h - dy * fy, w * 2 / 3, h - dy / 2);
357	c.quadTo(w / 2, h - dy * (1 - fy), w / 3, h - dy / 2);
358	c.quadTo(w / 6, h - dy * fy, 0, h - dy / 2);
359	c.close();
360	c.fillAndStroke();
361};
362
363mxCellRenderer.registerShape(mxShapeBasicWave.prototype.cst.WAVE, mxShapeBasicWave);
364
365mxShapeBasicWave.prototype.constraints = null;
366
367Graph.handleFactory[mxShapeBasicWave.prototype.cst.WAVE] = function(state)
368{
369	var handles = [Graph.createHandle(state, ['dy'], function(bounds)
370	{
371		var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
372
373		return new mxPoint(bounds.x + bounds.width / 2, bounds.y + dy * bounds.height);
374	}, function(bounds, pt)
375	{
376		this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;
377	})];
378
379	return handles;
380};
381
382mxShapeBasicWave.prototype.getConstraints = function(style, w, h)
383{
384	var constr = [];
385	var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
386	var fy = 1.4
387
388	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy * 0.5));
389	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 6, h * 0.015));
390	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 3, dy * 0.5));
391	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, dy * 0.95));
392	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.67, dy * 0.5));
393	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.83, h * 0.015));
394	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy * 0.5));
395	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.5));
396	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - dy * 0.5));
397	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.83, h - dy * 0.95));
398	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.67, h - dy * 0.5));
399	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h - dy * 0.04));
400	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 3, h - dy * 0.5));
401	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w / 6, h - dy * 0.95));
402	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dy * 0.5));
403	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.5));
404
405	return (constr);
406}
407
408//**********************************************************************************************************************************************************
409//Octagon
410//**********************************************************************************************************************************************************
411/**
412* Extends mxShape.
413*/
414function mxShapeBasicOctagon(bounds, fill, stroke, strokewidth)
415{
416	mxShape.call(this);
417	this.bounds = bounds;
418	this.fill = fill;
419	this.stroke = stroke;
420	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
421	this.dx = 0.5;
422};
423
424/**
425* Extends mxShape.
426*/
427mxUtils.extend(mxShapeBasicOctagon, mxActor);
428
429mxShapeBasicOctagon.prototype.customProperties = [
430	{name: 'dx', dispName: 'Cutoff Size', type: 'float', min:0, defVal:15}
431];
432
433mxShapeBasicOctagon.prototype.cst = {OCTAGON : 'mxgraph.basic.octagon2'};
434
435/**
436* Function: paintVertexShape
437*
438* Paints the vertex shape.
439*/
440mxShapeBasicOctagon.prototype.paintVertexShape = function(c, x, y, w, h)
441{
442	c.translate(x, y);
443
444	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
445
446	dx = Math.min(w * 0.5, h * 0.5, dx);
447
448	c.begin();
449	c.moveTo(dx, 0);
450	c.lineTo(w - dx, 0);
451	c.lineTo(w, dx);
452	c.lineTo(w, h - dx);
453	c.lineTo(w - dx, h);
454	c.lineTo(dx, h);
455	c.lineTo(0, h - dx);
456	c.lineTo(0, dx);
457	c.close();
458	c.fillAndStroke();
459};
460
461mxCellRenderer.registerShape(mxShapeBasicOctagon.prototype.cst.OCTAGON, mxShapeBasicOctagon);
462
463mxShapeBasicOctagon.prototype.constraints = null;
464
465Graph.handleFactory[mxShapeBasicOctagon.prototype.cst.OCTAGON] = function(state)
466{
467	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
468	{
469		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
470
471		return new mxPoint(bounds.x + dx, bounds.y + dx);
472	}, function(bounds, pt)
473	{
474		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
475	})];
476
477	return handles;
478};
479
480mxShapeBasicOctagon.prototype.getConstraints = function(style, w, h)
481{
482	var constr = [];
483	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
484
485	dx = Math.min(w * 0.5, h * 0.5, dx) * 0.5;
486
487	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
488	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
489	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
490	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
491	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));
492	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, dx));
493	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dx));
494	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h - dx));
495
496	return (constr);
497}
498
499//**********************************************************************************************************************************************************
500//Isometric Cube
501//**********************************************************************************************************************************************************
502/**
503* Extends mxShape.
504*/
505function mxShapeBasicIsoCube(bounds, fill, stroke, strokewidth)
506{
507	mxShape.call(this);
508	this.bounds = bounds;
509	this.fill = fill;
510	this.stroke = stroke;
511	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
512	this.isoAngle = 15;
513};
514
515/**
516* Extends mxShape.
517*/
518mxUtils.extend(mxShapeBasicIsoCube, mxActor);
519
520mxShapeBasicIsoCube.prototype.customProperties = [
521	{name: 'isoAngle', dispName: 'Perspective Angle', type: 'float', min:0, defVal:15}
522];
523
524mxShapeBasicIsoCube.prototype.cst = {ISO_CUBE : 'mxgraph.basic.isocube'};
525
526/**
527* Function: paintVertexShape
528*
529* Paints the vertex shape.
530*/
531mxShapeBasicIsoCube.prototype.paintVertexShape = function(c, x, y, w, h)
532{
533	c.translate(x, y);
534
535	var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;
536	var isoH = Math.min(w * Math.tan(isoAngle), h * 0.5);
537
538	c.begin();
539	c.moveTo(w * 0.5, 0);
540	c.lineTo(w, isoH);
541	c.lineTo(w, h - isoH);
542	c.lineTo(w * 0.5, h);
543	c.lineTo(0, h - isoH);
544	c.lineTo(0, isoH);
545	c.close();
546	c.fillAndStroke();
547
548	c.setShadow(false);
549
550	c.begin();
551	c.moveTo(0, isoH);
552	c.lineTo(w * 0.5, 2 * isoH);
553	c.lineTo(w, isoH);
554	c.moveTo(w * 0.5, 2 * isoH);
555	c.lineTo(w * 0.5, h);
556	c.stroke();
557};
558
559mxCellRenderer.registerShape(mxShapeBasicIsoCube.prototype.cst.ISO_CUBE, mxShapeBasicIsoCube);
560
561mxShapeBasicIsoCube.prototype.constraints = null;
562
563Graph.handleFactory[mxShapeBasicIsoCube.prototype.cst.ISO_CUBE] = function(state)
564{
565	var handles = [Graph.createHandle(state, ['isoAngle'], function(bounds)
566	{
567		var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.state.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;
568		var isoH = Math.min(bounds.width * Math.tan(isoAngle), bounds.height * 0.5);
569
570		return new mxPoint(bounds.x, bounds.y + isoH);
571	}, function(bounds, pt)
572	{
573		this.state.style['isoAngle'] = Math.round(100 * Math.max(0, Math.min(100, pt.y - bounds.y))) / 100;
574	})];
575
576	return handles;
577};
578
579mxShapeBasicIsoCube.prototype.getConstraints = function(style, w, h)
580{
581	var constr = [];
582	var isoAngle = Math.max(0.01, Math.min(94, parseFloat(mxUtils.getValue(this.style, 'isoAngle', this.isoAngle)))) * Math.PI / 200 ;
583	var isoH = Math.min(w * Math.tan(isoAngle), h * 0.5);
584
585	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
586	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, isoH));
587	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
588	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - isoH));
589	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
590	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - isoH));
591	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
592	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, isoH));
593
594	return (constr);
595}
596
597//**********************************************************************************************************************************************************
598//Acute Triangle
599//**********************************************************************************************************************************************************
600/**
601* Extends mxShape.
602*/
603function mxShapeBasicTriangleAcute(bounds, fill, stroke, strokewidth)
604{
605	mxShape.call(this);
606	this.bounds = bounds;
607	this.fill = fill;
608	this.stroke = stroke;
609	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
610	this.dx = 0.5;
611};
612
613/**
614* Extends mxShape.
615*/
616mxUtils.extend(mxShapeBasicTriangleAcute, mxActor);
617
618mxShapeBasicTriangleAcute.prototype.customProperties = [
619	{name: 'dx', dispName: 'Top', type: 'float', min:0, max:1, defVal:0.5}
620];
621
622mxShapeBasicTriangleAcute.prototype.cst = {ACUTE_TRIANGLE : 'mxgraph.basic.acute_triangle'};
623
624/**
625* Function: paintVertexShape
626*
627* Paints the vertex shape.
628*/
629mxShapeBasicTriangleAcute.prototype.paintVertexShape = function(c, x, y, w, h)
630{
631	c.translate(x, y);
632
633	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
634
635	c.begin();
636	c.moveTo(0, h);
637	c.lineTo(dx, 0);
638	c.lineTo(w, h);
639	c.close();
640	c.fillAndStroke();
641};
642
643mxCellRenderer.registerShape(mxShapeBasicTriangleAcute.prototype.cst.ACUTE_TRIANGLE, mxShapeBasicTriangleAcute);
644
645mxShapeBasicTriangleAcute.prototype.constraints = null;
646
647Graph.handleFactory[mxShapeBasicTriangleAcute.prototype.cst.ACUTE_TRIANGLE] = function(state)
648{
649	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
650	{
651		var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
652
653		return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 10);
654	}, function(bounds, pt)
655	{
656		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
657	})];
658
659	return handles;
660};
661
662mxShapeBasicTriangleAcute.prototype.getConstraints = function(style, w, h)
663{
664	var constr = [];
665	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
666
667	constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
668	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
669	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
670	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));
671	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h * 0.5));
672	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - (w - dx) * 0.5, h * 0.5));
673
674	return (constr);
675}
676
677//**********************************************************************************************************************************************************
678//Obtuse Triangle
679//**********************************************************************************************************************************************************
680/**
681* Extends mxShape.
682*/
683function mxShapeBasicTriangleObtuse(bounds, fill, stroke, strokewidth)
684{
685	mxShape.call(this);
686	this.bounds = bounds;
687	this.fill = fill;
688	this.stroke = stroke;
689	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
690	this.dx = 0.5;
691};
692
693/**
694* Extends mxShape.
695*/
696mxUtils.extend(mxShapeBasicTriangleObtuse, mxActor);
697
698mxShapeBasicTriangleObtuse.prototype.customProperties = [
699	{name: 'dx', dispName: 'Bottom', type: 'float', min:0, max:1, defVal:0.25}
700];
701
702mxShapeBasicTriangleObtuse.prototype.cst = {OBTUSE_TRIANGLE : 'mxgraph.basic.obtuse_triangle'};
703
704/**
705* Function: paintVertexShape
706*
707* Paints the vertex shape.
708*/
709mxShapeBasicTriangleObtuse.prototype.paintVertexShape = function(c, x, y, w, h)
710{
711	c.translate(x, y);
712
713	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
714
715	c.begin();
716	c.moveTo(dx, h);
717	c.lineTo(0, 0);
718	c.lineTo(w, h);
719	c.close();
720	c.fillAndStroke();
721};
722
723mxCellRenderer.registerShape(mxShapeBasicTriangleObtuse.prototype.cst.OBTUSE_TRIANGLE, mxShapeBasicTriangleObtuse);
724
725mxShapeBasicTriangleObtuse.prototype.constraints = null;
726
727Graph.handleFactory[mxShapeBasicTriangleObtuse.prototype.cst.OBTUSE_TRIANGLE] = function(state)
728{
729	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
730	{
731		var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
732
733		return new mxPoint(bounds.x + dx * bounds.width, bounds.y + bounds.height - 10);
734	}, function(bounds, pt)
735	{
736		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
737	})];
738
739	return handles;
740};
741
742mxShapeBasicTriangleObtuse.prototype.getConstraints = function(style, w, h)
743{
744	var constr = [];
745	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
746
747	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
748	constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
749	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h * 0.5));
750	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + dx) * 0.5, h));
751	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));
752	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h * 0.5));
753
754	return (constr);
755}
756
757//**********************************************************************************************************************************************************
758//Drop
759//**********************************************************************************************************************************************************
760/**
761* Extends mxShape.
762*/
763function mxShapeBasicDrop(bounds, fill, stroke, strokewidth)
764{
765	mxShape.call(this);
766	this.bounds = bounds;
767	this.fill = fill;
768	this.stroke = stroke;
769	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
770};
771
772/**
773* Extends mxShape.
774*/
775mxUtils.extend(mxShapeBasicDrop, mxActor);
776
777mxShapeBasicDrop.prototype.cst = {DROP : 'mxgraph.basic.drop'};
778
779/**
780* Function: paintVertexShape
781*
782* Paints the vertex shape.
783*/
784mxShapeBasicDrop.prototype.paintVertexShape = function(c, x, y, w, h)
785{
786	c.translate(x, y);
787
788	var r = Math.min(h, w) * 0.5;
789	var d = h - r;
790	var a = Math.sqrt(d * d - r * r);
791
792	var angle = Math.atan(a / r);
793
794	var x1 = r * Math.sin(angle);
795	var y1 = r * Math.cos(angle);
796
797	c.begin();
798	c.moveTo(w * 0.5, 0);
799	c.lineTo(w * 0.5 + x1, h - r - y1);
800	c.arcTo(r, r, 0, 0, 1, w * 0.5 + r, h - r);
801	c.arcTo(r, r, 0, 0, 1, w * 0.5, h);
802	c.arcTo(r, r, 0, 0, 1, w * 0.5 - r, h - r);
803	c.arcTo(r, r, 0, 0, 1, w * 0.5 - x1, h - r - y1);
804	c.close();
805	c.fillAndStroke();
806};
807
808mxCellRenderer.registerShape(mxShapeBasicDrop.prototype.cst.DROP, mxShapeBasicDrop);
809
810mxShapeBasicDrop.prototype.constraints = null;
811
812//**********************************************************************************************************************************************************
813//Cone 2
814//**********************************************************************************************************************************************************
815/**
816* Extends mxShape.
817*/
818function mxShapeBasicCone2(bounds, fill, stroke, strokewidth)
819{
820	mxShape.call(this);
821	this.bounds = bounds;
822	this.fill = fill;
823	this.stroke = stroke;
824	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
825	this.dx = 0.5;
826	this.dy = 0.9;
827};
828
829/**
830* Extends mxShape.
831*/
832mxUtils.extend(mxShapeBasicCone2, mxActor);
833
834mxShapeBasicCone2.prototype.customProperties = [
835	{name: 'dx', dispName: 'Top', type: 'float', min:0, max:1, defVal:0.5},
836	{name: 'dy', dispName: 'Bottom', type: 'float', min:0, max:1, defVal:0.9}
837];
838
839mxShapeBasicCone2.prototype.cst = {CONE2 : 'mxgraph.basic.cone2'};
840
841/**
842* Function: paintVertexShape
843*
844* Paints the vertex shape.
845*/
846mxShapeBasicCone2.prototype.paintVertexShape = function(c, x, y, w, h)
847{
848	c.translate(x, y);
849
850	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
851	var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
852
853	var ry = h - dy;
854
855	c.begin();
856	c.moveTo(dx, 0);
857
858	if (ry > 0)
859	{
860		c.lineTo(w, h - ry);
861		c.arcTo(w * 0.5, ry, 0, 0, 1, w * 0.5, h);
862		c.arcTo(w * 0.5, ry, 0, 0, 1, 0, h - ry);
863	}
864	else
865	{
866		c.lineTo(w, h);
867		c.lineTo(0, h);
868	}
869
870	c.close();
871	c.fillAndStroke();
872};
873
874mxCellRenderer.registerShape(mxShapeBasicCone2.prototype.cst.CONE2, mxShapeBasicCone2);
875
876mxShapeBasicCone2.prototype.constraints = null;
877
878Graph.handleFactory[mxShapeBasicCone2.prototype.cst.CONE2] = function(state)
879{
880	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
881	{
882		var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
883
884		return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 10);
885	}, function(bounds, pt)
886	{
887		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
888	})];
889
890	var handle2 = Graph.createHandle(state, ['dy'], function(bounds)
891	{
892		var dy = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
893
894		return new mxPoint(bounds.x + 10, bounds.y + dy * bounds.height);
895	}, function(bounds, pt)
896	{
897		this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;
898	});
899
900	handles.push(handle2);
901
902	return handles;
903};
904
905mxShapeBasicCone2.prototype.getConstraints = function(style, w, h)
906{
907	var constr = [];
908	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
909	var dy = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
910	var ry = h - dy;
911
912	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, 0));
913	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h - ry));
914	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.5, h));
915	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - ry));
916
917	return (constr);
918}
919
920//**********************************************************************************************************************************************************
921//Pyramid
922//**********************************************************************************************************************************************************
923/**
924* Extends mxShape.
925*/
926function mxShapeBasicPyramid(bounds, fill, stroke, strokewidth)
927{
928	mxShape.call(this);
929	this.bounds = bounds;
930	this.fill = fill;
931	this.stroke = stroke;
932	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
933	this.dx1 = 0.5;
934	this.dx2 = 0.6;
935	this.dy1 = 0.9;
936	this.dy2 = 0.8;
937};
938
939/**
940* Extends mxShape.
941*/
942mxUtils.extend(mxShapeBasicPyramid, mxActor);
943
944mxShapeBasicPyramid.prototype.customProperties = [
945	{name: 'dx1', dispName: 'Top', type: 'float', min:0, max:1, defVal:0.4},
946	{name: 'dx2', dispName: 'Bottom', type: 'float', min:0, max:1, defVal:0.6},
947	{name: 'dy1', dispName: 'Perspective Left', type: 'float', min:0, max:1, defVal:0.9},
948	{name: 'dy2', dispName: 'Perspective Right', type: 'float', min:0, max:1, defVal:0.8}
949];
950
951mxShapeBasicPyramid.prototype.cst = {PYRAMID : 'mxgraph.basic.pyramid'};
952
953/**
954* Function: paintVertexShape
955*
956* Paints the vertex shape.
957*/
958mxShapeBasicPyramid.prototype.paintVertexShape = function(c, x, y, w, h)
959{
960	c.translate(x, y);
961
962	var dx1 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
963	var dx2 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
964	var dy1 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
965	var dy2 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
966
967	c.begin();
968	c.moveTo(dx1, 0);
969	c.lineTo(w, dy2);
970	c.lineTo(dx2, h);
971	c.lineTo(0, dy1);
972	c.close();
973	c.fillAndStroke();
974
975	c.setShadow(false);
976
977	c.begin();
978	c.moveTo(dx1, 0);
979	c.lineTo(dx2, h);
980	c.stroke();
981};
982
983mxCellRenderer.registerShape(mxShapeBasicPyramid.prototype.cst.PYRAMID, mxShapeBasicPyramid);
984
985mxShapeBasicPyramid.prototype.constraints = null;
986
987Graph.handleFactory[mxShapeBasicPyramid.prototype.cst.PYRAMID] = function(state)
988{
989	var handles = [Graph.createHandle(state, ['dx1'], function(bounds)
990	{
991		var dx1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx1', this.dx1))));
992
993		return new mxPoint(bounds.x + dx1 * bounds.width, bounds.y + 10);
994	}, function(bounds, pt)
995	{
996		this.state.style['dx1'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
997	})];
998
999	var handle2 = Graph.createHandle(state, ['dx2'], function(bounds)
1000	{
1001		var dx2 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx2', this.dx2))));
1002
1003		return new mxPoint(bounds.x + dx2 * bounds.width, bounds.y + bounds.height - 10);
1004	}, function(bounds, pt)
1005	{
1006		this.state.style['dx2'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
1007	});
1008
1009	handles.push(handle2);
1010
1011	var handle3 = Graph.createHandle(state, ['dy1'], function(bounds)
1012	{
1013		var dy1 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy1', this.dy1))));
1014
1015		return new mxPoint(bounds.x + 10, bounds.y + dy1 * bounds.height);
1016	}, function(bounds, pt)
1017	{
1018		this.state.style['dy1'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;
1019	});
1020
1021	handles.push(handle3);
1022
1023	var handle4 = Graph.createHandle(state, ['dy2'], function(bounds)
1024	{
1025		var dy2 = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dy2', this.dy2))));
1026
1027		return new mxPoint(bounds.x + bounds.width - 10, bounds.y + dy2 * bounds.height);
1028	}, function(bounds, pt)
1029	{
1030		this.state.style['dy2'] = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;
1031	});
1032
1033	handles.push(handle4);
1034
1035	return handles;
1036};
1037
1038mxShapeBasicPyramid.prototype.getConstraints = function(style, w, h)
1039{
1040	var constr = [];
1041	var dx1 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx1', this.dx1))));
1042	var dx2 = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx2', this.dx2))));
1043	var dy1 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy1', this.dy1))));
1044	var dy2 = h * Math.max(0, Math.min(h, parseFloat(mxUtils.getValue(this.style, 'dy2', this.dy2))));
1045
1046	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx1, 0));
1047	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + dx1) * 0.5, dy2 * 0.5));
1048	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dy2));
1049	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + dx2) * 0.5, (h + dy2) * 0.5));
1050	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2, h));
1051	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx2 * 0.5, (h + dy1) * 0.5));
1052	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, dy1));
1053	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx1 * 0.5, dy1 * 0.5));
1054
1055	return (constr);
1056}
1057
1058//**********************************************************************************************************************************************************
1059//4 Point Star 2
1060//**********************************************************************************************************************************************************
1061/**
1062* Extends mxShape.
1063*/
1064function mxShapeBasic4PointStar2(bounds, fill, stroke, strokewidth)
1065{
1066	mxShape.call(this);
1067	this.bounds = bounds;
1068	this.fill = fill;
1069	this.stroke = stroke;
1070	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1071	this.dx = 0.8;
1072};
1073
1074/**
1075* Extends mxShape.
1076*/
1077mxUtils.extend(mxShapeBasic4PointStar2, mxActor);
1078
1079mxShapeBasic4PointStar2.prototype.customProperties = [
1080	{name: 'dx', dispName: 'Thickness', type: 'float', min:0, max:1, defVal:0.8}
1081];
1082
1083mxShapeBasic4PointStar2.prototype.cst = {FOUR_POINT_STAR_2 : 'mxgraph.basic.4_point_star_2'};
1084
1085/**
1086* Function: paintVertexShape
1087*
1088* Paints the vertex shape.
1089*/
1090mxShapeBasic4PointStar2.prototype.paintVertexShape = function(c, x, y, w, h)
1091{
1092	c.translate(x, y);
1093
1094	var dx = 0.5 * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1095
1096	c.begin();
1097	c.moveTo(0, h * 0.5);
1098	c.lineTo(dx * w, dx * h);
1099	c.lineTo(w * 0.5, 0);
1100	c.lineTo(w - dx * w, dx * h);
1101	c.lineTo(w, h * 0.5);
1102	c.lineTo(w - dx * w, h - dx * h);
1103	c.lineTo(w * 0.5, h);
1104	c.lineTo(dx * w, h - dx * h);
1105	c.close();
1106	c.fillAndStroke();
1107};
1108
1109mxCellRenderer.registerShape(mxShapeBasic4PointStar2.prototype.cst.FOUR_POINT_STAR_2, mxShapeBasic4PointStar2);
1110
1111mxShapeBasic4PointStar2.prototype.constraints = null;
1112
1113Graph.handleFactory[mxShapeBasic4PointStar2.prototype.cst.FOUR_POINT_STAR_2] = function(state)
1114{
1115	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1116	{
1117		var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1118
1119		return new mxPoint(bounds.x + dx * bounds.width / 2, bounds.y + dx * bounds.height / 2);
1120	}, function(bounds, pt)
1121	{
1122		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, 2 * (pt.x - bounds.x) / bounds.width))) / 100;
1123	})];
1124
1125	return handles;
1126};
1127
1128mxShapeBasic4PointStar2.prototype.getConstraints = function(style, w, h)
1129{
1130	var constr = [];
1131	var dx = 0.5 * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1132
1133	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1134	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1135	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1136	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1137	constr.push(new mxConnectionConstraint(new mxPoint(dx, dx), false));
1138	constr.push(new mxConnectionConstraint(new mxPoint(1 - dx, dx), false));
1139	constr.push(new mxConnectionConstraint(new mxPoint(1 - dx, 1 - dx), false));
1140	constr.push(new mxConnectionConstraint(new mxPoint(dx, 1 - dx), false));
1141
1142	return (constr);
1143}
1144
1145//**********************************************************************************************************************************************************
1146//Diagonal Snip Rectangle
1147//**********************************************************************************************************************************************************
1148/**
1149* Extends mxShape.
1150*/
1151function mxShapeBasicDiagSnipRect(bounds, fill, stroke, strokewidth)
1152{
1153	mxShape.call(this);
1154	this.bounds = bounds;
1155	this.fill = fill;
1156	this.stroke = stroke;
1157	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1158	this.dx = 0.5;
1159};
1160
1161/**
1162* Extends mxShape.
1163*/
1164mxUtils.extend(mxShapeBasicDiagSnipRect, mxActor);
1165
1166mxShapeBasicDiagSnipRect.prototype.customProperties = [
1167	{name: 'dx', dispName: 'Snip', type: 'float', min:0, deVal:6},
1168];
1169
1170mxShapeBasicDiagSnipRect.prototype.cst = {DIAG_SNIP_RECT : 'mxgraph.basic.diag_snip_rect'};
1171
1172/**
1173* Function: paintVertexShape
1174*
1175* Paints the vertex shape.
1176*/
1177mxShapeBasicDiagSnipRect.prototype.paintVertexShape = function(c, x, y, w, h)
1178{
1179	c.translate(x, y);
1180
1181	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
1182
1183	dx = Math.min(w * 0.5, h * 0.5, dx);
1184
1185	c.begin();
1186	c.moveTo(dx, 0);
1187	c.lineTo(w, 0);
1188	c.lineTo(w, h - dx);
1189	c.lineTo(w - dx, h);
1190	c.lineTo(0, h);
1191	c.lineTo(0, dx);
1192	c.close();
1193	c.fillAndStroke();
1194};
1195
1196mxCellRenderer.registerShape(mxShapeBasicDiagSnipRect.prototype.cst.DIAG_SNIP_RECT, mxShapeBasicDiagSnipRect);
1197
1198mxShapeBasicDiagSnipRect.prototype.constraints = null;
1199
1200Graph.handleFactory[mxShapeBasicDiagSnipRect.prototype.cst.DIAG_SNIP_RECT] = function(state)
1201{
1202	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1203	{
1204		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1205
1206		return new mxPoint(bounds.x + dx, bounds.y + dx);
1207	}, function(bounds, pt)
1208	{
1209		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
1210	})];
1211
1212	return handles;
1213};
1214
1215mxShapeBasicDiagSnipRect.prototype.getConstraints = function(style, w, h)
1216{
1217	var constr = [];
1218	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
1219
1220	dx = Math.min(w * 0.5, h * 0.5, dx) * 0.5;
1221
1222	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));
1223	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1224	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
1225	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1226	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, h - dx));
1227	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1228	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
1229	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1230
1231	return (constr);
1232}
1233
1234//**********************************************************************************************************************************************************
1235//Diagonal Round Rectangle
1236//**********************************************************************************************************************************************************
1237/**
1238* Extends mxShape.
1239*/
1240function mxShapeBasicDiagRoundRect(bounds, fill, stroke, strokewidth)
1241{
1242	mxShape.call(this);
1243	this.bounds = bounds;
1244	this.fill = fill;
1245	this.stroke = stroke;
1246	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1247	this.dx = 0.5;
1248};
1249
1250/**
1251* Extends mxShape.
1252*/
1253mxUtils.extend(mxShapeBasicDiagRoundRect, mxActor);
1254
1255mxShapeBasicDiagRoundRect.prototype.customProperties = [
1256	{name: 'dx', dispName: 'Rounding Size', type: 'float', min:0, defVal:6},
1257];
1258
1259mxShapeBasicDiagRoundRect.prototype.cst = {DIAG_ROUND_RECT : 'mxgraph.basic.diag_round_rect'};
1260
1261/**
1262* Function: paintVertexShape
1263*
1264* Paints the vertex shape.
1265*/
1266mxShapeBasicDiagRoundRect.prototype.paintVertexShape = function(c, x, y, w, h)
1267{
1268	c.translate(x, y);
1269
1270	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
1271
1272	dx = Math.min(w * 0.5, h * 0.5, dx);
1273
1274	c.begin();
1275	c.moveTo(dx, 0);
1276	c.lineTo(w, 0);
1277	c.lineTo(w, h - dx);
1278	c.arcTo(dx, dx, 0, 0, 1, w - dx, h);
1279	c.lineTo(0, h);
1280	c.lineTo(0, dx);
1281	c.arcTo(dx, dx, 0, 0, 1, dx, 0);
1282	c.close();
1283	c.fillAndStroke();
1284};
1285
1286mxCellRenderer.registerShape(mxShapeBasicDiagRoundRect.prototype.cst.DIAG_ROUND_RECT, mxShapeBasicDiagRoundRect);
1287
1288mxShapeBasicDiagRoundRect.prototype.constraints = null;
1289
1290Graph.handleFactory[mxShapeBasicDiagRoundRect.prototype.cst.DIAG_ROUND_RECT] = function(state)
1291{
1292	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1293	{
1294		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1295
1296		return new mxPoint(bounds.x + dx, bounds.y + dx);
1297	}, function(bounds, pt)
1298	{
1299		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
1300	})];
1301
1302	return handles;
1303};
1304
1305mxShapeBasicDiagRoundRect.prototype.getConstraints = function(style, w, h)
1306{
1307	var constr = [];
1308
1309	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1310	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
1311	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1312	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1313	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
1314	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1315
1316	return (constr);
1317}
1318
1319//**********************************************************************************************************************************************************
1320//Corner Round Rectangle
1321//**********************************************************************************************************************************************************
1322/**
1323* Extends mxShape.
1324*/
1325function mxShapeBasicCornerRoundRect(bounds, fill, stroke, strokewidth)
1326{
1327	mxShape.call(this);
1328	this.bounds = bounds;
1329	this.fill = fill;
1330	this.stroke = stroke;
1331	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1332	this.dx = 0.5;
1333};
1334
1335/**
1336* Extends mxShape.
1337*/
1338mxUtils.extend(mxShapeBasicCornerRoundRect, mxActor);
1339
1340mxShapeBasicCornerRoundRect.prototype.customProperties = [
1341	{name: 'dx', dispName: 'Rounding Size', type: 'float', min:0, defVal:6},
1342];
1343
1344mxShapeBasicCornerRoundRect.prototype.cst = {CORNER_ROUND_RECT : 'mxgraph.basic.corner_round_rect'};
1345
1346/**
1347* Function: paintVertexShape
1348*
1349* Paints the vertex shape.
1350*/
1351mxShapeBasicCornerRoundRect.prototype.paintVertexShape = function(c, x, y, w, h)
1352{
1353	c.translate(x, y);
1354
1355	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
1356
1357	dx = Math.min(w * 0.5, h * 0.5, dx);
1358
1359	c.begin();
1360	c.moveTo(dx, 0);
1361	c.lineTo(w, 0);
1362	c.lineTo(w, h);
1363	c.lineTo(0, h);
1364	c.lineTo(0, dx);
1365	c.arcTo(dx, dx, 0, 0, 1, dx, 0);
1366	c.close();
1367	c.fillAndStroke();
1368};
1369
1370mxCellRenderer.registerShape(mxShapeBasicCornerRoundRect.prototype.cst.CORNER_ROUND_RECT, mxShapeBasicCornerRoundRect);
1371
1372mxShapeBasicCornerRoundRect.prototype.constraints = null;
1373
1374Graph.handleFactory[mxShapeBasicCornerRoundRect.prototype.cst.CORNER_ROUND_RECT] = function(state)
1375{
1376	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1377	{
1378		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1379
1380		return new mxPoint(bounds.x + dx, bounds.y + dx);
1381	}, function(bounds, pt)
1382	{
1383		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
1384	})];
1385
1386	return handles;
1387};
1388
1389mxShapeBasicCornerRoundRect.prototype.getConstraints = function(style, w, h)
1390{
1391	var constr = [];
1392
1393	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1394	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
1395	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1396	constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
1397	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1398	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
1399	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1400
1401	return (constr);
1402}
1403
1404//**********************************************************************************************************************************************************
1405//Plaque
1406//**********************************************************************************************************************************************************
1407/**
1408* Extends mxShape.
1409*/
1410function mxShapeBasicPlaque(bounds, fill, stroke, strokewidth)
1411{
1412	mxShape.call(this);
1413	this.bounds = bounds;
1414	this.fill = fill;
1415	this.stroke = stroke;
1416	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1417	this.dx = 0.5;
1418};
1419
1420/**
1421* Extends mxShape.
1422*/
1423mxUtils.extend(mxShapeBasicPlaque, mxActor);
1424
1425mxShapeBasicPlaque.prototype.customProperties = [
1426	{name: 'dx', dispName: 'Cutoff Size', type: 'float', min:0, defVal:6},
1427];
1428
1429mxShapeBasicPlaque.prototype.cst = {PLAQUE : 'mxgraph.basic.plaque'};
1430
1431/**
1432* Function: paintVertexShape
1433*
1434* Paints the vertex shape.
1435*/
1436mxShapeBasicPlaque.prototype.paintVertexShape = function(c, x, y, w, h)
1437{
1438	c.translate(x, y);
1439
1440	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
1441
1442	dx = Math.min(w * 0.5, h * 0.5, dx);
1443
1444	c.begin();
1445	c.moveTo(w - dx, 0);
1446	c.arcTo(dx, dx, 0, 0, 0, w, dx);
1447	c.lineTo(w, h - dx);
1448	c.arcTo(dx, dx, 0, 0, 0, w - dx, h);
1449	c.lineTo(dx, h);
1450	c.arcTo(dx, dx, 0, 0, 0, 0, h - dx);
1451	c.lineTo(0, dx);
1452	c.arcTo(dx, dx, 0, 0, 0, dx, 0);
1453	c.close();
1454	c.fillAndStroke();
1455};
1456
1457mxCellRenderer.registerShape(mxShapeBasicPlaque.prototype.cst.PLAQUE, mxShapeBasicPlaque);
1458
1459mxShapeBasicPlaque.prototype.constraints = null;
1460
1461Graph.handleFactory[mxShapeBasicPlaque.prototype.cst.PLAQUE] = function(state)
1462{
1463	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1464	{
1465		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1466
1467		return new mxPoint(bounds.x + dx * 1.41, bounds.y + dx * 1.41);
1468	}, function(bounds, pt)
1469	{
1470		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
1471	})];
1472
1473	return handles;
1474};
1475
1476mxShapeBasicPlaque.prototype.getConstraints = function(style, w, h)
1477{
1478	var constr = [];
1479
1480	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1481	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1482	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1483	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1484
1485	return (constr);
1486}
1487
1488//**********************************************************************************************************************************************************
1489//Frame
1490//**********************************************************************************************************************************************************
1491/**
1492* Extends mxShape.
1493*/
1494function mxShapeBasicFrame(bounds, fill, stroke, strokewidth)
1495{
1496	mxShape.call(this);
1497	this.bounds = bounds;
1498	this.fill = fill;
1499	this.stroke = stroke;
1500	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1501	this.dx = 0.5;
1502};
1503
1504/**
1505* Extends mxShape.
1506*/
1507mxUtils.extend(mxShapeBasicFrame, mxActor);
1508
1509mxShapeBasicFrame.prototype.customProperties = [
1510	{name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:10},
1511];
1512
1513mxShapeBasicFrame.prototype.cst = {FRAME : 'mxgraph.basic.frame'};
1514
1515/**
1516* Function: paintVertexShape
1517*
1518* Paints the vertex shape.
1519*/
1520mxShapeBasicFrame.prototype.paintVertexShape = function(c, x, y, w, h)
1521{
1522	c.translate(x, y);
1523
1524	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1525
1526	dx = Math.min(w * 0.5, h * 0.5, dx);
1527
1528	c.begin();
1529	c.moveTo(w, 0);
1530	c.lineTo(w, h);
1531	c.lineTo(0, h);
1532	c.lineTo(0, 0);
1533	c.close();
1534	c.moveTo(dx, dx);
1535	c.lineTo(dx, h - dx);
1536	c.lineTo(w - dx, h - dx);
1537	c.lineTo(w - dx, dx);
1538	c.close();
1539	c.fillAndStroke();
1540};
1541
1542mxCellRenderer.registerShape(mxShapeBasicFrame.prototype.cst.FRAME, mxShapeBasicFrame);
1543
1544mxShapeBasicFrame.prototype.constraints = null;
1545
1546Graph.handleFactory[mxShapeBasicFrame.prototype.cst.FRAME] = function(state)
1547{
1548	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1549	{
1550		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1551
1552		return new mxPoint(bounds.x + dx, bounds.y + dx);
1553	}, function(bounds, pt)
1554	{
1555		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;
1556	})];
1557
1558	return handles;
1559};
1560
1561mxShapeBasicFrame.prototype.getConstraints = function(style, w, h)
1562{
1563	var constr = [];
1564	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1565	dx = Math.min(w * 0.5, h * 0.5, dx);
1566
1567	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
1568	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, 0));
1569	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1570	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, 0));
1571	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
1572	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.25));
1573	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1574	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h * 0.75));
1575	constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
1576	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.75, h));
1577	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1578	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w * 0.25, h));
1579	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
1580	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.75));
1581	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1582	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h * 0.25));
1583	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));
1584	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx)* 0.25 + dx, dx));
1585	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dx));
1586	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w * 1.5 - dx) * 0.5, dx));
1587	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -dx, dx));
1588	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, (h - 2 * dx)* 0.25 + dx));
1589	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -dx, 0));
1590	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, (h  - 2 * dx) * 0.75 + dx));
1591	constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false, null, -dx, -dx));
1592	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx) * 0.75 + dx, h - dx));
1593	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 0, -dx));
1594	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w  - 2 * dx) * 0.25 + dx, h - dx));
1595	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, dx, -dx));
1596	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - 2 * dx) * 0.75 + dx));
1597	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));
1598	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - 2 * dx) * 0.25 + dx));
1599
1600	return (constr);
1601}
1602
1603//**********************************************************************************************************************************************************
1604//Plaque Frame
1605//**********************************************************************************************************************************************************
1606/**
1607* Extends mxShape.
1608*/
1609function mxShapeBasicPlaqueFrame(bounds, fill, stroke, strokewidth)
1610{
1611	mxShape.call(this);
1612	this.bounds = bounds;
1613	this.fill = fill;
1614	this.stroke = stroke;
1615	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1616	this.dx = 0.5;
1617};
1618
1619/**
1620*/
1621mxUtils.extend(mxShapeBasicPlaqueFrame, mxActor);
1622
1623mxShapeBasicPlaqueFrame.prototype.customProperties = [
1624	{name: 'dx', dispName: 'Width', type: 'float', mix:0, defVal:10},
1625];
1626
1627mxShapeBasicPlaqueFrame.prototype.cst = {PLAQUE_FRAME : 'mxgraph.basic.plaque_frame'};
1628
1629/**
1630* Function: paintVertexShape
1631*
1632* Paints the vertex shape.
1633*/
1634mxShapeBasicPlaqueFrame.prototype.paintVertexShape = function(c, x, y, w, h)
1635{
1636	c.translate(x, y);
1637
1638	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1639
1640	dx = Math.min(w * 0.25, h * 0.25, dx);
1641
1642	c.begin();
1643	c.moveTo(w - dx, 0);
1644	c.arcTo(dx, dx, 0, 0, 0, w, dx);
1645	c.lineTo(w, h - dx);
1646	c.arcTo(dx, dx, 0, 0, 0, w - dx, h);
1647	c.lineTo(dx, h);
1648	c.arcTo(dx, dx, 0, 0, 0, 0, h - dx);
1649	c.lineTo(0, dx);
1650	c.arcTo(dx, dx, 0, 0, 0, dx, 0);
1651	c.close();
1652
1653	c.moveTo(dx * 2, dx);
1654	c.arcTo(dx * 2, dx * 2, 0, 0, 1, dx, dx * 2);
1655	c.lineTo(dx, h - 2 * dx);
1656	c.arcTo(dx * 2, dx * 2, 0, 0, 1, dx * 2, h - dx);
1657	c.lineTo(w - 2 * dx, h - dx);
1658	c.arcTo(dx * 2, dx * 2, 0, 0, 1, w - dx, h - 2 * dx);
1659	c.lineTo(w - dx, dx * 2);
1660	c.arcTo(dx * 2, dx * 2, 0, 0, 1, w - 2 * dx, dx);
1661	c.close();
1662
1663	c.fillAndStroke();
1664
1665};
1666
1667mxCellRenderer.registerShape(mxShapeBasicPlaqueFrame.prototype.cst.PLAQUE_FRAME, mxShapeBasicPlaqueFrame);
1668
1669mxShapeBasicPlaqueFrame.prototype.constraints = null;
1670
1671Graph.handleFactory[mxShapeBasicPlaqueFrame.prototype.cst.PLAQUE_FRAME] = function(state)
1672{
1673	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1674	{
1675		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1676
1677		return new mxPoint(bounds.x + dx, bounds.y + dx);
1678	}, function(bounds, pt)
1679	{
1680		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
1681	})];
1682
1683	return handles;
1684};
1685
1686mxShapeBasicPlaqueFrame.prototype.getConstraints = function(style, w, h)
1687{
1688	var constr = [];
1689	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1690	dx = Math.min(w * 0.5, h * 0.5, dx);
1691
1692	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1693	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1694	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1695	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1696	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dx));
1697	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -dx, 0));
1698	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 0, -dx));
1699	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));
1700
1701	return (constr);
1702}
1703
1704//**********************************************************************************************************************************************************
1705//Rounded Frame
1706//**********************************************************************************************************************************************************
1707/**
1708* Extends mxShape.
1709*/
1710function mxShapeBasicRoundedFrame(bounds, fill, stroke, strokewidth)
1711{
1712	mxShape.call(this);
1713	this.bounds = bounds;
1714	this.fill = fill;
1715	this.stroke = stroke;
1716	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1717	this.dx = 0.5;
1718};
1719
1720/**
1721* Extends mxShape.
1722*/
1723mxUtils.extend(mxShapeBasicRoundedFrame, mxActor);
1724
1725mxShapeBasicRoundedFrame.prototype.customProperties = [
1726	{name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:10},
1727];
1728
1729mxShapeBasicRoundedFrame.prototype.cst = {ROUNDED_FRAME : 'mxgraph.basic.rounded_frame'};
1730
1731/**
1732* Function: paintVertexShape
1733*
1734* Paints the vertex shape.
1735*/
1736mxShapeBasicRoundedFrame.prototype.paintVertexShape = function(c, x, y, w, h)
1737{
1738	c.translate(x, y);
1739
1740	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1741
1742	dx = Math.min(w * 0.25, h * 0.25, dx);
1743
1744	c.begin();
1745	c.moveTo(w - 2 * dx, 0);
1746	c.arcTo(dx * 2, dx * 2, 0, 0, 1, w, 2 * dx);
1747	c.lineTo(w, h - 2 * dx);
1748	c.arcTo(dx * 2, dx * 2, 0, 0, 1, w - 2 * dx, h);
1749	c.lineTo(dx * 2, h);
1750	c.arcTo(dx * 2, dx * 2, 0, 0, 1, 0, h - 2 * dx);
1751	c.lineTo(0, 2 * dx);
1752	c.arcTo(dx * 2, dx * 2, 0, 0, 1, 2 * dx, 0);
1753	c.close();
1754
1755	c.moveTo(dx * 2, dx);
1756	c.arcTo(dx, dx, 0, 0, 0, dx, dx * 2);
1757	c.lineTo(dx, h - 2 * dx);
1758	c.arcTo(dx, dx, 0, 0, 0, dx * 2, h - dx);
1759	c.lineTo(w - 2 * dx, h - dx);
1760	c.arcTo(dx, dx, 0, 0, 0, w - dx, h - 2 * dx);
1761	c.lineTo(w - dx, dx * 2);
1762	c.arcTo(dx, dx, 0, 0, 0, w - 2 * dx, dx);
1763	c.close();
1764
1765	c.fillAndStroke();
1766
1767};
1768
1769mxCellRenderer.registerShape(mxShapeBasicRoundedFrame.prototype.cst.ROUNDED_FRAME, mxShapeBasicRoundedFrame);
1770
1771mxShapeBasicRoundedFrame.prototype.constraints = null;
1772
1773Graph.handleFactory[mxShapeBasicRoundedFrame.prototype.cst.ROUNDED_FRAME] = function(state)
1774{
1775	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1776	{
1777		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1778
1779		return new mxPoint(bounds.x + dx, bounds.y + dx);
1780	}, function(bounds, pt)
1781	{
1782		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
1783	})];
1784
1785	return handles;
1786};
1787
1788mxShapeBasicRoundedFrame.prototype.getConstraints = function(style, w, h)
1789{
1790	var constr = [];
1791	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1792	dx = Math.min(w * 0.5, h * 0.5, dx);
1793
1794	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1795	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
1796	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
1797	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1798	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false, null, 0, dx));
1799	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false, null, -dx, 0));
1800	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false, null, 0, -dx));
1801	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false, null, dx, 0));
1802
1803	return (constr);
1804}
1805
1806//**********************************************************************************************************************************************************
1807//Frame Corner
1808//**********************************************************************************************************************************************************
1809/**
1810* Extends mxShape.
1811*/
1812function mxShapeBasicFrameCorner(bounds, fill, stroke, strokewidth)
1813{
1814	mxShape.call(this);
1815	this.bounds = bounds;
1816	this.fill = fill;
1817	this.stroke = stroke;
1818	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1819	this.dx = 0.5;
1820};
1821
1822/**
1823* Extends mxShape.
1824*/
1825mxUtils.extend(mxShapeBasicFrameCorner, mxActor);
1826
1827mxShapeBasicFrameCorner.prototype.customProperties = [
1828	{name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:10},
1829];
1830
1831mxShapeBasicFrameCorner.prototype.cst = {FRAME_CORNER : 'mxgraph.basic.frame_corner'};
1832
1833/**
1834* Function: paintVertexShape
1835*
1836* Paints the vertex shape.
1837*/
1838mxShapeBasicFrameCorner.prototype.paintVertexShape = function(c, x, y, w, h)
1839{
1840	c.translate(x, y);
1841
1842	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1843
1844	dx = Math.min(w * 0.5, h * 0.5, dx);
1845
1846	c.begin();
1847	c.moveTo(0, 0);
1848	c.lineTo(w, 0);
1849	c.lineTo(w - dx, dx);
1850	c.lineTo(dx, dx);
1851	c.lineTo(dx, h - dx);
1852	c.lineTo(0, h);
1853	c.close();
1854	c.fillAndStroke();
1855};
1856
1857mxCellRenderer.registerShape(mxShapeBasicFrameCorner.prototype.cst.FRAME_CORNER, mxShapeBasicFrameCorner);
1858
1859mxShapeBasicFrameCorner.prototype.constraints = null;
1860
1861Graph.handleFactory[mxShapeBasicFrameCorner.prototype.cst.FRAME_CORNER] = function(state)
1862{
1863	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1864	{
1865		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1866
1867		return new mxPoint(bounds.x + dx, bounds.y + dx);
1868	}, function(bounds, pt)
1869	{
1870		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;
1871	})];
1872
1873	return handles;
1874};
1875
1876mxShapeBasicFrameCorner.prototype.getConstraints = function(style, w, h)
1877{
1878	var constr = [];
1879	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1880
1881	dx = Math.min(w * 0.5, h * 0.5, dx);
1882
1883	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
1884	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
1885	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
1886	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false, null, -dx, dx));
1887	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - 2 * dx) * 0.5 + dx, dx));
1888	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, dx));
1889	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, (h - 2 * dx) * 0.5 + dx));
1890	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false, null, dx, -dx));
1891	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
1892	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
1893
1894	return (constr);
1895}
1896
1897//**********************************************************************************************************************************************************
1898//Diagonal Stripe
1899//**********************************************************************************************************************************************************
1900/**
1901* Extends mxShape.
1902*/
1903function mxShapeBasicDiagStripe(bounds, fill, stroke, strokewidth)
1904{
1905	mxShape.call(this);
1906	this.bounds = bounds;
1907	this.fill = fill;
1908	this.stroke = stroke;
1909	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1910	this.dx = 0.5;
1911};
1912
1913/**
1914* Extends mxShape.
1915*/
1916mxUtils.extend(mxShapeBasicDiagStripe, mxActor);
1917
1918mxShapeBasicDiagStripe.prototype.customProperties = [
1919	{name: 'dx', dispName: 'Width', type: 'float', mix:0, defVal:10},
1920];
1921
1922mxShapeBasicDiagStripe.prototype.cst = {DIAG_STRIPE : 'mxgraph.basic.diag_stripe'};
1923
1924/**
1925* Function: paintVertexShape
1926*
1927* Paints the vertex shape.
1928*/
1929mxShapeBasicDiagStripe.prototype.paintVertexShape = function(c, x, y, w, h)
1930{
1931	c.translate(x, y);
1932
1933	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1934
1935	dx = Math.min(w, h, dx);
1936
1937	c.begin();
1938	c.moveTo(0, h);
1939	c.lineTo(w, 0);
1940	c.lineTo(w, Math.min(dx * 100 / w, h));
1941	c.lineTo(Math.min(dx * 100 / h, w), h);
1942	c.close();
1943	c.fillAndStroke();
1944};
1945
1946mxCellRenderer.registerShape(mxShapeBasicDiagStripe.prototype.cst.DIAG_STRIPE, mxShapeBasicDiagStripe);
1947
1948mxShapeBasicDiagStripe.prototype.constraints = null;
1949
1950Graph.handleFactory[mxShapeBasicDiagStripe.prototype.cst.DIAG_STRIPE] = function(state)
1951{
1952	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1953	{
1954		var dx = Math.max(0, Math.min(bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1955
1956		return new mxPoint(bounds.x + dx, bounds.y + bounds.height);
1957	}, function(bounds, pt)
1958	{
1959		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;
1960	})];
1961
1962	return handles;
1963};
1964
1965mxShapeBasicDiagStripe.prototype.getConstraints = function(style, w, h)
1966{
1967	var constr = [];
1968	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1969	dx = Math.min(w, h, dx);
1970
1971	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
1972	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.5), false));
1973	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
1974	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, Math.min(dx * 100 / w, h) * 0.5));
1975	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, Math.min(dx * 100 / w, h)));
1976	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w + Math.min(dx * 100 / h, w)) * 0.5, (Math.min(dx * 100 / w, h) + h) * 0.5));
1977	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.min(dx * 100 / h, w), h));
1978	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, Math.min(dx * 100 / h, w) * 0.5, h));
1979
1980	return (constr);
1981}
1982
1983//**********************************************************************************************************************************************************
1984//Donut
1985//**********************************************************************************************************************************************************
1986/**
1987* Extends mxShape.
1988*/
1989function mxShapeBasicDonut(bounds, fill, stroke, strokewidth)
1990{
1991	mxShape.call(this);
1992	this.bounds = bounds;
1993	this.fill = fill;
1994	this.stroke = stroke;
1995	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1996	this.dx = 0.5;
1997};
1998
1999/**
2000* Extends mxShape.
2001*/
2002mxUtils.extend(mxShapeBasicDonut, mxActor);
2003
2004mxShapeBasicDonut.prototype.customProperties = [
2005	{name: 'dx', dispName: 'Width', type: 'float', min:0, defVal:25}
2006];
2007
2008mxShapeBasicDonut.prototype.cst = {DONUT : 'mxgraph.basic.donut'};
2009
2010/**
2011* Function: paintVertexShape
2012*
2013* Paints the vertex shape.
2014*/
2015mxShapeBasicDonut.prototype.paintVertexShape = function(c, x, y, w, h)
2016{
2017	c.translate(x, y);
2018
2019	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
2020
2021	dx = Math.min(w * 0.5, h * 0.5, dx);
2022
2023	c.begin();
2024	c.moveTo(0, h * 0.5);
2025	c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, 0);
2026	c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w, h * 0.5);
2027	c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.5, h);
2028	c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, 0, h * 0.5);
2029	c.close();
2030	c.moveTo(w * 0.5, dx);
2031	c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, dx, h * 0.5);
2032	c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, w * 0.5, h - dx);
2033	c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, w - dx, h * 0.5);
2034	c.arcTo(w * 0.5 - dx, h * 0.5 - dx, 0, 0, 0, w * 0.5, dx);
2035	c.close();
2036	c.fillAndStroke();
2037};
2038
2039mxCellRenderer.registerShape(mxShapeBasicDonut.prototype.cst.DONUT, mxShapeBasicDonut);
2040
2041mxShapeBasicDonut.prototype.constraints = null;
2042
2043Graph.handleFactory[mxShapeBasicDonut.prototype.cst.DONUT] = function(state)
2044{
2045	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
2046	{
2047		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
2048
2049		return new mxPoint(bounds.x + dx, bounds.y + bounds.height / 2);
2050	}, function(bounds, pt)
2051	{
2052		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;
2053	})];
2054
2055	return handles;
2056};
2057
2058//**********************************************************************************************************************************************************
2059//Layered Rect
2060//**********************************************************************************************************************************************************
2061/**
2062* Extends mxShape.
2063*/
2064function mxShapeBasicLayeredRect(bounds, fill, stroke, strokewidth)
2065{
2066	mxShape.call(this);
2067	this.bounds = bounds;
2068	this.fill = fill;
2069	this.stroke = stroke;
2070	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2071	this.dx = 0.5;
2072};
2073
2074/**
2075* Extends mxShape.
2076*/
2077mxUtils.extend(mxShapeBasicLayeredRect, mxActor);
2078
2079mxShapeBasicLayeredRect.prototype.customProperties = [
2080	{name: 'dx', dispName: 'Layer Distance', type: 'float', mix:0, defVal:10}
2081];
2082
2083mxShapeBasicLayeredRect.prototype.cst = {LAYERED_RECT : 'mxgraph.basic.layered_rect'};
2084
2085/**
2086* Function: paintVertexShape
2087*
2088* Paints the vertex shape.
2089*/
2090mxShapeBasicLayeredRect.prototype.paintVertexShape = function(c, x, y, w, h)
2091{
2092	c.translate(x, y);
2093
2094	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
2095
2096	dx = Math.min(w * 0.5, h * 0.5, dx);
2097
2098	c.begin();
2099	c.moveTo(dx, dx);
2100	c.lineTo(w, dx);
2101	c.lineTo(w, h);
2102	c.lineTo(dx, h);
2103	c.close();
2104	c.fillAndStroke();
2105
2106	c.begin();
2107	c.moveTo(dx * 0.5, dx * 0.5);
2108	c.lineTo(w - dx * 0.5, dx * 0.5);
2109	c.lineTo(w - dx * 0.5, h - dx * 0.5);
2110	c.lineTo(dx * 0.5, h - dx * 0.5);
2111	c.close();
2112	c.fillAndStroke();
2113
2114	c.begin();
2115	c.moveTo(0, 0);
2116	c.lineTo(w - dx, 0);
2117	c.lineTo(w - dx, h - dx);
2118	c.lineTo(0, h - dx);
2119	c.close();
2120	c.fillAndStroke();
2121};
2122
2123mxCellRenderer.registerShape(mxShapeBasicLayeredRect.prototype.cst.LAYERED_RECT, mxShapeBasicLayeredRect);
2124
2125mxShapeBasicLayeredRect.prototype.constraints = null;
2126
2127Graph.handleFactory[mxShapeBasicLayeredRect.prototype.cst.LAYERED_RECT] = function(state)
2128{
2129	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
2130	{
2131		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
2132
2133		return new mxPoint(bounds.x + bounds.width - dx, bounds.y + bounds.height - dx);
2134	}, function(bounds, pt)
2135	{
2136		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, - pt.x + bounds.width + bounds.x))) / 100;
2137	})];
2138
2139	return handles;
2140};
2141
2142mxShapeBasicLayeredRect.prototype.getConstraints = function(style, w, h)
2143{
2144	var constr = [];
2145	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
2146	dx = Math.min(w * 0.5, h * 0.5, dx);
2147
2148	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
2149	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.25, 0));
2150	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5, 0));
2151	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.75, 0));
2152	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx, 0));
2153	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w - dx * 0.5, dx * 0.5));
2154	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, dx));
2155	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dx) * 0.25 + dx));
2156	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dx) * 0.5 + dx));
2157	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, (h - dx) * 0.75 + dx));
2158	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, w, h));
2159	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.75 + dx, h));
2160	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.5 + dx, h));
2161	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, (w - dx) * 0.25 + dx, h));
2162	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx, h));
2163	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, dx * 0.5, h - dx * 0.5));
2164	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, h - dx));
2165	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dx) * 0.75));
2166	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dx) * 0.5));
2167	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false, null, 0, (h - dx) * 0.25));
2168
2169	return (constr);
2170}
2171
2172//**********************************************************************************************************************************************************
2173//Button
2174//**********************************************************************************************************************************************************
2175/**
2176* Extends mxShape.
2177*/
2178function mxShapeBasicButton(bounds, fill, stroke, strokewidth)
2179{
2180	mxShape.call(this);
2181	this.bounds = bounds;
2182	this.fill = fill;
2183	this.stroke = stroke;
2184	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2185	this.dx = 0.5;
2186};
2187
2188/**
2189* Extends mxShape.
2190*/
2191mxUtils.extend(mxShapeBasicButton, mxActor);
2192
2193mxShapeBasicButton.prototype.customProperties = [
2194	{name: 'dx', dispName: 'Button Height', type: 'float', min:0, defVal:10}
2195];
2196
2197mxShapeBasicButton.prototype.cst = {BUTTON : 'mxgraph.basic.button'};
2198
2199/**
2200* Function: paintVertexShape
2201*
2202* Paints the vertex shape.
2203*/
2204mxShapeBasicButton.prototype.paintVertexShape = function(c, x, y, w, h)
2205{
2206	c.translate(x, y);
2207
2208	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
2209
2210	dx = Math.min(w * 0.5, h * 0.5, dx);
2211
2212	c.begin();
2213	c.moveTo(0, 0);
2214	c.lineTo(w, 0);
2215	c.lineTo(w, h);
2216	c.lineTo(0, h);
2217	c.close();
2218	c.fillAndStroke();
2219
2220	c.setShadow(false);
2221	c.setLineJoin('round');
2222
2223	c.begin();
2224	c.moveTo(0, h);
2225	c.lineTo(0, 0);
2226	c.lineTo(dx, dx);
2227	c.lineTo(dx, h - dx);
2228	c.close();
2229	c.fillAndStroke();
2230
2231	c.begin();
2232	c.moveTo(0, 0);
2233	c.lineTo(w, 0);
2234	c.lineTo(w - dx, dx);
2235	c.lineTo(dx, dx);
2236	c.close();
2237	c.fillAndStroke();
2238
2239	c.begin();
2240	c.moveTo(w, 0);
2241	c.lineTo(w, h);
2242	c.lineTo(w - dx, h - dx);
2243	c.lineTo(w - dx, dx);
2244	c.close();
2245	c.fillAndStroke();
2246
2247	c.begin();
2248	c.moveTo(0, h);
2249	c.lineTo(dx, h - dx);
2250	c.lineTo(w - dx, h - dx);
2251	c.lineTo(w, h);
2252	c.close();
2253	c.fillAndStroke();
2254
2255	c.begin();
2256	c.moveTo(0, h);
2257	c.lineTo(0, 0);
2258	c.lineTo(dx, dx);
2259	c.lineTo(dx, h - dx);
2260	c.close();
2261	c.fillAndStroke();
2262
2263
2264};
2265
2266mxCellRenderer.registerShape(mxShapeBasicButton.prototype.cst.BUTTON, mxShapeBasicButton);
2267
2268mxShapeBasicButton.prototype.constraints = null;
2269
2270Graph.handleFactory[mxShapeBasicButton.prototype.cst.BUTTON] = function(state)
2271{
2272	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
2273	{
2274		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
2275
2276		return new mxPoint(bounds.x + dx, bounds.y + dx);
2277	}, function(bounds, pt)
2278	{
2279		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;
2280	})];
2281
2282	return handles;
2283};
2284
2285//**********************************************************************************************************************************************************
2286//Shaded Button
2287//**********************************************************************************************************************************************************
2288/**
2289* Extends mxShape.
2290*/
2291function mxShapeBasicShadedButton(bounds, fill, stroke, strokewidth)
2292{
2293	mxShape.call(this);
2294	this.bounds = bounds;
2295	this.fill = fill;
2296	this.stroke = stroke;
2297	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2298	this.dx = 0.5;
2299};
2300
2301/**
2302* Extends mxShape.
2303*/
2304mxUtils.extend(mxShapeBasicShadedButton, mxActor);
2305
2306mxShapeBasicShadedButton.prototype.customProperties = [
2307	{name: 'dx', dispName: 'Button Height', type: 'float', min:0, defVal:10}
2308];
2309
2310mxShapeBasicShadedButton.prototype.cst = {SHADED_BUTTON : 'mxgraph.basic.shaded_button'};
2311
2312/**
2313* Function: paintVertexShape
2314*
2315* Paints the vertex shape.
2316*/
2317mxShapeBasicShadedButton.prototype.paintVertexShape = function(c, x, y, w, h)
2318{
2319	c.translate(x, y);
2320
2321	c.setShadow(false);
2322
2323	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
2324
2325	dx = Math.min(w * 0.5, h * 0.5, dx);
2326
2327	c.begin();
2328	c.moveTo(0, 0);
2329	c.lineTo(w, 0);
2330	c.lineTo(w, h);
2331	c.lineTo(0, h);
2332	c.close();
2333	c.fill();
2334
2335	c.setFillColor('#ffffff');
2336	c.setAlpha(0.25);
2337	c.begin();
2338	c.moveTo(0, h);
2339	c.lineTo(0, 0);
2340	c.lineTo(dx, dx);
2341	c.lineTo(dx, h - dx);
2342	c.close();
2343	c.fill();
2344
2345	c.setAlpha(0.5);
2346	c.begin();
2347	c.moveTo(0, 0);
2348	c.lineTo(w, 0);
2349	c.lineTo(w - dx, dx);
2350	c.lineTo(dx, dx);
2351	c.close();
2352	c.fill();
2353
2354	c.setFillColor('#000000');
2355	c.setAlpha(0.25);
2356	c.begin();
2357	c.moveTo(w, 0);
2358	c.lineTo(w, h);
2359	c.lineTo(w - dx, h - dx);
2360	c.lineTo(w - dx, dx);
2361	c.close();
2362	c.fill();
2363
2364	c.setAlpha(0.5);
2365	c.begin();
2366	c.moveTo(0, h);
2367	c.lineTo(dx, h - dx);
2368	c.lineTo(w - dx, h - dx);
2369	c.lineTo(w, h);
2370	c.close();
2371	c.fill();
2372
2373
2374};
2375
2376mxCellRenderer.registerShape(mxShapeBasicShadedButton.prototype.cst.SHADED_BUTTON, mxShapeBasicShadedButton);
2377
2378mxShapeBasicShadedButton.prototype.constraints = null;
2379
2380Graph.handleFactory[mxShapeBasicShadedButton.prototype.cst.SHADED_BUTTON] = function(state)
2381{
2382	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
2383	{
2384		var dx = Math.max(0, Math.min(bounds.width / 2, bounds.width / 2, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
2385
2386		return new mxPoint(bounds.x + dx, bounds.y + dx);
2387	}, function(bounds, pt)
2388	{
2389		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, pt.x - bounds.x))) / 100;
2390	})];
2391
2392	return handles;
2393};
2394
2395//**********************************************************************************************************************************************************
2396//Pie
2397//**********************************************************************************************************************************************************
2398/**
2399* Extends mxShape.
2400*/
2401function mxShapeBasicPie(bounds, fill, stroke, strokewidth)
2402{
2403	mxShape.call(this);
2404	this.bounds = bounds;
2405	this.fill = fill;
2406	this.stroke = stroke;
2407	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2408	this.startAngle = 0.25;
2409	this.endAngle = 0.75;
2410};
2411
2412/**
2413* Extends mxShape.
2414*/
2415mxUtils.extend(mxShapeBasicPie, mxActor);
2416
2417mxShapeBasicPie.prototype.customProperties = [
2418	{name: 'startAngle', dispName: 'Start Angle', type: 'float', min:0, max:1, defVal: 0.2},
2419	{name: 'endAngle', dispName: 'End Angle', type: 'float', min:0, max:1, defVal: 0.9}
2420];
2421
2422mxShapeBasicPie.prototype.cst = {PIE : 'mxgraph.basic.pie'};
2423
2424/**
2425* Function: paintVertexShape
2426*
2427* Paints the vertex shape.
2428*/
2429mxShapeBasicPie.prototype.paintVertexShape = function(c, x, y, w, h)
2430{
2431	c.translate(x, y);
2432	var startAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));
2433	var endAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));
2434	var startAngle = 2 * Math.PI * startAngleSource;
2435	var endAngle = 2 * Math.PI * endAngleSource;
2436	var rx = w * 0.5;
2437	var ry = h * 0.5;
2438
2439	var startX = rx + Math.sin(startAngle) * rx;
2440	var startY = ry - Math.cos(startAngle) * ry;
2441	var endX = rx + Math.sin(endAngle) * rx;
2442	var endY = ry - Math.cos(endAngle) * ry;
2443
2444	var angDiff = endAngle - startAngle;
2445
2446	if (angDiff < 0)
2447	{
2448		angDiff = angDiff + Math.PI * 2;
2449	}
2450
2451	var bigArc = 0;
2452
2453	if (angDiff >= Math.PI)
2454	{
2455		bigArc = 1;
2456	}
2457
2458	c.begin();
2459	var startAngleDiff = startAngleSource % 1;
2460	var endAngleDiff = endAngleSource % 1;
2461
2462	if (startAngleDiff == 0 && endAngleDiff == 0.5)
2463	{
2464		c.moveTo(rx, ry);
2465		c.lineTo(startX, startY);
2466		c.arcTo(rx, ry, 0, 0, 1, w, h * 0.5);
2467		c.arcTo(rx, ry, 0, 0, 1, w * 0.5, h);
2468	}
2469	else if (startAngleDiff == 0.5 && endAngleDiff == 0)
2470	{
2471		c.moveTo(rx, ry);
2472		c.lineTo(startX, startY);
2473		c.arcTo(rx, ry, 0, 0, 1, 0, h * 0.5);
2474		c.arcTo(rx, ry, 0, 0, 1, w * 0.5, 0);
2475	}
2476	else
2477	{
2478		c.moveTo(rx, ry);
2479		c.lineTo(startX, startY);
2480		c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);
2481	}
2482
2483	c.close();
2484	c.fillAndStroke();
2485};
2486
2487mxCellRenderer.registerShape(mxShapeBasicPie.prototype.cst.PIE, mxShapeBasicPie);
2488
2489mxShapeBasicPie.prototype.constraints = null;
2490
2491Graph.handleFactory[mxShapeBasicPie.prototype.cst.PIE] = function(state)
2492{
2493	var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)
2494	{
2495		var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));
2496
2497		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);
2498	}, function(bounds, pt)
2499	{
2500		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2501		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2502
2503		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2504
2505		if (res < 0)
2506		{
2507			res = 1 + res;
2508		}
2509
2510		this.state.style['startAngle'] = res;
2511
2512	})];
2513
2514	var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)
2515	{
2516		var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));
2517
2518		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);
2519	}, function(bounds, pt)
2520	{
2521		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2522		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2523
2524		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2525
2526		if (res < 0)
2527		{
2528			res = 1 + res;
2529		}
2530
2531		this.state.style['endAngle'] = res;
2532	});
2533
2534	handles.push(handle2);
2535
2536	return handles;
2537};
2538
2539//**********************************************************************************************************************************************************
2540//Arc
2541//**********************************************************************************************************************************************************
2542/**
2543* Extends mxShape.
2544*/
2545function mxShapeBasicArc(bounds, fill, stroke, strokewidth)
2546{
2547	mxShape.call(this);
2548	this.bounds = bounds;
2549	this.fill = fill;
2550	this.stroke = stroke;
2551	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2552	this.startAngle = 0.25;
2553	this.endAngle = 0.75;
2554};
2555
2556/**
2557* Extends mxShape.
2558*/
2559mxUtils.extend(mxShapeBasicArc, mxActor);
2560
2561mxShapeBasicArc.prototype.customProperties = [
2562	{name: 'startAngle', dispName: 'Start Angle', type: 'float', min:0, max:1, defVal: 0.3},
2563	{name: 'endAngle', dispName: 'End Angle', type: 'float', min:0, max:1, defVal:0.1}
2564];
2565
2566mxShapeBasicArc.prototype.cst = {ARC : 'mxgraph.basic.arc'};
2567
2568/**
2569* Function: paintVertexShape
2570*
2571* Paints the vertex shape.
2572*/
2573mxShapeBasicArc.prototype.paintVertexShape = function(c, x, y, w, h)
2574{
2575	c.translate(x, y);
2576
2577	var startAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));
2578	var endAngleSource = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));
2579	var startAngle = 2 * Math.PI * startAngleSource;
2580	var endAngle = 2 * Math.PI * endAngleSource;
2581	var rx = w * 0.5;
2582	var ry = h * 0.5;
2583
2584	var startX = rx + Math.sin(startAngle) * rx;
2585	var startY = ry - Math.cos(startAngle) * ry;
2586	var endX = rx + Math.sin(endAngle) * rx;
2587	var endY = ry - Math.cos(endAngle) * ry;
2588
2589	var angDiff = endAngle - startAngle;
2590
2591	if (angDiff < 0)
2592	{
2593		angDiff = angDiff + Math.PI * 2;
2594	}
2595
2596	var bigArc = 0;
2597
2598	if (angDiff > Math.PI)
2599	{
2600		bigArc = 1;
2601	}
2602
2603	c.begin();
2604
2605	var startAngleDiff = startAngleSource % 1;
2606	var endAngleDiff = endAngleSource % 1;
2607
2608	if (startAngleDiff == 0 && endAngleDiff == 0.5)
2609	{
2610		c.moveTo(startX, startY);
2611		c.arcTo(rx, ry, 0, 0, 1, w, h * 0.5);
2612		c.arcTo(rx, ry, 0, 0, 1, w * 0.5, h);
2613	}
2614	else if (startAngleDiff == 0.5 && endAngleDiff == 0)
2615	{
2616		c.moveTo(startX, startY);
2617		c.arcTo(rx, ry, 0, 0, 1, 0, h * 0.5);
2618		c.arcTo(rx, ry, 0, 0, 1, w * 0.5, 0);
2619	}
2620	else
2621	{
2622		c.moveTo(startX, startY);
2623		c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);
2624	}
2625
2626	c.stroke();
2627};
2628
2629mxCellRenderer.registerShape(mxShapeBasicArc.prototype.cst.ARC, mxShapeBasicArc);
2630
2631mxShapeBasicArc.prototype.constraints = null;
2632
2633Graph.handleFactory[mxShapeBasicArc.prototype.cst.ARC] = function(state)
2634{
2635	var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)
2636	{
2637		var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));
2638
2639		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);
2640	}, function(bounds, pt)
2641	{
2642		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2643		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2644
2645		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2646
2647		if (res < 0)
2648		{
2649			res = 1 + res;
2650		}
2651
2652		this.state.style['startAngle'] = res;
2653
2654	})];
2655
2656	var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)
2657	{
2658		var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));
2659
2660		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);
2661	}, function(bounds, pt)
2662	{
2663		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2664		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2665
2666		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2667
2668		if (res < 0)
2669		{
2670			res = 1 + res;
2671		}
2672
2673		this.state.style['endAngle'] = res;
2674	});
2675
2676	handles.push(handle2);
2677
2678	return handles;
2679};
2680
2681//**********************************************************************************************************************************************************
2682//Partial Concentric Ellipse
2683//**********************************************************************************************************************************************************
2684/**
2685* Extends mxShape.
2686*/
2687function mxShapeBasicPartConcEllipse(bounds, fill, stroke, strokewidth)
2688{
2689	mxShape.call(this);
2690	this.bounds = bounds;
2691	this.fill = fill;
2692	this.stroke = stroke;
2693	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2694	this.startAngle = 0.25;
2695	this.endAngle = 0.75;
2696	this.arcWidth = 0.5;
2697};
2698
2699/**
2700* Extends mxShape.
2701*/
2702mxUtils.extend(mxShapeBasicPartConcEllipse, mxActor);
2703
2704mxShapeBasicPartConcEllipse.prototype.customProperties = [
2705	{name: 'startAngle', dispName: 'Start Angle', type: 'float', min:0, max:1, defVal:0.25},
2706	{name: 'endAngle', dispName: 'End Angle', type: 'float', min:0, max:1, defVal:0.1},
2707	{name: 'arcWidth', dispName: 'Arc Width', type: 'float', min:0, max:1, defVal:0.5}
2708];
2709
2710mxShapeBasicPartConcEllipse.prototype.cst = {PART_CONC_ELLIPSE : 'mxgraph.basic.partConcEllipse'};
2711
2712/**
2713* Function: paintVertexShape
2714*
2715* Paints the vertex shape.
2716*/
2717mxShapeBasicPartConcEllipse.prototype.paintVertexShape = function(c, x, y, w, h)
2718{
2719	c.translate(x, y);
2720
2721	var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));
2722	var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));
2723	var arcWidth = 1 - Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'arcWidth', this.arcWidth))));
2724	var rx = w * 0.5;
2725	var ry = h * 0.5;
2726	var rx2 = rx * arcWidth;
2727	var ry2 = ry * arcWidth;
2728
2729	var angDiff = endAngle - startAngle;
2730
2731	if (angDiff < 0)
2732	{
2733		angDiff = angDiff + Math.PI * 2;
2734	}
2735	else if (angDiff == Math.PI)
2736	{
2737		endAngle = endAngle + 0.00001;
2738	}
2739
2740	var startX = rx + Math.sin(startAngle) * rx;
2741	var startY = ry - Math.cos(startAngle) * ry;
2742	var innerStartX = rx + Math.sin(startAngle) * rx2;
2743	var innerStartY = ry - Math.cos(startAngle) * ry2;
2744	var endX = rx + Math.sin(endAngle) * rx;
2745	var endY = ry - Math.cos(endAngle) * ry;
2746	var innerEndX = rx + Math.sin(endAngle) * rx2;
2747	var innerEndY = ry - Math.cos(endAngle) * ry2;
2748
2749
2750	var bigArc = 0;
2751
2752	if (angDiff >= Math.PI)
2753	{
2754		bigArc = 1;
2755	}
2756
2757	c.begin();
2758	c.moveTo(startX, startY);
2759	c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);
2760	c.lineTo(innerEndX, innerEndY);
2761	c.arcTo(rx2, ry2, 0, bigArc, 0, innerStartX, innerStartY);
2762	c.close();
2763	c.fillAndStroke();
2764};
2765
2766mxCellRenderer.registerShape(mxShapeBasicPartConcEllipse.prototype.cst.PART_CONC_ELLIPSE, mxShapeBasicPartConcEllipse);
2767
2768mxShapeBasicPartConcEllipse.prototype.constraints = null;
2769
2770Graph.handleFactory[mxShapeBasicPartConcEllipse.prototype.cst.PART_CONC_ELLIPSE] = function(state)
2771{
2772	var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)
2773	{
2774		var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));
2775
2776		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);
2777	}, function(bounds, pt)
2778	{
2779		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2780		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2781
2782		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2783
2784		if (res < 0)
2785		{
2786			res = 1 + res;
2787		}
2788
2789		this.state.style['startAngle'] = res;
2790
2791	})];
2792
2793	var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)
2794	{
2795		var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));
2796
2797		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);
2798	}, function(bounds, pt)
2799	{
2800		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2801		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2802
2803		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2804
2805		if (res < 0)
2806		{
2807			res = 1 + res;
2808		}
2809
2810		this.state.style['endAngle'] = res;
2811	});
2812
2813	handles.push(handle2);
2814
2815	var handle3 = Graph.createHandle(state, ['arcWidth'], function(bounds)
2816	{
2817		var arcWidth = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'arcWidth', this.arcWidth))));
2818
2819		return new mxPoint(bounds.x + bounds.width / 2, bounds.y + arcWidth * bounds.height * 0.5);
2820	}, function(bounds, pt)
2821	{
2822		this.state.style['arcWidth'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, (pt.y - bounds.y) / (bounds.height * 0.5)))) / 100;
2823	});
2824
2825	handles.push(handle3);
2826
2827	return handles;
2828};
2829
2830//**********************************************************************************************************************************************************
2831//Numbered entry (vertical)
2832//**********************************************************************************************************************************************************
2833/**
2834* Extends mxShape.
2835*/
2836function mxShapeBasicNumEntryVert(bounds, fill, stroke, strokewidth)
2837{
2838	mxShape.call(this);
2839	this.bounds = bounds;
2840	this.fill = fill;
2841	this.stroke = stroke;
2842	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2843	this.dy = 0.5;
2844};
2845
2846/**
2847* Extends mxShape.
2848*/
2849mxUtils.extend(mxShapeBasicNumEntryVert, mxActor);
2850
2851mxShapeBasicNumEntryVert.prototype.cst = {NUM_ENTRY_VERT : 'mxgraph.basic.numberedEntryVert'};
2852
2853/**
2854* Function: paintVertexShape
2855*
2856* Paints the vertex shape.
2857*/
2858mxShapeBasicNumEntryVert.prototype.paintVertexShape = function(c, x, y, w, h)
2859{
2860	c.translate(x, y);
2861
2862	var dy = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dy', this.dy))));
2863
2864	var inset = 5;
2865
2866	var d = Math.min(dy, w - 2 * inset, h - inset);
2867
2868	c.ellipse(w * 0.5 - d * 0.5, 0, d, d);
2869	c.fillAndStroke();
2870
2871	c.begin();
2872	c.moveTo(0, d * 0.5);
2873	c.lineTo(w * 0.5 - d * 0.5 - inset, d * 0.5);
2874	c.arcTo(d * 0.5 + inset, d * 0.5 + inset, 0, 0, 0, w * 0.5 + d * 0.5 + inset, d * 0.5);
2875	c.lineTo(w, d * 0.5);
2876	c.lineTo(w, h);
2877	c.lineTo(0, h);
2878	c.close();
2879	c.fillAndStroke();
2880};
2881
2882mxCellRenderer.registerShape(mxShapeBasicNumEntryVert.prototype.cst.NUM_ENTRY_VERT, mxShapeBasicNumEntryVert);
2883
2884mxShapeBasicNumEntryVert.prototype.constraints = null;
2885
2886Graph.handleFactory[mxShapeBasicNumEntryVert.prototype.cst.NUM_ENTRY_VERT] = function(state)
2887{
2888	var handles = [Graph.createHandle(state, ['dy'], function(bounds)
2889	{
2890		var dy = Math.max(0, Math.min(bounds.width, bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'dy', this.dy))));
2891
2892		return new mxPoint(bounds.x + bounds.width / 2, bounds.y + dy);
2893	}, function(bounds, pt)
2894	{
2895		this.state.style['dy'] = Math.round(100 * Math.max(0, Math.min(bounds.height, bounds.width, pt.y - bounds.y))) / 100;
2896	})];
2897
2898	return handles;
2899};
2900
2901//**********************************************************************************************************************************************************
2902//Bending Arch
2903//**********************************************************************************************************************************************************
2904/**
2905* Extends mxShape.
2906*/
2907function mxShapeBasicBendingArch(bounds, fill, stroke, strokewidth)
2908{
2909	mxShape.call(this);
2910	this.bounds = bounds;
2911	this.fill = fill;
2912	this.stroke = stroke;
2913	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
2914	this.startAngle = 0.25;
2915	this.endAngle = 0.75;
2916	this.arcWidth = 0.5;
2917};
2918
2919/**
2920* Extends mxShape.
2921*/
2922mxUtils.extend(mxShapeBasicBendingArch, mxActor);
2923
2924mxShapeBasicBendingArch.prototype.cst = {BENDING_ARCH : 'mxgraph.basic.bendingArch'};
2925
2926/**
2927* Function: paintVertexShape
2928*
2929* Paints the vertex shape.
2930*/
2931mxShapeBasicBendingArch.prototype.paintVertexShape = function(c, x, y, w, h)
2932{
2933	c.translate(x, y);
2934
2935	var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'startAngle', this.startAngle))));
2936	var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'endAngle', this.endAngle))));
2937	var arcWidth = 1 - Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.style, 'arcWidth', this.arcWidth))));
2938	var rx = w * 0.5;
2939	var ry = h * 0.5;
2940	var rx2 = rx * arcWidth;
2941	var ry2 = ry * arcWidth;
2942
2943	var startX = rx + Math.sin(startAngle) * rx;
2944	var startY = ry - Math.cos(startAngle) * ry;
2945	var innerStartX = rx + Math.sin(startAngle) * rx2;
2946	var innerStartY = ry - Math.cos(startAngle) * ry2;
2947	var endX = rx + Math.sin(endAngle) * rx;
2948	var endY = ry - Math.cos(endAngle) * ry;
2949	var innerEndX = rx + Math.sin(endAngle) * rx2;
2950	var innerEndY = ry - Math.cos(endAngle) * ry2;
2951
2952	var angDiff = endAngle - startAngle;
2953
2954	if (angDiff < 0)
2955	{
2956		angDiff = angDiff + Math.PI * 2;
2957	}
2958
2959	var bigArc = 0;
2960
2961	if (angDiff > Math.PI)
2962	{
2963		bigArc = 1;
2964	}
2965
2966	var rx3 = rx2 - 5;
2967	var ry3 = ry2 - 5;
2968
2969	c.ellipse(w * 0.5 - rx3, h * 0.5 - ry3, 2 * rx3, 2 * ry3);
2970	c.fillAndStroke();
2971
2972	c.begin();
2973	c.moveTo(startX, startY);
2974	c.arcTo(rx, ry, 0, bigArc, 1, endX, endY);
2975	c.lineTo(innerEndX, innerEndY);
2976	c.arcTo(rx2, ry2, 0, bigArc, 0, innerStartX, innerStartY);
2977	c.close();
2978	c.fillAndStroke();
2979};
2980
2981mxCellRenderer.registerShape(mxShapeBasicBendingArch.prototype.cst.BENDING_ARCH, mxShapeBasicBendingArch);
2982
2983mxShapeBasicBendingArch.prototype.constraints = null;
2984
2985Graph.handleFactory[mxShapeBasicBendingArch.prototype.cst.BENDING_ARCH] = function(state)
2986{
2987	var handles = [Graph.createHandle(state, ['startAngle'], function(bounds)
2988	{
2989		var startAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'startAngle', this.startAngle))));
2990
2991		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(startAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(startAngle) * bounds.height * 0.5);
2992	}, function(bounds, pt)
2993	{
2994		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
2995		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
2996
2997		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
2998
2999		if (res < 0)
3000		{
3001			res = 1 + res;
3002		}
3003
3004		this.state.style['startAngle'] = res;
3005
3006	})];
3007
3008	var handle2 = Graph.createHandle(state, ['endAngle'], function(bounds)
3009	{
3010		var endAngle = 2 * Math.PI * Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'endAngle', this.endAngle))));
3011
3012		return new mxPoint(bounds.x + bounds.width * 0.5 + Math.sin(endAngle) * bounds.width * 0.5, bounds.y + bounds.height * 0.5 - Math.cos(endAngle) * bounds.height * 0.5);
3013	}, function(bounds, pt)
3014	{
3015		var handleX = Math.round(100 * Math.max(-1, Math.min(1, (pt.x - bounds.x - bounds.width * 0.5) / (bounds.width * 0.5)))) / 100;
3016		var handleY = -Math.round(100 * Math.max(-1, Math.min(1, (pt.y - bounds.y - bounds.height * 0.5) / (bounds.height * 0.5)))) / 100;
3017
3018		var res =  0.5 * Math.atan2(handleX, handleY) / Math.PI;
3019
3020		if (res < 0)
3021		{
3022			res = 1 + res;
3023		}
3024
3025		this.state.style['endAngle'] = res;
3026	});
3027
3028	handles.push(handle2);
3029
3030	var handle3 = Graph.createHandle(state, ['arcWidth'], function(bounds)
3031	{
3032		var arcWidth = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'arcWidth', this.arcWidth))));
3033
3034		return new mxPoint(bounds.x + bounds.width / 2, bounds.y + arcWidth * bounds.height * 0.5);
3035	}, function(bounds, pt)
3036	{
3037		this.state.style['arcWidth'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 2, bounds.width / 2, (pt.y - bounds.y) / (bounds.height * 0.5)))) / 100;
3038	});
3039
3040	handles.push(handle3);
3041
3042	return handles;
3043};
3044
3045//**********************************************************************************************************************************************************
3046//Three Corner Round Rectangle
3047//**********************************************************************************************************************************************************
3048/**
3049* Extends mxShape.
3050*/
3051function mxShapeBasicThreeCornerRoundRect(bounds, fill, stroke, strokewidth)
3052{
3053	mxShape.call(this);
3054	this.bounds = bounds;
3055	this.fill = fill;
3056	this.stroke = stroke;
3057	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
3058	this.dx = 0.5;
3059};
3060
3061/**
3062* Extends mxShape.
3063*/
3064mxUtils.extend(mxShapeBasicThreeCornerRoundRect, mxActor);
3065
3066mxShapeBasicThreeCornerRoundRect.prototype.customProperties = [
3067	{name: 'dx', dispName: 'Rounding Size', type: 'float', min:0, defVal:6}
3068];
3069
3070mxShapeBasicThreeCornerRoundRect.prototype.cst = {THREE_CORNER_ROUND_RECT : 'mxgraph.basic.three_corner_round_rect'};
3071
3072/**
3073* Function: paintVertexShape
3074*
3075* Paints the vertex shape.
3076*/
3077mxShapeBasicThreeCornerRoundRect.prototype.paintVertexShape = function(c, x, y, w, h)
3078{
3079	c.translate(x, y);
3080
3081	var dx = Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx)))) * 2;
3082
3083	dx = Math.min(w * 0.5, h * 0.5, dx);
3084
3085	c.begin();
3086	c.moveTo(dx, 0);
3087	c.lineTo(w - dx, 0);
3088	c.arcTo(dx, dx, 0, 0, 1, w, dx);
3089	c.lineTo(w, h - dx);
3090	c.arcTo(dx, dx, 0, 0, 1, w - dx, h);
3091	c.lineTo(0, h);
3092	c.lineTo(0, dx);
3093	c.arcTo(dx, dx, 0, 0, 1, dx, 0);
3094	c.close();
3095	c.fillAndStroke();
3096};
3097
3098mxCellRenderer.registerShape(mxShapeBasicThreeCornerRoundRect.prototype.cst.THREE_CORNER_ROUND_RECT, mxShapeBasicThreeCornerRoundRect);
3099
3100mxShapeBasicThreeCornerRoundRect.prototype.constraints = null;
3101
3102Graph.handleFactory[mxShapeBasicThreeCornerRoundRect.prototype.cst.THREE_CORNER_ROUND_RECT] = function(state)
3103{
3104	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
3105	{
3106		var dx = Math.max(0, Math.min(bounds.width / 4, bounds.width / 4, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
3107
3108		return new mxPoint(bounds.x + dx, bounds.y + dx);
3109	}, function(bounds, pt)
3110	{
3111		this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(bounds.height / 4, bounds.width / 4, pt.x - bounds.x))) / 100;
3112	})];
3113
3114	return handles;
3115};
3116
3117mxShapeBasicThreeCornerRoundRect.prototype.getConstraints = function(style, w, h)
3118{
3119	var constr = [];
3120
3121	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
3122	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
3123	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
3124	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
3125	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
3126
3127	return (constr);
3128}
3129
3130//**********************************************************************************************************************************************************
3131//Polygon
3132//**********************************************************************************************************************************************************
3133/**
3134* Extends mxShape.
3135*/
3136function mxShapeBasicPolygon(bounds, fill, stroke, strokewidth)
3137{
3138	mxShape.call(this);
3139	this.bounds = bounds;
3140	this.fill = fill;
3141	this.stroke = stroke;
3142	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
3143	this.dx = 0.5;
3144	this.dy = 0.5;
3145};
3146
3147/**
3148* Extends mxShape.
3149*/
3150mxUtils.extend(mxShapeBasicPolygon, mxActor);
3151
3152mxShapeBasicPolygon.prototype.customProperties = [
3153	{name: 'polyline', dispName: 'Polyline', type: 'bool', defVal:false},
3154];
3155
3156mxShapeBasicPolygon.prototype.cst = {POLYGON : 'mxgraph.basic.polygon'};
3157
3158/**
3159* Function: paintVertexShape
3160*
3161* Paints the vertex shape.
3162*/
3163mxShapeBasicPolygon.prototype.paintVertexShape = function(c, x, y, w, h)
3164{
3165    try
3166    {
3167        c.translate(x, y);
3168        var coords = JSON.parse(mxUtils.getValue(this.state.style, 'polyCoords', '[]'));
3169    	var polyline = mxUtils.getValue(this.style, 'polyline', false);
3170
3171        if (coords.length > 0)
3172        {
3173            c.begin();
3174            c.moveTo(coords[0][0] * w, coords[0][1] * h);
3175
3176            for (var i = 1; i < coords.length; i++)
3177            {
3178                c.lineTo(coords[i][0] * w, coords[i][1] * h);
3179            }
3180
3181            if (polyline == false)
3182            {
3183                c.close();
3184            }
3185
3186            c.end();
3187            c.fillAndStroke();
3188        }
3189    }
3190    catch (e)
3191    {
3192        // ignore
3193    }
3194};
3195
3196mxCellRenderer.registerShape(mxShapeBasicPolygon.prototype.cst.POLYGON, mxShapeBasicPolygon);
3197
3198mxShapeBasicPolygon.prototype.constraints = null;
3199
3200Graph.handleFactory[mxShapeBasicPolygon.prototype.cst.POLYGON] = function(state)
3201{
3202    var handles = [];
3203
3204    try
3205    {
3206        var c = JSON.parse(mxUtils.getValue(state.style, 'polyCoords', '[]'));
3207
3208        for (var i = 0; i < c.length; i++)
3209        {
3210            (function(index)
3211            {
3212                handles.push(Graph.createHandle(state, ['polyCoords'], function(bounds)
3213                {
3214                    return new mxPoint(bounds.x + c[index][0] * bounds.width, bounds.y + c[index][1] * bounds.height);
3215                }, function(bounds, pt)
3216                {
3217                    var x = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
3218                    var y = Math.round(100 * Math.max(0, Math.min(1, (pt.y - bounds.y) / bounds.height))) / 100;
3219
3220                    c[index] = [x, y];
3221                    state.style['polyCoords'] = JSON.stringify(c);
3222
3223                }, false));
3224            })(i);
3225        }
3226    }
3227    catch (e)
3228    {
3229        // ignore
3230    }
3231
3232    return handles;
3233};
3234
3235//**********************************************************************************************************************************************************
3236//Rectangle with pattern fill
3237//**********************************************************************************************************************************************************
3238/**
3239* Extends mxShape.
3240*/
3241function mxShapeBasicPatternFillRect(bounds, fill, stroke, strokewidth)
3242{
3243	mxShape.call(this);
3244	this.bounds = bounds;
3245	this.fill = fill;
3246	this.stroke = stroke;
3247	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
3248	this.dx = 0.5;
3249};
3250
3251/**
3252* Extends mxShape.
3253*/
3254mxUtils.extend(mxShapeBasicPatternFillRect, mxActor);
3255
3256mxShapeBasicPatternFillRect.prototype.cst = {PATTERN_FILL_RECT : 'mxgraph.basic.patternFillRect'};
3257
3258mxShapeBasicPatternFillRect.prototype.customProperties = [
3259	{name: 'step', dispName: 'Fill Step', type: 'float', min:0, defVal:5},
3260	{name: 'fillStyle', dispName: 'Fill Style', type: 'enum', defVal:'none',
3261		enumList:[
3262			{val: 'none', dispName: 'None'},
3263			{val: 'diag', dispName: 'Diagonal'},
3264			{val: 'diagRev', dispName: 'Diagonal Reverse'},
3265			{val: 'vert', dispName: 'Vertical'},
3266			{val: 'hor', dispName: 'Horizontal'},
3267			{val: 'grid', dispName: 'Grid'},
3268			{val: 'diagGrid', dispName: 'Diagonal Grid'}
3269	]},
3270	{name: 'fillStrokeWidth', dispName: 'Fill Stroke Width', type: 'float', min:0, defVal:1},
3271	{name: 'fillStrokeColor', dispName: 'Fill Stroke Color', type: 'color', defVal:'#cccccc'},
3272	{name: 'top', dispName: 'Top Line', type: 'bool', defVal:true},
3273	{name: 'right', dispName: 'Right Line', type: 'bool', defVal:true},
3274	{name: 'bottom', dispName: 'Bottom Line', type: 'bool', defVal:true},
3275	{name: 'left', dispName: 'Left Line', type: 'bool', defVal:true}
3276];
3277
3278/**
3279* Function: paintVertexShape
3280*
3281* Paints the vertex shape.
3282*/
3283mxShapeBasicPatternFillRect.prototype.paintVertexShape = function(c, x, y, w, h)
3284{
3285	c.translate(x, y);
3286
3287	var strokeColor = mxUtils.getValue(this.style, 'strokeColor', '#000000');
3288	var strokeWidth = mxUtils.getValue(this.style, 'strokeWidth', '1');
3289
3290	c.rect(0, 0, w, h);
3291	c.fill();
3292
3293	var fillStrokeColor = mxUtils.getValue(this.style, 'fillStrokeColor', '#cccccc');
3294	var fillStrokeWidth = parseFloat(mxUtils.getValue(this.style, 'fillStrokeWidth', 1));
3295
3296	c.setStrokeColor(fillStrokeColor);
3297	c.setStrokeWidth(fillStrokeWidth);
3298
3299	var step = parseFloat(mxUtils.getValue(this.style, 'step', 5));
3300	var fillStyle = mxUtils.getValue(this.style, 'fillStyle', 'none');
3301
3302	if (fillStyle == 'diag' || fillStyle == 'diagGrid')
3303	{
3304		step = step * 1.41;
3305		var i = 0;
3306
3307		c.begin();
3308
3309		while (i < (h + w))
3310		{
3311			var cx = 0;
3312			var cy = 0;
3313
3314			if (i <= h)
3315			{
3316				c.moveTo(0, i);
3317
3318				if(i <= w)
3319				{
3320					c.lineTo(i, 0);
3321				}
3322				else
3323				{
3324					c.lineTo(w, i - w);
3325				}
3326			}
3327			else
3328			{
3329				c.moveTo(i - h, h);
3330
3331				if(i <= w)
3332				{
3333					c.lineTo(i, 0);
3334				}
3335				else
3336				{
3337					c.lineTo(w, i - w);
3338				}
3339			}
3340
3341			i = i + step;
3342		}
3343
3344		c.stroke();
3345	}
3346	else if (fillStyle == 'vert' || fillStyle == 'grid')
3347	{
3348		c.begin();
3349		var i = 0;
3350
3351		while (i <= w)
3352		{
3353			var cx = 0;
3354			var cy = 0;
3355
3356			c.moveTo(i, 0);
3357			c.lineTo(i, h);
3358
3359			i = i + step;
3360		}
3361
3362		c.stroke();
3363	}
3364
3365	if (fillStyle == 'diagRev' || fillStyle == 'diagGrid')
3366	{
3367		if (fillStyle == 'diagRev')
3368		{
3369			step = step * 1.41;
3370		}
3371
3372		var i = 0;
3373
3374		c.begin();
3375
3376		while (i < (h + w))
3377		{
3378			var cx = 0;
3379			var cy = 0;
3380
3381			if (i <= h)
3382			{
3383				c.moveTo(w, i);
3384
3385				if(i <= w)
3386				{
3387					c.lineTo(w - i, 0);
3388				}
3389				else
3390				{
3391					c.lineTo(w - w, i - w);
3392				}
3393			}
3394			else
3395			{
3396				c.moveTo(w - i + h, h);
3397
3398				if(i <= w)
3399				{
3400					c.lineTo(w - i, 0);
3401				}
3402				else
3403				{
3404					c.lineTo(0, i - w);
3405				}
3406			}
3407
3408			i = i + step;
3409		}
3410
3411		c.stroke();
3412	}
3413	else if (fillStyle == 'hor' || fillStyle == 'grid')
3414	{
3415		c.begin();
3416		var i = 0;
3417
3418		while (i <= h)
3419		{
3420			var cx = 0;
3421			var cy = 0;
3422
3423			c.moveTo(0, i);
3424			c.lineTo(w, i);
3425
3426			i = i + step;
3427		}
3428
3429		c.stroke();
3430	}
3431
3432	c.setStrokeColor(strokeColor);
3433	c.setStrokeWidth(strokeWidth);
3434
3435	c.begin();
3436	c.moveTo(0, 0);
3437
3438	if (mxUtils.getValue(this.style, 'top', '1') == '1')
3439	{
3440		c.lineTo(w, 0);
3441	}
3442	else
3443	{
3444		c.moveTo(w, 0);
3445	}
3446
3447	if (mxUtils.getValue(this.style, 'right', '1') == '1')
3448	{
3449		c.lineTo(w, h);
3450	}
3451	else
3452	{
3453		c.moveTo(w, h);
3454	}
3455
3456	if (mxUtils.getValue(this.style, 'bottom', '1') == '1')
3457	{
3458		c.lineTo(0, h);
3459	}
3460	else
3461	{
3462		c.moveTo(0, h);
3463	}
3464
3465	if (mxUtils.getValue(this.style, 'left', '1') == '1')
3466	{
3467		c.lineTo(0, 0);
3468	}
3469
3470	c.end();
3471	c.stroke();
3472};
3473
3474mxCellRenderer.registerShape(mxShapeBasicPatternFillRect.prototype.cst.PATTERN_FILL_RECT, mxShapeBasicPatternFillRect);
3475
3476mxShapeBasicPatternFillRect.prototype.getConstraints = function(style, w, h)
3477{
3478	var constr = [];
3479
3480	constr.push(new mxConnectionConstraint(new mxPoint(0, 0), false));
3481	constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0), false));
3482	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0), false));
3483	constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0), false));
3484	constr.push(new mxConnectionConstraint(new mxPoint(1, 0), false));
3485	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.25), false));
3486	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.5), false));
3487	constr.push(new mxConnectionConstraint(new mxPoint(1, 0.75), false));
3488	constr.push(new mxConnectionConstraint(new mxPoint(1, 1), false));
3489	constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
3490	constr.push(new mxConnectionConstraint(new mxPoint(0.75, 1), false));
3491	constr.push(new mxConnectionConstraint(new mxPoint(0.5, 1), false));
3492	constr.push(new mxConnectionConstraint(new mxPoint(0.25, 1), false));
3493	constr.push(new mxConnectionConstraint(new mxPoint(0, 1), false));
3494	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.75), false));
3495	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.5), false));
3496	constr.push(new mxConnectionConstraint(new mxPoint(0, 0.25), false));
3497
3498	return (constr);
3499}
3500
3501