| 1 |
define([ |
| 2 |
"dojo/_base/kernel", |
| 3 |
"dojo/_base/lang", |
| 4 |
"dojo/_base/sniff", |
| 5 |
"dojox/gfx", |
| 6 |
"dojox/gfx/shape" |
| 7 |
], function(dojo, lang, sniff, gfx, shape){ |
| 8 |
|
| 9 |
var dgo = lang.getObject("geo.openlayers", true, dojox); |
| 10 |
|
| 11 |
dgo.Patch = { |
| 12 |
|
| 13 |
patchMethod: function(type, method, execBefore, |
| 14 |
execAfter){ |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
var old = type.prototype[method]; |
| 36 |
type.prototype[method] = function(){ |
| 37 |
var callee = method; |
| 38 |
if(execBefore){ |
| 39 |
execBefore.call(this, callee, arguments); |
| 40 |
} |
| 41 |
var ret = old.apply(this, arguments); |
| 42 |
if(execAfter){ |
| 43 |
ret = execAfter.call(this, callee, ret, arguments) || ret; |
| 44 |
} |
| 45 |
return ret; |
| 46 |
}; |
| 47 |
}, |
| 48 |
|
| 49 |
patchGFX: function(){ |
| 50 |
|
| 51 |
var vmlFixRawNodePath = function(){ |
| 52 |
if(!this.rawNode.path){ |
| 53 |
this.rawNode.path = {}; |
| 54 |
} |
| 55 |
}; |
| 56 |
|
| 57 |
var vmlFixFillColors = function(){ |
| 58 |
if(this.rawNode.fill && !this.rawNode.fill.colors){ |
| 59 |
this.rawNode.fill.colors = {}; |
| 60 |
} |
| 61 |
}; |
| 62 |
|
| 63 |
if(sniff.isIE <= 8 && gfx.renderer === "vml"){ |
| 64 |
this.patchMethod(gfx.Line, "setShape", vmlFixRawNodePath, null); |
| 65 |
this.patchMethod(gfx.Polyline, "setShape", vmlFixRawNodePath, null); |
| 66 |
this.patchMethod(gfx.Path, "setShape", vmlFixRawNodePath, null); |
| 67 |
|
| 68 |
this.patchMethod(shape.Shape, "setFill", vmlFixFillColors, null); |
| 69 |
} |
| 70 |
} |
| 71 |
}; |
| 72 |
return dgo.Patch; |
| 73 |
}); |