mirage2d 1.1.2 → 1.1.4

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.
Files changed (196) hide show
  1. package/dist/MirageHttp.es.js +5268 -0
  2. package/dist/MirageHttp.es.js.map +1 -0
  3. package/dist/MirageHttp.umd.js +2 -0
  4. package/dist/MirageHttp.umd.js.map +1 -0
  5. package/dist/assets/js/basedecoder-fa2b8e8d.js +107 -0
  6. package/dist/assets/js/decoder-f19e05cf.js +6 -0
  7. package/dist/assets/js/deflate-adb9a67b.js +8 -0
  8. package/dist/{js/dist/_html2canvas@1.4.1@html2canvas.e8006fee.js → assets/js/html2canvas.esm-3dd231c5.js} +0 -0
  9. package/dist/assets/js/index-3263db85.js +1 -0
  10. package/dist/assets/js/index-a9db46a5.js +212968 -0
  11. package/dist/{js/lib/_canvg@3.0.10@canvg.bd557ac8.js → assets/js/index.es-38f73a27.js} +2179 -351
  12. package/dist/assets/js/jpeg-3bf23728.js +835 -0
  13. package/dist/{js/_lerc@3.0.0@lerc/_lerc@3.0.0@lerc.dc2ff398.js → assets/js/lerc-4c39f39b.js} +26 -1
  14. package/dist/assets/js/lzw-d0cad8af.js +123 -0
  15. package/dist/assets/js/packbits-d75b4cce.js +25 -0
  16. package/dist/{js/_pako@2.0.4@pako/_pako@2.0.4@pako.52d6b320.js → assets/js/pako.esm-49deb4d7.js} +0 -0
  17. package/dist/{js/dist/_dompurify@2.4.0@dompurify.e7ba523e.js → assets/js/purify.es-1915dfae.js} +0 -0
  18. package/dist/assets/js/raw-9656f9cc.js +7 -0
  19. package/dist/assets/js/webimage-edb7156c.js +27 -0
  20. package/package.json +1 -1
  21. package/dist/js/_@babel_runtime@7.18.9@@babel/_@babel_runtime@7.18.9@@babel.e0126ca2.js +0 -51
  22. package/dist/js/_@petamoriken_float16@3.6.6@@petamoriken/_@petamoriken_float16@3.6.6@@petamoriken.c5188241.js +0 -217
  23. package/dist/js/_@turf_along@6.5.0@@turf/_@turf_along@6.5.0@@turf.18dbc1a3.js +0 -31
  24. package/dist/js/_@turf_angle@6.5.0@@turf/_@turf_angle@6.5.0@@turf.554ac9bf.js +0 -1
  25. package/dist/js/_@turf_area@6.5.0@@turf/_@turf_area@6.5.0@@turf.6cbf0cc1.js +0 -74
  26. package/dist/js/_@turf_bbox-clip@6.5.0@@turf/_@turf_bbox-clip@6.5.0@@turf.e491cb90.js +0 -1
  27. package/dist/js/_@turf_bbox-polygon@6.5.0@@turf/_@turf_bbox-polygon@6.5.0@@turf.523f1c20.js +0 -19
  28. package/dist/js/_@turf_bbox@6.5.0@@turf/_@turf_bbox@6.5.0@@turf.4c59feee.js +0 -48
  29. package/dist/js/_@turf_bearing@6.5.0@@turf/_@turf_bearing@6.5.0@@turf.f2555a09.js +0 -25
  30. package/dist/js/_@turf_bezier-spline@6.5.0@@turf/_@turf_bezier-spline@6.5.0@@turf.fa7991dd.js +0 -137
  31. package/dist/js/_@turf_boolean-clockwise@6.5.0@@turf/_@turf_boolean-clockwise@6.5.0@@turf.4031f280.js +0 -1
  32. package/dist/js/_@turf_boolean-contains@6.5.0@@turf/_@turf_boolean-contains@6.5.0@@turf.836d55d8.js +0 -191
  33. package/dist/js/_@turf_boolean-crosses@6.5.0@@turf/_@turf_boolean-crosses@6.5.0@@turf.c5f65a28.js +0 -125
  34. package/dist/js/_@turf_boolean-disjoint@6.5.0@@turf/_@turf_boolean-disjoint@6.5.0@@turf.bbd60872.js +0 -122
  35. package/dist/js/_@turf_boolean-equal@6.5.0@@turf/_@turf_boolean-equal@6.5.0@@turf.341ffa01.js +0 -1
  36. package/dist/js/_@turf_boolean-intersects@6.5.0@@turf/_@turf_boolean-intersects@6.5.0@@turf.05fc28b3.js +0 -15
  37. package/dist/js/_@turf_boolean-overlap@6.5.0@@turf/_@turf_boolean-overlap@6.5.0@@turf.a519db25.js +0 -53
  38. package/dist/js/_@turf_boolean-parallel@6.5.0@@turf/_@turf_boolean-parallel@6.5.0@@turf.dbf2bc2d.js +0 -1
  39. package/dist/js/_@turf_boolean-point-in-polygon@6.5.0@@turf/_@turf_boolean-point-in-polygon@6.5.0@@turf.62a2d48a.js +0 -65
  40. package/dist/js/_@turf_boolean-point-on-line@6.5.0@@turf/_@turf_boolean-point-on-line@6.5.0@@turf.3cf3aaa1.js +0 -69
  41. package/dist/js/_@turf_boolean-within@6.5.0@@turf/_@turf_boolean-within@6.5.0@@turf.d70d6bfc.js +0 -172
  42. package/dist/js/_@turf_buffer@6.5.0@@turf/_@turf_buffer@6.5.0@@turf.88330dfe.js +0 -99
  43. package/dist/js/_@turf_center-mean@6.5.0@@turf/_@turf_center-mean@6.5.0@@turf.b3d7c917.js +0 -1
  44. package/dist/js/_@turf_center-median@6.5.0@@turf/_@turf_center-median@6.5.0@@turf.44c4669e.js +0 -1
  45. package/dist/js/_@turf_center-of-mass@6.5.0@@turf/_@turf_center-of-mass@6.5.0@@turf.63ce279e.js +0 -1
  46. package/dist/js/_@turf_center@6.5.0@@turf/_@turf_center@6.5.0@@turf.a45495b5.js +0 -12
  47. package/dist/js/_@turf_centroid@6.5.0@@turf/_@turf_centroid@6.5.0@@turf.0a5be869.js +0 -17
  48. package/dist/js/_@turf_circle@6.5.0@@turf/_@turf_circle@6.5.0@@turf.0166b8c2.js +0 -16
  49. package/dist/js/_@turf_clean-coords@6.5.0@@turf/_@turf_clean-coords@6.5.0@@turf.8c76bd63.js +0 -111
  50. package/dist/js/_@turf_clone@6.5.0@@turf/_@turf_clone@6.5.0@@turf.cd05b1f8.js +0 -100
  51. package/dist/js/_@turf_clusters-dbscan@6.5.0@@turf/_@turf_clusters-dbscan@6.5.0@@turf.6bbee7e9.js +0 -1
  52. package/dist/js/_@turf_clusters-kmeans@6.5.0@@turf/_@turf_clusters-kmeans@6.5.0@@turf.505415df.js +0 -1
  53. package/dist/js/_@turf_clusters@6.5.0@@turf/_@turf_clusters@6.5.0@@turf.84cb9680.js +0 -1
  54. package/dist/js/_@turf_collect@6.5.0@@turf/_@turf_collect@6.5.0@@turf.93e41b5f.js +0 -1
  55. package/dist/js/_@turf_combine@6.5.0@@turf/_@turf_combine@6.5.0@@turf.33ee6336.js +0 -1
  56. package/dist/js/_@turf_concave@6.5.0@@turf/_@turf_concave@6.5.0@@turf.6fb6a8be.js +0 -179
  57. package/dist/js/_@turf_convex@6.5.0@@turf/_@turf_convex@6.5.0@@turf.24600ac2.js +0 -1
  58. package/dist/js/_@turf_destination@6.5.0@@turf/_@turf_destination@6.5.0@@turf.2621651e.js +0 -18
  59. package/dist/js/_@turf_difference@6.5.0@@turf/_@turf_difference@6.5.0@@turf.70df5e79.js +0 -18
  60. package/dist/js/_@turf_dissolve@6.5.0@@turf/_@turf_dissolve@6.5.0@@turf.edb28fc1.js +0 -1
  61. package/dist/js/_@turf_distance-weight@6.5.0@@turf/_@turf_distance-weight@6.5.0@@turf.e168af7f.js +0 -1
  62. package/dist/js/_@turf_distance@6.5.0@@turf/_@turf_distance@6.5.0@@turf.0c7b8aea.js +0 -22
  63. package/dist/js/_@turf_ellipse@6.5.0@@turf/_@turf_ellipse@6.5.0@@turf.37986056.js +0 -1
  64. package/dist/js/_@turf_envelope@6.5.0@@turf/_@turf_envelope@6.5.0@@turf.599c5772.js +0 -1
  65. package/dist/js/_@turf_explode@6.5.0@@turf/_@turf_explode@6.5.0@@turf.5c768db5.js +0 -24
  66. package/dist/js/_@turf_flatten@6.5.0@@turf/_@turf_flatten@6.5.0@@turf.57e9114c.js +0 -1
  67. package/dist/js/_@turf_flip@6.5.0@@turf/_@turf_flip@6.5.0@@turf.1f02101f.js +0 -1
  68. package/dist/js/_@turf_great-circle@6.5.0@@turf/_@turf_great-circle@6.5.0@@turf.2ca021a8.js +0 -1
  69. package/dist/js/_@turf_helpers@6.5.0@@turf/_@turf_helpers@6.5.0@@turf.f1480aa1.js +0 -364
  70. package/dist/js/_@turf_hex-grid@6.5.0@@turf/_@turf_hex-grid@6.5.0@@turf.a6a45778.js +0 -99
  71. package/dist/js/_@turf_interpolate@6.5.0@@turf/_@turf_interpolate@6.5.0@@turf.4d39bd8c.js +0 -1
  72. package/dist/js/_@turf_intersect@6.5.0@@turf/_@turf_intersect@6.5.0@@turf.34082cdf.js +0 -17
  73. package/dist/js/_@turf_invariant@6.5.0@@turf/_@turf_invariant@6.5.0@@turf.0ef69f8c.js +0 -71
  74. package/dist/js/_@turf_isobands@6.5.0@@turf/_@turf_isobands@6.5.0@@turf.def019df.js +0 -3109
  75. package/dist/js/_@turf_isolines@6.5.0@@turf/_@turf_isolines@6.5.0@@turf.da623b25.js +0 -1
  76. package/dist/js/_@turf_kinks@6.5.0@@turf/_@turf_kinks@6.5.0@@turf.ee61685b.js +0 -87
  77. package/dist/js/_@turf_length@6.5.0@@turf/_@turf_length@6.5.0@@turf.f73f6c98.js +0 -12
  78. package/dist/js/_@turf_line-arc@6.5.0@@turf/_@turf_line-arc@6.5.0@@turf.3dc57055.js +0 -37
  79. package/dist/js/_@turf_line-chunk@6.5.0@@turf/_@turf_line-chunk@6.5.0@@turf.1867af48.js +0 -43
  80. package/dist/js/_@turf_line-intersect@6.5.0@@turf/_@turf_line-intersect@6.5.0@@turf.c4d81948.js +0 -73
  81. package/dist/js/_@turf_line-offset@6.5.0@@turf/_@turf_line-offset@6.5.0@@turf.e6846793.js +0 -116
  82. package/dist/js/_@turf_line-overlap@6.5.0@@turf/_@turf_line-overlap@6.5.0@@turf.addba9a5.js +0 -76
  83. package/dist/js/_@turf_line-segment@6.5.0@@turf/_@turf_line-segment@6.5.0@@turf.18ce3010.js +0 -55
  84. package/dist/js/_@turf_line-slice-along@6.5.0@@turf/_@turf_line-slice-along@6.5.0@@turf.2b802464.js +0 -57
  85. package/dist/js/_@turf_line-slice@6.5.0@@turf/_@turf_line-slice@6.5.0@@turf.6423a053.js +0 -23
  86. package/dist/js/_@turf_line-split@6.5.0@@turf/_@turf_line-split@6.5.0@@turf.2022f104.js +0 -125
  87. package/dist/js/_@turf_line-to-polygon@6.5.0@@turf/_@turf_line-to-polygon@6.5.0@@turf.83f5e69f.js +0 -1
  88. package/dist/js/_@turf_mask@6.5.0@@turf/_@turf_mask@6.5.0@@turf.96cd5a94.js +0 -1
  89. package/dist/js/_@turf_meta@6.5.0@@turf/_@turf_meta@6.5.0@@turf.1b9d5da5.js +0 -611
  90. package/dist/js/_@turf_midpoint@6.5.0@@turf/_@turf_midpoint@6.5.0@@turf.67c14f94.js +0 -1
  91. package/dist/js/_@turf_moran-index@6.5.0@@turf/_@turf_moran-index@6.5.0@@turf.2ad5365a.js +0 -1
  92. package/dist/js/_@turf_nearest-point-on-line@6.5.0@@turf/_@turf_nearest-point-on-line@6.5.0@@turf.095c8c0d.js +0 -57
  93. package/dist/js/_@turf_nearest-point-to-line@6.5.0@@turf/_@turf_nearest-point-to-line@6.5.0@@turf.68484097.js +0 -1
  94. package/dist/js/_@turf_nearest-point@6.5.0@@turf/_@turf_nearest-point@6.5.0@@turf.e0d2f509.js +0 -24
  95. package/dist/js/_@turf_planepoint@6.5.0@@turf/_@turf_planepoint@6.5.0@@turf.56fc70b3.js +0 -1
  96. package/dist/js/_@turf_point-grid@6.5.0@@turf/_@turf_point-grid@6.5.0@@turf.2d278644.js +0 -42
  97. package/dist/js/_@turf_point-on-feature@6.5.0@@turf/_@turf_point-on-feature@6.5.0@@turf.0c740874.js +0 -1
  98. package/dist/js/_@turf_point-to-line-distance@6.5.0@@turf/_@turf_point-to-line-distance@6.5.0@@turf.33105d82.js +0 -1
  99. package/dist/js/_@turf_points-within-polygon@6.5.0@@turf/_@turf_points-within-polygon@6.5.0@@turf.659cd335.js +0 -35
  100. package/dist/js/_@turf_polygon-smooth@6.5.0@@turf/_@turf_polygon-smooth@6.5.0@@turf.43a7c33e.js +0 -1
  101. package/dist/js/_@turf_polygon-tangents@6.5.0@@turf/_@turf_polygon-tangents@6.5.0@@turf.a2c3a7b6.js +0 -1
  102. package/dist/js/_@turf_polygon-to-line@6.5.0@@turf/_@turf_polygon-to-line@6.5.0@@turf.3177cfb1.js +0 -48
  103. package/dist/js/_@turf_polygonize@6.5.0@@turf/_@turf_polygonize@6.5.0@@turf.f7cc4910.js +0 -1
  104. package/dist/js/_@turf_projection@6.5.0@@turf/_@turf_projection@6.5.0@@turf.ffdd3321.js +0 -1
  105. package/dist/js/_@turf_random@6.5.0@@turf/_@turf_random@6.5.0@@turf.f65251e4.js +0 -130
  106. package/dist/js/_@turf_rectangle-grid@6.5.0@@turf/_@turf_rectangle-grid@6.5.0@@turf.7e8b1a1f.js +0 -49
  107. package/dist/js/_@turf_rewind@6.5.0@@turf/_@turf_rewind@6.5.0@@turf.5d137ee9.js +0 -1
  108. package/dist/js/_@turf_rhumb-bearing@6.5.0@@turf/_@turf_rhumb-bearing@6.5.0@@turf.fb8f6ade.js +0 -30
  109. package/dist/js/_@turf_rhumb-destination@6.5.0@@turf/_@turf_rhumb-destination@6.5.0@@turf.dc0e4753.js +0 -36
  110. package/dist/js/_@turf_rhumb-distance@6.5.0@@turf/_@turf_rhumb-distance@6.5.0@@turf.94e475b8.js +0 -30
  111. package/dist/js/_@turf_sample@6.5.0@@turf/_@turf_sample@6.5.0@@turf.7181d7a7.js +0 -1
  112. package/dist/js/_@turf_sector@6.5.0@@turf/_@turf_sector@6.5.0@@turf.04ffddfe.js +0 -39
  113. package/dist/js/_@turf_shortest-path@6.5.0@@turf/_@turf_shortest-path@6.5.0@@turf.0c1b62a8.js +0 -367
  114. package/dist/js/_@turf_simplify@6.5.0@@turf/_@turf_simplify@6.5.0@@turf.46703d2e.js +0 -1
  115. package/dist/js/_@turf_square-grid@6.5.0@@turf/_@turf_square-grid@6.5.0@@turf.38bd2eaa.js +0 -8
  116. package/dist/js/_@turf_square@6.5.0@@turf/_@turf_square@6.5.0@@turf.2705289a.js +0 -27
  117. package/dist/js/_@turf_standard-deviational-ellipse@6.5.0@@turf/_@turf_standard-deviational-ellipse@6.5.0@@turf.7094e432.js +0 -1
  118. package/dist/js/_@turf_tag@6.5.0@@turf/_@turf_tag@6.5.0@@turf.cb60b0c1.js +0 -1
  119. package/dist/js/_@turf_tesselate@6.5.0@@turf/_@turf_tesselate@6.5.0@@turf.330e4aae.js +0 -1
  120. package/dist/js/_@turf_tin@6.5.0@@turf/_@turf_tin@6.5.0@@turf.077204c4.js +0 -173
  121. package/dist/js/_@turf_transform-rotate@6.5.0@@turf/_@turf_transform-rotate@6.5.0@@turf.6d350d36.js +0 -1
  122. package/dist/js/_@turf_transform-scale@6.5.0@@turf/_@turf_transform-scale@6.5.0@@turf.d6f65671.js +0 -90
  123. package/dist/js/_@turf_transform-translate@6.5.0@@turf/_@turf_transform-translate@6.5.0@@turf.9296b81a.js +0 -1
  124. package/dist/js/_@turf_triangle-grid@6.5.0@@turf/_@turf_triangle-grid@6.5.0@@turf.939f94ab.js +0 -107
  125. package/dist/js/_@turf_truncate@6.5.0@@turf/_@turf_truncate@6.5.0@@turf.ed70ebcb.js +0 -33
  126. package/dist/js/_@turf_turf@6.4.0@@turf/_@turf_turf@6.4.0@@turf.34fde8ec.js +0 -1
  127. package/dist/js/_@turf_union@6.5.0@@turf/_@turf_union@6.5.0@@turf.386ee2eb.js +0 -1
  128. package/dist/js/_@turf_unkink-polygon@6.5.0@@turf/_@turf_unkink-polygon@6.5.0@@turf.cb446e47.js +0 -1
  129. package/dist/js/_@turf_voronoi@6.5.0@@turf/_@turf_voronoi@6.5.0@@turf.c30d929e.js +0 -30
  130. package/dist/js/_call-bind@1.0.2@call-bind/_call-bind@1.0.2@call-bind.3811d387.js +0 -53
  131. package/dist/js/_concaveman@1.2.1@concaveman/_concaveman@1.2.1@concaveman.e747f731.js +0 -1
  132. package/dist/js/_core-js@3.25.0@core-js/_core-js@3.25.0@core-js.003355ed.js +0 -5029
  133. package/dist/js/_crypto-js@4.1.1@crypto-js/_crypto-js@4.1.1@crypto-js.e2f7f158.js +0 -1823
  134. package/dist/js/_d3-array@1.2.4@d3-array/_d3-array@1.2.4@d3-array.d606df6b.js +0 -58
  135. package/dist/js/_d3-geo@1.7.1@d3-geo/_d3-geo@1.7.1@d3-geo.7d357be1.js +0 -1094
  136. package/dist/js/_d3-voronoi@1.1.2@d3-voronoi/_d3-voronoi@1.1.2@d3-voronoi.072f12a6.js +0 -816
  137. package/dist/js/_deep-equal@1.1.1@deep-equal/_deep-equal@1.1.1@deep-equal.98576c17.js +0 -108
  138. package/dist/js/_define-properties@1.1.4@define-properties/_define-properties@1.1.4@define-properties.647c3367.js +0 -40
  139. package/dist/js/_density-clustering@1.3.0@density-clustering/_density-clustering@1.3.0@density-clustering.a07fc6ae.js +0 -1
  140. package/dist/js/_earcut@2.2.4@earcut/_earcut@2.2.4@earcut.972ebfd3.js +0 -1
  141. package/dist/js/_echarts-gl@1.1.2@echarts-gl/_echarts-gl@1.1.2@echarts-gl.1e3964b9.js +0 -36533
  142. package/dist/js/_echarts@4.9.0@echarts/_echarts@4.9.0@echarts.7d74ba77.js +0 -44219
  143. package/dist/js/_fflate@0.4.8@fflate/_fflate@0.4.8@fflate.d8111196.js +0 -571
  144. package/dist/js/_function-bind@1.1.1@function-bind/_function-bind@1.1.1@function-bind.de3cf11d.js +0 -46
  145. package/dist/js/_functions-have-names@1.2.3@functions-have-names/_functions-have-names@1.2.3@functions-have-names.7def2408.js +0 -27
  146. package/dist/js/_geojson-equality@0.1.6@geojson-equality/_geojson-equality@0.1.6@geojson-equality.09ffa121.js +0 -133
  147. package/dist/js/_geojson-path-finder@1.5.3@geojson-path-finder/_geojson-path-finder@1.5.3@geojson-path-finder.7a10eb99.js +0 -348
  148. package/dist/js/_geojson-rbush@3.2.0@geojson-rbush/_geojson-rbush@3.2.0@geojson-rbush.2adaeedb.js +0 -93
  149. package/dist/js/_geotiff@2.0.4@geotiff/_geotiff@2.0.4@geotiff.5b08f79e.js +0 -3663
  150. package/dist/js/_get-intrinsic@1.1.2@get-intrinsic/_get-intrinsic@1.1.2@get-intrinsic.a633bd68.js +0 -291
  151. package/dist/js/_has-property-descriptors@1.0.0@has-property-descriptors/_has-property-descriptors@1.0.0@has-property-descriptors.6bd2d302.js +0 -26
  152. package/dist/js/_has-symbols@1.0.3@has-symbols/_has-symbols@1.0.3@has-symbols.70406077.js +0 -63
  153. package/dist/js/_has-tostringtag@1.0.0@has-tostringtag/_has-tostringtag@1.0.0@has-tostringtag.2d502422.js +0 -6
  154. package/dist/js/_has@1.0.3@has/_has@1.0.3@has.ddd2eb68.js +0 -4
  155. package/dist/js/_ieee754@1.2.1@ieee754/_ieee754@1.2.1@ieee754.56426503.js +0 -80
  156. package/dist/js/_is-arguments@1.1.1@is-arguments/_is-arguments@1.1.1@is-arguments.7d77e24a.js +0 -23
  157. package/dist/js/_is-date-object@1.0.5@is-date-object/_is-date-object@1.0.5@is-date-object.08cc2543.js +0 -20
  158. package/dist/js/_is-regex@1.1.4@is-regex/_is-regex@1.1.4@is-regex.6417e007.js +0 -47
  159. package/dist/js/_jspdf@2.5.1@jspdf/_jspdf@2.5.1@jspdf.e927dbd8.js +0 -8494
  160. package/dist/js/_kml-geojson@1.2.0@kml-geojson/_kml-geojson@1.2.0@kml-geojson.f1ae86e4.js +0 -7858
  161. package/dist/js/_lru-cache@6.0.0@lru-cache/_lru-cache@6.0.0@lru-cache.dd72cc1b.js +0 -263
  162. package/dist/js/_mgrs@1.0.0@mgrs/_mgrs@1.0.0@mgrs.12d1da3e.js +0 -432
  163. package/dist/js/_object-assign@4.1.1@object-assign/_object-assign@4.1.1@object-assign.e4009c1c.js +0 -69
  164. package/dist/js/_object-is@1.1.5@object-is/_object-is@1.1.5@object-is.e47f5d65.js +0 -45
  165. package/dist/js/_object-keys@1.1.1@object-keys/_object-keys@1.1.1@object-keys.4b1d0a99.js +0 -151
  166. package/dist/js/_ol-echarts@2.0.6@ol-echarts/_ol-echarts@2.0.6@ol-echarts.658aaf82.js +0 -841
  167. package/dist/js/_ol-ext@3.2.30@ol-ext/_ol-ext@3.2.30@ol-ext.b94220dd.js +0 -4614
  168. package/dist/js/_ol-mapbox-style@8.2.1@ol-mapbox-style/_ol-mapbox-style@8.2.1@ol-mapbox-style.795310f3.js +0 -1
  169. package/dist/js/_ol@6.15.1@ol/_ol@6.15.1@ol.8fd0cbb5.js +0 -31823
  170. package/dist/js/_pbf@3.2.1@pbf/_pbf@3.2.1@pbf.330acf55.js +0 -647
  171. package/dist/js/_performance-now@2.1.0@performance-now/_performance-now@2.1.0@performance-now.a51379c2.js +0 -34
  172. package/dist/js/_point-in-polygon@1.1.0@point-in-polygon/_point-in-polygon@1.1.0@point-in-polygon.2cc4306e.js +0 -1
  173. package/dist/js/_polygon-clipping@0.15.3@polygon-clipping/_polygon-clipping@0.15.3@polygon-clipping.c0e9ec57.js +0 -1363
  174. package/dist/js/_proj4@2.8.0@proj4/_proj4@2.8.0@proj4.1600352c.js +0 -4885
  175. package/dist/js/_quickselect@1.1.1@quickselect/_quickselect@1.1.1@quickselect.8afce154.js +0 -1
  176. package/dist/js/_quickselect@2.0.0@quickselect/_quickselect@2.0.0@quickselect.9f5c1e48.js +0 -51
  177. package/dist/js/_raf@3.4.1@raf/_raf@3.4.1@raf.ac0d6c66.js +0 -60
  178. package/dist/js/_rbush@2.0.2@rbush/_rbush@2.0.2@rbush.7149e620.js +0 -1
  179. package/dist/js/_rbush@3.0.1@rbush/_rbush@3.0.1@rbush.57d33d95.js +0 -402
  180. package/dist/js/_regexp.prototype.flags@1.4.3@regexp.prototype.flags/_regexp.prototype.flags@1.4.3@regexp.prototype.flags.8b6921c6.js +0 -102
  181. package/dist/js/_rgbcolor@1.0.1@rgbcolor/_rgbcolor@1.0.1@rgbcolor.dd87e013.js +0 -272
  182. package/dist/js/_robust-predicates@2.0.4@robust-predicates/_robust-predicates@2.0.4@robust-predicates.564bf2f8.js +0 -1
  183. package/dist/js/_skmeans@0.9.7@skmeans/_skmeans@0.9.7@skmeans.933c6a76.js +0 -1
  184. package/dist/js/_splaytree@3.1.1@splaytree/_splaytree@3.1.1@splaytree.6cb55ed3.js +0 -671
  185. package/dist/js/_stackblur-canvas@2.5.0@stackblur-canvas/_stackblur-canvas@2.5.0@stackblur-canvas.dd883d14.js +0 -214
  186. package/dist/js/_svg-pathdata@6.0.3@svg-pathdata/_svg-pathdata@6.0.3@svg-pathdata.7e858a5f.js +0 -441
  187. package/dist/js/_tinyqueue@2.0.3@tinyqueue/_tinyqueue@2.0.3@tinyqueue.78918532.js +0 -73
  188. package/dist/js/_topojson-client@3.1.0@topojson-client/_topojson-client@3.1.0@topojson-client.aef4e2d5.js +0 -238
  189. package/dist/js/_topojson-server@3.0.1@topojson-server/_topojson-server@3.0.1@topojson-server.b521a412.js +0 -662
  190. package/dist/js/_turf-jsts@1.2.3@turf-jsts/_turf-jsts@1.2.3@turf-jsts.6ef42696.js +0 -18934
  191. package/dist/js/_web-worker@1.2.0@web-worker/_web-worker@1.2.0@web-worker.43288df7.js +0 -2
  192. package/dist/js/_wkt-parser@1.3.2@wkt-parser/_wkt-parser@1.3.2@wkt-parser.0e1cf374.js +0 -461
  193. package/dist/js/_xml-utils@1.2.0@xml-utils/_xml-utils@1.2.0@xml-utils.2a8ae655.js +0 -126
  194. package/dist/js/_yallist@4.0.0@yallist/_yallist@4.0.0@yallist.8350aafe.js +0 -363
  195. package/dist/js/_zrender@4.3.2@zrender/_zrender@4.3.2@zrender.1feea14d.js +0 -12455
  196. package/dist/mirage2d.es.js +0 -15894
@@ -1,4614 +0,0 @@
1
- import { F as Fill, b as asString, D as DEVICE_PIXEL_RATIO, o as ol_Map, c as ol_layer_Base, a as ol_Object, u as unByKey, d as asArray, e as ol_control_Control, f as ol_interaction_Pointer, S as Stroke, R as RegularShape, g as buffer, h as extend, i as Feature, P as Point, j as fromExtent, k as boundingExtent, l as ol_geom_Polygon, m as getCenter, n as ol_Collection, p as VectorLayer, q as VectorSource, r as Style, s as createEmpty, v as multiply, C as CanvasImmediateRenderer, V as VERSION, I as Icon, w as easeOut, x as Select, L as LineString, y as CircleStyle, z as singleClick, A as ol_geom_Geometry, B as linear, E as all, G as ol_geom_MultiLineString, H as ol_geom_MultiPolygon, J as Circle, K as ol_layer_Image, M as ol_source_ImageCanvas } from "../_ol@6.15.1@ol/_ol@6.15.1@ol.8fd0cbb5.js";
2
- if (window.ol && !ol.ext) {
3
- ol.ext = {};
4
- }
5
- var ol_ext_inherits = function(child, parent) {
6
- child.prototype = Object.create(parent.prototype);
7
- child.prototype.constructor = child;
8
- };
9
- if (window.ol) {
10
- if (!ol.inherits)
11
- ol.inherits = ol_ext_inherits;
12
- }
13
- if (window.NodeList && !NodeList.prototype.forEach) {
14
- NodeList.prototype.forEach = Array.prototype.forEach;
15
- }
16
- if (window.Element && !Element.prototype.remove) {
17
- Element.prototype.remove = function() {
18
- if (this.parentNode)
19
- this.parentNode.removeChild(this);
20
- };
21
- }
22
- var ol_style_FillPattern = function(options) {
23
- if (!options)
24
- options = {};
25
- var pattern;
26
- var canvas = this.canvas_ = document.createElement("canvas");
27
- var scale = Number(options.scale) > 0 ? Number(options.scale) : 1;
28
- var ratio = scale * DEVICE_PIXEL_RATIO || DEVICE_PIXEL_RATIO;
29
- var ctx = canvas.getContext("2d");
30
- if (options.image) {
31
- options.image.load();
32
- var i;
33
- var img = options.image.getImage();
34
- if (img.width) {
35
- canvas.width = Math.round(img.width * ratio);
36
- canvas.height = Math.round(img.height * ratio);
37
- ctx.globalAlpha = typeof options.opacity == "number" ? options.opacity : 1;
38
- ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
39
- pattern = ctx.createPattern(canvas, "repeat");
40
- } else {
41
- var self = this;
42
- pattern = [0, 0, 0, 0];
43
- img.onload = function() {
44
- canvas.width = Math.round(img.width * ratio);
45
- canvas.height = Math.round(img.height * ratio);
46
- ctx.globalAlpha = typeof options.opacity == "number" ? options.opacity : 1;
47
- ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
48
- pattern = ctx.createPattern(canvas, "repeat");
49
- self.setColor(pattern);
50
- };
51
- }
52
- } else {
53
- var pat = this.getPattern_(options);
54
- canvas.width = Math.round(pat.width * ratio);
55
- canvas.height = Math.round(pat.height * ratio);
56
- ctx.beginPath();
57
- if (options.fill) {
58
- ctx.fillStyle = asString(options.fill.getColor());
59
- ctx.fillRect(0, 0, canvas.width, canvas.height);
60
- }
61
- ctx.scale(ratio, ratio);
62
- ctx.lineCap = "round";
63
- ctx.lineWidth = pat.stroke || 1;
64
- ctx.fillStyle = asString(options.color || "#000");
65
- ctx.strokeStyle = asString(options.color || "#000");
66
- if (pat.circles)
67
- for (i = 0; i < pat.circles.length; i++) {
68
- var ci = pat.circles[i];
69
- ctx.beginPath();
70
- ctx.arc(ci[0], ci[1], ci[2], 0, 2 * Math.PI);
71
- if (pat.fill)
72
- ctx.fill();
73
- if (pat.stroke)
74
- ctx.stroke();
75
- }
76
- if (!pat.repeat)
77
- pat.repeat = [[0, 0]];
78
- if (pat.char) {
79
- ctx.font = pat.font || pat.width + "px Arial";
80
- ctx.textAlign = "center";
81
- ctx.textBaseline = "middle";
82
- if (pat.angle) {
83
- ctx.fillText(pat.char, pat.width / 4, pat.height / 4);
84
- ctx.fillText(pat.char, 5 * pat.width / 4, 5 * pat.height / 4);
85
- ctx.fillText(pat.char, pat.width / 4, 5 * pat.height / 4);
86
- ctx.fillText(pat.char, 5 * pat.width / 4, pat.height / 4);
87
- ctx.fillText(pat.char, 3 * pat.width / 4, 3 * pat.height / 4);
88
- ctx.fillText(pat.char, -pat.width / 4, -pat.height / 4);
89
- ctx.fillText(pat.char, 3 * pat.width / 4, -pat.height / 4);
90
- ctx.fillText(pat.char, -pat.width / 4, 3 * pat.height / 4);
91
- } else
92
- ctx.fillText(pat.char, pat.width / 2, pat.height / 2);
93
- }
94
- if (pat.lines)
95
- for (i = 0; i < pat.lines.length; i++)
96
- for (var r = 0; r < pat.repeat.length; r++) {
97
- var li = pat.lines[i];
98
- ctx.beginPath();
99
- ctx.moveTo(li[0] + pat.repeat[r][0], li[1] + pat.repeat[r][1]);
100
- for (var k = 2; k < li.length; k += 2) {
101
- ctx.lineTo(li[k] + pat.repeat[r][0], li[k + 1] + pat.repeat[r][1]);
102
- }
103
- if (pat.fill)
104
- ctx.fill();
105
- if (pat.stroke)
106
- ctx.stroke();
107
- ctx.save();
108
- ctx.strokeStyle = "red";
109
- ctx.strokeWidth = 0.1;
110
- ctx.restore();
111
- }
112
- pattern = ctx.createPattern(canvas, "repeat");
113
- if (options.offset) {
114
- var offset = options.offset;
115
- if (typeof offset == "number")
116
- offset = [offset, offset];
117
- if (offset instanceof Array) {
118
- var dx = Math.round(offset[0] * ratio);
119
- var dy = Math.round(offset[1] * ratio);
120
- ctx.scale(1 / ratio, 1 / ratio);
121
- ctx.clearRect(0, 0, canvas.width, canvas.height);
122
- ctx.translate(dx, dy);
123
- ctx.fillStyle = pattern;
124
- ctx.fillRect(-dx, -dy, canvas.width, canvas.height);
125
- pattern = ctx.createPattern(canvas, "repeat");
126
- }
127
- }
128
- }
129
- Fill.call(this, { color: pattern });
130
- };
131
- ol_ext_inherits(ol_style_FillPattern, Fill);
132
- ol_style_FillPattern.prototype.clone = function() {
133
- var s = Fill.prototype.clone.call(this);
134
- s.canvas_ = this.canvas_;
135
- return s;
136
- };
137
- ol_style_FillPattern.prototype.getImage = function() {
138
- return this.canvas_;
139
- };
140
- ol_style_FillPattern.prototype.getPattern_ = function(options) {
141
- var pat = ol_style_FillPattern.prototype.patterns[options.pattern] || ol_style_FillPattern.prototype.patterns.dot;
142
- var d = Math.round(options.spacing) || 10;
143
- var size;
144
- switch (options.pattern) {
145
- case "dot":
146
- case "circle": {
147
- size = options.size === 0 ? 0 : options.size / 2 || 2;
148
- if (!options.angle) {
149
- pat.width = pat.height = d;
150
- pat.circles = [[d / 2, d / 2, size]];
151
- if (options.pattern == "circle") {
152
- pat.circles = pat.circles.concat([
153
- [d / 2 + d, d / 2, size],
154
- [d / 2 - d, d / 2, size],
155
- [d / 2, d / 2 + d, size],
156
- [d / 2, d / 2 - d, size],
157
- [d / 2 + d, d / 2 + d, size],
158
- [d / 2 + d, d / 2 - d, size],
159
- [d / 2 - d, d / 2 + d, size],
160
- [d / 2 - d, d / 2 - d, size]
161
- ]);
162
- }
163
- } else {
164
- d = pat.width = pat.height = Math.round(d * 1.4);
165
- pat.circles = [[d / 4, d / 4, size], [3 * d / 4, 3 * d / 4, size]];
166
- if (options.pattern == "circle") {
167
- pat.circles = pat.circles.concat([
168
- [d / 4 + d, d / 4, size],
169
- [d / 4, d / 4 + d, size],
170
- [3 * d / 4 - d, 3 * d / 4, size],
171
- [3 * d / 4, 3 * d / 4 - d, size],
172
- [d / 4 + d, d / 4 + d, size],
173
- [3 * d / 4 - d, 3 * d / 4 - d, size]
174
- ]);
175
- }
176
- }
177
- break;
178
- }
179
- case "tile":
180
- case "square": {
181
- size = options.size === 0 ? 0 : options.size / 2 || 2;
182
- if (!options.angle) {
183
- pat.width = pat.height = d;
184
- pat.lines = [[d / 2 - size, d / 2 - size, d / 2 + size, d / 2 - size, d / 2 + size, d / 2 + size, d / 2 - size, d / 2 + size, d / 2 - size, d / 2 - size]];
185
- } else {
186
- pat.width = pat.height = d;
187
- pat.lines = [[d / 2 - size, d / 2, d / 2, d / 2 - size, d / 2 + size, d / 2, d / 2, d / 2 + size, d / 2 - size, d / 2]];
188
- }
189
- if (options.pattern == "square")
190
- pat.repeat = [[0, 0], [0, d], [d, 0], [0, -d], [-d, 0], [-d, -d], [d, d], [-d, d], [d, -d]];
191
- break;
192
- }
193
- case "cross": {
194
- if (options.angle)
195
- options.angle = 45;
196
- }
197
- case "hatch": {
198
- var a = Math.round(((options.angle || 0) - 90) % 360);
199
- if (a > 180)
200
- a -= 360;
201
- a *= Math.PI / 180;
202
- var cos = Math.cos(a);
203
- var sin = Math.sin(a);
204
- if (Math.abs(sin) < 1e-4) {
205
- pat.width = pat.height = d;
206
- pat.lines = [[0, 0.5, d, 0.5]];
207
- pat.repeat = [[0, 0], [0, d]];
208
- } else if (Math.abs(cos) < 1e-4) {
209
- pat.width = pat.height = d;
210
- pat.lines = [[0.5, 0, 0.5, d]];
211
- pat.repeat = [[0, 0], [d, 0]];
212
- if (options.pattern == "cross") {
213
- pat.lines.push([0, 0.5, d, 0.5]);
214
- pat.repeat.push([0, d]);
215
- }
216
- } else {
217
- var w = pat.width = Math.round(Math.abs(d / sin)) || 1;
218
- var h = pat.height = Math.round(Math.abs(d / cos)) || 1;
219
- if (options.pattern == "cross") {
220
- pat.lines = [[-w, -h, 2 * w, 2 * h], [2 * w, -h, -w, 2 * h]];
221
- pat.repeat = [[0, 0]];
222
- } else if (cos * sin > 0) {
223
- pat.lines = [[-w, -h, 2 * w, 2 * h]];
224
- pat.repeat = [[0, 0], [w, 0], [0, h]];
225
- } else {
226
- pat.lines = [[2 * w, -h, -w, 2 * h]];
227
- pat.repeat = [[0, 0], [-w, 0], [0, h]];
228
- }
229
- }
230
- pat.stroke = options.size === 0 ? 0 : options.size || 4;
231
- break;
232
- }
233
- }
234
- return pat;
235
- };
236
- ol_style_FillPattern.addPattern = function(title, options) {
237
- if (!options)
238
- options = {};
239
- ol_style_FillPattern.prototype.patterns[title || options.char] = {
240
- width: options.width || options.size || 10,
241
- height: options.height || options.size || 10,
242
- font: options.font,
243
- char: options.char,
244
- circles: options.circles,
245
- lines: options.lines,
246
- repeat: options.repeat,
247
- stroke: options.stroke,
248
- angle: options.angle,
249
- fill: options.fill
250
- };
251
- };
252
- ol_style_FillPattern.prototype.patterns = {
253
- "hatch": {
254
- width: 5,
255
- height: 5,
256
- lines: [[0, 2.5, 5, 2.5]],
257
- stroke: 1
258
- },
259
- "cross": {
260
- width: 7,
261
- height: 7,
262
- lines: [[0, 3, 10, 3], [3, 0, 3, 10]],
263
- stroke: 1
264
- },
265
- "dot": {
266
- width: 8,
267
- height: 8,
268
- circles: [[5, 5, 2]],
269
- stroke: false,
270
- fill: true
271
- },
272
- "circle": {
273
- width: 10,
274
- height: 10,
275
- circles: [[5, 5, 2]],
276
- stroke: 1,
277
- fill: false
278
- },
279
- "square": {
280
- width: 10,
281
- height: 10,
282
- lines: [[3, 3, 3, 8, 8, 8, 8, 3, 3, 3]],
283
- stroke: 1,
284
- fill: false
285
- },
286
- "tile": {
287
- width: 10,
288
- height: 10,
289
- lines: [[3, 3, 3, 8, 8, 8, 8, 3, 3, 3]],
290
- fill: true
291
- },
292
- "woven": {
293
- width: 12,
294
- height: 12,
295
- lines: [[3, 3, 9, 9], [0, 12, 3, 9], [9, 3, 12, 0], [-1, 1, 1, -1], [13, 11, 11, 13]],
296
- stroke: 1
297
- },
298
- "crosses": {
299
- width: 8,
300
- height: 8,
301
- lines: [[2, 2, 6, 6], [2, 6, 6, 2]],
302
- stroke: 1
303
- },
304
- "caps": {
305
- width: 8,
306
- height: 8,
307
- lines: [[2, 6, 4, 2, 6, 6]],
308
- stroke: 1
309
- },
310
- "nylon": {
311
- width: 20,
312
- height: 20,
313
- lines: [[1, 6, 1, 1, 6, 1], [6, 11, 11, 11, 11, 6], [11, 16, 11, 21, 16, 21], [16, 11, 21, 11, 21, 16]],
314
- repeat: [[0, 0], [-20, 0], [0, -20]],
315
- stroke: 1
316
- },
317
- "hexagon": {
318
- width: 20,
319
- height: 12,
320
- lines: [[0, 10, 4, 4, 10, 4, 14, 10, 10, 16, 4, 16, 0, 10]],
321
- stroke: 1,
322
- repeat: [[0, 0], [10, 6], [10, -6], [-10, -6]]
323
- },
324
- "cemetry": {
325
- width: 15,
326
- height: 19,
327
- lines: [
328
- [0, 3.5, 7, 3.5],
329
- [3.5, 0, 3.5, 10]
330
- ],
331
- stroke: 1,
332
- repeat: [[0, 0], [7, 9]]
333
- },
334
- "sand": {
335
- width: 20,
336
- height: 20,
337
- circles: [
338
- [1, 2, 1],
339
- [9, 3, 1],
340
- [2, 16, 1],
341
- [7, 8, 1],
342
- [6, 14, 1],
343
- [4, 19, 1],
344
- [14, 2, 1],
345
- [12, 10, 1],
346
- [14, 18, 1],
347
- [18, 8, 1],
348
- [18, 14, 1]
349
- ],
350
- fill: 1
351
- },
352
- "conglomerate": {
353
- width: 60,
354
- height: 40,
355
- circles: [[2, 4, 1], [17, 3, 1], [26, 18, 1], [12, 17, 1], [5, 17, 2], [28, 11, 2]],
356
- lines: [
357
- [7, 5, 6, 7, 9, 9, 11, 8, 11, 6, 9, 5, 7, 5],
358
- [16, 10, 15, 13, 16, 14, 19, 15, 21, 13, 22, 9, 20, 8, 19, 8, 16, 10],
359
- [24, 6, 26, 7, 27, 5, 26, 4, 24, 4, 24, 6]
360
- ],
361
- repeat: [[30, 0], [-15, 20], [15, 20], [45, 20]],
362
- stroke: 1
363
- },
364
- "conglomerate2": {
365
- width: 60,
366
- height: 40,
367
- circles: [[2, 4, 1], [17, 3, 1], [26, 18, 1], [12, 17, 1], [5, 17, 2], [28, 11, 2]],
368
- lines: [
369
- [7, 5, 6, 7, 9, 9, 11, 8, 11, 6, 9, 5, 7, 5],
370
- [16, 10, 15, 13, 16, 14, 19, 15, 21, 13, 22, 9, 20, 8, 19, 8, 16, 10],
371
- [24, 6, 26, 7, 27, 5, 26, 4, 24, 4, 24, 6]
372
- ],
373
- repeat: [[30, 0], [-15, 20], [15, 20], [45, 20]],
374
- fill: 1
375
- },
376
- "gravel": {
377
- width: 15,
378
- height: 10,
379
- circles: [[4, 2, 1], [5, 9, 1], [1, 7, 1]],
380
- lines: [[7, 5, 6, 6, 7, 7, 8, 7, 9, 7, 10, 5, 9, 4, 7, 5], [11, 2, 14, 4, 14, 1, 12, 1, 11, 2]],
381
- stroke: 1
382
- },
383
- "brick": {
384
- width: 18,
385
- height: 16,
386
- lines: [[0, 1, 18, 1], [0, 10, 18, 10], [6, 1, 6, 10], [12, 10, 12, 18], [12, 0, 12, 1]],
387
- stroke: 1
388
- },
389
- "dolomite": {
390
- width: 20,
391
- height: 16,
392
- lines: [[0, 1, 20, 1], [0, 9, 20, 9], [1, 9, 6, 1], [11, 9, 14, 16], [14, 0, 14.4, 1]],
393
- stroke: 1
394
- },
395
- "coal": {
396
- width: 20,
397
- height: 16,
398
- lines: [[1, 5, 7, 1, 7, 7], [11, 10, 12, 5, 18, 9], [5, 10, 2, 15, 9, 15], [15, 16, 15, 13, 20, 16], [15, 0, 15, 2, 20, 0]],
399
- fill: 1
400
- },
401
- "breccia": {
402
- width: 20,
403
- height: 16,
404
- lines: [[1, 5, 7, 1, 7, 7, 1, 5], [11, 10, 12, 5, 18, 9, 11, 10], [5, 10, 2, 15, 9, 15, 5, 10], [15, 16, 15, 13, 22, 18], [15, 0, 15, 2, 20, 0]],
405
- stroke: 1
406
- },
407
- "clay": {
408
- width: 20,
409
- height: 20,
410
- lines: [[0, 0, 3, 11, 0, 20], [11, 0, 10, 3, 13, 13, 11, 20], [0, 0, 10, 3, 20, 0], [0, 12, 3, 11, 13, 13, 20, 12]],
411
- stroke: 1
412
- },
413
- "flooded": {
414
- width: 15,
415
- height: 10,
416
- lines: [[0, 1, 10, 1], [0, 6, 5, 6], [10, 6, 15, 6]],
417
- stroke: 1
418
- },
419
- "chaos": {
420
- width: 40,
421
- height: 40,
422
- lines: [
423
- [40, 2, 40, 0, 38, 0, 40, 2],
424
- [
425
- 4,
426
- 0,
427
- 3,
428
- 2,
429
- 2,
430
- 5,
431
- 0,
432
- 0,
433
- 0,
434
- 3,
435
- 2,
436
- 7,
437
- 5,
438
- 6,
439
- 7,
440
- 7,
441
- 8,
442
- 10,
443
- 9,
444
- 12,
445
- 9,
446
- 13,
447
- 9,
448
- 14,
449
- 8,
450
- 14,
451
- 6,
452
- 15,
453
- 2,
454
- 15,
455
- 0,
456
- 20,
457
- 0,
458
- 22,
459
- 2,
460
- 20,
461
- 5,
462
- 19,
463
- 8,
464
- 15,
465
- 10,
466
- 14,
467
- 11,
468
- 12.25,
469
- 10,
470
- 12,
471
- 10,
472
- 10,
473
- 12,
474
- 9,
475
- 13,
476
- 7,
477
- 12,
478
- 6,
479
- 13,
480
- 4,
481
- 16,
482
- 7,
483
- 17,
484
- 4,
485
- 20,
486
- 0,
487
- 18,
488
- 0,
489
- 15,
490
- 3,
491
- 14,
492
- 2,
493
- 14,
494
- 0,
495
- 12,
496
- 1,
497
- 11,
498
- 0,
499
- 10,
500
- 1,
501
- 11,
502
- 4,
503
- 10,
504
- 7,
505
- 9,
506
- 8,
507
- 8,
508
- 5,
509
- 6,
510
- 4,
511
- 5,
512
- 3,
513
- 5,
514
- 1,
515
- 5,
516
- 0,
517
- 4,
518
- 0
519
- ],
520
- [7, 1, 7, 3, 8, 3, 8, 2, 7, 1],
521
- [4, 3, 5, 5, 4, 5, 4, 3],
522
- [34, 5, 33, 7, 38, 10, 38, 8, 36, 5, 34, 5],
523
- [27, 0, 23, 2, 21, 8, 30, 0, 27, 0],
524
- [
525
- 25,
526
- 8,
527
- 26,
528
- 12,
529
- 26,
530
- 16,
531
- 22.71875,
532
- 15.375,
533
- 20,
534
- 13,
535
- 18,
536
- 15,
537
- 17,
538
- 18,
539
- 13,
540
- 22,
541
- 17,
542
- 21,
543
- 19,
544
- 22,
545
- 21,
546
- 20,
547
- 19,
548
- 18,
549
- 22,
550
- 17,
551
- 30,
552
- 25,
553
- 26,
554
- 26,
555
- 24,
556
- 28,
557
- 21.75,
558
- 33.34375,
559
- 20,
560
- 36,
561
- 18,
562
- 40,
563
- 20,
564
- 40,
565
- 24,
566
- 37,
567
- 25,
568
- 32,
569
- 27,
570
- 31,
571
- 26,
572
- 38,
573
- 27,
574
- 37,
575
- 30,
576
- 32,
577
- 32,
578
- 35,
579
- 36,
580
- 37,
581
- 38,
582
- 40,
583
- 38,
584
- 39,
585
- 40,
586
- 40,
587
- 37,
588
- 36,
589
- 34,
590
- 32,
591
- 37,
592
- 31,
593
- 36,
594
- 29,
595
- 33,
596
- 27,
597
- 34,
598
- 24,
599
- 39,
600
- 21,
601
- 40,
602
- 21,
603
- 40,
604
- 16,
605
- 37,
606
- 20,
607
- 31,
608
- 22,
609
- 32,
610
- 25,
611
- 27,
612
- 20,
613
- 29,
614
- 15,
615
- 30,
616
- 20,
617
- 32,
618
- 20,
619
- 34,
620
- 18,
621
- 33,
622
- 12,
623
- 31,
624
- 11,
625
- 29,
626
- 14,
627
- 26,
628
- 9,
629
- 25,
630
- 8
631
- ],
632
- [39, 24, 37, 26, 40, 28, 39, 24],
633
- [13, 15, 9, 19, 14, 18, 13, 15],
634
- [18, 23, 14, 27, 16, 27, 17, 25, 20, 26, 18, 23],
635
- [6, 24, 2, 26, 1, 28, 2, 30, 5, 28, 12, 30, 16, 32, 18, 30, 15, 30, 12, 28, 9, 25, 7, 27, 6, 24],
636
- [29, 27, 32, 28, 33, 31, 30, 29, 27, 28, 29, 27],
637
- [5, 35, 1, 33, 3, 36, 13, 38, 15, 35, 10, 36, 5, 35]
638
- ],
639
- fill: 1
640
- },
641
- "grass": {
642
- width: 27,
643
- height: 22,
644
- lines: [[0, 10.5, 13, 10.5], [2.5, 10, 1.5, 7], [4.5, 10, 4.5, 5, 3.5, 4], [7, 10, 7.5, 6, 8.5, 3], [10, 10, 11, 6]],
645
- repeat: [[0, 0], [14, 10]],
646
- stroke: 1
647
- },
648
- "swamp": {
649
- width: 24,
650
- height: 23,
651
- lines: [[0, 10.5, 9.5, 10.5], [2.5, 10, 2.5, 7], [4.5, 10, 4.5, 4], [6.5, 10, 6.5, 6], [3, 12.5, 7, 12.5]],
652
- repeat: [[0, 0], [14, 10]],
653
- stroke: 1
654
- },
655
- "reed": {
656
- width: 26,
657
- height: 23,
658
- lines: [
659
- [2.5, 10, 2, 7],
660
- [4.5, 10, 4.2, 4],
661
- [6.5, 10, 6.8, 4],
662
- [8.5, 10, 9, 6],
663
- [3.7, 4, 3.7, 2.5],
664
- [4.7, 4, 4.7, 2.5],
665
- [6.3, 4, 6.3, 2.5],
666
- [7.3, 4, 7.3, 2.5]
667
- ],
668
- circles: [[4.2, 2.5, 0.5], [18.2, 12.5, 0.5], [6.8, 2.5, 0.5], [20.8, 12.5, 0.5], [9, 6, 0.5], [23, 16, 0.5]],
669
- repeat: [[0, 0], [14, 10]],
670
- stroke: 1
671
- },
672
- "wave": {
673
- width: 10,
674
- height: 8,
675
- lines: [[0, 0, 5, 4, 10, 0]],
676
- stroke: 1
677
- },
678
- "vine": {
679
- width: 13,
680
- height: 13,
681
- lines: [[3, 0, 3, 6], [9, 7, 9, 13]],
682
- stroke: 1
683
- },
684
- "forest": {
685
- width: 55,
686
- height: 30,
687
- circles: [[7, 7, 3.5], [20, 20, 1.5], [42, 22, 3.5], [35, 5, 1.5]],
688
- stroke: 1
689
- },
690
- "forest2": {
691
- width: 55,
692
- height: 30,
693
- circles: [[7, 7, 3.5], [20, 20, 1.5], [42, 22, 3.5], [35, 5, 1.5]],
694
- fill: 1,
695
- stroke: 1
696
- },
697
- "scrub": {
698
- width: 26,
699
- height: 20,
700
- lines: [[1, 4, 4, 8, 6, 4]],
701
- circles: [[20, 13, 1.5]],
702
- stroke: 1
703
- },
704
- "tree": {
705
- width: 30,
706
- height: 30,
707
- lines: [[7.78, 10.61, 4.95, 10.61, 4.95, 7.78, 3.54, 7.78, 2.12, 6.36, 0.71, 6.36, 0, 4.24, 0.71, 2.12, 4.24, 0, 7.78, 0.71, 9.19, 3.54, 7.78, 4.95, 7.07, 7.07, 4.95, 7.78]],
708
- repeat: [[3, 1], [18, 16]],
709
- stroke: 1
710
- },
711
- "tree2": {
712
- width: 30,
713
- height: 30,
714
- lines: [[7.78, 10.61, 4.95, 10.61, 4.95, 7.78, 3.54, 7.78, 2.12, 6.36, 0.71, 6.36, 0, 4.24, 0.71, 2.12, 4.24, 0, 7.78, 0.71, 9.19, 3.54, 7.78, 4.95, 7.07, 7.07, 4.95, 7.78, 4.95, 10.61, 7.78, 10.61]],
715
- repeat: [[3, 1], [18, 16]],
716
- fill: 1,
717
- stroke: 1
718
- },
719
- "pine": {
720
- width: 30,
721
- height: 30,
722
- lines: [[5.66, 11.31, 2.83, 11.31, 2.83, 8.49, 0, 8.49, 2.83, 0, 5.66, 8.49, 2.83, 8.49]],
723
- repeat: [[3, 1], [18, 16]],
724
- stroke: 1
725
- },
726
- "pine2": {
727
- width: 30,
728
- height: 30,
729
- lines: [[5.66, 11.31, 2.83, 11.31, 2.83, 8.49, 0, 8.49, 2.83, 0, 5.66, 8.49, 2.83, 8.49, 2.83, 11.31, 5.66, 11.31]],
730
- repeat: [[3, 1], [18, 16]],
731
- fill: 1,
732
- stroke: 1
733
- },
734
- "mixtree": {
735
- width: 30,
736
- height: 30,
737
- lines: [
738
- [7.78, 10.61, 4.95, 10.61, 4.95, 7.78, 3.54, 7.78, 2.12, 6.36, 0.71, 6.36, 0, 4.24, 0.71, 2.12, 4.24, 0, 7.78, 0.71, 9.19, 3.54, 7.78, 4.95, 7.07, 7.07, 4.95, 7.78, 4.95, 10.61, 7.78, 10.61],
739
- [23.66, 27.31, 20.83, 27.31, 20.83, 24.49, 18, 24.49, 20.83, 16, 23.66, 24.49, 20.83, 24.49, 20.83, 27.31, 23.66, 27.31]
740
- ],
741
- repeat: [[3, 1]],
742
- stroke: 1
743
- },
744
- "mixtree2": {
745
- width: 30,
746
- height: 30,
747
- lines: [
748
- [7.78, 10.61, 4.95, 10.61, 4.95, 7.78, 3.54, 7.78, 2.12, 6.36, 0.71, 6.36, 0, 4.24, 0.71, 2.12, 4.24, 0, 7.78, 0.71, 9.19, 3.54, 7.78, 4.95, 7.07, 7.07, 4.95, 7.78, 4.95, 10.61, 7.78, 10.61],
749
- [23.66, 27.31, 20.83, 27.31, 20.83, 24.49, 18, 24.49, 20.83, 16, 23.66, 24.49, 20.83, 24.49, 20.83, 27.31, 23.66, 27.31]
750
- ],
751
- repeat: [[3, 1]],
752
- fill: 1,
753
- stroke: 1
754
- },
755
- "pines": {
756
- width: 22,
757
- height: 20,
758
- lines: [[1, 4, 3.5, 1, 6, 4], [1, 8, 3.5, 5, 6, 8], [3.5, 1, 3.5, 11], [12, 14.5, 14.5, 14, 17, 14.5], [12, 18, 17, 18], [14.5, 12, 14.5, 18]],
759
- repeat: [[2, 1]],
760
- stroke: 1
761
- },
762
- "rock": {
763
- width: 20,
764
- height: 20,
765
- lines: [
766
- [1, 0, 1, 9],
767
- [4, 0, 4, 9],
768
- [7, 0, 7, 9],
769
- [10, 1, 19, 1],
770
- [10, 4, 19, 4],
771
- [10, 7, 19, 7],
772
- [0, 11, 9, 11],
773
- [0, 14, 9, 14],
774
- [0, 17, 9, 17],
775
- [12, 10, 12, 19],
776
- [15, 10, 15, 19],
777
- [18, 10, 18, 19]
778
- ],
779
- repeat: [[0.5, 0.5]],
780
- stroke: 1
781
- },
782
- "rocks": {
783
- width: 20,
784
- height: 20,
785
- lines: [
786
- [
787
- 5,
788
- 0,
789
- 3,
790
- 0,
791
- 5,
792
- 4,
793
- 4,
794
- 6,
795
- 0,
796
- 3,
797
- 0,
798
- 5,
799
- 3,
800
- 6,
801
- 5,
802
- 9,
803
- 3.75,
804
- 10,
805
- 2.5,
806
- 10,
807
- 0,
808
- 9,
809
- 0,
810
- 10,
811
- 4,
812
- 11,
813
- 5,
814
- 14,
815
- 4,
816
- 15,
817
- 0,
818
- 13,
819
- 0,
820
- 13,
821
- 0,
822
- 13,
823
- 0,
824
- 14,
825
- 0,
826
- 14,
827
- 5,
828
- 16,
829
- 5,
830
- 18,
831
- 3,
832
- 19,
833
- 0,
834
- 19,
835
- -0.25,
836
- 19.9375,
837
- 5,
838
- 20,
839
- 10,
840
- 19,
841
- 10,
842
- 20,
843
- 11,
844
- 20,
845
- 12,
846
- 19,
847
- 14,
848
- 20,
849
- 15,
850
- 20,
851
- 17,
852
- 19,
853
- 20,
854
- 20,
855
- 20,
856
- 19,
857
- 19,
858
- 16,
859
- 20,
860
- 15,
861
- 20,
862
- 11,
863
- 20,
864
- 10,
865
- 19,
866
- 8,
867
- 20,
868
- 5,
869
- 20,
870
- 0,
871
- 19,
872
- 0,
873
- 20,
874
- 2,
875
- 19,
876
- 4,
877
- 17,
878
- 4,
879
- 16,
880
- 3,
881
- 15,
882
- 0,
883
- 14,
884
- 0,
885
- 15,
886
- 4,
887
- 11,
888
- 5,
889
- 10,
890
- 4,
891
- 11,
892
- 0,
893
- 10,
894
- 0,
895
- 9,
896
- 4,
897
- 6,
898
- 5,
899
- 5,
900
- 0
901
- ],
902
- [18, 5, 19, 6, 18, 10, 16, 10, 14, 9, 16, 5, 18, 5],
903
- [5, 6, 9, 5, 10, 6, 10, 9, 6, 10, 5, 6],
904
- [14, 5, 14, 8, 13, 9, 12, 9, 11, 7, 12, 5, 14, 5],
905
- [5, 11, 8, 10, 9, 11, 10, 14, 6, 15, 6, 15, 5, 11],
906
- [13, 10, 14, 11, 15, 14, 15, 14, 15, 14, 11, 15, 10, 11, 11, 10, 13, 10],
907
- [15, 12, 16, 11, 19, 11, 19, 15, 16, 14, 16, 14, 15, 12],
908
- [6, 16, 9, 15, 10, 18, 5, 19, 6, 16],
909
- [10, 16, 14, 16, 14, 18, 13, 19, 11, 18, 10, 16],
910
- [15, 15, 18, 16, 18, 18, 16, 19, 15, 18, 15, 15]
911
- ],
912
- stroke: 1
913
- }
914
- };
915
- var ol_filter_Base = function(options) {
916
- ol_Object.call(this, options);
917
- this._listener = [];
918
- if (options && options.active === false)
919
- this.set("active", false);
920
- else
921
- this.set("active", true);
922
- };
923
- ol_ext_inherits(ol_filter_Base, ol_Object);
924
- ol_filter_Base.prototype.setActive = function(b) {
925
- this.set("active", b === true);
926
- };
927
- ol_filter_Base.prototype.getActive = function() {
928
- return this.get("active");
929
- };
930
- (function() {
931
- function precompose_(e) {
932
- if (this.get("active") && e.context)
933
- this.precompose(e);
934
- }
935
- function postcompose_(e) {
936
- if (this.get("active") && e.context)
937
- this.postcompose(e);
938
- }
939
- function filterRedraw_() {
940
- if (this.renderSync) {
941
- try {
942
- this.renderSync();
943
- } catch (e) {
944
- }
945
- } else {
946
- this.changed();
947
- }
948
- }
949
- function addFilter_(filter) {
950
- if (!this.filters_)
951
- this.filters_ = [];
952
- this.filters_.push(filter);
953
- if (filter.addToLayer)
954
- filter.addToLayer(this);
955
- if (filter.precompose)
956
- filter._listener.push({ listener: this.on(["precompose", "prerender"], precompose_.bind(filter)), target: this });
957
- if (filter.postcompose)
958
- filter._listener.push({ listener: this.on(["postcompose", "postrender"], postcompose_.bind(filter)), target: this });
959
- filter._listener.push({ listener: filter.on("propertychange", filterRedraw_.bind(this)), target: this });
960
- filterRedraw_.call(this);
961
- }
962
- function removeFilter_(filter) {
963
- var i;
964
- if (!this.filters_)
965
- this.filters_ = [];
966
- if (!filter) {
967
- this.filters_.forEach(function(f) {
968
- this.removeFilter(f);
969
- }.bind(this));
970
- return;
971
- }
972
- for (i = this.filters_.length - 1; i >= 0; i--) {
973
- if (this.filters_[i] === filter)
974
- this.filters_.splice(i, 1);
975
- }
976
- for (i = filter._listener.length - 1; i >= 0; i--) {
977
- if (filter._listener[i].target === this) {
978
- if (filter.removeFromLayer)
979
- filter.removeFromLayer(this);
980
- unByKey(filter._listener[i].listener);
981
- filter._listener.splice(i, 1);
982
- }
983
- }
984
- filterRedraw_.call(this);
985
- }
986
- ol_Map.prototype.addFilter = function(filter) {
987
- console.warn("[OL-EXT] addFilter deprecated on map.");
988
- addFilter_.call(this, filter);
989
- };
990
- ol_Map.prototype.removeFilter = function(filter) {
991
- removeFilter_.call(this, filter);
992
- };
993
- ol_Map.prototype.getFilters = function() {
994
- return this.filters_ || [];
995
- };
996
- ol_layer_Base.prototype.addFilter = function(filter) {
997
- addFilter_.call(this, filter);
998
- };
999
- ol_layer_Base.prototype.removeFilter = function(filter) {
1000
- removeFilter_.call(this, filter);
1001
- };
1002
- ol_layer_Base.prototype.getFilters = function() {
1003
- return this.filters_ || [];
1004
- };
1005
- })();
1006
- var ol_filter_Mask = function(options) {
1007
- options = options || {};
1008
- ol_filter_Base.call(this, options);
1009
- if (options.feature) {
1010
- switch (options.feature.getGeometry().getType()) {
1011
- case "Polygon":
1012
- case "MultiPolygon":
1013
- this.feature_ = options.feature;
1014
- break;
1015
- }
1016
- }
1017
- this.set("inner", options.inner);
1018
- this.fillColor_ = options.fill ? asString(options.fill.getColor()) || "rgba(0,0,0,0.2)" : "rgba(0,0,0,0.2)";
1019
- };
1020
- ol_ext_inherits(ol_filter_Mask, ol_filter_Base);
1021
- ol_filter_Mask.prototype.drawFeaturePath_ = function(e, out) {
1022
- var ctx = e.context;
1023
- var canvas = ctx.canvas;
1024
- var ratio = e.frameState.pixelRatio;
1025
- var tr;
1026
- if (e.frameState.coordinateToPixelTransform) {
1027
- var m = e.frameState.coordinateToPixelTransform;
1028
- if (e.inversePixelTransform) {
1029
- var ipt = e.inversePixelTransform;
1030
- tr = function(pt) {
1031
- pt = [
1032
- pt[0] * m[0] + pt[1] * m[1] + m[4],
1033
- pt[0] * m[2] + pt[1] * m[3] + m[5]
1034
- ];
1035
- return [
1036
- pt[0] * ipt[0] - pt[1] * ipt[1] + ipt[4],
1037
- -pt[0] * ipt[2] + pt[1] * ipt[3] + ipt[5]
1038
- ];
1039
- };
1040
- } else {
1041
- tr = function(pt) {
1042
- return [
1043
- (pt[0] * m[0] + pt[1] * m[1] + m[4]) * ratio,
1044
- (pt[0] * m[2] + pt[1] * m[3] + m[5]) * ratio
1045
- ];
1046
- };
1047
- }
1048
- } else {
1049
- m = e.frameState.coordinateToPixelMatrix;
1050
- tr = function(pt) {
1051
- return [
1052
- (pt[0] * m[0] + pt[1] * m[1] + m[12]) * ratio,
1053
- (pt[0] * m[4] + pt[1] * m[5] + m[13]) * ratio
1054
- ];
1055
- };
1056
- }
1057
- var ll = this.feature_.getGeometry().getCoordinates();
1058
- if (this.feature_.getGeometry().getType() === "Polygon")
1059
- ll = [ll];
1060
- function drawll(dx) {
1061
- for (var l = 0; l < ll.length; l++) {
1062
- var c = ll[l];
1063
- for (var i2 = 0; i2 < c.length; i2++) {
1064
- var pt = tr([c[i2][0][0] + dx, c[i2][0][1]]);
1065
- ctx.moveTo(pt[0], pt[1]);
1066
- for (var j = 1; j < c[i2].length; j++) {
1067
- pt = tr([c[i2][j][0] + dx, c[i2][j][1]]);
1068
- ctx.lineTo(pt[0], pt[1]);
1069
- }
1070
- }
1071
- }
1072
- }
1073
- ctx.beginPath();
1074
- if (out) {
1075
- ctx.moveTo(0, 0);
1076
- ctx.lineTo(canvas.width, 0);
1077
- ctx.lineTo(canvas.width, canvas.height);
1078
- ctx.lineTo(0, canvas.height);
1079
- ctx.lineTo(0, 0);
1080
- }
1081
- if (this.get("wrapX")) {
1082
- var worldExtent = e.frameState.viewState.projection.getExtent();
1083
- var worldWidth = worldExtent[2] - worldExtent[0];
1084
- var extent = e.frameState.extent;
1085
- var fExtent = this.feature_.getGeometry().getExtent();
1086
- var fWidth = fExtent[2] - fExtent[1];
1087
- var start = Math.floor((extent[0] + fWidth - worldExtent[0]) / worldWidth);
1088
- var end = Math.floor((extent[2] - fWidth - worldExtent[2]) / worldWidth) + 1;
1089
- if (start > end) {
1090
- [start, end] = [end, start];
1091
- }
1092
- for (var i = start; i <= end; i++) {
1093
- drawll(i * worldWidth);
1094
- }
1095
- } else {
1096
- drawll(0);
1097
- }
1098
- };
1099
- ol_filter_Mask.prototype.postcompose = function(e) {
1100
- if (!this.feature_)
1101
- return;
1102
- var ctx = e.context;
1103
- ctx.save();
1104
- this.drawFeaturePath_(e, !this.get("inner"));
1105
- ctx.fillStyle = this.fillColor_;
1106
- ctx.fill("evenodd");
1107
- ctx.restore();
1108
- };
1109
- var ol_filter_PencilSketch = function(options) {
1110
- options = options || {};
1111
- ol_filter_Base.call(this, options);
1112
- this.set("blur", options.blur || 8);
1113
- this.set("intensity", options.intensity || 0.8);
1114
- };
1115
- ol_ext_inherits(ol_filter_PencilSketch, ol_filter_Base);
1116
- ol_filter_PencilSketch.prototype.precompose = function() {
1117
- };
1118
- ol_filter_PencilSketch.prototype.postcompose = function(e) {
1119
- var ctx = e.context;
1120
- var canvas = ctx.canvas;
1121
- var w = canvas.width;
1122
- var h = canvas.height;
1123
- var bwimg = document.createElement("canvas");
1124
- bwimg.width = w;
1125
- bwimg.height = h;
1126
- var bwctx = bwimg.getContext("2d");
1127
- bwctx.filter = "grayscale(1) invert(1) blur(" + this.get("blur") + "px)";
1128
- bwctx.drawImage(canvas, 0, 0);
1129
- ctx.save();
1130
- if (!this.get("color")) {
1131
- ctx.filter = "grayscale(1)";
1132
- ctx.drawImage(canvas, 0, 0);
1133
- } else {
1134
- ctx.globalCompositeOperation = "darken";
1135
- ctx.globalAlpha = 0.3;
1136
- ctx.drawImage(canvas, 0, 0);
1137
- }
1138
- ctx.globalCompositeOperation = "color-dodge";
1139
- ctx.globalAlpha = this.get("intensity");
1140
- ctx.drawImage(bwimg, 0, 0);
1141
- ctx.restore();
1142
- };
1143
- var ol_filter_Colorize = function(options) {
1144
- ol_filter_Base.call(this, options);
1145
- this.setFilter(options);
1146
- };
1147
- ol_ext_inherits(ol_filter_Colorize, ol_filter_Base);
1148
- ol_filter_Colorize.prototype.setFilter = function(options) {
1149
- options = options || {};
1150
- switch (options) {
1151
- case "grayscale":
1152
- options = { operation: "hue", color: [0, 0, 0], value: 1 };
1153
- break;
1154
- case "invert":
1155
- options = { operation: "difference", color: [255, 255, 255], value: 1 };
1156
- break;
1157
- case "sepia":
1158
- options = { operation: "color", color: [153, 102, 51], value: 0.6 };
1159
- break;
1160
- }
1161
- var color = options.color ? asArray(options.color) : [options.red, options.green, options.blue, options.value];
1162
- this.set("color", asString(color));
1163
- this.set("value", options.value || 1);
1164
- this.set("preserveAlpha", options.preserveAlpha);
1165
- var v;
1166
- switch (options.operation) {
1167
- case "hue":
1168
- case "difference":
1169
- case "color-dodge":
1170
- case "enhance": {
1171
- this.set("operation", options.operation);
1172
- break;
1173
- }
1174
- case "saturation": {
1175
- v = 255 * (options.value || 0);
1176
- this.set("color", asString([0, 0, v, v || 1]));
1177
- this.set("operation", options.operation);
1178
- break;
1179
- }
1180
- case "luminosity": {
1181
- v = 255 * (options.value || 0);
1182
- this.set("color", asString([v, v, v, 255]));
1183
- this.set("operation", "hard-light");
1184
- break;
1185
- }
1186
- case "contrast": {
1187
- v = 255 * (options.value || 0);
1188
- this.set("color", asString([v, v, v, 255]));
1189
- this.set("operation", "soft-light");
1190
- break;
1191
- }
1192
- default: {
1193
- this.set("operation", "color");
1194
- this.setValue(options.value || 1);
1195
- break;
1196
- }
1197
- }
1198
- };
1199
- ol_filter_Colorize.prototype.setValue = function(v) {
1200
- this.set("value", v);
1201
- var c = asArray(this.get("color"));
1202
- c[3] = v;
1203
- this.set("color", asString(c));
1204
- };
1205
- ol_filter_Colorize.prototype.setColor = function(c) {
1206
- c = asArray(c);
1207
- if (c) {
1208
- c[3] = this.get("value");
1209
- this.set("color", asString(c));
1210
- }
1211
- };
1212
- ol_filter_Colorize.prototype.precompose = function() {
1213
- };
1214
- ol_filter_Colorize.prototype.postcompose = function(e) {
1215
- var c2, ctx2;
1216
- var ctx = e.context;
1217
- var canvas = ctx.canvas;
1218
- ctx.save();
1219
- if (this.get("operation") == "enhance") {
1220
- var v = this.get("value");
1221
- if (v) {
1222
- var w = canvas.width;
1223
- var h = canvas.height;
1224
- if (this.get("preserveAlpha")) {
1225
- c2 = document.createElement("CANVAS");
1226
- c2.width = canvas.width;
1227
- c2.height = canvas.height;
1228
- ctx2 = c2.getContext("2d");
1229
- ctx2.drawImage(canvas, 0, 0, w, h);
1230
- ctx2.globalCompositeOperation = "color-burn";
1231
- console.log(v);
1232
- ctx2.globalAlpha = v;
1233
- ctx2.drawImage(c2, 0, 0, w, h);
1234
- ctx2.drawImage(c2, 0, 0, w, h);
1235
- ctx2.drawImage(c2, 0, 0, w, h);
1236
- ctx.globalCompositeOperation = "source-in";
1237
- ctx.drawImage(c2, 0, 0);
1238
- } else {
1239
- ctx.globalCompositeOperation = "color-burn";
1240
- ctx.globalAlpha = v;
1241
- ctx.drawImage(canvas, 0, 0, w, h);
1242
- ctx.drawImage(canvas, 0, 0, w, h);
1243
- ctx.drawImage(canvas, 0, 0, w, h);
1244
- }
1245
- }
1246
- } else {
1247
- if (this.get("preserveAlpha")) {
1248
- c2 = document.createElement("CANVAS");
1249
- c2.width = canvas.width;
1250
- c2.height = canvas.height;
1251
- ctx2 = c2.getContext("2d");
1252
- ctx2.drawImage(canvas, 0, 0);
1253
- ctx2.globalCompositeOperation = this.get("operation");
1254
- ctx2.fillStyle = this.get("color");
1255
- ctx2.fillRect(0, 0, canvas.width, canvas.height);
1256
- ctx.globalCompositeOperation = "source-in";
1257
- ctx.drawImage(c2, 0, 0);
1258
- } else {
1259
- ctx.globalCompositeOperation = this.get("operation");
1260
- ctx.fillStyle = this.get("color");
1261
- ctx.fillRect(0, 0, canvas.width, canvas.height);
1262
- }
1263
- }
1264
- ctx.restore();
1265
- };
1266
- var ol_filter_CanvasFilter = function(options) {
1267
- ol_filter_Base.call(this, options);
1268
- this._svg = {};
1269
- };
1270
- ol_ext_inherits(ol_filter_CanvasFilter, ol_filter_Base);
1271
- ol_filter_CanvasFilter.prototype.addSVGFilter = function(url) {
1272
- if (url.getId)
1273
- url = "#" + url.getId();
1274
- this._svg[url] = 1;
1275
- this.dispatchEvent({ type: "propertychange", key: "svg", oldValue: this._svg });
1276
- };
1277
- ol_filter_CanvasFilter.prototype.removeSVGFilter = function(url) {
1278
- if (url.getId)
1279
- url = "#" + url.getId();
1280
- delete this._svg[url];
1281
- this.dispatchEvent({ type: "propertychange", key: "svg", oldValue: this._svg });
1282
- };
1283
- ol_filter_CanvasFilter.prototype.precompose = function() {
1284
- };
1285
- ol_filter_CanvasFilter.prototype.postcompose = function(e) {
1286
- var filter = [];
1287
- if (this.get("url") !== void 0)
1288
- filter.push("url(" + this.get("url") + ")");
1289
- for (var f in this._svg) {
1290
- filter.push("url(" + f + ")");
1291
- }
1292
- if (this.get("blur") !== void 0)
1293
- filter.push("blur(" + this.get("blur") + "px)");
1294
- if (this.get("brightness") !== void 0)
1295
- filter.push("brightness(" + this.get("brightness") + "%)");
1296
- if (this.get("contrast") !== void 0)
1297
- filter.push("contrast(" + this.get("contrast") + "%)");
1298
- if (this.get("shadow") !== void 0) {
1299
- filter.push("drop-shadow(" + this.get("shadow")[0] + "px " + this.get("shadow")[1] + "px " + (this.get("shadowBlur") || 0) + "px " + this.get("shadowColor") + ")");
1300
- }
1301
- if (this.get("grayscale") !== void 0)
1302
- filter.push("grayscale(" + this.get("grayscale") + "%)");
1303
- if (this.get("sepia") !== void 0)
1304
- filter.push("sepia(" + this.get("sepia") + "%)");
1305
- if (this.get("hueRotate") !== void 0)
1306
- filter.push("hue-rotate(" + this.get("hueRotate") + "deg)");
1307
- if (this.get("invert") !== void 0)
1308
- filter.push("invert(" + this.get("invert") + "%)");
1309
- if (this.get("saturate") !== void 0)
1310
- filter.push("saturate(" + this.get("saturate") + "%)");
1311
- filter = filter.join(" ");
1312
- if (filter) {
1313
- e.context.save();
1314
- e.context.filter = filter;
1315
- e.context.drawImage(e.context.canvas, 0, 0);
1316
- e.context.restore();
1317
- }
1318
- };
1319
- var ol_ext_SVGOperation = function(attributes) {
1320
- if (typeof attributes === "string")
1321
- attributes = { feoperation: attributes };
1322
- if (!attributes || !attributes.feoperation) {
1323
- console.error("[SVGOperation]: no operation defined.");
1324
- return;
1325
- }
1326
- ol_Object.call(this);
1327
- this._name = attributes.feoperation;
1328
- this.element = document.createElementNS(this.NS, this._name);
1329
- this.setProperties(attributes);
1330
- if (attributes.operations instanceof Array)
1331
- this.appendChild(attributes.operations);
1332
- };
1333
- ol_ext_inherits(ol_ext_SVGOperation, ol_Object);
1334
- ol_ext_SVGOperation.prototype.NS = "http://www.w3.org/2000/svg";
1335
- ol_ext_SVGOperation.prototype.getName = function() {
1336
- return this._name;
1337
- };
1338
- ol_ext_SVGOperation.prototype.set = function(k, val) {
1339
- if (!/^feoperation$|^operations$/.test(k)) {
1340
- ol_Object.prototype.set.call(this, k, val);
1341
- this.element.setAttribute(k, val);
1342
- }
1343
- };
1344
- ol_ext_SVGOperation.prototype.setProperties = function(attributes) {
1345
- attributes = attributes || {};
1346
- for (var k in attributes) {
1347
- this.set(k, attributes[k]);
1348
- }
1349
- };
1350
- ol_ext_SVGOperation.prototype.geElement = function() {
1351
- return this.element;
1352
- };
1353
- ol_ext_SVGOperation.prototype.appendChild = function(operation) {
1354
- if (operation instanceof Array) {
1355
- operation.forEach(function(o) {
1356
- this.appendChild(o);
1357
- }.bind(this));
1358
- } else {
1359
- if (!(operation instanceof ol_ext_SVGOperation))
1360
- operation = new ol_ext_SVGOperation(operation);
1361
- this.element.appendChild(operation.geElement());
1362
- }
1363
- };
1364
- var ol_ext_SVGFilter = function(options) {
1365
- options = options || {};
1366
- ol_Object.call(this);
1367
- if (!ol_ext_SVGFilter.prototype.svg) {
1368
- ol_ext_SVGFilter.prototype.svg = document.createElementNS(this.NS, "svg");
1369
- ol_ext_SVGFilter.prototype.svg.setAttribute("version", "1.1");
1370
- ol_ext_SVGFilter.prototype.svg.setAttribute("width", 0);
1371
- ol_ext_SVGFilter.prototype.svg.setAttribute("height", 0);
1372
- ol_ext_SVGFilter.prototype.svg.style.position = "absolute";
1373
- document.body.appendChild(ol_ext_SVGFilter.prototype.svg);
1374
- }
1375
- this.element = document.createElementNS(this.NS, "filter");
1376
- this._id = options.id || "_ol_SVGFilter_" + ol_ext_SVGFilter.prototype._id++;
1377
- this.element.setAttribute("id", this._id);
1378
- if (options.color)
1379
- this.element.setAttribute("color-interpolation-filters", options.color);
1380
- if (options.operation)
1381
- this.addOperation(options.operation);
1382
- ol_ext_SVGFilter.prototype.svg.appendChild(this.element);
1383
- };
1384
- ol_ext_inherits(ol_ext_SVGFilter, ol_Object);
1385
- ol_ext_SVGFilter.prototype.NS = "http://www.w3.org/2000/svg";
1386
- ol_ext_SVGFilter.prototype.svg = null;
1387
- ol_ext_SVGFilter.prototype._id = 0;
1388
- ol_ext_SVGFilter.prototype.getId = function() {
1389
- return this._id;
1390
- };
1391
- ol_ext_SVGFilter.prototype.remove = function() {
1392
- this.element.remove();
1393
- };
1394
- ol_ext_SVGFilter.prototype.addOperation = function(operation) {
1395
- if (operation instanceof Array) {
1396
- operation.forEach(function(o) {
1397
- this.addOperation(o);
1398
- }.bind(this));
1399
- } else {
1400
- if (!(operation instanceof ol_ext_SVGOperation))
1401
- operation = new ol_ext_SVGOperation(operation);
1402
- this.element.appendChild(operation.geElement());
1403
- }
1404
- };
1405
- ol_ext_SVGFilter.prototype.grayscale = function(value) {
1406
- this.addOperation({
1407
- feoperation: "feColorMatrix",
1408
- type: "saturate",
1409
- values: value || 0
1410
- });
1411
- };
1412
- ol_ext_SVGFilter.prototype.luminanceToAlpha = function(options) {
1413
- options = options || {};
1414
- this.addOperation({
1415
- feoperation: "feColorMatrix",
1416
- type: "luminanceToAlpha"
1417
- });
1418
- if (options.gamma) {
1419
- this.addOperation({
1420
- feoperation: "feComponentTransfer",
1421
- operations: [{
1422
- feoperation: "feFuncA",
1423
- type: "gamma",
1424
- amplitude: options.gamma,
1425
- exponent: 1,
1426
- offset: 0
1427
- }]
1428
- });
1429
- }
1430
- };
1431
- ol_ext_SVGFilter.prototype.applyTo = function(img) {
1432
- var canvas = document.createElement("CANVAS");
1433
- canvas.width = img.naturalWidth || img.width;
1434
- canvas.height = img.naturalHeight || img.height;
1435
- canvas.getContext("2d").filter = "url(#" + this.getId() + ")";
1436
- canvas.getContext("2d").drawImage(img, 0, 0);
1437
- return canvas;
1438
- };
1439
- var ol_control_Swipe = function(options) {
1440
- options = options || {};
1441
- var button = document.createElement("button");
1442
- var element = document.createElement("div");
1443
- element.className = (options.className || "ol-swipe") + " ol-unselectable ol-control";
1444
- element.appendChild(button);
1445
- element.addEventListener("mousedown", this.move.bind(this));
1446
- element.addEventListener("touchstart", this.move.bind(this));
1447
- ol_control_Control.call(this, {
1448
- element
1449
- });
1450
- this.precomposeRight_ = this.precomposeRight.bind(this);
1451
- this.precomposeLeft_ = this.precomposeLeft.bind(this);
1452
- this.postcompose_ = this.postcompose.bind(this);
1453
- this.layers = [];
1454
- if (options.layers)
1455
- this.addLayer(options.layers, false);
1456
- if (options.rightLayers)
1457
- this.addLayer(options.rightLayers, true);
1458
- this.on("propertychange", function(e) {
1459
- if (this.getMap()) {
1460
- try {
1461
- this.getMap().renderSync();
1462
- } catch (e2) {
1463
- }
1464
- }
1465
- if (this.get("orientation") === "horizontal") {
1466
- this.element.style.top = this.get("position") * 100 + "%";
1467
- this.element.style.left = "";
1468
- } else {
1469
- if (this.get("orientation") !== "vertical")
1470
- this.set("orientation", "vertical");
1471
- this.element.style.left = this.get("position") * 100 + "%";
1472
- this.element.style.top = "";
1473
- }
1474
- if (e.key === "orientation") {
1475
- this.element.classList.remove("horizontal", "vertical");
1476
- this.element.classList.add(this.get("orientation"));
1477
- }
1478
- if (!this.isMoving) {
1479
- this.layers.forEach(function(l) {
1480
- if (l.layer.getImageRatio)
1481
- l.layer.changed();
1482
- });
1483
- }
1484
- }.bind(this));
1485
- this.set("position", options.position || 0.5);
1486
- this.set("orientation", options.orientation || "vertical");
1487
- };
1488
- ol_ext_inherits(ol_control_Swipe, ol_control_Control);
1489
- ol_control_Swipe.prototype.setMap = function(map) {
1490
- var i;
1491
- var l;
1492
- if (this.getMap()) {
1493
- for (i = 0; i < this.layers.length; i++) {
1494
- l = this.layers[i];
1495
- if (l.right)
1496
- l.layer.un(["precompose", "prerender"], this.precomposeRight_);
1497
- else
1498
- l.layer.un(["precompose", "prerender"], this.precomposeLeft_);
1499
- l.layer.un(["postcompose", "postrender"], this.postcompose_);
1500
- }
1501
- try {
1502
- this.getMap().renderSync();
1503
- } catch (e) {
1504
- }
1505
- }
1506
- ol_control_Control.prototype.setMap.call(this, map);
1507
- if (map) {
1508
- this._listener = [];
1509
- for (i = 0; i < this.layers.length; i++) {
1510
- l = this.layers[i];
1511
- if (l.right)
1512
- l.layer.on(["precompose", "prerender"], this.precomposeRight_);
1513
- else
1514
- l.layer.on(["precompose", "prerender"], this.precomposeLeft_);
1515
- l.layer.on(["postcompose", "postrender"], this.postcompose_);
1516
- }
1517
- try {
1518
- map.renderSync();
1519
- } catch (e) {
1520
- }
1521
- }
1522
- };
1523
- ol_control_Swipe.prototype.isLayer_ = function(layer) {
1524
- for (var k = 0; k < this.layers.length; k++) {
1525
- if (this.layers[k].layer === layer)
1526
- return k;
1527
- }
1528
- return -1;
1529
- };
1530
- ol_control_Swipe.prototype.addLayer = function(layers, right) {
1531
- if (!(layers instanceof Array))
1532
- layers = [layers];
1533
- for (var i = 0; i < layers.length; i++) {
1534
- var l = layers[i];
1535
- if (this.isLayer_(l) < 0) {
1536
- this.layers.push({ layer: l, right });
1537
- if (this.getMap()) {
1538
- if (right)
1539
- l.on(["precompose", "prerender"], this.precomposeRight_);
1540
- else
1541
- l.on(["precompose", "prerender"], this.precomposeLeft_);
1542
- l.on(["postcompose", "postrender"], this.postcompose_);
1543
- try {
1544
- this.getMap().renderSync();
1545
- } catch (e) {
1546
- }
1547
- }
1548
- }
1549
- }
1550
- };
1551
- ol_control_Swipe.prototype.removeLayers = function() {
1552
- var layers = [];
1553
- this.layers.forEach(function(l) {
1554
- layers.push(l.layer);
1555
- });
1556
- this.removeLayer(layers);
1557
- };
1558
- ol_control_Swipe.prototype.removeLayer = function(layers) {
1559
- if (!(layers instanceof Array))
1560
- layers = [layers];
1561
- for (var i = 0; i < layers.length; i++) {
1562
- var k = this.isLayer_(layers[i]);
1563
- if (k >= 0 && this.getMap()) {
1564
- if (this.layers[k].right)
1565
- layers[i].un(["precompose", "prerender"], this.precomposeRight_);
1566
- else
1567
- layers[i].un(["precompose", "prerender"], this.precomposeLeft_);
1568
- layers[i].un(["postcompose", "postrender"], this.postcompose_);
1569
- this.layers.splice(k, 1);
1570
- }
1571
- }
1572
- if (this.getMap()) {
1573
- try {
1574
- this.getMap().renderSync();
1575
- } catch (e) {
1576
- }
1577
- }
1578
- };
1579
- ol_control_Swipe.prototype.getRectangle = function() {
1580
- var s;
1581
- if (this.get("orientation") === "vertical") {
1582
- s = this.getMap().getSize();
1583
- return [0, 0, s[0] * this.get("position"), s[1]];
1584
- } else {
1585
- s = this.getMap().getSize();
1586
- return [0, 0, s[0], s[1] * this.get("position")];
1587
- }
1588
- };
1589
- ol_control_Swipe.prototype.move = function(e) {
1590
- var self = this;
1591
- var l;
1592
- if (!this._movefn)
1593
- this._movefn = this.move.bind(this);
1594
- switch (e.type) {
1595
- case "touchcancel":
1596
- case "touchend":
1597
- case "mouseup": {
1598
- self.isMoving = false;
1599
- ["mouseup", "mousemove", "touchend", "touchcancel", "touchmove"].forEach(function(eventName) {
1600
- document.removeEventListener(eventName, self._movefn);
1601
- });
1602
- this.layers.forEach(function(l2) {
1603
- if (l2.layer.getImageRatio)
1604
- l2.layer.changed();
1605
- });
1606
- break;
1607
- }
1608
- case "mousedown":
1609
- case "touchstart": {
1610
- self.isMoving = true;
1611
- ["mouseup", "mousemove", "touchend", "touchcancel", "touchmove"].forEach(function(eventName) {
1612
- document.addEventListener(eventName, self._movefn);
1613
- });
1614
- }
1615
- case "mousemove":
1616
- case "touchmove": {
1617
- if (self.isMoving) {
1618
- if (self.get("orientation") === "vertical") {
1619
- var pageX = e.pageX || e.touches && e.touches.length && e.touches[0].pageX || e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageX;
1620
- if (!pageX)
1621
- break;
1622
- pageX -= self.getMap().getTargetElement().getBoundingClientRect().left + window.pageXOffset - document.documentElement.clientLeft;
1623
- l = self.getMap().getSize()[0];
1624
- var w = l - Math.min(Math.max(0, l - pageX), l);
1625
- l = w / l;
1626
- self.set("position", l);
1627
- self.dispatchEvent({ type: "moving", size: [w, self.getMap().getSize()[1]], position: [l, 0] });
1628
- } else {
1629
- var pageY = e.pageY || e.touches && e.touches.length && e.touches[0].pageY || e.changedTouches && e.changedTouches.length && e.changedTouches[0].pageY;
1630
- if (!pageY)
1631
- break;
1632
- pageY -= self.getMap().getTargetElement().getBoundingClientRect().top + window.pageYOffset - document.documentElement.clientTop;
1633
- l = self.getMap().getSize()[1];
1634
- var h = l - Math.min(Math.max(0, l - pageY), l);
1635
- l = h / l;
1636
- self.set("position", l);
1637
- self.dispatchEvent({ type: "moving", size: [self.getMap().getSize()[0], h], position: [0, l] });
1638
- }
1639
- }
1640
- break;
1641
- }
1642
- }
1643
- };
1644
- ol_control_Swipe.prototype._transformPt = function(e, pt) {
1645
- var tr = e.inversePixelTransform;
1646
- var x = pt[0];
1647
- var y = pt[1];
1648
- pt[0] = tr[0] * x + tr[2] * y + tr[4];
1649
- pt[1] = tr[1] * x + tr[3] * y + tr[5];
1650
- return pt;
1651
- };
1652
- ol_control_Swipe.prototype._drawRect = function(e, pts) {
1653
- var tr = e.inversePixelTransform;
1654
- if (tr) {
1655
- var r = [
1656
- [pts[0][0], pts[0][1]],
1657
- [pts[0][0], pts[1][1]],
1658
- [pts[1][0], pts[1][1]],
1659
- [pts[1][0], pts[0][1]],
1660
- [pts[0][0], pts[0][1]]
1661
- ];
1662
- e.context.save();
1663
- if (e.target.getImageRatio) {
1664
- var rot = -Math.atan2(e.frameState.pixelToCoordinateTransform[1], e.frameState.pixelToCoordinateTransform[0]);
1665
- e.context.translate(e.frameState.size[0] / 2, e.frameState.size[1] / 2);
1666
- e.context.rotate(rot);
1667
- e.context.translate(-e.frameState.size[0] / 2, -e.frameState.size[1] / 2);
1668
- }
1669
- r.forEach(function(pt, i) {
1670
- pt = [
1671
- pt[0] * tr[0] - pt[1] * tr[1] + tr[4],
1672
- -pt[0] * tr[2] + pt[1] * tr[3] + tr[5]
1673
- ];
1674
- if (!i) {
1675
- e.context.moveTo(pt[0], pt[1]);
1676
- } else {
1677
- e.context.lineTo(pt[0], pt[1]);
1678
- }
1679
- });
1680
- e.context.restore();
1681
- } else {
1682
- var ratio = e.frameState.pixelRatio;
1683
- e.context.rect(pts[0][0] * ratio, pts[0][1] * ratio, pts[1][0] * ratio, pts[1][1] * ratio);
1684
- }
1685
- };
1686
- ol_control_Swipe.prototype.precomposeLeft = function(e) {
1687
- var ctx = e.context;
1688
- if (ctx instanceof WebGLRenderingContext) {
1689
- if (e.type === "prerender") {
1690
- ctx.clearColor(0, 0, 0, 0);
1691
- ctx.clear(ctx.COLOR_BUFFER_BIT);
1692
- ctx.enable(ctx.SCISSOR_TEST);
1693
- var mapSize = this.getMap().getSize();
1694
- var bottomLeft = this._transformPt(e, [0, mapSize[1]]);
1695
- var topRight = this._transformPt(e, [mapSize[0], 0]);
1696
- var fullWidth = topRight[0] - bottomLeft[0];
1697
- var fullHeight = topRight[1] - bottomLeft[1];
1698
- var width, height;
1699
- if (this.get("orientation") === "vertical") {
1700
- width = Math.round(fullWidth * this.get("position"));
1701
- height = fullHeight;
1702
- } else {
1703
- width = fullWidth;
1704
- height = Math.round(fullHeight * this.get("position"));
1705
- bottomLeft[1] += fullHeight - height;
1706
- }
1707
- ctx.scissor(bottomLeft[0], bottomLeft[1], width, height);
1708
- }
1709
- } else {
1710
- var size = e.frameState.size;
1711
- ctx.save();
1712
- ctx.beginPath();
1713
- var pts = [[0, 0], [size[0], size[1]]];
1714
- if (this.get("orientation") === "vertical") {
1715
- pts[1] = [
1716
- size[0] * 0.5 + this.getMap().getSize()[0] * (this.get("position") - 0.5),
1717
- size[1]
1718
- ];
1719
- } else {
1720
- pts[1] = [
1721
- size[0],
1722
- size[1] * 0.5 + this.getMap().getSize()[1] * (this.get("position") - 0.5)
1723
- ];
1724
- }
1725
- this._drawRect(e, pts);
1726
- ctx.clip();
1727
- }
1728
- };
1729
- ol_control_Swipe.prototype.precomposeRight = function(e) {
1730
- var ctx = e.context;
1731
- if (ctx instanceof WebGLRenderingContext) {
1732
- if (e.type === "prerender") {
1733
- ctx.clearColor(0, 0, 0, 0);
1734
- ctx.clear(ctx.COLOR_BUFFER_BIT);
1735
- ctx.enable(ctx.SCISSOR_TEST);
1736
- var mapSize = this.getMap().getSize();
1737
- var bottomLeft = this._transformPt(e, [0, mapSize[1]]);
1738
- var topRight = this._transformPt(e, [mapSize[0], 0]);
1739
- var fullWidth = topRight[0] - bottomLeft[0];
1740
- var fullHeight = topRight[1] - bottomLeft[1];
1741
- var width, height;
1742
- if (this.get("orientation") === "vertical") {
1743
- height = fullHeight;
1744
- width = Math.round(fullWidth * (1 - this.get("position")));
1745
- bottomLeft[0] += fullWidth - width;
1746
- } else {
1747
- width = fullWidth;
1748
- height = Math.round(fullHeight * (1 - this.get("position")));
1749
- }
1750
- ctx.scissor(bottomLeft[0], bottomLeft[1], width, height);
1751
- }
1752
- } else {
1753
- var size = e.frameState.size;
1754
- ctx.save();
1755
- ctx.beginPath();
1756
- var pts = [[0, 0], [size[0], size[1]]];
1757
- if (this.get("orientation") === "vertical") {
1758
- pts[0] = [
1759
- size[0] * 0.5 + this.getMap().getSize()[0] * (this.get("position") - 0.5),
1760
- 0
1761
- ];
1762
- } else {
1763
- pts[0] = [
1764
- 0,
1765
- size[1] * 0.5 + this.getMap().getSize()[1] * (this.get("position") - 0.5)
1766
- ];
1767
- }
1768
- this._drawRect(e, pts);
1769
- ctx.clip();
1770
- }
1771
- };
1772
- ol_control_Swipe.prototype.postcompose = function(e) {
1773
- if (e.context instanceof WebGLRenderingContext) {
1774
- if (e.type === "postrender") {
1775
- var gl = e.context;
1776
- gl.disable(gl.SCISSOR_TEST);
1777
- }
1778
- } else {
1779
- if (e.target.getClassName && e.target.getClassName() !== "ol-layer" && e.target.get("declutter")) {
1780
- setTimeout(function() {
1781
- e.context.restore();
1782
- }, 0);
1783
- } else {
1784
- e.context.restore();
1785
- }
1786
- }
1787
- };
1788
- var ol_interaction_Transform = function(options) {
1789
- if (!options)
1790
- options = {};
1791
- var self = this;
1792
- this.selection_ = new ol_Collection();
1793
- this.handles_ = new ol_Collection();
1794
- this.overlayLayer_ = new VectorLayer({
1795
- source: new VectorSource({
1796
- features: this.handles_,
1797
- useSpatialIndex: false,
1798
- wrapX: false
1799
- }),
1800
- name: "Transform overlay",
1801
- displayInLayerSwitcher: false,
1802
- style: function(feature) {
1803
- return self.style[(feature.get("handle") || "default") + (feature.get("constraint") || "") + (feature.get("option") || "")];
1804
- }
1805
- });
1806
- ol_interaction_Pointer.call(this, {
1807
- handleDownEvent: this.handleDownEvent_,
1808
- handleDragEvent: this.handleDragEvent_,
1809
- handleMoveEvent: this.handleMoveEvent_,
1810
- handleUpEvent: this.handleUpEvent_
1811
- });
1812
- this.features_ = options.features;
1813
- if (typeof options.filter === "function")
1814
- this._filter = options.filter;
1815
- this.layers_ = options.layers ? options.layers instanceof Array ? options.layers : [options.layers] : null;
1816
- this._handleEvent = options.condition || function() {
1817
- return true;
1818
- };
1819
- this.addFn_ = options.addCondition || function() {
1820
- return false;
1821
- };
1822
- this.setPointRadius(options.pointRadius);
1823
- this.set("translateFeature", options.translateFeature !== false);
1824
- this.set("translate", options.translate !== false);
1825
- this.set("translateBBox", options.translateBBox === true);
1826
- this.set("stretch", options.stretch !== false);
1827
- this.set("scale", options.scale !== false);
1828
- this.set("rotate", options.rotate !== false);
1829
- this.set("keepAspectRatio", options.keepAspectRatio || function(e) {
1830
- return e.originalEvent.shiftKey;
1831
- });
1832
- this.set("modifyCenter", options.modifyCenter || function(e) {
1833
- return e.originalEvent.metaKey || e.originalEvent.ctrlKey;
1834
- });
1835
- this.set("noFlip", options.noFlip || false);
1836
- this.set("selection", options.selection !== false);
1837
- this.set("hitTolerance", options.hitTolerance || 0);
1838
- this.set("enableRotatedTransform", options.enableRotatedTransform || false);
1839
- this.set("keepRectangle", options.keepRectangle || false);
1840
- this.on("propertychange", function() {
1841
- this.drawSketch_();
1842
- });
1843
- this.setDefaultStyle();
1844
- };
1845
- ol_ext_inherits(ol_interaction_Transform, ol_interaction_Pointer);
1846
- ol_interaction_Transform.prototype.Cursors = {
1847
- "default": "auto",
1848
- "select": "pointer",
1849
- "translate": "move",
1850
- "rotate": "move",
1851
- "rotate0": "move",
1852
- "scale": "nesw-resize",
1853
- "scale1": "nwse-resize",
1854
- "scale2": "nesw-resize",
1855
- "scale3": "nwse-resize",
1856
- "scalev": "ew-resize",
1857
- "scaleh1": "ns-resize",
1858
- "scalev2": "ew-resize",
1859
- "scaleh3": "ns-resize"
1860
- };
1861
- ol_interaction_Transform.prototype.setMap = function(map) {
1862
- var oldMap = this.getMap();
1863
- if (oldMap) {
1864
- var targetElement = oldMap.getTargetElement();
1865
- oldMap.removeLayer(this.overlayLayer_);
1866
- if (this.previousCursor_ && targetElement) {
1867
- targetElement.style.cursor = this.previousCursor_;
1868
- }
1869
- this.previousCursor_ = void 0;
1870
- }
1871
- ol_interaction_Pointer.prototype.setMap.call(this, map);
1872
- this.overlayLayer_.setMap(map);
1873
- if (map === null) {
1874
- this.select(null);
1875
- }
1876
- if (map !== null) {
1877
- this.isTouch = /touch/.test(map.getViewport().className);
1878
- this.setDefaultStyle();
1879
- }
1880
- };
1881
- ol_interaction_Transform.prototype.setActive = function(b) {
1882
- this.select(null);
1883
- this.overlayLayer_.setVisible(b);
1884
- ol_interaction_Pointer.prototype.setActive.call(this, b);
1885
- };
1886
- ol_interaction_Transform.prototype.setDefaultStyle = function(options) {
1887
- options = options || {};
1888
- var stroke = options.pointStroke || new Stroke({ color: [255, 0, 0, 1], width: 1 });
1889
- var strokedash = options.stroke || new Stroke({ color: [255, 0, 0, 1], width: 1, lineDash: [4, 4] });
1890
- var fill0 = options.fill || new Fill({ color: [255, 0, 0, 0.01] });
1891
- var fill = options.pointFill || new Fill({ color: [255, 255, 255, 0.8] });
1892
- var circle = new RegularShape({
1893
- fill,
1894
- stroke,
1895
- radius: this.isTouch ? 12 : 6,
1896
- displacement: this.isTouch ? [24, -24] : [12, -12],
1897
- points: 15
1898
- });
1899
- if (!circle.setDisplacement)
1900
- circle.getAnchor()[0] = this.isTouch ? -10 : -5;
1901
- var bigpt = new RegularShape({
1902
- fill,
1903
- stroke,
1904
- radius: this.isTouch ? 16 : 8,
1905
- points: 4,
1906
- angle: Math.PI / 4
1907
- });
1908
- var smallpt = new RegularShape({
1909
- fill,
1910
- stroke,
1911
- radius: this.isTouch ? 12 : 6,
1912
- points: 4,
1913
- angle: Math.PI / 4
1914
- });
1915
- function createStyle(img, stroke2, fill2) {
1916
- return [new Style({ image: img, stroke: stroke2, fill: fill2 })];
1917
- }
1918
- this.style = {
1919
- "default": createStyle(bigpt, strokedash, fill0),
1920
- "translate": createStyle(bigpt, stroke, fill),
1921
- "rotate": createStyle(circle, stroke, fill),
1922
- "rotate0": createStyle(bigpt, stroke, fill),
1923
- "scale": createStyle(bigpt, stroke, fill),
1924
- "scale1": createStyle(bigpt, stroke, fill),
1925
- "scale2": createStyle(bigpt, stroke, fill),
1926
- "scale3": createStyle(bigpt, stroke, fill),
1927
- "scalev": createStyle(smallpt, stroke, fill),
1928
- "scaleh1": createStyle(smallpt, stroke, fill),
1929
- "scalev2": createStyle(smallpt, stroke, fill),
1930
- "scaleh3": createStyle(smallpt, stroke, fill)
1931
- };
1932
- this.drawSketch_();
1933
- };
1934
- ol_interaction_Transform.prototype.setStyle = function(style, olstyle) {
1935
- if (!olstyle)
1936
- return;
1937
- if (olstyle instanceof Array)
1938
- this.style[style] = olstyle;
1939
- else
1940
- this.style[style] = [olstyle];
1941
- for (var i = 0; i < this.style[style].length; i++) {
1942
- var im = this.style[style][i].getImage();
1943
- if (im) {
1944
- if (style == "rotate") {
1945
- im.getAnchor()[0] = -5;
1946
- }
1947
- if (this.isTouch)
1948
- im.setScale(1.8);
1949
- }
1950
- var tx = this.style[style][i].getText();
1951
- if (tx) {
1952
- if (style == "rotate")
1953
- tx.setOffsetX(this.isTouch ? 14 : 7);
1954
- if (this.isTouch)
1955
- tx.setScale(1.8);
1956
- }
1957
- }
1958
- this.drawSketch_();
1959
- };
1960
- ol_interaction_Transform.prototype.getFeatureAtPixel_ = function(pixel) {
1961
- var self = this;
1962
- return this.getMap().forEachFeatureAtPixel(
1963
- pixel,
1964
- function(feature, layer) {
1965
- var found = false;
1966
- if (!layer) {
1967
- if (feature === self.bbox_) {
1968
- if (self.get("translateBBox")) {
1969
- return { feature, handle: "translate", constraint: "", option: "" };
1970
- } else {
1971
- return false;
1972
- }
1973
- }
1974
- self.handles_.forEach(function(f) {
1975
- if (f === feature)
1976
- found = true;
1977
- });
1978
- if (found)
1979
- return { feature, handle: feature.get("handle"), constraint: feature.get("constraint"), option: feature.get("option") };
1980
- }
1981
- if (!self.get("selection")) {
1982
- if (self.selection_.getArray().some(function(f) {
1983
- return feature === f;
1984
- })) {
1985
- return { feature };
1986
- }
1987
- return null;
1988
- }
1989
- if (self._filter) {
1990
- if (self._filter(feature, layer))
1991
- return { feature };
1992
- else
1993
- return null;
1994
- } else if (self.layers_) {
1995
- for (var i = 0; i < self.layers_.length; i++) {
1996
- if (self.layers_[i] === layer)
1997
- return { feature };
1998
- }
1999
- return null;
2000
- } else if (self.features_) {
2001
- self.features_.forEach(function(f) {
2002
- if (f === feature)
2003
- found = true;
2004
- });
2005
- if (found)
2006
- return { feature };
2007
- else
2008
- return null;
2009
- } else
2010
- return { feature };
2011
- },
2012
- { hitTolerance: this.get("hitTolerance") }
2013
- ) || {};
2014
- };
2015
- ol_interaction_Transform.prototype.getGeometryRotateToZero_ = function(f, clone) {
2016
- var origGeom = f.getGeometry();
2017
- var viewRotation = this.getMap().getView().getRotation();
2018
- if (viewRotation === 0 || !this.get("enableRotatedTransform")) {
2019
- return clone ? origGeom.clone() : origGeom;
2020
- }
2021
- var rotGeom = origGeom.clone();
2022
- rotGeom.rotate(viewRotation * -1, this.getMap().getView().getCenter());
2023
- return rotGeom;
2024
- };
2025
- ol_interaction_Transform.prototype._isRectangle = function(geom) {
2026
- if (this.get("keepRectangle") && geom.getType() === "Polygon") {
2027
- var coords = geom.getCoordinates()[0];
2028
- return coords.length === 5;
2029
- }
2030
- return false;
2031
- };
2032
- ol_interaction_Transform.prototype.drawSketch_ = function(center) {
2033
- var i, f, geom;
2034
- var keepRectangle = this.selection_.item(0) && this._isRectangle(this.selection_.item(0).getGeometry());
2035
- this.overlayLayer_.getSource().clear();
2036
- if (!this.selection_.getLength())
2037
- return;
2038
- var viewRotation = this.getMap().getView().getRotation();
2039
- var ext = this.getGeometryRotateToZero_(this.selection_.item(0)).getExtent();
2040
- var coords;
2041
- if (keepRectangle) {
2042
- coords = this.getGeometryRotateToZero_(this.selection_.item(0)).getCoordinates()[0].slice(0, 4);
2043
- coords.unshift(coords[3]);
2044
- }
2045
- ext = buffer(ext, 0);
2046
- this.selection_.forEach(function(f2) {
2047
- var extendExt = this.getGeometryRotateToZero_(f2).getExtent();
2048
- extend(ext, extendExt);
2049
- }.bind(this));
2050
- var ptRadius = this.selection_.getLength() === 1 ? this._pointRadius(this.selection_.item(0)) : 0;
2051
- if (ptRadius && !(ptRadius instanceof Array))
2052
- ptRadius = [ptRadius, ptRadius];
2053
- if (center === true) {
2054
- if (!this.ispt_) {
2055
- this.overlayLayer_.getSource().addFeature(new Feature({ geometry: new Point(this.center_), handle: "rotate0" }));
2056
- geom = fromExtent(ext);
2057
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2058
- geom.rotate(viewRotation, this.getMap().getView().getCenter());
2059
- }
2060
- f = this.bbox_ = new Feature(geom);
2061
- this.overlayLayer_.getSource().addFeature(f);
2062
- }
2063
- } else {
2064
- if (this.ispt_) {
2065
- var p = this.getMap().getPixelFromCoordinate([ext[0], ext[1]]);
2066
- if (p) {
2067
- var dx = ptRadius ? ptRadius[0] || 10 : 10;
2068
- var dy = ptRadius ? ptRadius[1] || 10 : 10;
2069
- ext = boundingExtent([
2070
- this.getMap().getCoordinateFromPixel([p[0] - dx, p[1] - dy]),
2071
- this.getMap().getCoordinateFromPixel([p[0] + dx, p[1] + dy])
2072
- ]);
2073
- }
2074
- }
2075
- geom = keepRectangle ? new ol_geom_Polygon([coords]) : fromExtent(ext);
2076
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2077
- geom.rotate(viewRotation, this.getMap().getView().getCenter());
2078
- }
2079
- f = this.bbox_ = new Feature(geom);
2080
- var features = [];
2081
- var g = geom.getCoordinates()[0];
2082
- if (!this.ispt_ || ptRadius) {
2083
- features.push(f);
2084
- if (!this.iscircle_ && !this.ispt_ && this.get("stretch") && this.get("scale"))
2085
- for (i = 0; i < g.length - 1; i++) {
2086
- f = new Feature({ geometry: new Point([(g[i][0] + g[i + 1][0]) / 2, (g[i][1] + g[i + 1][1]) / 2]), handle: "scale", constraint: i % 2 ? "h" : "v", option: i });
2087
- features.push(f);
2088
- }
2089
- if (this.get("scale"))
2090
- for (i = 0; i < g.length - 1; i++) {
2091
- f = new Feature({ geometry: new Point(g[i]), handle: "scale", option: i });
2092
- features.push(f);
2093
- }
2094
- if (this.get("translate") && !this.get("translateFeature")) {
2095
- f = new Feature({ geometry: new Point([(g[0][0] + g[2][0]) / 2, (g[0][1] + g[2][1]) / 2]), handle: "translate" });
2096
- features.push(f);
2097
- }
2098
- }
2099
- if (!this.iscircle_ && this.get("rotate")) {
2100
- f = new Feature({ geometry: new Point(g[3]), handle: "rotate" });
2101
- features.push(f);
2102
- }
2103
- this.overlayLayer_.getSource().addFeatures(features);
2104
- }
2105
- };
2106
- ol_interaction_Transform.prototype.select = function(feature, add) {
2107
- if (!feature) {
2108
- this.selection_.clear();
2109
- this.drawSketch_();
2110
- return;
2111
- }
2112
- if (!feature.getGeometry || !feature.getGeometry())
2113
- return;
2114
- if (add) {
2115
- this.selection_.push(feature);
2116
- } else {
2117
- var index = this.selection_.getArray().indexOf(feature);
2118
- this.selection_.removeAt(index);
2119
- }
2120
- this.ispt_ = this.selection_.getLength() === 1 ? this.selection_.item(0).getGeometry().getType() == "Point" : false;
2121
- this.iscircle_ = this.selection_.getLength() === 1 ? this.selection_.item(0).getGeometry().getType() == "Circle" : false;
2122
- this.drawSketch_();
2123
- this.watchFeatures_();
2124
- this.dispatchEvent({ type: "select", feature, features: this.selection_ });
2125
- };
2126
- ol_interaction_Transform.prototype.setSelection = function(features) {
2127
- this.selection_.clear();
2128
- features.forEach(function(feature) {
2129
- this.selection_.push(feature);
2130
- }.bind(this));
2131
- this.ispt_ = this.selection_.getLength() === 1 ? this.selection_.item(0).getGeometry().getType() == "Point" : false;
2132
- this.iscircle_ = this.selection_.getLength() === 1 ? this.selection_.item(0).getGeometry().getType() == "Circle" : false;
2133
- this.drawSketch_();
2134
- this.watchFeatures_();
2135
- this.dispatchEvent({ type: "select", features: this.selection_ });
2136
- };
2137
- ol_interaction_Transform.prototype.watchFeatures_ = function() {
2138
- if (this._featureListeners) {
2139
- this._featureListeners.forEach(function(l) {
2140
- unByKey(l);
2141
- });
2142
- }
2143
- this._featureListeners = [];
2144
- this.selection_.forEach(function(f) {
2145
- this._featureListeners.push(
2146
- f.on("change", function() {
2147
- if (!this.isUpdating_) {
2148
- this.drawSketch_();
2149
- }
2150
- }.bind(this))
2151
- );
2152
- }.bind(this));
2153
- };
2154
- ol_interaction_Transform.prototype.handleDownEvent_ = function(evt) {
2155
- if (!this._handleEvent(evt, this.selection_))
2156
- return;
2157
- var sel = this.getFeatureAtPixel_(evt.pixel);
2158
- var feature = sel.feature;
2159
- if (this.selection_.getLength() && this.selection_.getArray().indexOf(feature) >= 0 && (this.ispt_ && this.get("translate") || this.get("translateFeature"))) {
2160
- sel.handle = "translate";
2161
- }
2162
- if (sel.handle) {
2163
- this.mode_ = sel.handle;
2164
- this.opt_ = sel.option;
2165
- this.constraint_ = sel.constraint;
2166
- var viewRotation = this.getMap().getView().getRotation();
2167
- this.coordinate_ = evt.coordinate;
2168
- this.pixel_ = evt.pixel;
2169
- this.geoms_ = [];
2170
- this.rotatedGeoms_ = [];
2171
- var extent = createEmpty();
2172
- var rotExtent = createEmpty();
2173
- for (var i = 0, f; f = this.selection_.item(i); i++) {
2174
- this.geoms_.push(f.getGeometry().clone());
2175
- extent = extend(extent, f.getGeometry().getExtent());
2176
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2177
- var rotGeom = this.getGeometryRotateToZero_(f, true);
2178
- this.rotatedGeoms_.push(rotGeom);
2179
- rotExtent = extend(rotExtent, rotGeom.getExtent());
2180
- }
2181
- }
2182
- this.extent_ = fromExtent(extent).getCoordinates()[0];
2183
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2184
- this.rotatedExtent_ = fromExtent(rotExtent).getCoordinates()[0];
2185
- }
2186
- if (this.mode_ === "rotate") {
2187
- this.center_ = this.getCenter() || getCenter(extent);
2188
- var element = evt.map.getTargetElement();
2189
- element.style.cursor = this.Cursors.rotate0;
2190
- this.previousCursor_ = element.style.cursor;
2191
- } else {
2192
- this.center_ = getCenter(extent);
2193
- }
2194
- this.angle_ = Math.atan2(this.center_[1] - evt.coordinate[1], this.center_[0] - evt.coordinate[0]);
2195
- this.dispatchEvent({
2196
- type: this.mode_ + "start",
2197
- feature: this.selection_.item(0),
2198
- features: this.selection_,
2199
- pixel: evt.pixel,
2200
- coordinate: evt.coordinate
2201
- });
2202
- return true;
2203
- } else if (this.get("selection")) {
2204
- if (feature) {
2205
- if (!this.addFn_(evt))
2206
- this.selection_.clear();
2207
- var index = this.selection_.getArray().indexOf(feature);
2208
- if (index < 0)
2209
- this.selection_.push(feature);
2210
- else
2211
- this.selection_.removeAt(index);
2212
- } else {
2213
- this.selection_.clear();
2214
- }
2215
- this.ispt_ = this.selection_.getLength() === 1 ? this.selection_.item(0).getGeometry().getType() == "Point" : false;
2216
- this.iscircle_ = this.selection_.getLength() === 1 ? this.selection_.item(0).getGeometry().getType() == "Circle" : false;
2217
- this.drawSketch_();
2218
- this.watchFeatures_();
2219
- this.dispatchEvent({ type: "select", feature, features: this.selection_, pixel: evt.pixel, coordinate: evt.coordinate });
2220
- return false;
2221
- }
2222
- };
2223
- ol_interaction_Transform.prototype.getFeatures = function() {
2224
- return this.selection_;
2225
- };
2226
- ol_interaction_Transform.prototype.getCenter = function() {
2227
- return this.get("center");
2228
- };
2229
- ol_interaction_Transform.prototype.setCenter = function(c) {
2230
- return this.set("center", c);
2231
- };
2232
- function projectVectorOnVector(displacement_vector, base) {
2233
- var k = (displacement_vector[0] * base[0] + displacement_vector[1] * base[1]) / (base[0] * base[0] + base[1] * base[1]);
2234
- return [base[0] * k, base[1] * k];
2235
- }
2236
- function countVector(start, end) {
2237
- return [end[0] - start[0], end[1] - start[1]];
2238
- }
2239
- function movePoint(point, displacementVector) {
2240
- return [point[0] + displacementVector[0], point[1] + displacementVector[1]];
2241
- }
2242
- ol_interaction_Transform.prototype.handleDragEvent_ = function(evt) {
2243
- if (!this._handleEvent(evt, this.features_))
2244
- return;
2245
- var viewRotation = this.getMap().getView().getRotation();
2246
- var i, j, f, geometry;
2247
- var pt0 = [this.coordinate_[0], this.coordinate_[1]];
2248
- var pt = [evt.coordinate[0], evt.coordinate[1]];
2249
- this.isUpdating_ = true;
2250
- switch (this.mode_) {
2251
- case "rotate": {
2252
- var a = Math.atan2(this.center_[1] - pt[1], this.center_[0] - pt[0]);
2253
- if (!this.ispt) {
2254
- for (i = 0, f; f = this.selection_.item(i); i++) {
2255
- geometry = this.geoms_[i].clone();
2256
- geometry.rotate(a - this.angle_, this.center_);
2257
- if (geometry.getType() == "Circle")
2258
- geometry.setCenterAndRadius(geometry.getCenter(), geometry.getRadius());
2259
- f.setGeometry(geometry);
2260
- }
2261
- }
2262
- this.drawSketch_(true);
2263
- this.dispatchEvent({
2264
- type: "rotating",
2265
- feature: this.selection_.item(0),
2266
- features: this.selection_,
2267
- angle: a - this.angle_,
2268
- pixel: evt.pixel,
2269
- coordinate: evt.coordinate
2270
- });
2271
- break;
2272
- }
2273
- case "translate": {
2274
- var deltaX = pt[0] - pt0[0];
2275
- var deltaY = pt[1] - pt0[1];
2276
- for (i = 0, f; f = this.selection_.item(i); i++) {
2277
- f.getGeometry().translate(deltaX, deltaY);
2278
- }
2279
- this.handles_.forEach(function(f2) {
2280
- f2.getGeometry().translate(deltaX, deltaY);
2281
- });
2282
- this.coordinate_ = evt.coordinate;
2283
- this.dispatchEvent({
2284
- type: "translating",
2285
- feature: this.selection_.item(0),
2286
- features: this.selection_,
2287
- delta: [deltaX, deltaY],
2288
- pixel: evt.pixel,
2289
- coordinate: evt.coordinate
2290
- });
2291
- break;
2292
- }
2293
- case "scale": {
2294
- var center = this.center_;
2295
- if (this.get("modifyCenter")(evt)) {
2296
- var extentCoordinates = this.extent_;
2297
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2298
- extentCoordinates = this.rotatedExtent_;
2299
- }
2300
- center = extentCoordinates[(Number(this.opt_) + 2) % 4];
2301
- }
2302
- var keepRectangle = this.geoms_.length == 1 && this._isRectangle(this.geoms_[0]);
2303
- var stretch = this.constraint_;
2304
- var opt = this.opt_;
2305
- var downCoordinate = this.coordinate_;
2306
- var dragCoordinate = evt.coordinate;
2307
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2308
- var downPoint = new Point(this.coordinate_);
2309
- downPoint.rotate(viewRotation * -1, center);
2310
- downCoordinate = downPoint.getCoordinates();
2311
- var dragPoint = new Point(evt.coordinate);
2312
- dragPoint.rotate(viewRotation * -1, center);
2313
- dragCoordinate = dragPoint.getCoordinates();
2314
- }
2315
- var scx = (dragCoordinate[0] - center[0]) / (downCoordinate[0] - center[0]);
2316
- var scy = (dragCoordinate[1] - center[1]) / (downCoordinate[1] - center[1]);
2317
- var displacementVector = [dragCoordinate[0] - downCoordinate[0], dragCoordinate[1] - downCoordinate[1]];
2318
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2319
- var centerPoint = new Point(center);
2320
- centerPoint.rotate(viewRotation * -1, this.getMap().getView().getCenter());
2321
- center = centerPoint.getCoordinates();
2322
- }
2323
- if (this.get("noFlip")) {
2324
- if (scx < 0)
2325
- scx = -scx;
2326
- if (scy < 0)
2327
- scy = -scy;
2328
- }
2329
- if (this.constraint_) {
2330
- if (this.constraint_ == "h")
2331
- scx = 1;
2332
- else
2333
- scy = 1;
2334
- } else {
2335
- if (this.get("keepAspectRatio")(evt)) {
2336
- scx = scy = Math.min(scx, scy);
2337
- }
2338
- }
2339
- for (i = 0, f; f = this.selection_.item(i); i++) {
2340
- geometry = viewRotation === 0 || !this.get("enableRotatedTransform") ? this.geoms_[i].clone() : this.rotatedGeoms_[i].clone();
2341
- geometry.applyTransform(function(g1, g2, dim) {
2342
- if (dim < 2)
2343
- return g2;
2344
- if (!keepRectangle) {
2345
- for (j = 0; j < g1.length; j += dim) {
2346
- if (scx != 1)
2347
- g2[j] = center[0] + (g1[j] - center[0]) * scx;
2348
- if (scy != 1)
2349
- g2[j + 1] = center[1] + (g1[j + 1] - center[1]) * scy;
2350
- }
2351
- } else {
2352
- var pointArray = [[6], [0, 8], [2], [4]];
2353
- var pointA = [g1[0], g1[1]];
2354
- var pointB = [g1[2], g1[3]];
2355
- var pointC = [g1[4], g1[5]];
2356
- var pointD = [g1[6], g1[7]];
2357
- var pointA1 = [g1[8], g1[9]];
2358
- if (stretch) {
2359
- var base = opt % 2 === 0 ? countVector(pointA, pointB) : countVector(pointD, pointA);
2360
- var projectedVector = projectVectorOnVector(displacementVector, base);
2361
- var nextIndex = opt + 1 < pointArray.length ? opt + 1 : 0;
2362
- var coordsToChange = [...pointArray[opt], ...pointArray[nextIndex]];
2363
- for (j = 0; j < g1.length; j += dim) {
2364
- g2[j] = coordsToChange.includes(j) ? g1[j] + projectedVector[0] : g1[j];
2365
- g2[j + 1] = coordsToChange.includes(j) ? g1[j + 1] + projectedVector[1] : g1[j + 1];
2366
- }
2367
- } else {
2368
- var projectedLeft, projectedRight;
2369
- switch (opt) {
2370
- case 0:
2371
- displacementVector = countVector(pointD, dragCoordinate);
2372
- projectedLeft = projectVectorOnVector(displacementVector, countVector(pointC, pointD));
2373
- projectedRight = projectVectorOnVector(displacementVector, countVector(pointA, pointD));
2374
- [g2[0], g2[1]] = movePoint(pointA, projectedLeft);
2375
- [g2[4], g2[5]] = movePoint(pointC, projectedRight);
2376
- [g2[6], g2[7]] = movePoint(pointD, displacementVector);
2377
- [g2[8], g2[9]] = movePoint(pointA1, projectedLeft);
2378
- break;
2379
- case 1:
2380
- displacementVector = countVector(pointA, dragCoordinate);
2381
- projectedLeft = projectVectorOnVector(displacementVector, countVector(pointD, pointA));
2382
- projectedRight = projectVectorOnVector(displacementVector, countVector(pointB, pointA));
2383
- [g2[0], g2[1]] = movePoint(pointA, displacementVector);
2384
- [g2[2], g2[3]] = movePoint(pointB, projectedLeft);
2385
- [g2[6], g2[7]] = movePoint(pointD, projectedRight);
2386
- [g2[8], g2[9]] = movePoint(pointA1, displacementVector);
2387
- break;
2388
- case 2:
2389
- displacementVector = countVector(pointB, dragCoordinate);
2390
- projectedLeft = projectVectorOnVector(displacementVector, countVector(pointA, pointB));
2391
- projectedRight = projectVectorOnVector(displacementVector, countVector(pointC, pointB));
2392
- [g2[0], g2[1]] = movePoint(pointA, projectedRight);
2393
- [g2[2], g2[3]] = movePoint(pointB, displacementVector);
2394
- [g2[4], g2[5]] = movePoint(pointC, projectedLeft);
2395
- [g2[8], g2[9]] = movePoint(pointA1, projectedRight);
2396
- break;
2397
- case 3:
2398
- displacementVector = countVector(pointC, dragCoordinate);
2399
- projectedLeft = projectVectorOnVector(displacementVector, countVector(pointB, pointC));
2400
- projectedRight = projectVectorOnVector(displacementVector, countVector(pointD, pointC));
2401
- [g2[2], g2[3]] = movePoint(pointB, projectedRight);
2402
- [g2[4], g2[5]] = movePoint(pointC, displacementVector);
2403
- [g2[6], g2[7]] = movePoint(pointD, projectedLeft);
2404
- break;
2405
- }
2406
- }
2407
- }
2408
- if (geometry.getType() == "Circle")
2409
- geometry.setCenterAndRadius(geometry.getCenter(), geometry.getRadius());
2410
- return g2;
2411
- });
2412
- if (this.get("enableRotatedTransform") && viewRotation !== 0) {
2413
- geometry.rotate(viewRotation, this.getMap().getView().getCenter());
2414
- }
2415
- f.setGeometry(geometry);
2416
- }
2417
- this.drawSketch_();
2418
- this.dispatchEvent({
2419
- type: "scaling",
2420
- feature: this.selection_.item(0),
2421
- features: this.selection_,
2422
- scale: [scx, scy],
2423
- pixel: evt.pixel,
2424
- coordinate: evt.coordinate
2425
- });
2426
- break;
2427
- }
2428
- }
2429
- this.isUpdating_ = false;
2430
- };
2431
- ol_interaction_Transform.prototype.handleMoveEvent_ = function(evt) {
2432
- if (!this._handleEvent(evt, this.features_))
2433
- return;
2434
- if (!this.mode_) {
2435
- var sel = this.getFeatureAtPixel_(evt.pixel);
2436
- var element = evt.map.getTargetElement();
2437
- if (sel.feature) {
2438
- var c = sel.handle ? this.Cursors[(sel.handle || "default") + (sel.constraint || "") + (sel.option || "")] : this.Cursors.select;
2439
- if (this.previousCursor_ === void 0) {
2440
- this.previousCursor_ = element.style.cursor;
2441
- }
2442
- element.style.cursor = c;
2443
- } else {
2444
- if (this.previousCursor_ !== void 0)
2445
- element.style.cursor = this.previousCursor_;
2446
- this.previousCursor_ = void 0;
2447
- }
2448
- }
2449
- };
2450
- ol_interaction_Transform.prototype.handleUpEvent_ = function(evt) {
2451
- if (this.mode_ === "rotate") {
2452
- var element = evt.map.getTargetElement();
2453
- element.style.cursor = this.Cursors.default;
2454
- this.previousCursor_ = void 0;
2455
- }
2456
- this.dispatchEvent({
2457
- type: this.mode_ + "end",
2458
- feature: this.selection_.item(0),
2459
- features: this.selection_,
2460
- oldgeom: this.geoms_[0],
2461
- oldgeoms: this.geoms_
2462
- });
2463
- this.drawSketch_();
2464
- this.mode_ = null;
2465
- return false;
2466
- };
2467
- ol_interaction_Transform.prototype.getFeatures = function() {
2468
- return this.selection_;
2469
- };
2470
- ol_interaction_Transform.prototype.setPointRadius = function(pointRadius) {
2471
- if (typeof pointRadius === "function") {
2472
- this._pointRadius = pointRadius;
2473
- } else {
2474
- this._pointRadius = function() {
2475
- return pointRadius;
2476
- };
2477
- }
2478
- };
2479
- function getVectorContext(event) {
2480
- const frameState = event.frameState;
2481
- const transform = multiply(event.inversePixelTransform.slice(), frameState.coordinateToPixelTransform);
2482
- return new CanvasImmediateRenderer(
2483
- event.context,
2484
- frameState.pixelRatio,
2485
- frameState.extent,
2486
- transform,
2487
- frameState.viewState.rotation
2488
- );
2489
- }
2490
- if (window.ol) {
2491
- if (!ol.util) {
2492
- ol.util = {
2493
- VERSION: ol.VERSION || "5.3.0"
2494
- };
2495
- } else if (!ol.util.VERSION) {
2496
- ol.util.VERSION = ol.VERSION || "6.1.0";
2497
- }
2498
- }
2499
- var ol_ext_olVersion = VERSION.split(".");
2500
- ol_ext_olVersion = parseInt(ol_ext_olVersion[0]) * 100 + parseInt(ol_ext_olVersion[1]);
2501
- var ol_ext_getVectorContextStyle = function(e, s) {
2502
- var ratio = e.frameState.pixelRatio;
2503
- if (ol_ext_olVersion > 605 && ratio !== 1 && s.getImage() instanceof Icon) {
2504
- s = s.clone();
2505
- var img = s.getImage();
2506
- img.setScale(img.getScale() * ratio);
2507
- var anchor = img.getAnchor();
2508
- if (img.setDisplacement) {
2509
- var disp = img.getDisplacement();
2510
- if (disp) {
2511
- disp[0] -= anchor[0] / ratio;
2512
- disp[1] += anchor[1] / ratio;
2513
- img.setAnchor([0, 0]);
2514
- }
2515
- } else {
2516
- if (anchor) {
2517
- anchor[0] /= ratio;
2518
- anchor[1] /= ratio;
2519
- }
2520
- }
2521
- }
2522
- return s;
2523
- };
2524
- var ol_layer_AnimatedCluster = function(opt_options) {
2525
- var options = opt_options || {};
2526
- VectorLayer.call(this, options);
2527
- this.oldcluster = new VectorSource();
2528
- this.clusters = [];
2529
- this.animation = { start: false };
2530
- this.set("animationDuration", typeof options.animationDuration == "number" ? options.animationDuration : 700);
2531
- this.set("animationMethod", options.animationMethod || easeOut);
2532
- this.getSource().on("change", this.saveCluster.bind(this));
2533
- this.on(["precompose", "prerender"], this.animate.bind(this));
2534
- this.on(["postcompose", "postrender"], this.postanimate.bind(this));
2535
- };
2536
- ol_ext_inherits(ol_layer_AnimatedCluster, VectorLayer);
2537
- ol_layer_AnimatedCluster.prototype.saveCluster = function() {
2538
- if (this.oldcluster) {
2539
- this.oldcluster.clear();
2540
- if (!this.get("animationDuration"))
2541
- return;
2542
- var features = this.getSource().getFeatures();
2543
- if (features.length && features[0].get("features")) {
2544
- this.oldcluster.addFeatures(this.clusters);
2545
- this.clusters = features.slice(0);
2546
- this.sourceChanged = true;
2547
- }
2548
- }
2549
- };
2550
- ol_layer_AnimatedCluster.prototype.getClusterForFeature = function(f, cluster) {
2551
- for (var j = 0, c; c = cluster[j]; j++) {
2552
- var features = c.get("features");
2553
- if (features && features.length) {
2554
- for (var k = 0, f2; f2 = features[k]; k++) {
2555
- if (f === f2) {
2556
- return c;
2557
- }
2558
- }
2559
- }
2560
- }
2561
- return false;
2562
- };
2563
- ol_layer_AnimatedCluster.prototype.stopAnimation = function() {
2564
- this.animation.start = false;
2565
- this.animation.cA = [];
2566
- this.animation.cB = [];
2567
- };
2568
- ol_layer_AnimatedCluster.prototype.animate = function(e) {
2569
- var duration = this.get("animationDuration");
2570
- if (!duration)
2571
- return;
2572
- var resolution = e.frameState.viewState.resolution;
2573
- var i, c0, a = this.animation;
2574
- var time = e.frameState.time;
2575
- if (a.resolution != resolution && this.sourceChanged) {
2576
- var extent = e.frameState.extent;
2577
- if (a.resolution < resolution) {
2578
- extent = buffer(extent, 100 * resolution);
2579
- a.cA = this.oldcluster.getFeaturesInExtent(extent);
2580
- a.cB = this.getSource().getFeaturesInExtent(extent);
2581
- a.revers = false;
2582
- } else {
2583
- extent = buffer(extent, 100 * resolution);
2584
- a.cA = this.getSource().getFeaturesInExtent(extent);
2585
- a.cB = this.oldcluster.getFeaturesInExtent(extent);
2586
- a.revers = true;
2587
- }
2588
- a.clusters = [];
2589
- for (i = 0, c0; c0 = a.cA[i]; i++) {
2590
- var f = c0.get("features");
2591
- if (f && f.length) {
2592
- var c = this.getClusterForFeature(f[0], a.cB);
2593
- if (c)
2594
- a.clusters.push({ f: c0, pt: c.getGeometry().getCoordinates() });
2595
- }
2596
- }
2597
- a.resolution = resolution;
2598
- this.sourceChanged = false;
2599
- if (!a.clusters.length || a.clusters.length > 1e3) {
2600
- this.stopAnimation();
2601
- return;
2602
- }
2603
- time = a.start = new Date().getTime();
2604
- }
2605
- if (a.start) {
2606
- var vectorContext = e.vectorContext || getVectorContext(e);
2607
- var d = (time - a.start) / duration;
2608
- if (d > 1) {
2609
- this.stopAnimation();
2610
- d = 1;
2611
- }
2612
- d = this.get("animationMethod")(d);
2613
- var style = this.getStyle();
2614
- var stylefn = typeof style == "function" ? style : style.length ? function() {
2615
- return style;
2616
- } : function() {
2617
- return [style];
2618
- };
2619
- e.context.save();
2620
- e.context.globalAlpha = this.getOpacity();
2621
- for (i = 0, c; c = a.clusters[i]; i++) {
2622
- var pt = c.f.getGeometry().getCoordinates();
2623
- var dx = pt[0] - c.pt[0];
2624
- var dy = pt[1] - c.pt[1];
2625
- if (a.revers) {
2626
- pt[0] = c.pt[0] + d * dx;
2627
- pt[1] = c.pt[1] + d * dy;
2628
- } else {
2629
- pt[0] = pt[0] - d * dx;
2630
- pt[1] = pt[1] - d * dy;
2631
- }
2632
- var st = stylefn(c.f, resolution, true);
2633
- if (!st.length)
2634
- st = [st];
2635
- if (c.f.get("features").length === 1 && !dx && !dy) {
2636
- f = c.f.get("features")[0];
2637
- } else {
2638
- var geo = new Point(pt);
2639
- f = new Feature(geo);
2640
- }
2641
- for (var k = 0, s; s = st[k]; k++) {
2642
- if (s.getText() && /\n/.test(s.getText().getText())) {
2643
- var offsetX = s.getText().getOffsetX();
2644
- var offsetY = s.getText().getOffsetY();
2645
- var rot = s.getText().getRotation() || 0;
2646
- var fontSize = Number((s.getText().getFont() || "10px").match(/\d+/)) * 1.2;
2647
- var str = s.getText().getText().split("\n");
2648
- var dl, nb = str.length - 1;
2649
- var s2 = s.clone();
2650
- str.forEach(function(t, i2) {
2651
- if (i2 == 1) {
2652
- s2.setImage();
2653
- s2.setFill();
2654
- s2.setStroke();
2655
- }
2656
- switch (s.getText().getTextBaseline()) {
2657
- case "alphabetic":
2658
- case "ideographic":
2659
- case "bottom": {
2660
- dl = nb;
2661
- break;
2662
- }
2663
- case "hanging":
2664
- case "top": {
2665
- dl = 0;
2666
- break;
2667
- }
2668
- default: {
2669
- dl = nb / 2;
2670
- break;
2671
- }
2672
- }
2673
- s2.getText().setOffsetX(offsetX - Math.sin(rot) * fontSize * (i2 - dl));
2674
- s2.getText().setOffsetY(offsetY + Math.cos(rot) * fontSize * (i2 - dl));
2675
- s2.getText().setText(t);
2676
- vectorContext.drawFeature(f, ol_ext_getVectorContextStyle(e, s2));
2677
- });
2678
- } else {
2679
- vectorContext.drawFeature(f, ol_ext_getVectorContextStyle(e, s));
2680
- }
2681
- }
2682
- }
2683
- e.context.restore();
2684
- e.frameState.animate = true;
2685
- e.context.save();
2686
- e.context.beginPath();
2687
- e.context.rect(0, 0, 0, 0);
2688
- e.context.clip();
2689
- this.clip_ = true;
2690
- }
2691
- return;
2692
- };
2693
- ol_layer_AnimatedCluster.prototype.postanimate = function(e) {
2694
- if (this.clip_) {
2695
- e.context.restore();
2696
- this.clip_ = false;
2697
- }
2698
- };
2699
- var ol_interaction_SelectCluster = function(options) {
2700
- options = options || {};
2701
- this.pointRadius = options.pointRadius || 12;
2702
- this.circleMaxObjects = options.circleMaxObjects || 10;
2703
- this.maxObjects = options.maxObjects || 60;
2704
- this.spiral = options.spiral !== false;
2705
- this.animate = options.animate;
2706
- this.animationDuration = options.animationDuration || 500;
2707
- this.selectCluster_ = options.selectCluster !== false;
2708
- this._autoClose = options.autoClose !== false;
2709
- var overlay = this.overlayLayer_ = new VectorLayer({
2710
- source: new VectorSource({
2711
- features: new ol_Collection(),
2712
- wrapX: options.wrapX,
2713
- useSpatialIndex: true
2714
- }),
2715
- name: "Cluster overlay",
2716
- updateWhileAnimating: true,
2717
- updateWhileInteracting: true,
2718
- displayInLayerSwitcher: false,
2719
- style: options.featureStyle
2720
- });
2721
- if (options.layers) {
2722
- if (typeof options.layers == "function") {
2723
- var fnLayers = options.layers;
2724
- options.layers = function(layer) {
2725
- return layer === overlay || fnLayers(layer);
2726
- };
2727
- } else if (options.layers.push) {
2728
- options.layers.push(this.overlayLayer_);
2729
- }
2730
- }
2731
- if (options.filter) {
2732
- var fnFilter = options.filter;
2733
- options.filter = function(f, l) {
2734
- if (!l && f.get("selectclusterlink"))
2735
- return false;
2736
- else
2737
- return fnFilter(f, l);
2738
- };
2739
- } else
2740
- options.filter = function(f, l) {
2741
- if (!l && f.get("selectclusterlink"))
2742
- return false;
2743
- else
2744
- return true;
2745
- };
2746
- this.filter_ = options.filter;
2747
- if (!this._autoClose && !options.toggleCondition) {
2748
- options.toggleCondition = singleClick;
2749
- }
2750
- Select.call(this, options);
2751
- this.on("select", this.selectCluster.bind(this));
2752
- };
2753
- ol_ext_inherits(ol_interaction_SelectCluster, Select);
2754
- ol_interaction_SelectCluster.prototype.setMap = function(map) {
2755
- if (this.getMap()) {
2756
- this.getMap().removeLayer(this.overlayLayer_);
2757
- }
2758
- if (this._listener)
2759
- unByKey(this._listener);
2760
- this._listener = null;
2761
- Select.prototype.setMap.call(this, map);
2762
- this.overlayLayer_.setMap(map);
2763
- if (map && map.getView()) {
2764
- this._listener = map.getView().on("change:resolution", this.clear.bind(this));
2765
- }
2766
- };
2767
- ol_interaction_SelectCluster.prototype.clear = function() {
2768
- this.getFeatures().clear();
2769
- this.overlayLayer_.getSource().clear();
2770
- };
2771
- ol_interaction_SelectCluster.prototype.getLayer = function() {
2772
- return this.overlayLayer_;
2773
- };
2774
- ol_interaction_SelectCluster.prototype.selectCluster = function(e) {
2775
- if (e instanceof Feature) {
2776
- e = { selected: [e] };
2777
- }
2778
- if (!e.selected.length) {
2779
- if (this._autoClose) {
2780
- this.clear();
2781
- } else {
2782
- var deselectedFeatures = e.deselected;
2783
- deselectedFeatures.forEach((deselectedFeature) => {
2784
- var selectClusterFeatures = deselectedFeature.get("selectcluserfeatures");
2785
- if (selectClusterFeatures) {
2786
- selectClusterFeatures.forEach((selectClusterFeature) => {
2787
- this.overlayLayer_.getSource().removeFeature(selectClusterFeature);
2788
- });
2789
- }
2790
- });
2791
- }
2792
- return;
2793
- }
2794
- var feature = e.selected[0];
2795
- if (feature.get("selectclusterfeature"))
2796
- return;
2797
- var source = this.overlayLayer_.getSource();
2798
- if (this._autoClose) {
2799
- source.clear();
2800
- }
2801
- var cluster = feature.get("features");
2802
- if (!cluster || cluster.length == 1)
2803
- return;
2804
- if (!this.selectCluster_)
2805
- this.getFeatures().clear();
2806
- var center = feature.getGeometry().getCoordinates();
2807
- var pix = this.getMap().getView().getResolution();
2808
- var r, a, i, max;
2809
- var p, cf, lk;
2810
- var features = [];
2811
- if (!this.spiral || cluster.length <= this.circleMaxObjects) {
2812
- max = Math.min(cluster.length, this.circleMaxObjects);
2813
- r = pix * this.pointRadius * (0.5 + max / 4);
2814
- for (i = 0; i < max; i++) {
2815
- a = 2 * Math.PI * i / max;
2816
- if (max == 2 || max == 4)
2817
- a += Math.PI / 4;
2818
- p = [center[0] + r * Math.sin(a), center[1] + r * Math.cos(a)];
2819
- cf = new Feature({ "selectclusterfeature": true, "features": [cluster[i]], geometry: new Point(p) });
2820
- cf.setStyle(cluster[i].getStyle());
2821
- features.push(cf);
2822
- lk = new Feature({ "selectclusterlink": true, geometry: new LineString([center, p]) });
2823
- features.push(lk);
2824
- }
2825
- } else {
2826
- a = 0;
2827
- var d = 2 * this.pointRadius;
2828
- max = Math.min(this.maxObjects, cluster.length);
2829
- for (i = 0; i < max; i++) {
2830
- r = d / 2 + d * a / (2 * Math.PI);
2831
- a = a + (d + 0.1) / r;
2832
- var dx = pix * r * Math.sin(a);
2833
- var dy = pix * r * Math.cos(a);
2834
- p = [center[0] + dx, center[1] + dy];
2835
- cf = new Feature({ "selectclusterfeature": true, "features": [cluster[i]], geometry: new Point(p) });
2836
- cf.setStyle(cluster[i].getStyle());
2837
- features.push(cf);
2838
- lk = new Feature({ "selectclusterlink": true, geometry: new LineString([center, p]) });
2839
- features.push(lk);
2840
- }
2841
- }
2842
- feature.set("selectcluserfeatures", features);
2843
- if (this.animate) {
2844
- this.animateCluster_(center, features);
2845
- } else {
2846
- source.addFeatures(features);
2847
- }
2848
- };
2849
- ol_interaction_SelectCluster.prototype.animateCluster_ = function(center, features) {
2850
- if (this.listenerKey_) {
2851
- unByKey(this.listenerKey_);
2852
- }
2853
- if (!features.length)
2854
- return;
2855
- var style = this.overlayLayer_.getStyle();
2856
- var stylefn = typeof style == "function" ? style : style.length ? function() {
2857
- return style;
2858
- } : function() {
2859
- return [style];
2860
- };
2861
- var duration = this.animationDuration || 500;
2862
- var start = new Date().getTime();
2863
- function animate(event) {
2864
- var vectorContext = event.vectorContext || getVectorContext(event);
2865
- var ratio = event.frameState.pixelRatio;
2866
- var res = this.getMap().getView().getResolution();
2867
- var e = easeOut((event.frameState.time - start) / duration);
2868
- for (var i = 0, feature2; feature2 = features[i]; i++)
2869
- if (feature2.get("features")) {
2870
- var pt = feature2.getGeometry().getCoordinates();
2871
- pt[0] = center[0] + e * (pt[0] - center[0]);
2872
- pt[1] = center[1] + e * (pt[1] - center[1]);
2873
- var geo = new Point(pt);
2874
- var st = stylefn(feature2, res);
2875
- for (var s = 0; s < st.length; s++) {
2876
- var sc;
2877
- var imgs = ol_Map.prototype.getFeaturesAtPixel ? false : st[s].getImage();
2878
- if (imgs) {
2879
- sc = imgs.getScale();
2880
- imgs.setScale(ratio);
2881
- }
2882
- if (vectorContext.setStyle) {
2883
- vectorContext.setStyle(st[s]);
2884
- vectorContext.drawGeometry(geo);
2885
- } else {
2886
- vectorContext.setImageStyle(imgs);
2887
- vectorContext.drawPointGeometry(geo);
2888
- }
2889
- if (imgs)
2890
- imgs.setScale(sc);
2891
- }
2892
- }
2893
- if (e > 1) {
2894
- unByKey(this.listenerKey_);
2895
- this.overlayLayer_.getSource().addFeatures(features);
2896
- this.overlayLayer_.changed();
2897
- return;
2898
- }
2899
- event.frameState.animate = true;
2900
- }
2901
- this.listenerKey_ = this.overlayLayer_.on(["postcompose", "postrender"], animate.bind(this));
2902
- var feature = new Feature(new Point(this.getMap().getView().getCenter()));
2903
- feature.setStyle(new Style({ image: new CircleStyle({}) }));
2904
- this.overlayLayer_.getSource().addFeature(feature);
2905
- };
2906
- ol_interaction_SelectCluster.prototype.getClusterExtent = function(feature) {
2907
- if (!feature.get("features"))
2908
- return null;
2909
- var extent = createEmpty();
2910
- feature.get("features").forEach(function(f) {
2911
- extent = extend(extent, f.getGeometry().getExtent());
2912
- });
2913
- if (extent[0] === extent[2] && extent[1] === extent[3])
2914
- return null;
2915
- return extent;
2916
- };
2917
- var ol_coordinate_convexHull;
2918
- (function() {
2919
- var clockwise = function(a, b, o) {
2920
- return (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]) <= 0;
2921
- };
2922
- ol_coordinate_convexHull = function(points) {
2923
- var i;
2924
- points.sort(function(a, b) {
2925
- return a[0] == b[0] ? a[1] - b[1] : a[0] - b[0];
2926
- });
2927
- var lower = [];
2928
- for (i = 0; i < points.length; i++) {
2929
- while (lower.length >= 2 && clockwise(lower[lower.length - 2], lower[lower.length - 1], points[i])) {
2930
- lower.pop();
2931
- }
2932
- lower.push(points[i]);
2933
- }
2934
- var upper = [];
2935
- for (i = points.length - 1; i >= 0; i--) {
2936
- while (upper.length >= 2 && clockwise(upper[upper.length - 2], upper[upper.length - 1], points[i])) {
2937
- upper.pop();
2938
- }
2939
- upper.push(points[i]);
2940
- }
2941
- upper.pop();
2942
- lower.pop();
2943
- return lower.concat(upper);
2944
- };
2945
- var getCoordinates = function(geom) {
2946
- var i, p;
2947
- var h = [];
2948
- switch (geom.getType()) {
2949
- case "Point":
2950
- h.push(geom.getCoordinates());
2951
- break;
2952
- case "LineString":
2953
- case "LinearRing":
2954
- case "MultiPoint":
2955
- h = geom.getCoordinates();
2956
- break;
2957
- case "MultiLineString":
2958
- p = geom.getLineStrings();
2959
- for (i = 0; i < p.length; i++)
2960
- h.concat(getCoordinates(p[i]));
2961
- break;
2962
- case "Polygon":
2963
- h = getCoordinates(geom.getLinearRing(0));
2964
- break;
2965
- case "MultiPolygon":
2966
- p = geom.getPolygons();
2967
- for (i = 0; i < p.length; i++)
2968
- h.concat(getCoordinates(p[i]));
2969
- break;
2970
- case "GeometryCollection":
2971
- p = geom.getGeometries();
2972
- for (i = 0; i < p.length; i++)
2973
- h.concat(getCoordinates(p[i]));
2974
- break;
2975
- }
2976
- return h;
2977
- };
2978
- ol_geom_Geometry.prototype.convexHull = function() {
2979
- return ol_coordinate_convexHull(getCoordinates(this));
2980
- };
2981
- })();
2982
- var convexHull = ol_coordinate_convexHull;
2983
- var ol_style_Photo = function(options) {
2984
- options = options || {};
2985
- if (!options.displacement)
2986
- options.displacement = [options.offsetX || 0, -options.offsetY || 0];
2987
- this.sanchor_ = options.kind === "anchored" ? 8 : 0;
2988
- this._shadow = Number(options.shadow) || 0;
2989
- if (!options.stroke) {
2990
- options.stroke = new Stroke({ width: 0, color: "#000" });
2991
- }
2992
- var strokeWidth = options.stroke.getWidth();
2993
- if (strokeWidth < 0)
2994
- strokeWidth = 0;
2995
- if (options.kind == "folio")
2996
- strokeWidth += 6;
2997
- options.stroke.setWidth(strokeWidth);
2998
- RegularShape.call(this, {
2999
- radius: options.radius + strokeWidth + this.sanchor_ / 2 + this._shadow / 2,
3000
- points: 0,
3001
- displacement: [options.displacement[0] || 0, (options.displacement[1] || 0) + this.sanchor_],
3002
- fill: RegularShape.prototype.render ? new Fill({ color: [0, 0, 0, 0] }) : null
3003
- });
3004
- if (!this.getHitDetectionImage) {
3005
- var img = RegularShape.prototype.getImage.call(this);
3006
- if (!this.hitDetectionCanvas_) {
3007
- for (var i in this) {
3008
- if (this[i] && this[i].getContext && this[i] !== img) {
3009
- this.hitDetectionCanvas_ = this[i];
3010
- break;
3011
- }
3012
- }
3013
- }
3014
- this.hitDetectionCanvas_ = document.createElement("canvas");
3015
- this.hitDetectionCanvas_.width = img.width;
3016
- this.hitDetectionCanvas_.height = img.height;
3017
- var hit = this.hitDetectionCanvas_;
3018
- this.getHitDetectionImage = function() {
3019
- return hit;
3020
- };
3021
- }
3022
- this._stroke = options.stroke;
3023
- this._fill = options.fill;
3024
- this._crop = options.crop;
3025
- this._crossOrigin = options.crossOrigin;
3026
- this._kind = options.kind || "default";
3027
- this._radius = options.radius;
3028
- this._src = options.src;
3029
- this._offset = [options.offsetX ? options.offsetX : 0, options.offsetY ? options.offsetY : 0];
3030
- this._onload = options.onload;
3031
- if (typeof options.opacity == "number")
3032
- this.setOpacity(options.opacity);
3033
- if (typeof options.rotation == "number")
3034
- this.setRotation(options.rotation);
3035
- this.getImage();
3036
- };
3037
- ol_ext_inherits(ol_style_Photo, RegularShape);
3038
- ol_style_Photo.prototype.setOffset = function(offset) {
3039
- this._offset = [offset[0] || 0, offset[1] || 0];
3040
- this.getImage();
3041
- };
3042
- ol_style_Photo.prototype.clone = function() {
3043
- var i = new ol_style_Photo({
3044
- stroke: this._stroke,
3045
- fill: this._fill,
3046
- shadow: this._shadow,
3047
- crop: this._crop,
3048
- crossOrigin: this._crossOrigin,
3049
- kind: this._kind,
3050
- radius: this._radius,
3051
- src: this._src,
3052
- offsetX: this._offset[0],
3053
- offsetY: this._offset[1],
3054
- opacity: this.getOpacity(),
3055
- rotation: this.getRotation()
3056
- });
3057
- i.getImage();
3058
- return i;
3059
- };
3060
- CanvasRenderingContext2D.prototype.roundRect = function(x, y, w, h, r) {
3061
- if (!r) {
3062
- this.rect(x, y, w, h);
3063
- } else {
3064
- if (w < 2 * r)
3065
- r = w / 2;
3066
- if (h < 2 * r)
3067
- r = h / 2;
3068
- this.beginPath();
3069
- this.moveTo(x + r, y);
3070
- this.arcTo(x + w, y, x + w, y + h, r);
3071
- this.arcTo(x + w, y + h, x, y + h, r);
3072
- this.arcTo(x, y + h, x, y, r);
3073
- this.arcTo(x, y, x + w, y, r);
3074
- this.closePath();
3075
- }
3076
- return this;
3077
- };
3078
- ol_style_Photo.prototype.drawBack_ = function(context, color, strokeWidth, pixelratio) {
3079
- var shadow = this._shadow;
3080
- var canvas = context.canvas;
3081
- context.beginPath();
3082
- context.fillStyle = color;
3083
- context.clearRect(0, 0, canvas.width, canvas.height);
3084
- var width = canvas.width / pixelratio;
3085
- var height = canvas.height / pixelratio;
3086
- switch (this._kind) {
3087
- case "square": {
3088
- context.rect(0, 0, width - shadow, height - shadow);
3089
- break;
3090
- }
3091
- case "circle": {
3092
- context.arc(this._radius + strokeWidth, this._radius + strokeWidth, this._radius + strokeWidth, 0, 2 * Math.PI, false);
3093
- break;
3094
- }
3095
- case "folio": {
3096
- var offset = 6;
3097
- strokeWidth -= offset;
3098
- context.strokeStyle = "rgba(0,0,0,0.5)";
3099
- context.lineWidth = 1;
3100
- var w = width - shadow - 2 * offset;
3101
- var a = Math.atan(6 / w);
3102
- context.save();
3103
- context.rotate(-a);
3104
- context.translate(-6, 2);
3105
- context.beginPath();
3106
- context.rect(offset, offset, w, w);
3107
- context.stroke();
3108
- context.fill();
3109
- context.restore();
3110
- context.save();
3111
- context.translate(6, -1);
3112
- context.rotate(a);
3113
- context.beginPath();
3114
- context.rect(offset, offset, w, w);
3115
- context.stroke();
3116
- context.fill();
3117
- context.restore();
3118
- context.beginPath();
3119
- context.rect(offset, offset, w, w);
3120
- context.stroke();
3121
- break;
3122
- }
3123
- case "anchored": {
3124
- context.roundRect(this.sanchor_ / 2, 0, width - this.sanchor_ - shadow, height - this.sanchor_ - shadow, strokeWidth);
3125
- context.moveTo(width / 2 - this.sanchor_ - shadow / 2, height - this.sanchor_ - shadow);
3126
- context.lineTo(width / 2 + this.sanchor_ - shadow / 2, height - this.sanchor_ - shadow);
3127
- context.lineTo(width / 2 - shadow / 2, height - shadow);
3128
- break;
3129
- }
3130
- default: {
3131
- context.roundRect(0, 0, width - shadow, height - shadow, strokeWidth);
3132
- break;
3133
- }
3134
- }
3135
- context.closePath();
3136
- };
3137
- ol_style_Photo.prototype.getImage = function(pixelratio) {
3138
- pixelratio = pixelratio || 1;
3139
- var canvas = RegularShape.prototype.getImage.call(this, pixelratio);
3140
- if (this._gethit)
3141
- return canvas;
3142
- var strokeStyle;
3143
- var strokeWidth = 0;
3144
- if (this._stroke) {
3145
- strokeStyle = asString(this._stroke.getColor());
3146
- strokeWidth = this._stroke.getWidth();
3147
- }
3148
- this._gethit = true;
3149
- var context = this.getHitDetectionImage().getContext("2d");
3150
- context.save();
3151
- context.setTransform(1, 0, 0, 1, 0, 0);
3152
- this.drawBack_(context, "#000", strokeWidth, 1);
3153
- context.fill();
3154
- context.restore();
3155
- this._gethit = false;
3156
- context = canvas.getContext("2d");
3157
- context.save();
3158
- context.setTransform(pixelratio, 0, 0, pixelratio, 0, 0);
3159
- this.drawBack_(context, strokeStyle, strokeWidth, pixelratio);
3160
- if (this._shadow) {
3161
- context.shadowColor = "rgba(0,0,0,0.5)";
3162
- context.shadowBlur = pixelratio * this._shadow / 2;
3163
- context.shadowOffsetX = pixelratio * this._shadow / 2;
3164
- context.shadowOffsetY = pixelratio * this._shadow / 2;
3165
- }
3166
- context.fill();
3167
- context.restore();
3168
- var self = this;
3169
- var img = this.img_ = new Image();
3170
- if (this._crossOrigin)
3171
- img.crossOrigin = this._crossOrigin;
3172
- img.src = this._src;
3173
- if (img.width) {
3174
- self.drawImage_(canvas, img, pixelratio);
3175
- } else {
3176
- img.onload = function() {
3177
- self.drawImage_(canvas, img, pixelratio);
3178
- if (self._onload)
3179
- self._onload();
3180
- };
3181
- }
3182
- if (!this.getDisplacement) {
3183
- var a = this.getAnchor();
3184
- a[0] = (canvas.width / pixelratio - this._shadow) / 2 - this._offset[0];
3185
- if (this.sanchor_) {
3186
- a[1] = canvas.height / pixelratio - this._shadow - this._offset[1];
3187
- } else {
3188
- a[1] = (canvas.height / pixelratio - this._shadow) / 2 - this._offset[1];
3189
- }
3190
- }
3191
- return canvas;
3192
- };
3193
- ol_style_Photo.prototype.getPhoto = function() {
3194
- return this.img_;
3195
- };
3196
- ol_style_Photo.prototype.drawImage_ = function(canvas, img, pixelratio) {
3197
- var context = canvas.getContext("2d");
3198
- var strokeWidth = 0;
3199
- if (this._stroke)
3200
- strokeWidth = this._stroke.getWidth();
3201
- var size = 2 * this._radius;
3202
- context.save();
3203
- if (RegularShape.prototype.render)
3204
- context.setTransform(pixelratio, 0, 0, pixelratio, 0, 0);
3205
- if (this._kind == "circle") {
3206
- context.beginPath();
3207
- context.arc(this._radius + strokeWidth, this._radius + strokeWidth, this._radius, 0, 2 * Math.PI, false);
3208
- context.clip();
3209
- }
3210
- var s, x, y, w, h, sx, sy, sw, sh;
3211
- if (this._crop) {
3212
- s = Math.min(img.width / size, img.height / size);
3213
- sw = sh = s * size;
3214
- sx = (img.width - sw) / 2;
3215
- sy = (img.height - sh) / 2;
3216
- x = y = 0;
3217
- w = h = size + 1;
3218
- } else {
3219
- s = Math.min(size / img.width, size / img.height);
3220
- sx = sy = 0;
3221
- sw = img.width;
3222
- sh = img.height;
3223
- w = s * sw;
3224
- h = s * sh;
3225
- x = (size - w) / 2;
3226
- y = (size - h) / 2;
3227
- }
3228
- x += strokeWidth + this.sanchor_ / 2;
3229
- y += strokeWidth;
3230
- context.drawImage(img, sx, sy, sw, sh, x, y, w, h);
3231
- if (this._kind == "circle" && strokeWidth) {
3232
- context.beginPath();
3233
- context.strokeStyle = asString(this._stroke.getColor());
3234
- context.lineWidth = strokeWidth / 4;
3235
- context.arc(this._radius + strokeWidth, this._radius + strokeWidth, this._radius, 0, 2 * Math.PI, false);
3236
- context.stroke();
3237
- }
3238
- context.restore();
3239
- };
3240
- var ol_ordering = {};
3241
- ol_ordering.yOrdering = function() {
3242
- return function(f0, f1) {
3243
- return f1.getGeometry().getExtent()[1] - f0.getGeometry().getExtent()[1];
3244
- };
3245
- };
3246
- ol_ordering.zIndex = function(options) {
3247
- if (!options)
3248
- options = {};
3249
- var attr = options.attribute || "zIndex";
3250
- if (options.equalFn) {
3251
- return function(f0, f1) {
3252
- if (f0.get(attr) == f1.get(attr))
3253
- return options.equalFn(f0, f1);
3254
- else
3255
- return f0.get(attr) < f1.get(attr) ? 1 : -1;
3256
- };
3257
- } else {
3258
- return function(f0, f1) {
3259
- if (f0.get(attr) == f1.get(attr))
3260
- return 0;
3261
- else
3262
- return f0.get(attr) < f1.get(attr) ? 1 : -1;
3263
- };
3264
- }
3265
- };
3266
- var ol_featureAnimation = function(options) {
3267
- options = options || {};
3268
- this.duration_ = typeof options.duration == "number" ? options.duration >= 0 ? options.duration : 0 : 1e3;
3269
- this.fade_ = typeof options.fade == "function" ? options.fade : null;
3270
- this.repeat_ = Number(options.repeat);
3271
- var easing = typeof options.easing == "function" ? options.easing : linear;
3272
- if (options.revers)
3273
- this.easing_ = function(t) {
3274
- return 1 - easing(t);
3275
- };
3276
- else
3277
- this.easing_ = easing;
3278
- this.hiddenStyle = options.hiddenStyle;
3279
- ol_Object.call(this);
3280
- };
3281
- ol_ext_inherits(ol_featureAnimation, ol_Object);
3282
- ol_featureAnimation.hiddenStyle = new Style({
3283
- image: new CircleStyle({}),
3284
- stroke: new Stroke({
3285
- color: "transparent"
3286
- })
3287
- });
3288
- ol_featureAnimation.prototype.drawGeom_ = function(e, geom, shadow) {
3289
- if (this.fade_) {
3290
- e.context.globalAlpha = this.fade_(1 - e.elapsed);
3291
- }
3292
- var style = e.style;
3293
- for (var i = 0; i < style.length; i++) {
3294
- try {
3295
- var vectorContext = e.vectorContext || getVectorContext(e);
3296
- var s = ol_ext_getVectorContextStyle(e, style[i]);
3297
- vectorContext.setStyle(s);
3298
- if (s.getZIndex() < 0)
3299
- vectorContext.drawGeometry(shadow || geom);
3300
- else
3301
- vectorContext.drawGeometry(geom);
3302
- } catch (e2) {
3303
- }
3304
- }
3305
- };
3306
- ol_featureAnimation.prototype.animate = function() {
3307
- return false;
3308
- };
3309
- ol_Map.prototype.animateFeature = function(feature, fanim) {
3310
- var layer = this._featureAnimationLayer;
3311
- if (!layer) {
3312
- layer = this._featureAnimationLayer = new VectorLayer({ source: new VectorSource() });
3313
- layer.setMap(this);
3314
- }
3315
- layer.getSource().addFeature(feature);
3316
- var listener = fanim.on("animationend", function(e) {
3317
- if (e.feature === feature) {
3318
- layer.getSource().removeFeature(feature);
3319
- unByKey(listener);
3320
- }
3321
- });
3322
- layer.animateFeature(feature, fanim);
3323
- };
3324
- ol_layer_Base.prototype.animateFeature = function(feature, fanim, useFilter) {
3325
- var self = this;
3326
- var listenerKey;
3327
- var style = feature.getStyle();
3328
- var flashStyle = style || (this.getStyleFunction ? this.getStyleFunction()(feature) : null);
3329
- if (!flashStyle)
3330
- flashStyle = [];
3331
- if (!(flashStyle instanceof Array))
3332
- flashStyle = [flashStyle];
3333
- var event = {
3334
- vectorContext: null,
3335
- frameState: null,
3336
- start: 0,
3337
- time: 0,
3338
- elapsed: 0,
3339
- extent: false,
3340
- feature,
3341
- geom: feature.getGeometry(),
3342
- typeGeom: feature.getGeometry().getType(),
3343
- bbox: feature.getGeometry().getExtent(),
3344
- coord: getCenter(feature.getGeometry().getExtent()),
3345
- style: flashStyle
3346
- };
3347
- if (!(fanim instanceof Array))
3348
- fanim = [fanim];
3349
- for (var i = fanim.length - 1; i >= 0; i--) {
3350
- if (fanim[i].duration_ === 0)
3351
- fanim.splice(i, 1);
3352
- }
3353
- var nb = 0, step = 0;
3354
- var filters = useFilter && this.getFilters ? this.getFilters() : [];
3355
- function animate(e) {
3356
- event.type = e.type;
3357
- try {
3358
- event.vectorContext = e.vectorContext || getVectorContext(e);
3359
- } catch (e2) {
3360
- }
3361
- event.frameState = e.frameState;
3362
- event.inversePixelTransform = e.inversePixelTransform;
3363
- if (!event.extent) {
3364
- event.extent = e.frameState.extent;
3365
- event.start = e.frameState.time;
3366
- event.context = e.context;
3367
- }
3368
- event.time = e.frameState.time - event.start;
3369
- event.elapsed = event.time / fanim[step].duration_;
3370
- if (event.elapsed > 1)
3371
- event.elapsed = 1;
3372
- e.context.save();
3373
- filters.forEach(function(f) {
3374
- if (f.get("active"))
3375
- f.precompose(e);
3376
- });
3377
- if (this.getOpacity) {
3378
- e.context.globalAlpha = this.getOpacity();
3379
- }
3380
- if (!fanim[step].animate(event)) {
3381
- nb++;
3382
- if (nb < fanim[step].repeat_) {
3383
- event.extent = false;
3384
- } else if (step < fanim.length - 1) {
3385
- fanim[step].dispatchEvent({ type: "animationend", feature });
3386
- step++;
3387
- nb = 0;
3388
- event.extent = false;
3389
- } else {
3390
- stop();
3391
- }
3392
- } else {
3393
- var animEvent = {
3394
- type: "animating",
3395
- step,
3396
- start: event.start,
3397
- time: event.time,
3398
- elapsed: event.elapsed,
3399
- rotation: event.rotation || 0,
3400
- geom: event.geom,
3401
- coordinate: event.coord,
3402
- feature
3403
- };
3404
- fanim[step].dispatchEvent(animEvent);
3405
- self.dispatchEvent(animEvent);
3406
- }
3407
- filters.forEach(function(f) {
3408
- if (f.get("active"))
3409
- f.postcompose(e);
3410
- });
3411
- e.context.restore();
3412
- e.frameState.animate = true;
3413
- }
3414
- function stop(options) {
3415
- unByKey(listenerKey);
3416
- listenerKey = null;
3417
- feature.setStyle(style);
3418
- var event2 = { type: "animationend", feature };
3419
- if (options) {
3420
- for (var i2 in options)
3421
- if (options.hasOwnProperty(i2)) {
3422
- event2[i2] = options[i2];
3423
- }
3424
- }
3425
- fanim[step].dispatchEvent(event2);
3426
- self.dispatchEvent(event2);
3427
- }
3428
- function start(options) {
3429
- if (fanim.length && !listenerKey) {
3430
- listenerKey = self.on(["postcompose", "postrender"], animate.bind(self));
3431
- if (self.renderSync) {
3432
- try {
3433
- self.renderSync();
3434
- } catch (e) {
3435
- }
3436
- } else {
3437
- self.changed();
3438
- }
3439
- feature.setStyle(fanim[step].hiddenStyle || ol_featureAnimation.hiddenStyle);
3440
- var event2 = { type: "animationstart", feature };
3441
- if (options) {
3442
- for (var i2 in options)
3443
- if (options.hasOwnProperty(i2)) {
3444
- event2[i2] = options[i2];
3445
- }
3446
- }
3447
- fanim[step].dispatchEvent(event2);
3448
- self.dispatchEvent(event2);
3449
- }
3450
- }
3451
- start();
3452
- return {
3453
- start,
3454
- stop,
3455
- isPlaying: function() {
3456
- return !!listenerKey;
3457
- }
3458
- };
3459
- };
3460
- var ol_featureAnimation_Bounce = function(options) {
3461
- options = options || {};
3462
- ol_featureAnimation.call(this, options);
3463
- this.amplitude_ = options.amplitude || 40;
3464
- this.bounce_ = -Math.PI * (options.bounce || 3);
3465
- };
3466
- ol_ext_inherits(ol_featureAnimation_Bounce, ol_featureAnimation);
3467
- ol_featureAnimation_Bounce.prototype.animate = function(e) {
3468
- var flashGeom = e.geom.clone();
3469
- var t = Math.abs(Math.sin(this.bounce_ * e.elapsed)) * this.amplitude_ * (1 - this.easing_(e.elapsed)) * e.frameState.viewState.resolution;
3470
- flashGeom.translate(0, t);
3471
- this.drawGeom_(e, flashGeom, e.geom);
3472
- return e.time <= this.duration_;
3473
- };
3474
- var ol_featureAnimation_Blink = function(options) {
3475
- ol_featureAnimation.call(this, options);
3476
- this.set("nb", options.nb || 10);
3477
- };
3478
- ol_ext_inherits(ol_featureAnimation_Blink, ol_featureAnimation);
3479
- ol_featureAnimation_Blink.prototype.animate = function(e) {
3480
- if (!(Math.round(this.easing_(e.elapsed) * this.get("nb")) % 2)) {
3481
- this.drawGeom_(e, e.geom);
3482
- }
3483
- return e.time <= this.duration_;
3484
- };
3485
- var ol_featureAnimation_Drop = function(options) {
3486
- options = options || {};
3487
- this.speed_ = options.speed || 0;
3488
- ol_featureAnimation.call(this, options);
3489
- this.side_ = options.side || "top";
3490
- };
3491
- ol_ext_inherits(ol_featureAnimation_Drop, ol_featureAnimation);
3492
- ol_featureAnimation_Drop.prototype.animate = function(e) {
3493
- if (!e.time) {
3494
- var angle = e.frameState.viewState.rotation;
3495
- var s = e.frameState.size[1] * e.frameState.viewState.resolution;
3496
- if (this.side_ != "top")
3497
- s *= -1;
3498
- this.dx = -Math.sin(angle) * s;
3499
- this.dy = Math.cos(angle) * s;
3500
- if (this.speed_) {
3501
- this.duration_ = s / this.speed_ / e.frameState.viewState.resolution;
3502
- }
3503
- }
3504
- var flashGeom = e.geom.clone();
3505
- flashGeom.translate(
3506
- this.dx * (1 - this.easing_(e.elapsed)),
3507
- this.dy * (1 - this.easing_(e.elapsed))
3508
- );
3509
- this.drawGeom_(e, flashGeom, e.geom);
3510
- return e.time <= this.duration_;
3511
- };
3512
- var ol_featureAnimation_Fade = function(options) {
3513
- options = options || {};
3514
- this.speed_ = options.speed || 0;
3515
- ol_featureAnimation.call(this, options);
3516
- };
3517
- ol_ext_inherits(ol_featureAnimation_Fade, ol_featureAnimation);
3518
- ol_featureAnimation_Fade.prototype.animate = function(e) {
3519
- e.context.globalAlpha = this.easing_(e.elapsed);
3520
- this.drawGeom_(e, e.geom);
3521
- return e.time <= this.duration_;
3522
- };
3523
- var ol_featureAnimation_Path = function(options) {
3524
- options = options || {};
3525
- ol_featureAnimation.call(this, options);
3526
- this.speed_ = options.speed || 0;
3527
- this.path_ = options.path;
3528
- switch (options.rotate) {
3529
- case true:
3530
- case 0:
3531
- this.rotate_ = 0;
3532
- break;
3533
- default:
3534
- this.rotate_ = options.rotate || false;
3535
- break;
3536
- }
3537
- if (this.path_ && this.path_.getGeometry)
3538
- this.path_ = this.path_.getGeometry();
3539
- if (this.path_ && this.path_.getLineString)
3540
- this.path_ = this.path_.getLineString();
3541
- if (this.path_.getLength) {
3542
- this.dist_ = this.path_.getLength();
3543
- if (this.path_ && this.path_.getCoordinates)
3544
- this.path_ = this.path_.getCoordinates();
3545
- } else {
3546
- this.dist_ = 0;
3547
- }
3548
- if (this.speed_ > 0)
3549
- this.duration_ = this.dist_ / this.speed_;
3550
- };
3551
- ol_ext_inherits(ol_featureAnimation_Path, ol_featureAnimation);
3552
- ol_featureAnimation_Path.prototype.animate = function(e) {
3553
- if (!e.time) {
3554
- if (!this.dist_)
3555
- return false;
3556
- }
3557
- var dmax = this.dist_ * this.easing_(e.elapsed);
3558
- var p0, p, s, dx, dy, dl, d = 0;
3559
- p = this.path_[0];
3560
- for (var i = 1; i < this.path_.length; i++) {
3561
- p0 = p;
3562
- p = this.path_[i];
3563
- dx = p[0] - p0[0];
3564
- dy = p[1] - p0[1];
3565
- dl = Math.sqrt(dx * dx + dy * dy);
3566
- if (dl && d + dl >= dmax) {
3567
- s = (dmax - d) / dl;
3568
- p = [p0[0] + (p[0] - p0[0]) * s, p0[1] + (p[1] - p0[1]) * s];
3569
- break;
3570
- }
3571
- d += dl;
3572
- }
3573
- var style = e.style;
3574
- e.rotation = Math.PI / 2 + Math.atan2(p0[1] - p[1], p0[0] - p[0]);
3575
- if (this.rotate_ !== false) {
3576
- var st = [];
3577
- var angle = this.rotate_ - e.rotation + e.frameState.viewState.rotation;
3578
- e.rotation = Math.PI / 2 + Math.atan2(p0[1] - p[1], p0[0] - p[0]);
3579
- for (var k = 0; s = e.style[k]; k++) {
3580
- if (s.getImage()) {
3581
- s.getImage().setRotation(angle);
3582
- }
3583
- st.push(s);
3584
- }
3585
- e.style = st;
3586
- }
3587
- e.geom.setCoordinates(p);
3588
- this.drawGeom_(e, e.geom);
3589
- e.style = style;
3590
- return e.time <= this.duration_;
3591
- };
3592
- var ol_featureAnimation_Shake = function(options) {
3593
- options = options || {};
3594
- ol_featureAnimation.call(this, options);
3595
- this.amplitude_ = options.amplitude || 40;
3596
- this.bounce_ = -Math.PI * (options.bounce || 6);
3597
- this.horizontal_ = options.horizontal;
3598
- };
3599
- ol_ext_inherits(ol_featureAnimation_Shake, ol_featureAnimation);
3600
- ol_featureAnimation_Shake.prototype.animate = function(e) {
3601
- var flashGeom = e.geom.clone();
3602
- var shadow = e.geom.clone();
3603
- var t = this.easing_(e.elapsed);
3604
- t = Math.sin(this.bounce_ * t) * this.amplitude_ * (1 - t) * e.frameState.viewState.resolution;
3605
- if (this.horizontal_) {
3606
- flashGeom.translate(t, 0);
3607
- shadow.translate(t, 0);
3608
- } else
3609
- flashGeom.translate(0, t);
3610
- this.drawGeom_(e, flashGeom, shadow);
3611
- return e.time <= this.duration_;
3612
- };
3613
- var ol_featureAnimation_Show = function(options) {
3614
- ol_featureAnimation.call(this, options);
3615
- };
3616
- ol_ext_inherits(ol_featureAnimation_Show, ol_featureAnimation);
3617
- ol_featureAnimation_Show.prototype.animate = function(e) {
3618
- this.drawGeom_(e, e.geom);
3619
- return e.time <= this.duration_;
3620
- };
3621
- var ol_featureAnimation_Slide = function(options) {
3622
- options = options || {};
3623
- this.speed_ = options.speed || 0;
3624
- ol_featureAnimation.call(this, options);
3625
- this.side_ = options.side || "left";
3626
- };
3627
- ol_ext_inherits(ol_featureAnimation_Slide, ol_featureAnimation);
3628
- ol_featureAnimation_Slide.prototype.animate = function(e) {
3629
- if (!e.time) {
3630
- if (this.side_ == "left")
3631
- this.dx = e.extent[0] - e.bbox[2];
3632
- else
3633
- this.dx = e.extent[2] - e.bbox[0];
3634
- if (this.speed_)
3635
- this.duration_ = Math.abs(this.dx) / this.speed_ / e.frameState.viewState.resolution;
3636
- }
3637
- var flashGeom = e.geom.clone();
3638
- flashGeom.translate(this.dx * (1 - this.easing_(e.elapsed)), 0);
3639
- this.drawGeom_(e, flashGeom);
3640
- return e.time <= this.duration_;
3641
- };
3642
- var ol_featureAnimation_Teleport = function(options) {
3643
- ol_featureAnimation.call(this, options);
3644
- };
3645
- ol_ext_inherits(ol_featureAnimation_Teleport, ol_featureAnimation);
3646
- ol_featureAnimation_Teleport.prototype.animate = function(e) {
3647
- var sc = this.easing_(e.elapsed);
3648
- if (sc) {
3649
- e.context.save();
3650
- var ratio = e.frameState.pixelRatio;
3651
- e.context.globalAlpha = sc;
3652
- e.context.scale(sc, 1 / sc);
3653
- var m = e.frameState.coordinateToPixelTransform;
3654
- var dx = (1 / sc - 1) * ratio * (m[0] * e.coord[0] + m[1] * e.coord[1] + m[4]);
3655
- var dy = (sc - 1) * ratio * (m[2] * e.coord[0] + m[3] * e.coord[1] + m[5]);
3656
- e.context.translate(dx, dy);
3657
- this.drawGeom_(e, e.geom);
3658
- e.context.restore();
3659
- }
3660
- return e.time <= this.duration_;
3661
- };
3662
- var ol_featureAnimation_Throw = function(options) {
3663
- options = options || {};
3664
- ol_featureAnimation.call(this, options);
3665
- this.speed_ = options.speed || 0;
3666
- this.side_ = options.side || "left";
3667
- };
3668
- ol_ext_inherits(ol_featureAnimation_Throw, ol_featureAnimation);
3669
- ol_featureAnimation_Throw.prototype.animate = function(e) {
3670
- if (!e.time && this.speed_) {
3671
- var dx, dy;
3672
- if (this.side_ == "left") {
3673
- dx = this.dx = e.extent[0] - e.bbox[2];
3674
- dy = this.dy = e.extent[3] - e.bbox[1];
3675
- } else {
3676
- dx = this.dx = e.extent[2] - e.bbox[0];
3677
- dy = this.dy = e.extent[3] - e.bbox[1];
3678
- }
3679
- this.duration_ = Math.sqrt(dx * dx + dy * dy) / this.speed_ / e.frameState.viewState.resolution;
3680
- }
3681
- var flashGeom = e.geom.clone();
3682
- var shadow = e.geom.clone();
3683
- flashGeom.translate(
3684
- this.dx * (1 - this.easing_(e.elapsed)),
3685
- this.dy * Math.cos(Math.PI / 2 * this.easing_(e.elapsed))
3686
- );
3687
- shadow.translate(this.dx * (1 - this.easing_(e.elapsed)), 0);
3688
- this.drawGeom_(e, flashGeom, shadow);
3689
- return e.time <= this.duration_;
3690
- };
3691
- var ol_featureAnimation_Zoom = function(options) {
3692
- options = options || {};
3693
- ol_featureAnimation.call(this, options);
3694
- this.set("zoomout", options.zoomOut);
3695
- };
3696
- ol_ext_inherits(ol_featureAnimation_Zoom, ol_featureAnimation);
3697
- var ol_featureAnimation_ZoomOut = function(options) {
3698
- options = options || {};
3699
- options.zoomOut = true;
3700
- ol_featureAnimation_Zoom.call(this, options);
3701
- };
3702
- ol_ext_inherits(ol_featureAnimation_ZoomOut, ol_featureAnimation_Zoom);
3703
- ol_featureAnimation_Zoom.prototype.animate = function(e) {
3704
- var fac = this.easing_(e.elapsed);
3705
- if (fac) {
3706
- if (this.get("zoomout"))
3707
- fac = 1 / fac;
3708
- var style = e.style;
3709
- var i, imgs, sc = [];
3710
- for (i = 0; i < style.length; i++) {
3711
- imgs = style[i].getImage();
3712
- if (imgs) {
3713
- sc[i] = imgs.getScale();
3714
- if (e.type === "postrender")
3715
- imgs.setScale(sc[i] * fac / e.frameState.pixelRatio);
3716
- else
3717
- imgs.setScale(sc[i] * fac);
3718
- }
3719
- }
3720
- this.drawGeom_(e, e.geom);
3721
- for (i = 0; i < style.length; i++) {
3722
- imgs = style[i].getImage();
3723
- if (imgs)
3724
- imgs.setScale(sc[i]);
3725
- }
3726
- }
3727
- return e.time <= this.duration_;
3728
- };
3729
- var ol_style_StrokePattern = function(options) {
3730
- if (!options)
3731
- options = {};
3732
- var pattern, i;
3733
- var canvas = this.canvas_ = document.createElement("canvas");
3734
- var scale = Number(options.scale) > 0 ? Number(options.scale) : 1;
3735
- var ratio = scale * DEVICE_PIXEL_RATIO || DEVICE_PIXEL_RATIO;
3736
- var ctx = canvas.getContext("2d");
3737
- if (options.image) {
3738
- options.image.load();
3739
- var img = options.image.getImage();
3740
- if (img.width) {
3741
- canvas.width = Math.round(img.width * ratio);
3742
- canvas.height = Math.round(img.height * ratio);
3743
- ctx.globalAlpha = typeof options.opacity == "number" ? options.opacity : 1;
3744
- ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
3745
- pattern = ctx.createPattern(canvas, "repeat");
3746
- } else {
3747
- var self = this;
3748
- pattern = [0, 0, 0, 0];
3749
- img.onload = function() {
3750
- canvas.width = Math.round(img.width * ratio);
3751
- canvas.height = Math.round(img.height * ratio);
3752
- ctx.globalAlpha = typeof options.opacity == "number" ? options.opacity : 1;
3753
- ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height);
3754
- pattern = ctx.createPattern(canvas, "repeat");
3755
- self.setColor(pattern);
3756
- };
3757
- }
3758
- } else {
3759
- var pat = this.getPattern_(options);
3760
- canvas.width = Math.round(pat.width * ratio);
3761
- canvas.height = Math.round(pat.height * ratio);
3762
- ctx.beginPath();
3763
- if (options.fill) {
3764
- ctx.fillStyle = asString(options.fill.getColor());
3765
- ctx.fillRect(0, 0, canvas.width, canvas.height);
3766
- }
3767
- ctx.scale(ratio, ratio);
3768
- ctx.lineCap = "round";
3769
- ctx.lineWidth = pat.stroke || 1;
3770
- ctx.fillStyle = asString(options.color || "#000");
3771
- ctx.strokeStyle = asString(options.color || "#000");
3772
- if (pat.circles)
3773
- for (i = 0; i < pat.circles.length; i++) {
3774
- var ci = pat.circles[i];
3775
- ctx.beginPath();
3776
- ctx.arc(ci[0], ci[1], ci[2], 0, 2 * Math.PI);
3777
- if (pat.fill)
3778
- ctx.fill();
3779
- if (pat.stroke)
3780
- ctx.stroke();
3781
- }
3782
- if (!pat.repeat)
3783
- pat.repeat = [[0, 0]];
3784
- if (pat.char) {
3785
- ctx.font = pat.font || pat.width + "px Arial";
3786
- ctx.textAlign = "center";
3787
- ctx.textBaseline = "middle";
3788
- if (pat.angle) {
3789
- ctx.fillText(pat.char, pat.width / 4, pat.height / 4);
3790
- ctx.fillText(pat.char, 5 * pat.width / 4, 5 * pat.height / 4);
3791
- ctx.fillText(pat.char, pat.width / 4, 5 * pat.height / 4);
3792
- ctx.fillText(pat.char, 5 * pat.width / 4, pat.height / 4);
3793
- ctx.fillText(pat.char, 3 * pat.width / 4, 3 * pat.height / 4);
3794
- ctx.fillText(pat.char, -pat.width / 4, -pat.height / 4);
3795
- ctx.fillText(pat.char, 3 * pat.width / 4, -pat.height / 4);
3796
- ctx.fillText(pat.char, -pat.width / 4, 3 * pat.height / 4);
3797
- } else
3798
- ctx.fillText(pat.char, pat.width / 2, pat.height / 2);
3799
- }
3800
- if (pat.lines)
3801
- for (i = 0; i < pat.lines.length; i++)
3802
- for (var r = 0; r < pat.repeat.length; r++) {
3803
- var li = pat.lines[i];
3804
- ctx.beginPath();
3805
- ctx.moveTo(li[0] + pat.repeat[r][0], li[1] + pat.repeat[r][1]);
3806
- for (var k = 2; k < li.length; k += 2) {
3807
- ctx.lineTo(li[k] + pat.repeat[r][0], li[k + 1] + pat.repeat[r][1]);
3808
- }
3809
- if (pat.fill)
3810
- ctx.fill();
3811
- if (pat.stroke)
3812
- ctx.stroke();
3813
- ctx.save();
3814
- ctx.strokeStyle = "red";
3815
- ctx.strokeWidth = 0.1;
3816
- ctx.restore();
3817
- }
3818
- pattern = ctx.createPattern(canvas, "repeat");
3819
- if (options.offset) {
3820
- var offset = options.offset;
3821
- if (typeof offset == "number")
3822
- offset = [offset, offset];
3823
- if (offset instanceof Array) {
3824
- var dx = Math.round(offset[0] * ratio);
3825
- var dy = Math.round(offset[1] * ratio);
3826
- ctx.scale(1 / ratio, 1 / ratio);
3827
- ctx.clearRect(0, 0, canvas.width, canvas.height);
3828
- ctx.translate(dx, dy);
3829
- ctx.fillStyle = pattern;
3830
- ctx.fillRect(-dx, -dy, canvas.width, canvas.height);
3831
- pattern = ctx.createPattern(canvas, "repeat");
3832
- }
3833
- }
3834
- }
3835
- options.color = pattern;
3836
- Stroke.call(this, options);
3837
- };
3838
- ol_ext_inherits(ol_style_StrokePattern, Stroke);
3839
- ol_style_StrokePattern.prototype.clone = function() {
3840
- var s = Fill.prototype.clone.call(this);
3841
- s.canvas_ = this.canvas_;
3842
- return s;
3843
- };
3844
- ol_style_StrokePattern.prototype.getImage = function() {
3845
- return this.canvas_;
3846
- };
3847
- ol_style_StrokePattern.prototype.getPattern_ = function(options) {
3848
- var pat = ol_style_FillPattern.prototype.patterns[options.pattern] || ol_style_FillPattern.prototype.patterns.dot;
3849
- var d = Math.round(options.spacing) || 10;
3850
- var size;
3851
- switch (options.pattern) {
3852
- case "dot":
3853
- case "circle": {
3854
- size = options.size === 0 ? 0 : options.size / 2 || 2;
3855
- if (!options.angle) {
3856
- pat.width = pat.height = d;
3857
- pat.circles = [[d / 2, d / 2, size]];
3858
- if (options.pattern == "circle") {
3859
- pat.circles = pat.circles.concat([
3860
- [d / 2 + d, d / 2, size],
3861
- [d / 2 - d, d / 2, size],
3862
- [d / 2, d / 2 + d, size],
3863
- [d / 2, d / 2 - d, size],
3864
- [d / 2 + d, d / 2 + d, size],
3865
- [d / 2 + d, d / 2 - d, size],
3866
- [d / 2 - d, d / 2 + d, size],
3867
- [d / 2 - d, d / 2 - d, size]
3868
- ]);
3869
- }
3870
- } else {
3871
- d = pat.width = pat.height = Math.round(d * 1.4);
3872
- pat.circles = [[d / 4, d / 4, size], [3 * d / 4, 3 * d / 4, size]];
3873
- if (options.pattern == "circle") {
3874
- pat.circles = pat.circles.concat([
3875
- [d / 4 + d, d / 4, size],
3876
- [d / 4, d / 4 + d, size],
3877
- [3 * d / 4 - d, 3 * d / 4, size],
3878
- [3 * d / 4, 3 * d / 4 - d, size],
3879
- [d / 4 + d, d / 4 + d, size],
3880
- [3 * d / 4 - d, 3 * d / 4 - d, size]
3881
- ]);
3882
- }
3883
- }
3884
- break;
3885
- }
3886
- case "tile":
3887
- case "square": {
3888
- size = options.size === 0 ? 0 : options.size / 2 || 2;
3889
- if (!options.angle) {
3890
- pat.width = pat.height = d;
3891
- pat.lines = [[d / 2 - size, d / 2 - size, d / 2 + size, d / 2 - size, d / 2 + size, d / 2 + size, d / 2 - size, d / 2 + size, d / 2 - size, d / 2 - size]];
3892
- } else {
3893
- pat.width = pat.height = d;
3894
- pat.lines = [[d / 2 - size, d / 2, d / 2, d / 2 - size, d / 2 + size, d / 2, d / 2, d / 2 + size, d / 2 - size, d / 2]];
3895
- }
3896
- if (options.pattern == "square")
3897
- pat.repeat = [[0, 0], [0, d], [d, 0], [0, -d], [-d, 0], [-d, -d], [d, d], [-d, d], [d, -d]];
3898
- break;
3899
- }
3900
- case "cross": {
3901
- if (options.angle)
3902
- options.angle = 45;
3903
- }
3904
- case "hatch": {
3905
- var a = Math.round(((options.angle || 0) - 90) % 360);
3906
- if (a > 180)
3907
- a -= 360;
3908
- a *= Math.PI / 180;
3909
- var cos = Math.cos(a);
3910
- var sin = Math.sin(a);
3911
- if (Math.abs(sin) < 1e-4) {
3912
- pat.width = pat.height = d;
3913
- pat.lines = [[0, 0.5, d, 0.5]];
3914
- pat.repeat = [[0, 0], [0, d]];
3915
- } else if (Math.abs(cos) < 1e-4) {
3916
- pat.width = pat.height = d;
3917
- pat.lines = [[0.5, 0, 0.5, d]];
3918
- pat.repeat = [[0, 0], [d, 0]];
3919
- if (options.pattern == "cross") {
3920
- pat.lines.push([0, 0.5, d, 0.5]);
3921
- pat.repeat.push([0, d]);
3922
- }
3923
- } else {
3924
- var w = pat.width = Math.round(Math.abs(d / sin)) || 1;
3925
- var h = pat.height = Math.round(Math.abs(d / cos)) || 1;
3926
- if (options.pattern == "cross") {
3927
- pat.lines = [[-w, -h, 2 * w, 2 * h], [2 * w, -h, -w, 2 * h]];
3928
- pat.repeat = [[0, 0]];
3929
- } else if (cos * sin > 0) {
3930
- pat.lines = [[-w, -h, 2 * w, 2 * h]];
3931
- pat.repeat = [[0, 0], [w, 0], [0, h]];
3932
- } else {
3933
- pat.lines = [[2 * w, -h, -w, 2 * h]];
3934
- pat.repeat = [[0, 0], [-w, 0], [0, h]];
3935
- }
3936
- }
3937
- pat.stroke = options.size === 0 ? 0 : options.size || 4;
3938
- break;
3939
- }
3940
- }
3941
- return pat;
3942
- };
3943
- var ol_source_DayNight = function(options) {
3944
- options = options || {};
3945
- options.loader = this._loader;
3946
- options.strategy = all;
3947
- VectorSource.call(this, options);
3948
- this.set("time", options.time || new Date());
3949
- this.set("step", options.step || 1);
3950
- };
3951
- ol_ext_inherits(ol_source_DayNight, VectorSource);
3952
- (function() {
3953
- ol_source_DayNight.prototype._loader = function(extent, resolution, projection) {
3954
- var lonlat = this.getCoordinates(this.get("time"));
3955
- var geom = new ol_geom_Polygon([lonlat]);
3956
- geom.transform("EPSG:4326", projection);
3957
- this.addFeature(new Feature(geom));
3958
- };
3959
- ol_source_DayNight.prototype.setTime = function(time) {
3960
- this.set("time", time);
3961
- this.refresh();
3962
- };
3963
- function _sunEclipticPosition(julianDay) {
3964
- var deg2rad = Math.PI / 180;
3965
- var n = julianDay - 2451545;
3966
- var L = 280.46 + 0.9856474 * n;
3967
- L %= 360;
3968
- var g = 357.528 + 0.9856003 * n;
3969
- g %= 360;
3970
- var lambda = L + 1.915 * Math.sin(g * deg2rad) + 0.02 * Math.sin(2 * g * deg2rad);
3971
- var R = 1.00014 - 0.01671 * Math.cos(g * deg2rad) - 14e-4 * Math.cos(2 * g * deg2rad);
3972
- return { lambda, R };
3973
- }
3974
- function _eclipticObliquity(julianDay) {
3975
- var n = julianDay - 2451545;
3976
- var T = n / 36525;
3977
- var epsilon = 23.43929111 - T * (46.836769 / 3600 - T * (1831e-7 / 3600 + T * (20034e-7 / 3600 - T * (576e-9 / 3600 - T * 434e-10 / 3600))));
3978
- return epsilon;
3979
- }
3980
- function _sunEquatorialPosition(sunEclLon, eclObliq) {
3981
- var rad2deg = 180 / Math.PI;
3982
- var deg2rad = Math.PI / 180;
3983
- var alpha = Math.atan(Math.cos(eclObliq * deg2rad) * Math.tan(sunEclLon * deg2rad)) * rad2deg;
3984
- var delta = Math.asin(Math.sin(eclObliq * deg2rad) * Math.sin(sunEclLon * deg2rad)) * rad2deg;
3985
- var lQuadrant = Math.floor(sunEclLon / 90) * 90;
3986
- var raQuadrant = Math.floor(alpha / 90) * 90;
3987
- alpha = alpha + (lQuadrant - raQuadrant);
3988
- return { alpha, delta };
3989
- }
3990
- ol_source_DayNight.prototype.getSunPosition = function(time) {
3991
- var date = time ? new Date(time) : new Date();
3992
- var julianDay = date / 864e5 + 24405875e-1;
3993
- var gst = (18.697374558 + 24.06570982441908 * (julianDay - 2451545)) % 24;
3994
- var sunEclPos = _sunEclipticPosition(julianDay);
3995
- var eclObliq = _eclipticObliquity(julianDay);
3996
- var sunEqPos = _sunEquatorialPosition(sunEclPos.lambda, eclObliq);
3997
- return [sunEqPos.alpha - gst * 15, sunEqPos.delta];
3998
- };
3999
- ol_source_DayNight.getNightLat = function(lon, time) {
4000
- var rad2deg = 180 / Math.PI;
4001
- var deg2rad = Math.PI / 180;
4002
- var date = time ? new Date(time) : new Date();
4003
- var julianDay = date / 864e5 + 24405875e-1;
4004
- var gst = (18.697374558 + 24.06570982441908 * (julianDay - 2451545)) % 24;
4005
- var sunEclPos = _sunEclipticPosition(julianDay);
4006
- var eclObliq = _eclipticObliquity(julianDay);
4007
- var sunEqPos = _sunEquatorialPosition(sunEclPos.lambda, eclObliq);
4008
- var ha = gst * 15 + lon - sunEqPos.alpha;
4009
- var lat = Math.atan(-Math.cos(ha * deg2rad) / Math.tan(sunEqPos.delta * deg2rad)) * rad2deg;
4010
- return lat;
4011
- };
4012
- ol_source_DayNight.prototype.getCoordinates = function(time, options) {
4013
- var rad2deg = 180 / Math.PI;
4014
- var deg2rad = Math.PI / 180;
4015
- var date = time ? new Date(time) : new Date();
4016
- var julianDay = date / 864e5 + 24405875e-1;
4017
- var gst = (18.697374558 + 24.06570982441908 * (julianDay - 2451545)) % 24;
4018
- var lonlat = [];
4019
- var sunEclPos = _sunEclipticPosition(julianDay);
4020
- var eclObliq = _eclipticObliquity(julianDay);
4021
- var sunEqPos = _sunEquatorialPosition(sunEclPos.lambda, eclObliq);
4022
- var step = this.get("step") || 1;
4023
- for (var i = -180; i <= 180; i += step) {
4024
- var lon = i;
4025
- var ha = gst * 15 + lon - sunEqPos.alpha;
4026
- var lat = Math.atan(-Math.cos(ha * deg2rad) / Math.tan(sunEqPos.delta * deg2rad)) * rad2deg;
4027
- lonlat.push([lon, lat]);
4028
- }
4029
- switch (options) {
4030
- case "line":
4031
- break;
4032
- case "day":
4033
- sunEqPos.delta *= -1;
4034
- default: {
4035
- lat = sunEqPos.delta < 0 ? 90 : -90;
4036
- for (var tlon = 180; tlon >= -180; tlon -= step) {
4037
- lonlat.push([tlon, lat]);
4038
- }
4039
- lonlat.push(lonlat[0]);
4040
- break;
4041
- }
4042
- }
4043
- if (options === "daynight") {
4044
- var day = [];
4045
- lonlat.forEach(function(t) {
4046
- day.push(t.slice());
4047
- });
4048
- day[0][1] = -day[0][1];
4049
- day[day.length - 1][1] = -day[0][1];
4050
- day[day.length - 1][1] = -day[0][1];
4051
- lonlat = [lonlat, day];
4052
- }
4053
- return lonlat;
4054
- };
4055
- })();
4056
- var ol_coordinate_dist2d = function(p1, p2) {
4057
- var dx = p1[0] - p2[0];
4058
- var dy = p1[1] - p2[1];
4059
- return Math.sqrt(dx * dx + dy * dy);
4060
- };
4061
- var ol_extent_intersection;
4062
- (function() {
4063
- function splitX(pts, x) {
4064
- var pt;
4065
- for (let i = pts.length - 1; i > 0; i--) {
4066
- if (pts[i][0] > x && pts[i - 1][0] < x || pts[i][0] < x && pts[i - 1][0] > x) {
4067
- pt = [x, (x - pts[i][0]) / (pts[i - 1][0] - pts[i][0]) * (pts[i - 1][1] - pts[i][1]) + pts[i][1]];
4068
- pts.splice(i, 0, pt);
4069
- }
4070
- }
4071
- }
4072
- function splitY(pts, y) {
4073
- var pt;
4074
- for (let i = pts.length - 1; i > 0; i--) {
4075
- if (pts[i][1] > y && pts[i - 1][1] < y || pts[i][1] < y && pts[i - 1][1] > y) {
4076
- pt = [(y - pts[i][1]) / (pts[i - 1][1] - pts[i][1]) * (pts[i - 1][0] - pts[i][0]) + pts[i][0], y];
4077
- pts.splice(i, 0, pt);
4078
- }
4079
- }
4080
- }
4081
- ol_extent_intersection = function(extent, polygon) {
4082
- var poly = polygon.getType() === "Polygon";
4083
- if (!poly && polygon.getType() !== "MultiPolygon")
4084
- return null;
4085
- var geom = polygon.getCoordinates();
4086
- if (poly)
4087
- geom = [geom];
4088
- geom.forEach(function(g) {
4089
- g.forEach(function(c) {
4090
- splitX(c, extent[0]);
4091
- splitX(c, extent[2]);
4092
- splitY(c, extent[1]);
4093
- splitY(c, extent[3]);
4094
- });
4095
- });
4096
- geom.forEach(function(g) {
4097
- g.forEach(function(c) {
4098
- c.forEach(function(p) {
4099
- if (p[0] < extent[0])
4100
- p[0] = extent[0];
4101
- else if (p[0] > extent[2])
4102
- p[0] = extent[2];
4103
- if (p[1] < extent[1])
4104
- p[1] = extent[1];
4105
- else if (p[1] > extent[3])
4106
- p[1] = extent[3];
4107
- });
4108
- });
4109
- });
4110
- if (poly) {
4111
- return new ol_geom_Polygon(geom[0]);
4112
- } else {
4113
- return new ol_geom_MultiPolygon(geom);
4114
- }
4115
- };
4116
- })();
4117
- var ol_coordinate_sampleAt = function(p1, p2, d, start) {
4118
- var pts = [];
4119
- if (start !== false)
4120
- pts.push(p1);
4121
- var dl = ol_coordinate_dist2d(p1, p2);
4122
- if (dl) {
4123
- var nb = Math.round(dl / d);
4124
- if (nb > 1) {
4125
- var dx = (p2[0] - p1[0]) / nb;
4126
- var dy = (p2[1] - p1[1]) / nb;
4127
- for (var i = 1; i < nb; i++) {
4128
- pts.push([p1[0] + dx * i, p1[1] + dy * i]);
4129
- }
4130
- }
4131
- }
4132
- pts.push(p2);
4133
- return pts;
4134
- };
4135
- LineString.prototype.sampleAt = function(d) {
4136
- var line = this.getCoordinates();
4137
- var result = [];
4138
- for (var i = 1; i < line.length; i++) {
4139
- result = result.concat(ol_coordinate_sampleAt(line[i - 1], line[i], d, i === 1));
4140
- }
4141
- return new LineString(result);
4142
- };
4143
- ol_geom_MultiLineString.prototype.sampleAt = function(d) {
4144
- var lines = this.getCoordinates();
4145
- var result = [];
4146
- lines.forEach(function(p) {
4147
- var l = [];
4148
- for (var i = 1; i < p.length; i++) {
4149
- l = l.concat(ol_coordinate_sampleAt(p[i - 1], p[i], d, i === 1));
4150
- }
4151
- result.push(l);
4152
- });
4153
- return new ol_geom_MultiLineString(result);
4154
- };
4155
- ol_geom_Polygon.prototype.sampleAt = function(res) {
4156
- var poly = this.getCoordinates();
4157
- var result = [];
4158
- poly.forEach(function(p) {
4159
- var l = [];
4160
- for (var i = 1; i < p.length; i++) {
4161
- l = l.concat(ol_coordinate_sampleAt(p[i - 1], p[i], res, i === 1));
4162
- }
4163
- result.push(l);
4164
- });
4165
- return new ol_geom_Polygon(result);
4166
- };
4167
- ol_geom_MultiPolygon.prototype.sampleAt = function(res) {
4168
- var mpoly = this.getCoordinates();
4169
- var result = [];
4170
- mpoly.forEach(function(poly) {
4171
- var a = [];
4172
- result.push(a);
4173
- poly.forEach(function(p) {
4174
- var l = [];
4175
- for (var i = 1; i < p.length; i++) {
4176
- l = l.concat(ol_coordinate_sampleAt(p[i - 1], p[i], res, i === 1));
4177
- }
4178
- a.push(l);
4179
- });
4180
- });
4181
- return new ol_geom_MultiPolygon(result);
4182
- };
4183
- Circle.prototype.intersection = function(geom, resolution) {
4184
- if (geom.sampleAt) {
4185
- var ext = buffer(this.getCenter().concat(this.getCenter()), this.getRadius());
4186
- geom = ol_extent_intersection(ext, geom);
4187
- geom = geom.simplify(resolution);
4188
- var c = this.getCenter();
4189
- var r = this.getRadius();
4190
- var g = geom.sampleAt(resolution).getCoordinates();
4191
- switch (geom.getType()) {
4192
- case "Polygon":
4193
- g = [g];
4194
- case "MultiPolygon": {
4195
- var hasout = false;
4196
- var result = [];
4197
- g.forEach(function(poly) {
4198
- var a = [];
4199
- result.push(a);
4200
- poly.forEach(function(ring) {
4201
- var l = [];
4202
- a.push(l);
4203
- ring.forEach(function(p) {
4204
- var d = ol_coordinate_dist2d(c, p);
4205
- if (d > r) {
4206
- hasout = true;
4207
- l.push([
4208
- c[0] + r / d * (p[0] - c[0]),
4209
- c[1] + r / d * (p[1] - c[1])
4210
- ]);
4211
- } else {
4212
- l.push(p);
4213
- }
4214
- });
4215
- });
4216
- });
4217
- if (!hasout)
4218
- return geom;
4219
- if (geom.getType() === "Polygon") {
4220
- return new ol_geom_Polygon(result[0]);
4221
- } else {
4222
- return new ol_geom_MultiPolygon(result);
4223
- }
4224
- }
4225
- }
4226
- } else {
4227
- console.warn("[ol/geom/Circle~intersection] Unsupported geometry type: " + geom.getType());
4228
- }
4229
- return geom;
4230
- };
4231
- var ol_graph_Dijskra = function(options) {
4232
- options = options || {};
4233
- this.source = options.source;
4234
- this.nodes = new VectorSource();
4235
- this.maxIteration = options.maxIteration || 2e4;
4236
- this.stepIteration = options.stepIteration || 2e3;
4237
- this.astar = true;
4238
- this.candidat = [];
4239
- ol_Object.call(this);
4240
- this.set("epsilon", options.epsilon || 1e-6);
4241
- };
4242
- ol_ext_inherits(ol_graph_Dijskra, ol_Object);
4243
- ol_graph_Dijskra.prototype.weight = function() {
4244
- return 1;
4245
- };
4246
- ol_graph_Dijskra.prototype.direction = function() {
4247
- return 2;
4248
- };
4249
- ol_graph_Dijskra.prototype.getLength = function(geom) {
4250
- if (geom.getGeometry)
4251
- geom = geom.getGeometry();
4252
- return geom.getLength();
4253
- };
4254
- ol_graph_Dijskra.prototype.getNodeSource = function() {
4255
- return this.nodes;
4256
- };
4257
- ol_graph_Dijskra.prototype.getEdges = function(coord) {
4258
- var extent = buffer(boundingExtent([coord]), this.get("epsilon"));
4259
- var result = [];
4260
- this.source.forEachFeatureIntersectingExtent(extent, function(f) {
4261
- result.push(f);
4262
- });
4263
- return result;
4264
- };
4265
- ol_graph_Dijskra.prototype.getNode = function(coord) {
4266
- var extent = buffer(boundingExtent([coord]), this.get("epsilon"));
4267
- var result = [];
4268
- this.nodes.forEachFeatureIntersectingExtent(extent, function(f) {
4269
- result.push(f);
4270
- });
4271
- return result[0];
4272
- };
4273
- ol_graph_Dijskra.prototype.addNode = function(p, wdist, dist, from, prev) {
4274
- if (this.wdist && wdist > this.wdist)
4275
- return false;
4276
- var node = this.getNode(p);
4277
- var dtotal = wdist + this.getLength(new LineString([this.end, p])) * this.weight();
4278
- if (this.astar && this.wdist && dtotal > this.wdist)
4279
- return false;
4280
- if (node) {
4281
- if (node !== this.arrival && node.get("wdist") <= wdist)
4282
- return node;
4283
- node.set("dist", dist);
4284
- node.set("wdist", wdist);
4285
- node.set("dtotal", dtotal);
4286
- node.set("from", from);
4287
- node.set("prev", prev);
4288
- if (node === this.arrival) {
4289
- this.wdist = wdist;
4290
- }
4291
- this.candidat.push(node);
4292
- } else {
4293
- node = new Feature({
4294
- geometry: new Point(p),
4295
- from,
4296
- prev,
4297
- dist: dist || 0,
4298
- wdist,
4299
- dtotal
4300
- });
4301
- if (wdist < 0) {
4302
- node.set("wdist", false);
4303
- } else
4304
- this.candidat.push(node);
4305
- this.nodes.addFeature(node);
4306
- }
4307
- return node;
4308
- };
4309
- ol_graph_Dijskra.prototype.closestCoordinate = function(p) {
4310
- var e = this.source.getClosestFeatureToCoordinate(p);
4311
- var p0 = e.getGeometry().getFirstCoordinate();
4312
- var p1 = e.getGeometry().getLastCoordinate();
4313
- if (ol_coordinate_dist2d(p, p0) < ol_coordinate_dist2d(p, p1))
4314
- return p0;
4315
- else
4316
- return p1;
4317
- };
4318
- ol_graph_Dijskra.prototype.path = function(start, end) {
4319
- if (this.running)
4320
- return false;
4321
- start = this.closestCoordinate(start);
4322
- this.end = this.closestCoordinate(end);
4323
- if (start[0] === this.end[0] && start[1] === this.end[1]) {
4324
- this.dispatchEvent({
4325
- type: "finish",
4326
- route: [],
4327
- wDistance: -1,
4328
- distance: this.wdist
4329
- });
4330
- return false;
4331
- }
4332
- var self = this;
4333
- this.nodes.clear();
4334
- this.candidat = [];
4335
- this.wdist = 0;
4336
- this.running = true;
4337
- this.addNode(start, 0);
4338
- this.arrival = this.addNode(this.end, -1);
4339
- this.nb = 0;
4340
- this.dispatchEvent({
4341
- type: "start"
4342
- });
4343
- setTimeout(function() {
4344
- self._resume();
4345
- });
4346
- return [start, this.end];
4347
- };
4348
- ol_graph_Dijskra.prototype.resume = function() {
4349
- if (this.running)
4350
- return;
4351
- if (this.candidat.length) {
4352
- this.running = true;
4353
- this.nb = 0;
4354
- this._resume();
4355
- }
4356
- };
4357
- ol_graph_Dijskra.prototype.pause = function() {
4358
- if (!this.running)
4359
- return;
4360
- this.nb = -1;
4361
- };
4362
- ol_graph_Dijskra.prototype.getBestWay = function() {
4363
- var node, max = -1;
4364
- for (var i = 0, n; n = this.candidat[i]; i++) {
4365
- if (n.get("wdist") > max) {
4366
- node = n;
4367
- max = n.get("wdist");
4368
- }
4369
- }
4370
- return this.getRoute(node);
4371
- };
4372
- ol_graph_Dijskra.prototype._resume = function() {
4373
- if (!this.running)
4374
- return;
4375
- while (this.candidat.length) {
4376
- this.candidat.sort(function(a, b) {
4377
- return a.get("dtotal") < b.get("dtotal") ? 1 : a.get("dtotal") === b.get("dtotal") ? 0 : -1;
4378
- });
4379
- var node = this.candidat.pop();
4380
- var p = node.getGeometry().getCoordinates();
4381
- var edges = this.getEdges(p);
4382
- for (var i = 0, e; e = edges[i]; i++) {
4383
- if (node.get("from") !== e) {
4384
- var dist = this.getLength(e);
4385
- if (dist < 0) {
4386
- console.log("distance < 0!");
4387
- }
4388
- var wdist = node.get("wdist") + dist * this.weight(e);
4389
- dist = node.get("dist") + dist;
4390
- var pt1 = e.getGeometry().getFirstCoordinate();
4391
- var pt2 = e.getGeometry().getLastCoordinate();
4392
- var sens = this.direction(e);
4393
- if (sens !== 0) {
4394
- if (p[0] === pt1[0] && p[1] === pt1[1] && sens !== -1) {
4395
- this.addNode(pt2, wdist, dist, e, node);
4396
- }
4397
- if (p[0] === pt2[0] && p[0] === pt2[0] && sens !== 1) {
4398
- this.addNode(pt1, wdist, dist, e, node);
4399
- }
4400
- }
4401
- }
4402
- if (this.nb === -1 || this.nb++ > this.maxIteration) {
4403
- this.running = false;
4404
- this.dispatchEvent({
4405
- type: "pause",
4406
- overflow: this.nb !== -1
4407
- });
4408
- return;
4409
- }
4410
- if (!(this.nb % this.stepIteration)) {
4411
- var self = this;
4412
- window.setTimeout(function() {
4413
- self._resume();
4414
- }, 5);
4415
- this.dispatchEvent({
4416
- type: "calculating"
4417
- });
4418
- return;
4419
- }
4420
- }
4421
- }
4422
- this.nodes.clear();
4423
- this.running = false;
4424
- this.dispatchEvent({
4425
- type: "finish",
4426
- route: this.getRoute(this.arrival),
4427
- wDistance: this.wdist,
4428
- distance: this.arrival.get("dist")
4429
- });
4430
- };
4431
- ol_graph_Dijskra.prototype.getRoute = function(node) {
4432
- var route = [];
4433
- while (node) {
4434
- route.unshift(node.get("from"));
4435
- node = node.get("prev");
4436
- }
4437
- route.shift();
4438
- return route;
4439
- };
4440
- var ol_layer_GeoImage = function(options) {
4441
- ol_layer_Image.call(this, options);
4442
- };
4443
- ol_ext_inherits(ol_layer_GeoImage, ol_layer_Image);
4444
- ol_layer_GeoImage.prototype.getExtent = function() {
4445
- return this.getSource().getExtent();
4446
- };
4447
- var ol_source_GeoImage = function(opt_options) {
4448
- var options = {
4449
- attributions: opt_options.attributions,
4450
- logo: opt_options.logo,
4451
- projection: opt_options.projection
4452
- };
4453
- this._image = opt_options.image ? opt_options.image : new Image();
4454
- this._image.crossOrigin = opt_options.crossOrigin;
4455
- var self = this;
4456
- this._image.onload = function() {
4457
- self.setCrop(self.crop);
4458
- self.changed();
4459
- };
4460
- if (!opt_options.image)
4461
- this._image.src = opt_options.url;
4462
- options.canvasFunction = this.calculateImage;
4463
- ol_source_ImageCanvas.call(this, options);
4464
- this.center = opt_options.imageCenter;
4465
- this.setScale(opt_options.imageScale);
4466
- this.rotate = opt_options.imageRotate ? opt_options.imageRotate : 0;
4467
- this.crop = opt_options.imageCrop;
4468
- this.mask = opt_options.imageMask;
4469
- this.setCrop(this.crop);
4470
- this.on("change", function() {
4471
- this.set("extent", this.calculateExtent());
4472
- }.bind(this));
4473
- };
4474
- ol_ext_inherits(ol_source_GeoImage, ol_source_ImageCanvas);
4475
- ol_source_GeoImage.prototype.calculateImage = function(extent, resolution, pixelRatio, size) {
4476
- if (!this.center)
4477
- return;
4478
- var canvas = document.createElement("canvas");
4479
- canvas.width = size[0];
4480
- canvas.height = size[1];
4481
- var ctx = canvas.getContext("2d");
4482
- if (!this._imageSize)
4483
- return canvas;
4484
- function tr(xy) {
4485
- return [
4486
- (xy[0] - extent[0]) / (extent[2] - extent[0]) * size[0],
4487
- (xy[1] - extent[3]) / (extent[1] - extent[3]) * size[1]
4488
- ];
4489
- }
4490
- if (this.mask) {
4491
- ctx.beginPath();
4492
- var p = tr(this.mask[0]);
4493
- ctx.moveTo(p[0], p[1]);
4494
- for (var i = 1; i < this.mask.length; i++) {
4495
- p = tr(this.mask[i]);
4496
- ctx.lineTo(p[0], p[1]);
4497
- }
4498
- ctx.clip();
4499
- }
4500
- var pixel = tr(this.center);
4501
- var dx = (this._image.naturalWidth / 2 - this.crop[0]) * this.scale[0] / resolution * pixelRatio;
4502
- var dy = (this._image.naturalHeight / 2 - this.crop[1]) * this.scale[1] / resolution * pixelRatio;
4503
- var sx = this._imageSize[0] * this.scale[0] / resolution * pixelRatio;
4504
- var sy = this._imageSize[1] * this.scale[1] / resolution * pixelRatio;
4505
- ctx.translate(pixel[0], pixel[1]);
4506
- if (this.rotate)
4507
- ctx.rotate(this.rotate);
4508
- ctx.drawImage(this._image, this.crop[0], this.crop[1], this._imageSize[0], this._imageSize[1], -dx, -dy, sx, sy);
4509
- return canvas;
4510
- };
4511
- ol_source_GeoImage.prototype.getCenter = function() {
4512
- return this.center;
4513
- };
4514
- ol_source_GeoImage.prototype.setCenter = function(center) {
4515
- this.center = center;
4516
- this.changed();
4517
- };
4518
- ol_source_GeoImage.prototype.getScale = function() {
4519
- return this.scale;
4520
- };
4521
- ol_source_GeoImage.prototype.setScale = function(scale) {
4522
- switch (typeof scale) {
4523
- case "number":
4524
- scale = [scale, scale];
4525
- break;
4526
- case "object":
4527
- if (scale.length != 2)
4528
- return;
4529
- break;
4530
- default:
4531
- return;
4532
- }
4533
- this.scale = scale;
4534
- this.changed();
4535
- };
4536
- ol_source_GeoImage.prototype.getRotation = function() {
4537
- return this.rotate;
4538
- };
4539
- ol_source_GeoImage.prototype.setRotation = function(angle) {
4540
- this.rotate = angle;
4541
- this.changed();
4542
- };
4543
- ol_source_GeoImage.prototype.getGeoImage = function() {
4544
- return this._image;
4545
- };
4546
- ol_source_GeoImage.prototype.getCrop = function() {
4547
- return this.crop;
4548
- };
4549
- ol_source_GeoImage.prototype.setMask = function(mask) {
4550
- this.mask = mask;
4551
- this.changed();
4552
- };
4553
- ol_source_GeoImage.prototype.getMask = function() {
4554
- return this.mask;
4555
- };
4556
- ol_source_GeoImage.prototype.setCrop = function(crop) {
4557
- if (!this._image.naturalWidth) {
4558
- this.crop = crop;
4559
- return;
4560
- }
4561
- if (crop) {
4562
- switch (typeof crop) {
4563
- case "number":
4564
- crop = [crop, crop, this._image.naturalWidth - crop, this._image.naturalHeight - crop];
4565
- break;
4566
- case "object":
4567
- if (crop.length != 4)
4568
- return;
4569
- break;
4570
- default:
4571
- return;
4572
- }
4573
- crop = boundingExtent([[crop[0], crop[1]], [crop[2], crop[3]]]);
4574
- this.crop = [Math.max(0, crop[0]), Math.max(0, crop[1]), Math.min(this._image.naturalWidth, crop[2]), Math.min(this._image.naturalHeight, crop[3])];
4575
- } else
4576
- this.crop = [0, 0, this._image.naturalWidth, this._image.naturalHeight];
4577
- if (this.crop[2] <= this.crop[0])
4578
- this.crop[2] = this.crop[0] + 1;
4579
- if (this.crop[3] <= this.crop[1])
4580
- this.crop[3] = this.crop[1] + 1;
4581
- this._imageSize = [this.crop[2] - this.crop[0], this.crop[3] - this.crop[1]];
4582
- this.changed();
4583
- };
4584
- ol_source_GeoImage.prototype.getExtent = function(opt_extent) {
4585
- var ext = this.get("extent");
4586
- if (!ext)
4587
- ext = this.calculateExtent();
4588
- if (opt_extent) {
4589
- for (var i = 0; i < opt_extent.length; i++) {
4590
- opt_extent[i] = ext[i];
4591
- }
4592
- }
4593
- return ext;
4594
- };
4595
- ol_source_GeoImage.prototype.calculateExtent = function(usemask) {
4596
- var polygon;
4597
- if (usemask !== false && this.getMask()) {
4598
- polygon = new ol_geom_Polygon([this.getMask()]);
4599
- } else {
4600
- var center = this.getCenter();
4601
- var scale = this.getScale();
4602
- var width = this.getGeoImage().width * scale[0];
4603
- var height = this.getGeoImage().height * scale[1];
4604
- var extent = boundingExtent([
4605
- [center[0] - width / 2, center[1] - height / 2],
4606
- [center[0] + width / 2, center[1] + height / 2]
4607
- ]);
4608
- polygon = fromExtent(extent);
4609
- polygon.rotate(-this.getRotation(), center);
4610
- }
4611
- var ext = polygon.getExtent();
4612
- return ext;
4613
- };
4614
- export { ol_source_DayNight as A, ol_graph_Dijskra as B, ol_source_GeoImage as C, ol_layer_GeoImage as D, ol_filter_Mask as a, ol_filter_PencilSketch as b, ol_filter_Colorize as c, ol_filter_CanvasFilter as d, ol_ext_SVGOperation as e, ol_ext_SVGFilter as f, ol_control_Swipe as g, ol_interaction_Transform as h, ol_layer_AnimatedCluster as i, ol_interaction_SelectCluster as j, convexHull as k, ol_ordering as l, ol_style_Photo as m, ol_style_StrokePattern as n, ol_style_FillPattern as o, ol_featureAnimation_Path as p, ol_featureAnimation_Zoom as q, ol_featureAnimation_Bounce as r, ol_featureAnimation_Throw as s, ol_featureAnimation_Teleport as t, ol_featureAnimation_Slide as u, ol_featureAnimation_Show as v, ol_featureAnimation_Shake as w, ol_featureAnimation_Fade as x, ol_featureAnimation_Drop as y, ol_featureAnimation_Blink as z };