Checks zoom ranges for source and target, and appends as much sources to the dest as needed.
(dest, typ, source, target, high)
| 37 | return "zoom {}".format(z1) |
| 38 | |
| 39 | def add_missing_zooms(dest, typ, source, target, high): |
| 40 | """Checks zoom ranges for source and target, and appends as much sources to |
| 41 | the dest as needed.""" |
| 42 | if high: |
| 43 | scales = (target.scale + 1, source.scale + 1) |
| 44 | else: |
| 45 | scales = (source.scale, target.scale) |
| 46 | |
| 47 | if scales[1] < scales[0]: |
| 48 | print("{}: missing {} {}".format(typ, 'high' if high else 'low', zooms_string(scales[1], scales[0] - 1))) |
| 49 | for z in range(scales[1], scales[0]): |
| 50 | fix = copy.deepcopy(source) |
| 51 | fix.scale = z |
| 52 | dest[typ].append(fix) |
| 53 | elif scales[1] > scales[0]: |
| 54 | print("{}: extra {} {}".format(typ, 'high' if high else 'low', zooms_string(scales[0], scales[1] - 1))) |
| 55 | |
| 56 | def create_diff(zooms1, zooms2): |
| 57 | """Calculates difference between zoom dicts, and returns a tuple: |
no test coverage detected