Skip to content

Commit f6fff86

Browse files
committed
PB-111: Tidy up code.
1 parent 57c8305 commit f6fff86

File tree

1 file changed

+3
-20
lines changed

1 file changed

+3
-20
lines changed

src/modules/map/components/openlayers/utils/print-area-renderer.composable.js

+3-20
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ function createWorldPolygon() {
5353
}
5454

5555
function encodeGraticule(dpi, projection) {
56-
log.info('Encode graticule for projection:', projection)
57-
var gridLayer = 'org.epsg.grid_2056'
56+
let gridLayer = 'org.epsg.grid_2056'
5857
if (projection.value instanceof CustomCoordinateSystem) {
5958
gridLayer = 'org.epsg.grid_2056'
6059
}
@@ -76,10 +75,8 @@ function encodeGraticule(dpi, projection) {
7675
function encodeLegend() {
7776
const icons = []
7877
const visibleLayers = store.getters.visibleLayers
79-
log.info('visible layers', visibleLayers)
8078

8179
for (const layer of visibleLayers) {
82-
log.info('Layer:', layer, layer.hasLegend)
8380
if (layer.hasLegend) {
8481
icons.push(
8582
`${API_BASE_URL}/static/images/legends/${layer.getID()}_${store.state.i18n.lang}.png`
@@ -140,16 +137,12 @@ export default function usePrintAreaRenderer(map) {
140137
})
141138

142139
async function startPrinting() {
143-
log.info('Printing is started ...')
144140
const mapFishPrintUrl = API_SERVICES_BASE_URL + 'print3/print/default'
145-
log.info('Print URL: ', mapFishPrintUrl)
146141

147142
const layout = store.state.print.selectedLayout.name
148143

149144
const encoder = new MFPEncoder(mapFishPrintUrl)
150145
const customizer = new BaseCustomizer([0, 0, 10000, 10000])
151-
const layers = map.getLayers().getArray()
152-
log.info('Layers: ', layers)
153146
// Generate QR code url from current shortlink
154147
await store.dispatch('generateShortLinks', false)
155148
const shortLink = store.state.share.shortLink
@@ -166,7 +159,6 @@ export default function usePrintAreaRenderer(map) {
166159
}
167160

168161
const mapSpec = await encoder.encodeMap(mapConfig)
169-
log.info('Print spec: ', mapSpec)
170162

171163
const spec = {
172164
attributes: {
@@ -185,28 +177,23 @@ export default function usePrintAreaRenderer(map) {
185177
} else {
186178
spec.attributes.printLegend = 0
187179
}
188-
log.info('visible layers', store.getters.visibleLayers)
189-
window.visibleLayers = store.getters.visibleLayers
190180

191181
if (store.state.print.useGraticule) {
192-
log.info('Graticule is enabled')
193182
// Put the graticule in the first layer so it's drawn at the top
194183
spec.attributes.map.layers.unshift(encodeGraticule(96, store.state.position.projection))
195-
log.info('Print spec after graticule: ', spec)
196184
}
197185

198186
const report = await requestReport(mapFishPrintUrl, spec)
199187
store.dispatch('setCurrentPrintReference', report.ref)
200188

201-
log.info('Report: ', report)
202189
await getDownloadUrl(mapFishPrintUrl, report, 1000)
203190
.then(
204191
(url) => {
205192
downloadUrl(url)
206193
return url
207194
},
208195
(err) => {
209-
log.info('result', 'error', err)
196+
log.error('result', 'error', err)
210197
return err
211198
}
212199
)
@@ -217,20 +204,16 @@ export default function usePrintAreaRenderer(map) {
217204
}
218205

219206
async function abortPrinting() {
220-
log.info('Aborting printing ...')
221207
if (store.getters.currentPrintReference) {
222208
const printReference = store.getters.currentPrintReference
223209
const mapFishPrintUrl = API_SERVICES_BASE_URL + 'print3/print/default'
224-
const cancelRespond = cancelPrint(mapFishPrintUrl, printReference)
210+
cancelPrint(mapFishPrintUrl, printReference)
225211

226-
log.info('Cancel respond', cancelRespond)
227-
log.info(`Print reference ${printReference} is aborted ...`)
228212
store.dispatch('setCurrentPrintReference', null)
229213
}
230214
}
231215

232216
function downloadUrl(url) {
233-
log.info('PDF map url', url)
234217
if (window.navigator.userAgent.indexOf('MSIE ') > -1) {
235218
window.open(url)
236219
} else {

0 commit comments

Comments
 (0)