georchestra / mapstore2-georchestra

geOrchestra newest viewer
Other
6 stars 23 forks source link

[Print] Ability to print image legend with an appropriate scale #682

Closed catmorales closed 6 months ago

catmorales commented 7 months ago

Describe the bug When printing an image legend with the map, the size of the legend doesn't match with the size configured in the layer properties

To Reproduce Steps to reproduce the behavior:

  1. Go to 'https://portail-test.sig.rennesmetropole.fr'
  2. Add the map template "PLUi : plans thématiques"
  3. Make visible the layer "Orientations d'aménagement et de programmation (OAP)" (zoom in and activate it)
  4. Look at the legend and its size in the property of the layer (Largeur 300, hauteur 12)
  5. Print the map with the legend in other sheet
  6. Legend is not visible

Expected behavior Legend be visible like in the layer properties

Screenshots

legende_light

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context

mapstore-print (11).pdf

dsuren1 commented 7 months ago

@catmorales The legend is visible but very small.

Currently the mapfish uses the iconSize of the legend options in print tool to set width and height of the legend

Screenshot 2023-12-14 at 12 16 26 PM
Example: with internal layer iconSize: 20 iconSize: 40
Screenshot 2023-12-14 at 12 15 10 PM Screenshot 2023-12-14 at 12 14 05 PM

@tdipisa To use the configured scale (i.e width and height) of the legend in layer settings, we can replace the Icon Size with Width and Height fields in the Legend Options of the print tool and use legend sizes configured in the layer settings as these field values respectively

image

Kindly let me know your thoughts. Thanks!

landryb commented 7 months ago

and to avoid strange results, if the user changes one of width or height, automatically adjust the other so that the aspect ratio is kept ? i doubt anyone would want to resize a legend in a stretched/compressed way....

dsuren1 commented 7 months ago

No, we won't adjust the size automatically. The user can visualize this change when modifying the width/height in the layer settings, so the user can know if the image is stretched/compressed and can enter a value that appears to fit best

dsuren1 commented 6 months ago

Updated behavior

The print tool's Legend Options will be modified to have two fields called Width and Height replacing the Icon Size field along with a new checkbox field called Override icon size. These new fields will hold the current default size of 24px. This override option will allow user to override legend's configured scale (width and height) set for the layer in the layer options and when more than one layer is present, this option will be applied for the all the applicable layers.

By default, this option will be unchecked, meaning the legend's width and height configured in layer will be used per layer

Reason: Print tool has a common option for all the layers selected for printing and cannot be made available per layer, hence a common option will be used for all layer when user prefer to override the icon size

image