[OpenLayers-Users] Strange issue using custom printing tool
[SOLVED]
David Alda Fernandez de Lezea
dalda at ikt.es
Thu Mar 3 04:08:47 EST 2011
Hi,
I found the solution. I just added before looping through the layers the following line
this.map.setCenter(this.map.getExtent().getCenterLonLat(),this.map.zoom,true,true);
And worked perfectly.
Hope this can help to anyone.
Thanks.
Un saludo,
··················································································
David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)
··················································································
Tlfnos.: 945-00-32-95 Fax: 945-00.32.90
··················································································
email: dalda at ikt.es web: www.ikt.es
··················································································
-----Mensaje original-----
De: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] En nombre de David Alda Fernandez de Lezea
Enviado el: miércoles, 02 de marzo de 2011 17:04
Para: users at openlayers.org
Asunto: [OpenLayers-Users] Strange issue using custom printing tool
Hi,
We manage to create a custom print tool for OpenLayers. The tool is based in the code that appears in http://trac.osgeo.org/openlayers/wiki/Printing but with some little changes to provide the print-server-script also the vector feature of openlayers. The tool is working fine but I've detected a small malfunctioning of printing code. Sometimes some tiles are lost if you pan instead of zoomming. To reproduce the malfunctioning follow these steps:
1- Zoom to an area, e.g. zoom level 5-6.
2- Click the print icon
3- A pop up will appear with the generated image
4- Activate the pan tool and pan more than one time to move from that area to another one.
5- Again, Click the print icon
6- The generated image has som blanks tiles
This issue it doesn't happen if you zoom in and zoom out after panning, weird, isn't it?
I've been debugging with FireBug and the only thing I see strange is that while looping through the layer.grid array:
....
// iterate through their grid's tiles, collecting each tile's extent and pixel location at th
for (tilerow in layer.grid) {
for (tilei in layer.grid[tilerow]) {
if (tilei != "bindAsEventListener" && tilei != "bind" && tilei != "indexOf"){
var tile = layer.grid[tilerow][tilei]
//if (map.getExtent().containsBounds(tile.bounds)){
var url = layer.getURL(tile.bounds);
var position = tile.position;
var opacity = layer.opacity ? parseInt(100*layer.opacity) : 100;
tiles[tiles.length] = {'url':escape(url), 'x':position.x, 'y':position.y, 'opacity':opacity};
//}
}
}
}
....
The value of position.X during the issue it can reach until 2456, for example, but whe working correctly it doesn't appear to be very large.
To test this behaviour:
http://www.iktlan.net/mapa/OpenLayers/visorIKT.htm
Any ideas??
Un saludo,
··················································································
David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)
··················································································
Tlfnos.: 945-00-32-95 Fax: 945-00.32.90
··················································································
email: dalda at ikt.es web: www.ikt.es
··················································································
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
More information about the Users
mailing list