blue-chestnut-solar-expert 0.0.68 → 0.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-I24yU8do.js +10 -0
- package/dist/cjs/app-globals-I24yU8do.js.map +1 -0
- package/dist/cjs/basedecoder-CQuzfSgz.js +116 -0
- package/dist/cjs/basedecoder-CQuzfSgz.js.map +1 -0
- package/dist/cjs/deflate-AzGzQSW2.js +17 -0
- package/dist/cjs/deflate-AzGzQSW2.js.map +1 -0
- package/dist/cjs/eraser-icon_19.cjs.entry.js +31 -0
- package/dist/cjs/eraser-icon_19.cjs.entry.js.map +1 -0
- package/dist/cjs/index-HgRXF6kp.js +1470 -0
- package/dist/cjs/index-HgRXF6kp.js.map +1 -0
- package/dist/cjs/index.cjs.js +7 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/jpeg-Bx3bTm32.js +904 -0
- package/dist/cjs/jpeg-Bx3bTm32.js.map +1 -0
- package/dist/cjs/lerc-Bdx5y-yw.js +4427 -0
- package/dist/cjs/lerc-Bdx5y-yw.js.map +1 -0
- package/dist/cjs/loader.cjs.js +18 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/loading-widget.cjs.entry.js +22 -0
- package/dist/{stencil-library/polygon-information.entry.esm.js.map → cjs/loading-widget.cjs.entry.js.map} +1 -1
- package/dist/cjs/loading-widget.entry.cjs.js.map +1 -0
- package/dist/cjs/lzw-BmFug486.js +140 -0
- package/dist/cjs/lzw-BmFug486.js.map +1 -0
- package/dist/cjs/packbits-CYx9fB0v.js +35 -0
- package/dist/cjs/packbits-CYx9fB0v.js.map +1 -0
- package/dist/cjs/pako.esm-0mKI6Jik.js +3243 -0
- package/dist/cjs/pako.esm-0mKI6Jik.js.map +1 -0
- package/dist/cjs/raw-DC82yoyr.js +16 -0
- package/dist/cjs/raw-DC82yoyr.js.map +1 -0
- package/dist/cjs/stencil-library.cjs.js +30 -0
- package/dist/cjs/stencil-library.cjs.js.map +1 -0
- package/dist/cjs/webimage-Dc0t2xAB.js +49 -0
- package/dist/cjs/webimage-Dc0t2xAB.js.map +1 -0
- package/dist/collection/collection-manifest.json +31 -0
- package/dist/collection/components/icons/eraser.js +64 -0
- package/dist/collection/components/icons/eraser.js.map +1 -0
- package/dist/collection/components/icons/house.js +64 -0
- package/dist/collection/components/icons/house.js.map +1 -0
- package/dist/collection/components/icons/icon.js +108 -0
- package/dist/collection/components/icons/icon.js.map +1 -0
- package/dist/collection/components/icons/marker.js +64 -0
- package/dist/collection/components/icons/marker.js.map +1 -0
- package/dist/collection/components/icons/move.js +64 -0
- package/dist/collection/components/icons/move.js.map +1 -0
- package/dist/collection/components/icons/octagonMinus.js +64 -0
- package/dist/collection/components/icons/octagonMinus.js.map +1 -0
- package/dist/collection/components/icons/search.js +64 -0
- package/dist/collection/components/icons/search.js.map +1 -0
- package/dist/collection/components/icons/settings.js +64 -0
- package/dist/collection/components/icons/settings.js.map +1 -0
- package/dist/collection/components/icons/undo.js +64 -0
- package/dist/collection/components/icons/undo.js.map +1 -0
- package/dist/collection/components/map-draw/map-draw.js +824 -0
- package/dist/collection/components/map-draw/map-draw.js.map +1 -0
- package/dist/collection/components/map-draw/map-selector.js +246 -0
- package/dist/collection/components/map-draw/map-selector.js.map +1 -0
- package/dist/collection/components/map-draw/polygon-buttons.js +86 -0
- package/dist/collection/components/map-draw/polygon-buttons.js.map +1 -0
- package/dist/collection/components/map-draw/polygon-information.js +211 -0
- package/dist/collection/components/map-draw/polygon-information.js.map +1 -0
- package/dist/collection/components/map-draw/tool-box.js +108 -0
- package/dist/collection/components/map-draw/tool-box.js.map +1 -0
- package/dist/collection/components/map-draw/tutorial-component.js +219 -0
- package/dist/collection/components/map-draw/tutorial-component.js.map +1 -0
- package/dist/collection/components/settings/settings.js +127 -0
- package/dist/collection/components/settings/settings.js.map +1 -0
- package/dist/collection/components/solar-expert/solar-expert.js +241 -0
- package/dist/collection/components/solar-expert/solar-expert.js.map +1 -0
- package/dist/collection/components/solar-system-form/solar-system-form.js +617 -0
- package/dist/collection/components/solar-system-form/solar-system-form.js.map +1 -0
- package/dist/collection/components/widgets/loading-widget.js +18 -0
- package/dist/collection/components/widgets/loading-widget.js.map +1 -0
- package/dist/collection/components/widgets/toast-notification.js +133 -0
- package/dist/collection/components/widgets/toast-notification.js.map +1 -0
- package/dist/{stencil-library/config-CWfV1nKn.js → collection/config.js} +4 -10
- package/dist/collection/config.js.map +1 -0
- package/dist/collection/constants.js +90 -0
- package/dist/collection/constants.js.map +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/output.css +1126 -0
- package/dist/collection/store.js +43 -0
- package/dist/collection/store.js.map +1 -0
- package/dist/collection/types/lang.js +2 -0
- package/dist/collection/types/lang.js.map +1 -0
- package/dist/collection/types/shapes.js +2 -0
- package/dist/collection/types/shapes.js.map +1 -0
- package/dist/collection/utils/api.js +94 -0
- package/dist/collection/utils/api.js.map +1 -0
- package/dist/collection/utils/images.js +2 -0
- package/dist/collection/utils/images.js.map +1 -0
- package/dist/collection/utils/lang/english.js +164 -0
- package/dist/collection/utils/lang/english.js.map +1 -0
- package/dist/collection/utils/lang/general.js +30 -0
- package/dist/collection/utils/lang/general.js.map +1 -0
- package/dist/collection/utils/lang/german.js +164 -0
- package/dist/collection/utils/lang/german.js.map +1 -0
- package/dist/collection/utils/lang/spanish.js +164 -0
- package/dist/collection/utils/lang/spanish.js.map +1 -0
- package/dist/{stencil-library/tools-BNYKV5H5.js → collection/utils/render/tools.js} +8 -14
- package/dist/collection/utils/render/tools.js.map +1 -0
- package/dist/collection/utils/solar.js +135 -0
- package/dist/collection/utils/solar.js.map +1 -0
- package/dist/collection/utils/theme.js +97 -0
- package/dist/collection/utils/theme.js.map +1 -0
- package/dist/{stencil-library/utils-BCUZxI9u.js → collection/utils/utils.js} +3 -9
- package/dist/collection/utils/utils.js.map +1 -0
- package/dist/components/eraser-icon.js +11 -0
- package/dist/components/eraser-icon.js.map +1 -0
- package/dist/components/house-icon.js +11 -0
- package/dist/components/house-icon.js.map +1 -0
- package/dist/components/icon-selector.js +11 -0
- package/dist/components/icon-selector.js.map +1 -0
- package/dist/components/index.js +1269 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/loading-widget.js +38 -0
- package/dist/{stencil-library/marker-icon.entry.esm.js.map → components/loading-widget.js.map} +1 -1
- package/dist/components/map-draw.js +11 -0
- package/dist/components/map-draw.js.map +1 -0
- package/dist/components/map-selector.js +11 -0
- package/dist/components/map-selector.js.map +1 -0
- package/dist/components/marker-icon.js +11 -0
- package/dist/components/marker-icon.js.map +1 -0
- package/dist/components/move-icon.js +11 -0
- package/dist/components/move-icon.js.map +1 -0
- package/dist/components/octagon-minus-icon.js +11 -0
- package/dist/components/octagon-minus-icon.js.map +1 -0
- package/dist/{stencil-library/polygon-buttons.entry.js → components/p-26DHwbCE.js} +29 -10
- package/dist/{stencil-library/solar-expert.entry.js.map → components/p-26DHwbCE.js.map} +1 -1
- package/dist/components/p-B54Ul0nf.js +15 -0
- package/dist/components/p-B54Ul0nf.js.map +1 -0
- package/dist/components/p-B5WTRCh8.js +3241 -0
- package/dist/components/p-B5WTRCh8.js.map +1 -0
- package/dist/{stencil-library/jpeg-Dd5nnHR5.js → components/p-BGoSj_DR.js} +3 -11
- package/dist/components/p-BGoSj_DR.js.map +1 -0
- package/dist/{stencil-library/octagon-minus-icon.entry.js → components/p-BJLO76Yi.js} +27 -9
- package/dist/components/p-BJLO76Yi.js.map +1 -0
- package/dist/components/p-BOe-Z8rz.js +16323 -0
- package/dist/components/p-BOe-Z8rz.js.map +1 -0
- package/dist/{stencil-library/map-selector.entry.js → components/p-Bduzzygj.js} +453 -12
- package/dist/components/p-Bduzzygj.js.map +1 -0
- package/dist/{stencil-library/packbits-X3R_utTs.js → components/p-ByX6QP-E.js} +3 -9
- package/dist/components/p-ByX6QP-E.js.map +1 -0
- package/dist/{stencil-library/solar-system-form.entry.js → components/p-C3ZXE525.js} +382 -80
- package/dist/components/p-C3ZXE525.js.map +1 -0
- package/dist/{stencil-library/icon-selector.entry.js → components/p-C5QieOat.js} +76 -9
- package/dist/components/p-C5QieOat.js.map +1 -0
- package/dist/{stencil-library/eraser-icon.entry.js → components/p-CL74Q4VR.js} +27 -9
- package/dist/components/p-CL74Q4VR.js.map +1 -0
- package/dist/{stencil-library/webimage-CBrfoxHM.js → components/p-Cgchl6bA.js} +3 -9
- package/dist/components/p-Cgchl6bA.js.map +1 -0
- package/dist/{stencil-library/tool-box.entry.js → components/p-Cx7fffWb.js} +135 -11
- package/dist/components/p-Cx7fffWb.js.map +1 -0
- package/dist/{stencil-library/tutorial-component.entry.js → components/p-D2AHNjbG.js} +35 -10
- package/dist/{stencil-library/toast-notification.entry.esm.js.map → components/p-D2AHNjbG.js.map} +1 -1
- package/dist/{stencil-library/house-icon.entry.js → components/p-D8w3bTPO.js} +27 -9
- package/dist/components/p-D8w3bTPO.js.map +1 -0
- package/dist/{stencil-library/search-icon.entry.js → components/p-DBwr8xSB.js} +27 -9
- package/dist/components/p-DBwr8xSB.js.map +1 -0
- package/dist/{stencil-library/lerc-7W4E8EBs.js → components/p-DLWzgdrw.js} +1981 -27
- package/dist/components/p-DLWzgdrw.js.map +1 -0
- package/dist/{stencil-library/settings-icon.entry.js → components/p-DTXeHbuh.js} +27 -9
- package/dist/{stencil-library/octagon-minus-icon.entry.esm.js.map → components/p-DTXeHbuh.js.map} +1 -1
- package/dist/{stencil-library/settings-modal.entry.js → components/p-Ddk3b30j.js} +30 -12
- package/dist/{stencil-library/polygon-buttons.entry.esm.js.map → components/p-Ddk3b30j.js.map} +1 -1
- package/dist/{stencil-library/store-CcqrFuBK.js → components/p-DfzSejIb.js} +3 -3
- package/dist/components/p-DfzSejIb.js.map +1 -0
- package/dist/{stencil-library/move-icon.entry.js → components/p-FdEV2qPo.js} +27 -9
- package/dist/components/p-FdEV2qPo.js.map +1 -0
- package/dist/{stencil-library/polygon-information.entry.js → components/p-OxUYjaAL.js} +68 -11
- package/dist/components/p-OxUYjaAL.js.map +1 -0
- package/dist/{stencil-library/toast-notification.entry.js → components/p-P28NBglk.js} +30 -9
- package/dist/{stencil-library/loading-widget.entry.js.map → components/p-P28NBglk.js.map} +1 -1
- package/dist/{stencil-library/marker-icon.entry.js → components/p-Umz6nJIv.js} +27 -9
- package/dist/components/p-Umz6nJIv.js.map +1 -0
- package/dist/components/p-WmcSqXD8.js +14 -0
- package/dist/components/p-WmcSqXD8.js.map +1 -0
- package/dist/components/p-j-vOrhhh.js +114 -0
- package/dist/components/p-j-vOrhhh.js.map +1 -0
- package/dist/{stencil-library/lzw--P4c0ZHH.js → components/p-q8auDIJ2.js} +4 -10
- package/dist/components/p-q8auDIJ2.js.map +1 -0
- package/dist/{stencil-library/undo-icon.entry.js → components/p-waOPoUcA.js} +27 -9
- package/dist/components/p-waOPoUcA.js.map +1 -0
- package/dist/components/polygon-buttons.js +11 -0
- package/dist/components/polygon-buttons.js.map +1 -0
- package/dist/components/polygon-information.js +11 -0
- package/dist/components/polygon-information.js.map +1 -0
- package/dist/components/search-icon.js +11 -0
- package/dist/components/search-icon.js.map +1 -0
- package/dist/components/settings-icon.js +11 -0
- package/dist/components/settings-icon.js.map +1 -0
- package/dist/components/settings-modal.js +11 -0
- package/dist/components/settings-modal.js.map +1 -0
- package/dist/{stencil-library/solar-expert.entry.js → components/solar-expert.js} +149 -13
- package/dist/components/solar-expert.js.map +1 -0
- package/dist/components/solar-system-form.js +11 -0
- package/dist/components/solar-system-form.js.map +1 -0
- package/dist/components/toast-notification.js +11 -0
- package/dist/components/toast-notification.js.map +1 -0
- package/dist/components/tool-box.js +11 -0
- package/dist/components/tool-box.js.map +1 -0
- package/dist/components/tutorial-component.js +11 -0
- package/dist/components/tutorial-component.js.map +1 -0
- package/dist/components/undo-icon.js +11 -0
- package/dist/components/undo-icon.js.map +1 -0
- package/dist/esm/basedecoder-j-vOrhhh.js +114 -0
- package/dist/esm/basedecoder-j-vOrhhh.js.map +1 -0
- package/dist/esm/deflate-DHgPf9CO.js +15 -0
- package/dist/{stencil-library/deflate-0Vdd6-55.js.map → esm/deflate-DHgPf9CO.js.map} +1 -1
- package/dist/esm/eraser-icon_19.entry.js +7 -0
- package/dist/esm/eraser-icon_19.entry.js.map +1 -0
- package/dist/esm/index-C2JRBB5c.js +1458 -0
- package/dist/esm/index-C2JRBB5c.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/jpeg-CJLm1GkA.js +902 -0
- package/dist/esm/jpeg-CJLm1GkA.js.map +1 -0
- package/dist/esm/lerc-DF5Lrv5A.js +4424 -0
- package/dist/esm/lerc-DF5Lrv5A.js.map +1 -0
- package/dist/esm/loader.js +16 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/{stencil-library → esm}/loading-widget.entry.js +2 -2
- package/dist/esm/loading-widget.entry.js.map +1 -0
- package/dist/esm/lzw-DaOzWJUD.js +138 -0
- package/dist/esm/lzw-DaOzWJUD.js.map +1 -0
- package/dist/esm/packbits-CZPyx9kx.js +33 -0
- package/dist/esm/packbits-CZPyx9kx.js.map +1 -0
- package/dist/esm/pako.esm-B5WTRCh8.js +3241 -0
- package/dist/{stencil-library/pako.esm-CPorU236.js.map → esm/pako.esm-B5WTRCh8.js.map} +1 -1
- package/dist/esm/raw-pqeeWc2_.js +14 -0
- package/dist/esm/raw-pqeeWc2_.js.map +1 -0
- package/dist/esm/stencil-library.js +26 -0
- package/dist/esm/stencil-library.js.map +1 -0
- package/dist/esm/webimage-BiHardhv.js +47 -0
- package/dist/{stencil-library/webimage-CBrfoxHM.js.map → esm/webimage-BiHardhv.js.map} +1 -1
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil-library/index.esm.js +1 -13
- package/dist/stencil-library/index.esm.js.map +1 -1
- package/dist/stencil-library/{search-icon.entry.js.map → p-9b4e52c3.entry.js} +2 -1
- package/dist/stencil-library/p-9b4e52c3.entry.js.map +1 -0
- package/dist/stencil-library/p-B54Ul0nf.js +2 -0
- package/dist/stencil-library/p-B54Ul0nf.js.map +1 -0
- package/dist/stencil-library/p-B5WTRCh8.js +2 -0
- package/dist/stencil-library/p-B5WTRCh8.js.map +1 -0
- package/dist/stencil-library/p-BGoSj_DR.js +2 -0
- package/dist/stencil-library/p-BGoSj_DR.js.map +1 -0
- package/dist/stencil-library/p-ByX6QP-E.js +2 -0
- package/dist/stencil-library/p-ByX6QP-E.js.map +1 -0
- package/dist/stencil-library/p-C2JRBB5c.js +3 -0
- package/dist/stencil-library/p-C2JRBB5c.js.map +1 -0
- package/dist/stencil-library/p-CX8V3eiN.js +2 -0
- package/dist/stencil-library/p-CX8V3eiN.js.map +1 -0
- package/dist/stencil-library/p-Cgchl6bA.js +2 -0
- package/dist/stencil-library/p-Cgchl6bA.js.map +1 -0
- package/dist/stencil-library/p-CymYGBJH.js +2 -0
- package/dist/stencil-library/p-CymYGBJH.js.map +1 -0
- package/dist/stencil-library/p-DHgjDQwz.js +10 -0
- package/dist/stencil-library/p-DHgjDQwz.js.map +1 -0
- package/dist/stencil-library/p-WmcSqXD8.js +2 -0
- package/dist/stencil-library/p-WmcSqXD8.js.map +1 -0
- package/dist/stencil-library/p-ba64c5e4.entry.js +2 -0
- package/dist/stencil-library/p-ba64c5e4.entry.js.map +1 -0
- package/dist/stencil-library/p-j-vOrhhh.js +2 -0
- package/dist/stencil-library/p-j-vOrhhh.js.map +1 -0
- package/dist/stencil-library/p-q8auDIJ2.js +2 -0
- package/dist/stencil-library/p-q8auDIJ2.js.map +1 -0
- package/dist/stencil-library/stencil-library.esm.js +1 -52
- package/dist/stencil-library/stencil-library.esm.js.map +1 -1
- package/dist/types/components/solar-system-form/solar-system-form.d.ts +1 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/utils/api.d.ts +1 -0
- package/package.json +1 -1
- package/dist/stencil-library/config-CWfV1nKn.js.map +0 -1
- package/dist/stencil-library/constants-hboFofU4.js +0 -1522
- package/dist/stencil-library/constants-hboFofU4.js.map +0 -1
- package/dist/stencil-library/decoder-DNOvLSaS.js +0 -39
- package/dist/stencil-library/decoder-DNOvLSaS.js.map +0 -1
- package/dist/stencil-library/deflate-0Vdd6-55.js +0 -21
- package/dist/stencil-library/eraser-icon.entry.esm.js.map +0 -1
- package/dist/stencil-library/eraser-icon.entry.js.map +0 -1
- package/dist/stencil-library/house-icon.entry.esm.js.map +0 -1
- package/dist/stencil-library/house-icon.entry.js.map +0 -1
- package/dist/stencil-library/icon-selector.entry.esm.js.map +0 -1
- package/dist/stencil-library/icon-selector.entry.js.map +0 -1
- package/dist/stencil-library/index-CChkgM3J.js +0 -414
- package/dist/stencil-library/index-CChkgM3J.js.map +0 -1
- package/dist/stencil-library/index-ICfDNUMe.js +0 -4172
- package/dist/stencil-library/index-ICfDNUMe.js.map +0 -1
- package/dist/stencil-library/jpeg-Dd5nnHR5.js.map +0 -1
- package/dist/stencil-library/lerc-7W4E8EBs.js.map +0 -1
- package/dist/stencil-library/lzw--P4c0ZHH.js.map +0 -1
- package/dist/stencil-library/map-draw-Cx9WZoKH.js +0 -25567
- package/dist/stencil-library/map-draw-Cx9WZoKH.js.map +0 -1
- package/dist/stencil-library/map-draw.entry.esm.js.map +0 -1
- package/dist/stencil-library/map-draw.entry.js +0 -12
- package/dist/stencil-library/map-draw.entry.js.map +0 -1
- package/dist/stencil-library/map-selector.entry.esm.js.map +0 -1
- package/dist/stencil-library/map-selector.entry.js.map +0 -1
- package/dist/stencil-library/marker-icon.entry.js.map +0 -1
- package/dist/stencil-library/move-icon.entry.esm.js.map +0 -1
- package/dist/stencil-library/move-icon.entry.js.map +0 -1
- package/dist/stencil-library/octagon-minus-icon.entry.js.map +0 -1
- package/dist/stencil-library/packbits-X3R_utTs.js.map +0 -1
- package/dist/stencil-library/pako.esm-CPorU236.js +0 -6881
- package/dist/stencil-library/polygon-buttons.entry.js.map +0 -1
- package/dist/stencil-library/polygon-information.entry.js.map +0 -1
- package/dist/stencil-library/raw-BxukYehy.js +0 -20
- package/dist/stencil-library/raw-BxukYehy.js.map +0 -1
- package/dist/stencil-library/search-icon.entry.esm.js.map +0 -1
- package/dist/stencil-library/settings-icon.entry.esm.js.map +0 -1
- package/dist/stencil-library/settings-icon.entry.js.map +0 -1
- package/dist/stencil-library/settings-modal.entry.esm.js.map +0 -1
- package/dist/stencil-library/settings-modal.entry.js.map +0 -1
- package/dist/stencil-library/solar-expert.entry.esm.js.map +0 -1
- package/dist/stencil-library/solar-system-form.entry.esm.js.map +0 -1
- package/dist/stencil-library/solar-system-form.entry.js.map +0 -1
- package/dist/stencil-library/store-CcqrFuBK.js.map +0 -1
- package/dist/stencil-library/toast-notification.entry.js.map +0 -1
- package/dist/stencil-library/tool-box.entry.esm.js.map +0 -1
- package/dist/stencil-library/tool-box.entry.js.map +0 -1
- package/dist/stencil-library/tools-BNYKV5H5.js.map +0 -1
- package/dist/stencil-library/tutorial-component.entry.esm.js.map +0 -1
- package/dist/stencil-library/tutorial-component.entry.js.map +0 -1
- package/dist/stencil-library/undo-icon.entry.esm.js.map +0 -1
- package/dist/stencil-library/undo-icon.entry.js.map +0 -1
- package/dist/stencil-library/utils-BCUZxI9u.js.map +0 -1
- /package/dist/{stencil-library → esm}/app-globals-CX8V3eiN.js +0 -0
- /package/dist/{stencil-library → esm}/app-globals-CX8V3eiN.js.map +0 -0
|
@@ -0,0 +1,824 @@
|
|
|
1
|
+
import { getAssetPath, h, } from "@stencil/core";
|
|
2
|
+
import { fetchSolarData, getBestFittingRoofSegment, getOptimalSolarPositionFully, } from "harmonia-sim";
|
|
3
|
+
import { getBuildingImages } from "../../utils/solar";
|
|
4
|
+
import { CanvasManager, CanvasUtils, renderRGB, Tool, } from "harmonia-draw";
|
|
5
|
+
import { markRoofEdgeTool, moveTool, obstructionTool, roofTool, } from "../../utils/render/tools";
|
|
6
|
+
import { DEFAULT_SOLAR_EXPERT_CONFIG, DEFAULT_SOLAR_PANEL_TYPE, } from "../../config";
|
|
7
|
+
import { getPixelInMeters } from "../../utils/utils";
|
|
8
|
+
import { BORDER_INSET } from "../../constants";
|
|
9
|
+
import { getLanguageStrings } from "../../utils/lang/general";
|
|
10
|
+
import { onChange, state } from "../../store";
|
|
11
|
+
export class MapDraw {
|
|
12
|
+
apiKey = "";
|
|
13
|
+
config = DEFAULT_SOLAR_EXPERT_CONFIG;
|
|
14
|
+
solarPanel = DEFAULT_SOLAR_PANEL_TYPE;
|
|
15
|
+
enableSettings = false;
|
|
16
|
+
showInstructions = true;
|
|
17
|
+
showSettings = false;
|
|
18
|
+
showTutorial = false;
|
|
19
|
+
showMarkEdgeTutorial = false;
|
|
20
|
+
showAdditionalToolsTutorial = false;
|
|
21
|
+
additionalToolsTutorialShown = false;
|
|
22
|
+
showObstacleTutorial = false;
|
|
23
|
+
obstacleTutorialShown = false;
|
|
24
|
+
firstPolygonClosed = false;
|
|
25
|
+
zoom = 1;
|
|
26
|
+
loadingState = "empty";
|
|
27
|
+
rgbTiff = null;
|
|
28
|
+
currentTool = roofTool;
|
|
29
|
+
buildingInsights = null;
|
|
30
|
+
pixelInMeters = 0.2;
|
|
31
|
+
interaction = {
|
|
32
|
+
isDrawing: false,
|
|
33
|
+
isDragging: false,
|
|
34
|
+
lastTouchTime: 0,
|
|
35
|
+
};
|
|
36
|
+
currentPolygon = null;
|
|
37
|
+
solarSystem = {};
|
|
38
|
+
showToast = false;
|
|
39
|
+
toastMessage = "";
|
|
40
|
+
toastType = "success";
|
|
41
|
+
el;
|
|
42
|
+
canvasElement;
|
|
43
|
+
polygonCanvas;
|
|
44
|
+
polygonCtx;
|
|
45
|
+
canvasManager;
|
|
46
|
+
preventDefaultTouch;
|
|
47
|
+
gestureStartHandler;
|
|
48
|
+
gestureChangeHandler;
|
|
49
|
+
gestureEndHandler;
|
|
50
|
+
latitudeChangeListener;
|
|
51
|
+
longitudeChangeListener;
|
|
52
|
+
componentDidLoad() {
|
|
53
|
+
// Set up change listeners for latitude and longitude
|
|
54
|
+
this.latitudeChangeListener = () => {
|
|
55
|
+
if (state.latitude && state.longitude) {
|
|
56
|
+
this.loadingState = "loading";
|
|
57
|
+
this.getBuildingImages();
|
|
58
|
+
this.getBuildingInsights();
|
|
59
|
+
// Reset tutorial states for new location
|
|
60
|
+
this.resetTutorials();
|
|
61
|
+
// Show tutorial when coordinates are first set
|
|
62
|
+
this.showTutorial = true;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
this.longitudeChangeListener = () => {
|
|
66
|
+
if (state.latitude && state.longitude) {
|
|
67
|
+
this.loadingState = "loading";
|
|
68
|
+
this.getBuildingImages();
|
|
69
|
+
this.getBuildingInsights();
|
|
70
|
+
// Reset tutorial states for new location
|
|
71
|
+
this.resetTutorials();
|
|
72
|
+
// Show tutorial when coordinates are first set
|
|
73
|
+
this.showTutorial = true;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
onChange("latitude", this.latitudeChangeListener);
|
|
77
|
+
onChange("longitude", this.longitudeChangeListener);
|
|
78
|
+
// Load data if coordinates already exist
|
|
79
|
+
if (state.latitude && state.longitude) {
|
|
80
|
+
this.loadingState = "loading";
|
|
81
|
+
this.getBuildingInsights();
|
|
82
|
+
this.getBuildingImages();
|
|
83
|
+
// Show tutorial if coordinates already exist
|
|
84
|
+
this.showTutorial = true;
|
|
85
|
+
}
|
|
86
|
+
// Wait for the next frame to ensure DOM is ready
|
|
87
|
+
requestAnimationFrame(() => {
|
|
88
|
+
this.initializeCanvas();
|
|
89
|
+
const rect = this.canvasElement.getBoundingClientRect();
|
|
90
|
+
this.sizeCanvas(rect.width, rect.height);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
initializeCanvas() {
|
|
94
|
+
if (this.canvasElement && this.polygonCanvas) {
|
|
95
|
+
// Set initial canvas sizes based on container
|
|
96
|
+
const rect = this.canvasElement.getBoundingClientRect();
|
|
97
|
+
if (rect.width > 0 && rect.height > 0) {
|
|
98
|
+
this.canvasElement.width = rect.width;
|
|
99
|
+
this.canvasElement.height = rect.height;
|
|
100
|
+
this.polygonCanvas.width = rect.width;
|
|
101
|
+
this.polygonCanvas.height = rect.height;
|
|
102
|
+
this.polygonCtx = this.polygonCanvas.getContext("2d");
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Add resize listener
|
|
106
|
+
window.addEventListener("resize", this.handleResize);
|
|
107
|
+
}
|
|
108
|
+
handleResize = () => {
|
|
109
|
+
if (this.rgbTiff) {
|
|
110
|
+
this.drawMap();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
disconnectedCallback() {
|
|
114
|
+
this.removeEventListeners();
|
|
115
|
+
window.removeEventListener("resize", this.handleResize);
|
|
116
|
+
window.removeEventListener("resize", this.handleResize);
|
|
117
|
+
}
|
|
118
|
+
setupCanvasManager() {
|
|
119
|
+
if (!this.rgbTiff)
|
|
120
|
+
return;
|
|
121
|
+
if (!this.rgbTiff)
|
|
122
|
+
return;
|
|
123
|
+
// if (this.canvasManager) return;
|
|
124
|
+
let managerConfig = {};
|
|
125
|
+
if (state.isMobile) {
|
|
126
|
+
managerConfig = {
|
|
127
|
+
...managerConfig,
|
|
128
|
+
closeDistance: 20,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
this.canvasManager = new CanvasManager({
|
|
132
|
+
coordinateSystem: {
|
|
133
|
+
width: this.rgbTiff.width,
|
|
134
|
+
height: this.rgbTiff.height,
|
|
135
|
+
},
|
|
136
|
+
onStateChange: () => {
|
|
137
|
+
const currentPolygon = this.canvasManager
|
|
138
|
+
?.getCurrentPolygon();
|
|
139
|
+
// Calculate area and create a copy to trigger Stencil re-render
|
|
140
|
+
this.currentPolygon = currentPolygon
|
|
141
|
+
? {
|
|
142
|
+
...currentPolygon,
|
|
143
|
+
points: [...currentPolygon.points],
|
|
144
|
+
area: currentPolygon.area,
|
|
145
|
+
}
|
|
146
|
+
: null;
|
|
147
|
+
CanvasUtils.drawState(this.polygonCtx, this.canvasManager.getState(), this.solarPanel, {
|
|
148
|
+
showGrid: false,
|
|
149
|
+
showPreview: !state.isMobile,
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
onPolygonChange: (polygon) => this.handlePolygonsChange(polygon),
|
|
153
|
+
onLowerRoofEdgeMarked: () => {
|
|
154
|
+
this.calculateSolarPanels(false);
|
|
155
|
+
// Show additional tools tutorial after mark edge tutorial is completed
|
|
156
|
+
if (!this.additionalToolsTutorialShown) {
|
|
157
|
+
this.showAdditionalToolsTutorial = true;
|
|
158
|
+
this.additionalToolsTutorialShown = true;
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
}, managerConfig);
|
|
162
|
+
console.log("debug", this.canvasManager?.getDebugString());
|
|
163
|
+
// Add event listeners after canvas is initialized
|
|
164
|
+
this.setupEventListeners();
|
|
165
|
+
// Draw map after canvas manager is set up
|
|
166
|
+
requestAnimationFrame(() => {
|
|
167
|
+
this.drawMap();
|
|
168
|
+
});
|
|
169
|
+
// Draw map after canvas manager is set up
|
|
170
|
+
requestAnimationFrame(() => {
|
|
171
|
+
this.drawMap();
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
setupEventListeners() {
|
|
175
|
+
if (!this.polygonCanvas)
|
|
176
|
+
return;
|
|
177
|
+
this.polygonCanvas.addEventListener("mousedown", this.handleMouseDown, {
|
|
178
|
+
passive: false,
|
|
179
|
+
});
|
|
180
|
+
this.polygonCanvas.addEventListener("touchstart", this.handleTouchStart, {
|
|
181
|
+
passive: false,
|
|
182
|
+
});
|
|
183
|
+
this.polygonCanvas.addEventListener("mousemove", this.handleMouseMove, {
|
|
184
|
+
passive: true,
|
|
185
|
+
});
|
|
186
|
+
this.polygonCanvas.addEventListener("mouseleave", this.handleMouseLeave, {
|
|
187
|
+
passive: true,
|
|
188
|
+
});
|
|
189
|
+
// Document-level event listeners for drag operations
|
|
190
|
+
document.addEventListener("mousemove", this.handleMouseMove, {
|
|
191
|
+
passive: true,
|
|
192
|
+
});
|
|
193
|
+
document.addEventListener("touchmove", this.handleTouchMove, {
|
|
194
|
+
passive: false,
|
|
195
|
+
});
|
|
196
|
+
document.addEventListener("mouseup", this.handleMouseUp, {
|
|
197
|
+
passive: true,
|
|
198
|
+
});
|
|
199
|
+
document.addEventListener("touchend", this.handleTouchEnd, {
|
|
200
|
+
passive: false,
|
|
201
|
+
});
|
|
202
|
+
// Additional touch event prevention
|
|
203
|
+
this.preventDefaultTouch = (e) => {
|
|
204
|
+
if (e.touches.length > 1) {
|
|
205
|
+
e.preventDefault();
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
this.gestureStartHandler = (e) => e.preventDefault();
|
|
209
|
+
this.gestureChangeHandler = (e) => e.preventDefault();
|
|
210
|
+
this.gestureEndHandler = (e) => e.preventDefault();
|
|
211
|
+
this.polygonCanvas.addEventListener("touchmove", this.preventDefaultTouch, {
|
|
212
|
+
passive: false,
|
|
213
|
+
});
|
|
214
|
+
this.polygonCanvas.addEventListener("gesturestart", this.gestureStartHandler, {
|
|
215
|
+
passive: false,
|
|
216
|
+
});
|
|
217
|
+
this.polygonCanvas.addEventListener("gesturechange", this.gestureChangeHandler, {
|
|
218
|
+
passive: false,
|
|
219
|
+
});
|
|
220
|
+
this.polygonCanvas.addEventListener("gestureend", this.gestureEndHandler, {
|
|
221
|
+
passive: false,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
removeEventListeners() {
|
|
225
|
+
if (!this.polygonCanvas)
|
|
226
|
+
return;
|
|
227
|
+
this.polygonCanvas.removeEventListener("mousedown", this.handleMouseDown);
|
|
228
|
+
this.polygonCanvas.removeEventListener("touchstart", this.handleTouchStart);
|
|
229
|
+
this.polygonCanvas.removeEventListener("mousemove", this.handleMouseMove);
|
|
230
|
+
this.polygonCanvas.removeEventListener("mouseleave", this.handleMouseLeave);
|
|
231
|
+
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
232
|
+
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
233
|
+
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
234
|
+
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
235
|
+
if (this.preventDefaultTouch) {
|
|
236
|
+
this.polygonCanvas.removeEventListener("touchmove", this.preventDefaultTouch);
|
|
237
|
+
}
|
|
238
|
+
if (this.gestureStartHandler) {
|
|
239
|
+
this.polygonCanvas.removeEventListener("gesturestart", this.gestureStartHandler);
|
|
240
|
+
}
|
|
241
|
+
if (this.gestureChangeHandler) {
|
|
242
|
+
this.polygonCanvas.removeEventListener("gesturechange", this.gestureChangeHandler);
|
|
243
|
+
}
|
|
244
|
+
if (this.gestureEndHandler) {
|
|
245
|
+
this.polygonCanvas.removeEventListener("gestureend", this.gestureEndHandler);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
handlePolygonsChange(polygon) {
|
|
249
|
+
this.currentPolygon = polygon;
|
|
250
|
+
// Check if this is the first polygon being closed
|
|
251
|
+
if (polygon.closed && !this.firstPolygonClosed &&
|
|
252
|
+
polygon.type === "roof") {
|
|
253
|
+
this.firstPolygonClosed = true;
|
|
254
|
+
// Show obstacle tutorial first instead of mark edge tutorial
|
|
255
|
+
this.showObstacleTutorial = true;
|
|
256
|
+
}
|
|
257
|
+
// Show mark edge tutorial when an obstacle polygon is closed (if obstacle tutorial was shown)
|
|
258
|
+
if (polygon.closed &&
|
|
259
|
+
polygon.type === "obstruction" &&
|
|
260
|
+
this.obstacleTutorialShown &&
|
|
261
|
+
!this.showMarkEdgeTutorial &&
|
|
262
|
+
!this.showObstacleTutorial) {
|
|
263
|
+
this.showMarkEdgeTutorial = true;
|
|
264
|
+
}
|
|
265
|
+
if (polygon.closed || this.currentTool !== moveTool) {
|
|
266
|
+
this.handleToolSelect(moveTool);
|
|
267
|
+
if (polygon.azimuth && polygon.pitch) {
|
|
268
|
+
if (this.canvasManager?.getPositionedSolarPanels(polygon.id)) {
|
|
269
|
+
this.calculateSolarPanels(false);
|
|
270
|
+
}
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const bestMatch = getBestFittingRoofSegment(polygon, this.buildingInsights?.solarPotential.roofSegmentStats ?? [], this.rgbTiff.bounds, this.canvasElement);
|
|
274
|
+
if (!bestMatch) {
|
|
275
|
+
const newPolygon = {
|
|
276
|
+
...polygon,
|
|
277
|
+
azimuth: 180,
|
|
278
|
+
pitch: 35,
|
|
279
|
+
};
|
|
280
|
+
this.canvasManager?.updatePolygon(newPolygon);
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const newPolygon = {
|
|
284
|
+
...polygon,
|
|
285
|
+
azimuth: polygon.azimuth || bestMatch.azimuthDegrees,
|
|
286
|
+
pitch: polygon.pitch || bestMatch.pitchDegrees,
|
|
287
|
+
};
|
|
288
|
+
this.canvasManager?.updatePolygon(newPolygon);
|
|
289
|
+
}
|
|
290
|
+
if (polygon.closed &&
|
|
291
|
+
this.canvasManager?.getPositionedSolarPanels(polygon.id)) {
|
|
292
|
+
this.calculateSolarPanels(false);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
handleMouseUp = (event) => {
|
|
296
|
+
if (!this.canvasManager)
|
|
297
|
+
return;
|
|
298
|
+
this.canvasManager.handleMouseUp(event);
|
|
299
|
+
};
|
|
300
|
+
handleTouchEnd = (event) => {
|
|
301
|
+
if (!this.polygonCanvas || !this.canvasManager)
|
|
302
|
+
return;
|
|
303
|
+
// Only prevent default if the touch is on the canvas
|
|
304
|
+
const target = event.target;
|
|
305
|
+
if (this.isTargetCanvas(target)) {
|
|
306
|
+
event.preventDefault();
|
|
307
|
+
event.stopPropagation();
|
|
308
|
+
}
|
|
309
|
+
this.canvasManager.handleTouchEnd(event);
|
|
310
|
+
};
|
|
311
|
+
handleTouchMove = (event) => {
|
|
312
|
+
if (!this.polygonCanvas || !this.canvasManager)
|
|
313
|
+
return;
|
|
314
|
+
// Only prevent default if the touch is on the canvas
|
|
315
|
+
const target = event.target;
|
|
316
|
+
if (this.isTargetCanvas(target)) {
|
|
317
|
+
event.preventDefault();
|
|
318
|
+
event.stopPropagation();
|
|
319
|
+
}
|
|
320
|
+
const rect = this.polygonCanvas.getBoundingClientRect();
|
|
321
|
+
this.canvasManager.handleTouchMove(event, rect);
|
|
322
|
+
};
|
|
323
|
+
handleMouseMove = (event) => {
|
|
324
|
+
if (!this.canvasManager)
|
|
325
|
+
return;
|
|
326
|
+
const rect = this.polygonCanvas?.getBoundingClientRect();
|
|
327
|
+
this.canvasManager.handleMouseMove(event, rect);
|
|
328
|
+
};
|
|
329
|
+
handleMouseLeave = () => {
|
|
330
|
+
if (!this.canvasManager)
|
|
331
|
+
return;
|
|
332
|
+
this.canvasManager.handleMouseLeave();
|
|
333
|
+
};
|
|
334
|
+
handleMouseDown = (event) => {
|
|
335
|
+
if (!this.canvasManager)
|
|
336
|
+
return;
|
|
337
|
+
const rect = this.polygonCanvas?.getBoundingClientRect();
|
|
338
|
+
this.canvasManager.handleMouseDown(event, rect);
|
|
339
|
+
};
|
|
340
|
+
handleTouchStart = (event) => {
|
|
341
|
+
if (!this.polygonCanvas || !this.canvasManager)
|
|
342
|
+
return;
|
|
343
|
+
// Only prevent default if the touch is on the canvas
|
|
344
|
+
const target = event.target;
|
|
345
|
+
if (!this.isTargetCanvas(target)) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
event.preventDefault();
|
|
349
|
+
event.stopPropagation();
|
|
350
|
+
const now = Date.now();
|
|
351
|
+
// Prevent double tap zoom with a longer timeout
|
|
352
|
+
if (now - this.interaction.lastTouchTime < 500) {
|
|
353
|
+
event.preventDefault();
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
this.interaction = {
|
|
357
|
+
...this.interaction,
|
|
358
|
+
lastTouchTime: now,
|
|
359
|
+
};
|
|
360
|
+
const rect = this.polygonCanvas.getBoundingClientRect();
|
|
361
|
+
this.canvasManager.handleTouchStart(event, rect);
|
|
362
|
+
};
|
|
363
|
+
isTargetCanvas(target) {
|
|
364
|
+
if (!this.polygonCanvas || !this.canvasElement)
|
|
365
|
+
return false;
|
|
366
|
+
return target === this.polygonCanvas ||
|
|
367
|
+
target === this.canvasElement ||
|
|
368
|
+
this.polygonCanvas.contains(target) ||
|
|
369
|
+
this.canvasElement.contains(target);
|
|
370
|
+
}
|
|
371
|
+
sizeCanvas(width, height) {
|
|
372
|
+
if (this.canvasElement) {
|
|
373
|
+
this.canvasElement.width = width;
|
|
374
|
+
this.canvasElement.height = height;
|
|
375
|
+
}
|
|
376
|
+
if (this.polygonCanvas) {
|
|
377
|
+
this.polygonCanvas.width = width;
|
|
378
|
+
this.polygonCanvas.height = height;
|
|
379
|
+
this.polygonCtx = this.polygonCanvas.getContext("2d");
|
|
380
|
+
if (this.canvasManager) {
|
|
381
|
+
this.canvasManager.updateCanvasSize({
|
|
382
|
+
width: width,
|
|
383
|
+
height: height,
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
async getBuildingInsights() {
|
|
389
|
+
if (!state.latitude || !state.longitude) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
if (this.buildingInsights) {
|
|
393
|
+
const sameLocation = this.buildingInsights.center.latitude === state.latitude &&
|
|
394
|
+
this.buildingInsights.center.longitude === state.longitude;
|
|
395
|
+
if (sameLocation) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
this.solarSystem = {};
|
|
399
|
+
this.canvasElement?.getContext("2d")?.clearRect(0, 0, this.canvasElement.width, this.canvasElement.height);
|
|
400
|
+
this.polygonCtx?.clearRect(0, 0, this.polygonCanvas.width, this.polygonCanvas.height);
|
|
401
|
+
this.rgbTiff = null;
|
|
402
|
+
this.canvasManager?.clearPolygons();
|
|
403
|
+
// Reset tutorial states for new location
|
|
404
|
+
this.resetTutorials();
|
|
405
|
+
}
|
|
406
|
+
try {
|
|
407
|
+
this.buildingInsights = await fetchSolarData(state.latitude, state.longitude, this.apiKey);
|
|
408
|
+
if (!this.buildingInsights) {
|
|
409
|
+
console.error("No building insights found. Please enter them manually.");
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
catch (error) {
|
|
413
|
+
console.error("Failed to get building insights:", error);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
async getBuildingImages() {
|
|
417
|
+
if (!state.latitude || !state.longitude) {
|
|
418
|
+
return;
|
|
419
|
+
}
|
|
420
|
+
// Check if we already have building insights for the same location
|
|
421
|
+
if (this.buildingInsights) {
|
|
422
|
+
const sameLocation = this.buildingInsights.center.latitude === state.latitude &&
|
|
423
|
+
this.buildingInsights.center.longitude === state.longitude;
|
|
424
|
+
if (sameLocation) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
try {
|
|
429
|
+
this.rgbTiff = await getBuildingImages(state.latitude, state.longitude, this.apiKey, state.radiusMeters);
|
|
430
|
+
if (this.rgbTiff) {
|
|
431
|
+
this.pixelInMeters = getPixelInMeters(this.rgbTiff);
|
|
432
|
+
if (this.canvasManager) {
|
|
433
|
+
this.canvasManager.setMeterToPixelRatio(this.pixelInMeters);
|
|
434
|
+
}
|
|
435
|
+
// this.loadingState = "loaded";
|
|
436
|
+
}
|
|
437
|
+
else {
|
|
438
|
+
this.loadingState = "error";
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
console.error("Failed to get building images:", error);
|
|
443
|
+
this.loadingState = "error";
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
async drawMap() {
|
|
447
|
+
if (!this.canvasElement || !this.rgbTiff) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
// Ensure canvas is properly sized
|
|
451
|
+
if (!this.canvasElement || !this.rgbTiff) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
// Ensure canvas is properly sized
|
|
455
|
+
this.sizeCanvas(this.rgbTiff.width, this.rgbTiff.height);
|
|
456
|
+
// Add a small delay to ensure canvas sizing is complete
|
|
457
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
458
|
+
// Add a small delay to ensure canvas sizing is complete
|
|
459
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
460
|
+
try {
|
|
461
|
+
renderRGB(this.rgbTiff, undefined, this.canvasElement);
|
|
462
|
+
this.loadingState = "loaded";
|
|
463
|
+
}
|
|
464
|
+
catch (error) {
|
|
465
|
+
console.error("Failed to render RGB image:", error);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
undo() {
|
|
469
|
+
if (this.canvasManager?.canUndo()) {
|
|
470
|
+
this.canvasManager.undo();
|
|
471
|
+
// Map harmonia-draw Tool enum back to local Tool
|
|
472
|
+
const harmoniaTool = this.canvasManager.getState().selectedTool;
|
|
473
|
+
switch (harmoniaTool) {
|
|
474
|
+
case Tool.ROOF_POLYGON:
|
|
475
|
+
this.currentTool = roofTool;
|
|
476
|
+
break;
|
|
477
|
+
case Tool.OBSTRUCTION_POLYGON:
|
|
478
|
+
this.currentTool = obstructionTool;
|
|
479
|
+
break;
|
|
480
|
+
case Tool.MOVE:
|
|
481
|
+
this.currentTool = moveTool;
|
|
482
|
+
break;
|
|
483
|
+
case Tool.MARK_ROOF_EDGE:
|
|
484
|
+
this.currentTool = markRoofEdgeTool;
|
|
485
|
+
break;
|
|
486
|
+
default:
|
|
487
|
+
this.currentTool = moveTool;
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
// Show toast message
|
|
491
|
+
const t = getLanguageStrings(state.settings.language);
|
|
492
|
+
this.showToastMessage(t.mapDraw.toast.undoSuccess, "success");
|
|
493
|
+
// if (!this.currentPolygon?.closed) {
|
|
494
|
+
// this.handleToolSelect(roofTool);
|
|
495
|
+
// }
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
calculateSolarPanels(showToast = false) {
|
|
499
|
+
if (this.currentPolygon) {
|
|
500
|
+
this.calculateSolarPanelsForPolygon(this.currentPolygon, false);
|
|
501
|
+
// Show toast message only when explicitly requested
|
|
502
|
+
if (showToast) {
|
|
503
|
+
const t = getLanguageStrings(state.settings.language);
|
|
504
|
+
this.showToastMessage(t.mapDraw.toast.calculateSolarPanelsSuccess, "success");
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
markAsFlatRoof() {
|
|
509
|
+
if (this.currentPolygon) {
|
|
510
|
+
const newPolygon = {
|
|
511
|
+
...this.currentPolygon,
|
|
512
|
+
pitch: 15,
|
|
513
|
+
azimuth: 180, // East orientation
|
|
514
|
+
};
|
|
515
|
+
this.canvasManager?.updatePolygon(newPolygon);
|
|
516
|
+
this.currentPolygon = newPolygon;
|
|
517
|
+
this.calculateSolarPanelsForPolygon(newPolygon, true);
|
|
518
|
+
// Show toast message
|
|
519
|
+
const t = getLanguageStrings(state.settings.language);
|
|
520
|
+
this.showToastMessage(t.mapDraw.toast.markAsFlatRoofSuccess, "info");
|
|
521
|
+
// Auto-select the mark roof edge tool
|
|
522
|
+
this.handleToolSelect(markRoofEdgeTool);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
calculateSolarPanelsForPolygon(polygon, isFlatRoof) {
|
|
526
|
+
const convertedSolarPanel = {
|
|
527
|
+
...this.solarPanel,
|
|
528
|
+
widthMeters: this.solarPanel.widthMeters / this.pixelInMeters,
|
|
529
|
+
heightMeters: this.solarPanel.heightMeters / this.pixelInMeters,
|
|
530
|
+
};
|
|
531
|
+
const inset = BORDER_INSET / this.pixelInMeters;
|
|
532
|
+
const solarPanels = getOptimalSolarPositionFully(polygon, this.canvasManager.getObstacles(), convertedSolarPanel, polygon.azimuth, inset, polygon.pitch, state.settings.columnSpacing, state.settings.rowSpacing);
|
|
533
|
+
this.canvasManager.setPositionedSolarPanel(polygon.id, solarPanels);
|
|
534
|
+
// Convert PositionedSolarPanel[] to SolarPanelSystemPart format
|
|
535
|
+
const allPositionedPanels = this.canvasManager
|
|
536
|
+
.getAllPositionedSolarPanels();
|
|
537
|
+
this.solarSystem = Object.keys(allPositionedPanels).reduce((acc, polygonId) => {
|
|
538
|
+
acc[polygonId] = {
|
|
539
|
+
numberOfPanels: allPositionedPanels[polygonId].length,
|
|
540
|
+
panelType: this.solarPanel,
|
|
541
|
+
pitch: polygon.pitch,
|
|
542
|
+
azimuth: polygon.azimuth,
|
|
543
|
+
roofArea: polygon.area,
|
|
544
|
+
isFlatRoof: isFlatRoof,
|
|
545
|
+
inverterType: "central",
|
|
546
|
+
};
|
|
547
|
+
return acc;
|
|
548
|
+
}, {});
|
|
549
|
+
}
|
|
550
|
+
handlePitchChange(event) {
|
|
551
|
+
const target = event.target;
|
|
552
|
+
const pitch = parseFloat(target.value);
|
|
553
|
+
if (this.currentPolygon) {
|
|
554
|
+
const newPolygon = {
|
|
555
|
+
...this.currentPolygon,
|
|
556
|
+
pitch: pitch,
|
|
557
|
+
};
|
|
558
|
+
this.canvasManager?.updatePolygon(newPolygon);
|
|
559
|
+
this.currentPolygon = newPolygon;
|
|
560
|
+
}
|
|
561
|
+
if (this.currentPolygon?.type === "roof" &&
|
|
562
|
+
this.canvasManager?.getPositionedSolarPanels(this.currentPolygon.id)) {
|
|
563
|
+
this.calculateSolarPanels(false);
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
handleAzimuthChange(event) {
|
|
568
|
+
const target = event.target;
|
|
569
|
+
const displayAzimuth = parseFloat(target.value);
|
|
570
|
+
const azimuth = (displayAzimuth + 270) % 360;
|
|
571
|
+
if (this.currentPolygon) {
|
|
572
|
+
const newPolygon = {
|
|
573
|
+
...this.currentPolygon,
|
|
574
|
+
azimuth: azimuth,
|
|
575
|
+
};
|
|
576
|
+
this.canvasManager?.updatePolygon(newPolygon);
|
|
577
|
+
this.currentPolygon = newPolygon;
|
|
578
|
+
}
|
|
579
|
+
if (this.currentPolygon?.type === "roof" &&
|
|
580
|
+
this.canvasManager?.getPositionedSolarPanels(this.currentPolygon.id)) {
|
|
581
|
+
this.calculateSolarPanels(false);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
handleToolSelect(tool) {
|
|
586
|
+
if (this.currentPolygon && !this.currentPolygon.closed &&
|
|
587
|
+
this.currentPolygon.points.length > 0) {
|
|
588
|
+
alert("Please close the polygon before selecting a tool");
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
this.currentTool = tool;
|
|
592
|
+
// Map legacy tools to harmonia-draw tools
|
|
593
|
+
if (this.canvasManager) {
|
|
594
|
+
switch (tool.name) {
|
|
595
|
+
case "roof":
|
|
596
|
+
this.canvasManager.setSelectedTool(Tool.ROOF_POLYGON);
|
|
597
|
+
break;
|
|
598
|
+
case "obstruction":
|
|
599
|
+
this.canvasManager.setSelectedTool(Tool.OBSTRUCTION_POLYGON);
|
|
600
|
+
break;
|
|
601
|
+
case "move":
|
|
602
|
+
this.canvasManager.setSelectedTool(Tool.MOVE);
|
|
603
|
+
break;
|
|
604
|
+
case "markRoofEdge":
|
|
605
|
+
this.canvasManager.setSelectedTool(Tool.MARK_ROOF_EDGE);
|
|
606
|
+
break;
|
|
607
|
+
default:
|
|
608
|
+
// For other tools like delete, etc., we handle them manually
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
handleSettingsClose = () => {
|
|
614
|
+
this.showSettings = false;
|
|
615
|
+
};
|
|
616
|
+
handleSettingsSave = (event) => {
|
|
617
|
+
state.settings = event.detail;
|
|
618
|
+
state.settingsVersion++;
|
|
619
|
+
};
|
|
620
|
+
handleTutorialClose = () => {
|
|
621
|
+
this.showTutorial = false;
|
|
622
|
+
};
|
|
623
|
+
handleMarkEdgeTutorialClose = () => {
|
|
624
|
+
this.showMarkEdgeTutorial = false;
|
|
625
|
+
this.handleToolSelect(markRoofEdgeTool);
|
|
626
|
+
};
|
|
627
|
+
handleAdditionalToolsTutorialClose = () => {
|
|
628
|
+
this.showAdditionalToolsTutorial = false;
|
|
629
|
+
this.additionalToolsTutorialShown = true;
|
|
630
|
+
};
|
|
631
|
+
handleObstacleTutorialClose = () => {
|
|
632
|
+
this.showObstacleTutorial = false;
|
|
633
|
+
this.obstacleTutorialShown = true;
|
|
634
|
+
this.handleToolSelect(obstructionTool);
|
|
635
|
+
};
|
|
636
|
+
handleObstacleTutorialSkip = () => {
|
|
637
|
+
this.showObstacleTutorial = false;
|
|
638
|
+
this.obstacleTutorialShown = true;
|
|
639
|
+
this.showMarkEdgeTutorial = true;
|
|
640
|
+
};
|
|
641
|
+
showToastMessage(message, type = "success") {
|
|
642
|
+
this.toastMessage = message;
|
|
643
|
+
this.toastType = type;
|
|
644
|
+
this.showToast = true;
|
|
645
|
+
// Hide toast after 3 seconds
|
|
646
|
+
setTimeout(() => {
|
|
647
|
+
this.showToast = false;
|
|
648
|
+
}, 3000);
|
|
649
|
+
}
|
|
650
|
+
resetTutorials() {
|
|
651
|
+
this.showTutorial = false;
|
|
652
|
+
this.showMarkEdgeTutorial = false;
|
|
653
|
+
this.showAdditionalToolsTutorial = false;
|
|
654
|
+
this.showObstacleTutorial = false;
|
|
655
|
+
this.additionalToolsTutorialShown = false;
|
|
656
|
+
this.obstacleTutorialShown = false;
|
|
657
|
+
this.firstPolygonClosed = false;
|
|
658
|
+
}
|
|
659
|
+
render() {
|
|
660
|
+
const t = getLanguageStrings(state.settings.language);
|
|
661
|
+
return (h("div", { key: 'bb9de30bfdc8c301648b4e555ee91dd10790cfe1', class: "flex flex-col justify-center items-center w-full h-full gap-4", id: "map-draw" }, this.showTutorial && (h("tutorial-component", { key: '55fb0534409ded5116ef5d0848ef4e18429125dc', onClose: this.handleTutorialClose, title: t.mapDraw.tutorial.title, description: t.mapDraw.tutorial.description, videoSource: getAssetPath("./assets/tutorial1.mp4") })), this.showMarkEdgeTutorial && (h("tutorial-component", { key: '106bb6504bd30cc9fbaa45ea81bce7bc8e35ad89', onClose: this.handleMarkEdgeTutorialClose, title: t.mapDraw.tutorial.markEdge.title, description: t.mapDraw.tutorial.markEdge
|
|
662
|
+
.description, videoSource: getAssetPath("./assets/tutorial2.mp4") })), this.showAdditionalToolsTutorial && (h("tutorial-component", { key: '60e9697dc04c89ce174265021ec2f725fc894887', onClose: this
|
|
663
|
+
.handleAdditionalToolsTutorialClose, title: t.mapDraw.tutorial.additionalTools.title, description: t.mapDraw.tutorial.additionalTools
|
|
664
|
+
.description, videoSource: getAssetPath("./assets/tutorial3.mp4") })), this.showObstacleTutorial && (h("tutorial-component", { key: 'b8ee4d273be4405f0e75433f3c3bfaf8fd38f6ea', onClose: this.handleObstacleTutorialClose, onSkip: this.handleObstacleTutorialSkip, showSkipButton: true, title: t.mapDraw.tutorial.obstacle.title, description: t.mapDraw.tutorial.obstacle.description, videoSource: getAssetPath("./assets/tutorial4.mp4") })), (state.latitude && state.longitude &&
|
|
665
|
+
this.loadingState === "loading") && (h("div", { key: '1d9795783a5a4001e8942214f9291ff17e5c9e81', class: "flex items-center justify-center w-full bg-opacity-75 z-20 pt-7 rounded-4xl" }, h("div", { key: '4fe8c9ed7e0f951047ade565c7c7d7c284880af7', class: "animate-spin rounded-full h-16 w-16 border-t-2 border-b-2 border-secondary" }))), (state.latitude && state.longitude &&
|
|
666
|
+
this.loadingState === "error") && (h("div", { key: 'b573fea2e40fe903464df2f9c87418e10645bdbe', class: "flex items-center justify-center w-full bg-opacity-75 z-20 pt-7 rounded-4xl" }, h("div", { key: '8ca895577317ed846e88a74f460bacac13ba1102', class: "text-red-500 text-center text-lg font-semibold" }, t.mapDraw.imageLoadError))), h("div", { key: '5727a6899c7ef16fd65b328f879f382200cd0099', class: "flex items-start justify-center w-full bg-primary rounded-4xl" }, h("div", { key: '8d0cb90847e01380e795426f4eb0d82ee4472fc3', class: "relative flex items-center justify-center w-full rounded-4xl bg-secondary", style: {
|
|
667
|
+
aspectRatio: this.rgbTiff
|
|
668
|
+
? `${this.rgbTiff.width}/${this.rgbTiff.height}`
|
|
669
|
+
: "",
|
|
670
|
+
} }, h("canvas", { key: 'e5dace6eed7f881f26c453ec4a37786940618cea', ref: (el) => this.canvasElement = el, class: "absolute top-0 left-0 w-full h-full rounded-4xl", id: "map-draw-canvas", style: {
|
|
671
|
+
cursor: this.currentTool.cursor,
|
|
672
|
+
} }), h("canvas", { key: '1e4bbef400cd1d95cd0c2bbfbe5c75de77687744', ref: (el) => this.polygonCanvas = el, class: "absolute top-0 left-0 w-full h-full rounded-4xl", style: {
|
|
673
|
+
cursor: this.currentTool.cursor,
|
|
674
|
+
} }))), this.rgbTiff && (h("div", { key: '19e7119b1f12ea5a4380a6b1b1bd5aa70ce9be77', class: "w-full" }, h("div", { key: '3e192ed5048aaeeb3a251ef11b30eda3a5b78668', class: "w-full pb-4" }, h("tool-box", { key: '5d3ee6c1e561b836dfe3566fb95573f669d6e692', currentTool: this.currentTool, onToolSelect: (tool) => this.handleToolSelect(tool), undoCallback: () => this.undo() })), h("div", { key: 'e7a98bcf23ea1653547d7b3eeabd3f784ac7114e', class: "w-full" }, h("polygon-information", { key: 'ca3092abaea53001bf5d008e9e9128e91e07cf01', currentPolygon: this.currentPolygon, numberOfPanels: this.currentPolygon
|
|
675
|
+
? this
|
|
676
|
+
.solarSystem[this.currentPolygon.id]
|
|
677
|
+
?.numberOfPanels
|
|
678
|
+
: undefined, handleAzimuthChange: (event) => this.handleAzimuthChange(event), handlePitchChange: (event) => this.handlePitchChange(event), calculateSolarPanels: () => this.calculateSolarPanels(true), markAsFlatRoof: () => this.markAsFlatRoof(), currentTool: this.currentTool.name })), h("div", { key: '004d65f46355bb244a1e7ddfa6c6df28ad3f31ad', class: "w-full" }, h("solar-system-form", { key: 'b9c095e76b308a5ab5de11de436eef7401516318', systemConfigs: this.solarSystem, polygons: this.canvasManager?.getPolygons(), roofCanvas: this.canvasElement, polygonCanvas: this.polygonCanvas, pixelInMeters: this.pixelInMeters })))), this.showSettings && (h("settings-modal", { key: 'adfa4fe395cb1a3a275cb1012b05ee7dce24ec45', settings: state.settings, onClose: this.handleSettingsClose, onSave: this.handleSettingsSave })), this.showToast && (h("toast-notification", { key: '5413c46de3d34e9910d011f49e9e39f778f40a69', message: this.toastMessage, type: this.toastType, duration: 3000 }))));
|
|
679
|
+
}
|
|
680
|
+
static get is() { return "map-draw"; }
|
|
681
|
+
static get originalStyleUrls() {
|
|
682
|
+
return {
|
|
683
|
+
"$": ["../../output.css"]
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
static get styleUrls() {
|
|
687
|
+
return {
|
|
688
|
+
"$": ["../../output.css"]
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
static get properties() {
|
|
692
|
+
return {
|
|
693
|
+
"apiKey": {
|
|
694
|
+
"type": "string",
|
|
695
|
+
"attribute": "api-key",
|
|
696
|
+
"mutable": false,
|
|
697
|
+
"complexType": {
|
|
698
|
+
"original": "string",
|
|
699
|
+
"resolved": "string",
|
|
700
|
+
"references": {}
|
|
701
|
+
},
|
|
702
|
+
"required": false,
|
|
703
|
+
"optional": false,
|
|
704
|
+
"docs": {
|
|
705
|
+
"tags": [],
|
|
706
|
+
"text": ""
|
|
707
|
+
},
|
|
708
|
+
"getter": false,
|
|
709
|
+
"setter": false,
|
|
710
|
+
"reflect": false,
|
|
711
|
+
"defaultValue": "\"\""
|
|
712
|
+
},
|
|
713
|
+
"config": {
|
|
714
|
+
"type": "unknown",
|
|
715
|
+
"attribute": "config",
|
|
716
|
+
"mutable": false,
|
|
717
|
+
"complexType": {
|
|
718
|
+
"original": "SolarExpertConfig",
|
|
719
|
+
"resolved": "SolarExpertConfig",
|
|
720
|
+
"references": {
|
|
721
|
+
"SolarExpertConfig": {
|
|
722
|
+
"location": "import",
|
|
723
|
+
"path": "../../config",
|
|
724
|
+
"id": "src/config.ts::SolarExpertConfig"
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
"required": false,
|
|
729
|
+
"optional": false,
|
|
730
|
+
"docs": {
|
|
731
|
+
"tags": [],
|
|
732
|
+
"text": ""
|
|
733
|
+
},
|
|
734
|
+
"getter": false,
|
|
735
|
+
"setter": false,
|
|
736
|
+
"defaultValue": "DEFAULT_SOLAR_EXPERT_CONFIG"
|
|
737
|
+
},
|
|
738
|
+
"solarPanel": {
|
|
739
|
+
"type": "unknown",
|
|
740
|
+
"attribute": "solar-panel",
|
|
741
|
+
"mutable": false,
|
|
742
|
+
"complexType": {
|
|
743
|
+
"original": "SolarPanelType",
|
|
744
|
+
"resolved": "SolarPanelType",
|
|
745
|
+
"references": {
|
|
746
|
+
"SolarPanelType": {
|
|
747
|
+
"location": "import",
|
|
748
|
+
"path": "harmonia-types",
|
|
749
|
+
"id": "../../../harmonia/packages/harmonia-types/dist/index.d.ts::SolarPanelType"
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
},
|
|
753
|
+
"required": false,
|
|
754
|
+
"optional": false,
|
|
755
|
+
"docs": {
|
|
756
|
+
"tags": [],
|
|
757
|
+
"text": ""
|
|
758
|
+
},
|
|
759
|
+
"getter": false,
|
|
760
|
+
"setter": false,
|
|
761
|
+
"defaultValue": "DEFAULT_SOLAR_PANEL_TYPE"
|
|
762
|
+
},
|
|
763
|
+
"enableSettings": {
|
|
764
|
+
"type": "boolean",
|
|
765
|
+
"attribute": "enable-settings",
|
|
766
|
+
"mutable": false,
|
|
767
|
+
"complexType": {
|
|
768
|
+
"original": "boolean",
|
|
769
|
+
"resolved": "boolean",
|
|
770
|
+
"references": {}
|
|
771
|
+
},
|
|
772
|
+
"required": false,
|
|
773
|
+
"optional": false,
|
|
774
|
+
"docs": {
|
|
775
|
+
"tags": [],
|
|
776
|
+
"text": ""
|
|
777
|
+
},
|
|
778
|
+
"getter": false,
|
|
779
|
+
"setter": false,
|
|
780
|
+
"reflect": false,
|
|
781
|
+
"defaultValue": "false"
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
static get states() {
|
|
786
|
+
return {
|
|
787
|
+
"showInstructions": {},
|
|
788
|
+
"showSettings": {},
|
|
789
|
+
"showTutorial": {},
|
|
790
|
+
"showMarkEdgeTutorial": {},
|
|
791
|
+
"showAdditionalToolsTutorial": {},
|
|
792
|
+
"additionalToolsTutorialShown": {},
|
|
793
|
+
"showObstacleTutorial": {},
|
|
794
|
+
"obstacleTutorialShown": {},
|
|
795
|
+
"firstPolygonClosed": {},
|
|
796
|
+
"zoom": {},
|
|
797
|
+
"loadingState": {},
|
|
798
|
+
"rgbTiff": {},
|
|
799
|
+
"currentTool": {},
|
|
800
|
+
"buildingInsights": {},
|
|
801
|
+
"pixelInMeters": {},
|
|
802
|
+
"interaction": {},
|
|
803
|
+
"currentPolygon": {},
|
|
804
|
+
"solarSystem": {},
|
|
805
|
+
"showToast": {},
|
|
806
|
+
"toastMessage": {},
|
|
807
|
+
"toastType": {}
|
|
808
|
+
};
|
|
809
|
+
}
|
|
810
|
+
static get elementRef() { return "el"; }
|
|
811
|
+
static get watchers() {
|
|
812
|
+
return [{
|
|
813
|
+
"propName": "rgbTiff",
|
|
814
|
+
"methodName": "setupCanvasManager"
|
|
815
|
+
}, {
|
|
816
|
+
"propName": "rgbTiff",
|
|
817
|
+
"methodName": "drawMap"
|
|
818
|
+
}, {
|
|
819
|
+
"propName": "canvasElement",
|
|
820
|
+
"methodName": "drawMap"
|
|
821
|
+
}];
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
//# sourceMappingURL=map-draw.js.map
|