Récupérations des slides (début d'implémentation).
[Portfolio.git] / skins / tiling_infos.xml.py
1 ##parameters
2 from Products.CMFCore.utils import getToolByName
3 from math import ceil
4
5 options = {}
6 thumbSize = context.getThumbnailSize()
7 options['thumbnailWidth'] = thumbSize['width']
8 options['thumbnailHeight'] = thumbSize['height']
9 options['tileSize'] = context.tileSize
10
11 options['zoomLevels'] = []
12
13 for zoom in context.getAvailableZooms() :
14 level = int(zoom * 100)
15 levelInfos = {}
16 levelInfos['zoomlevel'] = level
17 rawSize = (context.width, context.height)
18 orientation = context.tiffOrientation()
19 if orientation >= 5 :
20 rawSize = rawSize[::-1]
21 size = map(lambda x: int(round(x*zoom)), rawSize)
22 levelInfos['width'], levelInfos['height'] = size
23
24 nbTiles = map(lambda x : int(ceil(float(x) / context.tileSize)), size)
25 levelInfos['tileX'], levelInfos['tileY'] = nbTiles
26
27 options['zoomLevels'].append(levelInfos)
28
29 context.REQUEST.RESPONSE.setHeader('Content-Type', 'text/xml;;charset=utf-8')
30 return context.tiling_infos_template(**options)