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