- Default "Zadání HG3" mode with exactly the 16 categories of the assignment (9 built-up, 7 undeveloped) and its legend colours; replaces the old simple mode - Whole map coloured: RÚIAN cadastral parcels are fetched and classified from land type / land use; built-up parcels take the category of their building - Field corrections per building or parcel (info panel), saved locally and in a project file (save/open JSON) to move between devices - A4 frame at 1 : 3 780 (300 dpi, landscape/portrait) shown on the map; data loading covers the frame - Built-up territory meter against the 66 % rule (built-up areas + gardens + maintained greenery; strict legend share shown too) and area statistics per category with CSV export - Submission print/PDF: 1 map (title, author, scale, source), 2 legend (only categories present), 3-4 commentary - Commentary editor with the assignment's questions and a 3 600-character counter - Field worksheet: blank A4 base map with house numbers and an empty legend to colour with crayons - Buildings CSV gains HG3 category, correction flag and parcels Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
import { orientation, S } from './state'
|
||
import type { BBox, Orientation } from './types'
|
||
|
||
/* ================= A4 page geometry for the HG3 submission =================
|
||
* The assignment prints the ČÚZK base map on A4 at 300 dpi, which gives 1 : 3 780.
|
||
*/
|
||
export const SCALE = 3780
|
||
export const DPI = 300
|
||
const PAGE_MM: Record<Orientation, [number, number]> = {
|
||
landscape: [297, 210],
|
||
portrait: [210, 297],
|
||
}
|
||
export const MARGIN_MM = 8
|
||
export const HEADER_MM = 9
|
||
export const FOOTER_MM = 7
|
||
|
||
export const pageMM = (o: Orientation = orientation.value) => PAGE_MM[o]
|
||
|
||
/** Size of the map image on the page, in mm. */
|
||
export function mapBoxMM(o: Orientation = orientation.value): [number, number] {
|
||
const [w, h] = PAGE_MM[o]
|
||
return [w - 2 * MARGIN_MM, h - 2 * MARGIN_MM - HEADER_MM - FOOTER_MM]
|
||
}
|
||
|
||
/** Ground size of the printed map in metres. */
|
||
export function frameMeters(o?: Orientation): [number, number] {
|
||
const [w, h] = mapBoxMM(o)
|
||
return [(w * SCALE) / 1000, (h * SCALE) / 1000]
|
||
}
|
||
|
||
/** The print frame in Web Mercator, centred on the current view. */
|
||
export function frameRect(o?: Orientation): BBox {
|
||
const [w, h] = frameMeters(o)
|
||
const hx = w / 2 / S.K,
|
||
hy = h / 2 / S.K
|
||
return [S.view.cx - hx, S.view.cy - hy, S.view.cx + hx, S.view.cy + hy]
|
||
}
|
||
|
||
/** Load radius (see fetchArea: the query box is ±1.1 × radius) that covers the frame. */
|
||
export function frameRadius(o?: Orientation): number {
|
||
const [w, h] = frameMeters(o)
|
||
return Math.ceil(Math.max(w, h) / 2 / 1.1 / 50) * 50
|
||
}
|
||
|
||
/** Whether the loaded data covers the whole frame. */
|
||
export function frameCovered(o?: Orientation): boolean {
|
||
const bb = S.loadedBB,
|
||
f = frameRect(o)
|
||
return !!bb && f[0] >= bb[0] && f[1] >= bb[1] && f[2] <= bb[2] && f[3] <= bb[3]
|
||
}
|