Skip to content

Commit

Permalink
Toc length calculation bufix d3 and d5 (#2038)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterschaer committed Oct 16, 2024
1 parent a5bc344 commit 36f687d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pyramid_oereb/contrib/print_proxy/mapfish_print/toc_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,14 @@ def compute_d3(self):
blank_space_above = 26 # toc.jrxml
not_concerned_themes_title_height = 15 # toc.jrxml
blank_space_between = 5 # toc.jrxml
not_concerned_themes_item_height = 15 # toc.jrxml (12 in themelist.jrxml)
not_concerned_themes_first_item_height = 15 # toc.jrxml
not_concerned_themes_further_items_height = 12 # themelist.jrxml
total_size += (
blank_space_above + not_concerned_themes_title_height + blank_space_between
)
total_size += (
len(self.extract["NotConcernedTheme"]) * not_concerned_themes_item_height
total_size += not_concerned_themes_first_item_height + (
(len(self.extract["NotConcernedTheme"]) - 1)
* not_concerned_themes_further_items_height
)
log.debug(f"d3 total_size: {total_size}")
if total_size > self.d3_height:
Expand All @@ -93,9 +95,11 @@ def compute_d4(self):

def compute_d5(self):
total_size = 0
theme_without_data_item_height = 15 # toc.jrxml (12 in themelist.jrxml)
total_size += len(
self.extract["ThemeWithoutData"] * theme_without_data_item_height
theme_without_data_first_item_height = 15 # toc.jrxml
theme_without_data_further_items_height = 12 # themelist.jrxml
total_size += theme_without_data_first_item_height + (
(len(self.extract["ThemeWithoutData"]) - 1)
* theme_without_data_further_items_height
)
log.debug(f"d5 total_size: {total_size}")
if total_size > self.d5_height:
Expand Down
2 changes: 2 additions & 0 deletions tests/contrib.print_proxy.mapfish_print/test_mapfish_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ def extract():
) as f:
yield json.load(f)


@pytest.fixture
def extract_toc_pages():
with codecs.open(
'tests/contrib.print_proxy.mapfish_print/resources/test_extract_toc_pages.json'
) as f:
yield json.load(f)


@pytest.fixture
def extract_multi_wms():
with codecs.open(
Expand Down

0 comments on commit 36f687d

Please sign in to comment.