in plugins/struts2-dojo-plugin/src/main/resources/org/apache/struts2/static/dojo/src/gfx/vml.js [551:932]
}, {_updateWithSegment:function (segment) {
var last = dojo.lang.shallowCopy(this.last);
dojo.gfx.Path.superclass._updateWithSegment.apply(this, arguments);
var path = this[this.renderers[segment.action]](segment, last);
if (typeof (this.vmlPath) == "string") {
this.vmlPath += path.join("");
} else {
this.vmlPath = this.vmlPath.concat(path);
}
if (typeof (this.vmlPath) == "string") {
this.rawNode.path.v = this.vmlPath + " e";
}
}, attachShape:function (rawNode) {
var shape = dojo.lang.shallowCopy(dojo.gfx.defaultPath, true);
var p = rawNode.path.v.match(dojo.gfx.pathRegExp);
var t = [], skip = false;
for (var i = 0; i < p.length; ++p) {
var s = p[i];
if (s in this._pathVmlToSvgMap) {
skip = false;
t.push(this._pathVmlToSvgMap[s]);
} else {
if (!skip) {
var n = parseInt(s);
if (isNaN(n)) {
skip = true;
} else {
t.push(n);
}
}
}
}
if (t.length) {
shape.path = t.join(" ");
}
return shape;
}, setShape:function (newShape) {
this.vmlPath = [];
this.lastControl = {};
dojo.gfx.Path.superclass.setShape.apply(this, arguments);
this.vmlPath = this.vmlPath.join("");
this.rawNode.path.v = this.vmlPath + " e";
return this;
}, _pathVmlToSvgMap:{m:"M", l:"L", t:"m", r:"l", c:"C", v:"c", qb:"Q", x:"z", e:""}, renderers:{M:"_moveToA", m:"_moveToR", L:"_lineToA", l:"_lineToR", H:"_hLineToA", h:"_hLineToR", V:"_vLineToA", v:"_vLineToR", C:"_curveToA", c:"_curveToR", S:"_smoothCurveToA", s:"_smoothCurveToR", Q:"_qCurveToA", q:"_qCurveToR", T:"_qSmoothCurveToA", t:"_qSmoothCurveToR", A:"_arcTo", a:"_arcTo", Z:"_closePath", z:"_closePath"}, _addArgs:function (path, args, from, upto) {
if (typeof (upto) == "undefined") {
upto = args.length;
}
if (typeof (from) == "undefined") {
from = 0;
}
for (var i = from; i < upto; ++i) {
path.push(" ");
path.push(args[i].toFixed());
}
}, _addArgsAdjusted:function (path, last, args, from, upto) {
if (typeof (upto) == "undefined") {
upto = args.length;
}
if (typeof (from) == "undefined") {
from = 0;
}
for (var i = from; i < upto; i += 2) {
path.push(" ");
path.push((last.x + args[i]).toFixed());
path.push(" ");
path.push((last.y + args[i + 1]).toFixed());
}
}, _moveToA:function (segment) {
var p = [" m"];
var n = segment.args;
var l = n.length;
if (l == 2) {
this._addArgs(p, n);
} else {
this._addArgs(p, n, 0, 2);
p.push(" l");
this._addArgs(p, n, 2);
}
this.lastControl = {};
return p;
}, _moveToR:function (segment, last) {
var p = ["x" in last ? " t" : " m"];
var n = segment.args;
var l = n.length;
if (l == 2) {
this._addArgs(p, n);
} else {
this._addArgs(p, n, 0, 2);
p.push(" r");
this._addArgs(p, n, 2);
}
this.lastControl = {};
return p;
}, _lineToA:function (segment) {
var p = [" l"];
this._addArgs(p, segment.args);
this.lastControl = {};
return p;
}, _lineToR:function (segment) {
var p = [" r"];
this._addArgs(p, segment.args);
this.lastControl = {};
return p;
}, _hLineToA:function (segment, last) {
var p = [" l"];
var n = segment.args;
var l = n.length;
var y = " " + last.y.toFixed();
for (var i = 0; i < l; ++i) {
p.push(" ");
p.push(n[i].toFixed());
p.push(y);
}
this.lastControl = {};
return p;
}, _hLineToR:function (segment) {
var p = [" r"];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; ++i) {
p.push(" ");
p.push(n[i].toFixed());
p.push(" 0");
}
this.lastControl = {};
return p;
}, _vLineToA:function (segment, last) {
var p = [" l"];
var n = segment.args;
var l = n.length;
var x = " " + last.x.toFixed();
for (var i = 0; i < l; ++i) {
p.push(x);
p.push(" ");
p.push(n[i].toFixed());
}
this.lastControl = {};
return p;
}, _vLineToR:function (segment) {
var p = [" r"];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; ++i) {
p.push(" 0 ");
p.push(n[i].toFixed());
}
this.lastControl = {};
return p;
}, _curveToA:function (segment) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 6) {
p.push(" c");
this._addArgs(p, n, i, i + 6);
}
this.lastControl = {x:n[l - 4], y:n[l - 3], type:"C"};
return p;
}, _curveToR:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 6) {
p.push(" v");
this._addArgs(p, n, i, i + 6);
this.lastControl = {x:last.x + n[i + 2], y:last.y + n[i + 3]};
last.x += n[i + 4];
last.y += n[i + 5];
}
this.lastControl.type = "C";
return p;
}, _smoothCurveToA:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 4) {
p.push(" c");
if (this.lastControl.type == "C") {
this._addArgs(p, [2 * last.x - this.lastControl.x, 2 * last.y - this.lastControl.y]);
} else {
this._addArgs(p, [last.x, last.y]);
}
this._addArgs(p, n, i, i + 4);
}
this.lastControl = {x:n[l - 4], y:n[l - 3], type:"C"};
return p;
}, _smoothCurveToR:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 4) {
p.push(" v");
if (this.lastControl.type == "C") {
this._addArgs(p, [last.x - this.lastControl.x, last.y - this.lastControl.y]);
} else {
this._addArgs(p, [0, 0]);
}
this._addArgs(p, n, i, i + 4);
this.lastControl = {x:last.x + n[i], y:last.y + n[i + 1]};
last.x += n[i + 2];
last.y += n[i + 3];
}
this.lastControl.type = "C";
return p;
}, _qCurveToA:function (segment) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 4) {
p.push(" qb");
this._addArgs(p, n, i, i + 4);
}
this.lastControl = {x:n[l - 4], y:n[l - 3], type:"Q"};
return p;
}, _qCurveToR:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 4) {
p.push(" qb");
this._addArgsAdjusted(p, last, n, i, i + 4);
this.lastControl = {x:last.x + n[i], y:last.y + n[i + 1]};
last.x += n[i + 2];
last.y += n[i + 3];
}
this.lastControl.type = "Q";
return p;
}, _qSmoothCurveToA:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 2) {
p.push(" qb");
if (this.lastControl.type == "Q") {
this._addArgs(p, [this.lastControl.x = 2 * last.x - this.lastControl.x, this.lastControl.y = 2 * last.y - this.lastControl.y]);
} else {
this._addArgs(p, [this.lastControl.x = last.x, this.lastControl.y = last.y]);
}
this._addArgs(p, n, i, i + 2);
}
this.lastControl.type = "Q";
return p;
}, _qSmoothCurveToR:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
for (var i = 0; i < l; i += 2) {
p.push(" qb");
if (this.lastControl.type == "Q") {
this._addArgs(p, [this.lastControl.x = 2 * last.x - this.lastControl.x, this.lastControl.y = 2 * last.y - this.lastControl.y]);
} else {
this._addArgs(p, [this.lastControl.x = last.x, this.lastControl.y = last.y]);
}
this._addArgsAdjusted(p, last, n, i, i + 2);
}
this.lastControl.type = "Q";
return p;
}, _PI4:Math.PI / 4, _curvePI4:dojo.gfx.path._calcArc(Math.PI / 8), _calcArcTo:function (path, last, rx, ry, xRotg, large, cw, x, y) {
var m = dojo.gfx.matrix;
var xRot = -dojo.math.degToRad(xRotg);
var rx2 = rx * rx;
var ry2 = ry * ry;
var pa = m.multiplyPoint(m.rotate(-xRot), {x:(last.x - x) / 2, y:(last.y - y) / 2});
var pax2 = pa.x * pa.x;
var pay2 = pa.y * pa.y;
var c1 = Math.sqrt((rx2 * ry2 - rx2 * pay2 - ry2 * pax2) / (rx2 * pay2 + ry2 * pax2));
var ca = {x:c1 * rx * pa.y / ry, y:-c1 * ry * pa.x / rx};
if (large == cw) {
ca = {x:-ca.x, y:-ca.y};
}
var c = m.multiplyPoint([m.translate((last.x + x) / 2, (last.y + y) / 2), m.rotate(xRot)], ca);
var startAngle = Math.atan2(c.y - last.y, last.x - c.x) - xRot;
var endAngle = Math.atan2(c.y - y, x - c.x) - xRot;
var theta = cw ? startAngle - endAngle : endAngle - startAngle;
if (theta < 0) {
theta += this._2PI;
} else {
if (theta > this._2PI) {
theta = this._2PI;
}
}
var elliptic_transform = m.normalize([m.translate(c.x, c.y), m.rotate(xRot), m.scale(rx, ry)]);
var alpha = this._PI4 / 2;
var curve = this._curvePI4;
var step = cw ? -alpha : alpha;
for (var angle = theta; angle > 0; angle -= this._PI4) {
if (angle < this._PI4) {
alpha = angle / 2;
curve = dojo.gfx.path._calcArc(alpha);
step = cw ? -alpha : alpha;
}
var c1, c2, e;
var M = m.normalize([elliptic_transform, m.rotate(startAngle + step)]);
if (cw) {
c1 = m.multiplyPoint(M, curve.c2);
c2 = m.multiplyPoint(M, curve.c1);
e = m.multiplyPoint(M, curve.s);
} else {
c1 = m.multiplyPoint(M, curve.c1);
c2 = m.multiplyPoint(M, curve.c2);
e = m.multiplyPoint(M, curve.e);
}
path.push(" c");
this._addArgs(path, [c1.x, c1.y, c2.x, c2.y, e.x, e.y]);
startAngle += 2 * step;
}
}, _arcTo:function (segment, last) {
var p = [];
var n = segment.args;
var l = n.length;
var relative = segment.action == "a";
for (var i = 0; i < l; i += 7) {
var x1 = n[i + 5];
var y1 = n[i + 6];
if (relative) {
x1 += last.x;
y1 += last.y;
}
this._calcArcTo(p, last, n[i], n[i + 1], n[i + 2], n[i + 3] ? 1 : 0, n[i + 4] ? 1 : 0, x1, y1);
last = {x:x1, y:y1};
}
this.lastControl = {};
return p;
}, _closePath:function () {
this.lastControl = {};
return ["x"];
}});
dojo.gfx.Path.nodeType = "shape";
dojo.gfx._creators = {createPath:function (path) {
return this.createObject(dojo.gfx.Path, path, true);
}, createRect:function (rect) {
return this.createObject(dojo.gfx.Rect, rect);
}, createCircle:function (circle) {
return this.createObject(dojo.gfx.Circle, circle);
}, createEllipse:function (ellipse) {
return this.createObject(dojo.gfx.Ellipse, ellipse);
}, createLine:function (line) {
return this.createObject(dojo.gfx.Line, line, true);
}, createPolyline:function (points) {
return this.createObject(dojo.gfx.Polyline, points, true);
}, createImage:function (image) {
if (!this.rawNode) {
return null;
}
var shape = new dojo.gfx.Image();
var node = document.createElement("div");
node.style.position = "relative";
node.style.width = this.rawNode.style.width;
node.style.height = this.rawNode.style.height;
node.style.filter = "progid:DXImageTransform.Microsoft.Matrix(M11=1, M12=0, M21=0, M22=1, Dx=0, Dy=0)";
var img = document.createElement("img");
node.appendChild(img);
shape.setRawNode(node);
this.rawNode.appendChild(node);
shape.setShape(image);
this.add(shape);
return shape;
}, createGroup:function () {
return this.createObject(dojo.gfx.Group, null, true);
}, createObject:function (shapeType, rawShape, overrideSize) {
if (!this.rawNode) {
return null;
}
var shape = new shapeType();
var node = document.createElement("v:" + shapeType.nodeType);
shape.setRawNode(node);
this.rawNode.appendChild(node);
if (overrideSize) {
this._overrideSize(node);
}
shape.setShape(rawShape);
this.add(shape);
return shape;
}, _overrideSize:function (node) {
node.style.width = this.rawNode.style.width;
node.style.height = this.rawNode.style.height;
node.coordsize = parseFloat(node.style.width) + " " + parseFloat(node.style.height);
}};
dojo.lang.extend(dojo.gfx.Group, dojo.gfx._creators);
dojo.lang.extend(dojo.gfx.Surface, dojo.gfx._creators);
delete dojo.gfx._creators;
dojo.gfx.attachNode = function (node) {