@vaadin/bundles 25.0.0-alpha3 → 25.0.0-alpha5
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/node_modules_ol_ImageCanvas_js.js +76 -83
- package/node_modules_ol_ImageCanvas_js.js.map +1 -1
- package/node_modules_ol_TileRange_js.js +128 -110
- package/node_modules_ol_TileRange_js.js.map +1 -1
- package/node_modules_ol_Tile_js.js +279 -0
- package/node_modules_ol_Tile_js.js.map +1 -0
- package/node_modules_ol_VectorRenderTile_js.js +428 -143
- package/node_modules_ol_VectorRenderTile_js.js.map +1 -1
- package/node_modules_ol_VectorTile_js.js +405 -119
- package/node_modules_ol_VectorTile_js.js.map +1 -1
- package/node_modules_ol_control_MousePosition_js.js +327 -0
- package/node_modules_ol_control_MousePosition_js.js.map +1 -0
- package/node_modules_ol_control_ZoomToExtent_js.js +118 -0
- package/node_modules_ol_control_ZoomToExtent_js.js.map +1 -0
- package/node_modules_ol_events_SnapEvent_js.js +79 -0
- package/node_modules_ol_events_SnapEvent_js.js.map +1 -0
- package/node_modules_ol_featureloader_js.js +205 -0
- package/node_modules_ol_featureloader_js.js.map +1 -0
- package/node_modules_ol_geom_Circle_js.js +300 -0
- package/node_modules_ol_geom_Circle_js.js.map +1 -0
- package/node_modules_ol_geom_GeometryCollection_js.js +369 -0
- package/node_modules_ol_geom_GeometryCollection_js.js.map +1 -0
- package/node_modules_ol_geom_MultiPoint_js.js +228 -0
- package/node_modules_ol_geom_MultiPoint_js.js.map +1 -0
- package/node_modules_ol_geom_flat_center_js.js +47 -0
- package/node_modules_ol_geom_flat_center_js.js.map +1 -0
- package/node_modules_ol_geom_flat_geodesic_js.js +123 -88
- package/node_modules_ol_geom_flat_geodesic_js.js.map +1 -1
- package/node_modules_ol_geom_flat_interpolate_js.js +230 -0
- package/node_modules_ol_geom_flat_interpolate_js.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a0.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a0.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a1.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a1.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a2.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a2.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a3.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a3.js.map +1 -0
- package/node_modules_ol_geom_flat_length_js-_375a4.js +58 -0
- package/node_modules_ol_geom_flat_length_js-_375a4.js.map +1 -0
- package/node_modules_ol_geom_flat_linechunk_js.js +76 -0
- package/node_modules_ol_geom_flat_linechunk_js.js.map +1 -0
- package/node_modules_ol_geom_flat_straightchunk_js.js +68 -0
- package/node_modules_ol_geom_flat_straightchunk_js.js.map +1 -0
- package/node_modules_ol_geom_flat_textpath_js.js +178 -0
- package/node_modules_ol_geom_flat_textpath_js.js.map +1 -0
- package/node_modules_ol_interaction_DblClickDragZoom_js.js +285 -0
- package/node_modules_ol_interaction_DblClickDragZoom_js.js.map +1 -0
- package/node_modules_ol_interaction_DragAndDrop_js.js +351 -0
- package/node_modules_ol_interaction_DragAndDrop_js.js.map +1 -0
- package/node_modules_ol_interaction_DragRotateAndZoom_js.js +159 -0
- package/node_modules_ol_interaction_DragRotateAndZoom_js.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49290.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49290.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49291.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49291.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49292.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49292.js.map +1 -0
- package/node_modules_ol_layer_Vector_js-_49293.js +110 -0
- package/node_modules_ol_layer_Vector_js-_49293.js.map +1 -0
- package/node_modules_ol_loadingstrategy_js.js +95 -0
- package/node_modules_ol_loadingstrategy_js.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-_3ad60.js +144 -0
- package/node_modules_ol_render_VectorContext_js-_3ad60.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-_3ad61.js +144 -0
- package/node_modules_ol_render_VectorContext_js-_3ad61.js.map +1 -0
- package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js +372 -0
- package/node_modules_ol_render_VectorContext_js-node_modules_ol_render_canvas_hitdetect_js.js.map +1 -0
- package/node_modules_ol_render_canvas_ImageBuilder_js.js +318 -0
- package/node_modules_ol_render_canvas_ImageBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_Instruction_js.js +66 -0
- package/node_modules_ol_render_canvas_Instruction_js.js.map +1 -0
- package/node_modules_ol_render_canvas_LineStringBuilder_js.js +187 -0
- package/node_modules_ol_render_canvas_LineStringBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_PolygonBuilder_js.js +276 -0
- package/node_modules_ol_render_canvas_PolygonBuilder_js.js.map +1 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js +156 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab20.js.map +1 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js +156 -0
- package/node_modules_ol_render_canvas_ZIndexContext_js-_fab21.js.map +1 -0
- package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js +301 -0
- package/node_modules_ol_render_js-node_modules_ol_render_VectorContext_js.js.map +1 -0
- package/node_modules_ol_renderer_Layer_js.js +219 -0
- package/node_modules_ol_renderer_Layer_js.js.map +1 -0
- package/node_modules_ol_source_Source_js.js +256 -0
- package/node_modules_ol_source_Source_js.js.map +1 -0
- package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js +318 -0
- package/node_modules_ol_source_VectorEventType_js-node_modules_ol_structs_RBush_js.js.map +1 -0
- package/node_modules_ol_source_VectorEventType_js.js +80 -0
- package/node_modules_ol_source_VectorEventType_js.js.map +1 -0
- package/node_modules_ol_structs_RBush_js.js +242 -0
- package/node_modules_ol_structs_RBush_js.js.map +1 -0
- package/node_modules_ol_style_js.js +2 -1
- package/node_modules_ol_style_js.js.map +1 -1
- package/node_modules_rbush_rbush_min_js.js +16 -0
- package/node_modules_rbush_rbush_min_js.js.map +1 -0
- package/package.json +142 -146
- package/vaadin-bundle.json +2447 -2352
- package/vaadin.js +52246 -63791
- package/vaadin.js.map +1 -1
- package/vendors-node_modules_dompurify_dist_purify_es_mjs.js +1364 -0
- package/vendors-node_modules_dompurify_dist_purify_es_mjs.js.map +1 -0
- package/vendors-node_modules_dompurify_dist_purify_js.js +26 -21
- package/vendors-node_modules_dompurify_dist_purify_js.js.map +1 -1
- package/vendors-node_modules_marked_lib_marked_esm_js.js +2205 -0
- package/vendors-node_modules_marked_lib_marked_esm_js.js.map +1 -0
- package/vendors-node_modules_marked_lib_marked_umd_js.js +2164 -2556
- package/vendors-node_modules_marked_lib_marked_umd_js.js.map +1 -1
- package/vendors-node_modules_ol_Feature_js.js +360 -0
- package/vendors-node_modules_ol_Feature_js.js.map +1 -0
- package/vendors-node_modules_ol_Geolocation_js.js +352 -293
- package/vendors-node_modules_ol_Geolocation_js.js.map +1 -1
- package/vendors-node_modules_ol_ImageTile_js.js +494 -0
- package/vendors-node_modules_ol_ImageTile_js.js.map +1 -0
- package/vendors-node_modules_ol_Overlay_js.js +606 -0
- package/vendors-node_modules_ol_Overlay_js.js.map +1 -0
- package/vendors-node_modules_ol_control_FullScreen_js.js +417 -0
- package/vendors-node_modules_ol_control_FullScreen_js.js.map +1 -0
- package/vendors-node_modules_ol_control_OverviewMap_js.js +711 -0
- package/vendors-node_modules_ol_control_OverviewMap_js.js.map +1 -0
- package/vendors-node_modules_ol_control_ScaleLine_js.js +509 -0
- package/vendors-node_modules_ol_control_ScaleLine_js.js.map +1 -0
- package/vendors-node_modules_ol_control_ZoomSlider_js.js +418 -0
- package/vendors-node_modules_ol_control_ZoomSlider_js.js.map +1 -0
- package/vendors-node_modules_ol_control_js.js +490 -0
- package/vendors-node_modules_ol_control_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_LineString_js.js +574 -0
- package/vendors-node_modules_ol_geom_LineString_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_MultiLineString_js.js +405 -0
- package/vendors-node_modules_ol_geom_MultiLineString_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_MultiPolygon_js.js +773 -0
- package/vendors-node_modules_ol_geom_MultiPolygon_js.js.map +1 -0
- package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js +769 -0
- package/vendors-node_modules_ol_geom_js-node_modules_ol_geom_flat_length_js.js.map +1 -0
- package/vendors-node_modules_ol_index_js.js +526 -675
- package/vendors-node_modules_ol_index_js.js.map +1 -1
- package/vendors-node_modules_ol_interaction_Draw_js.js +2777 -0
- package/vendors-node_modules_ol_interaction_Draw_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Extent_js.js +586 -0
- package/vendors-node_modules_ol_interaction_Extent_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Link_js.js +489 -0
- package/vendors-node_modules_ol_interaction_Link_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Modify_js.js +1841 -0
- package/vendors-node_modules_ol_interaction_Modify_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Select_js.js +623 -0
- package/vendors-node_modules_ol_interaction_Select_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Snap_js.js +982 -0
- package/vendors-node_modules_ol_interaction_Snap_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_Translate_js.js +466 -0
- package/vendors-node_modules_ol_interaction_Translate_js.js.map +1 -0
- package/vendors-node_modules_ol_interaction_js.js +872 -0
- package/vendors-node_modules_ol_interaction_js.js.map +1 -0
- package/vendors-node_modules_ol_layer_Graticule_js.js +1374 -989
- package/vendors-node_modules_ol_layer_Graticule_js.js.map +1 -1
- package/vendors-node_modules_ol_render_Feature_js.js +546 -0
- package/vendors-node_modules_ol_render_Feature_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js +897 -0
- package/vendors-node_modules_ol_render_canvas_BuilderGroup_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Builder_js.js +907 -0
- package/vendors-node_modules_ol_render_canvas_Builder_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js +539 -0
- package/vendors-node_modules_ol_render_canvas_ExecutorGroup_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Executor_js.js +1715 -0
- package/vendors-node_modules_ol_render_canvas_Executor_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_Immediate_js.js +1208 -0
- package/vendors-node_modules_ol_render_canvas_Immediate_js.js.map +1 -0
- package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js +825 -0
- package/vendors-node_modules_ol_render_canvas_TextBuilder_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_canvas_Layer_js.js +654 -0
- package/vendors-node_modules_ol_renderer_canvas_Layer_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js +1044 -0
- package/vendors-node_modules_ol_renderer_canvas_VectorLayer_js.js.map +1 -0
- package/vendors-node_modules_ol_renderer_vector_js.js +460 -0
- package/vendors-node_modules_ol_renderer_vector_js.js.map +1 -0
- package/vendors-node_modules_ol_source_Vector_js.js +2091 -0
- package/vendors-node_modules_ol_source_Vector_js.js.map +1 -0
- package/node_modules_ol_ImageTile_js.js +0 -177
- package/node_modules_ol_ImageTile_js.js.map +0 -1
- package/node_modules_ol_render_js.js +0 -131
- package/node_modules_ol_render_js.js.map +0 -1
- package/node_modules_ol_structs_LRUCache_js.js +0 -275
- package/node_modules_ol_structs_LRUCache_js.js.map +0 -1
- package/node_modules_ol_tilecoord_js.js +0 -115
- package/node_modules_ol_tilecoord_js.js.map +0 -1
- package/vendors-node_modules_ol_TileCache_js.js +0 -461
- package/vendors-node_modules_ol_TileCache_js.js.map +0 -1
- package/vendors-node_modules_ol_Tile_js.js +0 -330
- package/vendors-node_modules_ol_Tile_js.js.map +0 -1
- package/vendors-node_modules_ol_style_Text_js.js +0 -509
- package/vendors-node_modules_ol_style_Text_js.js.map +0 -1
- package/vendors-node_modules_rbush_index_js.js +0 -531
- package/vendors-node_modules_rbush_index_js.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendors-node_modules_ol_control_OverviewMap_js.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC0C;AACd;AACkB;AACF;AACQ;AAChB;AACN;AACgB;AAC+B;AACvC;AACS;AACC;AAO1B;AAC6C;AAChC;;AAEnC;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,oBAAoB;AAClC;AACA,cAAc,SAAS;AACvB,cAAc,oBAAoB;AAClC;AACA,cAAc,kHAAkH;AAChI;AACA,cAAc,iDAAiD;AAC/D;AACA,cAAc,SAAS;AACvB,cAAc,oBAAoB;AAClC;AACA,cAAc,QAAQ;AACtB,cAAc,MAAM;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,mDAAO;AACjC;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;;AAEA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,MAAM,kEAAe;AACrB;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA,sBAAsB,+CAAG;AACzB;AACA,oBAAoB,sDAAU;AAC9B,wBAAwB,sDAAU;AAClC,KAAK;;AAEL;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP;;AAEA;AACA;AACA;;AAEA;AACA,cAAc;AACd;AACA;AACA,2BAA2B,mDAAO;AAClC;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA,MAAM,uDAAkB;AACxB;AACA,MAAM,kDAAa;AACnB,oDAAoD,oDAAe;AACnE;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,kCAAkC,GAAG;AACrC;AACA,mBAAmB,YAAY;AAC/B;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA,aAAa,kCAAkC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,QAAQ,kDAAM;AACd;AACA,UAAU,0EAA8B;AACxC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,oCAAoC;AACjD;AACA;AACA;AACA,sBAAsB,4DAAgB;AACtC,iCAAiC,8BAA8B;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA,qBAAqB,8DAAkB,kBAAkB,4DAAgB;AACzE;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;AACA;AACA,0BAA0B,gDAAI;AAC9B;AACA,OAAO;AACP;AACA;;AAEA;AACA,MAAM,kEAAqB;AAC3B;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,8BAA8B;AAC3C;AACA;AACA;AACA;AACA,MAAM,kEAAqB;AAC3B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+BAA+B,2BAA2B;;AAE1D;AACA;;AAEA,4BAA4B,mDAAY;AACxC;AACA;AACA;AACA;;AAEA,iCAAiC,2BAA2B;AAC5D;AACA;;AAEA;AACA;;AAEA;AACA,MAAM,uDAAU;AAChB;AACA;AACA,MAAM,2DAAc;AACpB;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,UAAU,2DAAc;AAC9B;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,+BAA+B,2BAA2B;;AAE1D;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA,IAAI,4DAAe;AACnB,uBAAuB,6DAAiB;AACxC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,+BAA+B,2BAA2B;;AAE1D;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,sDAAU;AACzC;AACA,MAAM,oEAAuB;AAC7B;AACA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,kCAAkC,oDAAe;AACjD;AACA,MAAM,qDAAW;AACjB,MAAM;AACN,MAAM,qDAAW;AACjB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,SAAS;AACvB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,SAAS;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,6BAA6B;AAC3C;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kCAAkC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,iEAAe,WAAW,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/control/OverviewMap.js"],"sourcesContent":["/**\n * @module ol/control/OverviewMap\n */\nimport Collection from '../Collection.js';\nimport Map from '../Map.js';\nimport MapEventType from '../MapEventType.js';\nimport MapProperty from '../MapProperty.js';\nimport ObjectEventType from '../ObjectEventType.js';\nimport Overlay from '../Overlay.js';\nimport View from '../View.js';\nimport ViewProperty from '../ViewProperty.js';\nimport {CLASS_COLLAPSED, CLASS_CONTROL, CLASS_UNSELECTABLE} from '../css.js';\nimport {replaceNode} from '../dom.js';\nimport EventType from '../events/EventType.js';\nimport {listen, listenOnce} from '../events.js';\nimport {\n containsExtent,\n equals as equalsExtent,\n getBottomRight,\n getTopLeft,\n scaleFromCenter,\n} from '../extent.js';\nimport {fromExtent as polygonFromExtent} from '../geom/Polygon.js';\nimport Control from './Control.js';\n\n/**\n * Maximum width and/or height extent ratio that determines when the overview\n * map should be zoomed out.\n * @type {number}\n */\nconst MAX_RATIO = 0.75;\n\n/**\n * Minimum width and/or height extent ratio that determines when the overview\n * map should be zoomed in.\n * @type {number}\n */\nconst MIN_RATIO = 0.1;\n\n/**\n * @typedef {Object} Options\n * @property {string} [className='ol-overviewmap'] CSS class name.\n * @property {boolean} [collapsed=true] Whether the control should start collapsed or not (expanded).\n * @property {string|HTMLElement} [collapseLabel='‹'] Text label to use for the\n * expanded overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {boolean} [collapsible=true] Whether the control can be collapsed or not.\n * @property {string|HTMLElement} [label='›'] Text label to use for the collapsed\n * overviewmap button. Instead of text, also an element (e.g. a `span` element) can be used.\n * @property {Array<import(\"../layer/Base.js\").default>|import(\"../Collection.js\").default<import(\"../layer/Base.js\").default>} [layers]\n * Layers for the overview map.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {boolean} [rotateWithView=false] Whether the control view should rotate with the main map view.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {string} [tipLabel='Overview map'] Text label to use for the button tip.\n * @property {View} [view] Custom view for the overview map (should use same projection as main map). If not provided,\n * a default view with the same projection as the main map will be used.\n */\n\n/**\n * Create a new control with a map acting as an overview map for another\n * defined map.\n *\n * @api\n */\nclass OverviewMap extends Control {\n /**\n * @param {Options} [options] OverviewMap options.\n */\n constructor(options) {\n options = options ? options : {};\n\n super({\n element: document.createElement('div'),\n render: options.render,\n target: options.target,\n });\n\n /**\n * @private\n */\n this.boundHandleRotationChanged_ = this.handleRotationChanged_.bind(this);\n\n /**\n * @type {boolean}\n * @private\n */\n this.collapsed_ =\n options.collapsed !== undefined ? options.collapsed : true;\n\n /**\n * @private\n * @type {boolean}\n */\n this.collapsible_ =\n options.collapsible !== undefined ? options.collapsible : true;\n\n if (!this.collapsible_) {\n this.collapsed_ = false;\n }\n\n /**\n * @private\n * @type {boolean}\n */\n this.rotateWithView_ =\n options.rotateWithView !== undefined ? options.rotateWithView : false;\n\n /**\n * @private\n * @type {import(\"../extent.js\").Extent|undefined}\n */\n this.viewExtent_ = undefined;\n\n const className =\n options.className !== undefined ? options.className : 'ol-overviewmap';\n\n const tipLabel =\n options.tipLabel !== undefined ? options.tipLabel : 'Overview map';\n\n const collapseLabel =\n options.collapseLabel !== undefined ? options.collapseLabel : '\\u2039';\n\n if (typeof collapseLabel === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.collapseLabel_ = document.createElement('span');\n this.collapseLabel_.textContent = collapseLabel;\n } else {\n this.collapseLabel_ = collapseLabel;\n }\n\n const label = options.label !== undefined ? options.label : '\\u203A';\n\n if (typeof label === 'string') {\n /**\n * @private\n * @type {HTMLElement}\n */\n this.label_ = document.createElement('span');\n this.label_.textContent = label;\n } else {\n this.label_ = label;\n }\n\n const activeLabel =\n this.collapsible_ && !this.collapsed_ ? this.collapseLabel_ : this.label_;\n const button = document.createElement('button');\n button.setAttribute('type', 'button');\n button.title = tipLabel;\n button.appendChild(activeLabel);\n\n button.addEventListener(\n EventType.CLICK,\n this.handleClick_.bind(this),\n false,\n );\n\n /**\n * @type {HTMLElement}\n * @private\n */\n this.ovmapDiv_ = document.createElement('div');\n this.ovmapDiv_.className = 'ol-overviewmap-map';\n\n /**\n * Explicitly given view to be used instead of a view derived from the main map.\n * @type {View}\n * @private\n */\n this.view_ = options.view;\n\n const ovmap = new Map({\n view: options.view,\n controls: new Collection(),\n interactions: new Collection(),\n });\n\n /**\n * @type {Map}\n * @private\n */\n this.ovmap_ = ovmap;\n\n if (options.layers) {\n options.layers.forEach(function (layer) {\n ovmap.addLayer(layer);\n });\n }\n\n const box = document.createElement('div');\n box.className = 'ol-overviewmap-box';\n box.style.boxSizing = 'border-box';\n\n /**\n * @type {import(\"../Overlay.js\").default}\n * @private\n */\n this.boxOverlay_ = new Overlay({\n position: [0, 0],\n positioning: 'center-center',\n element: box,\n });\n this.ovmap_.addOverlay(this.boxOverlay_);\n\n const cssClasses =\n className +\n ' ' +\n CLASS_UNSELECTABLE +\n ' ' +\n CLASS_CONTROL +\n (this.collapsed_ && this.collapsible_ ? ' ' + CLASS_COLLAPSED : '') +\n (this.collapsible_ ? '' : ' ol-uncollapsible');\n const element = this.element;\n element.className = cssClasses;\n element.appendChild(this.ovmapDiv_);\n element.appendChild(button);\n\n /* Interactive map */\n\n const overlay = this.boxOverlay_;\n const overlayBox = this.boxOverlay_.getElement();\n\n /* Functions definition */\n\n const computeDesiredMousePosition = (mousePosition) => {\n return {\n clientX: mousePosition.clientX,\n clientY: mousePosition.clientY,\n };\n };\n\n const move = function (event) {\n const position = /** @type {?} */ (computeDesiredMousePosition(event));\n const coordinates = ovmap.getEventCoordinate(\n /** @type {MouseEvent} */ (position),\n );\n\n overlay.setPosition(coordinates);\n };\n\n const endMoving = (event) => {\n const coordinates = ovmap.getEventCoordinateInternal(event);\n\n const map = this.getMap();\n\n map.getView().setCenterInternal(coordinates);\n\n const ownerDocument = map.getOwnerDocument();\n ownerDocument.removeEventListener('pointermove', move);\n ownerDocument.removeEventListener('pointerup', endMoving);\n };\n\n /* Binding */\n\n this.ovmapDiv_.addEventListener('pointerdown', (event) => {\n const ownerDocument = this.getMap().getOwnerDocument();\n if (event.target === overlayBox) {\n ownerDocument.addEventListener('pointermove', move);\n }\n ownerDocument.addEventListener('pointerup', endMoving);\n });\n }\n\n /**\n * Remove the control from its current map and attach it to the new map.\n * Pass `null` to just remove the control from the current map.\n * Subclasses may set up event handlers to get notified about changes to\n * the map here.\n * @param {import(\"../Map.js\").default|null} map Map.\n * @api\n * @override\n */\n setMap(map) {\n const oldMap = this.getMap();\n if (map === oldMap) {\n return;\n }\n if (oldMap) {\n const oldView = oldMap.getView();\n if (oldView) {\n this.unbindView_(oldView);\n }\n this.ovmap_.setTarget(null);\n }\n super.setMap(map);\n\n if (map) {\n this.ovmap_.setTarget(this.ovmapDiv_);\n this.listenerKeys.push(\n listen(\n map,\n ObjectEventType.PROPERTYCHANGE,\n this.handleMapPropertyChange_,\n this,\n ),\n );\n\n const view = map.getView();\n if (view) {\n this.bindView_(view);\n }\n\n if (!this.ovmap_.isRendered()) {\n this.updateBoxAfterOvmapIsRendered_();\n }\n }\n }\n\n /**\n * Handle map property changes. This only deals with changes to the map's view.\n * @param {import(\"../Object.js\").ObjectEvent} event The propertychange event.\n * @private\n */\n handleMapPropertyChange_(event) {\n if (event.key === MapProperty.VIEW) {\n const oldView = /** @type {import(\"../View.js\").default} */ (\n event.oldValue\n );\n if (oldView) {\n this.unbindView_(oldView);\n }\n const newView = this.getMap().getView();\n this.bindView_(newView);\n } else if (\n !this.ovmap_.isRendered() &&\n (event.key === MapProperty.TARGET || event.key === MapProperty.SIZE)\n ) {\n this.ovmap_.updateSize();\n }\n }\n\n /**\n * Register listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n bindView_(view) {\n if (!this.view_) {\n // Unless an explicit view definition was given, derive default from whatever main map uses.\n const newView = new View({\n projection: view.getProjection(),\n });\n this.ovmap_.setView(newView);\n }\n\n view.addChangeListener(\n ViewProperty.ROTATION,\n this.boundHandleRotationChanged_,\n );\n // Sync once with the new view\n this.handleRotationChanged_();\n\n if (view.isDef()) {\n this.ovmap_.updateSize();\n this.resetExtent_();\n }\n }\n\n /**\n * Unregister listeners for view property changes.\n * @param {import(\"../View.js\").default} view The view.\n * @private\n */\n unbindView_(view) {\n view.removeChangeListener(\n ViewProperty.ROTATION,\n this.boundHandleRotationChanged_,\n );\n }\n\n /**\n * Handle rotation changes to the main map.\n * @private\n */\n handleRotationChanged_() {\n if (this.rotateWithView_) {\n this.ovmap_.getView().setRotation(this.getMap().getView().getRotation());\n }\n }\n\n /**\n * Reset the overview map extent if the box size (width or\n * height) is less than the size of the overview map size times minRatio\n * or is greater than the size of the overview size times maxRatio.\n *\n * If the map extent was not reset, the box size can fits in the defined\n * ratio sizes. This method then checks if is contained inside the overview\n * map current extent. If not, recenter the overview map to the current\n * main map center location.\n * @private\n */\n validateExtent_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n if (this.viewExtent_ && equalsExtent(extent, this.viewExtent_)) {\n // repeats of the same extent may indicate constraint conflicts leading to an endless cycle\n return;\n }\n this.viewExtent_ = extent;\n\n const ovmapSize = /** @type {import(\"../size.js\").Size} */ (\n ovmap.getSize()\n );\n\n const ovview = ovmap.getView();\n const ovextent = ovview.calculateExtentInternal(ovmapSize);\n\n const topLeftPixel = ovmap.getPixelFromCoordinateInternal(\n getTopLeft(extent),\n );\n const bottomRightPixel = ovmap.getPixelFromCoordinateInternal(\n getBottomRight(extent),\n );\n\n const boxWidth = Math.abs(topLeftPixel[0] - bottomRightPixel[0]);\n const boxHeight = Math.abs(topLeftPixel[1] - bottomRightPixel[1]);\n\n const ovmapWidth = ovmapSize[0];\n const ovmapHeight = ovmapSize[1];\n\n if (\n boxWidth < ovmapWidth * MIN_RATIO ||\n boxHeight < ovmapHeight * MIN_RATIO ||\n boxWidth > ovmapWidth * MAX_RATIO ||\n boxHeight > ovmapHeight * MAX_RATIO\n ) {\n this.resetExtent_();\n } else if (!containsExtent(ovextent, extent)) {\n this.recenter_();\n }\n }\n\n /**\n * Reset the overview map extent to half calculated min and max ratio times\n * the extent of the main map.\n * @private\n */\n resetExtent_() {\n if (MAX_RATIO === 0 || MIN_RATIO === 0) {\n return;\n }\n\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n const extent = view.calculateExtentInternal(mapSize);\n\n const ovview = ovmap.getView();\n\n // get how many times the current map overview could hold different\n // box sizes using the min and max ratio, pick the step in the middle used\n // to calculate the extent from the main map to set it to the overview map,\n const steps = Math.log(MAX_RATIO / MIN_RATIO) / Math.LN2;\n const ratio = 1 / (Math.pow(2, steps / 2) * MIN_RATIO);\n scaleFromCenter(extent, ratio);\n ovview.fitInternal(polygonFromExtent(extent));\n }\n\n /**\n * Set the center of the overview map to the map center without changing its\n * resolution.\n * @private\n */\n recenter_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n ovview.setCenterInternal(view.getCenterInternal());\n }\n\n /**\n * Update the box using the main map extent\n * @private\n */\n updateBox_() {\n const map = this.getMap();\n const ovmap = this.ovmap_;\n\n if (!map.isRendered() || !ovmap.isRendered()) {\n return;\n }\n\n const mapSize = /** @type {import(\"../size.js\").Size} */ (map.getSize());\n\n const view = map.getView();\n\n const ovview = ovmap.getView();\n\n const rotation = this.rotateWithView_ ? 0 : -view.getRotation();\n\n const overlay = this.boxOverlay_;\n const box = this.boxOverlay_.getElement();\n const center = view.getCenter();\n const resolution = view.getResolution();\n const ovresolution = ovview.getResolution();\n const width = (mapSize[0] * resolution) / ovresolution;\n const height = (mapSize[1] * resolution) / ovresolution;\n\n // set position using center coordinates\n overlay.setPosition(center);\n\n // set box size calculated from map extent size and overview map resolution\n if (box) {\n box.style.width = width + 'px';\n box.style.height = height + 'px';\n const transform = 'rotate(' + rotation + 'rad)';\n box.style.transform = transform;\n }\n }\n\n /**\n * @private\n */\n updateBoxAfterOvmapIsRendered_() {\n if (this.ovmapPostrenderKey_) {\n return;\n }\n this.ovmapPostrenderKey_ = listenOnce(\n this.ovmap_,\n MapEventType.POSTRENDER,\n (event) => {\n delete this.ovmapPostrenderKey_;\n this.updateBox_();\n },\n );\n }\n\n /**\n * @param {MouseEvent} event The event to handle\n * @private\n */\n handleClick_(event) {\n event.preventDefault();\n this.handleToggle_();\n }\n\n /**\n * @private\n */\n handleToggle_() {\n this.element.classList.toggle(CLASS_COLLAPSED);\n if (this.collapsed_) {\n replaceNode(this.collapseLabel_, this.label_);\n } else {\n replaceNode(this.label_, this.collapseLabel_);\n }\n this.collapsed_ = !this.collapsed_;\n\n // manage overview map if it had not been rendered before and control\n // is expanded\n const ovmap = this.ovmap_;\n if (!this.collapsed_) {\n if (ovmap.isRendered()) {\n this.viewExtent_ = undefined;\n ovmap.render();\n return;\n }\n ovmap.updateSize();\n this.resetExtent_();\n this.updateBoxAfterOvmapIsRendered_();\n }\n }\n\n /**\n * Return `true` if the overview map is collapsible, `false` otherwise.\n * @return {boolean} True if the widget is collapsible.\n * @api\n */\n getCollapsible() {\n return this.collapsible_;\n }\n\n /**\n * Set whether the overview map should be collapsible.\n * @param {boolean} collapsible True if the widget is collapsible.\n * @api\n */\n setCollapsible(collapsible) {\n if (this.collapsible_ === collapsible) {\n return;\n }\n this.collapsible_ = collapsible;\n this.element.classList.toggle('ol-uncollapsible');\n if (!collapsible && this.collapsed_) {\n this.handleToggle_();\n }\n }\n\n /**\n * Collapse or expand the overview map according to the passed parameter. Will\n * not do anything if the overview map isn't collapsible or if the current\n * collapsed state is already the one requested.\n * @param {boolean} collapsed True if the widget is collapsed.\n * @api\n */\n setCollapsed(collapsed) {\n if (!this.collapsible_ || this.collapsed_ === collapsed) {\n return;\n }\n this.handleToggle_();\n }\n\n /**\n * Determine if the overview map is collapsed.\n * @return {boolean} The overview map is collapsed.\n * @api\n */\n getCollapsed() {\n return this.collapsed_;\n }\n\n /**\n * Return `true` if the overview map view can rotate, `false` otherwise.\n * @return {boolean} True if the control view can rotate.\n * @api\n */\n getRotateWithView() {\n return this.rotateWithView_;\n }\n\n /**\n * Set whether the overview map view should rotate with the main map view.\n * @param {boolean} rotateWithView True if the control view should rotate.\n * @api\n */\n setRotateWithView(rotateWithView) {\n if (this.rotateWithView_ === rotateWithView) {\n return;\n }\n this.rotateWithView_ = rotateWithView;\n if (this.getMap().getView().getRotation() !== 0) {\n if (this.rotateWithView_) {\n this.handleRotationChanged_();\n } else {\n this.ovmap_.getView().setRotation(0);\n }\n this.viewExtent_ = undefined;\n this.validateExtent_();\n this.updateBox_();\n }\n }\n\n /**\n * Return the overview map.\n * @return {import(\"../Map.js\").default} Overview map.\n * @api\n */\n getOverviewMap() {\n return this.ovmap_;\n }\n\n /**\n * Update the overview map element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n this.validateExtent_();\n this.updateBox_();\n }\n}\n\nexport default OverviewMap;\n"],"names":[],"sourceRoot":""}
|
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
(self["webpackChunk_vaadin_bundles"] = self["webpackChunk_vaadin_bundles"] || []).push([["vendors-node_modules_ol_control_ScaleLine_js"],{
|
|
2
|
+
|
|
3
|
+
/***/ "./node_modules/ol/control/ScaleLine.js":
|
|
4
|
+
/*!**********************************************!*\
|
|
5
|
+
!*** ./node_modules/ol/control/ScaleLine.js ***!
|
|
6
|
+
\**********************************************/
|
|
7
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
8
|
+
|
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
11
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
12
|
+
/* harmony export */ });
|
|
13
|
+
/* harmony import */ var _css_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../css.js */ "./node_modules/ol/css.js");
|
|
14
|
+
/* harmony import */ var _proj_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../proj.js */ "./node_modules/ol/proj.js");
|
|
15
|
+
/* harmony import */ var _Control_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Control.js */ "./node_modules/ol/control/Control.js");
|
|
16
|
+
/**
|
|
17
|
+
* @module ol/control/ScaleLine
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
const UNITS_PROP = 'units';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @typedef {'degrees' | 'imperial' | 'nautical' | 'metric' | 'us'} Units
|
|
30
|
+
* Units for the scale line.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @const
|
|
35
|
+
* @type {Array<number>}
|
|
36
|
+
*/
|
|
37
|
+
const LEADING_DIGITS = [1, 2, 5];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @const
|
|
41
|
+
* @type {number}
|
|
42
|
+
*/
|
|
43
|
+
const DEFAULT_DPI = 25.4 / 0.28;
|
|
44
|
+
|
|
45
|
+
/***
|
|
46
|
+
* @template Return
|
|
47
|
+
* @typedef {import("../Observable").OnSignature<import("../Observable").EventTypes, import("../events/Event.js").default, Return> &
|
|
48
|
+
* import("../Observable").OnSignature<import("../ObjectEventType").Types|
|
|
49
|
+
* 'change:units', import("../Object").ObjectEvent, Return> &
|
|
50
|
+
* import("../Observable").CombinedOnSignature<import("../Observable").EventTypes|import("../ObjectEventType").Types
|
|
51
|
+
* |'change:units', Return>} ScaleLineOnSignature
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @typedef {Object} Options
|
|
56
|
+
* @property {string} [className] CSS class name. The default is `ol-scale-bar` when configured with
|
|
57
|
+
* `bar: true`. Otherwise the default is `ol-scale-line`.
|
|
58
|
+
* @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be
|
|
59
|
+
* adjusted to match the dpi used.
|
|
60
|
+
* @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be
|
|
61
|
+
* adjusted to match the dpi used.
|
|
62
|
+
* @property {function(import("../MapEvent.js").default):void} [render] Function called when the control
|
|
63
|
+
* should be re-rendered. This is called in a `requestAnimationFrame` callback.
|
|
64
|
+
* @property {HTMLElement|string} [target] Specify a target if you want the control
|
|
65
|
+
* to be rendered outside of the map's viewport.
|
|
66
|
+
* @property {Units} [units='metric'] Units.
|
|
67
|
+
* @property {boolean} [bar=false] Render scalebars instead of a line.
|
|
68
|
+
* @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers
|
|
69
|
+
* for best results. Only applies when `bar` is `true`.
|
|
70
|
+
* @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies
|
|
71
|
+
* when `bar` is `true`.
|
|
72
|
+
* @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies
|
|
73
|
+
* when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @classdesc
|
|
78
|
+
* A control displaying rough y-axis distances, calculated for the center of the
|
|
79
|
+
* viewport. For conformal projections (e.g. EPSG:3857, the default view
|
|
80
|
+
* projection in OpenLayers), the scale is valid for all directions.
|
|
81
|
+
* No scale line will be shown when the y-axis distance of a pixel at the
|
|
82
|
+
* viewport center cannot be calculated in the view projection.
|
|
83
|
+
* By default the scale line will show in the bottom left portion of the map,
|
|
84
|
+
* but this can be changed by using the css selector `.ol-scale-line`.
|
|
85
|
+
* When specifying `bar` as `true`, a scalebar will be rendered instead
|
|
86
|
+
* of a scaleline.
|
|
87
|
+
* For cartesian measurements of the scaleline, you need to set the
|
|
88
|
+
* `getPointResolution` method of your projection to simply return the input
|
|
89
|
+
* value, e.g. `projection.setGetPointResolution(r => r);`
|
|
90
|
+
*
|
|
91
|
+
* @api
|
|
92
|
+
*/
|
|
93
|
+
class ScaleLine extends _Control_js__WEBPACK_IMPORTED_MODULE_1__["default"] {
|
|
94
|
+
/**
|
|
95
|
+
* @param {Options} [options] Scale line options.
|
|
96
|
+
*/
|
|
97
|
+
constructor(options) {
|
|
98
|
+
options = options ? options : {};
|
|
99
|
+
|
|
100
|
+
const element = document.createElement('div');
|
|
101
|
+
element.style.pointerEvents = 'none';
|
|
102
|
+
|
|
103
|
+
super({
|
|
104
|
+
element: element,
|
|
105
|
+
render: options.render,
|
|
106
|
+
target: options.target,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
/***
|
|
110
|
+
* @type {ScaleLineOnSignature<import("../events").EventsKey>}
|
|
111
|
+
*/
|
|
112
|
+
this.on;
|
|
113
|
+
|
|
114
|
+
/***
|
|
115
|
+
* @type {ScaleLineOnSignature<import("../events").EventsKey>}
|
|
116
|
+
*/
|
|
117
|
+
this.once;
|
|
118
|
+
|
|
119
|
+
/***
|
|
120
|
+
* @type {ScaleLineOnSignature<void>}
|
|
121
|
+
*/
|
|
122
|
+
this.un;
|
|
123
|
+
|
|
124
|
+
const className =
|
|
125
|
+
options.className !== undefined
|
|
126
|
+
? options.className
|
|
127
|
+
: options.bar
|
|
128
|
+
? 'ol-scale-bar'
|
|
129
|
+
: 'ol-scale-line';
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* @private
|
|
133
|
+
* @type {HTMLElement}
|
|
134
|
+
*/
|
|
135
|
+
this.innerElement_ = document.createElement('div');
|
|
136
|
+
this.innerElement_.className = className + '-inner';
|
|
137
|
+
|
|
138
|
+
this.element.className = className + ' ' + _css_js__WEBPACK_IMPORTED_MODULE_2__.CLASS_UNSELECTABLE;
|
|
139
|
+
this.element.appendChild(this.innerElement_);
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @private
|
|
143
|
+
* @type {?import("../View.js").State}
|
|
144
|
+
*/
|
|
145
|
+
this.viewState_ = null;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* @private
|
|
149
|
+
* @type {number}
|
|
150
|
+
*/
|
|
151
|
+
this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @private
|
|
155
|
+
* @type {number|undefined}
|
|
156
|
+
*/
|
|
157
|
+
this.maxWidth_ = options.maxWidth;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* @private
|
|
161
|
+
* @type {boolean}
|
|
162
|
+
*/
|
|
163
|
+
this.renderedVisible_ = false;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @private
|
|
167
|
+
* @type {number|undefined}
|
|
168
|
+
*/
|
|
169
|
+
this.renderedWidth_ = undefined;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @private
|
|
173
|
+
* @type {string}
|
|
174
|
+
*/
|
|
175
|
+
this.renderedHTML_ = '';
|
|
176
|
+
|
|
177
|
+
this.addChangeListener(UNITS_PROP, this.handleUnitsChanged_);
|
|
178
|
+
|
|
179
|
+
this.setUnits(options.units || 'metric');
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @private
|
|
183
|
+
* @type {boolean}
|
|
184
|
+
*/
|
|
185
|
+
this.scaleBar_ = options.bar || false;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @private
|
|
189
|
+
* @type {number}
|
|
190
|
+
*/
|
|
191
|
+
this.scaleBarSteps_ = options.steps || 4;
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @private
|
|
195
|
+
* @type {boolean}
|
|
196
|
+
*/
|
|
197
|
+
this.scaleBarText_ = options.text || false;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @private
|
|
201
|
+
* @type {number|undefined}
|
|
202
|
+
*/
|
|
203
|
+
this.dpi_ = options.dpi || undefined;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Return the units to use in the scale line.
|
|
208
|
+
* @return {Units} The units
|
|
209
|
+
* to use in the scale line.
|
|
210
|
+
* @observable
|
|
211
|
+
* @api
|
|
212
|
+
*/
|
|
213
|
+
getUnits() {
|
|
214
|
+
return this.get(UNITS_PROP);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @private
|
|
219
|
+
*/
|
|
220
|
+
handleUnitsChanged_() {
|
|
221
|
+
this.updateElement_();
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Set the units to use in the scale line.
|
|
226
|
+
* @param {Units} units The units to use in the scale line.
|
|
227
|
+
* @observable
|
|
228
|
+
* @api
|
|
229
|
+
*/
|
|
230
|
+
setUnits(units) {
|
|
231
|
+
this.set(UNITS_PROP, units);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Specify the dpi of output device such as printer.
|
|
236
|
+
* @param {number|undefined} dpi The dpi of output device.
|
|
237
|
+
* @api
|
|
238
|
+
*/
|
|
239
|
+
setDpi(dpi) {
|
|
240
|
+
this.dpi_ = dpi;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @private
|
|
245
|
+
*/
|
|
246
|
+
updateElement_() {
|
|
247
|
+
const viewState = this.viewState_;
|
|
248
|
+
|
|
249
|
+
if (!viewState) {
|
|
250
|
+
if (this.renderedVisible_) {
|
|
251
|
+
this.element.style.display = 'none';
|
|
252
|
+
this.renderedVisible_ = false;
|
|
253
|
+
}
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const center = viewState.center;
|
|
258
|
+
const projection = viewState.projection;
|
|
259
|
+
const units = this.getUnits();
|
|
260
|
+
const pointResolutionUnits = units == 'degrees' ? 'degrees' : 'm';
|
|
261
|
+
let pointResolution = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getPointResolution)(
|
|
262
|
+
projection,
|
|
263
|
+
viewState.resolution,
|
|
264
|
+
center,
|
|
265
|
+
pointResolutionUnits,
|
|
266
|
+
);
|
|
267
|
+
|
|
268
|
+
const minWidth =
|
|
269
|
+
(this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;
|
|
270
|
+
|
|
271
|
+
const maxWidth =
|
|
272
|
+
this.maxWidth_ !== undefined
|
|
273
|
+
? (this.maxWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI
|
|
274
|
+
: undefined;
|
|
275
|
+
|
|
276
|
+
let nominalCount = minWidth * pointResolution;
|
|
277
|
+
let suffix = '';
|
|
278
|
+
if (units == 'degrees') {
|
|
279
|
+
const metersPerDegree = _proj_js__WEBPACK_IMPORTED_MODULE_0__.METERS_PER_UNIT.degrees;
|
|
280
|
+
nominalCount *= metersPerDegree;
|
|
281
|
+
if (nominalCount < metersPerDegree / 60) {
|
|
282
|
+
suffix = '\u2033'; // seconds
|
|
283
|
+
pointResolution *= 3600;
|
|
284
|
+
} else if (nominalCount < metersPerDegree) {
|
|
285
|
+
suffix = '\u2032'; // minutes
|
|
286
|
+
pointResolution *= 60;
|
|
287
|
+
} else {
|
|
288
|
+
suffix = '\u00b0'; // degrees
|
|
289
|
+
}
|
|
290
|
+
} else if (units == 'imperial') {
|
|
291
|
+
if (nominalCount < 0.9144) {
|
|
292
|
+
suffix = 'in';
|
|
293
|
+
pointResolution /= 0.0254;
|
|
294
|
+
} else if (nominalCount < 1609.344) {
|
|
295
|
+
suffix = 'ft';
|
|
296
|
+
pointResolution /= 0.3048;
|
|
297
|
+
} else {
|
|
298
|
+
suffix = 'mi';
|
|
299
|
+
pointResolution /= 1609.344;
|
|
300
|
+
}
|
|
301
|
+
} else if (units == 'nautical') {
|
|
302
|
+
pointResolution /= 1852;
|
|
303
|
+
suffix = 'NM';
|
|
304
|
+
} else if (units == 'metric') {
|
|
305
|
+
if (nominalCount < 1e-6) {
|
|
306
|
+
suffix = 'nm';
|
|
307
|
+
pointResolution *= 1e9;
|
|
308
|
+
} else if (nominalCount < 0.001) {
|
|
309
|
+
suffix = 'μm';
|
|
310
|
+
pointResolution *= 1000000;
|
|
311
|
+
} else if (nominalCount < 1) {
|
|
312
|
+
suffix = 'mm';
|
|
313
|
+
pointResolution *= 1000;
|
|
314
|
+
} else if (nominalCount < 1000) {
|
|
315
|
+
suffix = 'm';
|
|
316
|
+
} else {
|
|
317
|
+
suffix = 'km';
|
|
318
|
+
pointResolution /= 1000;
|
|
319
|
+
}
|
|
320
|
+
} else if (units == 'us') {
|
|
321
|
+
if (nominalCount < 0.9144) {
|
|
322
|
+
suffix = 'in';
|
|
323
|
+
pointResolution *= 39.37;
|
|
324
|
+
} else if (nominalCount < 1609.344) {
|
|
325
|
+
suffix = 'ft';
|
|
326
|
+
pointResolution /= 0.30480061;
|
|
327
|
+
} else {
|
|
328
|
+
suffix = 'mi';
|
|
329
|
+
pointResolution /= 1609.3472;
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
throw new Error('Invalid units');
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
let i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));
|
|
336
|
+
let count, width, decimalCount;
|
|
337
|
+
let previousCount = 0;
|
|
338
|
+
let previousWidth, previousDecimalCount;
|
|
339
|
+
while (true) {
|
|
340
|
+
decimalCount = Math.floor(i / 3);
|
|
341
|
+
const decimal = Math.pow(10, decimalCount);
|
|
342
|
+
count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;
|
|
343
|
+
width = Math.round(count / pointResolution);
|
|
344
|
+
if (isNaN(width)) {
|
|
345
|
+
this.element.style.display = 'none';
|
|
346
|
+
this.renderedVisible_ = false;
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (maxWidth !== undefined && width >= maxWidth) {
|
|
350
|
+
count = previousCount;
|
|
351
|
+
width = previousWidth;
|
|
352
|
+
decimalCount = previousDecimalCount;
|
|
353
|
+
break;
|
|
354
|
+
} else if (width >= minWidth) {
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
previousCount = count;
|
|
358
|
+
previousWidth = width;
|
|
359
|
+
previousDecimalCount = decimalCount;
|
|
360
|
+
++i;
|
|
361
|
+
}
|
|
362
|
+
const html = this.scaleBar_
|
|
363
|
+
? this.createScaleBar(width, count, suffix)
|
|
364
|
+
: count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
|
|
365
|
+
|
|
366
|
+
if (this.renderedHTML_ != html) {
|
|
367
|
+
this.innerElement_.innerHTML = html;
|
|
368
|
+
this.renderedHTML_ = html;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
if (this.renderedWidth_ != width) {
|
|
372
|
+
this.innerElement_.style.width = width + 'px';
|
|
373
|
+
this.renderedWidth_ = width;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (!this.renderedVisible_) {
|
|
377
|
+
this.element.style.display = '';
|
|
378
|
+
this.renderedVisible_ = true;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* @private
|
|
384
|
+
* @param {number} width The current width of the scalebar.
|
|
385
|
+
* @param {number} scale The current scale.
|
|
386
|
+
* @param {string} suffix The suffix to append to the scale text.
|
|
387
|
+
* @return {string} The stringified HTML of the scalebar.
|
|
388
|
+
*/
|
|
389
|
+
createScaleBar(width, scale, suffix) {
|
|
390
|
+
const resolutionScale = this.getScaleForResolution();
|
|
391
|
+
const mapScale =
|
|
392
|
+
resolutionScale < 1
|
|
393
|
+
? Math.round(1 / resolutionScale).toLocaleString() + ' : 1'
|
|
394
|
+
: '1 : ' + Math.round(resolutionScale).toLocaleString();
|
|
395
|
+
const steps = this.scaleBarSteps_;
|
|
396
|
+
const stepWidth = width / steps;
|
|
397
|
+
const scaleSteps = [this.createMarker('absolute')];
|
|
398
|
+
for (let i = 0; i < steps; ++i) {
|
|
399
|
+
const cls =
|
|
400
|
+
i % 2 === 0 ? 'ol-scale-singlebar-odd' : 'ol-scale-singlebar-even';
|
|
401
|
+
scaleSteps.push(
|
|
402
|
+
'<div>' +
|
|
403
|
+
'<div ' +
|
|
404
|
+
`class="ol-scale-singlebar ${cls}" ` +
|
|
405
|
+
`style="width: ${stepWidth}px;"` +
|
|
406
|
+
'>' +
|
|
407
|
+
'</div>' +
|
|
408
|
+
this.createMarker('relative') +
|
|
409
|
+
// render text every second step, except when only 2 steps
|
|
410
|
+
(i % 2 === 0 || steps === 2
|
|
411
|
+
? this.createStepText(i, width, false, scale, suffix)
|
|
412
|
+
: '') +
|
|
413
|
+
'</div>',
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
// render text at the end
|
|
417
|
+
scaleSteps.push(this.createStepText(steps, width, true, scale, suffix));
|
|
418
|
+
|
|
419
|
+
const scaleBarText = this.scaleBarText_
|
|
420
|
+
? `<div class="ol-scale-text" style="width: ${width}px;">` +
|
|
421
|
+
mapScale +
|
|
422
|
+
'</div>'
|
|
423
|
+
: '';
|
|
424
|
+
return scaleBarText + scaleSteps.join('');
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Creates a marker at given position
|
|
429
|
+
* @param {'absolute'|'relative'} position The position, absolute or relative
|
|
430
|
+
* @return {string} The stringified div containing the marker
|
|
431
|
+
*/
|
|
432
|
+
createMarker(position) {
|
|
433
|
+
const top = position === 'absolute' ? 3 : -10;
|
|
434
|
+
return (
|
|
435
|
+
'<div ' +
|
|
436
|
+
'class="ol-scale-step-marker" ' +
|
|
437
|
+
`style="position: ${position}; top: ${top}px;"` +
|
|
438
|
+
'></div>'
|
|
439
|
+
);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Creates the label for a marker marker at given position
|
|
444
|
+
* @param {number} i The iterator
|
|
445
|
+
* @param {number} width The width the scalebar will currently use
|
|
446
|
+
* @param {boolean} isLast Flag indicating if we add the last step text
|
|
447
|
+
* @param {number} scale The current scale for the whole scalebar
|
|
448
|
+
* @param {string} suffix The suffix for the scale
|
|
449
|
+
* @return {string} The stringified div containing the step text
|
|
450
|
+
*/
|
|
451
|
+
createStepText(i, width, isLast, scale, suffix) {
|
|
452
|
+
const length =
|
|
453
|
+
i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;
|
|
454
|
+
const lengthString = length + (i === 0 ? '' : ' ' + suffix);
|
|
455
|
+
const margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;
|
|
456
|
+
const minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;
|
|
457
|
+
return (
|
|
458
|
+
'<div ' +
|
|
459
|
+
'class="ol-scale-step-text" ' +
|
|
460
|
+
'style="' +
|
|
461
|
+
`margin-left: ${margin}px;` +
|
|
462
|
+
`text-align: ${i === 0 ? 'left' : 'center'};` +
|
|
463
|
+
`min-width: ${minWidth}px;` +
|
|
464
|
+
`left: ${isLast ? width + 'px' : 'unset'};` +
|
|
465
|
+
'">' +
|
|
466
|
+
lengthString +
|
|
467
|
+
'</div>'
|
|
468
|
+
);
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Returns the appropriate scale for the given resolution and units.
|
|
473
|
+
* @return {number} The appropriate scale.
|
|
474
|
+
*/
|
|
475
|
+
getScaleForResolution() {
|
|
476
|
+
const resolution = (0,_proj_js__WEBPACK_IMPORTED_MODULE_0__.getPointResolution)(
|
|
477
|
+
this.viewState_.projection,
|
|
478
|
+
this.viewState_.resolution,
|
|
479
|
+
this.viewState_.center,
|
|
480
|
+
'm',
|
|
481
|
+
);
|
|
482
|
+
const dpi = this.dpi_ || DEFAULT_DPI;
|
|
483
|
+
const inchesPerMeter = 1000 / 25.4;
|
|
484
|
+
return resolution * inchesPerMeter * dpi;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Update the scale line element.
|
|
489
|
+
* @param {import("../MapEvent.js").default} mapEvent Map event.
|
|
490
|
+
* @override
|
|
491
|
+
*/
|
|
492
|
+
render(mapEvent) {
|
|
493
|
+
const frameState = mapEvent.frameState;
|
|
494
|
+
if (!frameState) {
|
|
495
|
+
this.viewState_ = null;
|
|
496
|
+
} else {
|
|
497
|
+
this.viewState_ = frameState.viewState;
|
|
498
|
+
}
|
|
499
|
+
this.updateElement_();
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ScaleLine);
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
/***/ })
|
|
507
|
+
|
|
508
|
+
}])
|
|
509
|
+
//# sourceMappingURL=vendors-node_modules_ol_control_ScaleLine_js.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendors-node_modules_ol_control_ScaleLine_js.js","mappings":";;;;;;;;;;;;;;;AAAA;AACA;AACA;AAC6C;AACkB;AAC5B;;AAEnC;AACA,UAAU;AACV;AACA;;AAEA;AACA,aAAa,uDAAuD;AACpE;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,UAAU;AACV;AACA;;AAEA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,iCAAiC;AACjC;;AAEA;AACA,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,QAAQ;AACtB;AACA,cAAc,iDAAiD;AAC/D;AACA,cAAc,oBAAoB;AAClC;AACA,cAAc,OAAO;AACrB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB;AACA,cAAc,SAAS;AACvB;AACA,cAAc,kBAAkB;AAChC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yDAAyD;AACzD;AACA;AACA;AACA,wBAAwB,mDAAO;AAC/B;AACA,aAAa,SAAS;AACtB;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,KAAK;;AAEL;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA,+CAA+C,uDAAkB;AACjE;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;;AAEA;AACA;AACA,cAAc;AACd;AACA;AACA;;AAEA;AACA;AACA,cAAc,OAAO;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,OAAO;AACpB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kBAAkB;AAC/B;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,0BAA0B,4DAAkB;AAC5C;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,8BAA8B,6DAAuB;AACrD;AACA;AACA,2BAA2B;AAC3B;AACA,QAAQ;AACR,2BAA2B;AAC3B;AACA,QAAQ;AACR,2BAA2B;AAC3B;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA,MAAM;AACN;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAQ;AACR;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB,WAAW;AAC/B;AACA;AACA;AACA;AACA;AACA,uCAAuC,IAAI;AAC3C,2BAA2B,UAAU,GAAG;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oDAAoD,MAAM,GAAG;AAC7D;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,uBAAuB;AACpC,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA,0BAA0B,WAAW,OAAO,IAAI,GAAG;AACnD;AACA;AACA;;AAEA;AACA;AACA,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,aAAa,SAAS;AACtB,aAAa,QAAQ;AACrB,aAAa,QAAQ;AACrB,cAAc,QAAQ;AACtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,GAAG;AAChC,qBAAqB,6BAA6B;AAClD,oBAAoB,SAAS,GAAG;AAChC,eAAe,iCAAiC;AAChD;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,cAAc,QAAQ;AACtB;AACA;AACA,uBAAuB,4DAAkB;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,aAAa,kCAAkC;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;;AAEA,iEAAe,SAAS,EAAC","sources":["webpack://@vaadin/bundles/./node_modules/ol/control/ScaleLine.js"],"sourcesContent":["/**\n * @module ol/control/ScaleLine\n */\nimport {CLASS_UNSELECTABLE} from '../css.js';\nimport {METERS_PER_UNIT, getPointResolution} from '../proj.js';\nimport Control from './Control.js';\n\n/**\n * @type {string}\n */\nconst UNITS_PROP = 'units';\n\n/**\n * @typedef {'degrees' | 'imperial' | 'nautical' | 'metric' | 'us'} Units\n * Units for the scale line.\n */\n\n/**\n * @const\n * @type {Array<number>}\n */\nconst LEADING_DIGITS = [1, 2, 5];\n\n/**\n * @const\n * @type {number}\n */\nconst DEFAULT_DPI = 25.4 / 0.28;\n\n/***\n * @template Return\n * @typedef {import(\"../Observable\").OnSignature<import(\"../Observable\").EventTypes, import(\"../events/Event.js\").default, Return> &\n * import(\"../Observable\").OnSignature<import(\"../ObjectEventType\").Types|\n * 'change:units', import(\"../Object\").ObjectEvent, Return> &\n * import(\"../Observable\").CombinedOnSignature<import(\"../Observable\").EventTypes|import(\"../ObjectEventType\").Types\n * |'change:units', Return>} ScaleLineOnSignature\n */\n\n/**\n * @typedef {Object} Options\n * @property {string} [className] CSS class name. The default is `ol-scale-bar` when configured with\n * `bar: true`. Otherwise the default is `ol-scale-line`.\n * @property {number} [minWidth=64] Minimum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {number} [maxWidth] Maximum width in pixels at the OGC default dpi. The width will be\n * adjusted to match the dpi used.\n * @property {function(import(\"../MapEvent.js\").default):void} [render] Function called when the control\n * should be re-rendered. This is called in a `requestAnimationFrame` callback.\n * @property {HTMLElement|string} [target] Specify a target if you want the control\n * to be rendered outside of the map's viewport.\n * @property {Units} [units='metric'] Units.\n * @property {boolean} [bar=false] Render scalebars instead of a line.\n * @property {number} [steps=4] Number of steps the scalebar should use. Use even numbers\n * for best results. Only applies when `bar` is `true`.\n * @property {boolean} [text=false] Render the text scale above of the scalebar. Only applies\n * when `bar` is `true`.\n * @property {number|undefined} [dpi=undefined] dpi of output device such as printer. Only applies\n * when `bar` is `true`. If undefined the OGC default screen pixel size of 0.28mm will be assumed.\n */\n\n/**\n * @classdesc\n * A control displaying rough y-axis distances, calculated for the center of the\n * viewport. For conformal projections (e.g. EPSG:3857, the default view\n * projection in OpenLayers), the scale is valid for all directions.\n * No scale line will be shown when the y-axis distance of a pixel at the\n * viewport center cannot be calculated in the view projection.\n * By default the scale line will show in the bottom left portion of the map,\n * but this can be changed by using the css selector `.ol-scale-line`.\n * When specifying `bar` as `true`, a scalebar will be rendered instead\n * of a scaleline.\n * For cartesian measurements of the scaleline, you need to set the\n * `getPointResolution` method of your projection to simply return the input\n * value, e.g. `projection.setGetPointResolution(r => r);`\n *\n * @api\n */\nclass ScaleLine extends Control {\n /**\n * @param {Options} [options] Scale line options.\n */\n constructor(options) {\n options = options ? options : {};\n\n const element = document.createElement('div');\n element.style.pointerEvents = 'none';\n\n super({\n element: element,\n render: options.render,\n target: options.target,\n });\n\n /***\n * @type {ScaleLineOnSignature<import(\"../events\").EventsKey>}\n */\n this.on;\n\n /***\n * @type {ScaleLineOnSignature<import(\"../events\").EventsKey>}\n */\n this.once;\n\n /***\n * @type {ScaleLineOnSignature<void>}\n */\n this.un;\n\n const className =\n options.className !== undefined\n ? options.className\n : options.bar\n ? 'ol-scale-bar'\n : 'ol-scale-line';\n\n /**\n * @private\n * @type {HTMLElement}\n */\n this.innerElement_ = document.createElement('div');\n this.innerElement_.className = className + '-inner';\n\n this.element.className = className + ' ' + CLASS_UNSELECTABLE;\n this.element.appendChild(this.innerElement_);\n\n /**\n * @private\n * @type {?import(\"../View.js\").State}\n */\n this.viewState_ = null;\n\n /**\n * @private\n * @type {number}\n */\n this.minWidth_ = options.minWidth !== undefined ? options.minWidth : 64;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.maxWidth_ = options.maxWidth;\n\n /**\n * @private\n * @type {boolean}\n */\n this.renderedVisible_ = false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.renderedWidth_ = undefined;\n\n /**\n * @private\n * @type {string}\n */\n this.renderedHTML_ = '';\n\n this.addChangeListener(UNITS_PROP, this.handleUnitsChanged_);\n\n this.setUnits(options.units || 'metric');\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBar_ = options.bar || false;\n\n /**\n * @private\n * @type {number}\n */\n this.scaleBarSteps_ = options.steps || 4;\n\n /**\n * @private\n * @type {boolean}\n */\n this.scaleBarText_ = options.text || false;\n\n /**\n * @private\n * @type {number|undefined}\n */\n this.dpi_ = options.dpi || undefined;\n }\n\n /**\n * Return the units to use in the scale line.\n * @return {Units} The units\n * to use in the scale line.\n * @observable\n * @api\n */\n getUnits() {\n return this.get(UNITS_PROP);\n }\n\n /**\n * @private\n */\n handleUnitsChanged_() {\n this.updateElement_();\n }\n\n /**\n * Set the units to use in the scale line.\n * @param {Units} units The units to use in the scale line.\n * @observable\n * @api\n */\n setUnits(units) {\n this.set(UNITS_PROP, units);\n }\n\n /**\n * Specify the dpi of output device such as printer.\n * @param {number|undefined} dpi The dpi of output device.\n * @api\n */\n setDpi(dpi) {\n this.dpi_ = dpi;\n }\n\n /**\n * @private\n */\n updateElement_() {\n const viewState = this.viewState_;\n\n if (!viewState) {\n if (this.renderedVisible_) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n }\n return;\n }\n\n const center = viewState.center;\n const projection = viewState.projection;\n const units = this.getUnits();\n const pointResolutionUnits = units == 'degrees' ? 'degrees' : 'm';\n let pointResolution = getPointResolution(\n projection,\n viewState.resolution,\n center,\n pointResolutionUnits,\n );\n\n const minWidth =\n (this.minWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI;\n\n const maxWidth =\n this.maxWidth_ !== undefined\n ? (this.maxWidth_ * (this.dpi_ || DEFAULT_DPI)) / DEFAULT_DPI\n : undefined;\n\n let nominalCount = minWidth * pointResolution;\n let suffix = '';\n if (units == 'degrees') {\n const metersPerDegree = METERS_PER_UNIT.degrees;\n nominalCount *= metersPerDegree;\n if (nominalCount < metersPerDegree / 60) {\n suffix = '\\u2033'; // seconds\n pointResolution *= 3600;\n } else if (nominalCount < metersPerDegree) {\n suffix = '\\u2032'; // minutes\n pointResolution *= 60;\n } else {\n suffix = '\\u00b0'; // degrees\n }\n } else if (units == 'imperial') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution /= 0.0254;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.3048;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.344;\n }\n } else if (units == 'nautical') {\n pointResolution /= 1852;\n suffix = 'NM';\n } else if (units == 'metric') {\n if (nominalCount < 1e-6) {\n suffix = 'nm';\n pointResolution *= 1e9;\n } else if (nominalCount < 0.001) {\n suffix = 'μm';\n pointResolution *= 1000000;\n } else if (nominalCount < 1) {\n suffix = 'mm';\n pointResolution *= 1000;\n } else if (nominalCount < 1000) {\n suffix = 'm';\n } else {\n suffix = 'km';\n pointResolution /= 1000;\n }\n } else if (units == 'us') {\n if (nominalCount < 0.9144) {\n suffix = 'in';\n pointResolution *= 39.37;\n } else if (nominalCount < 1609.344) {\n suffix = 'ft';\n pointResolution /= 0.30480061;\n } else {\n suffix = 'mi';\n pointResolution /= 1609.3472;\n }\n } else {\n throw new Error('Invalid units');\n }\n\n let i = 3 * Math.floor(Math.log(minWidth * pointResolution) / Math.log(10));\n let count, width, decimalCount;\n let previousCount = 0;\n let previousWidth, previousDecimalCount;\n while (true) {\n decimalCount = Math.floor(i / 3);\n const decimal = Math.pow(10, decimalCount);\n count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;\n width = Math.round(count / pointResolution);\n if (isNaN(width)) {\n this.element.style.display = 'none';\n this.renderedVisible_ = false;\n return;\n }\n if (maxWidth !== undefined && width >= maxWidth) {\n count = previousCount;\n width = previousWidth;\n decimalCount = previousDecimalCount;\n break;\n } else if (width >= minWidth) {\n break;\n }\n previousCount = count;\n previousWidth = width;\n previousDecimalCount = decimalCount;\n ++i;\n }\n const html = this.scaleBar_\n ? this.createScaleBar(width, count, suffix)\n : count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;\n\n if (this.renderedHTML_ != html) {\n this.innerElement_.innerHTML = html;\n this.renderedHTML_ = html;\n }\n\n if (this.renderedWidth_ != width) {\n this.innerElement_.style.width = width + 'px';\n this.renderedWidth_ = width;\n }\n\n if (!this.renderedVisible_) {\n this.element.style.display = '';\n this.renderedVisible_ = true;\n }\n }\n\n /**\n * @private\n * @param {number} width The current width of the scalebar.\n * @param {number} scale The current scale.\n * @param {string} suffix The suffix to append to the scale text.\n * @return {string} The stringified HTML of the scalebar.\n */\n createScaleBar(width, scale, suffix) {\n const resolutionScale = this.getScaleForResolution();\n const mapScale =\n resolutionScale < 1\n ? Math.round(1 / resolutionScale).toLocaleString() + ' : 1'\n : '1 : ' + Math.round(resolutionScale).toLocaleString();\n const steps = this.scaleBarSteps_;\n const stepWidth = width / steps;\n const scaleSteps = [this.createMarker('absolute')];\n for (let i = 0; i < steps; ++i) {\n const cls =\n i % 2 === 0 ? 'ol-scale-singlebar-odd' : 'ol-scale-singlebar-even';\n scaleSteps.push(\n '<div>' +\n '<div ' +\n `class=\"ol-scale-singlebar ${cls}\" ` +\n `style=\"width: ${stepWidth}px;\"` +\n '>' +\n '</div>' +\n this.createMarker('relative') +\n // render text every second step, except when only 2 steps\n (i % 2 === 0 || steps === 2\n ? this.createStepText(i, width, false, scale, suffix)\n : '') +\n '</div>',\n );\n }\n // render text at the end\n scaleSteps.push(this.createStepText(steps, width, true, scale, suffix));\n\n const scaleBarText = this.scaleBarText_\n ? `<div class=\"ol-scale-text\" style=\"width: ${width}px;\">` +\n mapScale +\n '</div>'\n : '';\n return scaleBarText + scaleSteps.join('');\n }\n\n /**\n * Creates a marker at given position\n * @param {'absolute'|'relative'} position The position, absolute or relative\n * @return {string} The stringified div containing the marker\n */\n createMarker(position) {\n const top = position === 'absolute' ? 3 : -10;\n return (\n '<div ' +\n 'class=\"ol-scale-step-marker\" ' +\n `style=\"position: ${position}; top: ${top}px;\"` +\n '></div>'\n );\n }\n\n /**\n * Creates the label for a marker marker at given position\n * @param {number} i The iterator\n * @param {number} width The width the scalebar will currently use\n * @param {boolean} isLast Flag indicating if we add the last step text\n * @param {number} scale The current scale for the whole scalebar\n * @param {string} suffix The suffix for the scale\n * @return {string} The stringified div containing the step text\n */\n createStepText(i, width, isLast, scale, suffix) {\n const length =\n i === 0 ? 0 : Math.round((scale / this.scaleBarSteps_) * i * 100) / 100;\n const lengthString = length + (i === 0 ? '' : ' ' + suffix);\n const margin = i === 0 ? -3 : (width / this.scaleBarSteps_) * -1;\n const minWidth = i === 0 ? 0 : (width / this.scaleBarSteps_) * 2;\n return (\n '<div ' +\n 'class=\"ol-scale-step-text\" ' +\n 'style=\"' +\n `margin-left: ${margin}px;` +\n `text-align: ${i === 0 ? 'left' : 'center'};` +\n `min-width: ${minWidth}px;` +\n `left: ${isLast ? width + 'px' : 'unset'};` +\n '\">' +\n lengthString +\n '</div>'\n );\n }\n\n /**\n * Returns the appropriate scale for the given resolution and units.\n * @return {number} The appropriate scale.\n */\n getScaleForResolution() {\n const resolution = getPointResolution(\n this.viewState_.projection,\n this.viewState_.resolution,\n this.viewState_.center,\n 'm',\n );\n const dpi = this.dpi_ || DEFAULT_DPI;\n const inchesPerMeter = 1000 / 25.4;\n return resolution * inchesPerMeter * dpi;\n }\n\n /**\n * Update the scale line element.\n * @param {import(\"../MapEvent.js\").default} mapEvent Map event.\n * @override\n */\n render(mapEvent) {\n const frameState = mapEvent.frameState;\n if (!frameState) {\n this.viewState_ = null;\n } else {\n this.viewState_ = frameState.viewState;\n }\n this.updateElement_();\n }\n}\n\nexport default ScaleLine;\n"],"names":[],"sourceRoot":""}
|