[OpenLayers-Users] How to force a vector layer to use canvas instead of SVG?

maven apache apachemaven0 at gmail.com
Tue Jun 18 17:08:08 PDT 2013


2013/6/18 mail.roliveira at gmail.com <mail.roliveira at gmail.com>

> Hi,
>
> I'm trying to create a vector layer. My code is quite similar to the
> source code in:
>
>
> http://openlayers.org/dev/examples/select-feature-multilayer.html?renderer=Canvas
>
> However, I notice that the renderer=Canvas (url parameter) is not being
> used, because features are created using svg (inspecting with firebug)
>


If you check the source codes in the link you mentioned you will find this:

*            // allow testing of specific renderers via "?renderer=Canvas",
etc*
*            var renderer =
OpenLayers.Util.getParameters(window.location.href).renderer;*
*            renderer = (renderer) ? [renderer] :
OpenLayers.Layer.Vector.prototype.renderers;*

This is how the example get the renderer from the url.

>
> Here is my code for the layer creation:
>
> var layer_style = new OpenLayers.StyleMap({
>     "default": new
> OpenLayers.Style(OpenLayers.Util.applyDefaults({fillColor:
> "red",strokeColor: "gray",rotation: 45,pointRadius: 15},
> OpenLayers.Feature.Vector.style["default"])),
>     "select": new
> OpenLayers.Style(OpenLayers.Util.applyDefaults({graphicName: "square",
> rotation: 45, pointRadius: 30}, OpenLayers.Feature.Vector.style["select"]))
> })
>
> var vectorLayer = new OpenLayers.Layer.Vector("vLayer", {
>     styleMap: layer_style,
>     renderers: ["Canvas"]
> });
>
> map.addLayer(vectorLayer);
>
> I also notice that the options passed on the vector layer
> instantiation apparently don't mach the documentation:
>
> http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers/Layer/Vector-js.html
>
> I'm using FF12, Chrome 22.0.1229.94
> Openlayers 2.12
>
> Sent from Alto - altomail.com
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20130619/ad4071db/attachment.html>


More information about the Users mailing list