[OpenLayers-Users] very large polygon disappears at very high zoom level
Michael Ryan
mr at mry4n.net
Tue Jun 5 10:26:02 PDT 2012
To answer my own question, in order to have the graphic fill work for
the Canvas renderer I added a few lines of code to setCanvasStyle in
lib/OpenLayers/Renderer/Canvas.js that create the pattern and then
override canvas' fillStyle attribute .
So far it seems like I haven't broken anything.
setCanvasStyle: function(type, style) {
if (type === "fill") {
this.canvas.globalAlpha = style['fillOpacity'];
this.canvas.fillStyle = style['fillColor'];
// NEW GRAPHIC FILL CODE HERE
if (style.externalGraphic){
var imageObj = new Image();
imageObj.src = style.externalGraphic;
this.canvas.fillStyle = this.canvas.createPattern(imageObj,"repeat");
}
// END GRAPHIC FILL CODE
}
On Mon, Jun 4, 2012 at 5:01 PM, Michael Ryan <mr at mry4n.net> wrote:
> That was it. Unfortunately, I'm using the graphic fill code to create
> polygons filled with external graphics:
>
> http://lists.osgeo.org/pipermail/openlayers-commits/2011-September/001578.html
>
> The polygon appears as it should at the high zoom level, but does not
> perform the graphic fill. I believe this is because ossipoff's code
> didn't alter Canvas.js. These were the js files modified:
>
> sandbox/ossipoff/openlayers/lib/OpenLayers/Format/SLD/v1.js
> sandbox/ossipoff/openlayers/lib/OpenLayers/Renderer/SVG.js
> sandbox/ossipoff/openlayers/lib/OpenLayers/Renderer/VML.js.
>
> I'll dig around in there and compare it to Canvas.js to see if I can
> figure out how to make canvas also perform the graphic fill.
>
> If anyone wants to throw me a bone here, I'm listening.
>
> -Mike
More information about the Users
mailing list