X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/2da869b2b46179d64c05eaac4081226fdbbbc9ff..e73353500c67453ef9663d67eaeee7dd46c358ee:/Products/Portfolio/skins/tiling_infos.xml.py?ds=sidebyside diff --git a/Products/Portfolio/skins/tiling_infos.xml.py b/Products/Portfolio/skins/tiling_infos.xml.py new file mode 100755 index 0000000..0c88ccd --- /dev/null +++ b/Products/Portfolio/skins/tiling_infos.xml.py @@ -0,0 +1,30 @@ +##parameters +from Products.CMFCore.utils import getToolByName +from math import ceil + +options = {} +thumbSize = context.getThumbnailSize() +options['thumbnailWidth'] = thumbSize['width'] +options['thumbnailHeight'] = thumbSize['height'] +options['tileSize'] = context.tileSize + +options['zoomLevels'] = [] + +for zoom in context.getAvailableZooms() : + level = int(zoom * 100) + levelInfos = {} + levelInfos['zoomlevel'] = level + rawSize = (context.width, context.height) + orientation = context.tiffOrientation() + if orientation >= 5 : + rawSize = rawSize[::-1] + size = map(lambda x: int(round(x*zoom)), rawSize) + levelInfos['width'], levelInfos['height'] = size + + nbTiles = map(lambda x : int(ceil(float(x) / context.tileSize)), size) + levelInfos['tileX'], levelInfos['tileY'] = nbTiles + + options['zoomLevels'].append(levelInfos) + +context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8') +return context.tiling_infos_template(**options)