-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(geo): Print with resolution PDF and image #1264
Conversation
On ne peut pas faire la revue de cette PR car on a inclus #1256. En stand-by tant que cette PR n'est pas mergé ou corriger cette PR pour ne pas l'inclure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ça me semble bien beau, plus des commentaires de style pour améliorer la lisibilité et maintenance.
@@ -830,15 +830,28 @@ export class PrintService { | |||
legendPosition: PrintLegendPosition | |||
) { | |||
const status$ = new Subject(); | |||
// const resolution = map.ol.getView().getResolution(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dans les paramètres de la méthode, on pourrait ajouter le type pour la résolution: PrintResolution
// Reset original map size | ||
map.ol.setSize(initialMapSize); | ||
map.ol.getView().setResolution(viewResolution); | ||
map.ol.renderSync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On peut éviter le commentaire en refactorant cette partie et créer un méthode resetOriginalMapSize(size, resolution)
// Set map image size | ||
map.ol.setSize(newMapSize); | ||
const scaling = Math.min(newMapSize[0] / initialMapSize[0], newMapSize[1] / initialMapSize[1]); | ||
map.ol.getView().setResolution(viewResolution / scaling); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pour éviter de laisser des commentaire on pourrait en faire un méthode, cela améliorait aussi la lisibilité.
// Set map image size | |
map.ol.setSize(newMapSize); | |
const scaling = Math.min(newMapSize[0] / initialMapSize[0], newMapSize[1] / initialMapSize[1]); | |
map.ol.getView().setResolution(viewResolution / scaling); | |
setMapResolution(initialSize: [number, number], resolution: PrintResolution): void { | |
const scaleFactor = resolution / 96; | |
const [width, height] = initialSize; | |
const scaledSize = [Math.round(width * scaleFactor), Math.round(height * scaleFactor)]; | |
map.ol.setSize(scaledSize); | |
const scaling = Math.min(scaledSize[0] / width, scaledSize[1] / height); | |
const view = map.ol.getView(); | |
view.setResolution(view.getResolution() / scaling); | |
} |
…setMapResolution for pdf
What is the current behavior? (You can also link to an open issue here)
this behavior related to #402 in igo2
What is the new behavior?
Ability to choose the resolution before exporting pdf or image
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications:
Other information: