@m4l/components 0.2.32 → 0.2.34
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/@types/export.d.ts +441 -413
- package/{commonjs.333e55c7.js → commonjs.565e6834.js} +0 -5
- package/components/AccountPopover/{index.69cda48b.js → index.39efc8f0.js} +1 -1
- package/components/AppBar/{index.0cc0bd40.js → index.c8850b99.js} +2 -2
- package/components/CommonActions/components/ActionCancel/{index.f00f026d.js → index.416cbf9b.js} +2 -2
- package/components/CommonActions/components/ActionFormCancel/{index.08fe4e27.js → index.78267f7c.js} +4 -4
- package/components/CommonActions/components/ActionFormIntro/{index.b5a5c4b4.js → index.dcb4d280.js} +2 -2
- package/components/CommonActions/components/ActionIntro/{index.574967a0.js → index.094290fd.js} +2 -2
- package/components/CommonActions/components/Actions/{index.23bfc86b.js → index.fa7ab18c.js} +1 -8
- package/components/DataGrid/assets/icons/datagrid.svg +4 -4
- package/components/DataGrid/formatters/ColumnBooleanFormatter/{index.cf410875.js → index.cd6e553a.js} +1 -1
- package/components/DataGrid/formatters/ColumnConcatenatedValueFormatter/{index.00f9ed87.js → index.0c439ac3.js} +1 -1
- package/components/DataGrid/formatters/ColumnInteractiveCheckFormatter/{index.4089f91b.js → index.867b8745.js} +1 -1
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/{index.eb406256.js → index.0b23ba88.js} +6 -0
- package/components/DataGrid/formatters/ColumnSetCheckFormatter/types.d.ts +1 -0
- package/components/DataGrid/{index.c283b50b.js → index.abe0f9b9.js} +43 -41
- package/components/DataGrid/subcomponents/Actions/{index.d945647f.js → index.4f2071ee.js} +12 -11
- package/components/DragResizeWindow/DragResizeWindow.d.ts +15 -9
- package/components/DragResizeWindow/classes/types.d.ts +1 -0
- package/components/DragResizeWindow/{index.82cf6408.js → index.13ef022e.js} +108 -63
- package/components/DragResizeWindow/types.d.ts +23 -1
- package/components/DynamicFilter/DynamicFilter.d.ts +2 -2
- package/components/DynamicFilter/classes/index.d.ts +1 -1
- package/components/DynamicFilter/classes/types.d.ts +1 -0
- package/components/DynamicFilter/constants.d.ts +2 -1
- package/components/DynamicFilter/contexts/DynamicFilterContext/helpers.d.ts +2 -3
- package/components/DynamicFilter/contexts/DynamicFilterContext/store.d.ts +3 -2
- package/components/DynamicFilter/dictionary.d.ts +4 -0
- package/components/DynamicFilter/{index.75c66024.js → index.c52a8e96.js} +189 -35
- package/components/DynamicFilter/subcomponents/fieldstypes/SelectFilter/helpers.d.ts +51 -0
- package/components/DynamicFilter/subcomponents/fieldstypes/SelectFilter/index.d.ts +5 -0
- package/components/DynamicFilter/subcomponents/fieldstypes/factory.d.ts +12 -4
- package/components/DynamicFilter/subcomponents/fieldstypes/validations.d.ts +8 -1
- package/components/DynamicFilter/types.d.ts +40 -19
- package/components/FieldLabel/{index.75e89ace.js → index.0412576c.js} +2 -2
- package/components/GridLayout/{index.00740f82.js → index.65470f01.js} +2 -2
- package/components/GridLayout/subcomponents/Griditem/{index.3d479abb.js → index.30016fc1.js} +3 -3
- package/components/GridLayout/subcomponents/Responsive/{index.733e8ba6.js → index.5b3e0521.js} +1 -1
- package/components/GridLayout/subcomponents/SizeProvider/{index.247cc027.js → index.0328ad0a.js} +1 -1
- package/components/Icon/{index.14670a00.js → index.ad330e78.js} +65 -89
- package/components/Image/{index.6aa1ae49.js → index.b799c514.js} +2 -2
- package/components/LanguagePopover/{index.4149a8da.js → index.93c48ec5.js} +2 -2
- package/components/LinearProgressIndeterminate/{index.6e5db737.js → index.c46da124.js} +1 -1
- package/components/LoadingError/{index.1ec78dd5.js → index.ee29dd48.js} +3 -3
- package/components/MFLoader/{index.6037f834.js → index.3a37407c.js} +1 -1
- package/components/ModalDialog/{index.f27b7c2d.js → index.78c9650a.js} +4 -4
- package/components/NoItemSelected/{index.54023226.js → index.3a479c64.js} +1 -1
- package/components/ObjectLogs/{index.32ddae31.js → index.1d85a021.js} +6 -6
- package/components/PDFViewer/{index.d185afd0.js → index.88c6ff6a.js} +1 -1
- package/components/Page/{index.2c550c91.js → index.5d34dc4d.js} +1 -1
- package/components/PaperForm/{index.63dc4b29.js → index.d08b43f6.js} +1 -1
- package/components/Period/{index.ddf8716c.js → index.3f89d8a4.js} +2 -2
- package/components/PrintingSystem/{index.bcef9a6f.js → index.27f1f209.js} +13 -13
- package/components/PrintingSystem/subcomponents/BodyNode/{index.14ecdd97.js → index.319a3bb9.js} +1 -1
- package/components/PrintingSystem/subcomponents/ChartNode/{index.aa2b8706.js → index.990e164c.js} +1 -1
- package/components/PrintingSystem/subcomponents/DividerNode/{index.ce81726b.js → index.e504dbd2.js} +1 -1
- package/components/PrintingSystem/subcomponents/FooterNode/{index.7fc8c316.js → index.9a19a7cb.js} +1 -1
- package/components/PrintingSystem/subcomponents/GridNode/{index.88fcc856.js → index.8d14e1b6.js} +1 -1
- package/components/PrintingSystem/subcomponents/HeaderNode/{index.d3f4e000.js → index.89e4eaab.js} +1 -1
- package/components/PrintingSystem/subcomponents/PaperNode/{index.30cbab70.js → index.dd4ca449.js} +1 -1
- package/components/PrintingSystem/subcomponents/PropertyValueNode/{index.05a3579e.js → index.048d7ebf.js} +1 -1
- package/components/PrintingSystem/subcomponents/SectionNode/{index.d6344807.js → index.83f1efea.js} +1 -1
- package/components/PrintingSystem/subcomponents/TextBoxNode/{index.79d2e283.js → index.5427cb75.js} +1 -1
- package/components/PropertyValue/{index.1dbf6ef8.js → index.15c61a4b.js} +2 -2
- package/components/Resizeable/{index.eba4fda9.js → index.cb5aad75.js} +1 -1
- package/components/SideBar/{index.b1455bd0.js → index.b0359a2b.js} +4 -4
- package/components/SplitLayout/{index.3856385c.js → index.7302ceb3.js} +1 -1
- package/components/ToastContainer/{index.a33ebb52.js → index.4d44ce53.js} +4 -4
- package/components/areas/components/AreasAdmin/{index.922cdb11.js → index.820a00ab.js} +10 -10
- package/components/areas/components/AreasViewer/{index.f7126815.js → index.6d7194e2.js} +14 -14
- package/components/areas/contexts/AreasContext/{index.37be3e4e.js → index.c5a3b322.js} +4 -4
- package/components/areas/hooks/useAreas/{index.e3971ffa.js → index.caa92660.js} +1 -1
- package/components/areas/types.d.ts +1 -1
- package/components/commercial/AppBarCommercial/{index.3e0ad6ef.js → index.9cf586a2.js} +1 -1
- package/components/commercial/SectionCommercial/index.4dbfc0a7.js +48 -0
- package/components/commercial/TopBar/{index.7b22d97b.js → index.93a7d26a.js} +4 -4
- package/components/{HamburgerMenu/index.fb1a3aae.js → commercial/index.89ad149c.js} +2 -2
- package/components/formatters/BooleanFormatter/{index.fb44d69d.js → index.9ccf9298.js} +2 -2
- package/components/formatters/{index.05c4e1a4.js → index.03471e3f.js} +1 -1
- package/components/hook-form/HelperError/index.66bbcac3.js +30 -0
- package/components/hook-form/RHFAutocomplete/classes/index.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/classes/types.d.ts +2 -1
- package/components/hook-form/RHFAutocomplete/{index.3592430b.js → index.1f2afb6b.js} +75 -42
- package/components/hook-form/RHFAutocomplete/types.d.ts +4 -2
- package/components/hook-form/RHFAutocompleteAsync/{index.dfbaece5.js → index.bc278965.js} +1 -1
- package/components/hook-form/RHFCheckbox/{index.251a36b5.js → index.eca64469.js} +2 -2
- package/components/hook-form/RHFColorPicker/{index.e7d27ca0.js → index.dc13d5a3.js} +6 -8
- package/components/hook-form/RHFDateTime/{index.fc474c35.js → index.e554b068.js} +3 -3
- package/components/hook-form/RHFHelperError/index.d.ts +4 -0
- package/components/hook-form/RHFPeriod/{index.2bf650c4.js → index.e4e4530f.js} +3 -3
- package/components/hook-form/RHFTextField/{index.db56e769.js → index.1bfa601f.js} +4 -4
- package/components/hook-form/RHFUpload/{index.9d4d4460.js → index.6e98b291.js} +4 -4
- package/components/index.d.ts +2 -0
- package/components/maps/components/GpsTools/GpsTools.d.ts +1 -0
- package/components/maps/components/GpsTools/classes/index.d.ts +4 -0
- package/components/maps/components/GpsTools/classes/types.d.ts +13 -0
- package/components/maps/components/GpsTools/constants.d.ts +8 -0
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/index.d.ts +19 -0
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/store.d.ts +16 -0
- package/components/maps/components/GpsTools/contexts/GpsToolsContext/types.d.ts +165 -0
- package/components/maps/components/GpsTools/hooks/useGpsToolsStore/index.d.ts +2 -0
- package/components/maps/components/GpsTools/hooks/useLayers/index.d.ts +1 -0
- package/components/maps/components/GpsTools/icons.d.ts +15 -0
- package/components/maps/components/GpsTools/index.d.ts +3 -0
- package/components/maps/components/GpsTools/index.d93188ad.js +1792 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/index.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/constants.d.ts +20 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/helpers.d.ts +19 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useDrawing.d.ts +11 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useSubmit.d.ts +8 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useSumbitErrorsFocus.d.ts +5 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/hooks/useValidation.d.ts +22 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/index.d.ts +2 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/types.d.ts +6 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/ConfigData/validations.d.ts +5 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/types.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/GeneralData/validations.d.ts +6 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/index.d.ts +2 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyActions/types.d.ts +2 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/MyTabs/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/FillData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/subcomponents/StrokeData/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/subcomponents/StyleData/types.d.ts +10 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofenceAddEdit/types.d.ts +27 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useCheckedFeatures.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useCheckedGeofences.d.ts +4 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useColumns.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useMaster.d.ts +20 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/hooks/useRowActionsGetter.d.ts +9 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/index.d.ts +1 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/GeofencesList/subcomponents/Filter/index.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/constants.d.ts +7 -0
- package/components/maps/components/GpsTools/subcomponents/TabsGpsTools/subcomponents/model.d.ts +122 -0
- package/components/maps/components/GpsTools/types.d.ts +34 -0
- package/components/maps/components/Map/Map.d.ts +9 -0
- package/components/maps/components/Map/classes/index.d.ts +5 -0
- package/components/maps/components/Map/classes/types.d.ts +69 -0
- package/components/maps/components/Map/constants.d.ts +24 -0
- package/components/maps/components/Map/contexts/MapContext/MapContext.d.ts +19 -0
- package/components/maps/components/Map/contexts/MapContext/helper.d.ts +8 -0
- package/components/maps/components/Map/contexts/MapContext/index.d.ts +2 -0
- package/components/maps/components/Map/contexts/MapContext/store.d.ts +16 -0
- package/components/maps/components/Map/contexts/MapContext/types.d.ts +592 -0
- package/components/maps/components/Map/dictionary.d.ts +86 -0
- package/components/maps/components/Map/external/Control/index.d.ts +11 -0
- package/components/maps/components/Map/external/Control/types.d.ts +8 -0
- package/components/maps/components/Map/external/googleMutant/index.d.ts +94 -0
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/index.d.ts +8 -0
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/FeatureDivIconLabel/index.d.ts +3 -0
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/FeatureDivIconLabel/types.d.ts +7 -0
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/MarkerIconLabel/index.d.ts +2 -0
- package/components/maps/components/Map/featureRenders/CommonFeatureRender/subcomponents/MarkerIconLabel/types.d.ts +6 -0
- package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarker.d.ts +6 -0
- package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarkerGrua.d.ts +1 -0
- package/components/maps/components/Map/featureRenders/MarkerFeatureRender/IconMarkerTaxi.d.ts +1 -0
- package/components/maps/components/Map/featureRenders/MarkerFeatureRender/index.d.ts +2 -0
- package/components/maps/components/Map/featureRenders/index.d.ts +2 -0
- package/components/maps/components/Map/hooks/useAutoFocus/index.d.ts +8 -0
- package/components/maps/components/Map/hooks/useAutoFocus/types.d.ts +15 -0
- package/components/maps/components/Map/hooks/useDisableZoomEvents/index.d.ts +6 -0
- package/components/maps/components/Map/hooks/useMapStore/index.d.ts +3 -0
- package/components/maps/components/Map/icons.d.ts +50 -0
- package/components/maps/components/Map/index.accb1f77.js +2386 -0
- package/components/maps/components/Map/index.d.ts +7 -0
- package/components/maps/components/Map/pluginLayers/PolylineWithArrows/index.d.ts +9 -0
- package/components/maps/components/Map/pluginLayers/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/index.d.ts +17 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/index.d.ts +7 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useCheckedLayers.d.ts +9 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useColumns.d.ts +15 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useMaster.d.ts +13 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/hooks/useRowActionsGetter.d.ts +5 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/LayersTool/model.d.ts +27 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/bing.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/google.d.ts +4 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/osm.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/subcomponentes/MapSourcesTool/sourceTypes/utils.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopLeftTools/subcomponents/PopoverToolButton/types.d.ts +4 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/index.d.ts +12 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/constants.d.ts +30 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/helpers.d.ts +11 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/index.d.ts +13 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useMeasure/types.d.ts +13 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/hooks/useValidation.d.ts +10 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/index.d.ts +5 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/types.d.ts +6 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MeasureData/validations.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/subcomponents/MyActions/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/MeasureTool/types.d.ts +9 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/subcomponents/ZoomButtons/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/Controls/subcomponents/TopRigthTools/types.d.ts +4 -0
- package/components/maps/components/Map/subcomponents/Controls/types.d.ts +22 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/index.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/index.d.ts +17 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/index.d.ts +20 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/MarkerClusterGroup/types.d.ts +11 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/RenderByEachFeatureComponent/index.d.ts +12 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/subcomponents/RenderByEachFeatureComponent/types.d.ts +5 -0
- package/components/maps/components/Map/subcomponents/LayersContainer/subcomponents/MyLayer/types.d.ts +2 -0
- package/components/maps/components/Map/subcomponents/TileLayers/index.d.ts +6 -0
- package/components/maps/components/Map/subcomponents/TileLayers/subcomponents/TileLayerGoogle/index.d.ts +1 -0
- package/components/maps/components/Map/subcomponents/TileLayers/subcomponents/TileLayerOthers/index.d.ts +6 -0
- package/components/maps/components/Map/types.d.ts +40 -0
- package/components/maps/index.34ab6a68.js +7 -0
- package/components/maps/index.d.ts +3 -0
- package/components/maps/leaflet-geoman.d.ts +1633 -1633
- package/components/maps/utils.d.ts +15 -0
- package/components/modal/{WindowBase.2e5506d7.js → WindowBase.fd86f575.js} +3 -3
- package/components/modal/{WindowConfirm.ce47a48a.js → WindowConfirm.ee6de236.js} +6 -6
- package/components/mui_extended/Accordion/{index.f9042228.js → index.7dcdfd3a.js} +2 -2
- package/components/mui_extended/Button/{index.d5a031be.js → index.c3084916.js} +1 -1
- package/components/mui_extended/{CheckBox.0dcf39ae.js → CheckBox.2a3b86c5.js} +1 -1
- package/components/mui_extended/IconButton/{index.d8bdadaa.js → index.f8a3021b.js} +1 -1
- package/components/mui_extended/MenuActions/{index.154d57f0.js → index.90f53670.js} +2 -2
- package/components/mui_extended/Pager/{index.da7ea851.js → index.ea2a4f3e.js} +2 -2
- package/components/mui_extended/Tab/{index.2068925d.js → index.9214d9cc.js} +4 -4
- package/components/mui_extended/TabContent/types.d.ts +1 -1
- package/components/mui_extended/ToggleButton/ToggleButton.d.ts +2 -1
- package/components/mui_extended/ToggleButton/{index.595ea955.js → index.191711f3.js} +6 -9
- package/components/mui_extended/ToggleButton/types.d.ts +2 -2
- package/components/mui_extended/ToggleIconButton/ToggleIconButton.d.ts +1 -12
- package/components/mui_extended/ToggleIconButton/index.d9dbf650.js +19 -0
- package/components/mui_extended/ToggleIconButton/types.d.ts +2 -3
- package/components/popups/PopupsProvider/index.d7409f48.js +179 -0
- package/components/popups/PopupsViewer/index.1500ce72.js +186 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.d.ts +19 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/helper.d.ts +7 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/index.d.ts +1 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/store.d.ts +16 -0
- package/components/popups/components/PopupsProvider/contexts/PopupsContext/types.d.ts +160 -0
- package/components/popups/components/PopupsProvider/hooks/usePopupsStore/index.d.ts +3 -0
- package/components/popups/components/PopupsProvider/index.d.ts +2 -0
- package/components/popups/components/PopupsViewer/PopupsViewer.d.ts +8 -0
- package/components/popups/components/PopupsViewer/classes/index.d.ts +15 -0
- package/components/popups/components/PopupsViewer/classes/types.d.ts +13 -0
- package/components/{PopupsProvider → popups/components/PopupsViewer}/constants.d.ts +2 -2
- package/components/popups/components/PopupsViewer/icons.d.ts +3 -0
- package/components/popups/components/PopupsViewer/index.d.ts +1 -0
- package/components/popups/components/PopupsViewer/subcomponents/Popup/index.d.ts +9 -0
- package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/index.d.ts +2 -0
- package/components/popups/components/PopupsViewer/subcomponents/Popup/subcomponents/Header/types.d.ts +2 -0
- package/components/popups/components/PopupsViewer/subcomponents/Popup/types.d.ts +16 -0
- package/components/popups/components/PopupsViewer/types.d.ts +3 -0
- package/components/popups/index.c5eae682.js +1 -0
- package/components/popups/index.d.ts +2 -0
- package/contexts/ModalContext/{index.3d48d675.js → index.2368bb19.js} +1 -1
- package/hocs/withToggle/index.50aec5e4.js +22 -0
- package/hocs/withToggle/index.d.ts +2 -2
- package/hocs/withToggle/types.d.ts +6 -4
- package/hooks/useFormAddEdit/{index.07e5258d.js → index.000ce60b.js} +2 -2
- package/hooks/useFormReadyForUpdate/index.d.ts +6 -0
- package/hooks/useFormReadyForUpdate/index.f60f500e.js +20 -0
- package/hooks/useModal/{index.cb1d6a37.js → index.f73d7e42.js} +1 -1
- package/hooks/useSizeContainer/contants.d.ts +1 -0
- package/hooks/useSizeContainer/index.62b4e0c4.js +35 -0
- package/hooks/useSizeContainer/index.d.ts +8 -0
- package/hooks/useStateRef/index.538edb89.js +15 -0
- package/hooks/useStateRef/index.d.ts +8 -0
- package/hooks/useTab/{index.c0564138.js → index.976d5e1e.js} +1 -1
- package/index.js +157 -115
- package/package.json +11 -5
- package/{react-draggable.6cf19cba.js → react-draggable.e4725f3a.js} +4 -4
- package/{react-json-view.5636414a.js → react-json-view.57125fcf.js} +1 -1
- package/{react-resizable.0ebffd82.js → react-resizable.c07d63fb.js} +5 -5
- package/{react-splitter-layout.c5d98bf7.js → react-splitter-layout.8b1655c8.js} +3 -3
- package/vite-env.d.ts +3 -3
- package/components/PopupsProvider/index.3d5ad0ee.js +0 -4
- package/components/mui_extended/ToggleIconButton/index.c588d5e1.js +0 -29
- package/hocs/withToggle/index.e44eb0da.js +0 -24
- package/node_modules.98455a76.js +0 -6921
- package/vendor.55925cb3.js +0 -182
- /package/utils/{index.24b5284a.js → index.6469f148.js} +0 -0
|
@@ -0,0 +1,2386 @@
|
|
|
1
|
+
import { useMap, LayerGroup, MapContainer, Marker, Polyline, Circle, Polygon } from "react-leaflet";
|
|
2
|
+
import { shallow } from "zustand/shallow";
|
|
3
|
+
import React__default, { createContext, useRef, useEffect, useContext, useMemo, useState, useCallback } from "react";
|
|
4
|
+
import * as L from "leaflet";
|
|
5
|
+
import L__default from "leaflet";
|
|
6
|
+
import { Loader } from "@googlemaps/js-api-loader";
|
|
7
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
8
|
+
import { createPortal } from "react-dom";
|
|
9
|
+
import { useModuleDictionary, useModuleSkeleton, useEnvironment, useModulePrivileges } from "@m4l/core";
|
|
10
|
+
import clsx from "clsx";
|
|
11
|
+
import { useFormContext, useWatch } from "react-hook-form";
|
|
12
|
+
import { A as Actions } from "../../../CommonActions/components/Actions/index.fa7ab18c.js";
|
|
13
|
+
import { B as Button } from "../../../mui_extended/Button/index.c3084916.js";
|
|
14
|
+
import * as Yup from "yup";
|
|
15
|
+
import { u as useFormReadyForUpdate } from "../../../../hooks/useFormReadyForUpdate/index.f60f500e.js";
|
|
16
|
+
import { R as RHFAutocompleteAsync } from "../../../hook-form/RHFAutocompleteAsync/index.bc278965.js";
|
|
17
|
+
import { S as Stack } from "../../../mui_extended/Stack/index.0e53197c.js";
|
|
18
|
+
import { R as RHFormProvider } from "../../../../contexts/RHFormContext/index.7b2a8723.js";
|
|
19
|
+
import { I as IconButton } from "../../../mui_extended/IconButton/index.f8a3021b.js";
|
|
20
|
+
import { u as usePopupsStore, P as PopupsProvider } from "../../../popups/PopupsProvider/index.d7409f48.js";
|
|
21
|
+
import { T as ToggleIconButton } from "../../../mui_extended/ToggleIconButton/index.d9dbf650.js";
|
|
22
|
+
import { c as DataGrid } from "../../../DataGrid/index.abe0f9b9.js";
|
|
23
|
+
import { generateUtilityClasses, Tooltip, FormControl, RadioGroup, FormControlLabel, Radio, useTheme } from "@mui/material";
|
|
24
|
+
import { C as ColumnSetCheckFormatter } from "../../../DataGrid/formatters/ColumnSetCheckFormatter/index.0b23ba88.js";
|
|
25
|
+
import { I as Icon, M as MarkerIconLabel } from "../../../Icon/index.ad330e78.js";
|
|
26
|
+
import { u as useStateRef } from "../../../../hooks/useStateRef/index.538edb89.js";
|
|
27
|
+
import { C as CheckBox } from "../../../mui_extended/CheckBox.2a3b86c5.js";
|
|
28
|
+
import { P as Popover } from "../../../mui_extended/Popover/index.d85de73b.js";
|
|
29
|
+
import { P as PopupsViewer } from "../../../popups/PopupsViewer/index.1500ce72.js";
|
|
30
|
+
import { createPathComponent } from "@react-leaflet/core";
|
|
31
|
+
import "leaflet.markercluster";
|
|
32
|
+
import { cloneDeep, throttle } from "lodash";
|
|
33
|
+
import { styled } from "@mui/material/styles";
|
|
34
|
+
import leaflet_css from "leaflet/dist/leaflet.css?used";
|
|
35
|
+
import { createStore, useStore } from "zustand";
|
|
36
|
+
import { useResponsiveDesktop, useFirstRender } from "@m4l/graphics";
|
|
37
|
+
import { devtools } from "zustand/middleware";
|
|
38
|
+
import { immer } from "zustand/middleware/immer";
|
|
39
|
+
import { unstable_composeClasses } from "@mui/base";
|
|
40
|
+
import { g as getComponentUtilityClass } from "../../../../utils/index.6469f148.js";
|
|
41
|
+
import { b as bearingRawToCSS } from "../../index.34ab6a68.js";
|
|
42
|
+
import "leaflet-polylinedecorator";
|
|
43
|
+
const COMPONENT_CLASS_NAME = "M4LMap";
|
|
44
|
+
const MAP_ZINDEX_DEFAULT = 0;
|
|
45
|
+
const MAP_ZINDEX_OVER_MAP = 1100;
|
|
46
|
+
const TIME_DOUBLE_CLICK = 250;
|
|
47
|
+
const MARKER_COLOR_DEFAULT = "#1E96DC";
|
|
48
|
+
const LABEL_BK_COLOR_DEFAULT = "#1E96DC";
|
|
49
|
+
const LABEL_COLOR_DEFAULT = "#FFFFFF";
|
|
50
|
+
const GPS_TOOLS_POPUP_DEFAULT_POSITION = {
|
|
51
|
+
vertical: { top: 50, bottom: 50 },
|
|
52
|
+
horizontal: { right: 50, width: 380 }
|
|
53
|
+
};
|
|
54
|
+
const MESURE_POPUP_DEFAULT_POSITION = {
|
|
55
|
+
vertical: { top: 50, height: 250 },
|
|
56
|
+
horizontal: { right: 50, width: 300 }
|
|
57
|
+
};
|
|
58
|
+
const SVG_ICON_DEFAULT = `<svg viewBox="0 0 640 640" height="32" width="32" xmlns="http://www.w3.org/2000/svg">
|
|
59
|
+
<g>
|
|
60
|
+
<circle
|
|
61
|
+
cx="320"
|
|
62
|
+
cy="320"
|
|
63
|
+
r="280"
|
|
64
|
+
fill="#1E96DC"
|
|
65
|
+
/>
|
|
66
|
+
<text
|
|
67
|
+
x="320"
|
|
68
|
+
y="320"
|
|
69
|
+
font-size="320"
|
|
70
|
+
font-family="sans-serif"
|
|
71
|
+
fill="#FFFFFF"
|
|
72
|
+
text-anchor="middle"
|
|
73
|
+
alignment-baseline="central"
|
|
74
|
+
dominant-baseline="central"
|
|
75
|
+
>P</text>
|
|
76
|
+
</g>
|
|
77
|
+
</svg>`;
|
|
78
|
+
const updateOwnerStateClasses = (state) => {
|
|
79
|
+
};
|
|
80
|
+
const mapClasses = generateUtilityClasses(COMPONENT_CLASS_NAME, [
|
|
81
|
+
"root",
|
|
82
|
+
"topLeftToolsRoot",
|
|
83
|
+
"topRigthToolsRoot",
|
|
84
|
+
"zoomButtons",
|
|
85
|
+
"markerLayerRoot",
|
|
86
|
+
"markerLayerIcon",
|
|
87
|
+
"markerLayerLabel",
|
|
88
|
+
"markerLayerLabelInner",
|
|
89
|
+
"featureLabel",
|
|
90
|
+
"meaureToolRoot",
|
|
91
|
+
"measureToolFormValue",
|
|
92
|
+
"measureToolFormValueDistance",
|
|
93
|
+
"measureToolFormValueSymbol",
|
|
94
|
+
"measureToolLabel",
|
|
95
|
+
"meausureToolLabelDistance",
|
|
96
|
+
"meausureToolLabelSymbol",
|
|
97
|
+
"measureMarkerRoot",
|
|
98
|
+
"measureMarkerContainer",
|
|
99
|
+
"measureMarkerContainerRhomb",
|
|
100
|
+
"measureMarkerContainerSlot",
|
|
101
|
+
"measureMarkerContainerSlotNumber",
|
|
102
|
+
"measureLabelMarkerRoot",
|
|
103
|
+
"measureLabelMarkerContainer",
|
|
104
|
+
"measureLabelMarkerDistance",
|
|
105
|
+
"measureLabelMarkerRemove",
|
|
106
|
+
"mapSourcesPopoverRoot",
|
|
107
|
+
"mapSourcesRoot",
|
|
108
|
+
"mapSourcesOption",
|
|
109
|
+
"mapSourcesOptionIconLabel",
|
|
110
|
+
"mapSourcesOptionRoadOptions",
|
|
111
|
+
"mapSourcesOptionRoadOptionsCheck",
|
|
112
|
+
"layersPopoverRoot",
|
|
113
|
+
"active",
|
|
114
|
+
"disabled"
|
|
115
|
+
]);
|
|
116
|
+
const useMapUtilityClasses = (_ownerState) => {
|
|
117
|
+
const slots = {
|
|
118
|
+
root: ["root"],
|
|
119
|
+
topLeftToolsRoot: ["topLeftToolsRoot"],
|
|
120
|
+
topRigthToolsRoot: ["topRigthToolsRoot"],
|
|
121
|
+
zoomButtons: ["zoomButtons"],
|
|
122
|
+
markerLayerRoot: ["markerLayerRoot"],
|
|
123
|
+
markerLayerIcon: ["markerLayerIcon"],
|
|
124
|
+
markerLayerLabel: ["markerLayerLabel"],
|
|
125
|
+
markerLayerLabelInner: ["markerLayerLabelInner"],
|
|
126
|
+
featureLabel: ["featureLabel"],
|
|
127
|
+
meaureToolRoot: ["meaureToolRoot"],
|
|
128
|
+
measureToolFormValue: ["measureToolFormValue"],
|
|
129
|
+
measureToolFormValueDistance: ["measureToolFormValueDistance"],
|
|
130
|
+
measureToolFormValueSymbol: ["measureToolFormValueSymbol"],
|
|
131
|
+
measureToolLabel: ["measureToolLabel"],
|
|
132
|
+
meausureToolLabelDistance: ["meausureToolLabelDistance"],
|
|
133
|
+
meausureToolLabelSymbol: ["meausureToolLabelSymbol"],
|
|
134
|
+
measureMarkerRoot: ["measureMarkerRoot"],
|
|
135
|
+
measureMarkerContainer: ["measureMarkerContainer"],
|
|
136
|
+
measureMarkerContainerRhomb: ["measureMarkerContainerRhomb"],
|
|
137
|
+
measureMarkerContainerSlot: ["measureMarkerContainerSlot"],
|
|
138
|
+
measureMarkerContainerSlotNumber: ["measureMarkerContainerSlotNumber"],
|
|
139
|
+
measureLabelMarkerRoot: ["measureLabelMarkerRoot"],
|
|
140
|
+
measureLabelMarkerContainer: ["measureLabelMarkerContainer"],
|
|
141
|
+
measureLabelMarkerDistance: ["measureLabelMarkerDistance"],
|
|
142
|
+
measureLabelMarkerRemove: ["measureLabelMarkerRemove"],
|
|
143
|
+
mapSourcesPopoverRoot: ["mapSourcesPopoverRoot"],
|
|
144
|
+
mapSourcesRoot: ["mapSourcesToolRoot"],
|
|
145
|
+
mapSourcesOption: ["mapSourcesToolOption"],
|
|
146
|
+
mapSourcesOptionIconLabel: ["mapSourcesToolOptionIconLabel"],
|
|
147
|
+
mapSourcesOptionRoadOptions: ["mapSourcesToolOptionRoadOptions"],
|
|
148
|
+
mapSourcesOptionRoadOptionsCheck: ["mapSourcesToolOptionRoadOptionsCheck"],
|
|
149
|
+
layersPopoverRoot: ["layersPopoverRoot"],
|
|
150
|
+
active: ["active"],
|
|
151
|
+
disabled: ["disabled"]
|
|
152
|
+
};
|
|
153
|
+
return unstable_composeClasses(slots, getComponentUtilityClass(COMPONENT_CLASS_NAME), {});
|
|
154
|
+
};
|
|
155
|
+
const MAP_DICCTIONARY = {
|
|
156
|
+
LABEL_GPSTOOLS_NAME: "label_gpstools_name",
|
|
157
|
+
LABEL_TAB_GEO: "label_tab_geo",
|
|
158
|
+
TAB_GENERAL_CONFIG_TOOLTIP: "tab_general_config_tooltip",
|
|
159
|
+
PAPER_GENERAL: "paper_general",
|
|
160
|
+
LABEL_ID: "label_id",
|
|
161
|
+
LABEL_NAME: "label_name",
|
|
162
|
+
LABEL_GEOMETRY_TYPE: "label_geometry_type",
|
|
163
|
+
LABEL_GEOMETRY_CIRCLE: "label_geometry_circle",
|
|
164
|
+
LABEL_GEOMETRY_RECTANGLE: "label_geometry_rectangle",
|
|
165
|
+
LABEL_GEOMETRY_POLYGON: "label_geometry_polygon",
|
|
166
|
+
LABEL_DRAW: "label_draw",
|
|
167
|
+
LABEL_FINISH: "label_finish",
|
|
168
|
+
PAPER_CONFIG: "paper_config",
|
|
169
|
+
LABEL_ALIAS: "label_alias",
|
|
170
|
+
LABEL_CUSTOMER_ID: "label_customer_id",
|
|
171
|
+
LABEL_TIME_MIN_IN_SECONDS: "label_time_min_in_seconds",
|
|
172
|
+
LABEL_TIME_MIN_OUT_SECONDS: "label_time_min_out_seconds",
|
|
173
|
+
TAB_STYLE_CONFIG_TOOLTIP: "tab_style_tooltip",
|
|
174
|
+
PAPER_STROKE: "paper_stroke",
|
|
175
|
+
LABEL_COLOR: "label_color",
|
|
176
|
+
LABEL_OPACITY: "label_opacity",
|
|
177
|
+
LABEL_WEIGHT: "label_weight",
|
|
178
|
+
LABEL_DASH_ARRAY: "label_dash_array",
|
|
179
|
+
LABEL_DASH_OFFSET: "label_dash_offset",
|
|
180
|
+
LABEL_RADIUS: "label_radius",
|
|
181
|
+
LABEL_LAT: "label_lat",
|
|
182
|
+
LABEL_LON: "label_lon",
|
|
183
|
+
LABEL_PLACE_MARKER: "label_place_marker",
|
|
184
|
+
LABEL_FIRST_VERTEX: "label_first_vertex",
|
|
185
|
+
LABEL_CONTINUE_LINE: "label_continue_line",
|
|
186
|
+
LABEL_FINISH_LINE: "label_finish_line",
|
|
187
|
+
LABEL_FINISH_POLY: "label_finish_poly",
|
|
188
|
+
LABEL_FINISH_RECT: "label_finish_rect",
|
|
189
|
+
LABEL_START_CIRCLE: "label_start_circle",
|
|
190
|
+
LABEL_FINISH_CIRCLE: "label_finish_circle",
|
|
191
|
+
LABEL_PLACE_CIRCLE_MARKER: "label_place_circle_marker",
|
|
192
|
+
VALIDATION_GEOMETRY_REQUIRED: "validation_geometry_required",
|
|
193
|
+
VALIDATION_FIELD_REQUIRED: "validation_field_required",
|
|
194
|
+
VALIDATION_FIELD_TYPE_NUMBER_ERROR: "validation_field_type_number_error",
|
|
195
|
+
LABEL_VIEW_TRANSIT_FEATURES: "label_view_crossing_features",
|
|
196
|
+
LABEL_VIEW_INTERNAL_FEATURES: "label_view_internal_features",
|
|
197
|
+
LABEL_CREATED_AT: "label_created_at",
|
|
198
|
+
LABEL_UPDATED_AT: "label_updated_at",
|
|
199
|
+
MODAL_DELETE_GEO_TITLE: "modal_delete_geo_title",
|
|
200
|
+
MODAL_DELETE_GEO_MESSAGE: "modal_delete_geo_message",
|
|
201
|
+
MODAL_DISABLE_GEO_TITLE: "modal_disable_geo_title",
|
|
202
|
+
MODAL_DISABLE_MESSAGE: "modal_disable_geo_message",
|
|
203
|
+
ROW_ACTION_GEO_EDIT: "row_action_geo_edit",
|
|
204
|
+
ROW_ACTION_GEO_ENABLE: "row_action_geo_enable",
|
|
205
|
+
ROW_ACTION_GEO_DISABLE: "row_action_geo_disable",
|
|
206
|
+
ROW_ACTION_GEO_DELETE: "row_action_geo_delete",
|
|
207
|
+
LABEL_TAB_MEASURE: "label_tab_measure",
|
|
208
|
+
PAPER_MEASURE: "paper_measure",
|
|
209
|
+
LABEL_MEASURE_START: "label_measure_start",
|
|
210
|
+
LABEL_MEASURE_CANCEL: "label_measure_cancel",
|
|
211
|
+
LABEL_MEASURE_DISTANCE: "label_measure_distance",
|
|
212
|
+
LABEL_MEASURE_AREA: "label_measure_area",
|
|
213
|
+
LABEL_MEASURE_UNIT: "label_measure_unit",
|
|
214
|
+
LABEL_MEASURE_UNIT_BASE_KILOMETERS: "label_measure_unit_base_kilometers",
|
|
215
|
+
LABEL_MEASURE_REMOVE_POINT: "label_measure_remove_point",
|
|
216
|
+
LABEL_LAYERS: "label_layes",
|
|
217
|
+
LABEL_LAYER_NAME: "label_layer_name",
|
|
218
|
+
LABEL_LAYER_VISIBLE: "label_layer_visible",
|
|
219
|
+
LABEL_LAYER_AUTOFOCUS: "label_layer_autofocus",
|
|
220
|
+
LABEL_LAYER_CLUSTER: "label_layer_cluster",
|
|
221
|
+
LABEL_LAYER_DELETE: "label_layer_delete",
|
|
222
|
+
ROW_ACTION_LAYER_DELETE: "row_action_layer_delete",
|
|
223
|
+
LABEL_MAP_SOURCES: "label_map_sources",
|
|
224
|
+
LABEL_TILE_OSM: "label_tile_osm",
|
|
225
|
+
LABEL_TILE_GOOGLE: "label_tile_google",
|
|
226
|
+
LABEL_TILE_GOOGLE_SATELLITE: "label_tile_google_satellite",
|
|
227
|
+
LABEL_TILE_GOOGLE_HYBRID: "label_tile_google_hybrid",
|
|
228
|
+
LABEL_TILE_BING: "label_tile_bing"
|
|
229
|
+
};
|
|
230
|
+
const MAP_ICONS = {
|
|
231
|
+
MAP_ZOOM_IN: "cmp_map_zoom_in.svg",
|
|
232
|
+
MAP_ZOOM_OUT: "cmp_map_zoom_out.svg",
|
|
233
|
+
MAP_SOURCES_TOOL: "cmp_map_mapsources_tool.svg",
|
|
234
|
+
MAP_SOURCE_OSM: "cmp_map_mapsources_osm.svg",
|
|
235
|
+
MAP_SOURCE_GOOGLE_ROADS: "cmp_map_mapsources_google.svg",
|
|
236
|
+
MAP_SOURCE_GOOGLE_HYBRID: "cmp_map_mapsources_googlehybrid.svg",
|
|
237
|
+
MAP_SOURCE_GOOGLE_SATELLITE: "cmp_map_mapsources_googlesatelite.svg",
|
|
238
|
+
MAP_SOURCE_BING: "cmp_map_mapsources_ bing.svg",
|
|
239
|
+
MAP_SOURCE_ROAD_TRAFFIC: "cmp_map_mapsources_layer-traffic.svg",
|
|
240
|
+
MAP_SOURCE_ROAD_TRANSIT: "cmp_map_mapsources_layer-transit.svg",
|
|
241
|
+
MAP_SOURCE_ROAD_BICYCLING: "cmp_map_mapsources_layer-bicycle.svg",
|
|
242
|
+
MAP_LAYERS_TOOL: "cmp_map_layers_tool.svg",
|
|
243
|
+
MAP_LAYER_VISIBLE: "cmp_map_layers_view.svg",
|
|
244
|
+
MAP_LAYER_AUTOFOCUS: "cmp_map_layers_zoom_fit.svg",
|
|
245
|
+
MAP_LAYER_CLUSTER: "cmp_map_layers_cluster.svg",
|
|
246
|
+
MAP_LAYER_DELETE: "cmp_map_layers_delete.svg",
|
|
247
|
+
MAP_GPS_TOOLS_TOOL: "cmp_map_gpstools_tool.svg",
|
|
248
|
+
GEOMETRY_CIRCLE: "geometry_circle.svg",
|
|
249
|
+
GEOMETRY_RECTANGLE: "geometry_rectangle.svg",
|
|
250
|
+
GEOMETRY_POLYGON: "geometry_polygon.svg",
|
|
251
|
+
ADD: "add.svg",
|
|
252
|
+
MAP_MEASURE_TOOL: "cmp_map_measure_tool.svg",
|
|
253
|
+
GENERAL: "general.svg",
|
|
254
|
+
CONFIG: "config.svg",
|
|
255
|
+
STROKE: "stroke.svg",
|
|
256
|
+
FILL: "fill.svg",
|
|
257
|
+
EDIT: "edit.svg",
|
|
258
|
+
DELETE: "delete.svg",
|
|
259
|
+
ACTIVE: "active.svg",
|
|
260
|
+
NAME: "name.svg"
|
|
261
|
+
};
|
|
262
|
+
const TILE_LAYER_OSM = {
|
|
263
|
+
id: "osm_roadmap",
|
|
264
|
+
sourceType: "OSM",
|
|
265
|
+
iconUrl: MAP_ICONS.MAP_SOURCE_OSM,
|
|
266
|
+
mapTypeTile: "roadmap",
|
|
267
|
+
dictionaryId: MAP_DICCTIONARY.LABEL_TILE_OSM,
|
|
268
|
+
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
269
|
+
options: {
|
|
270
|
+
minZoom: 0,
|
|
271
|
+
maxZoom: 19,
|
|
272
|
+
subdomains: ["a", "b", "c"],
|
|
273
|
+
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a>',
|
|
274
|
+
tms: false
|
|
275
|
+
},
|
|
276
|
+
roadSelectedOptions: {
|
|
277
|
+
trafficLayer: false,
|
|
278
|
+
transitLayer: false,
|
|
279
|
+
bicyclingLayer: false
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const TILE_LAYER_GOOGLE = {
|
|
283
|
+
id: "google_rodmap",
|
|
284
|
+
sourceType: "Google",
|
|
285
|
+
iconUrl: MAP_ICONS.MAP_SOURCE_GOOGLE_ROADS,
|
|
286
|
+
mapTypeTile: "roadmap",
|
|
287
|
+
dictionaryId: MAP_DICCTIONARY.LABEL_TILE_GOOGLE,
|
|
288
|
+
urlTemplate: "http://{s}.google.com/vt/lyrs=m&x={x}&y={y}&z={z}&key=AIzaSyDfhTK9us4kuqPTeFIm89yB3uvk2_G5AMw",
|
|
289
|
+
hasBicyclingLayer: true,
|
|
290
|
+
hasTrafficLayer: true,
|
|
291
|
+
hasTransitLayer: true,
|
|
292
|
+
options: {
|
|
293
|
+
minZoom: 0,
|
|
294
|
+
maxZoom: 22,
|
|
295
|
+
subdomains: ["mt0", "mt1", "mt2", "mt3"],
|
|
296
|
+
attribution: "Map data \xA9 Google",
|
|
297
|
+
tms: false
|
|
298
|
+
},
|
|
299
|
+
roadSelectedOptions: {
|
|
300
|
+
trafficLayer: false,
|
|
301
|
+
transitLayer: false,
|
|
302
|
+
bicyclingLayer: false
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
const TILE_LAYER_GOOGLE_SATELLITE = {
|
|
306
|
+
id: "google_satellite",
|
|
307
|
+
sourceType: "Google",
|
|
308
|
+
iconUrl: MAP_ICONS.MAP_SOURCE_GOOGLE_SATELLITE,
|
|
309
|
+
mapTypeTile: "satellite",
|
|
310
|
+
dictionaryId: MAP_DICCTIONARY.LABEL_TILE_GOOGLE_SATELLITE,
|
|
311
|
+
urlTemplate: "http://{s}.google.com/vt/lyrs=s&x={x}&y={y}&z={z}&key=AIzaSyDfhTK9us4kuqPTeFIm89yB3uvk2_G5AMw",
|
|
312
|
+
options: {
|
|
313
|
+
minZoom: 0,
|
|
314
|
+
maxZoom: 22,
|
|
315
|
+
subdomains: ["mt0", "mt1", "mt2", "mt3"],
|
|
316
|
+
attribution: "Map data \xA9 Google",
|
|
317
|
+
tms: false
|
|
318
|
+
},
|
|
319
|
+
roadSelectedOptions: {
|
|
320
|
+
trafficLayer: false,
|
|
321
|
+
transitLayer: false,
|
|
322
|
+
bicyclingLayer: false
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const TILE_LAYER_GOOGLE_HYBRID = {
|
|
326
|
+
id: "google_hybrid",
|
|
327
|
+
sourceType: "Google",
|
|
328
|
+
iconUrl: MAP_ICONS.MAP_SOURCE_GOOGLE_HYBRID,
|
|
329
|
+
mapTypeTile: "hybrid",
|
|
330
|
+
dictionaryId: MAP_DICCTIONARY.LABEL_TILE_GOOGLE_HYBRID,
|
|
331
|
+
urlTemplate: "http://{s}.google.com/vt/lyrs=y&x={x}&y={y}&z={z}&key=AIzaSyDfhTK9us4kuqPTeFIm89yB3uvk2_G5AMw",
|
|
332
|
+
hasBicyclingLayer: true,
|
|
333
|
+
hasTrafficLayer: true,
|
|
334
|
+
hasTransitLayer: true,
|
|
335
|
+
options: {
|
|
336
|
+
minZoom: 0,
|
|
337
|
+
maxZoom: 22,
|
|
338
|
+
subdomains: ["mt0", "mt1", "mt2", "mt3"],
|
|
339
|
+
attribution: "Map data \xA9 Google",
|
|
340
|
+
tms: false
|
|
341
|
+
},
|
|
342
|
+
roadSelectedOptions: {
|
|
343
|
+
trafficLayer: false,
|
|
344
|
+
transitLayer: false,
|
|
345
|
+
bicyclingLayer: false
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
function toQuadKey(x, y, z) {
|
|
349
|
+
let quadKey = "";
|
|
350
|
+
for (let i = z; i > 0; i--) {
|
|
351
|
+
let digit = 0;
|
|
352
|
+
let mask = 1 << i - 1;
|
|
353
|
+
if ((x & mask) !== 0) {
|
|
354
|
+
digit++;
|
|
355
|
+
}
|
|
356
|
+
if ((y & mask) !== 0) {
|
|
357
|
+
digit++;
|
|
358
|
+
digit++;
|
|
359
|
+
}
|
|
360
|
+
quadKey += digit.toString();
|
|
361
|
+
}
|
|
362
|
+
return quadKey;
|
|
363
|
+
}
|
|
364
|
+
const BING_URL_TEMPLATE = "https://{s}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/|QK|?mkt=en-us&it=G,VE,BX,L,LA&shading=hill&og=22&n=z";
|
|
365
|
+
const BING_SUB_DOMAINS = ["t2", "t3"];
|
|
366
|
+
const TILE_LAYER_BING = {
|
|
367
|
+
id: "bing_rodmap",
|
|
368
|
+
sourceType: "Bing",
|
|
369
|
+
mapTypeTile: "roadmap",
|
|
370
|
+
dictionaryId: MAP_DICCTIONARY.LABEL_TILE_BING,
|
|
371
|
+
iconUrl: MAP_ICONS.MAP_SOURCE_BING,
|
|
372
|
+
urlTemplate: BING_URL_TEMPLATE,
|
|
373
|
+
options: {
|
|
374
|
+
minZoom: 0,
|
|
375
|
+
maxZoom: 21,
|
|
376
|
+
subdomains: BING_SUB_DOMAINS,
|
|
377
|
+
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a>',
|
|
378
|
+
tms: true
|
|
379
|
+
},
|
|
380
|
+
roadSelectedOptions: {
|
|
381
|
+
trafficLayer: false,
|
|
382
|
+
transitLayer: false,
|
|
383
|
+
bicyclingLayer: false
|
|
384
|
+
},
|
|
385
|
+
getTileUrl: (tileCoord) => {
|
|
386
|
+
const i = Math.abs(tileCoord.x + tileCoord.y) % BING_SUB_DOMAINS.length;
|
|
387
|
+
const z = tileCoord.z;
|
|
388
|
+
const x = tileCoord.x;
|
|
389
|
+
const y = tileCoord.y;
|
|
390
|
+
const gk = toQuadKey(x, y, z);
|
|
391
|
+
return BING_URL_TEMPLATE.replace("|QK|", gk).replace("{s}", BING_SUB_DOMAINS[i]);
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
const createMapStore = (initProps) => {
|
|
395
|
+
const startProps = {
|
|
396
|
+
classes: useMapUtilityClasses(initProps.ownerState),
|
|
397
|
+
visibleCheckedLayers: /* @__PURE__ */ new Set(),
|
|
398
|
+
autoFocusCheckedLayers: /* @__PURE__ */ new Set(),
|
|
399
|
+
clusterCheckedLayers: /* @__PURE__ */ new Set(),
|
|
400
|
+
currentMapSourceId: "",
|
|
401
|
+
hashMapSources: {},
|
|
402
|
+
mapSourcesIds: [],
|
|
403
|
+
layersIds: [],
|
|
404
|
+
hashLayers: {},
|
|
405
|
+
...initProps
|
|
406
|
+
};
|
|
407
|
+
return createStore(
|
|
408
|
+
devtools(
|
|
409
|
+
immer((set, get) => ({
|
|
410
|
+
...startProps,
|
|
411
|
+
mapActions: {
|
|
412
|
+
init: (layersStore) => {
|
|
413
|
+
set((state) => {
|
|
414
|
+
state.hashMapSources = {
|
|
415
|
+
osm_roadmap: TILE_LAYER_OSM,
|
|
416
|
+
google_rodmap: TILE_LAYER_GOOGLE,
|
|
417
|
+
google_satellite: TILE_LAYER_GOOGLE_SATELLITE,
|
|
418
|
+
google_hybrid: TILE_LAYER_GOOGLE_HYBRID,
|
|
419
|
+
bing_rodmap: TILE_LAYER_BING
|
|
420
|
+
};
|
|
421
|
+
state.mapSourcesIds = ["osm_roadmap", "google_rodmap", "google_satellite", "google_hybrid", "bing_rodmap"];
|
|
422
|
+
state.currentMapSourceId = "osm_roadmap";
|
|
423
|
+
for (let index = 0; index < layersStore.length; index++) {
|
|
424
|
+
state.hashLayers[layersStore[index].layerId] = cloneDeep(
|
|
425
|
+
layersStore[index]
|
|
426
|
+
);
|
|
427
|
+
state.layersIds.push(layersStore[index].layerId);
|
|
428
|
+
if (layersStore[index].visible !== false) {
|
|
429
|
+
state.visibleCheckedLayers.add(layersStore[index].layerId);
|
|
430
|
+
}
|
|
431
|
+
if (state.hashLayers[layersStore[index].layerId].autoFocus !== false) {
|
|
432
|
+
state.autoFocusCheckedLayers.add(layersStore[index].layerId);
|
|
433
|
+
}
|
|
434
|
+
if (state.hashLayers[layersStore[index].layerId].cluster !== false) {
|
|
435
|
+
state.clusterCheckedLayers.add(layersStore[index].layerId);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
},
|
|
440
|
+
setMapState: (status) => {
|
|
441
|
+
set((state) => {
|
|
442
|
+
state.ownerState.status = status;
|
|
443
|
+
});
|
|
444
|
+
},
|
|
445
|
+
setDataLayer: (layerId, geoJson) => {
|
|
446
|
+
if (!get().hashLayers[layerId]) {
|
|
447
|
+
throw new Error(`Layer with id ${layerId} not found`);
|
|
448
|
+
}
|
|
449
|
+
set((state) => {
|
|
450
|
+
const layer = state.hashLayers[layerId];
|
|
451
|
+
layer.geoJsonObject = geoJson;
|
|
452
|
+
});
|
|
453
|
+
},
|
|
454
|
+
getFeatureIds: (layerId) => {
|
|
455
|
+
if (!get().hashLayers[layerId]) {
|
|
456
|
+
throw new Error(`Layer with id ${layerId} not found`);
|
|
457
|
+
}
|
|
458
|
+
const geoJsonObject = get().hashLayers[layerId]?.geoJsonObject;
|
|
459
|
+
if (geoJsonObject && geoJsonObject.object.type === "Feature") {
|
|
460
|
+
return [geoJsonObject.object.id];
|
|
461
|
+
} else if (geoJsonObject && geoJsonObject.object.type === "FeatureCollection") {
|
|
462
|
+
return geoJsonObject.object.features.map((feature) => feature.id);
|
|
463
|
+
}
|
|
464
|
+
return [];
|
|
465
|
+
},
|
|
466
|
+
setFeatureData: (layerId, featureId, geometry, properties, featureLabel) => {
|
|
467
|
+
if (!get().hashLayers[layerId]) {
|
|
468
|
+
throw new Error(`Layer with id ${layerId} not found`);
|
|
469
|
+
}
|
|
470
|
+
set((state) => {
|
|
471
|
+
if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
|
|
472
|
+
const layer = state.hashLayers[layerId].geoJsonObject?.object;
|
|
473
|
+
let feature = layer.features.find((f) => f.id === featureId);
|
|
474
|
+
if (feature) {
|
|
475
|
+
feature.geometry = cloneDeep(geometry);
|
|
476
|
+
feature.properties = { ...feature.properties, ...properties };
|
|
477
|
+
feature.featureLabel = featureLabel;
|
|
478
|
+
} else {
|
|
479
|
+
feature = {
|
|
480
|
+
type: "Feature",
|
|
481
|
+
geometry,
|
|
482
|
+
id: featureId,
|
|
483
|
+
properties,
|
|
484
|
+
featureLabel
|
|
485
|
+
};
|
|
486
|
+
layer.features.push(feature);
|
|
487
|
+
}
|
|
488
|
+
} else if (state.hashLayers[layerId].geoJsonObject?.object.type === "Feature") {
|
|
489
|
+
const feature = state.hashLayers[layerId].geoJsonObject?.object;
|
|
490
|
+
feature.id = featureId;
|
|
491
|
+
feature.geometry = cloneDeep(geometry);
|
|
492
|
+
feature.properties = cloneDeep(properties);
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
},
|
|
496
|
+
removeFeature: (layerId, featureId) => {
|
|
497
|
+
if (!get().hashLayers[layerId]) {
|
|
498
|
+
throw new Error(`Layer with id ${layerId} not found`);
|
|
499
|
+
}
|
|
500
|
+
set((state) => {
|
|
501
|
+
if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
|
|
502
|
+
const layer = state.hashLayers[layerId].geoJsonObject?.object;
|
|
503
|
+
const index = layer.features.findIndex((f) => f.id === featureId);
|
|
504
|
+
if (index !== -1) {
|
|
505
|
+
layer.features.splice(index, 1);
|
|
506
|
+
}
|
|
507
|
+
} else if (state.hashLayers[layerId].geoJsonObject?.object.type === "Feature") {
|
|
508
|
+
const feature = state.hashLayers[layerId].geoJsonObject?.object;
|
|
509
|
+
feature.geometry = { type: "Point", coordinates: [0, 0] };
|
|
510
|
+
feature.properties = { subType: "Marker" };
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
},
|
|
514
|
+
setLayerRenderProp: (layerId, renderProp) => {
|
|
515
|
+
set((state) => {
|
|
516
|
+
state.hashLayers[layerId].renderFeature = renderProp;
|
|
517
|
+
});
|
|
518
|
+
},
|
|
519
|
+
addLayer: (layer) => {
|
|
520
|
+
if (get().hashLayers[layer.layerId]) {
|
|
521
|
+
throw new Error(`Layer with id ${layer.layerId} already exists`);
|
|
522
|
+
}
|
|
523
|
+
set((state) => {
|
|
524
|
+
state.hashLayers[layer.layerId] = layer;
|
|
525
|
+
state.layersIds.push(layer.layerId);
|
|
526
|
+
if (layer.visible !== false) {
|
|
527
|
+
state.hashLayers[layer.layerId].visible = true;
|
|
528
|
+
state.visibleCheckedLayers.add(layer.layerId);
|
|
529
|
+
}
|
|
530
|
+
if (layer.autoFocus !== false) {
|
|
531
|
+
state.hashLayers[layer.layerId].autoFocus = true;
|
|
532
|
+
state.autoFocusCheckedLayers.add(layer.layerId);
|
|
533
|
+
}
|
|
534
|
+
if (layer.clusterAble && layer.cluster !== false) {
|
|
535
|
+
state.hashLayers[layer.layerId].cluster = true;
|
|
536
|
+
state.clusterCheckedLayers.add(layer.layerId);
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
},
|
|
540
|
+
addLayerDataToFeature: (layerId, featureId, layerData) => {
|
|
541
|
+
set((state) => {
|
|
542
|
+
if (state.hashLayers[layerId]) {
|
|
543
|
+
if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
|
|
544
|
+
const layer = state.hashLayers[layerId].geoJsonObject?.object;
|
|
545
|
+
const feature = layer.features.find((feature2) => feature2.id === featureId);
|
|
546
|
+
if (feature) {
|
|
547
|
+
feature.layerData = layerData;
|
|
548
|
+
}
|
|
549
|
+
} else if (state.hashLayers[layerId].geoJsonObject?.object.type === "Feature") {
|
|
550
|
+
const feature = state.hashLayers[layerId].geoJsonObject?.object;
|
|
551
|
+
if (feature.layerData) {
|
|
552
|
+
feature.layerData = layerData;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
},
|
|
558
|
+
removeLayer: (layerId) => {
|
|
559
|
+
if (!get().hashLayers[layerId]) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
set((state) => {
|
|
563
|
+
if (!state.hashLayers[layerId].visible) {
|
|
564
|
+
state.visibleCheckedLayers.delete(layerId);
|
|
565
|
+
state.autoFocusCheckedLayers.delete(layerId);
|
|
566
|
+
}
|
|
567
|
+
state.layersIds.splice(state.layersIds.indexOf(layerId), 1);
|
|
568
|
+
delete state.hashLayers[layerId];
|
|
569
|
+
});
|
|
570
|
+
},
|
|
571
|
+
setCheckedLayers: (checkedNameSet, newCheckedSet) => {
|
|
572
|
+
set((state) => {
|
|
573
|
+
state[`${checkedNameSet}CheckedLayers`] = new Set(newCheckedSet);
|
|
574
|
+
for (const layerId in state.hashLayers) {
|
|
575
|
+
state.hashLayers[layerId][checkedNameSet] = newCheckedSet.has(layerId);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
},
|
|
579
|
+
setCurrentMapSource: (newId) => {
|
|
580
|
+
set((state) => {
|
|
581
|
+
if (newId in state.hashMapSources) {
|
|
582
|
+
state.currentMapSourceId = newId;
|
|
583
|
+
}
|
|
584
|
+
});
|
|
585
|
+
},
|
|
586
|
+
setMapSourceRoadOptions: (partialRoadOptions) => {
|
|
587
|
+
set((state) => {
|
|
588
|
+
if (!state.hashMapSources[state.currentMapSourceId]) {
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
state.hashMapSources[state.currentMapSourceId].roadSelectedOptions = {
|
|
592
|
+
bicyclingLayer: state.hashMapSources[state.currentMapSourceId]?.roadSelectedOptions?.bicyclingLayer || false,
|
|
593
|
+
trafficLayer: state.hashMapSources[state.currentMapSourceId]?.roadSelectedOptions?.trafficLayer || false,
|
|
594
|
+
transitLayer: state.hashMapSources[state.currentMapSourceId]?.roadSelectedOptions?.transitLayer || false,
|
|
595
|
+
...partialRoadOptions
|
|
596
|
+
};
|
|
597
|
+
});
|
|
598
|
+
},
|
|
599
|
+
setHandlerGetLabel: (newHandler) => {
|
|
600
|
+
set((state) => {
|
|
601
|
+
state.getLabel = newHandler;
|
|
602
|
+
});
|
|
603
|
+
},
|
|
604
|
+
setExternalState: (newExternalState) => {
|
|
605
|
+
set((state) => {
|
|
606
|
+
state.ownerState = { ...state.ownerState, ...newExternalState };
|
|
607
|
+
updateOwnerStateClasses();
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
})),
|
|
612
|
+
{ name: `Map store` }
|
|
613
|
+
)
|
|
614
|
+
);
|
|
615
|
+
};
|
|
616
|
+
const MapContext = createContext(null);
|
|
617
|
+
function MapProvider(props) {
|
|
618
|
+
const {
|
|
619
|
+
children,
|
|
620
|
+
initialLayers,
|
|
621
|
+
googleApiKey: apiKey,
|
|
622
|
+
googleMapVersion = "weekly"
|
|
623
|
+
} = props;
|
|
624
|
+
const {
|
|
625
|
+
getLabel
|
|
626
|
+
} = useModuleDictionary();
|
|
627
|
+
const isDesktop = useResponsiveDesktop();
|
|
628
|
+
const isSkeleton = useModuleSkeleton();
|
|
629
|
+
const isFirstRender = useFirstRender([getLabel]);
|
|
630
|
+
const mapStoreRef = useRef();
|
|
631
|
+
if (!mapStoreRef.current) {
|
|
632
|
+
mapStoreRef.current = createMapStore({
|
|
633
|
+
getLabel,
|
|
634
|
+
ownerState: {
|
|
635
|
+
status: "init",
|
|
636
|
+
isMobile: !isDesktop,
|
|
637
|
+
isSkeleton,
|
|
638
|
+
focus: false
|
|
639
|
+
},
|
|
640
|
+
googleApiKey: apiKey,
|
|
641
|
+
googleMapVersion
|
|
642
|
+
});
|
|
643
|
+
mapStoreRef.current?.getState().mapActions.init(initialLayers || []);
|
|
644
|
+
}
|
|
645
|
+
const {
|
|
646
|
+
setHandlerGetLabel,
|
|
647
|
+
setExternalState
|
|
648
|
+
} = useStore(mapStoreRef.current, (state) => state.mapActions, shallow);
|
|
649
|
+
useEffect(() => {
|
|
650
|
+
if (!isFirstRender) {
|
|
651
|
+
setHandlerGetLabel(getLabel);
|
|
652
|
+
}
|
|
653
|
+
}, [getLabel]);
|
|
654
|
+
useEffect(() => {
|
|
655
|
+
if (isFirstRender) {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
setExternalState({
|
|
659
|
+
isMobile: !isDesktop,
|
|
660
|
+
isSkeleton
|
|
661
|
+
});
|
|
662
|
+
}, [isDesktop, isSkeleton]);
|
|
663
|
+
return /* @__PURE__ */ jsx(MapContext.Provider, {
|
|
664
|
+
value: mapStoreRef.current,
|
|
665
|
+
children
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function useMapStore(selector, equalityFn) {
|
|
669
|
+
const context = useContext(MapContext);
|
|
670
|
+
if (!context)
|
|
671
|
+
throw new Error("useMapStore context must be use inside MapContext");
|
|
672
|
+
return useStore(context, selector, equalityFn);
|
|
673
|
+
}
|
|
674
|
+
const TileLayerOthers = () => {
|
|
675
|
+
const map = useMap();
|
|
676
|
+
const {
|
|
677
|
+
urlTemplate,
|
|
678
|
+
dictionaryId,
|
|
679
|
+
options,
|
|
680
|
+
getTileUrl,
|
|
681
|
+
sourceType
|
|
682
|
+
} = useMapStore((state) => state.hashMapSources[state.currentMapSourceId], shallow);
|
|
683
|
+
useEffect(() => {
|
|
684
|
+
let layer;
|
|
685
|
+
if (sourceType === "Google") {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
layer = L__default.tileLayer(urlTemplate, options);
|
|
689
|
+
if (getTileUrl) {
|
|
690
|
+
layer.getTileUrl = getTileUrl;
|
|
691
|
+
}
|
|
692
|
+
map.addLayer(layer);
|
|
693
|
+
if (options && options.maxZoom) {
|
|
694
|
+
map.setMaxZoom(options.maxZoom);
|
|
695
|
+
}
|
|
696
|
+
return () => {
|
|
697
|
+
if (layer) {
|
|
698
|
+
map.removeLayer(layer);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
}, [dictionaryId, urlTemplate, options, getTileUrl, sourceType]);
|
|
702
|
+
return null;
|
|
703
|
+
};
|
|
704
|
+
function TileLayerGoogle() {
|
|
705
|
+
const map = useMap();
|
|
706
|
+
const mutantRefLayer = React__default.useRef(null);
|
|
707
|
+
const {
|
|
708
|
+
options,
|
|
709
|
+
sourceType,
|
|
710
|
+
mapTypeTile
|
|
711
|
+
} = useMapStore((state) => state.hashMapSources[state.currentMapSourceId], shallow);
|
|
712
|
+
const roadOptions = useMapStore((state) => state.hashMapSources[state.currentMapSourceId].roadSelectedOptions, shallow);
|
|
713
|
+
const [googleApiKey, googleMapVersion] = useMapStore((state) => [state.googleApiKey, state.googleMapVersion], shallow);
|
|
714
|
+
React__default.useEffect(() => {
|
|
715
|
+
if (sourceType !== "Google") {
|
|
716
|
+
return;
|
|
717
|
+
}
|
|
718
|
+
let googleMutantLayer;
|
|
719
|
+
const loader = new Loader({
|
|
720
|
+
apiKey: googleApiKey,
|
|
721
|
+
version: googleMapVersion
|
|
722
|
+
});
|
|
723
|
+
loader.importLibrary("maps").then(() => {
|
|
724
|
+
googleMutantLayer = L__default.gridLayer.googleMutant({
|
|
725
|
+
type: mapTypeTile,
|
|
726
|
+
maxZoom: 20,
|
|
727
|
+
...options
|
|
728
|
+
});
|
|
729
|
+
mutantRefLayer.current = googleMutantLayer;
|
|
730
|
+
if (roadOptions.trafficLayer) {
|
|
731
|
+
googleMutantLayer.addGoogleLayer("TrafficLayer");
|
|
732
|
+
}
|
|
733
|
+
if (roadOptions.transitLayer) {
|
|
734
|
+
googleMutantLayer.addGoogleLayer("TransitLayer");
|
|
735
|
+
}
|
|
736
|
+
if (roadOptions.bicyclingLayer) {
|
|
737
|
+
googleMutantLayer.addGoogleLayer("BicyclingLayer");
|
|
738
|
+
}
|
|
739
|
+
map.addLayer(googleMutantLayer);
|
|
740
|
+
});
|
|
741
|
+
return () => {
|
|
742
|
+
if (googleMutantLayer) {
|
|
743
|
+
map.removeLayer(googleMutantLayer);
|
|
744
|
+
mutantRefLayer.current = null;
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
}, [map, sourceType, mapTypeTile]);
|
|
748
|
+
React__default.useEffect(() => {
|
|
749
|
+
if (sourceType !== "Google") {
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
if (mutantRefLayer.current && roadOptions) {
|
|
753
|
+
console.log("roadOptions.trafficLayer", roadOptions.trafficLayer);
|
|
754
|
+
if (roadOptions.trafficLayer) {
|
|
755
|
+
mutantRefLayer.current.addGoogleLayer("TrafficLayer");
|
|
756
|
+
} else if (roadOptions.trafficLayer === false) {
|
|
757
|
+
mutantRefLayer.current.removeGoogleLayer("TrafficLayer");
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}, [roadOptions.trafficLayer]);
|
|
761
|
+
React__default.useEffect(() => {
|
|
762
|
+
if (sourceType !== "Google") {
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
if (mutantRefLayer.current && roadOptions) {
|
|
766
|
+
if (roadOptions.transitLayer) {
|
|
767
|
+
mutantRefLayer.current.addGoogleLayer("TransitLayer");
|
|
768
|
+
} else if (roadOptions.transitLayer === false) {
|
|
769
|
+
mutantRefLayer.current.removeGoogleLayer("TransitLayer");
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}, [roadOptions.transitLayer]);
|
|
773
|
+
React__default.useEffect(() => {
|
|
774
|
+
if (sourceType !== "Google") {
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
if (mutantRefLayer.current && roadOptions) {
|
|
778
|
+
if (roadOptions.bicyclingLayer) {
|
|
779
|
+
mutantRefLayer.current.addGoogleLayer("BicyclingLayer");
|
|
780
|
+
} else if (roadOptions.bicyclingLayer === false) {
|
|
781
|
+
mutantRefLayer.current.removeGoogleLayer("BicyclingLayer");
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}, [roadOptions.bicyclingLayer]);
|
|
785
|
+
return null;
|
|
786
|
+
}
|
|
787
|
+
function TileLayers() {
|
|
788
|
+
return /* @__PURE__ */ jsxs(React__default.Fragment, {
|
|
789
|
+
children: [/* @__PURE__ */ jsx(TileLayerOthers, {}), /* @__PURE__ */ jsx(TileLayerGoogle, {})]
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
const POSITION_CLASSES = {
|
|
793
|
+
bottomleft: "leaflet-bottom leaflet-left",
|
|
794
|
+
bottomright: "leaflet-bottom leaflet-right",
|
|
795
|
+
topleft: "leaflet-top leaflet-left",
|
|
796
|
+
topright: "leaflet-top leaflet-right"
|
|
797
|
+
};
|
|
798
|
+
const Control = (props) => {
|
|
799
|
+
const [portalRoot, setPortalRoot] = React__default.useState(document.createElement("div"));
|
|
800
|
+
const positionClass = props.position && POSITION_CLASSES[props.position] || POSITION_CLASSES.topright;
|
|
801
|
+
const controlContainerRef = React__default.createRef();
|
|
802
|
+
const map = useMap();
|
|
803
|
+
React__default.useEffect(() => {
|
|
804
|
+
console.log("useEffect, controlContainerRef", controlContainerRef);
|
|
805
|
+
if (controlContainerRef.current !== null) {
|
|
806
|
+
L__default.DomEvent.disableClickPropagation(controlContainerRef.current);
|
|
807
|
+
L__default.DomEvent.disableScrollPropagation(controlContainerRef.current);
|
|
808
|
+
}
|
|
809
|
+
}, [controlContainerRef]);
|
|
810
|
+
React__default.useEffect(() => {
|
|
811
|
+
const mapContainer = map.getContainer();
|
|
812
|
+
const targetDiv = mapContainer.getElementsByClassName(positionClass);
|
|
813
|
+
setPortalRoot(targetDiv[0]);
|
|
814
|
+
}, [positionClass]);
|
|
815
|
+
React__default.useEffect(() => {
|
|
816
|
+
if (portalRoot !== null) {
|
|
817
|
+
if (props.prepend !== void 0 && props.prepend === true) {
|
|
818
|
+
portalRoot.prepend(controlContainerRef.current);
|
|
819
|
+
} else {
|
|
820
|
+
portalRoot.append(controlContainerRef.current);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}, [portalRoot, props.prepend, controlContainerRef]);
|
|
824
|
+
const className = clsx(props.container?.className, "leaflet-control", props.className);
|
|
825
|
+
console.log("Control Render", controlContainerRef);
|
|
826
|
+
return /* @__PURE__ */ jsx("div", {
|
|
827
|
+
...props.container,
|
|
828
|
+
ref: controlContainerRef,
|
|
829
|
+
className,
|
|
830
|
+
children: props.children
|
|
831
|
+
});
|
|
832
|
+
};
|
|
833
|
+
function MyActions() {
|
|
834
|
+
const {
|
|
835
|
+
control,
|
|
836
|
+
setValue
|
|
837
|
+
} = useFormContext();
|
|
838
|
+
const {
|
|
839
|
+
getLabel
|
|
840
|
+
} = useModuleDictionary();
|
|
841
|
+
const fieldsWatch = useWatch({
|
|
842
|
+
control,
|
|
843
|
+
name: ["statusEdition", "reInits"]
|
|
844
|
+
});
|
|
845
|
+
const statusEdition = fieldsWatch[0];
|
|
846
|
+
const initCancelDraw = () => {
|
|
847
|
+
if (statusEdition === "initial") {
|
|
848
|
+
setValue("statusEdition", "draw");
|
|
849
|
+
} else if (statusEdition === "draw") {
|
|
850
|
+
setValue("statusEdition", "initial");
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
return /* @__PURE__ */ jsx(Actions, {
|
|
854
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
855
|
+
onClick: initCancelDraw,
|
|
856
|
+
children: statusEdition === "initial" ? getLabel(MAP_DICCTIONARY.LABEL_MEASURE_START) : getLabel(MAP_DICCTIONARY.LABEL_MEASURE_CANCEL)
|
|
857
|
+
})
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
function MeasureDataValidation(_getLabel) {
|
|
861
|
+
return {};
|
|
862
|
+
}
|
|
863
|
+
function useValidation() {
|
|
864
|
+
const { getLabel } = useModuleDictionary();
|
|
865
|
+
const validationSchema = useMemo(
|
|
866
|
+
() => Yup.object().shape({
|
|
867
|
+
...MeasureDataValidation()
|
|
868
|
+
}),
|
|
869
|
+
[getLabel]
|
|
870
|
+
);
|
|
871
|
+
return { validationSchema };
|
|
872
|
+
}
|
|
873
|
+
const INITIAL_FORM_VALUES = {
|
|
874
|
+
statusLoad: "ready",
|
|
875
|
+
reInits: 0,
|
|
876
|
+
value: "0",
|
|
877
|
+
measureTypeId: "distance",
|
|
878
|
+
magnitudFactor: { id: "m_kilometers", name: "Kilometers", symbol: "k", factor_x0: 0, factor_x1: 1, factor_x2: 0 },
|
|
879
|
+
unitArea: null,
|
|
880
|
+
statusEdition: "initial"
|
|
881
|
+
};
|
|
882
|
+
const STYLE_MEASURE_OPTIONS = {
|
|
883
|
+
strokeLineColor: "#1E96DC",
|
|
884
|
+
strokeLineWeight: 5,
|
|
885
|
+
markerHeight: 37,
|
|
886
|
+
markerWidth: 26,
|
|
887
|
+
labelMarkerHeight: 0,
|
|
888
|
+
labelMarkerWidth: 0,
|
|
889
|
+
labelMarkerAnchorY: 0,
|
|
890
|
+
labelMarkerAnchorX: 0
|
|
891
|
+
};
|
|
892
|
+
const getMarkerPointIcon = (position) => {
|
|
893
|
+
return L__default.divIcon({
|
|
894
|
+
className: mapClasses.measureMarkerRoot,
|
|
895
|
+
html: `<div class="${mapClasses.measureMarkerContainer}">
|
|
896
|
+
<div class="${mapClasses.measureMarkerContainerRhomb}">
|
|
897
|
+
</div>
|
|
898
|
+
<div class="${mapClasses.measureMarkerContainerSlot}">
|
|
899
|
+
<div class="${mapClasses.measureMarkerContainerSlotNumber}">
|
|
900
|
+
${position}
|
|
901
|
+
</div>
|
|
902
|
+
</div>
|
|
903
|
+
</div>
|
|
904
|
+
`,
|
|
905
|
+
iconSize: [STYLE_MEASURE_OPTIONS.markerWidth, STYLE_MEASURE_OPTIONS.markerHeight],
|
|
906
|
+
iconAnchor: [STYLE_MEASURE_OPTIONS.markerWidth / 2, STYLE_MEASURE_OPTIONS.markerHeight]
|
|
907
|
+
});
|
|
908
|
+
};
|
|
909
|
+
const getMarkerPointLabel = (distance, getLabel) => {
|
|
910
|
+
return L__default.divIcon({
|
|
911
|
+
className: mapClasses.measureLabelMarkerRoot,
|
|
912
|
+
html: `<div class="${mapClasses.measureLabelMarkerContainer}">
|
|
913
|
+
${distance ? `<span class="${mapClasses.measureLabelMarkerDistance}">${distance}</span>` : ""}
|
|
914
|
+
<div class="${mapClasses.measureLabelMarkerRemove}">${getLabel(MAP_DICCTIONARY.LABEL_MEASURE_REMOVE_POINT)}</div>
|
|
915
|
+
</div>`,
|
|
916
|
+
iconSize: [STYLE_MEASURE_OPTIONS.labelMarkerWidth, STYLE_MEASURE_OPTIONS.labelMarkerHeight],
|
|
917
|
+
iconAnchor: [STYLE_MEASURE_OPTIONS.labelMarkerAnchorX, STYLE_MEASURE_OPTIONS.labelMarkerAnchorY]
|
|
918
|
+
});
|
|
919
|
+
};
|
|
920
|
+
function useMeasure() {
|
|
921
|
+
const { getLabel } = useModuleDictionary();
|
|
922
|
+
const map = useMap();
|
|
923
|
+
const readyToUpdate = useFormReadyForUpdate();
|
|
924
|
+
const { control, setValue } = useFormContext();
|
|
925
|
+
const fieldsWatch = useWatch({
|
|
926
|
+
control,
|
|
927
|
+
name: [
|
|
928
|
+
"statusEdition",
|
|
929
|
+
"value",
|
|
930
|
+
"magnitudFactor"
|
|
931
|
+
]
|
|
932
|
+
});
|
|
933
|
+
const statusEdition = fieldsWatch[0];
|
|
934
|
+
const value = fieldsWatch[1];
|
|
935
|
+
const magnitudFactor = fieldsWatch[2];
|
|
936
|
+
const [magnitudFactorCached, setMagnitudFactorCached] = useState(magnitudFactor);
|
|
937
|
+
const currentMeasure = useRef({ measurePoints: [], addMarker: false, magnitudFactor, dragging: false });
|
|
938
|
+
const clearMeasure = useCallback(() => {
|
|
939
|
+
currentMeasure.current.measurePoints.forEach((measurePoint) => {
|
|
940
|
+
measurePoint.marker.remove();
|
|
941
|
+
measurePoint.labelMarker.remove();
|
|
942
|
+
});
|
|
943
|
+
currentMeasure.current.measurePoints = [];
|
|
944
|
+
setValue("value", measureDistante());
|
|
945
|
+
}, []);
|
|
946
|
+
const getFormatFactorDistance = useCallback((distance, withSymbol = false) => {
|
|
947
|
+
if (distance === void 0) {
|
|
948
|
+
return void 0;
|
|
949
|
+
}
|
|
950
|
+
const cMagnitudeFactor = currentMeasure.current.magnitudFactor;
|
|
951
|
+
return (cMagnitudeFactor.factor_x0 + distance * cMagnitudeFactor.factor_x1 + (distance ^ 2 * cMagnitudeFactor.factor_x2)).toFixed(2) + (withSymbol ? ` ${cMagnitudeFactor.symbol}` : "");
|
|
952
|
+
}, []);
|
|
953
|
+
const measureDistante = useCallback(() => {
|
|
954
|
+
var totalDistance = 0;
|
|
955
|
+
const measurePoints = currentMeasure.current.measurePoints;
|
|
956
|
+
if (currentMeasure.current.layerLine) {
|
|
957
|
+
if (measurePoints.length < 2) {
|
|
958
|
+
currentMeasure.current.layerLine.remove();
|
|
959
|
+
currentMeasure.current.layerLine = void 0;
|
|
960
|
+
} else {
|
|
961
|
+
currentMeasure.current.layerLine.setLatLngs(measurePoints.map((measurePoint) => measurePoint.marker.getLatLng()));
|
|
962
|
+
}
|
|
963
|
+
} else {
|
|
964
|
+
if (measurePoints.length > 1) {
|
|
965
|
+
currentMeasure.current.layerLine = L.polyline(
|
|
966
|
+
measurePoints.map((measurePoint) => measurePoint.marker.getLatLng()),
|
|
967
|
+
{
|
|
968
|
+
color: STYLE_MEASURE_OPTIONS.strokeLineColor,
|
|
969
|
+
weight: STYLE_MEASURE_OPTIONS.strokeLineWeight,
|
|
970
|
+
interactive: false
|
|
971
|
+
}
|
|
972
|
+
).addTo(map);
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
for (let i = 0; i < measurePoints.length - 1; i++) {
|
|
976
|
+
totalDistance += measurePoints[i].marker.getLatLng().distanceTo(measurePoints[i + 1].marker.getLatLng());
|
|
977
|
+
}
|
|
978
|
+
if (measurePoints.length > 0 && measurePoints[0].formatDistanceFromPrevious !== void 0) {
|
|
979
|
+
measurePoints[0].formatDistanceFromPrevious = void 0;
|
|
980
|
+
measurePoints[0].labelMarker.setIcon(getMarkerPointLabelMemo(void 0, getLabel));
|
|
981
|
+
addClickListenerForRemove(measurePoints[0].labelMarker);
|
|
982
|
+
}
|
|
983
|
+
for (let i = 1; i < measurePoints.length; i++) {
|
|
984
|
+
const formatDistanceFromPrevious = getFormatFactorDistance(measurePoints[i - 1].marker.getLatLng().distanceTo(measurePoints[i].marker.getLatLng()), true);
|
|
985
|
+
if (measurePoints[i].formatDistanceFromPrevious !== formatDistanceFromPrevious) {
|
|
986
|
+
measurePoints[i].formatDistanceFromPrevious = formatDistanceFromPrevious;
|
|
987
|
+
measurePoints[i].labelMarker.setIcon(getMarkerPointLabelMemo(formatDistanceFromPrevious, getLabel));
|
|
988
|
+
addClickListenerForRemove(measurePoints[i].labelMarker);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return getFormatFactorDistance(totalDistance);
|
|
992
|
+
}, [map, getLabel]);
|
|
993
|
+
const getMarkerPointIconMemo = useCallback(getMarkerPointIcon, []);
|
|
994
|
+
const getMarkerPointLabelMemo = useCallback(getMarkerPointLabel, [getLabel]);
|
|
995
|
+
const onClickRemovePoint = useCallback((labelMarker) => {
|
|
996
|
+
return (e) => {
|
|
997
|
+
e.stopPropagation();
|
|
998
|
+
if (!currentMeasure.current.dragging) {
|
|
999
|
+
var markIndex = currentMeasure.current.measurePoints.findIndex((searchElement) => {
|
|
1000
|
+
return searchElement.labelMarker === labelMarker;
|
|
1001
|
+
});
|
|
1002
|
+
if (markIndex !== -1) {
|
|
1003
|
+
var measurePoint = currentMeasure.current.measurePoints[markIndex];
|
|
1004
|
+
measurePoint.marker.remove();
|
|
1005
|
+
measurePoint.labelMarker.remove();
|
|
1006
|
+
currentMeasure.current.measurePoints.splice(markIndex, 1);
|
|
1007
|
+
setValue("value", measureDistante());
|
|
1008
|
+
currentMeasure.current.addMarker = true;
|
|
1009
|
+
}
|
|
1010
|
+
currentMeasure.current.measurePoints.forEach((measurePoint2, index) => {
|
|
1011
|
+
measurePoint2.marker.setIcon(getMarkerPointIconMemo(index + 1));
|
|
1012
|
+
});
|
|
1013
|
+
}
|
|
1014
|
+
};
|
|
1015
|
+
}, []);
|
|
1016
|
+
const addClickListenerForRemove = useCallback((labelMarker) => {
|
|
1017
|
+
var element = labelMarker.getElement();
|
|
1018
|
+
if (element) {
|
|
1019
|
+
var elements = element.getElementsByClassName(mapClasses.measureLabelMarkerRemove);
|
|
1020
|
+
element = elements[0];
|
|
1021
|
+
console.log("addClickListenerForRemove event", element);
|
|
1022
|
+
if (element) {
|
|
1023
|
+
element.addEventListener("click", onClickRemovePoint(labelMarker));
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}, []);
|
|
1027
|
+
const onClickMap = useCallback((e) => {
|
|
1028
|
+
console.log("onClickMap event");
|
|
1029
|
+
var lat = e.latlng.lat;
|
|
1030
|
+
var lng = e.latlng.lng;
|
|
1031
|
+
var formatDistanceFromPrevious = void 0;
|
|
1032
|
+
if (currentMeasure.current.addMarker === false) {
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
1035
|
+
if (currentMeasure.current.measurePoints.length > 0) {
|
|
1036
|
+
formatDistanceFromPrevious = getFormatFactorDistance(currentMeasure.current.measurePoints[currentMeasure.current.measurePoints.length - 1].marker.getLatLng().distanceTo(e.latlng));
|
|
1037
|
+
}
|
|
1038
|
+
var marker = L.marker([lat, lng], {
|
|
1039
|
+
draggable: true,
|
|
1040
|
+
riseOnHover: true,
|
|
1041
|
+
autoPan: true,
|
|
1042
|
+
icon: getMarkerPointIconMemo(currentMeasure.current.measurePoints.length + 1),
|
|
1043
|
+
zIndexOffset: MAP_ZINDEX_DEFAULT
|
|
1044
|
+
}).addTo(map);
|
|
1045
|
+
marker.on("moveend", function(_e) {
|
|
1046
|
+
var latlng = marker.getLatLng();
|
|
1047
|
+
labelMarker.setLatLng(latlng);
|
|
1048
|
+
setValue("value", measureDistante());
|
|
1049
|
+
});
|
|
1050
|
+
marker.on("mouseover", function() {
|
|
1051
|
+
currentMeasure.current.addMarker = false;
|
|
1052
|
+
});
|
|
1053
|
+
marker.on("mouseout", function() {
|
|
1054
|
+
currentMeasure.current.addMarker = true;
|
|
1055
|
+
});
|
|
1056
|
+
var labelMarker = L.marker([lat, lng], {
|
|
1057
|
+
draggable: true,
|
|
1058
|
+
riseOnHover: true,
|
|
1059
|
+
icon: getMarkerPointLabelMemo(formatDistanceFromPrevious, getLabel),
|
|
1060
|
+
zIndexOffset: MAP_ZINDEX_DEFAULT
|
|
1061
|
+
}).addTo(map);
|
|
1062
|
+
labelMarker.on("moveend", function(_e) {
|
|
1063
|
+
var latlng = labelMarker.getLatLng();
|
|
1064
|
+
marker.setLatLng(latlng);
|
|
1065
|
+
setValue("value", measureDistante());
|
|
1066
|
+
});
|
|
1067
|
+
labelMarker.on("mouseover", function(_e) {
|
|
1068
|
+
currentMeasure.current.addMarker = false;
|
|
1069
|
+
});
|
|
1070
|
+
labelMarker.on("mouseout", function(_e) {
|
|
1071
|
+
currentMeasure.current.addMarker = true;
|
|
1072
|
+
});
|
|
1073
|
+
labelMarker.on("dragstart", function(_e) {
|
|
1074
|
+
currentMeasure.current.dragging = true;
|
|
1075
|
+
});
|
|
1076
|
+
labelMarker.on("dragend", function(_e) {
|
|
1077
|
+
setTimeout(function() {
|
|
1078
|
+
currentMeasure.current.dragging = false;
|
|
1079
|
+
}, 10);
|
|
1080
|
+
});
|
|
1081
|
+
addClickListenerForRemove(labelMarker);
|
|
1082
|
+
currentMeasure.current.measurePoints.push({
|
|
1083
|
+
marker,
|
|
1084
|
+
labelMarker,
|
|
1085
|
+
formatDistanceFromPrevious
|
|
1086
|
+
});
|
|
1087
|
+
setValue("value", measureDistante());
|
|
1088
|
+
}, [map, measureDistante, setValue, getLabel]);
|
|
1089
|
+
const onMouseMoveMap = useCallback(() => {
|
|
1090
|
+
map.getContainer().style.cursor = "crosshair";
|
|
1091
|
+
}, [map]);
|
|
1092
|
+
const onMouseOutMap = useCallback(() => {
|
|
1093
|
+
map.getContainer().style.cursor = "default";
|
|
1094
|
+
}, [map]);
|
|
1095
|
+
useEffect(() => {
|
|
1096
|
+
if (map) {
|
|
1097
|
+
if (statusEdition === "initial") {
|
|
1098
|
+
map.off("click", onClickMap);
|
|
1099
|
+
clearMeasure();
|
|
1100
|
+
map.getContainer().style.cursor = "default";
|
|
1101
|
+
return;
|
|
1102
|
+
} else {
|
|
1103
|
+
currentMeasure.current.addMarker = true;
|
|
1104
|
+
map.getContainer().style.cursor = "crosshair";
|
|
1105
|
+
map.on("click", onClickMap);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
}, [map, statusEdition]);
|
|
1109
|
+
useEffect(() => {
|
|
1110
|
+
console.log("useEffect magnitudFactor", readyToUpdate, magnitudFactor);
|
|
1111
|
+
if (!readyToUpdate)
|
|
1112
|
+
return;
|
|
1113
|
+
if (magnitudFactor.id !== magnitudFactorCached.id) {
|
|
1114
|
+
console.log("useEffect magnitudFactor CAMBIO");
|
|
1115
|
+
setMagnitudFactorCached({ ...magnitudFactor });
|
|
1116
|
+
currentMeasure.current.magnitudFactor = magnitudFactor;
|
|
1117
|
+
setValue("value", measureDistante());
|
|
1118
|
+
}
|
|
1119
|
+
}, [magnitudFactor]);
|
|
1120
|
+
useEffect(() => {
|
|
1121
|
+
return () => {
|
|
1122
|
+
map.off("mousemove", onMouseMoveMap);
|
|
1123
|
+
map.off("mouseout", onMouseOutMap);
|
|
1124
|
+
map.off("click", onClickMap);
|
|
1125
|
+
map.getContainer().style.cursor = "default";
|
|
1126
|
+
clearMeasure();
|
|
1127
|
+
};
|
|
1128
|
+
}, []);
|
|
1129
|
+
return { statusEdition, magnitudFactor, value };
|
|
1130
|
+
}
|
|
1131
|
+
function MeasureData() {
|
|
1132
|
+
const {
|
|
1133
|
+
getLabel
|
|
1134
|
+
} = useModuleDictionary();
|
|
1135
|
+
const {
|
|
1136
|
+
value,
|
|
1137
|
+
magnitudFactor
|
|
1138
|
+
} = useMeasure();
|
|
1139
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
1140
|
+
children: [/* @__PURE__ */ jsx(RHFAutocompleteAsync, {
|
|
1141
|
+
endPoint: "magnitudes/factors?origin_unit_reference_id=m_kilometers",
|
|
1142
|
+
name: "magnitudFactor",
|
|
1143
|
+
autoComplete: "off",
|
|
1144
|
+
getOptionLabel: (option) => option.name,
|
|
1145
|
+
isOptionEqualToValue: (option, value2) => option.id === value2.id,
|
|
1146
|
+
label: getLabel(MAP_DICCTIONARY.LABEL_MEASURE_UNIT),
|
|
1147
|
+
isRemote: false
|
|
1148
|
+
}), /* @__PURE__ */ jsxs(Stack, {
|
|
1149
|
+
direction: "row",
|
|
1150
|
+
spacing: 2,
|
|
1151
|
+
className: mapClasses.measureToolFormValue,
|
|
1152
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1153
|
+
className: mapClasses.measureToolFormValueDistance,
|
|
1154
|
+
children: value
|
|
1155
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1156
|
+
className: mapClasses.measureToolFormValueSymbol,
|
|
1157
|
+
children: magnitudFactor.symbol
|
|
1158
|
+
})]
|
|
1159
|
+
})]
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
function MeasureTool() {
|
|
1163
|
+
const {
|
|
1164
|
+
getLabel
|
|
1165
|
+
} = useModuleDictionary();
|
|
1166
|
+
const finalInitalValues = {
|
|
1167
|
+
...INITIAL_FORM_VALUES
|
|
1168
|
+
};
|
|
1169
|
+
if (finalInitalValues?.magnitudFactor?.name) {
|
|
1170
|
+
finalInitalValues.magnitudFactor.name = getLabel(MAP_DICCTIONARY.LABEL_MEASURE_UNIT_BASE_KILOMETERS);
|
|
1171
|
+
}
|
|
1172
|
+
const {
|
|
1173
|
+
validationSchema
|
|
1174
|
+
} = useValidation();
|
|
1175
|
+
const onSubmit = () => {
|
|
1176
|
+
};
|
|
1177
|
+
return /* @__PURE__ */ jsxs(RHFormProvider, {
|
|
1178
|
+
className: mapClasses.meaureToolRoot,
|
|
1179
|
+
statusLoad: INITIAL_FORM_VALUES.statusLoad,
|
|
1180
|
+
onSubmit,
|
|
1181
|
+
values: finalInitalValues,
|
|
1182
|
+
validationSchema,
|
|
1183
|
+
children: [/* @__PURE__ */ jsx(Stack, {
|
|
1184
|
+
direction: "column",
|
|
1185
|
+
children: /* @__PURE__ */ jsx(MeasureData, {})
|
|
1186
|
+
}), /* @__PURE__ */ jsx(MyActions, {})]
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
function ZoomButtons() {
|
|
1190
|
+
const map = useMap();
|
|
1191
|
+
const {
|
|
1192
|
+
host_static_assets,
|
|
1193
|
+
environment_assets
|
|
1194
|
+
} = useEnvironment();
|
|
1195
|
+
const [, setZoomInDisabled] = useState(false);
|
|
1196
|
+
const [, setZoomOutDisabled] = useState(false);
|
|
1197
|
+
useEffect(() => {
|
|
1198
|
+
const updateButtonState = () => {
|
|
1199
|
+
const currentZoom = map.getZoom();
|
|
1200
|
+
const maxZoom = map.getMaxZoom();
|
|
1201
|
+
const minZoom = map.getMinZoom();
|
|
1202
|
+
setZoomInDisabled(currentZoom === maxZoom);
|
|
1203
|
+
setZoomOutDisabled(currentZoom === minZoom);
|
|
1204
|
+
};
|
|
1205
|
+
map.on("zoomend", updateButtonState);
|
|
1206
|
+
updateButtonState();
|
|
1207
|
+
return () => {
|
|
1208
|
+
map.off("zoomend", updateButtonState);
|
|
1209
|
+
};
|
|
1210
|
+
}, [map]);
|
|
1211
|
+
const handleZoomIn = () => {
|
|
1212
|
+
map.zoomIn();
|
|
1213
|
+
};
|
|
1214
|
+
const handleZoomOut = () => {
|
|
1215
|
+
map.zoomOut();
|
|
1216
|
+
};
|
|
1217
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1218
|
+
className: mapClasses.zoomButtons,
|
|
1219
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
1220
|
+
onClick: handleZoomIn,
|
|
1221
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_ZOOM_IN}`
|
|
1222
|
+
}), /* @__PURE__ */ jsx(IconButton, {
|
|
1223
|
+
onClick: handleZoomOut,
|
|
1224
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_ZOOM_OUT}`
|
|
1225
|
+
})]
|
|
1226
|
+
});
|
|
1227
|
+
}
|
|
1228
|
+
function TopRightTools(props) {
|
|
1229
|
+
const {
|
|
1230
|
+
gpsTools
|
|
1231
|
+
} = props;
|
|
1232
|
+
const {
|
|
1233
|
+
addPopup,
|
|
1234
|
+
closePopup
|
|
1235
|
+
} = usePopupsStore((state) => state.popupsActions);
|
|
1236
|
+
const {
|
|
1237
|
+
host_static_assets,
|
|
1238
|
+
environment_assets
|
|
1239
|
+
} = useEnvironment();
|
|
1240
|
+
const {
|
|
1241
|
+
getLabel
|
|
1242
|
+
} = useModuleDictionary();
|
|
1243
|
+
const openPopupsIds = usePopupsStore((state) => state.popupsIds.filter((pId) => {
|
|
1244
|
+
return state.hashPopups[pId].status === "init";
|
|
1245
|
+
}), shallow);
|
|
1246
|
+
const popupsIds = usePopupsStore((state) => state.popupsIds, shallow);
|
|
1247
|
+
const map = useMap();
|
|
1248
|
+
const isToggledGpsTools = openPopupsIds.indexOf("gpsTools") > -1;
|
|
1249
|
+
const isDisabledGpsTools = popupsIds.indexOf("gpsTools") > -1 && openPopupsIds.indexOf("gpsTools") === -1;
|
|
1250
|
+
const isToggledMeasureTool = openPopupsIds.indexOf("measureTool") > -1;
|
|
1251
|
+
const isDisabledMeasureTool = popupsIds.indexOf("measureTool") > -1 && openPopupsIds.indexOf("measureTool") === -1;
|
|
1252
|
+
const onMouseDown = (e) => {
|
|
1253
|
+
map.dragging.disable();
|
|
1254
|
+
e.stopPropagation();
|
|
1255
|
+
document.addEventListener("mouseup", onMouseUp);
|
|
1256
|
+
};
|
|
1257
|
+
const onMouseUp = (e) => {
|
|
1258
|
+
map.dragging.enable();
|
|
1259
|
+
e.stopPropagation();
|
|
1260
|
+
document.removeEventListener("mouseup", onMouseUp);
|
|
1261
|
+
};
|
|
1262
|
+
const onGpsToolsClick = (e) => {
|
|
1263
|
+
if (!isToggledGpsTools) {
|
|
1264
|
+
addPopup({
|
|
1265
|
+
popupId: "gpsTools",
|
|
1266
|
+
title: getLabel(MAP_DICCTIONARY.LABEL_GPSTOOLS_NAME),
|
|
1267
|
+
iconUrl: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_GPS_TOOLS_TOOL}`,
|
|
1268
|
+
functionComponent: gpsTools,
|
|
1269
|
+
onMouseDown,
|
|
1270
|
+
defaultPosition: GPS_TOOLS_POPUP_DEFAULT_POSITION
|
|
1271
|
+
}, {
|
|
1272
|
+
closeOthers: true
|
|
1273
|
+
});
|
|
1274
|
+
} else {
|
|
1275
|
+
closePopup("gpsTools");
|
|
1276
|
+
}
|
|
1277
|
+
e.stopPropagation();
|
|
1278
|
+
};
|
|
1279
|
+
const onMeasureToolClick = (e) => {
|
|
1280
|
+
if (!isToggledMeasureTool) {
|
|
1281
|
+
addPopup({
|
|
1282
|
+
popupId: "measureTool",
|
|
1283
|
+
iconUrl: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_MEASURE_TOOL}`,
|
|
1284
|
+
title: "Measure Tool",
|
|
1285
|
+
functionComponent: MeasureTool,
|
|
1286
|
+
onMouseDown,
|
|
1287
|
+
defaultPosition: MESURE_POPUP_DEFAULT_POSITION
|
|
1288
|
+
}, {
|
|
1289
|
+
closeOthers: true
|
|
1290
|
+
});
|
|
1291
|
+
} else {
|
|
1292
|
+
closePopup("measureTool");
|
|
1293
|
+
}
|
|
1294
|
+
e.stopPropagation();
|
|
1295
|
+
};
|
|
1296
|
+
return /* @__PURE__ */ jsxs(Control, {
|
|
1297
|
+
position: "topright",
|
|
1298
|
+
prepend: true,
|
|
1299
|
+
className: mapClasses.topRigthToolsRoot,
|
|
1300
|
+
children: [/* @__PURE__ */ jsx(ToggleIconButton, {
|
|
1301
|
+
isToggled: isToggledGpsTools,
|
|
1302
|
+
disabled: isDisabledGpsTools,
|
|
1303
|
+
onToggle: onGpsToolsClick,
|
|
1304
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_GPS_TOOLS_TOOL}`
|
|
1305
|
+
}), /* @__PURE__ */ jsx(ToggleIconButton, {
|
|
1306
|
+
isToggled: isToggledMeasureTool,
|
|
1307
|
+
disabled: isDisabledMeasureTool,
|
|
1308
|
+
onToggle: onMeasureToolClick,
|
|
1309
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_MEASURE_TOOL}`
|
|
1310
|
+
}), /* @__PURE__ */ jsx(ZoomButtons, {})]
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
function useColumns(props) {
|
|
1314
|
+
const {
|
|
1315
|
+
rowKeyGetter,
|
|
1316
|
+
visibleLayers,
|
|
1317
|
+
setVisibleLayers,
|
|
1318
|
+
autoFocusLayers,
|
|
1319
|
+
setAutoFocusLayers,
|
|
1320
|
+
clusterLayers,
|
|
1321
|
+
setClusterLayers
|
|
1322
|
+
} = props;
|
|
1323
|
+
const {
|
|
1324
|
+
getLabel
|
|
1325
|
+
} = useModuleDictionary();
|
|
1326
|
+
const {
|
|
1327
|
+
host_static_assets,
|
|
1328
|
+
environment_assets
|
|
1329
|
+
} = useEnvironment();
|
|
1330
|
+
const useHook = useCallback((field) => {
|
|
1331
|
+
if (field === "visible") {
|
|
1332
|
+
return [visibleLayers, setVisibleLayers];
|
|
1333
|
+
} else if (field === "autoFocus") {
|
|
1334
|
+
return [autoFocusLayers, setAutoFocusLayers];
|
|
1335
|
+
} else {
|
|
1336
|
+
return [clusterLayers, setClusterLayers];
|
|
1337
|
+
}
|
|
1338
|
+
}, [visibleLayers, autoFocusLayers, clusterLayers]);
|
|
1339
|
+
const columns = useMemo(() => [
|
|
1340
|
+
{
|
|
1341
|
+
key: "name",
|
|
1342
|
+
name: getLabel(MAP_DICCTIONARY.LABEL_NAME),
|
|
1343
|
+
type: "string",
|
|
1344
|
+
width: 150,
|
|
1345
|
+
frozen: true
|
|
1346
|
+
},
|
|
1347
|
+
{
|
|
1348
|
+
key: "visible",
|
|
1349
|
+
name: getLabel(MAP_DICCTIONARY.LABEL_LAYER_VISIBLE),
|
|
1350
|
+
width: 50,
|
|
1351
|
+
minWidth: 20,
|
|
1352
|
+
type: "boolean",
|
|
1353
|
+
formatter: ColumnSetCheckFormatter({
|
|
1354
|
+
field: "visible",
|
|
1355
|
+
rowKeyGetter,
|
|
1356
|
+
useHook
|
|
1357
|
+
}),
|
|
1358
|
+
cellClass: "rdg-cell-align-center",
|
|
1359
|
+
headerRenderer: (p) => /* @__PURE__ */ jsx(Tooltip, {
|
|
1360
|
+
title: getLabel(MAP_DICCTIONARY.LABEL_LAYER_VISIBLE),
|
|
1361
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
1362
|
+
size: "medium",
|
|
1363
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_VISIBLE}`
|
|
1364
|
+
})
|
|
1365
|
+
})
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
key: "autoFocus",
|
|
1369
|
+
name: getLabel(MAP_DICCTIONARY.LABEL_LAYER_AUTOFOCUS),
|
|
1370
|
+
minWidth: 20,
|
|
1371
|
+
width: 50,
|
|
1372
|
+
type: "boolean",
|
|
1373
|
+
formatter: ColumnSetCheckFormatter({
|
|
1374
|
+
field: "autoFocus",
|
|
1375
|
+
rowKeyGetter,
|
|
1376
|
+
useHook
|
|
1377
|
+
}),
|
|
1378
|
+
cellClass: "rdg-cell-align-center",
|
|
1379
|
+
headerRenderer: (p) => /* @__PURE__ */ jsx(Tooltip, {
|
|
1380
|
+
title: getLabel(MAP_DICCTIONARY.LABEL_LAYER_AUTOFOCUS),
|
|
1381
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
1382
|
+
size: "medium",
|
|
1383
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_AUTOFOCUS}`
|
|
1384
|
+
})
|
|
1385
|
+
})
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
key: "cluster",
|
|
1389
|
+
name: getLabel(MAP_DICCTIONARY.LABEL_LAYER_CLUSTER),
|
|
1390
|
+
minWidth: 20,
|
|
1391
|
+
width: 50,
|
|
1392
|
+
type: "boolean",
|
|
1393
|
+
formatter: ColumnSetCheckFormatter({
|
|
1394
|
+
field: "cluster",
|
|
1395
|
+
disabledGetter: (row) => !row.clusterAble,
|
|
1396
|
+
rowKeyGetter,
|
|
1397
|
+
useHook
|
|
1398
|
+
}),
|
|
1399
|
+
cellClass: "rdg-cell-align-center",
|
|
1400
|
+
headerRenderer: (p) => /* @__PURE__ */ jsx(Tooltip, {
|
|
1401
|
+
title: getLabel(MAP_DICCTIONARY.LABEL_LAYER_CLUSTER),
|
|
1402
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
1403
|
+
size: "medium",
|
|
1404
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_CLUSTER}`
|
|
1405
|
+
})
|
|
1406
|
+
})
|
|
1407
|
+
}
|
|
1408
|
+
], [getLabel, useHook]);
|
|
1409
|
+
return {
|
|
1410
|
+
columns
|
|
1411
|
+
};
|
|
1412
|
+
}
|
|
1413
|
+
function useCheckedLayers(checkedNameSet) {
|
|
1414
|
+
const [checkedLayers, setCheckedLayers] = useMapStore((state) => [state[`${checkedNameSet}CheckedLayers`], (newSet) => {
|
|
1415
|
+
state.mapActions.setCheckedLayers(checkedNameSet, newSet);
|
|
1416
|
+
}], shallow);
|
|
1417
|
+
return [checkedLayers, setCheckedLayers];
|
|
1418
|
+
}
|
|
1419
|
+
function useRowActionsGetter() {
|
|
1420
|
+
const {
|
|
1421
|
+
getLabel
|
|
1422
|
+
} = useModuleDictionary();
|
|
1423
|
+
const {
|
|
1424
|
+
hasPrivilege
|
|
1425
|
+
} = useModulePrivileges();
|
|
1426
|
+
const {
|
|
1427
|
+
host_static_assets,
|
|
1428
|
+
environment_assets
|
|
1429
|
+
} = useEnvironment();
|
|
1430
|
+
const {
|
|
1431
|
+
removeLayer
|
|
1432
|
+
} = useMapStore((state) => state.mapActions, shallow);
|
|
1433
|
+
const [urlIconDelete] = useState(`${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_LAYER_DELETE}`);
|
|
1434
|
+
const onDelete = useCallback((row) => {
|
|
1435
|
+
removeLayer(row.id);
|
|
1436
|
+
}, [getLabel]);
|
|
1437
|
+
const rowActionsGetter = useCallback((row) => {
|
|
1438
|
+
const conditionalItems = [];
|
|
1439
|
+
conditionalItems.push({
|
|
1440
|
+
urlIcon: urlIconDelete,
|
|
1441
|
+
dictionaryId: MAP_DICCTIONARY.ROW_ACTION_LAYER_DELETE,
|
|
1442
|
+
onClick: () => {
|
|
1443
|
+
onDelete(row);
|
|
1444
|
+
},
|
|
1445
|
+
disabled: !row.deleteAble
|
|
1446
|
+
});
|
|
1447
|
+
return conditionalItems;
|
|
1448
|
+
}, [hasPrivilege, onDelete, urlIconDelete]);
|
|
1449
|
+
return {
|
|
1450
|
+
rowActionsGetter
|
|
1451
|
+
};
|
|
1452
|
+
}
|
|
1453
|
+
function useMaster() {
|
|
1454
|
+
const [hashLayers, layersIds] = useMapStore((state) => [state.hashLayers, state.layersIds], shallow);
|
|
1455
|
+
const rowKeyGetter = useCallback((row) => row.id, []);
|
|
1456
|
+
const [visibleLayers, setVisibleLayers] = useCheckedLayers("visible");
|
|
1457
|
+
const [autoFocusLayers, setAutoFocusLayers] = useCheckedLayers("autoFocus");
|
|
1458
|
+
const [clusterLayers, setClusterLayers] = useCheckedLayers("cluster");
|
|
1459
|
+
const rows = useMemo(() => {
|
|
1460
|
+
const rows2 = [];
|
|
1461
|
+
layersIds.forEach((layerId) => {
|
|
1462
|
+
if (hashLayers[layerId]) {
|
|
1463
|
+
rows2.push({
|
|
1464
|
+
id: layerId,
|
|
1465
|
+
name: hashLayers[layerId].name || `*${layerId}`,
|
|
1466
|
+
active: hashLayers[layerId].visible,
|
|
1467
|
+
clusterAble: hashLayers[layerId].clusterAble || false,
|
|
1468
|
+
deleteAble: hashLayers[layerId].deleteAble || false
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
});
|
|
1472
|
+
return rows2;
|
|
1473
|
+
}, [hashLayers, layersIds]);
|
|
1474
|
+
const {
|
|
1475
|
+
rowActionsGetter
|
|
1476
|
+
} = useRowActionsGetter();
|
|
1477
|
+
const {
|
|
1478
|
+
columns
|
|
1479
|
+
} = useColumns({
|
|
1480
|
+
rowKeyGetter,
|
|
1481
|
+
visibleLayers,
|
|
1482
|
+
setVisibleLayers,
|
|
1483
|
+
autoFocusLayers,
|
|
1484
|
+
setAutoFocusLayers,
|
|
1485
|
+
clusterLayers,
|
|
1486
|
+
setClusterLayers
|
|
1487
|
+
});
|
|
1488
|
+
return {
|
|
1489
|
+
rowKeyGetter,
|
|
1490
|
+
columns,
|
|
1491
|
+
rows,
|
|
1492
|
+
checkedRows: visibleLayers,
|
|
1493
|
+
onCheckedRowsChange: setVisibleLayers,
|
|
1494
|
+
rowActionsGetter
|
|
1495
|
+
};
|
|
1496
|
+
}
|
|
1497
|
+
function useDisableZoomEvents(node) {
|
|
1498
|
+
const map = useMap();
|
|
1499
|
+
useEffect(() => {
|
|
1500
|
+
if (!map || !node)
|
|
1501
|
+
return;
|
|
1502
|
+
node.addEventListener("mouseover", function() {
|
|
1503
|
+
console.log("Desactivar zoom");
|
|
1504
|
+
map.doubleClickZoom.disable();
|
|
1505
|
+
map.scrollWheelZoom.disable();
|
|
1506
|
+
});
|
|
1507
|
+
node.addEventListener("mouseleave", function() {
|
|
1508
|
+
console.log("Activar zoom");
|
|
1509
|
+
map.scrollWheelZoom.enable();
|
|
1510
|
+
map.doubleClickZoom.enable();
|
|
1511
|
+
});
|
|
1512
|
+
}, [map, node]);
|
|
1513
|
+
}
|
|
1514
|
+
function LayersTool() {
|
|
1515
|
+
const {
|
|
1516
|
+
columns,
|
|
1517
|
+
rows,
|
|
1518
|
+
rowKeyGetter,
|
|
1519
|
+
rowActionsGetter
|
|
1520
|
+
} = useMaster();
|
|
1521
|
+
const [divRef, setDivRef] = useStateRef(null);
|
|
1522
|
+
useDisableZoomEvents(divRef);
|
|
1523
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1524
|
+
ref: setDivRef,
|
|
1525
|
+
style: {
|
|
1526
|
+
position: "relative",
|
|
1527
|
+
height: "100%"
|
|
1528
|
+
},
|
|
1529
|
+
children: /* @__PURE__ */ jsx(DataGrid, {
|
|
1530
|
+
id: "layers",
|
|
1531
|
+
columns,
|
|
1532
|
+
rows,
|
|
1533
|
+
rowActionsGetter,
|
|
1534
|
+
rowKeyGetter,
|
|
1535
|
+
withActions: true,
|
|
1536
|
+
actionsProps: {
|
|
1537
|
+
withRowsCount: false,
|
|
1538
|
+
withSettings: false,
|
|
1539
|
+
withPager: false,
|
|
1540
|
+
withLocalFilters: false
|
|
1541
|
+
}
|
|
1542
|
+
})
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1545
|
+
function MapSourcesTool() {
|
|
1546
|
+
const {
|
|
1547
|
+
getLabel
|
|
1548
|
+
} = useModuleDictionary();
|
|
1549
|
+
const {
|
|
1550
|
+
host_static_assets,
|
|
1551
|
+
environment_assets
|
|
1552
|
+
} = useEnvironment();
|
|
1553
|
+
const currentMapSourceId = useMapStore((state) => state.currentMapSourceId, shallow);
|
|
1554
|
+
const mapSources = useMapStore((state) => {
|
|
1555
|
+
return state.mapSourcesIds.map((id) => ({
|
|
1556
|
+
id,
|
|
1557
|
+
dictionaryId: state.hashMapSources[id].dictionaryId,
|
|
1558
|
+
iconUrl: state.hashMapSources[id].iconUrl,
|
|
1559
|
+
hasBicyclingLayer: state.hashMapSources[id].hasBicyclingLayer,
|
|
1560
|
+
hasTrafficLayer: state.hashMapSources[id].hasTrafficLayer,
|
|
1561
|
+
hasTransitLayer: state.hashMapSources[id].hasTransitLayer,
|
|
1562
|
+
roadSeletedOptions: state.hashMapSources[id].roadSelectedOptions
|
|
1563
|
+
}));
|
|
1564
|
+
}, shallow);
|
|
1565
|
+
const {
|
|
1566
|
+
setCurrentMapSource,
|
|
1567
|
+
setMapSourceRoadOptions: setMapSourceRoadMapOptions
|
|
1568
|
+
} = useMapStore((state) => state.mapActions, shallow);
|
|
1569
|
+
const [divRef, setDivRef] = useStateRef(null);
|
|
1570
|
+
useDisableZoomEvents(divRef);
|
|
1571
|
+
const handleChange = (event) => {
|
|
1572
|
+
setCurrentMapSource(event.target.value);
|
|
1573
|
+
};
|
|
1574
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1575
|
+
className: mapClasses.mapSourcesRoot,
|
|
1576
|
+
ref: setDivRef,
|
|
1577
|
+
children: /* @__PURE__ */ jsx(FormControl, {
|
|
1578
|
+
children: /* @__PURE__ */ jsx(RadioGroup, {
|
|
1579
|
+
"aria-labelledby": "demo-controlled-radio-buttons-group",
|
|
1580
|
+
name: "controlled-radio-buttons-group",
|
|
1581
|
+
value: currentMapSourceId,
|
|
1582
|
+
onChange: handleChange,
|
|
1583
|
+
children: mapSources.map((mapSourceOption) => /* @__PURE__ */ jsxs("div", {
|
|
1584
|
+
className: mapClasses.mapSourcesOption,
|
|
1585
|
+
children: [/* @__PURE__ */ jsx(FormControlLabel, {
|
|
1586
|
+
className: "",
|
|
1587
|
+
value: mapSourceOption.id,
|
|
1588
|
+
control: /* @__PURE__ */ jsx(Radio, {}),
|
|
1589
|
+
label: /* @__PURE__ */ jsxs("div", {
|
|
1590
|
+
className: mapClasses.mapSourcesOptionIconLabel,
|
|
1591
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
1592
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${mapSourceOption.iconUrl}`
|
|
1593
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1594
|
+
children: getLabel(mapSourceOption.dictionaryId)
|
|
1595
|
+
})]
|
|
1596
|
+
})
|
|
1597
|
+
}), (mapSourceOption.hasBicyclingLayer || mapSourceOption.hasTrafficLayer || mapSourceOption.hasTransitLayer) && /* @__PURE__ */ jsxs("div", {
|
|
1598
|
+
className: clsx(mapClasses.mapSourcesOptionRoadOptions, currentMapSourceId !== mapSourceOption.id ? mapClasses.disabled : mapClasses.active),
|
|
1599
|
+
children: [mapSourceOption.hasTrafficLayer && /* @__PURE__ */ jsxs("div", {
|
|
1600
|
+
className: mapClasses.mapSourcesOptionRoadOptionsCheck,
|
|
1601
|
+
children: [/* @__PURE__ */ jsx(CheckBox, {
|
|
1602
|
+
disabled: currentMapSourceId !== mapSourceOption.id,
|
|
1603
|
+
checked: mapSourceOption.roadSeletedOptions?.trafficLayer || false,
|
|
1604
|
+
onChange: (e, checked) => {
|
|
1605
|
+
setMapSourceRoadMapOptions({
|
|
1606
|
+
trafficLayer: checked
|
|
1607
|
+
});
|
|
1608
|
+
}
|
|
1609
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
1610
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_SOURCE_ROAD_TRAFFIC}`
|
|
1611
|
+
})]
|
|
1612
|
+
}), mapSourceOption.hasTransitLayer && /* @__PURE__ */ jsxs("div", {
|
|
1613
|
+
className: mapClasses.mapSourcesOptionRoadOptionsCheck,
|
|
1614
|
+
children: [/* @__PURE__ */ jsx(CheckBox, {
|
|
1615
|
+
disabled: currentMapSourceId !== mapSourceOption.id,
|
|
1616
|
+
checked: mapSourceOption.roadSeletedOptions?.transitLayer || false,
|
|
1617
|
+
onChange: (e, checked) => {
|
|
1618
|
+
setMapSourceRoadMapOptions({
|
|
1619
|
+
transitLayer: checked
|
|
1620
|
+
});
|
|
1621
|
+
}
|
|
1622
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
1623
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_SOURCE_ROAD_TRANSIT}`
|
|
1624
|
+
})]
|
|
1625
|
+
}), mapSourceOption.hasBicyclingLayer && /* @__PURE__ */ jsxs("div", {
|
|
1626
|
+
className: mapClasses.mapSourcesOptionRoadOptionsCheck,
|
|
1627
|
+
children: [/* @__PURE__ */ jsx(CheckBox, {
|
|
1628
|
+
disabled: currentMapSourceId !== mapSourceOption.id,
|
|
1629
|
+
checked: mapSourceOption.roadSeletedOptions?.bicyclingLayer || false,
|
|
1630
|
+
label: "Bycicle",
|
|
1631
|
+
onChange: (e, checked) => {
|
|
1632
|
+
setMapSourceRoadMapOptions({
|
|
1633
|
+
bicyclingLayer: checked
|
|
1634
|
+
});
|
|
1635
|
+
}
|
|
1636
|
+
}), /* @__PURE__ */ jsx(Icon, {
|
|
1637
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${MAP_ICONS.MAP_SOURCE_ROAD_BICYCLING}`
|
|
1638
|
+
})]
|
|
1639
|
+
})]
|
|
1640
|
+
})]
|
|
1641
|
+
}, mapSourceOption.dictionaryId))
|
|
1642
|
+
})
|
|
1643
|
+
})
|
|
1644
|
+
});
|
|
1645
|
+
}
|
|
1646
|
+
function LayersButton(props) {
|
|
1647
|
+
const {
|
|
1648
|
+
type
|
|
1649
|
+
} = props;
|
|
1650
|
+
const [open, setOpen] = useState(null);
|
|
1651
|
+
const {
|
|
1652
|
+
host_static_assets,
|
|
1653
|
+
environment_assets
|
|
1654
|
+
} = useEnvironment();
|
|
1655
|
+
const theme = useTheme();
|
|
1656
|
+
const handleOpen = (event) => {
|
|
1657
|
+
setOpen(event.currentTarget);
|
|
1658
|
+
console.log("open", event.currentTarget);
|
|
1659
|
+
};
|
|
1660
|
+
const handleClose = () => {
|
|
1661
|
+
setOpen(null);
|
|
1662
|
+
};
|
|
1663
|
+
return /* @__PURE__ */ jsxs(React__default.Fragment, {
|
|
1664
|
+
children: [/* @__PURE__ */ jsx(IconButton, {
|
|
1665
|
+
onClick: handleOpen,
|
|
1666
|
+
src: `${host_static_assets}/${environment_assets}/frontend/components/map/assets/icons/${type === "MapSources" ? MAP_ICONS.MAP_SOURCES_TOOL : MAP_ICONS.MAP_LAYERS_TOOL}`
|
|
1667
|
+
}), /* @__PURE__ */ jsx(Popover, {
|
|
1668
|
+
className: type === "MapSources" ? mapClasses.mapSourcesPopoverRoot : mapClasses.layersPopoverRoot,
|
|
1669
|
+
arrowType: "no-arrow",
|
|
1670
|
+
open: Boolean(open),
|
|
1671
|
+
anchorEl: open,
|
|
1672
|
+
anchorOrigin: {
|
|
1673
|
+
vertical: "bottom",
|
|
1674
|
+
horizontal: "left"
|
|
1675
|
+
},
|
|
1676
|
+
onClose: handleClose,
|
|
1677
|
+
sx: {
|
|
1678
|
+
...type === "MapSources" ? theme.components?.M4LMapMapSources?.styleOverrides : theme.components?.M4LMapLayers?.styleOverrides
|
|
1679
|
+
},
|
|
1680
|
+
disableAutoFocus: true,
|
|
1681
|
+
disableRestoreFocus: true,
|
|
1682
|
+
disableEnforceFocus: true,
|
|
1683
|
+
children: type === "MapSources" ? /* @__PURE__ */ jsx(MapSourcesTool, {}) : /* @__PURE__ */ jsx(LayersTool, {})
|
|
1684
|
+
})]
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
function TopLeftTools() {
|
|
1688
|
+
return /* @__PURE__ */ jsxs(Control, {
|
|
1689
|
+
position: "topleft",
|
|
1690
|
+
prepend: true,
|
|
1691
|
+
className: mapClasses.topLeftToolsRoot,
|
|
1692
|
+
children: [/* @__PURE__ */ jsx(LayersButton, {
|
|
1693
|
+
type: "MapSources"
|
|
1694
|
+
}), /* @__PURE__ */ jsx(LayersButton, {
|
|
1695
|
+
type: "Layers"
|
|
1696
|
+
})]
|
|
1697
|
+
});
|
|
1698
|
+
}
|
|
1699
|
+
function Controls(props) {
|
|
1700
|
+
const {
|
|
1701
|
+
gpsTools
|
|
1702
|
+
} = props;
|
|
1703
|
+
const map = useMap();
|
|
1704
|
+
const [controlContainer, setControlContainer] = useState(null);
|
|
1705
|
+
useEffect(() => {
|
|
1706
|
+
const cContainer = map.getContainer().getElementsByClassName("leaflet-control-container")[0];
|
|
1707
|
+
if (cContainer !== null) {
|
|
1708
|
+
setControlContainer(cContainer);
|
|
1709
|
+
L__default.DomEvent.disableClickPropagation(cContainer);
|
|
1710
|
+
L__default.DomEvent.disableScrollPropagation(cContainer);
|
|
1711
|
+
}
|
|
1712
|
+
}, [map]);
|
|
1713
|
+
return /* @__PURE__ */ jsxs(PopupsProvider, {
|
|
1714
|
+
children: [/* @__PURE__ */ jsx(TopLeftTools, {}), /* @__PURE__ */ jsx(TopRightTools, {
|
|
1715
|
+
gpsTools
|
|
1716
|
+
}), controlContainer && createPortal(/* @__PURE__ */ jsx(PopupsViewer, {
|
|
1717
|
+
containerElement: map.getContainer()
|
|
1718
|
+
}), controlContainer)]
|
|
1719
|
+
});
|
|
1720
|
+
}
|
|
1721
|
+
const MarkerClusterGroup = createPathComponent(({
|
|
1722
|
+
children: _c,
|
|
1723
|
+
...props
|
|
1724
|
+
}, ctx) => {
|
|
1725
|
+
const clusterProps = {};
|
|
1726
|
+
const clusterEvents = {};
|
|
1727
|
+
Object.entries(props).forEach(([propName, prop]) => {
|
|
1728
|
+
if (propName !== void 0 && prop !== "") {
|
|
1729
|
+
propName.startsWith("on") ? clusterEvents[propName] = prop : clusterProps[propName] = prop;
|
|
1730
|
+
}
|
|
1731
|
+
});
|
|
1732
|
+
const markerClusterGroup = new L__default.MarkerClusterGroup(clusterProps);
|
|
1733
|
+
Object.entries(clusterEvents).forEach(([eventAsProp, callback]) => {
|
|
1734
|
+
const clusterEvent = `cluster${eventAsProp.substring(2).toLowerCase()}`;
|
|
1735
|
+
markerClusterGroup.on(clusterEvent, callback);
|
|
1736
|
+
});
|
|
1737
|
+
return {
|
|
1738
|
+
instance: markerClusterGroup,
|
|
1739
|
+
context: {
|
|
1740
|
+
...ctx,
|
|
1741
|
+
layerContainer: markerClusterGroup
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
});
|
|
1745
|
+
const RenderByEachFeatureComponent = ({
|
|
1746
|
+
renderFeature,
|
|
1747
|
+
...props
|
|
1748
|
+
}) => {
|
|
1749
|
+
const feature = renderFeature(props);
|
|
1750
|
+
return feature ? /* @__PURE__ */ jsx(Fragment, {
|
|
1751
|
+
children: feature
|
|
1752
|
+
}) : null;
|
|
1753
|
+
};
|
|
1754
|
+
const MemonizedRenderByEachFeatureComponent = React__default.memo(RenderByEachFeatureComponent);
|
|
1755
|
+
const MyLayer = (props) => {
|
|
1756
|
+
const {
|
|
1757
|
+
layerId
|
|
1758
|
+
} = props;
|
|
1759
|
+
const map = useMap();
|
|
1760
|
+
const popupRef = useRef(null);
|
|
1761
|
+
const lefaletLayerRef = useRef({
|
|
1762
|
+
clickTimeout: null,
|
|
1763
|
+
clickCount: 0,
|
|
1764
|
+
handleClickSetted: false
|
|
1765
|
+
});
|
|
1766
|
+
const featureIdOrCollection = useMapStore((state) => {
|
|
1767
|
+
const geoJsonObject = state.hashLayers[layerId]?.geoJsonObject;
|
|
1768
|
+
if (geoJsonObject && geoJsonObject.object.type === "Feature") {
|
|
1769
|
+
return geoJsonObject.object.id;
|
|
1770
|
+
} else if (geoJsonObject && geoJsonObject.object.type === "FeatureCollection") {
|
|
1771
|
+
return geoJsonObject && geoJsonObject.object.features.map((feature) => feature.id);
|
|
1772
|
+
}
|
|
1773
|
+
}, shallow);
|
|
1774
|
+
const renderFeature = useMapStore((state) => state.hashLayers[layerId]?.renderFeature, shallow);
|
|
1775
|
+
const [visible, cluster = false] = useMapStore((state) => [state.hashLayers[layerId]?.visible, state.hashLayers[layerId]?.cluster], shallow);
|
|
1776
|
+
const markerClusterGroupRef = useRef(null);
|
|
1777
|
+
const handleClick = (a) => {
|
|
1778
|
+
lefaletLayerRef.current.clickCount++;
|
|
1779
|
+
if (lefaletLayerRef.current.clickCount === 1) {
|
|
1780
|
+
lefaletLayerRef.current.clickTimeout = setTimeout(() => {
|
|
1781
|
+
console.log("cluster clicked", a, popupRef.current);
|
|
1782
|
+
const cluster2 = a.propagatedFrom;
|
|
1783
|
+
if (cluster2 && cluster2 instanceof L__default.MarkerCluster) {
|
|
1784
|
+
const childMarkers = cluster2.getAllChildMarkers();
|
|
1785
|
+
console.log("Markers in this cluster: ", childMarkers);
|
|
1786
|
+
}
|
|
1787
|
+
if (!popupRef.current) {
|
|
1788
|
+
popupRef.current = L__default.popup().setLatLng(a.sourceTarget._cLatLng).setContent("Hello, World!");
|
|
1789
|
+
map.addLayer(popupRef.current);
|
|
1790
|
+
} else {
|
|
1791
|
+
popupRef.current.openOn(map);
|
|
1792
|
+
}
|
|
1793
|
+
lefaletLayerRef.current.clickCount = 0;
|
|
1794
|
+
}, TIME_DOUBLE_CLICK);
|
|
1795
|
+
} else if (lefaletLayerRef.current.clickCount === 2) {
|
|
1796
|
+
clearTimeout(lefaletLayerRef.current.clickTimeout);
|
|
1797
|
+
console.log("Double click");
|
|
1798
|
+
lefaletLayerRef.current.clickCount = 0;
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
useEffect(() => {
|
|
1802
|
+
if (markerClusterGroupRef.current) {
|
|
1803
|
+
markerClusterGroupRef.current.on("clusterclick", handleClick);
|
|
1804
|
+
}
|
|
1805
|
+
}, [markerClusterGroupRef.current]);
|
|
1806
|
+
console.log("Render MyLayer", layerId, featureIdOrCollection, visible, cluster);
|
|
1807
|
+
if (!featureIdOrCollection || !renderFeature) {
|
|
1808
|
+
return null;
|
|
1809
|
+
}
|
|
1810
|
+
if (visible === false) {
|
|
1811
|
+
return null;
|
|
1812
|
+
}
|
|
1813
|
+
const isFeaturCollection = Array.isArray(featureIdOrCollection);
|
|
1814
|
+
if (!isFeaturCollection) {
|
|
1815
|
+
return /* @__PURE__ */ jsx(RenderByEachFeatureComponent, {
|
|
1816
|
+
renderFeature,
|
|
1817
|
+
id: featureIdOrCollection,
|
|
1818
|
+
layerId
|
|
1819
|
+
});
|
|
1820
|
+
} else {
|
|
1821
|
+
const createClusterCustomIcon = (cluster2) => {
|
|
1822
|
+
var childCount = cluster2.getChildCount();
|
|
1823
|
+
var c = " marker-cluster-";
|
|
1824
|
+
if (childCount < 10) {
|
|
1825
|
+
c += "small";
|
|
1826
|
+
} else if (childCount < 100) {
|
|
1827
|
+
c += "medium";
|
|
1828
|
+
} else {
|
|
1829
|
+
c += "large";
|
|
1830
|
+
}
|
|
1831
|
+
const DivIcon2 = new L__default.DivIcon({
|
|
1832
|
+
html: "<div><span>" + childCount + "</span></div>",
|
|
1833
|
+
className: "marker-cluster" + c,
|
|
1834
|
+
iconSize: new L__default.Point(40, 40)
|
|
1835
|
+
});
|
|
1836
|
+
return DivIcon2;
|
|
1837
|
+
};
|
|
1838
|
+
if (!cluster) {
|
|
1839
|
+
return /* @__PURE__ */ jsx(LayerGroup, {
|
|
1840
|
+
children: featureIdOrCollection.map((featureId) => {
|
|
1841
|
+
return /* @__PURE__ */ jsx(MemonizedRenderByEachFeatureComponent, {
|
|
1842
|
+
renderFeature,
|
|
1843
|
+
id: featureId,
|
|
1844
|
+
layerId
|
|
1845
|
+
}, `k_${featureId}`);
|
|
1846
|
+
})
|
|
1847
|
+
});
|
|
1848
|
+
} else {
|
|
1849
|
+
return /* @__PURE__ */ jsx(
|
|
1850
|
+
MarkerClusterGroup,
|
|
1851
|
+
{
|
|
1852
|
+
disableClusteringAtZoom: 18,
|
|
1853
|
+
showCoverageOnHover: false,
|
|
1854
|
+
zoomToBoundsOnClick: false,
|
|
1855
|
+
spiderfyOnMaxZoom: false,
|
|
1856
|
+
iconCreateFunction: createClusterCustomIcon,
|
|
1857
|
+
children: featureIdOrCollection.map((featureId) => {
|
|
1858
|
+
return /* @__PURE__ */ jsx(MemonizedRenderByEachFeatureComponent, {
|
|
1859
|
+
renderFeature,
|
|
1860
|
+
id: featureId,
|
|
1861
|
+
layerId
|
|
1862
|
+
}, `k_${featureId}`);
|
|
1863
|
+
})
|
|
1864
|
+
}
|
|
1865
|
+
);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
};
|
|
1869
|
+
function useAutoFocus() {
|
|
1870
|
+
const map = useMap();
|
|
1871
|
+
const layerWithAutoFocus = useMapStore((state) => {
|
|
1872
|
+
return state.layersIds.filter((lId) => {
|
|
1873
|
+
if (state.hashLayers[lId].autoFocus && state.hashLayers[lId].visible) {
|
|
1874
|
+
return true;
|
|
1875
|
+
}
|
|
1876
|
+
return false;
|
|
1877
|
+
}).map((layerId) => ({
|
|
1878
|
+
layerId,
|
|
1879
|
+
features: function() {
|
|
1880
|
+
if (state.hashLayers[layerId].geoJsonObject?.object.type === "FeatureCollection") {
|
|
1881
|
+
const layer = state.hashLayers[layerId].geoJsonObject?.object;
|
|
1882
|
+
return layer.features.filter((feature) => feature.layerData !== void 0).map((feature) => ({
|
|
1883
|
+
featureId: feature.id,
|
|
1884
|
+
layerData: feature.layerData
|
|
1885
|
+
}));
|
|
1886
|
+
} else {
|
|
1887
|
+
const feature = state.hashLayers[layerId].geoJsonObject?.object;
|
|
1888
|
+
if (feature.layerData !== void 0) {
|
|
1889
|
+
return [{
|
|
1890
|
+
featureId: feature.id,
|
|
1891
|
+
layerData: feature.layerData
|
|
1892
|
+
}];
|
|
1893
|
+
}
|
|
1894
|
+
}
|
|
1895
|
+
return [];
|
|
1896
|
+
}()
|
|
1897
|
+
}));
|
|
1898
|
+
}, shallow);
|
|
1899
|
+
useEffect(() => {
|
|
1900
|
+
const proccesLayerWithAutoFocus = (layersFoucus) => {
|
|
1901
|
+
const layersToFitBounds = [];
|
|
1902
|
+
for (const layerWhitFeatures of layersFoucus) {
|
|
1903
|
+
const features = layerWhitFeatures?.features;
|
|
1904
|
+
for (let i = 0; i < features.length; i++) {
|
|
1905
|
+
const feature = features[i];
|
|
1906
|
+
if (feature.layerData !== void 0) {
|
|
1907
|
+
const featureForBounds = {
|
|
1908
|
+
layerId: layerWhitFeatures.layerId,
|
|
1909
|
+
featureId: feature.featureId,
|
|
1910
|
+
layerData: feature.layerData
|
|
1911
|
+
};
|
|
1912
|
+
layersToFitBounds.push(featureForBounds);
|
|
1913
|
+
} else {
|
|
1914
|
+
console.error(`La capa ${layerWhitFeatures.layerId} no tiene un m\xE9todo getBounds`);
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
if (layersToFitBounds.length > 0) {
|
|
1919
|
+
let featureForBounds = layersToFitBounds[0];
|
|
1920
|
+
let bounds = L__default.latLngBounds(featureForBounds.layerData.boundsNW, featureForBounds.layerData.boundsSE);
|
|
1921
|
+
for (let i = 1; i < layersToFitBounds.length; i++) {
|
|
1922
|
+
featureForBounds = layersToFitBounds[i];
|
|
1923
|
+
const newBounds = L__default.latLngBounds(featureForBounds.layerData.boundsNW, featureForBounds.layerData.boundsSE);
|
|
1924
|
+
bounds = bounds.extend(newBounds);
|
|
1925
|
+
}
|
|
1926
|
+
map.fitBounds(bounds, {
|
|
1927
|
+
animate: false,
|
|
1928
|
+
maxZoom: 22,
|
|
1929
|
+
padding: [50, 50]
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
const throttleBounds = throttle(proccesLayerWithAutoFocus, 300, {
|
|
1934
|
+
leading: false,
|
|
1935
|
+
trailing: true
|
|
1936
|
+
});
|
|
1937
|
+
throttleBounds(layerWithAutoFocus);
|
|
1938
|
+
}, [layerWithAutoFocus]);
|
|
1939
|
+
}
|
|
1940
|
+
const LayersContainer = () => {
|
|
1941
|
+
const layersId = useMapStore((state) => state.layersIds, shallow);
|
|
1942
|
+
const isSkeleton = useMapStore((state) => state.ownerState.isSkeleton, shallow);
|
|
1943
|
+
const map = useMap();
|
|
1944
|
+
useAutoFocus();
|
|
1945
|
+
useEffect(() => {
|
|
1946
|
+
if (!map) {
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
L__default.control.scale().addTo(map);
|
|
1950
|
+
return () => {
|
|
1951
|
+
L__default.control.scale().remove();
|
|
1952
|
+
};
|
|
1953
|
+
}, [map]);
|
|
1954
|
+
if (isSkeleton) {
|
|
1955
|
+
return null;
|
|
1956
|
+
}
|
|
1957
|
+
if (!map) {
|
|
1958
|
+
return null;
|
|
1959
|
+
}
|
|
1960
|
+
return /* @__PURE__ */ jsx(React__default.Fragment, {
|
|
1961
|
+
children: layersId.map((l) => /* @__PURE__ */ jsx(MyLayer, {
|
|
1962
|
+
layerId: l
|
|
1963
|
+
}, l))
|
|
1964
|
+
});
|
|
1965
|
+
};
|
|
1966
|
+
const MapRootContainer = styled(MapContainer)`
|
|
1967
|
+
|
|
1968
|
+
|
|
1969
|
+
|
|
1970
|
+
|
|
1971
|
+
|
|
1972
|
+
|
|
1973
|
+
|
|
1974
|
+
|
|
1975
|
+
|
|
1976
|
+
|
|
1977
|
+
|
|
1978
|
+
|
|
1979
|
+
|
|
1980
|
+
|
|
1981
|
+
|
|
1982
|
+
|
|
1983
|
+
|
|
1984
|
+
|
|
1985
|
+
${leaflet_css}
|
|
1986
|
+
|
|
1987
|
+
${(props) => props.theme.components?.M4LMap?.styleOverrides}
|
|
1988
|
+
|
|
1989
|
+
`;
|
|
1990
|
+
function Map$1(props) {
|
|
1991
|
+
const {
|
|
1992
|
+
gpsTools,
|
|
1993
|
+
center = [6.215749485905093, -75.58622905191254],
|
|
1994
|
+
initalZoom = 16,
|
|
1995
|
+
maxZoom = 22
|
|
1996
|
+
} = props;
|
|
1997
|
+
return /* @__PURE__ */ jsxs(MapRootContainer, {
|
|
1998
|
+
className: mapClasses.root,
|
|
1999
|
+
center,
|
|
2000
|
+
zoom: initalZoom,
|
|
2001
|
+
maxZoom,
|
|
2002
|
+
boxZoom: true,
|
|
2003
|
+
preferCanvas: true,
|
|
2004
|
+
zoomControl: false,
|
|
2005
|
+
children: [/* @__PURE__ */ jsx(TileLayers, {}), /* @__PURE__ */ jsx(LayersContainer, {}), /* @__PURE__ */ jsx(Controls, {
|
|
2006
|
+
gpsTools
|
|
2007
|
+
})]
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
function CustomMarker(props) {
|
|
2011
|
+
const {
|
|
2012
|
+
position,
|
|
2013
|
+
width,
|
|
2014
|
+
height,
|
|
2015
|
+
iconForm,
|
|
2016
|
+
bearing,
|
|
2017
|
+
...other
|
|
2018
|
+
} = props;
|
|
2019
|
+
const html = useMemo(() => {
|
|
2020
|
+
}, [bearing]);
|
|
2021
|
+
const customIcon = useMemo(() => {
|
|
2022
|
+
return L__default.divIcon({
|
|
2023
|
+
className: "custom-icon",
|
|
2024
|
+
iconSize: [width, height],
|
|
2025
|
+
html: `<div>Hola</div>`
|
|
2026
|
+
});
|
|
2027
|
+
}, [html]);
|
|
2028
|
+
return /* @__PURE__ */ jsx(Marker, {
|
|
2029
|
+
position,
|
|
2030
|
+
icon: customIcon,
|
|
2031
|
+
...other
|
|
2032
|
+
});
|
|
2033
|
+
}
|
|
2034
|
+
const MarkerFeatureRender = (props) => {
|
|
2035
|
+
const {
|
|
2036
|
+
id,
|
|
2037
|
+
layerId
|
|
2038
|
+
} = props;
|
|
2039
|
+
const feature = useMapStore((state) => {
|
|
2040
|
+
const gObject = state.hashLayers[layerId].geoJsonObject;
|
|
2041
|
+
if (!gObject) {
|
|
2042
|
+
return null;
|
|
2043
|
+
}
|
|
2044
|
+
if (gObject.object.type === "Feature") {
|
|
2045
|
+
return {
|
|
2046
|
+
id: gObject.object.id,
|
|
2047
|
+
geometry: gObject.object.geometry,
|
|
2048
|
+
properties: gObject.object.properties
|
|
2049
|
+
};
|
|
2050
|
+
} else {
|
|
2051
|
+
const feat = gObject.object.features.find((f) => f.id === id);
|
|
2052
|
+
if (feat) {
|
|
2053
|
+
return {
|
|
2054
|
+
id: feat.id,
|
|
2055
|
+
geometry: feat.geometry,
|
|
2056
|
+
properties: feat.properties
|
|
2057
|
+
};
|
|
2058
|
+
}
|
|
2059
|
+
return null;
|
|
2060
|
+
}
|
|
2061
|
+
}, shallow);
|
|
2062
|
+
if (!feature) {
|
|
2063
|
+
return null;
|
|
2064
|
+
}
|
|
2065
|
+
if (feature.geometry.type === "Point") {
|
|
2066
|
+
const [lat, lng] = feature.geometry.coordinates;
|
|
2067
|
+
const bearing = feature.properties?.iconBearing ?? 0;
|
|
2068
|
+
return /* @__PURE__ */ jsx(CustomMarker, {
|
|
2069
|
+
position: {
|
|
2070
|
+
lat,
|
|
2071
|
+
lng
|
|
2072
|
+
},
|
|
2073
|
+
width: 32,
|
|
2074
|
+
height: 32,
|
|
2075
|
+
bearing,
|
|
2076
|
+
iconForm: "grua",
|
|
2077
|
+
id: feature.id
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
return null;
|
|
2081
|
+
};
|
|
2082
|
+
const PolylineWithArrows = ({
|
|
2083
|
+
positions,
|
|
2084
|
+
enableEdit,
|
|
2085
|
+
...other
|
|
2086
|
+
}) => {
|
|
2087
|
+
const map = useMap();
|
|
2088
|
+
const polylineRef = useRef(null);
|
|
2089
|
+
const decoratorRef = useRef(null);
|
|
2090
|
+
useEffect(() => {
|
|
2091
|
+
if (polylineRef.current) {
|
|
2092
|
+
const decorator = L__default.polylineDecorator(polylineRef.current, {
|
|
2093
|
+
patterns: [{
|
|
2094
|
+
repeat: 50,
|
|
2095
|
+
symbol: L__default.Symbol.arrowHead({
|
|
2096
|
+
pixelSize: 4,
|
|
2097
|
+
polygon: false,
|
|
2098
|
+
pathOptions: {
|
|
2099
|
+
stroke: true,
|
|
2100
|
+
color: "#ffffff",
|
|
2101
|
+
weight: 2
|
|
2102
|
+
}
|
|
2103
|
+
})
|
|
2104
|
+
}]
|
|
2105
|
+
}).addTo(map);
|
|
2106
|
+
decoratorRef.current = decorator;
|
|
2107
|
+
if (enableEdit) {
|
|
2108
|
+
polylineRef.current.pm.enable();
|
|
2109
|
+
} else {
|
|
2110
|
+
polylineRef.current.pm.disable();
|
|
2111
|
+
}
|
|
2112
|
+
polylineRef.current.on("pm:change", () => {
|
|
2113
|
+
if (decoratorRef.current) {
|
|
2114
|
+
map.removeLayer(decoratorRef.current);
|
|
2115
|
+
}
|
|
2116
|
+
if (polylineRef.current) {
|
|
2117
|
+
decoratorRef.current = L__default.polylineDecorator(polylineRef.current, {
|
|
2118
|
+
patterns: [{
|
|
2119
|
+
repeat: 40,
|
|
2120
|
+
symbol: L__default.Symbol.arrowHead({
|
|
2121
|
+
pixelSize: 4,
|
|
2122
|
+
polygon: false,
|
|
2123
|
+
pathOptions: {
|
|
2124
|
+
stroke: true,
|
|
2125
|
+
color: "#cc0000",
|
|
2126
|
+
weight: 2
|
|
2127
|
+
}
|
|
2128
|
+
})
|
|
2129
|
+
}]
|
|
2130
|
+
}).addTo(map);
|
|
2131
|
+
}
|
|
2132
|
+
});
|
|
2133
|
+
return () => {
|
|
2134
|
+
if (decoratorRef.current) {
|
|
2135
|
+
map.removeLayer(decoratorRef.current);
|
|
2136
|
+
}
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
}, [map, enableEdit]);
|
|
2140
|
+
return /* @__PURE__ */ jsx(Polyline, {
|
|
2141
|
+
positions,
|
|
2142
|
+
ref: polylineRef,
|
|
2143
|
+
...other
|
|
2144
|
+
});
|
|
2145
|
+
};
|
|
2146
|
+
const CommonFeatureRender = (props) => {
|
|
2147
|
+
const {
|
|
2148
|
+
id,
|
|
2149
|
+
layerId
|
|
2150
|
+
} = props;
|
|
2151
|
+
const feature = useMapStore((state) => {
|
|
2152
|
+
const gObject = state.hashLayers[layerId].geoJsonObject;
|
|
2153
|
+
if (!gObject) {
|
|
2154
|
+
return null;
|
|
2155
|
+
}
|
|
2156
|
+
if (gObject.object.type === "Feature") {
|
|
2157
|
+
return {
|
|
2158
|
+
id: gObject.object.id,
|
|
2159
|
+
geometry: gObject.object.geometry,
|
|
2160
|
+
properties: gObject.object.properties,
|
|
2161
|
+
featureLabel: gObject.object.featureLabel
|
|
2162
|
+
};
|
|
2163
|
+
} else {
|
|
2164
|
+
const feat = gObject.object.features.find((f) => f.id === id);
|
|
2165
|
+
if (feat) {
|
|
2166
|
+
return {
|
|
2167
|
+
id: feat.id,
|
|
2168
|
+
geometry: feat.geometry,
|
|
2169
|
+
properties: feat.properties,
|
|
2170
|
+
featureLabel: feat.featureLabel
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
return null;
|
|
2174
|
+
}
|
|
2175
|
+
}, shallow);
|
|
2176
|
+
const {
|
|
2177
|
+
addLayerDataToFeature
|
|
2178
|
+
} = useMapStore((state) => state.mapActions, shallow);
|
|
2179
|
+
const [svg, setSvg] = useState(null);
|
|
2180
|
+
useEffect(() => {
|
|
2181
|
+
if (!feature) {
|
|
2182
|
+
return;
|
|
2183
|
+
}
|
|
2184
|
+
if (feature.geometry?.type === "Point" && (feature.properties?.subType === "Marker" || feature.properties?.subType === void 0)) {
|
|
2185
|
+
const {
|
|
2186
|
+
iconUrl,
|
|
2187
|
+
markerColor = MARKER_COLOR_DEFAULT
|
|
2188
|
+
} = feature?.properties;
|
|
2189
|
+
const fetchData = async () => {
|
|
2190
|
+
if (svg && svg.path === iconUrl && svg.color === markerColor) {
|
|
2191
|
+
return;
|
|
2192
|
+
}
|
|
2193
|
+
let data;
|
|
2194
|
+
if (iconUrl) {
|
|
2195
|
+
data = await fetch(iconUrl).then((i) => i.text());
|
|
2196
|
+
}
|
|
2197
|
+
if (!data) {
|
|
2198
|
+
data = SVG_ICON_DEFAULT;
|
|
2199
|
+
}
|
|
2200
|
+
data = "data:image/svg+xml;base64," + btoa((data || "").replace(/#1E96DC/g, markerColor));
|
|
2201
|
+
setSvg({
|
|
2202
|
+
color: markerColor,
|
|
2203
|
+
path: iconUrl,
|
|
2204
|
+
data
|
|
2205
|
+
});
|
|
2206
|
+
};
|
|
2207
|
+
fetchData();
|
|
2208
|
+
}
|
|
2209
|
+
}, [feature]);
|
|
2210
|
+
useEffect(() => {
|
|
2211
|
+
return () => {
|
|
2212
|
+
};
|
|
2213
|
+
}, []);
|
|
2214
|
+
if (!feature) {
|
|
2215
|
+
return null;
|
|
2216
|
+
}
|
|
2217
|
+
const propFeature = {
|
|
2218
|
+
featureId: feature.id
|
|
2219
|
+
};
|
|
2220
|
+
const onAddPointLayer = useCallback((e) => {
|
|
2221
|
+
const layerData = {
|
|
2222
|
+
boundsNW: e.target?._latlng,
|
|
2223
|
+
boundsSE: e.target?._latlng
|
|
2224
|
+
};
|
|
2225
|
+
addLayerDataToFeature(layerId, feature.id, layerData);
|
|
2226
|
+
}, []);
|
|
2227
|
+
const onAddMultipointLayer = useCallback((e) => {
|
|
2228
|
+
const layerData = {
|
|
2229
|
+
boundsNW: e.target.getBounds().getNorthWest(),
|
|
2230
|
+
boundsSE: e.target.getBounds().getSouthEast()
|
|
2231
|
+
};
|
|
2232
|
+
addLayerDataToFeature(layerId, feature.id, layerData);
|
|
2233
|
+
}, []);
|
|
2234
|
+
if (feature.geometry?.type === "Point") {
|
|
2235
|
+
const [lng, lat] = feature.geometry.coordinates;
|
|
2236
|
+
if (feature.properties?.subType === "Marker" || feature.properties?.subType === void 0) {
|
|
2237
|
+
const {
|
|
2238
|
+
iconUrl: urlIcon,
|
|
2239
|
+
iconBearing = 0,
|
|
2240
|
+
iconOffsetRotate = 0,
|
|
2241
|
+
scaleIcon = 1,
|
|
2242
|
+
iconHeight,
|
|
2243
|
+
iconWidth,
|
|
2244
|
+
className,
|
|
2245
|
+
label,
|
|
2246
|
+
markerColor = MARKER_COLOR_DEFAULT,
|
|
2247
|
+
labelBkColor = LABEL_BK_COLOR_DEFAULT,
|
|
2248
|
+
labelColor = LABEL_COLOR_DEFAULT,
|
|
2249
|
+
offsetLeftTop = [42, 0],
|
|
2250
|
+
...styleProperties
|
|
2251
|
+
} = feature.properties;
|
|
2252
|
+
if (urlIcon && !svg) {
|
|
2253
|
+
return null;
|
|
2254
|
+
}
|
|
2255
|
+
return /* @__PURE__ */ jsx(
|
|
2256
|
+
MarkerIconLabel,
|
|
2257
|
+
{
|
|
2258
|
+
position: {
|
|
2259
|
+
lat,
|
|
2260
|
+
lng
|
|
2261
|
+
},
|
|
2262
|
+
label,
|
|
2263
|
+
iconSrc: svg?.data,
|
|
2264
|
+
iconScale: scaleIcon,
|
|
2265
|
+
iconRotate: bearingRawToCSS(iconBearing, iconOffsetRotate),
|
|
2266
|
+
iconWidth,
|
|
2267
|
+
iconHeight,
|
|
2268
|
+
labelBkColor,
|
|
2269
|
+
labelColor,
|
|
2270
|
+
offsetLeftTop,
|
|
2271
|
+
draggable: false,
|
|
2272
|
+
eventHandlers: {
|
|
2273
|
+
add: onAddPointLayer,
|
|
2274
|
+
click: (e) => {
|
|
2275
|
+
}
|
|
2276
|
+
},
|
|
2277
|
+
...styleProperties,
|
|
2278
|
+
...propFeature
|
|
2279
|
+
},
|
|
2280
|
+
Math.random()
|
|
2281
|
+
);
|
|
2282
|
+
} else if (feature.properties?.subType === "Circle" && feature.properties?.radius) {
|
|
2283
|
+
const {
|
|
2284
|
+
subType,
|
|
2285
|
+
radius,
|
|
2286
|
+
...styleProperties
|
|
2287
|
+
} = feature.properties;
|
|
2288
|
+
return /* @__PURE__ */ jsxs(Fragment, {
|
|
2289
|
+
children: [/* @__PURE__ */ jsx(Circle, {
|
|
2290
|
+
center: {
|
|
2291
|
+
lat,
|
|
2292
|
+
lng
|
|
2293
|
+
},
|
|
2294
|
+
radius: feature.properties?.radius,
|
|
2295
|
+
eventHandlers: {
|
|
2296
|
+
add: onAddMultipointLayer
|
|
2297
|
+
},
|
|
2298
|
+
...styleProperties,
|
|
2299
|
+
...propFeature
|
|
2300
|
+
}, Math.random()), feature?.featureLabel && /* @__PURE__ */ jsx(MarkerIconLabel, {
|
|
2301
|
+
position: [lat + feature.properties.radius / 111319, lng],
|
|
2302
|
+
...feature?.featureLabel
|
|
2303
|
+
})]
|
|
2304
|
+
});
|
|
2305
|
+
}
|
|
2306
|
+
} else if (feature.geometry?.type === "LineString") {
|
|
2307
|
+
const polylinePositions = feature.geometry.coordinates.map((coord) => [coord[1], coord[0]]);
|
|
2308
|
+
if (feature.properties?.subType === "PolylineWithArrows") {
|
|
2309
|
+
return /* @__PURE__ */ jsx(
|
|
2310
|
+
PolylineWithArrows,
|
|
2311
|
+
{
|
|
2312
|
+
positions: polylinePositions,
|
|
2313
|
+
stroke: true,
|
|
2314
|
+
weight: 10,
|
|
2315
|
+
eventHandlers: {
|
|
2316
|
+
add: onAddMultipointLayer
|
|
2317
|
+
},
|
|
2318
|
+
dashArray: "20 30",
|
|
2319
|
+
...feature.properties,
|
|
2320
|
+
...propFeature
|
|
2321
|
+
},
|
|
2322
|
+
Math.random()
|
|
2323
|
+
);
|
|
2324
|
+
} else {
|
|
2325
|
+
return /* @__PURE__ */ jsx(
|
|
2326
|
+
Polyline,
|
|
2327
|
+
{
|
|
2328
|
+
positions: polylinePositions,
|
|
2329
|
+
stroke: true,
|
|
2330
|
+
weight: 10,
|
|
2331
|
+
eventHandlers: {
|
|
2332
|
+
add: onAddMultipointLayer
|
|
2333
|
+
},
|
|
2334
|
+
dashArray: "20 30",
|
|
2335
|
+
...feature.properties,
|
|
2336
|
+
...propFeature
|
|
2337
|
+
},
|
|
2338
|
+
Math.random()
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2341
|
+
} else if (feature.geometry?.type === "Polygon") {
|
|
2342
|
+
const polygonPositions = feature.geometry.coordinates.map((ring) => ring.map(([lng, lat]) => [lat, lng]));
|
|
2343
|
+
let topRightPoint = null;
|
|
2344
|
+
polygonPositions[0].forEach((coord) => {
|
|
2345
|
+
console.log("coord", coord);
|
|
2346
|
+
const [lat, lng] = coord;
|
|
2347
|
+
if (!topRightPoint || lat >= topRightPoint[0] && lng >= topRightPoint[1]) {
|
|
2348
|
+
console.log("coord elegida", coord);
|
|
2349
|
+
topRightPoint = coord;
|
|
2350
|
+
}
|
|
2351
|
+
});
|
|
2352
|
+
topRightPoint = topRightPoint || polygonPositions[0][0];
|
|
2353
|
+
console.log("Polygon Render", feature.featureLabel?.label, polygonPositions);
|
|
2354
|
+
return /* @__PURE__ */ jsxs(React__default.Fragment, {
|
|
2355
|
+
children: [/* @__PURE__ */ jsx(
|
|
2356
|
+
Polygon,
|
|
2357
|
+
{
|
|
2358
|
+
positions: polygonPositions,
|
|
2359
|
+
opacity: 1,
|
|
2360
|
+
eventHandlers: {
|
|
2361
|
+
add: onAddMultipointLayer
|
|
2362
|
+
},
|
|
2363
|
+
...feature.properties,
|
|
2364
|
+
...propFeature
|
|
2365
|
+
}
|
|
2366
|
+
), feature?.featureLabel && /* @__PURE__ */ jsx(MarkerIconLabel, {
|
|
2367
|
+
position: topRightPoint,
|
|
2368
|
+
...feature?.featureLabel
|
|
2369
|
+
})]
|
|
2370
|
+
});
|
|
2371
|
+
}
|
|
2372
|
+
return null;
|
|
2373
|
+
};
|
|
2374
|
+
export {
|
|
2375
|
+
CommonFeatureRender as C,
|
|
2376
|
+
LABEL_BK_COLOR_DEFAULT as L,
|
|
2377
|
+
MAP_ZINDEX_OVER_MAP as M,
|
|
2378
|
+
LABEL_COLOR_DEFAULT as a,
|
|
2379
|
+
MAP_DICCTIONARY as b,
|
|
2380
|
+
Map$1 as c,
|
|
2381
|
+
MapProvider as d,
|
|
2382
|
+
MapContext as e,
|
|
2383
|
+
MarkerFeatureRender as f,
|
|
2384
|
+
mapClasses as m,
|
|
2385
|
+
useMapStore as u
|
|
2386
|
+
};
|