diff --git a/.eslintrc.js b/.eslintrc.js index b49435a..a0bd407 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,6 +14,7 @@ module.exports = { 'vue/require-default-prop': 'off', 'vue/multi-word-component-names': 'off', 'vue/attribute-order': 'off', - '@typescript-eslint/no-explicit-any': 'off' + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unused-vars': 'off' } } diff --git a/src/common/maps/govmap.data.ts b/src/common/maps/govmap.data.ts index 6df5ab9..619295b 100644 --- a/src/common/maps/govmap.data.ts +++ b/src/common/maps/govmap.data.ts @@ -3,18 +3,15 @@ import { MapData, UrlResult, UrlUsageType } from './map.data' export const mapDataGovMap: MapData = { name: 'GovMap', - urlProvider: async (usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { + urlProvider: async (_: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { if (mapType === '1:25000' && (zoomLevel < 5 || zoomLevel > 9)) { return { url: '', unsupported: true } } const zoomLevelStr = (mapType === '1:25000' ? zoomLevel - 5 : zoomLevel).toString(10).padStart(2, '0') const rowStr = row.toString(16).padStart(8, '0') const colStr = col.toString(16).padStart(8, '0') - // https://cdn.govmap.gov.il/B0BZ1ORTO23/L08/R00004987/C00004114.jpg - // https://cdn.govmap.gov.il/B0b3010BLDG/L08/R00004986/C00004117.png - // https://cdn.govmap.gov.il/2024MAP25KTO/L03/R00004984/C00004115.png - const mapTypeStr = mapType === 'Satellite' ? 'B0BZ1ORTO23' : mapType === 'Street & Buildings' ? 'B0b3010BLDG' : '2024MAP25KTO' + const mapTypeStr = mapType === 'Satellite' ? 'B0BZ1ORTO23' : mapType === 'Street & Buildings' ? 'B0B0MARS27052024' : '2024MAP25KTO' const suffix = mapType === 'Satellite' ? 'jpg' : 'png' const domain = 'cdn.govmap.gov.il' return { diff --git a/src/common/maps/haifa.data.ts b/src/common/maps/haifa.data.ts index 9d1c9de..7ae05bb 100644 --- a/src/common/maps/haifa.data.ts +++ b/src/common/maps/haifa.data.ts @@ -1,122 +1,122 @@ -// import * as pimage from "pureimage"; -// import { Bitmap } from "pureimage/types/bitmap"; -// import { Readable } from "stream"; -// import { MapData, UrlResult, UrlUsageType } from "./map.data"; -// -// export const mapDataHaifa: MapData = { -// name: "Haifa", -// -// urlProvider: async (usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { -// let zoomLevelStr = zoomLevel.toString(); -// const rowStr = row.toString(); -// const colStr = col.toString(); -// return { url: `https://gisserver.haifa.muni.il/arcgiswebadaptor/rest/services/Orthophoto_202204/MapServer/tile/${zoomLevelStr}/${rowStr}/${colStr}?blankTile=false` }; -// }, -// -// zoomLevelProvider: (zoomLevel: number): string => { -// return zoomLevel.toString(); -// }, -// -// zoomFactorProvider: (zoomLevel: number, zoomIn: boolean): number => { -// if ( -// (zoomLevel === 0 && zoomIn) || -// (zoomLevel === 1 && !zoomIn) || -// (zoomLevel === 5 && zoomIn) || -// (zoomLevel === 6 && !zoomIn) -// ) { -// return 1.5; -// // } else if (((zoomLevel === 3 || zoomLevel === 6) && zoomIn) || ((zoomLevel === 4 || zoomLevel === 7) && !zoomIn)) { -// // return 2.5; -// } else if ((zoomLevel === 3 && zoomIn) || (zoomLevel === 4 && !zoomIn)) { -// return 1.25; -// } else if ((zoomLevel === 4 && zoomIn) || (zoomLevel === 5 && !zoomIn)) { -// return 1.33; -// } else if ((zoomLevel === 7 && zoomIn) || (zoomLevel === 8 && !zoomIn)) { -// return 2.5; -// } else -// return 2; -// }, -// -// decode: async (mapType: string, buffer: Buffer): Promise => { -// return pimage.decodePNGFromStream(Readable.from(buffer)); -// }, -// -// supportedMapTypes: ["Satellite"], -// -// showScale: false, -// -// referer: undefined, -// -// zoomLayers: [ -// { -// scale: 0, -// centerTileX: 1103, -// centerTileY: 1254, -// centerTileOffsetX: 30, -// centerTileOffsetY: 88, -// }, -// { -// scale: 1, -// centerTileX: 1654, -// centerTileY: 1881, -// centerTileOffsetX: 178, -// centerTileOffsetY: 134, -// }, -// { -// scale: 2, -// centerTileX: 3309, -// centerTileY: 3763, -// centerTileOffsetX: 98, -// centerTileOffsetY: 11, -// }, -// { -// scale: 3, -// centerTileX: 6618, -// centerTileY: 7526, -// centerTileOffsetX: 199, -// centerTileOffsetY: 27, -// }, -// { -// scale: 4, -// centerTileX: 8273, -// centerTileY: 9407, -// centerTileOffsetX: 118, -// centerTileOffsetY: 165, -// }, -// { -// scale: 5, -// centerTileX: 11031, -// centerTileY: 12543, -// centerTileOffsetX: 72, -// centerTileOffsetY: 137, -// }, -// { -// scale: 6, -// centerTileX: 16546, -// centerTileY: 18815, -// centerTileOffsetX: 237, -// centerTileOffsetY: 77, -// }, -// { -// scale: 7, -// centerTileX: 33093, -// centerTileY: 37630, -// centerTileOffsetX: 216, -// centerTileOffsetY: 155, -// }, -// { -// scale: 8, -// centerTileX: 82734, -// centerTileY: 94076, -// centerTileOffsetX: 154, -// centerTileOffsetY: 130, -// }, -// { -// scale: 9, -// centerTileX: 165469, -// centerTileY: 188153, -// centerTileOffsetX: 51, -// centerTileOffsetY: 5, -// }, -// ], -// }; +import { MapData, UrlResult, UrlUsageType } from './map.data' + +//https://experience.arcgis.com/experience/fbbaf8ced1a54fa394d47cdea28ca1b3 +export const mapDataHaifa: MapData = { + name: 'Haifa', + + urlProvider: async (_usageType: UrlUsageType, _mapType: string, zoomLevel: number, row: number, col: number): Promise => { + if (zoomLevel < 3) { + return { url: '', unsupported: true } + } + + const zoomLevelStr = zoomLevel.toString() + const rowStr = row.toString() + const colStr = col.toString() + + return { url: `https://gisserver.haifa.muni.il/arcgiswebadaptor/rest/services/Orthophoto_202402/MapServer/tile/${zoomLevelStr}/${rowStr}/${colStr}?blankTile=false` } + }, + + zoomLevelProvider: (zoomLevel: number): string => { + return zoomLevel.toString() + }, + + zoomFactorProvider: (zoomLevel: number, zoomIn: boolean): number => { + if ((zoomLevel === 0 && zoomIn) || (zoomLevel === 1 && !zoomIn) || (zoomLevel === 5 && zoomIn) || (zoomLevel === 6 && !zoomIn)) { + return 1.5 + // } else if (((zoomLevel === 3 || zoomLevel === 6) && zoomIn) || ((zoomLevel === 4 || zoomLevel === 7) && !zoomIn)) { + // return 2.5; + } else if ((zoomLevel === 3 && zoomIn) || (zoomLevel === 4 && !zoomIn)) { + return 1.25 + } else if ((zoomLevel === 4 && zoomIn) || (zoomLevel === 5 && !zoomIn)) { + return 1.33 + } else if ((zoomLevel === 7 && zoomIn) || (zoomLevel === 8 && !zoomIn)) { + return 2.5 + } else return 2 + }, + + supportedMapTypes: ['Satellite'], + + showScale: false, + + referer: undefined, + + zoomLayers: [ + { + scale: 0, + centerTileX: 1, + centerTileY: 1, + centerTileOffsetX: 1, + centerTileOffsetY: 1 + }, + { + scale: 1, + centerTileX: 1, + centerTileY: 1, + centerTileOffsetX: 1, + centerTileOffsetY: 1 + }, + { + scale: 2, + centerTileX: 1, + centerTileY: 1, + centerTileOffsetX: 1, + centerTileOffsetY: 1 + }, + { + scale: 3, + centerTileX: 1, + centerTileY: 1, + centerTileOffsetX: 132, + centerTileOffsetY: 205 + }, + { + scale: 4, + centerTileX: 3, + centerTileY: 3, + centerTileOffsetX: 6, + centerTileOffsetY: 152 + }, + { + scale: 5, + centerTileX: 6, + centerTileY: 7, + centerTileOffsetX: 10, + centerTileOffsetY: 47 + }, + { + scale: 6, + centerTileX: 12, + centerTileY: 14, + centerTileOffsetX: 17, + centerTileOffsetY: 93 + }, + { + scale: 7, + centerTileX: 24, + centerTileY: 28, + centerTileOffsetX: 34, + centerTileOffsetY: 188 + }, + { + scale: 8, + centerTileX: 48, + centerTileY: 57, + centerTileOffsetX: 66, + centerTileOffsetY: 119 + }, + { + scale: 9, + centerTileX: 96, + centerTileY: 114, + centerTileOffsetX: 132, + centerTileOffsetY: 239 + }, + { + scale: 10, + centerTileX: 193, + centerTileY: 229, + centerTileOffsetX: 5, + centerTileOffsetY: 222 + } + ] +} diff --git a/src/common/maps/map.data.ts b/src/common/maps/map.data.ts index 9af8de8..ec928bb 100644 --- a/src/common/maps/map.data.ts +++ b/src/common/maps/map.data.ts @@ -1,4 +1,7 @@ import { mapDataGovMap } from './govmap.data' +import { mapDataTelAviv } from './tel-aviv.data' +import { mapDataHaifa } from './haifa.data' +import { mapDataNetanya } from './netanya.data' export type ZoomLayer = { readonly scale: number @@ -33,9 +36,9 @@ export type MapData = { export const maps = [ mapDataGovMap, // mapDataGalilTahton, - // mapDataTelAviv, - // mapDataHaifa, + mapDataTelAviv, + mapDataHaifa, // mapDataHodHasharon, - // mapDataNetanya, + mapDataNetanya, // mapDataMapy ] diff --git a/src/common/maps/netanya.data.ts b/src/common/maps/netanya.data.ts index 3830f9b..5c885b2 100644 --- a/src/common/maps/netanya.data.ts +++ b/src/common/maps/netanya.data.ts @@ -1,100 +1,96 @@ -// import * as pimage from "pureimage"; -// import { Bitmap } from "pureimage/types/bitmap"; -// import { Readable } from "stream"; -// import { MapData, UrlResult, UrlUsageType } from "./map.data"; -// -// export const mapDataNetanya: MapData = { -// name: "Netanya", -// -// urlProvider: async (usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { -// let zoomLevelStr = (zoomLevel + 3).toString(); -// const rowStr = row.toString(); -// const colStr = col.toString(); -// const mapTypeStr = mapType === "Satellite" ? "Netanya_2022_November:2022_November" : "Netanya_SHP:Netanya_Reka"; -// return { url: `https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.71:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=${mapTypeStr}&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Netanya&TILEMATRIX=Netanya:${zoomLevelStr}&TILEROW=${rowStr}&TILECOL=${colStr}` }; -// }, -// -// zoomLevelProvider: (zoomLevel: number): string => { -// return zoomLevel.toString(); -// }, -// -// zoomFactorProvider: (zoomLevel: number, zoomIn: boolean): number => { -// return 2; -// }, -// -// decode: async (mapType: string, buffer: Buffer): Promise => { -// return await pimage.decodeJPEGFromStream(Readable.from(buffer)); -// }, -// -// supportedMapTypes: ["Satellite", "Street & Buildings"], -// -// showScale: true, -// -// referer: undefined, -// -// zoomLayers: [ -// { -// scale: 32000, -// centerTileX: 3, -// centerTileY: 3, -// centerTileOffsetX: 183, -// centerTileOffsetY: 64, -// }, -// { -// scale: 16000, -// centerTileX: 7, -// centerTileY: 6, -// centerTileOffsetX: 109, -// centerTileOffsetY: 133, -// }, -// { -// scale: 8000, -// centerTileX: 14, -// centerTileY: 13, -// centerTileOffsetX: 221, -// centerTileOffsetY: 9, -// }, -// { -// scale: 4000, -// centerTileX: 29, -// centerTileY: 26, -// centerTileOffsetX: 184, -// centerTileOffsetY: 18, -// }, -// { -// scale: 2000, -// centerTileX: 59, -// centerTileY: 52, -// centerTileOffsetX: 112, -// centerTileOffsetY: 39, -// }, -// { -// scale: 1000, -// centerTileX: 118, -// centerTileY: 104, -// centerTileOffsetX: 224, -// centerTileOffsetY: 76, -// }, -// { -// scale: 500, -// centerTileX: 237, -// centerTileY: 208, -// centerTileOffsetX: 192, -// centerTileOffsetY: 150, -// }, -// { -// scale: 250, -// centerTileX: 475, -// centerTileY: 417, -// centerTileOffsetX: 128, -// centerTileOffsetY: 44, -// }, -// { -// scale: 125, -// centerTileX: 950, -// centerTileY: 834, -// centerTileOffsetX: 255, -// centerTileOffsetY: 90, -// }, -// ], -// }; +import { MapData, UrlResult, UrlUsageType } from './map.data' + +//https://v5.gis-net.co.il/v5/netanya?layers=248 +export const mapDataNetanya: MapData = { + name: 'Netanya', + + urlProvider: async (_usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { + const zoomLevelStr = (zoomLevel + 3).toString() + const rowStr = row.toString() + const colStr = col.toString() + const mapTypeStr = mapType === 'Satellite' ? 'Netanya_2022:2022' : 'Netanya_SHP:Netanya_Reka' + return { + url: `https://v5.gis-net.co.il/proxy/proxy.ashx?http://10.237.72.71:8080/geoserver/gwc/service/wmts?SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&LAYER=${mapTypeStr}&STYLE=raster&FORMAT=image/jpeg&TILEMATRIXSET=Netanya&TILEMATRIX=Netanya:${zoomLevelStr}&TILEROW=${rowStr}&TILECOL=${colStr}` + } + }, + + zoomLevelProvider: (zoomLevel: number): string => { + return zoomLevel.toString() + }, + + zoomFactorProvider: (_zoomLevel: number, _zoomIn: boolean): number => { + return 2 + }, + + supportedMapTypes: ['Satellite', 'Street & Buildings'], + + showScale: true, + + referer: 'https://v5.gis-net.co.il/v5/netanya', + + zoomLayers: [ + { + scale: 32000, + centerTileX: 3, + centerTileY: 3, + centerTileOffsetX: 183, + centerTileOffsetY: 64 + }, + { + scale: 16000, + centerTileX: 7, + centerTileY: 6, + centerTileOffsetX: 109, + centerTileOffsetY: 133 + }, + { + scale: 8000, + centerTileX: 14, + centerTileY: 13, + centerTileOffsetX: 221, + centerTileOffsetY: 9 + }, + { + scale: 4000, + centerTileX: 29, + centerTileY: 26, + centerTileOffsetX: 184, + centerTileOffsetY: 18 + }, + { + scale: 2000, + centerTileX: 59, + centerTileY: 52, + centerTileOffsetX: 112, + centerTileOffsetY: 39 + }, + { + scale: 1000, + centerTileX: 118, + centerTileY: 104, + centerTileOffsetX: 224, + centerTileOffsetY: 76 + }, + { + scale: 500, + centerTileX: 237, + centerTileY: 208, + centerTileOffsetX: 192, + centerTileOffsetY: 150 + }, + { + scale: 250, + centerTileX: 475, + centerTileY: 417, + centerTileOffsetX: 128, + centerTileOffsetY: 44 + }, + { + scale: 125, + centerTileX: 950, + centerTileY: 834, + centerTileOffsetX: 255, + centerTileOffsetY: 90 + } + ] +} diff --git a/src/common/maps/tel-aviv.data.ts b/src/common/maps/tel-aviv.data.ts index a7da46c..6f93729 100644 --- a/src/common/maps/tel-aviv.data.ts +++ b/src/common/maps/tel-aviv.data.ts @@ -1,99 +1,93 @@ -// import * as pimage from "pureimage"; -// import { Bitmap } from "pureimage/types/bitmap"; -// import { Readable } from "stream"; -// import { MapData, UrlResult, UrlUsageType } from "./map.data"; -// -// export const mapDataTelAviv: MapData = { -// name: "Tel-Aviv", -// -// urlProvider: async (usageType: UrlUsageType, mapType: string, zoomLevel: number, row: number, col: number): Promise => { -// let zoomLevelStr = zoomLevel + 13; -// const rowStr = row.toString(10); -// const colStr = col.toString(10); -// return { url: `https://gisn.tel-aviv.gov.il/arcgis/rest/services/WM/IView2Ortho2021WM/MapServer/tile/${zoomLevelStr}/${rowStr}/${colStr}?blankTile=false` }; -// }, -// -// zoomLevelProvider: (zoomLevel: number): string => { -// return zoomLevel.toString(); -// }, -// -// zoomFactorProvider: (zoomLevel: number, zoomIn: boolean): number => { -// return 2; -// }, -// -// decode: async (mapType: string, buffer: Buffer): Promise => { -// return pimage.decodeJPEGFromStream(Readable.from(buffer)); -// }, -// -// supportedMapTypes: ["Satellite"], -// -// showScale: true, -// -// referer: undefined, -// -// zoomLayers: [ -// { -// scale: 72000, -// centerTileX: 4887, -// centerTileY: 3324, -// centerTileOffsetX: 169, -// centerTileOffsetY: 99, -// }, -// { -// scale: 36000, -// centerTileX: 9775, -// centerTileY: 6648, -// centerTileOffsetX: 81, -// centerTileOffsetY: 201, -// }, -// { -// scale: 18000, -// centerTileX: 19550, -// centerTileY: 13297, -// centerTileOffsetX: 164, -// centerTileOffsetY: 141, -// }, -// { -// scale: 9000, -// centerTileX: 39101, -// centerTileY: 26595, -// centerTileOffsetX: 70, -// centerTileOffsetY: 25, -// }, -// { -// scale: 4500, -// centerTileX: 78202, -// centerTileY: 53190, -// centerTileOffsetX: 138, -// centerTileOffsetY: 51, -// }, -// { -// scale: 2250, -// centerTileX: 156405, -// centerTileY: 106380, -// centerTileOffsetX: 22, -// centerTileOffsetY: 100, -// }, -// { -// scale: 1125, -// centerTileX: 312810, -// centerTileY: 212760, -// centerTileOffsetX: 47, -// centerTileOffsetY: 200, -// }, -// { -// scale: 563, -// centerTileX: 625620, -// centerTileY: 425521, -// centerTileOffsetX: 94, -// centerTileOffsetY: 147, -// }, -// { -// scale: 281, -// centerTileX: 1251240, -// centerTileY: 851043, -// centerTileOffsetX: 194, -// centerTileOffsetY: 51, -// }, -// ], -// }; +import { MapData, UrlResult, UrlUsageType } from './map.data' + +//https://gisn.tel-aviv.gov.il/iview2js4/index.aspx?zoom=13000&device=desktop&extent=3871525,3773988,3874992,3775421&layers=577&back=1&year=2023&opacity=0.9&filters= +export const mapDataTelAviv: MapData = { + name: 'Tel-Aviv', + + urlProvider: async (_usageType: UrlUsageType, _mapType: string, zoomLevel: number, row: number, col: number): Promise => { + const zoomLevelStr = zoomLevel + 13 + const rowStr = row.toString(10) + const colStr = col.toString(10) + return { url: `https://gisn.tel-aviv.gov.il/arcgis/rest/services/WM/IView2Ortho2023WM/MapServer/tile/${zoomLevelStr}/${rowStr}/${colStr}?blankTile=false` } + }, + + zoomLevelProvider: (zoomLevel: number): string => { + return zoomLevel.toString() + }, + + zoomFactorProvider: (_zoomLevel: number, _zoomIn: boolean): number => { + return 2 + }, + + supportedMapTypes: ['Satellite'], + + showScale: true, + + referer: undefined, + + zoomLayers: [ + { + scale: 72000, + centerTileX: 4887, + centerTileY: 3324, + centerTileOffsetX: 169, + centerTileOffsetY: 99 + }, + { + scale: 36000, + centerTileX: 9775, + centerTileY: 6648, + centerTileOffsetX: 81, + centerTileOffsetY: 201 + }, + { + scale: 18000, + centerTileX: 19550, + centerTileY: 13297, + centerTileOffsetX: 164, + centerTileOffsetY: 141 + }, + { + scale: 9000, + centerTileX: 39101, + centerTileY: 26595, + centerTileOffsetX: 70, + centerTileOffsetY: 25 + }, + { + scale: 4500, + centerTileX: 78202, + centerTileY: 53190, + centerTileOffsetX: 138, + centerTileOffsetY: 51 + }, + { + scale: 2250, + centerTileX: 156405, + centerTileY: 106380, + centerTileOffsetX: 22, + centerTileOffsetY: 100 + }, + { + scale: 1125, + centerTileX: 312810, + centerTileY: 212760, + centerTileOffsetX: 47, + centerTileOffsetY: 200 + }, + { + scale: 563, + centerTileX: 625620, + centerTileY: 425521, + centerTileOffsetX: 94, + centerTileOffsetY: 147 + }, + { + scale: 281, + centerTileX: 1251240, + centerTileY: 851043, + centerTileOffsetX: 194, + centerTileOffsetY: 51 + } + ] +} diff --git a/src/main/downloader.ts b/src/main/downloader.ts index 0ca575e..2d9e6c4 100644 --- a/src/main/downloader.ts +++ b/src/main/downloader.ts @@ -46,9 +46,12 @@ export const downloadMap = async (win: BrowserWindow, request: DownloadData) => const { url, unsupported } = await getTileUrl(map, request.zoomLevel, request.startRow + y, request.startCol + x, request.mapType) try { if (!unsupported) { - const headers = map.getDownloaderHeaders ? map.getDownloaderHeaders() : {} + const headers = map.getDownloaderHeaders ?? {} + if (map.referer) { + headers['Referer'] = map.referer + } - const response = await fetch(url, headers) //, { responseType: "arraybuffer" }); + const response = await fetch(url, { headers }) //, { responseType: "arraybuffer" }); const arrayBuffer = await response.arrayBuffer() const buffer = Buffer.from(arrayBuffer) const img1 = await backendData.decode(request.mapType, buffer) diff --git a/src/main/index.ts b/src/main/index.ts index 7ac8885..f665b16 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,8 +1,9 @@ -import { app, BrowserWindow, shell } from 'electron' +import { app, BrowserWindow, session, shell } from 'electron' import { join } from 'path' import { electronApp, is, optimizer } from '@electron-toolkit/utils' import icon from '../../resources/favicon.ico?asset' import { eventRegistrar } from './event-registrar' +import { getReferrer } from './main-store' function createWindow(): void { // Create the browser window. @@ -20,7 +21,7 @@ function createWindow(): void { } }) - if (process.env.NODE_ENV !== "production") { + if (process.env.NODE_ENV !== 'production') { mainWindow.webContents.openDevTools() } @@ -41,7 +42,15 @@ function createWindow(): void { mainWindow.loadFile(join(__dirname, '../renderer/index.html')) } - eventRegistrar.registerEvents(mainWindow, app); + const filter = { + urls: [] + } + session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => { + details.requestHeaders['Referer'] = getReferrer() ?? '' + callback({ cancel: false, requestHeaders: details.requestHeaders }) + }) + + eventRegistrar.registerEvents(mainWindow, app) } // This method will be called when Electron has finished diff --git a/src/main/maps/haifa.backend.ts b/src/main/maps/haifa.backend.ts new file mode 100644 index 0000000..f3579f3 --- /dev/null +++ b/src/main/maps/haifa.backend.ts @@ -0,0 +1,12 @@ +import * as pimage from 'pureimage' +import { Bitmap } from 'pureimage' +import { Readable } from 'stream' +import { MapBackendData } from './map-backend' + +export const mapBackendDataHaifa: MapBackendData = { + name: 'Haifa', + + decode: async (_mapType: string, buffer: Buffer): Promise => { + return pimage.decodeJPEGFromStream(Readable.from(buffer)) + } +} diff --git a/src/main/maps/map-backend.ts b/src/main/maps/map-backend.ts index 44738bd..aacd899 100644 --- a/src/main/maps/map-backend.ts +++ b/src/main/maps/map-backend.ts @@ -1,5 +1,8 @@ import { mapBackendDataGovMap } from './govmap.backend' import { Bitmap } from 'pureimage' +import { mapBackendTelAviv } from './tel-aviv.backend' +import { mapBackendDataHaifa } from './haifa.backend' +import { mapBackendDataNetanya } from './netanya.backend' export type MapBackendData = { name: string @@ -9,10 +12,10 @@ export type MapBackendData = { const mapBackend = [ mapBackendDataGovMap, // mapDataGalilTahton, - // mapDataTelAviv, - // mapDataHaifa, + mapBackendTelAviv, + mapBackendDataHaifa, // mapDataHodHasharon, - // mapDataNetanya, + mapBackendDataNetanya // mapDataMapy ] diff --git a/src/main/maps/netanya.backend.ts b/src/main/maps/netanya.backend.ts new file mode 100644 index 0000000..6c7d99e --- /dev/null +++ b/src/main/maps/netanya.backend.ts @@ -0,0 +1,12 @@ +import * as pimage from 'pureimage' +import { Bitmap } from 'pureimage' +import { Readable } from 'stream' +import { MapBackendData } from './map-backend' + +export const mapBackendDataNetanya: MapBackendData = { + name: 'Netanya', + + decode: async (_mapType: string, buffer: Buffer): Promise => { + return await pimage.decodeJPEGFromStream(Readable.from(buffer)) + } +} diff --git a/src/main/maps/tel-aviv.backend.ts b/src/main/maps/tel-aviv.backend.ts new file mode 100644 index 0000000..46872ae --- /dev/null +++ b/src/main/maps/tel-aviv.backend.ts @@ -0,0 +1,12 @@ +import * as pimage from 'pureimage' +import { Bitmap } from 'pureimage' +import { Readable } from 'stream' +import { MapBackendData } from './map-backend' + +export const mapBackendTelAviv: MapBackendData = { + name: 'Tel-Aviv', + + decode: async (_: string, buffer: Buffer): Promise => { + return pimage.decodeJPEGFromStream(Readable.from(buffer)) + } +} diff --git a/src/renderer/src/components/controls-pane.vue b/src/renderer/src/components/controls-pane.vue index cd6c25d..25fae81 100644 --- a/src/renderer/src/components/controls-pane.vue +++ b/src/renderer/src/components/controls-pane.vue @@ -3,7 +3,7 @@
-
@@ -44,8 +44,8 @@