From 0463ff874eab1c484b593e8c02f73c85a02c000c Mon Sep 17 00:00:00 2001 From: thinkinggis Date: Wed, 6 Nov 2019 11:57:42 +0800 Subject: [PATCH] feat(add l7 site): add websites --- .cache/.eslintrc.json | 9 + .cache/__tests__/.babelrc | 5 + .../__snapshots__/dev-loader.js.snap | 16 + .cache/__tests__/__snapshots__/loader.js.snap | 16 + .../__snapshots__/static-entry.js.snap | 13 + .cache/__tests__/dev-loader.js | 539 + .cache/__tests__/error-overlay-handler.js | 59 + .cache/__tests__/find-path.js | 109 + .cache/__tests__/loader.js | 554 + .cache/__tests__/minimal-config.js | 32 + .cache/__tests__/static-entry.js | 330 + .cache/__tests__/strip-prefix.js | 23 + .cache/api-runner-browser-plugins.js | 28 + .cache/api-runner-browser.js | 61 + .cache/api-runner-ssr.js | 58 + .cache/api-ssr-docs.js | 198 + .cache/app.js | 72 + .cache/async-requires.js | 13 + .cache/babelState.json | 100 + ...tore-03f70e3c5a52291e52b331e3d35900a4.json | 1 + ...tore-1ea0cd3c8f491f1774b8edd1ce38b1f9.json | 1 + ...tore-20649dc8fd4cdde49b1d9ea0c26371b2.json | 1 + ...tore-2b8cd1df4f8a6941bff4108301b5d6a9.json | 1 + ...tore-2c713f7ba9a30ac45cbadf6d86d5d544.json | 1 + ...tore-2e9a5d11bfbd9e331e877b0e013a0ab8.json | 1 + ...tore-335fc52df6558698584a4c58a93133dc.json | 1 + ...tore-34caa57442541fb555e65adf766c9dbf.json | 1 + ...tore-468b5bae8ef758f28811323986a026ca.json | 1 + ...tore-479f7412bfaf2ad395f176418584631a.json | 1 + ...tore-4959c881d2fccc57dea5cba657223041.json | 1 + ...tore-51d0f3b693c1d063f395570395293fb4.json | 1 + ...tore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json | 1 + ...tore-5aa0c32748bae2a74e08828fed4fd3a6.json | 1 + ...tore-5ce457da6f1384d2d0a1c8d65aa7035f.json | 1 + ...tore-60ffaa0253ce67428f5a7e31a4a0bad1.json | 1 + ...tore-6195db1b342fb1235a247e18694e1cc8.json | 1 + ...tore-61c1d71d82d9e8cb724bc675e994ee07.json | 1 + ...tore-8152d0a6832522eb79f34eecc5e89cd4.json | 1 + ...tore-8a657829abac5ed5e9e205e519d6ded0.json | 1 + ...tore-8c6f6648e48a1e25d0879cba52c6f15c.json | 1 + ...tore-9429c44d730cc08b4b28804d3d7d5a2c.json | 1 + ...tore-a7725b15bd64a40f9d4d5eb35340b314.json | 1 + ...tore-b0407a444ef8acb3f4819a2fd00c5ae3.json | 1 + ...tore-b089023713dde4294665d832c48ccd63.json | 1 + ...tore-b923ecb39dc7dd6f4752bf9bbf5c94da.json | 1 + ...tore-bee012580db1a2e5f57e03421caf971f.json | 1 + ...tore-ca2fb97dfd9c7f243ca223efc08ffba5.json | 1 + ...tore-d2b3f82b0a8e66040aa810a8958afe0d.json | 1 + ...tore-dc1901f7f1baf243df1556f52717b2ba.json | 1 + ...tore-ddc1db31dfe2bcb6d2040bce323f5828.json | 1 + ...tore-df75817e83ad0a2f79b98ce42e6056a8.json | 1 + ...tore-e49d5822f90847d686ab7ed05c412e0b.json | 1 + ...tore-e72135977ad05cc3007997a59f58e7ed.json | 1 + ...tore-ec259f9adac459854ebecf9375d97a8d.json | 1 + ...tore-fb18e835921f3dc32ae5b74bdfb36220.json | 1 + ...tore-fbddf0de549e59cfa8bf242898a85984.json | 1 + ...tore-fffb15ec8285c18963c880046e7fccce.json | 1 + .cache/commonjs/api-runner-browser-plugins.js | 15 + .cache/commonjs/api-runner-browser.js | 61 + .cache/commonjs/api-runner-ssr.js | 48 + .cache/commonjs/api-ssr-docs.js | 200 + .cache/commonjs/app.js | 69 + .cache/commonjs/create-react-context.js | 11 + .cache/commonjs/default-html.js | 40 + .cache/commonjs/dev-loader.js | 41 + .cache/commonjs/develop-static-entry.js | 135 + .cache/commonjs/emitter.js | 12 + .cache/commonjs/ensure-resources.js | 94 + .cache/commonjs/error-overlay-handler.js | 67 + .cache/commonjs/find-path.js | 111 + .cache/commonjs/gatsby-browser-entry.js | 90 + .cache/commonjs/json-store.js | 93 + .cache/commonjs/loader.js | 434 + .cache/commonjs/navigation.js | 233 + .cache/commonjs/normalize-page-path.js | 22 + .cache/commonjs/page-renderer.js | 53 + .cache/commonjs/prefetch.js | 76 + .cache/commonjs/production-app.js | 139 + .cache/commonjs/public-page-renderer-dev.js | 33 + .cache/commonjs/public-page-renderer-prod.js | 34 + .cache/commonjs/public-page-renderer.js | 11 + .cache/commonjs/react-lifecycles-compat.js | 3 + .cache/commonjs/register-service-worker.js | 66 + .cache/commonjs/root.js | 131 + .cache/commonjs/socketIo.js | 122 + .cache/commonjs/static-entry.js | 406 + .cache/commonjs/strip-prefix.js | 15 + .cache/create-react-context.js | 3 + .cache/default-html.js | 39 + .cache/dev-404-page.js | 145 + .cache/dev-loader.js | 39 + .cache/develop-static-entry.js | 119 + .cache/emitter.js | 4 + .cache/ensure-resources.js | 81 + .cache/error-overlay-handler.js | 65 + .cache/find-path.js | 93 + .cache/fragments/image-sharp-fragments.js | 321 + .cache/gatsby-browser-entry.js | 102 + .cache/json-store.js | 99 + .cache/loader.js | 418 + .cache/match-paths.json | 1 + .cache/navigation.js | 197 + .cache/normalize-page-path.js | 12 + .cache/page-renderer.js | 46 + .cache/pages.json | 1 + .cache/prefetch.js | 76 + .cache/production-app.js | 163 + .cache/public-page-renderer-dev.js | 21 + .cache/public-page-renderer-prod.js | 23 + .cache/public-page-renderer.js | 9 + .cache/react-lifecycles-compat.js | 1 + .cache/redirects.json | 26 + .cache/redux.state | Bin 0 -> 222932 bytes .cache/register-service-worker.js | 64 + .cache/root.js | 133 + .cache/socketIo.js | 111 + .cache/static-entry.js | 435 + .cache/strip-prefix.js | 9 + .cache/sync-requires.js | 16 + .cache/test-require-error.js | 21 + .eslintrc | 5 + .gitignore | 1 + .npmrc | 4 + README.md | 9 +- babel.config.js | 18 +- dev-docs/TAA.md | 4 +- docs/API/L7.md | 6 + docs/API/Scene.md | 321 + docs/API/component/control.md | 137 + docs/API/component/marker.md | 83 + docs/API/component/popup.md | 92 + docs/manual/tutorial/data.md | 65 + docs/manual/tutorial/quickStart.md | 8 + docs/specification/introduction.md | 7 + examples/point/basic/data.json | 351 + examples/point/basic/demo/color.js | 58 + examples/point/basic/demo/meta.json | 13 + examples/point/basic/demo/point.js | 40 + examples/point/basic/index.zh.md | 11 + examples/scene/demo/amap.js | 12 + examples/scene/demo/mapbox.js | 11 + examples/scene/demo/meta.json | 18 + examples/scene/index.zh.md | 8 + gatsby-browser.js | 2 + gatsby-config.js | 99 + package-lock.json | 36843 ++++++++++------ package.json | 14 + packages/core/src/inversify.config.ts | 4 +- .../core/src/services/layer/LayerService.ts | 7 + .../src/services/renderer/passes/TAAPass.ts | 2 +- .../core/src/services/scene/SceneService.ts | 7 +- .../src/shaders/post-processing/blend.glsl | 6 +- packages/core/src/shaders/projection.glsl | 12 +- packages/layers/src/core/BaseLayer.ts | 10 + packages/layers/src/heatmap/grid.ts | 2 +- packages/layers/src/heatmap/heatmap.ts | 21 +- .../src/heatmap/shaders/heatmap_3d_frag.glsl | 5 +- .../src/heatmap/shaders/heatmap_3d_vert.glsl | 42 +- .../src/heatmap/shaders/heatmap_frag.glsl | 4 +- .../src/heatmap/shaders/hexagon_frag.glsl | 4 +- packages/layers/src/line/arc.ts | 2 +- packages/layers/src/line/arc2d.ts | 2 +- packages/layers/src/line/index.ts | 2 +- .../src/line/shaders/line_arc_frag.glsl | 4 +- packages/layers/src/point/extrude.ts | 2 +- packages/layers/src/point/image.ts | 2 +- packages/layers/src/point/index.ts | 22 +- .../layers/src/point/shaders/circle_frag.glsl | 2 +- .../layers/src/point/shaders/circle_vert.glsl | 2 +- .../src/point/shaders/extrude_frag.glsl | 2 +- .../layers/src/point/shaders/text_frag.glsl | 4 +- packages/layers/src/point/text.ts | 2 +- packages/layers/src/polygon/index.ts | 2 +- packages/layers/src/polygon/polygon3D.ts | 2 +- .../polygon/shaders/polygon_extrude_frag.glsl | 4 +- .../src/polygon/shaders/polygon_frag.glsl | 6 +- packages/layers/src/raster/image.ts | 2 +- packages/layers/src/raster/raster.ts | 2 +- .../src/raster/shaders/raster_frag.glsl | 4 +- packages/maps/src/amap/index.ts | 18 +- packages/maps/src/amap/theme.ts | 6 + packages/maps/src/mapbox/index.ts | 16 +- packages/maps/src/mapbox/theme.ts | 6 + packages/renderer/src/regl/ReglModel.ts | 2 - packages/scene/src/index.ts | 9 +- site/locale.json | 0 site/pages/index.en.ts | 2 + site/pages/index.zh.ts | 5 + stories/Animation/components/Polygon.tsx | 2 +- stories/Layers/components/Point.tsx | 6 +- stories/Layers/components/heatMap.tsx | 7 +- stories/Layers/components/pointImage.tsx | 26 +- tslint.json | 3 + tslint.prod.json | 2 +- 194 files changed, 33635 insertions(+), 12942 deletions(-) create mode 100644 .cache/.eslintrc.json create mode 100644 .cache/__tests__/.babelrc create mode 100644 .cache/__tests__/__snapshots__/dev-loader.js.snap create mode 100644 .cache/__tests__/__snapshots__/loader.js.snap create mode 100644 .cache/__tests__/__snapshots__/static-entry.js.snap create mode 100644 .cache/__tests__/dev-loader.js create mode 100644 .cache/__tests__/error-overlay-handler.js create mode 100644 .cache/__tests__/find-path.js create mode 100644 .cache/__tests__/loader.js create mode 100644 .cache/__tests__/minimal-config.js create mode 100644 .cache/__tests__/static-entry.js create mode 100644 .cache/__tests__/strip-prefix.js create mode 100644 .cache/api-runner-browser-plugins.js create mode 100644 .cache/api-runner-browser.js create mode 100644 .cache/api-runner-ssr.js create mode 100644 .cache/api-ssr-docs.js create mode 100644 .cache/app.js create mode 100644 .cache/async-requires.js create mode 100644 .cache/babelState.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-03f70e3c5a52291e52b331e3d35900a4.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-1ea0cd3c8f491f1774b8edd1ce38b1f9.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-20649dc8fd4cdde49b1d9ea0c26371b2.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-2b8cd1df4f8a6941bff4108301b5d6a9.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-2c713f7ba9a30ac45cbadf6d86d5d544.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-2e9a5d11bfbd9e331e877b0e013a0ab8.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-335fc52df6558698584a4c58a93133dc.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-34caa57442541fb555e65adf766c9dbf.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-468b5bae8ef758f28811323986a026ca.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-479f7412bfaf2ad395f176418584631a.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-4959c881d2fccc57dea5cba657223041.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-51d0f3b693c1d063f395570395293fb4.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-5aa0c32748bae2a74e08828fed4fd3a6.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-5ce457da6f1384d2d0a1c8d65aa7035f.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-60ffaa0253ce67428f5a7e31a4a0bad1.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-6195db1b342fb1235a247e18694e1cc8.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-61c1d71d82d9e8cb724bc675e994ee07.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-8152d0a6832522eb79f34eecc5e89cd4.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-8a657829abac5ed5e9e205e519d6ded0.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-8c6f6648e48a1e25d0879cba52c6f15c.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-9429c44d730cc08b4b28804d3d7d5a2c.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-a7725b15bd64a40f9d4d5eb35340b314.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-b0407a444ef8acb3f4819a2fd00c5ae3.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-b089023713dde4294665d832c48ccd63.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-b923ecb39dc7dd6f4752bf9bbf5c94da.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-bee012580db1a2e5f57e03421caf971f.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-d2b3f82b0a8e66040aa810a8958afe0d.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-dc1901f7f1baf243df1556f52717b2ba.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-ddc1db31dfe2bcb6d2040bce323f5828.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-df75817e83ad0a2f79b98ce42e6056a8.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-e49d5822f90847d686ab7ed05c412e0b.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-e72135977ad05cc3007997a59f58e7ed.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-ec259f9adac459854ebecf9375d97a8d.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-fb18e835921f3dc32ae5b74bdfb36220.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-fbddf0de549e59cfa8bf242898a85984.json create mode 100644 .cache/caches/gatsby-transformer-remark/diskstore-fffb15ec8285c18963c880046e7fccce.json create mode 100644 .cache/commonjs/api-runner-browser-plugins.js create mode 100644 .cache/commonjs/api-runner-browser.js create mode 100644 .cache/commonjs/api-runner-ssr.js create mode 100644 .cache/commonjs/api-ssr-docs.js create mode 100644 .cache/commonjs/app.js create mode 100644 .cache/commonjs/create-react-context.js create mode 100644 .cache/commonjs/default-html.js create mode 100644 .cache/commonjs/dev-loader.js create mode 100644 .cache/commonjs/develop-static-entry.js create mode 100644 .cache/commonjs/emitter.js create mode 100644 .cache/commonjs/ensure-resources.js create mode 100644 .cache/commonjs/error-overlay-handler.js create mode 100644 .cache/commonjs/find-path.js create mode 100644 .cache/commonjs/gatsby-browser-entry.js create mode 100644 .cache/commonjs/json-store.js create mode 100644 .cache/commonjs/loader.js create mode 100644 .cache/commonjs/navigation.js create mode 100644 .cache/commonjs/normalize-page-path.js create mode 100644 .cache/commonjs/page-renderer.js create mode 100644 .cache/commonjs/prefetch.js create mode 100644 .cache/commonjs/production-app.js create mode 100644 .cache/commonjs/public-page-renderer-dev.js create mode 100644 .cache/commonjs/public-page-renderer-prod.js create mode 100644 .cache/commonjs/public-page-renderer.js create mode 100644 .cache/commonjs/react-lifecycles-compat.js create mode 100644 .cache/commonjs/register-service-worker.js create mode 100644 .cache/commonjs/root.js create mode 100644 .cache/commonjs/socketIo.js create mode 100644 .cache/commonjs/static-entry.js create mode 100644 .cache/commonjs/strip-prefix.js create mode 100644 .cache/create-react-context.js create mode 100644 .cache/default-html.js create mode 100644 .cache/dev-404-page.js create mode 100644 .cache/dev-loader.js create mode 100644 .cache/develop-static-entry.js create mode 100644 .cache/emitter.js create mode 100644 .cache/ensure-resources.js create mode 100644 .cache/error-overlay-handler.js create mode 100644 .cache/find-path.js create mode 100644 .cache/fragments/image-sharp-fragments.js create mode 100644 .cache/gatsby-browser-entry.js create mode 100644 .cache/json-store.js create mode 100644 .cache/loader.js create mode 100644 .cache/match-paths.json create mode 100644 .cache/navigation.js create mode 100644 .cache/normalize-page-path.js create mode 100644 .cache/page-renderer.js create mode 100644 .cache/pages.json create mode 100644 .cache/prefetch.js create mode 100644 .cache/production-app.js create mode 100644 .cache/public-page-renderer-dev.js create mode 100644 .cache/public-page-renderer-prod.js create mode 100644 .cache/public-page-renderer.js create mode 100644 .cache/react-lifecycles-compat.js create mode 100644 .cache/redirects.json create mode 100644 .cache/redux.state create mode 100644 .cache/register-service-worker.js create mode 100644 .cache/root.js create mode 100644 .cache/socketIo.js create mode 100644 .cache/static-entry.js create mode 100644 .cache/strip-prefix.js create mode 100644 .cache/sync-requires.js create mode 100644 .cache/test-require-error.js create mode 100755 .eslintrc create mode 100644 .npmrc create mode 100644 docs/API/L7.md create mode 100644 docs/API/Scene.md create mode 100644 docs/API/component/control.md create mode 100644 docs/API/component/marker.md create mode 100644 docs/API/component/popup.md create mode 100644 docs/manual/tutorial/data.md create mode 100644 docs/manual/tutorial/quickStart.md create mode 100644 docs/specification/introduction.md create mode 100644 examples/point/basic/data.json create mode 100644 examples/point/basic/demo/color.js create mode 100644 examples/point/basic/demo/meta.json create mode 100644 examples/point/basic/demo/point.js create mode 100644 examples/point/basic/index.zh.md create mode 100644 examples/scene/demo/amap.js create mode 100644 examples/scene/demo/mapbox.js create mode 100644 examples/scene/demo/meta.json create mode 100644 examples/scene/index.zh.md create mode 100644 gatsby-browser.js create mode 100644 gatsby-config.js create mode 100644 packages/maps/src/amap/theme.ts create mode 100644 packages/maps/src/mapbox/theme.ts create mode 100644 site/locale.json create mode 100644 site/pages/index.en.ts create mode 100644 site/pages/index.zh.ts diff --git a/.cache/.eslintrc.json b/.cache/.eslintrc.json new file mode 100644 index 0000000000..9352bcdc0d --- /dev/null +++ b/.cache/.eslintrc.json @@ -0,0 +1,9 @@ +{ + "env": { + "browser": true + }, + "globals": { + "__PATH_PREFIX__": false, + "___emitter": false + } +} \ No newline at end of file diff --git a/.cache/__tests__/.babelrc b/.cache/__tests__/.babelrc new file mode 100644 index 0000000000..b1ff77b727 --- /dev/null +++ b/.cache/__tests__/.babelrc @@ -0,0 +1,5 @@ +{ + "presets": [ + ["babel-preset-gatsby"] + ] +} diff --git a/.cache/__tests__/__snapshots__/dev-loader.js.snap b/.cache/__tests__/__snapshots__/dev-loader.js.snap new file mode 100644 index 0000000000..f43ae2fb75 --- /dev/null +++ b/.cache/__tests__/__snapshots__/dev-loader.js.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Dev loader loadPage should be successful when component can be loaded 1`] = ` +Object { + "component": "instance", + "json": Object { + "pageContext": "something something", + }, + "page": Object { + "componentChunkName": "chunk", + "matchPath": undefined, + "path": "/mypage/", + "webpackCompilationHash": "", + }, +} +`; diff --git a/.cache/__tests__/__snapshots__/loader.js.snap b/.cache/__tests__/__snapshots__/loader.js.snap new file mode 100644 index 0000000000..2a10f26f4f --- /dev/null +++ b/.cache/__tests__/__snapshots__/loader.js.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Production loader loadPage should be successful when component can be loaded 1`] = ` +Object { + "component": "instance", + "json": Object { + "pageContext": "something something", + }, + "page": Object { + "componentChunkName": "chunk", + "matchPath": undefined, + "path": "/mypage/", + "webpackCompilationHash": "", + }, +} +`; diff --git a/.cache/__tests__/__snapshots__/static-entry.js.snap b/.cache/__tests__/__snapshots__/static-entry.js.snap new file mode 100644 index 0000000000..ad583044ea --- /dev/null +++ b/.cache/__tests__/__snapshots__/static-entry.js.snap @@ -0,0 +1,13 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`develop-static-entry onPreRenderHTML can be used to replace headComponents 1`] = `"
"`; + +exports[`develop-static-entry onPreRenderHTML can be used to replace postBodyComponents 1`] = `"
div3
div2
div1
"`; + +exports[`develop-static-entry onPreRenderHTML can be used to replace preBodyComponents 1`] = `"
div3
div2
div1
"`; + +exports[`static-entry onPreRenderHTML can be used to replace headComponents 1`] = `"
"`; + +exports[`static-entry onPreRenderHTML can be used to replace postBodyComponents 1`] = `"
div3
div2
div1
"`; + +exports[`static-entry onPreRenderHTML can be used to replace preBodyComponents 1`] = `"
div3
div2
div1
"`; diff --git a/.cache/__tests__/dev-loader.js b/.cache/__tests__/dev-loader.js new file mode 100644 index 0000000000..ead077fcb8 --- /dev/null +++ b/.cache/__tests__/dev-loader.js @@ -0,0 +1,539 @@ +// This is by no means a full test file for loader.js so feel free to add more tests. +import mock from "xhr-mock" +import DevLoader from "../dev-loader" +import emitter from "../emitter" + +jest.mock(`../emitter`) +jest.mock(`../socketIo`, () => { + return { + default: jest.fn(), + getPageData: jest.fn().mockResolvedValue(), + } +}) + +describe(`Dev loader`, () => { + describe(`loadPageDataJson`, () => { + let originalBasePath + let originalPathPrefix + let xhrCount + + /** + * @param {string} path + * @param {number} status + * @param {string|Object?} responseText + * @param {boolean?} json + */ + const mockPageData = (path, status, responseText = ``, json = false) => { + mock.get(`/page-data${path}/page-data.json`, (req, res) => { + xhrCount++ + if (json) { + res.header(`content-type`, `application/json`) + } + + return res + .status(status) + .body( + typeof responseText === `string` + ? responseText + : JSON.stringify(responseText) + ) + }) + } + + const defaultPayload = { + path: `/mypage/`, + } + + // replace the real XHR object with the mock XHR object before each test + beforeEach(() => { + originalBasePath = global.__BASE_PATH__ + originalPathPrefix = global.__PATH_PREFIX__ + global.__BASE_PATH__ = `` + global.__PATH_PREFIX__ = `` + xhrCount = 0 + mock.setup() + }) + + // put the real XHR object back and clear the mocks after each test + afterEach(() => { + global.__BASE_PATH__ = originalBasePath + global.__PATH_PREFIX__ = originalPathPrefix + mock.teardown() + }) + + it(`should return a pageData json on success`, async () => { + const devLoader = new DevLoader(null, []) + + mockPageData(`/mypage`, 200, defaultPayload, true) + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + } + expect(await devLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation) + expect(devLoader.pageDataDb.get(`/mypage`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should return a pageData json on success without contentType`, async () => { + const devLoader = new DevLoader(null, []) + + mockPageData(`/mypage`, 200, defaultPayload) + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + } + expect(await devLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation) + expect(devLoader.pageDataDb.get(`/mypage`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should return a pageData json with an empty compilation hash (gatsby develop)`, async () => { + const devLoader = new DevLoader(null, []) + + const payload = { ...defaultPayload, webpackCompilationHash: `` } + mockPageData(`/mypage`, 200, payload) + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload, + } + expect(await devLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation) + expect(devLoader.pageDataDb.get(`/mypage`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should load a 404 page when page-path file is not a gatsby json`, async () => { + const devLoader = new DevLoader(null, []) + + const payload = { ...defaultPayload, path: `/404.html/` } + mockPageData(`/unknown-page`, 200, { random: `string` }, true) + mockPageData(`/404.html`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + } + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should load a 404 page when page-path file is not a json`, async () => { + const devLoader = new DevLoader(null, []) + + const payload = { ...defaultPayload, path: `/404.html/` } + mockPageData(`/unknown-page`, 200) + mockPageData(`/404.html`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + } + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should load a 404 page when path returns a 404`, async () => { + const devLoader = new DevLoader(null, []) + + const payload = { ...defaultPayload, path: `/404.html/` } + mockPageData(`/unknown-page`, 200) + mockPageData(`/404.html`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + } + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should return the dev-404-page when no 404 page can be found`, async () => { + const devLoader = new DevLoader(null, []) + + const payload = { ...defaultPayload, path: `/dev-404-page/` } + mockPageData(`/unknown-page`, 404) + mockPageData(`/404.html`, 404) + mockPageData(`/dev-404-page`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/dev-404-page`, + notFound: true, + payload, + } + expect(await devLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + + expect(devLoader.pageDataDb.get(`/unknown-page`)).toEqual({ + notFound: true, + pagePath: `/404.html`, + status: `failure`, + }) + expect(xhrCount).toBe(3) + }) + + it(`should return an error when status is 500`, async () => { + const devLoader = new DevLoader(null, []) + + mockPageData(`/error-page`, 500) + + const expectation = { + status: `error`, + pagePath: `/error-page`, + } + expect(await devLoader.loadPageDataJson(`/error-page/`)).toEqual( + expectation + ) + expect(devLoader.pageDataDb.get(`/error-page`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should retry 3 times before returning an error`, async () => { + const devLoader = new DevLoader(null, []) + + mockPageData(`/blocked-page`, 0) + + const expectation = { + status: `error`, + retries: 3, + pagePath: `/blocked-page`, + } + expect(await devLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation + ) + expect(devLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation) + expect(xhrCount).toBe(4) + }) + + it(`should recover if we get 1 failure`, async () => { + const devLoader = new DevLoader(null, []) + const payload = { + path: `/blocked-page/`, + } + + let xhrCount = 0 + mock.get(`/page-data/blocked-page/page-data.json`, (req, res) => { + if (xhrCount++ === 0) { + return res.status(0).body(``) + } else { + res.header(`content-type`, `application/json`) + return res.status(200).body(JSON.stringify(payload)) + } + }) + + const expectation = { + status: `success`, + retries: 1, + pagePath: `/blocked-page`, + payload, + } + expect(await devLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation + ) + expect(devLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`shouldn't load pageData multiple times`, async () => { + const devLoader = new DevLoader(null, []) + + mockPageData(`/mypage`, 200, defaultPayload, true) + + const expectation = await devLoader.loadPageDataJson(`/mypage/`) + expect(await devLoader.loadPageDataJson(`/mypage/`)).toBe(expectation) + expect(xhrCount).toBe(1) + }) + }) + + describe(`loadPage`, () => { + const createSyncRequires = components => { + return { + components, + } + } + + let originalPathPrefix + + beforeEach(() => { + originalPathPrefix = global.__PATH_PREFIX__ + global.__PATH_PREFIX__ = `` + mock.setup() + mock.get(`/app-data.json`, (req, res) => + res + .status(200) + .header(`content-type`, `application/json`) + .body( + JSON.stringify({ + webpackCompilationHash: `123`, + }) + ) + ) + emitter.emit.mockReset() + }) + + afterEach(() => { + global.__PATH_PREFIX__ = originalPathPrefix + mock.teardown() + }) + + it(`should be successful when component can be loaded`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }) + const devLoader = new DevLoader(syncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + result: { + pageContext: `something something`, + }, + } + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ) + + const expectation = await devLoader.loadPage(`/mypage/`) + expect(expectation).toMatchSnapshot() + expect(Object.keys(expectation)).toEqual([`component`, `json`, `page`]) + expect(devLoader.pageDb.get(`/mypage`)).toEqual( + expect.objectContaining({ + payload: expectation, + status: `success`, + }) + ) + expect(emitter.emit).toHaveBeenCalledTimes(1) + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation, + pageResources: expectation, + }) + }) + + it(`should set not found on finalResult`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }) + const devLoader = new DevLoader(syncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + } + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + notFound: true, + }) + ) + + await devLoader.loadPage(`/mypage/`) + const expectation = devLoader.pageDb.get(`/mypage`) + expect(expectation).toHaveProperty(`notFound`, true) + expect(emitter.emit).toHaveBeenCalledTimes(1) + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation.payload, + pageResources: expectation.payload, + }) + }) + + it(`should return an error when component cannot be loaded`, async () => { + const syncRequires = createSyncRequires({ + chunk: false, + }) + const devLoader = new DevLoader(syncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + } + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ) + + await devLoader.loadPage(`/mypage/`) + const expectation = devLoader.pageDb.get(`/mypage`) + expect(expectation).toHaveProperty(`status`, `error`) + expect(emitter.emit).toHaveBeenCalledTimes(0) + }) + + it(`should return an error pageData contains an error`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }) + const devLoader = new DevLoader(syncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + } + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `error`, + }) + ) + + expect(await devLoader.loadPage(`/mypage/`)).toEqual({ status: `error` }) + expect(devLoader.pageDb.size).toBe(0) + expect(emitter.emit).toHaveBeenCalledTimes(0) + }) + + it(`should throw an error when 404 cannot be fetched`, async () => { + const devLoader = new DevLoader(null, []) + + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + status: `failure`, + }) + ) + + try { + await devLoader.loadPage(`/404.html/`) + } catch (err) { + expect(err.message).toEqual( + expect.stringContaining(`404 page could not be found`) + ) + } + expect(devLoader.pageDb.size).toBe(0) + expect(emitter.emit).toHaveBeenCalledTimes(0) + }) + + it(`should cache the result of loadPage`, async () => { + const syncRequires = createSyncRequires({ + chunk: `instance`, + }) + const devLoader = new DevLoader(syncRequires, []) + devLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: { + componentChunkName: `chunk`, + }, + status: `success`, + }) + ) + + const expectation = await devLoader.loadPage(`/mypage/`) + expect(await devLoader.loadPage(`/mypage/`)).toBe(expectation) + expect(devLoader.loadPageDataJson).toHaveBeenCalledTimes(1) + }) + }) + + describe(`loadPageSync`, () => { + it(`returns page resources when already fetched`, () => { + const devLoader = new DevLoader(null, []) + + devLoader.pageDb.set(`/mypage`, { payload: true }) + expect(devLoader.loadPageSync(`/mypage/`)).toBe(true) + }) + + it(`returns page resources when already fetched`, () => { + const devLoader = new DevLoader(null, []) + + expect(devLoader.loadPageSync(`/mypage/`)).toBeUndefined() + }) + }) + + describe(`prefetch`, () => { + const flushPromises = () => new Promise(resolve => setImmediate(resolve)) + + it(`shouldn't prefetch when shouldPrefetch is false`, () => { + const devLoader = new DevLoader(null, []) + devLoader.shouldPrefetch = jest.fn(() => false) + devLoader.doPrefetch = jest.fn() + devLoader.apiRunner = jest.fn() + + expect(devLoader.prefetch(`/mypath/`)).toBe(false) + expect(devLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`) + expect(devLoader.apiRunner).not.toHaveBeenCalled() + expect(devLoader.doPrefetch).not.toHaveBeenCalled() + }) + + it(`should trigger custom prefetch logic when core is disabled`, () => { + const devLoader = new DevLoader(null, []) + devLoader.shouldPrefetch = jest.fn(() => true) + devLoader.doPrefetch = jest.fn() + devLoader.apiRunner = jest.fn() + devLoader.prefetchDisabled = true + + expect(devLoader.prefetch(`/mypath/`)).toBe(false) + expect(devLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`) + expect(devLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }) + expect(devLoader.doPrefetch).not.toHaveBeenCalled() + }) + + it(`should prefetch when not yet triggered`, async () => { + jest.useFakeTimers() + const devLoader = new DevLoader(null, []) + devLoader.shouldPrefetch = jest.fn(() => true) + devLoader.apiRunner = jest.fn() + devLoader.doPrefetch = jest.fn(() => Promise.resolve({})) + + expect(devLoader.prefetch(`/mypath/`)).toBe(true) + + // wait for doPrefetchPromise + await flushPromises() + + expect(devLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }) + expect(devLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + { + pathname: `/mypath/`, + } + ) + }) + + it(`should only run apis once`, async () => { + const devLoader = new DevLoader(null, []) + devLoader.shouldPrefetch = jest.fn(() => true) + devLoader.apiRunner = jest.fn() + devLoader.doPrefetch = jest.fn(() => Promise.resolve({})) + + expect(devLoader.prefetch(`/mypath/`)).toBe(true) + expect(devLoader.prefetch(`/mypath/`)).toBe(true) + + // wait for doPrefetchPromise + await flushPromises() + + expect(devLoader.apiRunner).toHaveBeenCalledTimes(2) + expect(devLoader.apiRunner).toHaveBeenNthCalledWith( + 1, + `onPrefetchPathname`, + expect.anything() + ) + expect(devLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + expect.anything() + ) + }) + }) +}) diff --git a/.cache/__tests__/error-overlay-handler.js b/.cache/__tests__/error-overlay-handler.js new file mode 100644 index 0000000000..088793742e --- /dev/null +++ b/.cache/__tests__/error-overlay-handler.js @@ -0,0 +1,59 @@ +import "@babel/polyfill" +const { + reportError, + clearError, + errorMap, +} = require(`../error-overlay-handler`) + +import * as ErrorOverlay from "react-error-overlay" + +jest.mock(`react-error-overlay`, () => { + return { + reportBuildError: jest.fn(), + dismissBuildError: jest.fn(), + startReportingRuntimeErrors: jest.fn(), + setEditorHandler: jest.fn(), + } +}) + +beforeEach(() => { + ErrorOverlay.reportBuildError.mockClear() + ErrorOverlay.dismissBuildError.mockClear() +}) + +describe(`errorOverlayHandler`, () => { + describe(`clearError()`, () => { + beforeEach(() => { + reportError(`foo`, `error`) + reportError(`bar`, `error`) + }) + afterAll(() => { + clearError(`foo`) + clearError(`bar`) + }) + it(`should clear specific error type`, () => { + expect(Object.keys(errorMap)).toHaveLength(2) + clearError(`foo`) + expect(Object.keys(errorMap)).toHaveLength(1) + expect(ErrorOverlay.dismissBuildError).not.toHaveBeenCalled() + }) + + it(`should call ErrorOverlay to dismiss build errors`, () => { + clearError(`foo`) + clearError(`bar`) + expect(ErrorOverlay.dismissBuildError).toHaveBeenCalled() + }) + }) + describe(`reportErrorOverlay()`, () => { + it(`should not add error if it's empty and not call ErrorOverlay`, () => { + reportError(`foo`, null) + expect(Object.keys(errorMap)).toHaveLength(0) + expect(ErrorOverlay.reportBuildError).not.toHaveBeenCalled() + }) + it(`should add error if it has a truthy value and call ErrorOverlay`, () => { + reportError(`foo`, `bar`) + expect(Object.keys(errorMap)).toHaveLength(1) + expect(ErrorOverlay.reportBuildError).toHaveBeenCalled() + }) + }) +}) diff --git a/.cache/__tests__/find-path.js b/.cache/__tests__/find-path.js new file mode 100644 index 0000000000..e8813aa1bd --- /dev/null +++ b/.cache/__tests__/find-path.js @@ -0,0 +1,109 @@ +import { cleanPath, setMatchPaths, findMatchPath, findPath } from "../find-path" + +describe(`find-path`, () => { + describe(`cleanPath`, () => { + beforeEach(() => { + global.__BASE_PATH__ = `` + }) + + it(`should strip out ? & # from a pathname`, () => { + expect(cleanPath(`/mypath#anchor?gatsby=cool`)).toBe(`/mypath`) + }) + + it(`should convert a /index.html to root dir`, () => { + expect(cleanPath(`/index.html`)).toBe(`/`) + }) + + it(`strip out a basePrefix`, () => { + global.__BASE_PATH__ = `/blog` + expect(cleanPath(`/blog/mypath`)).toBe(`/mypath`) + }) + }) + + describe(`findMatchPath`, () => { + beforeEach(() => { + // reset matchPaths + setMatchPaths([]) + global.__BASE_PATH__ = `` + }) + + it(`should find a path when matchPath found`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]) + + expect(findMatchPath(`/app/dynamic-page#anchor?gatsby=cool`)).toBe(`/app`) + }) + + it(`should return null when no matchPathFound`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]) + + expect(findMatchPath(`/notanapp/dynamic-page`)).toBeNull() + }) + }) + + describe(`findPath`, () => { + beforeEach(() => { + // reset matchPaths + setMatchPaths([]) + global.__BASE_PATH__ = `` + }) + + it(`should use matchPath if found`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]) + + expect(findPath(`/app/dynamic-page#anchor?gatsby=cool`)).toBe(`/app`) + }) + + it(`should return the cleaned up path when no matchPathFound`, () => { + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]) + + expect(findPath(`/notanapp/my-page#anchor?gatsby=cool`)).toBe( + `/notanapp/my-page` + ) + }) + + it(`should only process a request once`, () => { + jest.resetModules() + jest.mock(`@reach/router/lib/utils`) + const findPath = require(`../find-path`).findPath + const setMatchPaths = require(`../find-path`).setMatchPaths + const match = require(`@reach/router/lib/utils`).match + + setMatchPaths([ + { + matchPath: `/app/*`, + path: `/app`, + }, + ]) + + expect(findPath(`/notanapp/my-page#anchor?gatsby=cool`)).toBe( + `/notanapp/my-page` + ) + expect(findPath(`/notanapp/my-page#anchor?gatsby=cool`)).toBe( + `/notanapp/my-page` + ) + expect(findPath(`/notanapp/my-page`)).toBe(`/notanapp/my-page`) + + expect(match).toHaveBeenCalledTimes(1) + }) + }) +}) diff --git a/.cache/__tests__/loader.js b/.cache/__tests__/loader.js new file mode 100644 index 0000000000..cfba630c53 --- /dev/null +++ b/.cache/__tests__/loader.js @@ -0,0 +1,554 @@ +// This is by no means a full test file for loader.js so feel free to add more tests. +import mock from "xhr-mock" +import { ProdLoader } from "../loader" +import emitter from "../emitter" + +jest.mock(`../emitter`) + +describe(`Production loader`, () => { + describe(`loadPageDataJson`, () => { + let originalBasePath + let originalPathPrefix + let xhrCount + + /** + * @param {string} path + * @param {number} status + * @param {string|Object?} responseText + * @param {boolean?} json + */ + const mockPageData = (path, status, responseText = ``, json = false) => { + mock.get(`/page-data${path}/page-data.json`, (req, res) => { + xhrCount++ + if (json) { + res.header(`content-type`, `application/json`) + } + + return res + .status(status) + .body( + typeof responseText === `string` + ? responseText + : JSON.stringify(responseText) + ) + }) + } + + const defaultPayload = { + path: `/mypage/`, + } + + // replace the real XHR object with the mock XHR object before each test + beforeEach(() => { + originalBasePath = global.__BASE_PATH__ + originalPathPrefix = global.__PATH_PREFIX__ + global.__BASE_PATH__ = `` + global.__PATH_PREFIX__ = `` + xhrCount = 0 + mock.setup() + }) + + // put the real XHR object back and clear the mocks after each test + afterEach(() => { + global.__BASE_PATH__ = originalBasePath + global.__PATH_PREFIX__ = originalPathPrefix + mock.teardown() + }) + + it(`should return a pageData json on success`, async () => { + const prodLoader = new ProdLoader(null, []) + + mockPageData(`/mypage`, 200, defaultPayload, true) + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + } + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation) + expect(prodLoader.pageDataDb.get(`/mypage`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should return a pageData json on success without contentType`, async () => { + const prodLoader = new ProdLoader(null, []) + + mockPageData(`/mypage`, 200, defaultPayload) + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload: defaultPayload, + } + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation) + expect(prodLoader.pageDataDb.get(`/mypage`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should return a pageData json with an empty compilation hash (gatsby develop)`, async () => { + const prodLoader = new ProdLoader(null, []) + + const payload = { ...defaultPayload, webpackCompilationHash: `` } + mockPageData(`/mypage`, 200, payload) + + const expectation = { + status: `success`, + pagePath: `/mypage`, + payload, + } + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toEqual(expectation) + expect(prodLoader.pageDataDb.get(`/mypage`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should load a 404 page when page-path file is not a gatsby json`, async () => { + const prodLoader = new ProdLoader(null, []) + + const payload = { ...defaultPayload, path: `/404.html/` } + mockPageData(`/unknown-page`, 200, { random: `string` }, true) + mockPageData(`/404.html`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + } + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should load a 404 page when page-path file is not a json`, async () => { + const prodLoader = new ProdLoader(null, []) + + const payload = { ...defaultPayload, path: `/404.html/` } + mockPageData(`/unknown-page`, 200) + mockPageData(`/404.html`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + } + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should load a 404 page when path returns a 404`, async () => { + const prodLoader = new ProdLoader(null, []) + + const payload = { ...defaultPayload, path: `/404.html/` } + mockPageData(`/unknown-page`, 200) + mockPageData(`/404.html`, 200, payload, true) + + const expectation = { + status: `success`, + pagePath: `/404.html`, + notFound: true, + payload, + } + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should return a failure when status is 404 and 404 page is fetched`, async () => { + const prodLoader = new ProdLoader(null, []) + + mockPageData(`/unknown-page`, 404) + mockPageData(`/404.html`, 404) + + const expectation = { + status: `failure`, + pagePath: `/404.html`, + notFound: true, + } + expect(await prodLoader.loadPageDataJson(`/unknown-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/unknown-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`should return an error when status is 500`, async () => { + const prodLoader = new ProdLoader(null, []) + + mockPageData(`/error-page`, 500) + + const expectation = { + status: `error`, + pagePath: `/error-page`, + } + expect(await prodLoader.loadPageDataJson(`/error-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/error-page`)).toEqual(expectation) + expect(xhrCount).toBe(1) + }) + + it(`should retry 3 times before returning an error`, async () => { + const prodLoader = new ProdLoader(null, []) + + mockPageData(`/blocked-page`, 0) + + const expectation = { + status: `error`, + retries: 3, + pagePath: `/blocked-page`, + } + expect(await prodLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation) + expect(xhrCount).toBe(4) + }) + + it(`should recover if we get 1 failure`, async () => { + const prodLoader = new ProdLoader(null, []) + const payload = { + path: `/blocked-page/`, + } + + let xhrCount = 0 + mock.get(`/page-data/blocked-page/page-data.json`, (req, res) => { + if (xhrCount++ === 0) { + return res.status(0).body(``) + } else { + res.header(`content-type`, `application/json`) + return res.status(200).body(JSON.stringify(payload)) + } + }) + + const expectation = { + status: `success`, + retries: 1, + pagePath: `/blocked-page`, + payload, + } + expect(await prodLoader.loadPageDataJson(`/blocked-page/`)).toEqual( + expectation + ) + expect(prodLoader.pageDataDb.get(`/blocked-page`)).toEqual(expectation) + expect(xhrCount).toBe(2) + }) + + it(`shouldn't load pageData multiple times`, async () => { + const prodLoader = new ProdLoader(null, []) + + mockPageData(`/mypage`, 200, defaultPayload, true) + + const expectation = await prodLoader.loadPageDataJson(`/mypage/`) + expect(await prodLoader.loadPageDataJson(`/mypage/`)).toBe(expectation) + expect(xhrCount).toBe(1) + }) + }) + + describe(`loadPage`, () => { + const createAsyncRequires = components => { + return { + components, + } + } + + let originalPathPrefix + + beforeEach(() => { + originalPathPrefix = global.__PATH_PREFIX__ + global.__PATH_PREFIX__ = `` + mock.setup() + mock.get(`/app-data.json`, (req, res) => + res + .status(200) + .header(`content-type`, `application/json`) + .body( + JSON.stringify({ + webpackCompilationHash: `123`, + }) + ) + ) + emitter.emit.mockReset() + }) + + afterEach(() => { + global.__PATH_PREFIX__ = originalPathPrefix + mock.teardown() + }) + + it(`should be successful when component can be loaded`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }) + const prodLoader = new ProdLoader(asyncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + result: { + pageContext: `something something`, + }, + } + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ) + + const expectation = await prodLoader.loadPage(`/mypage/`) + expect(expectation).toMatchSnapshot() + expect(Object.keys(expectation)).toEqual([`component`, `json`, `page`]) + expect(prodLoader.pageDb.get(`/mypage`)).toEqual( + expect.objectContaining({ + payload: expectation, + status: `success`, + }) + ) + expect(emitter.emit).toHaveBeenCalledTimes(1) + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation, + pageResources: expectation, + }) + }) + + it(`should set not found on finalResult`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }) + const prodLoader = new ProdLoader(asyncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + } + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + notFound: true, + }) + ) + + await prodLoader.loadPage(`/mypage/`) + const expectation = prodLoader.pageDb.get(`/mypage`) + expect(expectation).toHaveProperty(`notFound`, true) + expect(emitter.emit).toHaveBeenCalledTimes(1) + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation.payload, + pageResources: expectation.payload, + }) + }) + + it(`should return an error when component cannot be loaded`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(false), + }) + const prodLoader = new ProdLoader(asyncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + } + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `success`, + }) + ) + + await prodLoader.loadPage(`/mypage/`) + const expectation = prodLoader.pageDb.get(`/mypage`) + expect(expectation).toHaveProperty(`status`, `error`) + expect(emitter.emit).toHaveBeenCalledTimes(0) + }) + + it(`should return an error pageData contains an error`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }) + const prodLoader = new ProdLoader(asyncRequires, []) + const pageData = { + path: `/mypage/`, + componentChunkName: `chunk`, + } + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: pageData, + status: `error`, + }) + ) + + expect(await prodLoader.loadPage(`/mypage/`)).toEqual({ status: `error` }) + expect(prodLoader.pageDb.size).toBe(0) + expect(emitter.emit).toHaveBeenCalledTimes(0) + }) + + it(`should throw an error when 404 cannot be fetched`, async () => { + const prodLoader = new ProdLoader(null, []) + + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + status: `failure`, + }) + ) + + try { + await prodLoader.loadPage(`/404.html/`) + } catch (err) { + expect(err.message).toEqual( + expect.stringContaining(`404 page could not be found`) + ) + } + expect(prodLoader.pageDb.size).toBe(0) + expect(emitter.emit).toHaveBeenCalledTimes(0) + }) + + it(`should cache the result of loadPage`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }) + const prodLoader = new ProdLoader(asyncRequires, []) + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: { + componentChunkName: `chunk`, + }, + status: `success`, + }) + ) + + const expectation = await prodLoader.loadPage(`/mypage/`) + expect(await prodLoader.loadPage(`/mypage/`)).toBe(expectation) + expect(prodLoader.loadPageDataJson).toHaveBeenCalledTimes(1) + }) + + it(`should only run 1 network request even when called multiple times`, async () => { + const asyncRequires = createAsyncRequires({ + chunk: () => Promise.resolve(`instance`), + }) + const prodLoader = new ProdLoader(asyncRequires, []) + prodLoader.loadPageDataJson = jest.fn(() => + Promise.resolve({ + payload: { + componentChunkName: `chunk`, + }, + status: `success`, + }) + ) + + const loadPagePromise = prodLoader.loadPage(`/test-page/`) + expect(prodLoader.inFlightDb.size).toBe(1) + expect(prodLoader.loadPage(`/test-page/`)).toBe(loadPagePromise) + expect(prodLoader.inFlightDb.size).toBe(1) + + const expectation = await loadPagePromise + + expect(prodLoader.inFlightDb.size).toBe(0) + expect(emitter.emit).toHaveBeenCalledTimes(1) + expect(emitter.emit).toHaveBeenCalledWith(`onPostLoadPageResources`, { + page: expectation, + pageResources: expectation, + }) + }) + }) + + describe(`loadPageSync`, () => { + it(`returns page resources when already fetched`, () => { + const prodLoader = new ProdLoader(null, []) + + prodLoader.pageDb.set(`/mypage`, { payload: true }) + expect(prodLoader.loadPageSync(`/mypage/`)).toBe(true) + }) + + it(`returns page resources when already fetched`, () => { + const prodLoader = new ProdLoader(null, []) + + expect(prodLoader.loadPageSync(`/mypage/`)).toBeUndefined() + }) + }) + + describe(`prefetch`, () => { + const flushPromises = () => new Promise(resolve => setImmediate(resolve)) + + it(`shouldn't prefetch when shouldPrefetch is false`, () => { + const prodLoader = new ProdLoader(null, []) + prodLoader.shouldPrefetch = jest.fn(() => false) + prodLoader.doPrefetch = jest.fn() + prodLoader.apiRunner = jest.fn() + + expect(prodLoader.prefetch(`/mypath/`)).toBe(false) + expect(prodLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`) + expect(prodLoader.apiRunner).not.toHaveBeenCalled() + expect(prodLoader.doPrefetch).not.toHaveBeenCalled() + }) + + it(`should trigger custom prefetch logic when core is disabled`, () => { + const prodLoader = new ProdLoader(null, []) + prodLoader.shouldPrefetch = jest.fn(() => true) + prodLoader.doPrefetch = jest.fn() + prodLoader.apiRunner = jest.fn() + prodLoader.prefetchDisabled = true + + expect(prodLoader.prefetch(`/mypath/`)).toBe(false) + expect(prodLoader.shouldPrefetch).toHaveBeenCalledWith(`/mypath/`) + expect(prodLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }) + expect(prodLoader.doPrefetch).not.toHaveBeenCalled() + }) + + it(`should prefetch when not yet triggered`, async () => { + jest.useFakeTimers() + const prodLoader = new ProdLoader(null, []) + prodLoader.shouldPrefetch = jest.fn(() => true) + prodLoader.apiRunner = jest.fn() + prodLoader.doPrefetch = jest.fn(() => Promise.resolve({})) + + expect(prodLoader.prefetch(`/mypath/`)).toBe(true) + + // wait for doPrefetchPromise + await flushPromises() + + expect(prodLoader.apiRunner).toHaveBeenCalledWith(`onPrefetchPathname`, { + pathname: `/mypath/`, + }) + expect(prodLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + { + pathname: `/mypath/`, + } + ) + }) + + it(`should only run apis once`, async () => { + const prodLoader = new ProdLoader(null, []) + prodLoader.shouldPrefetch = jest.fn(() => true) + prodLoader.apiRunner = jest.fn() + prodLoader.doPrefetch = jest.fn(() => Promise.resolve({})) + + expect(prodLoader.prefetch(`/mypath/`)).toBe(true) + expect(prodLoader.prefetch(`/mypath/`)).toBe(true) + + // wait for doPrefetchPromise + await flushPromises() + + expect(prodLoader.apiRunner).toHaveBeenCalledTimes(2) + expect(prodLoader.apiRunner).toHaveBeenNthCalledWith( + 1, + `onPrefetchPathname`, + expect.anything() + ) + expect(prodLoader.apiRunner).toHaveBeenNthCalledWith( + 2, + `onPostPrefetchPathname`, + expect.anything() + ) + }) + }) +}) diff --git a/.cache/__tests__/minimal-config.js b/.cache/__tests__/minimal-config.js new file mode 100644 index 0000000000..ef2c4c9a90 --- /dev/null +++ b/.cache/__tests__/minimal-config.js @@ -0,0 +1,32 @@ +const path = require(`path`) +const child = require(`child_process`) + +it(`Builds cache-dir with minimal config`, done => { + const args = [ + require.resolve(`@babel/cli/bin/babel.js`), + path.join(__dirname, `..`), + `--config-file`, + path.join(__dirname, `.babelrc`), + `--ignore`, + `**/__tests__`, + ] + + const spawn = child.spawn(process.execPath, args) + + let stderr = `` + let stdout = `` + + spawn.stderr.on(`data`, function(chunk) { + stderr += chunk + }) + + spawn.stdout.on(`data`, function(chunk) { + stdout += chunk + }) + + spawn.on(`close`, function() { + expect(stderr).toEqual(``) + expect(stdout).not.toEqual(``) + done() + }) +}, 30000) diff --git a/.cache/__tests__/static-entry.js b/.cache/__tests__/static-entry.js new file mode 100644 index 0000000000..9149015bf2 --- /dev/null +++ b/.cache/__tests__/static-entry.js @@ -0,0 +1,330 @@ +import React from "react" +import fs from "fs" +const { join } = require(`path`) + +import DevelopStaticEntry from "../develop-static-entry" + +jest.mock(`fs`, () => { + const fs = jest.requireActual(`fs`) + return { + ...fs, + readFileSync: jest.fn(), + } +}) +jest.mock(`gatsby/package.json`, () => { + return { + version: `2.0.0`, + } +}) + +jest.mock( + `../sync-requires`, + () => { + return { + components: { + "page-component---src-pages-test-js": () => null, + }, + } + }, + { + virtual: true, + } +) + +const MOCK_FILE_INFO = { + [`${process.cwd()}/public/webpack.stats.json`]: `{}`, + [`${process.cwd()}/public/chunk-map.json`]: `{}`, + [join( + process.cwd(), + `/public/page-data/about/page-data.json` + )]: JSON.stringify({ + componentChunkName: `page-component---src-pages-test-js`, + path: `/about/`, + webpackCompilationHash: `1234567890abcdef1234`, + }), +} + +let StaticEntry +beforeEach(() => { + fs.readFileSync.mockImplementation(file => MOCK_FILE_INFO[file]) + StaticEntry = require(`../static-entry`).default +}) + +const reverseHeadersPlugin = { + plugin: { + onPreRenderHTML: ({ getHeadComponents, replaceHeadComponents }) => { + const headComponents = getHeadComponents() + headComponents.reverse() + replaceHeadComponents(headComponents) + }, + }, +} + +const injectValuePlugin = (hookName, methodName, value) => { + return { + plugin: { + [hookName]: staticEntry => { + const method = staticEntry[methodName] + method(value) + }, + }, + } +} + +const checkSanitized = components => { + expect(components.includes(null)).toBeFalsy() + expect( + components.find(val => Array.isArray(val) && val.length === 0) + ).toBeFalsy() + expect(components.find(val => Array.isArray(val))).toBeFalsy() +} + +const checkNonEmptyHeadersPlugin = { + plugin: { + onPreRenderHTML: ({ + getHeadComponents, + getPreBodyComponents, + getPostBodyComponents, + }) => { + const headComponents = getHeadComponents() + const preBodyComponents = getPreBodyComponents() + const postBodyComponents = getPostBodyComponents() + checkSanitized(headComponents) + checkSanitized(preBodyComponents) + checkSanitized(postBodyComponents) + }, + }, +} + +const fakeStylesPlugin = { + plugin: { + onRenderBody: ({ setHeadComponents }) => + setHeadComponents([ + , + , + , + ]), + }, +} + +const reverseBodyComponentsPluginFactory = type => { + return { + plugin: { + onPreRenderHTML: props => { + const components = props[`get${type}BodyComponents`]() + components.reverse() + props[`replace${type}BodyComponents`](components) + }, + }, + } +} + +const fakeComponentsPluginFactory = type => { + return { + plugin: { + onRenderBody: props => { + props[`set${type}BodyComponents`]([ +
div1
, +
div2
, +
div3
, + ]) + }, + }, + } +} + +describe(`develop-static-entry`, () => { + test(`onPreRenderHTML can be used to replace headComponents`, done => { + global.plugins = [fakeStylesPlugin, reverseHeadersPlugin] + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot() + done() + }) + }) + + test(`onPreRenderHTML can be used to replace postBodyComponents`, done => { + global.plugins = [ + fakeComponentsPluginFactory(`Post`), + reverseBodyComponentsPluginFactory(`Post`), + ] + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot() + done() + }) + }) + + test(`onPreRenderHTML can be used to replace preBodyComponents`, done => { + global.plugins = [ + fakeComponentsPluginFactory(`Pre`), + reverseBodyComponentsPluginFactory(`Pre`), + ] + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot() + done() + }) + }) + + test(`onPreRenderHTML adds metatag note for development environment`, done => { + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toContain( + `` + ) + done() + }) + }) + + test(`onPreRenderHTML adds metatag note for development environment after replaceHeadComponents`, done => { + global.plugins = [reverseHeadersPlugin] + + DevelopStaticEntry(`/about/`, (_, html) => { + expect(html).toContain( + `` + ) + done() + }) + }) +}) + +describe(`static-entry sanity checks`, () => { + beforeEach(() => { + global.__PATH_PREFIX__ = `` + global.__BASE_PATH__ = `` + global.__ASSET_PREFIX__ = `` + }) + + const methodsToCheck = [ + `replaceHeadComponents`, + `replacePreBodyComponents`, + `replacePostBodyComponents`, + ] + + methodsToCheck.forEach(methodName => { + test(`${methodName} can filter out null value`, done => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, null) + global.plugins = [plugin, checkNonEmptyHeadersPlugin] + + StaticEntry(`/about/`, (_, html) => { + done() + }) + }) + + test(`${methodName} can filter out null values`, done => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, [ + null, + null, + ]) + global.plugins = [plugin, checkNonEmptyHeadersPlugin] + + StaticEntry(`/about/`, (_, html) => { + done() + }) + }) + + test(`${methodName} can filter out empty array`, done => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, []) + global.plugins = [plugin, checkNonEmptyHeadersPlugin] + + StaticEntry(`/about/`, (_, html) => { + done() + }) + }) + + test(`${methodName} can filter out empty arrays`, done => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, [[], []]) + global.plugins = [plugin, checkNonEmptyHeadersPlugin] + + StaticEntry(`/about/`, (_, html) => { + done() + }) + }) + + test(`${methodName} can flatten arrays`, done => { + const plugin = injectValuePlugin(`onPreRenderHTML`, methodName, [ + , + , + , + [], + ]) + global.plugins = [plugin, checkNonEmptyHeadersPlugin] + + StaticEntry(`/about/`, (_, html) => { + done() + }) + }) + }) +}) + +describe(`static-entry`, () => { + beforeEach(() => { + global.__PATH_PREFIX__ = `` + global.__BASE_PATH__ = `` + }) + + test(`onPreRenderHTML can be used to replace headComponents`, done => { + global.plugins = [fakeStylesPlugin, reverseHeadersPlugin] + + StaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot() + done() + }) + }) + + test(`onPreRenderHTML can be used to replace postBodyComponents`, done => { + global.plugins = [ + fakeComponentsPluginFactory(`Post`), + reverseBodyComponentsPluginFactory(`Post`), + ] + + StaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot() + done() + }) + }) + + test(`onPreRenderHTML can be used to replace preBodyComponents`, done => { + global.plugins = [ + fakeComponentsPluginFactory(`Pre`), + reverseBodyComponentsPluginFactory(`Pre`), + ] + + StaticEntry(`/about/`, (_, html) => { + expect(html).toMatchSnapshot() + done() + }) + }) + + test(`onPreRenderHTML does not add metatag note for development environment`, done => { + StaticEntry(`/about/`, (_, html) => { + expect(html).not.toContain( + `` + ) + done() + }) + }) +}) + +describe(`sanitizeComponents`, () => { + let sanitizeComponents + + beforeEach(() => { + fs.readFileSync.mockImplementation(file => MOCK_FILE_INFO[file]) + sanitizeComponents = require(`../static-entry`).sanitizeComponents + }) + + it(`strips assetPrefix for manifest link`, () => { + global.__PATH_PREFIX__ = `https://gatsbyjs.org/blog` + global.__BASE_PATH__ = `/blog` + global.__ASSET_PREFIX__ = `https://gatsbyjs.org` + + const sanitizedComponents = sanitizeComponents([ + , + ]) + expect(sanitizedComponents[0].props.href).toBe(`/blog/manifest.webmanifest`) + }) +}) diff --git a/.cache/__tests__/strip-prefix.js b/.cache/__tests__/strip-prefix.js new file mode 100644 index 0000000000..78fc19be1d --- /dev/null +++ b/.cache/__tests__/strip-prefix.js @@ -0,0 +1,23 @@ +const stripPrefix = require(`../strip-prefix`).default + +describe(`strip-prefix`, () => { + it(`strips a prefix`, () => { + expect(stripPrefix(`/foo/bar/`, `/foo`)).toBe(`/bar/`) + }) + + it(`strips first instance only`, () => { + expect(stripPrefix(`/foo/foo/bar/`, `/foo`)).toBe(`/foo/bar/`) + }) + + it(`ignores prefix appearing elsewhere in the string`, () => { + expect(stripPrefix(`/foo/bar/`, `bar`)).toBe(`/foo/bar/`) + }) + + it(`ignores a non-existent prefix`, () => { + expect(stripPrefix(`/bar`, `/foo`)).toBe(`/bar`) + }) + + it(`returns input str if no prefix is provided`, () => { + expect(stripPrefix(`/bar`)).toBe(`/bar`) + }) +}) diff --git a/.cache/api-runner-browser-plugins.js b/.cache/api-runner-browser-plugins.js new file mode 100644 index 0000000000..7ad21e4a9a --- /dev/null +++ b/.cache/api-runner-browser-plugins.js @@ -0,0 +1,28 @@ +module.exports = [{ + plugin: require('../node_modules/gatsby-remark-autolink-headers/gatsby-browser.js'), + options: {"plugins":[]}, + },{ + plugin: require('../node_modules/gatsby-plugin-offline/gatsby-browser.js'), + options: {"plugins":[]}, + },{ + plugin: require('../node_modules/gatsby-plugin-manifest/gatsby-browser.js'), + options: {"plugins":[],"name":"gatsby-starter-default","short_name":"starter","start_url":"/","background_color":"#722ED1","theme_color":"#722ED1","display":"minimal-ui","icon":"/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/@antv/gatsby-theme-antv/site/images/favicon.png"}, + },{ + plugin: require('../node_modules/gatsby-plugin-catch-links/gatsby-browser.js'), + options: {"plugins":[]}, + },{ + plugin: require('../node_modules/gatsby-plugin-nprogress/gatsby-browser.js'), + options: {"plugins":[]}, + },{ + plugin: require('../node_modules/gatsby-plugin-layout/gatsby-browser.js'), + options: {"plugins":[],"component":"/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/@antv/gatsby-theme-antv/site/layouts/layout.tsx"}, + },{ + plugin: require('../node_modules/gatsby-plugin-nprogress/gatsby-browser.js'), + options: {"plugins":[],"color":"#722ED1"}, + },{ + plugin: require('../node_modules/@antv/gatsby-theme-antv/gatsby-browser.js'), + options: {"plugins":[],"pathPrefix":"/gatsby-theme-antv"}, + },{ + plugin: require('../gatsby-browser.js'), + options: {"plugins":[]}, + }] diff --git a/.cache/api-runner-browser.js b/.cache/api-runner-browser.js new file mode 100644 index 0000000000..2dd5981615 --- /dev/null +++ b/.cache/api-runner-browser.js @@ -0,0 +1,61 @@ +const plugins = require(`./api-runner-browser-plugins`) +const { + getResourcesForPathname, + getResourcesForPathnameSync, + getResourceURLsForPathname, + loadPage, + loadPageSync, +} = require(`./loader`).publicLoader + +exports.apiRunner = (api, args = {}, defaultReturn, argTransform) => { + // Hooks for gatsby-cypress's API handler + if (process.env.CYPRESS_SUPPORT) { + if (window.___apiHandler) { + window.___apiHandler(api) + } else if (window.___resolvedAPIs) { + window.___resolvedAPIs.push(api) + } else { + window.___resolvedAPIs = [api] + } + } + + let results = plugins.map(plugin => { + if (!plugin.plugin[api]) { + return undefined + } + + // Deprecated April 2019. Use `loadPageSync` instead + args.getResourcesForPathnameSync = getResourcesForPathnameSync + // Deprecated April 2019. Use `loadPage` instead + args.getResourcesForPathname = getResourcesForPathname + args.getResourceURLsForPathname = getResourceURLsForPathname + args.loadPage = loadPage + args.loadPageSync = loadPageSync + + const result = plugin.plugin[api](args, plugin.options) + if (result && argTransform) { + args = argTransform({ args, result, plugin }) + } + return result + }) + + // Filter out undefined results. + results = results.filter(result => typeof result !== `undefined`) + + if (results.length > 0) { + return results + } else if (defaultReturn) { + return [defaultReturn] + } else { + return [] + } +} + +exports.apiRunnerAsync = (api, args, defaultReturn) => + plugins.reduce( + (previous, next) => + next.plugin[api] + ? previous.then(() => next.plugin[api](args, next.options)) + : previous, + Promise.resolve() + ) diff --git a/.cache/api-runner-ssr.js b/.cache/api-runner-ssr.js new file mode 100644 index 0000000000..5fb3dac4d8 --- /dev/null +++ b/.cache/api-runner-ssr.js @@ -0,0 +1,58 @@ +var plugins = [{ + plugin: require('/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-react-helmet/gatsby-ssr'), + options: {"plugins":[]}, + },{ + plugin: require('/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-remark-autolink-headers/gatsby-ssr'), + options: {"plugins":[]}, + },{ + plugin: require('/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-offline/gatsby-ssr'), + options: {"plugins":[]}, + },{ + plugin: require('/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-manifest/gatsby-ssr'), + options: {"plugins":[],"name":"gatsby-starter-default","short_name":"starter","start_url":"/","background_color":"#722ED1","theme_color":"#722ED1","display":"minimal-ui","icon":"/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/@antv/gatsby-theme-antv/site/images/favicon.png"}, + },{ + plugin: require('/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-layout/gatsby-ssr'), + options: {"plugins":[],"component":"/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/@antv/gatsby-theme-antv/site/layouts/layout.tsx"}, + }] +// During bootstrap, we write requires at top of this file which looks like: +// var plugins = [ +// { +// plugin: require("/path/to/plugin1/gatsby-ssr.js"), +// options: { ... }, +// }, +// { +// plugin: require("/path/to/plugin2/gatsby-ssr.js"), +// options: { ... }, +// }, +// ] + +const apis = require(`./api-ssr-docs`) + +// Run the specified API in any plugins that have implemented it +module.exports = (api, args, defaultReturn, argTransform) => { + if (!apis[api]) { + console.log(`This API doesn't exist`, api) + } + + // Run each plugin in series. + // eslint-disable-next-line no-undef + let results = plugins.map(plugin => { + if (!plugin.plugin[api]) { + return undefined + } + const result = plugin.plugin[api](args, plugin.options) + if (result && argTransform) { + args = argTransform({ args, result }) + } + return result + }) + + // Filter out undefined results. + results = results.filter(result => typeof result !== `undefined`) + + if (results.length > 0) { + return results + } else { + return [defaultReturn] + } +} diff --git a/.cache/api-ssr-docs.js b/.cache/api-ssr-docs.js new file mode 100644 index 0000000000..62982142fb --- /dev/null +++ b/.cache/api-ssr-docs.js @@ -0,0 +1,198 @@ +/** + * Object containing options defined in `gatsby-config.js` + * @typedef {object} pluginOptions + */ + +/** + * Replace the default server renderer. This is useful for integration with + * Redux, css-in-js libraries, etc. that need custom setups for server + * rendering. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.replaceBodyHTMLString Call this with the HTML string + * you render. **WARNING** if multiple plugins implement this API it's the + * last plugin that "wins". TODO implement an automated warning against this. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * // From gatsby-plugin-glamor + * const { renderToString } = require("react-dom/server") + * const inline = require("glamor-inline") + * + * exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => { + * const bodyHTML = renderToString(bodyComponent) + * const inlinedHTML = inline(bodyHTML) + * + * replaceBodyHTMLString(inlinedHTML) + * } + */ +exports.replaceRenderer = true + +/** + * Called after every page Gatsby server renders while building HTML so you can + * set head and body components to be rendered in your `html.js`. + * + * Gatsby does a two-pass render for HTML. It loops through your pages first + * rendering only the body and then takes the result body HTML string and + * passes it as the `body` prop to your `html.js` to complete the render. + * + * It's often handy to be able to send custom components to your `html.js`. + * For example, it's a very common pattern for React.js libraries that + * support server rendering to pull out data generated during the render to + * add to your HTML. + * + * Using this API over [`replaceRenderer`](#replaceRenderer) is preferable as + * multiple plugins can implement this API where only one plugin can take + * over server rendering. However, if your plugin requires taking over server + * rendering then that's the one to + * use + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * const { Helmet } = require("react-helmet") + * + * exports.onRenderBody = ( + * { setHeadComponents, setHtmlAttributes, setBodyAttributes }, + * pluginOptions + * ) => { + * const helmet = Helmet.renderStatic() + * setHtmlAttributes(helmet.htmlAttributes.toComponent()) + * setBodyAttributes(helmet.bodyAttributes.toComponent()) + * setHeadComponents([ + * helmet.title.toComponent(), + * helmet.link.toComponent(), + * helmet.meta.toComponent(), + * helmet.noscript.toComponent(), + * helmet.script.toComponent(), + * helmet.style.toComponent(), + * ]) + * } + */ +exports.onRenderBody = true + +/** + * Called after every page Gatsby server renders while building HTML so you can + * replace head components to be rendered in your `html.js`. This is useful if + * you need to reorder scripts or styles added by other plugins. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {Array} $0.getHeadComponents Returns the current `headComponents` array. + * @param {function} $0.replaceHeadComponents Takes an array of components as its + * first argument which replace the `headComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPreBodyComponents Returns the current `preBodyComponents` array. + * @param {function} $0.replacePreBodyComponents Takes an array of components as its + * first argument which replace the `preBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPostBodyComponents Returns the current `postBodyComponents` array. + * @param {function} $0.replacePostBodyComponents Takes an array of components as its + * first argument which replace the `postBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {pluginOptions} pluginOptions + * @example + * // Move Typography.js styles to the top of the head section so they're loaded first. + * exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => { + * const headComponents = getHeadComponents() + * headComponents.sort((x, y) => { + * if (x.key === 'TypographyStyle') { + * return -1 + * } else if (y.key === 'TypographyStyle') { + * return 1 + * } + * return 0 + * }) + * replaceHeadComponents(headComponents) + * } + */ +exports.onPreRenderHTML = true + +/** + * Allow a plugin to wrap the page element. + * + * This is useful for setting wrapper components around pages that won't get + * unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapPageElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n). + * @param {object} $0 + * @param {ReactNode} $0.element The "Page" React Element built by Gatsby. + * @param {object} $0.props Props object used by page. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const Layout = require("./src/components/layout").default + * + * exports.wrapPageElement = ({ element, props }) => { + * // props provide same data to Layout as Page element will get + * // including location, data, etc - you don't need to pass it + * return {element} + * } + */ +exports.wrapPageElement = true + +/** + * Allow a plugin to wrap the root element. + * + * This is useful to set up any Provider components that will wrap your application. + * For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapRootElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux). + * @param {object} $0 + * @param {ReactNode} $0.element The "Root" React Element built by Gatsby. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const { Provider } = require("react-redux") + * + * const createStore = require("./src/state/createStore") + * const store = createStore() + * + * exports.wrapRootElement = ({ element }) => { + * return ( + * + * {element} + * + * ) + * } + */ +exports.wrapRootElement = true diff --git a/.cache/app.js b/.cache/app.js new file mode 100644 index 0000000000..f0c2b5c476 --- /dev/null +++ b/.cache/app.js @@ -0,0 +1,72 @@ +import React from "react" +import ReactDOM from "react-dom" +import domReady from "@mikaelkristiansson/domready" + +import socketIo from "./socketIo" +import emitter from "./emitter" +import { apiRunner, apiRunnerAsync } from "./api-runner-browser" +import { setLoader, publicLoader } from "./loader" +import DevLoader from "./dev-loader" +import syncRequires from "./sync-requires" +// Generated during bootstrap +import matchPaths from "./match-paths.json" + +window.___emitter = emitter + +const loader = new DevLoader(syncRequires, matchPaths) +setLoader(loader) +loader.setApiRunner(apiRunner) + +window.___loader = publicLoader + +// Let the site/plugins run code very early. +apiRunnerAsync(`onClientEntry`).then(() => { + // Hook up the client to socket.io on server + const socket = socketIo() + if (socket) { + socket.on(`reload`, () => { + window.location.reload() + }) + } + + /** + * Service Workers are persistent by nature. They stick around, + * serving a cached version of the site if they aren't removed. + * This is especially frustrating when you need to test the + * production build on your local machine. + * + * Let's warn if we find service workers in development. + */ + if (`serviceWorker` in navigator) { + navigator.serviceWorker.getRegistrations().then(registrations => { + if (registrations.length > 0) + console.warn( + `Warning: found one or more service workers present.`, + `If your site isn't behaving as expected, you might want to remove these.`, + registrations + ) + }) + } + + const rootElement = document.getElementById(`___gatsby`) + + const renderer = apiRunner( + `replaceHydrateFunction`, + undefined, + ReactDOM.render + )[0] + + Promise.all([ + loader.loadPage(`/dev-404-page/`), + loader.loadPage(`/404.html`), + loader.loadPage(window.location.pathname), + ]).then(() => { + const preferDefault = m => (m && m.default) || m + let Root = preferDefault(require(`./root`)) + domReady(() => { + renderer(, rootElement, () => { + apiRunner(`onInitialClientRender`) + }) + }) + }) +}) diff --git a/.cache/async-requires.js b/.cache/async-requires.js new file mode 100644 index 0000000000..a8c45d2bcf --- /dev/null +++ b/.cache/async-requires.js @@ -0,0 +1,13 @@ +// prefer default export if available +const preferDefault = m => m && m.default || m + +exports.components = { + "component---node-modules-antv-gatsby-theme-antv-site-templates-document-tsx": () => import("../node_modules/@antv/gatsby-theme-antv/site/templates/document.tsx" /* webpackChunkName: "component---node-modules-antv-gatsby-theme-antv-site-templates-document-tsx" */), + "component---node-modules-antv-gatsby-theme-antv-site-templates-example-tsx": () => import("../node_modules/@antv/gatsby-theme-antv/site/templates/example.tsx" /* webpackChunkName: "component---node-modules-antv-gatsby-theme-antv-site-templates-example-tsx" */), + "component---cache-dev-404-page-js": () => import("dev-404-page.js" /* webpackChunkName: "component---cache-dev-404-page-js" */), + "component---node-modules-antv-gatsby-theme-antv-site-pages-index-tsx": () => import("../node_modules/@antv/gatsby-theme-antv/site/pages/index.tsx" /* webpackChunkName: "component---node-modules-antv-gatsby-theme-antv-site-pages-index-tsx" */), + "component---node-modules-antv-gatsby-theme-antv-site-pages-404-tsx": () => import("../node_modules/@antv/gatsby-theme-antv/site/pages/404.tsx" /* webpackChunkName: "component---node-modules-antv-gatsby-theme-antv-site-pages-404-tsx" */), + "component---site-pages-index-en-ts": () => import("../site/pages/index.en.ts" /* webpackChunkName: "component---site-pages-index-en-ts" */), + "component---site-pages-index-zh-ts": () => import("../site/pages/index.zh.ts" /* webpackChunkName: "component---site-pages-index-zh-ts" */) +} + diff --git a/.cache/babelState.json b/.cache/babelState.json new file mode 100644 index 0000000000..544fc98adc --- /dev/null +++ b/.cache/babelState.json @@ -0,0 +1,100 @@ +{ + "stages": { + "develop": { + "plugins": [ + { + "name": "babel-plugin-import", + "options": { + "libraryName": "antd", + "style": true + } + } + ], + "presets": [ + { + "name": "/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-typescript/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + }, + "develop-html": { + "plugins": [ + { + "name": "babel-plugin-import", + "options": { + "libraryName": "antd", + "style": true + } + } + ], + "presets": [ + { + "name": "/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-typescript/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + }, + "build-html": { + "plugins": [ + { + "name": "babel-plugin-import", + "options": { + "libraryName": "antd", + "style": true + } + } + ], + "presets": [ + { + "name": "/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-typescript/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + }, + "build-javascript": { + "plugins": [ + { + "name": "babel-plugin-import", + "options": { + "libraryName": "antd", + "style": true + } + } + ], + "presets": [ + { + "name": "/Users/lizhengxue/Documents/AntV/github/L7_2.0/L7/node_modules/gatsby-plugin-typescript/node_modules/@babel/preset-typescript/lib/index.js", + "options": { + "plugins": [] + } + } + ], + "options": { + "cacheDirectory": true, + "sourceType": "unambiguous" + } + } + }, + "browserslist": [ + ">0.25%", + "not dead" + ] +} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-03f70e3c5a52291e52b331e3d35900a4.json b/.cache/caches/gatsby-transformer-remark/diskstore-03f70e3c5a52291e52b331e3d35900a4.json new file mode 100644 index 0000000000..70dac7e1e7 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-03f70e3c5a52291e52b331e3d35900a4.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-ast-99b5b2f90b0432fb92044e231041ffca-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":1,"offset":0}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-1ea0cd3c8f491f1774b8edd1ce38b1f9.json b/.cache/caches/gatsby-transformer-remark/diskstore-1ea0cd3c8f491f1774b8edd1ce38b1f9.json new file mode 100644 index 0000000000..98fb24baea --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-1ea0cd3c8f491f1774b8edd1ce38b1f9.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-c9cb5e0c306ae6f6211ba629c1a3fc15-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

初始 L7 地图实例

\n

何时使用

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-20649dc8fd4cdde49b1d9ea0c26371b2.json b/.cache/caches/gatsby-transformer-remark/diskstore-20649dc8fd4cdde49b1d9ea0c26371b2.json new file mode 100644 index 0000000000..cc03366752 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-20649dc8fd4cdde49b1d9ea0c26371b2.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-ast-b1a6eb4a5fb92e03f562537f31f11c68-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"h2","properties":{"id":"数据"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%95%B0%E6%8D%AE","aria-label":"数据 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"数据","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":6,"offset":6}}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":6,"offset":6}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"目前L7支持的数据格式有GeoJson,CSV,JSon Image","position":{"start":{"line":4,"column":1,"offset":8},"end":{"line":4,"column":35,"offset":42}}}],"position":{"start":{"line":4,"column":1,"offset":8},"end":{"line":4,"column":35,"offset":42}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"GeoJSON 支持点、线、面,等所有的空间数据格式。","position":{"start":{"line":6,"column":1,"offset":44},"end":{"line":6,"column":28,"offset":71}}},{"type":"raw","value":"
","position":{"start":{"line":6,"column":28,"offset":71},"end":{"line":6,"column":34,"offset":77}}},{"type":"text","value":"CSV 支持,点,线段,弧线的支持。","position":{"start":{"line":6,"column":34,"offset":77},"end":{"line":6,"column":52,"offset":95}}},{"type":"raw","value":"
","position":{"start":{"line":6,"column":52,"offset":95},"end":{"line":6,"column":58,"offset":101}}},{"type":"text","value":"JSON 支持简单的点、线,面,不支持多点,多线的,多面数据格式。","position":{"start":{"line":6,"column":58,"offset":101},"end":{"line":6,"column":91,"offset":134}}}],"position":{"start":{"line":6,"column":1,"offset":44},"end":{"line":6,"column":91,"offset":134}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"geojson"},"children":[{"type":"element","tagName":"a","properties":{"href":"#geojson","aria-label":"geojson permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"GeoJSON","position":{"start":{"line":9,"column":4,"offset":140},"end":{"line":9,"column":11,"offset":147}}}],"position":{"start":{"line":9,"column":1,"offset":137},"end":{"line":9,"column":11,"offset":147}}},{"type":"text","value":"\n"},{"type":"element","tagName":"blockquote","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"GeoJSON是一种对各种地理数据结构进行编码的格式。GeoJSON对象可以表示几何、特征或者特征集合。GeoJSON支持下面几何类型:点、线、面、多点、多线、多面和几何集合。GeoJSON里的特征包含一个几何对象和其他属性,特征集合表示一系列特征。","position":{"start":{"line":11,"column":3,"offset":151},"end":{"line":11,"column":128,"offset":276}}}],"position":{"start":{"line":11,"column":3,"offset":151},"end":{"line":11,"column":128,"offset":276}}},{"type":"text","value":"\n"}],"position":{"start":{"line":11,"column":1,"offset":149},"end":{"line":11,"column":128,"offset":276}}},{"type":"text","value":"\n"},{"type":"raw","value":"
{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n    {\n      \"type\": \"Feature\",\n      \"properties\": {},\n      \"geometry\": {\n        \"type\": \"Polygon\",\n        \"coordinates\": [\n          [\n            [110.478515625, 32.76880048488168],\n            [117.68554687499999, 32.76880048488168],\n            [117.68554687499999, 37.64903402157866],\n            [110.478515625, 37.64903402157866],\n            [110.478515625, 32.76880048488168]\n          ]\n        ]\n      }\n    }\n  ]\n}\n
","position":{"start":{"line":15,"column":1,"offset":280},"end":{"line":52,"column":4,"offset":980}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"地理统计分析工具"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E5%9C%B0%E7%90%86%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7","aria-label":"地理统计分析工具 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"地理统计分析工具","position":{"start":{"line":54,"column":4,"offset":985},"end":{"line":54,"column":12,"offset":993}}}],"position":{"start":{"line":54,"column":1,"offset":982},"end":{"line":54,"column":12,"offset":993}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"http://turfjs.org/","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"turfjs","position":{"start":{"line":55,"column":2,"offset":995},"end":{"line":55,"column":8,"offset":1001}}}],"position":{"start":{"line":55,"column":1,"offset":994},"end":{"line":55,"column":29,"offset":1022}}},{"type":"text","value":":  地理数据计算,处理,统计,分析的Javascript 库","position":{"start":{"line":55,"column":29,"offset":1022},"end":{"line":55,"column":60,"offset":1053}}}],"position":{"start":{"line":55,"column":1,"offset":994},"end":{"line":55,"column":60,"offset":1053}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"在线工具"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E5%9C%A8%E7%BA%BF%E5%B7%A5%E5%85%B7","aria-label":"在线工具 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"在线工具","position":{"start":{"line":57,"column":4,"offset":1058},"end":{"line":57,"column":8,"offset":1062}}}],"position":{"start":{"line":57,"column":1,"offset":1055},"end":{"line":57,"column":8,"offset":1062}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"http://geojson.io/","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"http://geojson.io/","position":{"start":{"line":59,"column":2,"offset":1065},"end":{"line":59,"column":20,"offset":1083}}}],"position":{"start":{"line":59,"column":1,"offset":1064},"end":{"line":59,"column":41,"offset":1104}}},{"type":"text","value":"    可以在线查看,绘制,修改GeoJSON数据","position":{"start":{"line":59,"column":41,"offset":1104},"end":{"line":59,"column":66,"offset":1129}}}],"position":{"start":{"line":59,"column":1,"offset":1064},"end":{"line":59,"column":66,"offset":1129}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://mapshaper.org/","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"https://mapshaper.org/","position":{"start":{"line":61,"column":2,"offset":1132},"end":{"line":61,"column":24,"offset":1154}}}],"position":{"start":{"line":61,"column":1,"offset":1131},"end":{"line":61,"column":49,"offset":1179}}},{"type":"text","value":"  可以查看较大的geojson,还能够简化GeoJSON数据","position":{"start":{"line":61,"column":49,"offset":1179},"end":{"line":61,"column":80,"offset":1210}}}],"position":{"start":{"line":61,"column":1,"offset":1131},"end":{"line":61,"column":80,"offset":1210}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":1,"offset":1211}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-2b8cd1df4f8a6941bff4108301b5d6a9.json b/.cache/caches/gatsby-transformer-remark/diskstore-2b8cd1df4f8a6941bff4108301b5d6a9.json new file mode 100644 index 0000000000..a2a988ee32 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-2b8cd1df4f8a6941bff4108301b5d6a9.json @@ -0,0 +1 @@ +{"expireTime":9007200827750866000,"key":"transformer-remark-markdown-html-99b5b2f90b0432fb92044e231041ffca-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-2c713f7ba9a30ac45cbadf6d86d5d544.json b/.cache/caches/gatsby-transformer-remark/diskstore-2c713f7ba9a30ac45cbadf6d86d5d544.json new file mode 100644 index 0000000000..63b6ff791c --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-2c713f7ba9a30ac45cbadf6d86d5d544.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-ast-57531815410aa78dc10e42270cb201dd-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"L7 地理空间可视化设计语言","position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":15,"offset":14}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":15,"offset":14}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":2,"column":1,"offset":15}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-2e9a5d11bfbd9e331e877b0e013a0ab8.json b/.cache/caches/gatsby-transformer-remark/diskstore-2e9a5d11bfbd9e331e877b0e013a0ab8.json new file mode 100644 index 0000000000..6155082a11 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-2e9a5d11bfbd9e331e877b0e013a0ab8.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-ast-6c75c6b34b379d2a97680d76e3983681-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"h2","properties":{"id":"简介"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E7%AE%80%E4%BB%8B","aria-label":"简介 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"简介","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":6,"offset":6}}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":6,"offset":6}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"raw","value":"Scene","position":{"start":{"line":3,"column":1,"offset":7},"end":{"line":3,"column":9,"offset":15}}},{"type":"text","value":"基础的地图类,提供地图创建,图层创建,管理等功能","position":{"start":{"line":3,"column":9,"offset":15},"end":{"line":3,"column":33,"offset":39}}}],"position":{"start":{"line":3,"column":1,"offset":7},"end":{"line":3,"column":33,"offset":39}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"示例代码","position":{"start":{"line":5,"column":1,"offset":41},"end":{"line":5,"column":5,"offset":45}}}],"position":{"start":{"line":5,"column":1,"offset":41},"end":{"line":5,"column":5,"offset":45}}},{"type":"text","value":"\n"},{"type":"raw","value":"
import {Scene} from '@l7/scene';\nconst scene =new L7.Scene({\n    id:'map'\n    mapStyle:'dark',\n    center:[ 110.770672, 34.159869 ],\n    pitch:45\n})
","position":{"start":{"line":7,"column":1,"offset":47},"end":{"line":15,"column":4,"offset":213}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"构造函数"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0","aria-label":"构造函数 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"构造函数","position":{"start":{"line":18,"column":5,"offset":220},"end":{"line":18,"column":9,"offset":224}}}],"position":{"start":{"line":18,"column":1,"offset":216},"end":{"line":18,"column":9,"offset":224}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Scene","position":{"start":{"line":20,"column":3,"offset":228},"end":{"line":20,"column":8,"offset":233}}}],"position":{"start":{"line":20,"column":1,"offset":226},"end":{"line":20,"column":10,"offset":235}}},{"type":"raw","value":"
","position":{"start":{"line":20,"column":10,"offset":235},"end":{"line":20,"column":16,"offset":241}}},{"type":"text","value":"支持两种实例化方式","position":{"start":{"line":20,"column":16,"offset":241},"end":{"line":20,"column":25,"offset":250}}}],"position":{"start":{"line":20,"column":1,"offset":226},"end":{"line":20,"column":25,"offset":250}}},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"独立实例化 内部根据id自动穿件地图实例","position":{"start":{"line":22,"column":3,"offset":254},"end":{"line":22,"column":23,"offset":274}}}],"position":{"start":{"line":22,"column":1,"offset":252},"end":{"line":22,"column":23,"offset":274}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"传入地图实例","position":{"start":{"line":23,"column":3,"offset":277},"end":{"line":23,"column":9,"offset":283}}}],"position":{"start":{"line":23,"column":1,"offset":275},"end":{"line":23,"column":9,"offset":283}}},{"type":"text","value":"\n"}],"position":{"start":{"line":22,"column":1,"offset":252},"end":{"line":23,"column":9,"offset":283}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"独立实例化-scene"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E7%8B%AC%E7%AB%8B%E5%AE%9E%E4%BE%8B%E5%8C%96-scene","aria-label":"独立实例化 scene permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"独立实例化 Scene","position":{"start":{"line":29,"column":6,"offset":294},"end":{"line":29,"column":17,"offset":305}}}],"position":{"start":{"line":29,"column":1,"offset":289},"end":{"line":29,"column":17,"offset":305}}},{"type":"text","value":"\n"},{"type":"raw","value":"
const scene = new L7.Scene({\n  id: 'map',\n  mapStyle: 'dark',\n  center: [120.19382669582967, 30.258134],\n  pitch: 0,\n  zoom: 12,\n  maxZoom: 20,\n  minZoom: 0,\n});\n
","position":{"start":{"line":31,"column":1,"offset":307},"end":{"line":41,"column":4,"offset":487}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"根据map-实例创建sence"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%A0%B9%E6%8D%AEmap-%E5%AE%9E%E4%BE%8B%E5%88%9B%E5%BB%BAsence","aria-label":"根据map 实例创建sence permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"根据map 实例创建Sence","position":{"start":{"line":44,"column":6,"offset":495},"end":{"line":44,"column":21,"offset":510}}}],"position":{"start":{"line":44,"column":1,"offset":490},"end":{"line":44,"column":21,"offset":510}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"_L7 基于高德地图3D模式开发的,因此传入Map实例 _","position":{"start":{"line":46,"column":1,"offset":512},"end":{"line":46,"column":30,"offset":541}}},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"viewModes需要设置成3d","position":{"start":{"line":46,"column":31,"offset":542},"end":{"line":46,"column":47,"offset":558}}}],"position":{"start":{"line":46,"column":30,"offset":541},"end":{"line":46,"column":48,"offset":559}}},{"type":"raw","value":"
","position":{"start":{"line":46,"column":48,"offset":559},"end":{"line":46,"column":54,"offset":565}}},{"type":"text","value":"_","position":{"start":{"line":46,"column":54,"offset":565},"end":{"line":46,"column":55,"offset":566}}}],"position":{"start":{"line":46,"column":1,"offset":512},"end":{"line":46,"column":55,"offset":566}}},{"type":"text","value":"\n"},{"type":"raw","value":"
var mapinstance = new AMap.Map('map', {\n  center: [120.19382669582967, 30.258134],\n  viewMode: '3D',\n  pitch: 0,\n  zoom: 12,\n  maxZoom: 20,\n  minZoom: 0,\n});\n\nconst scene = new L7.Scene({\n  mapStyle: 'dark',\n  map: mapinstance,\n});\n
","position":{"start":{"line":47,"column":1,"offset":567},"end":{"line":61,"column":4,"offset":826}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"map"},"children":[{"type":"element","tagName":"a","properties":{"href":"#map","aria-label":"map permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"map","position":{"start":{"line":64,"column":4,"offset":832},"end":{"line":64,"column":7,"offset":835}}}],"position":{"start":{"line":64,"column":1,"offset":829},"end":{"line":64,"column":7,"offset":835}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"L7 在scene 下保留了高德地图实例,可以通过scene.map 调用高德地图的map方法。","position":{"start":{"line":65,"column":1,"offset":836},"end":{"line":65,"column":49,"offset":884}}},{"type":"raw","value":"
","position":{"start":{"line":65,"column":49,"offset":884},"end":{"line":65,"column":55,"offset":890}}},{"type":"text","value":"map 实例方法见","position":{"start":{"line":65,"column":55,"offset":890},"end":{"line":65,"column":64,"offset":899}}},{"type":"element","tagName":"a","properties":{"href":"https://lbs.amap.com/api/javascript-api/reference/map","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"高德地图文档","position":{"start":{"line":65,"column":65,"offset":900},"end":{"line":65,"column":71,"offset":906}}}],"position":{"start":{"line":65,"column":64,"offset":899},"end":{"line":65,"column":127,"offset":962}}}],"position":{"start":{"line":65,"column":1,"offset":836},"end":{"line":65,"column":127,"offset":962}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.map;\n
","position":{"start":{"line":67,"column":1,"offset":964},"end":{"line":69,"column":4,"offset":991}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"构造类"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%9E%84%E9%80%A0%E7%B1%BB","aria-label":"构造类 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"构造类","position":{"start":{"line":72,"column":4,"offset":997},"end":{"line":72,"column":7,"offset":1000}}}],"position":{"start":{"line":72,"column":1,"offset":994},"end":{"line":72,"column":7,"offset":1000}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"pointlayer"},"children":[{"type":"element","tagName":"a","properties":{"href":"#pointlayer","aria-label":"pointlayer permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"PointLayer","position":{"start":{"line":74,"column":5,"offset":1006},"end":{"line":74,"column":15,"offset":1016}}}],"position":{"start":{"line":74,"column":1,"offset":1002},"end":{"line":74,"column":15,"offset":1016}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建点图层","position":{"start":{"line":75,"column":1,"offset":1017},"end":{"line":75,"column":6,"offset":1022}}}],"position":{"start":{"line":75,"column":1,"offset":1017},"end":{"line":75,"column":6,"offset":1022}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"polylinelayer"},"children":[{"type":"element","tagName":"a","properties":{"href":"#polylinelayer","aria-label":"polylinelayer permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"PolylineLayer","position":{"start":{"line":77,"column":5,"offset":1028},"end":{"line":77,"column":18,"offset":1041}}}],"position":{"start":{"line":77,"column":1,"offset":1024},"end":{"line":77,"column":18,"offset":1041}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建线图层","position":{"start":{"line":78,"column":1,"offset":1042},"end":{"line":78,"column":6,"offset":1047}}}],"position":{"start":{"line":78,"column":1,"offset":1042},"end":{"line":78,"column":6,"offset":1047}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"polygonlayer"},"children":[{"type":"element","tagName":"a","properties":{"href":"#polygonlayer","aria-label":"polygonlayer permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"PolygonLayer","position":{"start":{"line":80,"column":5,"offset":1053},"end":{"line":80,"column":17,"offset":1065}}}],"position":{"start":{"line":80,"column":1,"offset":1049},"end":{"line":80,"column":17,"offset":1065}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建面图层","position":{"start":{"line":81,"column":1,"offset":1066},"end":{"line":81,"column":6,"offset":1071}}}],"position":{"start":{"line":81,"column":1,"offset":1066},"end":{"line":81,"column":6,"offset":1071}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"imagelayer"},"children":[{"type":"element","tagName":"a","properties":{"href":"#imagelayer","aria-label":"imagelayer permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"ImageLayer","position":{"start":{"line":83,"column":5,"offset":1077},"end":{"line":83,"column":15,"offset":1087}}}],"position":{"start":{"line":83,"column":1,"offset":1073},"end":{"line":83,"column":15,"offset":1087}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建图片图层","position":{"start":{"line":84,"column":1,"offset":1088},"end":{"line":84,"column":7,"offset":1094}}}],"position":{"start":{"line":84,"column":1,"offset":1088},"end":{"line":84,"column":7,"offset":1094}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"配置项"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E9%85%8D%E7%BD%AE%E9%A1%B9","aria-label":"配置项 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"配置项","position":{"start":{"line":87,"column":4,"offset":1100},"end":{"line":87,"column":7,"offset":1103}}}],"position":{"start":{"line":87,"column":1,"offset":1097},"end":{"line":87,"column":7,"offset":1103}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"id"},"children":[{"type":"element","tagName":"a","properties":{"href":"#id","aria-label":"id permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"id","position":{"start":{"line":89,"column":5,"offset":1109},"end":{"line":89,"column":7,"offset":1111}}}],"position":{"start":{"line":89,"column":1,"offset":1105},"end":{"line":89,"column":7,"offset":1111}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"需传入 dom 容器或者容器 id  {domObject || string} ","position":{"start":{"line":90,"column":1,"offset":1112},"end":{"line":90,"column":42,"offset":1153}}},{"type":"text","value":"[必选]","position":{"start":{"line":90,"column":43,"offset":1154},"end":{"line":90,"column":45,"offset":1156}}}],"position":{"start":{"line":90,"column":1,"offset":1112},"end":{"line":90,"column":46,"offset":1157}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"zoom"},"children":[{"type":"element","tagName":"a","properties":{"href":"#zoom","aria-label":"zoom permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"zoom","position":{"start":{"line":93,"column":5,"offset":1164},"end":{"line":93,"column":9,"offset":1168}}}],"position":{"start":{"line":93,"column":1,"offset":1160},"end":{"line":93,"column":9,"offset":1168}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图初始显示级别 {number} (0-22)","position":{"start":{"line":94,"column":1,"offset":1169},"end":{"line":94,"column":26,"offset":1194}}}],"position":{"start":{"line":94,"column":1,"offset":1169},"end":{"line":94,"column":26,"offset":1194}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"center"},"children":[{"type":"element","tagName":"a","properties":{"href":"#center","aria-label":"center permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"center","position":{"start":{"line":96,"column":5,"offset":1200},"end":{"line":96,"column":11,"offset":1206}}}],"position":{"start":{"line":96,"column":1,"offset":1196},"end":{"line":96,"column":11,"offset":1206}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图初始中心经纬度 {Lnglat}","position":{"start":{"line":97,"column":1,"offset":1207},"end":{"line":97,"column":19,"offset":1225}}}],"position":{"start":{"line":97,"column":1,"offset":1207},"end":{"line":97,"column":19,"offset":1225}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"pitch"},"children":[{"type":"element","tagName":"a","properties":{"href":"#pitch","aria-label":"pitch permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"pitch","position":{"start":{"line":99,"column":5,"offset":1231},"end":{"line":99,"column":10,"offset":1236}}}],"position":{"start":{"line":99,"column":1,"offset":1227},"end":{"line":99,"column":10,"offset":1236}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图初始俯仰角度 {number}  default 0","position":{"start":{"line":100,"column":1,"offset":1237},"end":{"line":100,"column":29,"offset":1265}}}],"position":{"start":{"line":100,"column":1,"offset":1237},"end":{"line":100,"column":29,"offset":1265}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"mapsyle"},"children":[{"type":"element","tagName":"a","properties":{"href":"#mapsyle","aria-label":"mapsyle permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"mapSyle","position":{"start":{"line":102,"column":5,"offset":1271},"end":{"line":102,"column":12,"offset":1278}}}],"position":{"start":{"line":102,"column":1,"offset":1267},"end":{"line":102,"column":12,"offset":1278}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图样式 {style} 目前仅支持高德地图。 default 'dark'","position":{"start":{"line":103,"column":1,"offset":1279},"end":{"line":103,"column":39,"offset":1317}}},{"type":"raw","value":"
","position":{"start":{"line":103,"column":39,"offset":1317},"end":{"line":103,"column":45,"offset":1323}}},{"type":"text","value":"L7 内置三种种默认地图样式 dark | light|blank 空地图","position":{"start":{"line":103,"column":45,"offset":1323},"end":{"line":103,"column":82,"offset":1360}}}],"position":{"start":{"line":103,"column":1,"offset":1279},"end":{"line":103,"column":82,"offset":1360}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图的显示样式,目前支持两种地图样式:","position":{"start":{"line":105,"column":1,"offset":1362},"end":{"line":105,"column":22,"offset":1383}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":22,"offset":1383},"end":{"line":105,"column":28,"offset":1389}}},{"type":"text","value":"第一种:自定义地图样式,如","position":{"start":{"line":105,"column":28,"offset":1389},"end":{"line":105,"column":41,"offset":1402}}},{"type":"raw","value":""amap://styles/d6bf8c1d69cea9f5c696185ad4ac4c86"","position":{"start":{"line":105,"column":41,"offset":1402},"end":{"line":105,"column":91,"offset":1452}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":91,"offset":1452},"end":{"line":105,"column":97,"offset":1458}}},{"type":"text","value":"可前往","position":{"start":{"line":105,"column":97,"offset":1458},"end":{"line":105,"column":100,"offset":1461}}},{"type":"element","tagName":"a","properties":{"href":"https://lbs.amap.com/dev/mapstyle/index","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"地图自定义平台","position":{"start":{"line":105,"column":101,"offset":1462},"end":{"line":105,"column":108,"offset":1469}}}],"position":{"start":{"line":105,"column":100,"offset":1461},"end":{"line":105,"column":150,"offset":1511}}},{"type":"text","value":"定制自己的个性地图样式;","position":{"start":{"line":105,"column":150,"offset":1511},"end":{"line":105,"column":162,"offset":1523}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":162,"offset":1523},"end":{"line":105,"column":168,"offset":1529}}},{"type":"text","value":"第二种:官方样式模版,如","position":{"start":{"line":105,"column":168,"offset":1529},"end":{"line":105,"column":180,"offset":1541}}},{"type":"raw","value":""amap://styles/grey"","position":{"start":{"line":105,"column":180,"offset":1541},"end":{"line":105,"column":202,"offset":1563}}},{"type":"text","value":"。","position":{"start":{"line":105,"column":202,"offset":1563},"end":{"line":105,"column":203,"offset":1564}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":203,"offset":1564},"end":{"line":105,"column":209,"offset":1570}}},{"type":"text","value":"其他模版样式及自定义地图的使用说明见","position":{"start":{"line":105,"column":209,"offset":1570},"end":{"line":105,"column":227,"offset":1588}}},{"type":"element","tagName":"a","properties":{"href":"https://lbs.amap.com/api/javascript-api/guide/create-map/mapstye/","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"开发指南","position":{"start":{"line":105,"column":228,"offset":1589},"end":{"line":105,"column":232,"offset":1593}}}],"position":{"start":{"line":105,"column":227,"offset":1588},"end":{"line":105,"column":300,"offset":1661}}}],"position":{"start":{"line":105,"column":1,"offset":1362},"end":{"line":105,"column":300,"offset":1661}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"minzoom"},"children":[{"type":"element","tagName":"a","properties":{"href":"#minzoom","aria-label":"minzoom permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"minZoom","position":{"start":{"line":108,"column":5,"offset":1668},"end":{"line":108,"column":12,"offset":1675}}}],"position":{"start":{"line":108,"column":1,"offset":1664},"end":{"line":108,"column":12,"offset":1675}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图最小缩放等级 {number}  default 0 (0-22)","position":{"start":{"line":109,"column":1,"offset":1676},"end":{"line":109,"column":37,"offset":1712}}}],"position":{"start":{"line":109,"column":1,"offset":1676},"end":{"line":109,"column":37,"offset":1712}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"maxzoom"},"children":[{"type":"element","tagName":"a","properties":{"href":"#maxzoom","aria-label":"maxzoom permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"maxZoom","position":{"start":{"line":111,"column":5,"offset":1718},"end":{"line":111,"column":12,"offset":1725}}}],"position":{"start":{"line":111,"column":1,"offset":1714},"end":{"line":111,"column":12,"offset":1725}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图最大缩放等级 {number}  default 22 (0-22)","position":{"start":{"line":112,"column":1,"offset":1726},"end":{"line":112,"column":38,"offset":1763}}}],"position":{"start":{"line":112,"column":1,"offset":1726},"end":{"line":112,"column":38,"offset":1763}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"rotateenable"},"children":[{"type":"element","tagName":"a","properties":{"href":"#rotateenable","aria-label":"rotateenable permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"rotateEnable","position":{"start":{"line":114,"column":5,"offset":1769},"end":{"line":114,"column":17,"offset":1781}}}],"position":{"start":{"line":114,"column":1,"offset":1765},"end":{"line":114,"column":17,"offset":1781}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图是否可旋转 {Boolean} default true","position":{"start":{"line":115,"column":1,"offset":1782},"end":{"line":115,"column":31,"offset":1812}}}],"position":{"start":{"line":115,"column":1,"offset":1782},"end":{"line":115,"column":31,"offset":1812}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"方法"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%96%B9%E6%B3%95","aria-label":"方法 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"方法","position":{"start":{"line":120,"column":4,"offset":1820},"end":{"line":120,"column":6,"offset":1822}}}],"position":{"start":{"line":120,"column":1,"offset":1817},"end":{"line":120,"column":6,"offset":1822}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"getzoom"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getzoom","aria-label":"getzoom permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getZoom","position":{"start":{"line":122,"column":5,"offset":1828},"end":{"line":122,"column":12,"offset":1835}}}],"position":{"start":{"line":122,"column":1,"offset":1824},"end":{"line":122,"column":12,"offset":1835}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取当前缩放等级","position":{"start":{"line":123,"column":1,"offset":1836},"end":{"line":123,"column":9,"offset":1844}}}],"position":{"start":{"line":123,"column":1,"offset":1836},"end":{"line":123,"column":9,"offset":1844}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getZoom();\n
","position":{"start":{"line":125,"column":1,"offset":1846},"end":{"line":127,"column":4,"offset":1880}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return {float}  当前缩放等级","position":{"start":{"line":129,"column":1,"offset":1882},"end":{"line":129,"column":24,"offset":1905}}}],"position":{"start":{"line":129,"column":1,"offset":1882},"end":{"line":129,"column":24,"offset":1905}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"getlayers"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getlayers","aria-label":"getlayers permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getLayers()","position":{"start":{"line":131,"column":5,"offset":1911},"end":{"line":131,"column":16,"offset":1922}}}],"position":{"start":{"line":131,"column":1,"offset":1907},"end":{"line":131,"column":16,"offset":1922}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取所有的地图图层","position":{"start":{"line":132,"column":1,"offset":1923},"end":{"line":132,"column":10,"offset":1932}}}],"position":{"start":{"line":132,"column":1,"offset":1923},"end":{"line":132,"column":10,"offset":1932}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getLayers();\n
","position":{"start":{"line":133,"column":1,"offset":1933},"end":{"line":135,"column":4,"offset":1969}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return 图层数组 {Array}","position":{"start":{"line":137,"column":1,"offset":1971},"end":{"line":137,"column":21,"offset":1991}}}],"position":{"start":{"line":137,"column":1,"offset":1971},"end":{"line":137,"column":21,"offset":1991}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"getcenter"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getcenter","aria-label":"getcenter permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getCenter()","position":{"start":{"line":140,"column":5,"offset":1998},"end":{"line":140,"column":16,"offset":2009}}}],"position":{"start":{"line":140,"column":1,"offset":1994},"end":{"line":140,"column":16,"offset":2009}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取地图中心点","position":{"start":{"line":141,"column":1,"offset":2010},"end":{"line":141,"column":8,"offset":2017}}}],"position":{"start":{"line":141,"column":1,"offset":2010},"end":{"line":141,"column":8,"offset":2017}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getCenter();\n
","position":{"start":{"line":142,"column":1,"offset":2018},"end":{"line":144,"column":4,"offset":2053}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return {Lnglat} :地图中心点","position":{"start":{"line":146,"column":1,"offset":2055},"end":{"line":146,"column":23,"offset":2077}}}],"position":{"start":{"line":146,"column":1,"offset":2055},"end":{"line":146,"column":23,"offset":2077}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"getsize"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getsize","aria-label":"getsize permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getSize()","position":{"start":{"line":148,"column":5,"offset":2083},"end":{"line":148,"column":14,"offset":2092}}}],"position":{"start":{"line":148,"column":1,"offset":2079},"end":{"line":148,"column":14,"offset":2092}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取地图容器大小","position":{"start":{"line":149,"column":1,"offset":2093},"end":{"line":149,"column":9,"offset":2101}}}],"position":{"start":{"line":149,"column":1,"offset":2093},"end":{"line":149,"column":9,"offset":2101}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getSize();\n
","position":{"start":{"line":150,"column":1,"offset":2102},"end":{"line":152,"column":4,"offset":2135}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return { Object } 地图容器的 width,height","position":{"start":{"line":153,"column":1,"offset":2136},"end":{"line":153,"column":37,"offset":2172}}}],"position":{"start":{"line":153,"column":1,"offset":2136},"end":{"line":153,"column":37,"offset":2172}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"getpitch"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getpitch","aria-label":"getpitch permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getPitch()","position":{"start":{"line":155,"column":5,"offset":2178},"end":{"line":155,"column":15,"offset":2188}}}],"position":{"start":{"line":155,"column":1,"offset":2174},"end":{"line":155,"column":15,"offset":2188}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取地图俯仰角","position":{"start":{"line":156,"column":1,"offset":2189},"end":{"line":156,"column":8,"offset":2196}}}],"position":{"start":{"line":156,"column":1,"offset":2189},"end":{"line":156,"column":8,"offset":2196}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getPitch();\n
","position":{"start":{"line":157,"column":1,"offset":2197},"end":{"line":159,"column":4,"offset":2232}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return {number} pitch","position":{"start":{"line":161,"column":1,"offset":2234},"end":{"line":161,"column":22,"offset":2255}}}],"position":{"start":{"line":161,"column":1,"offset":2234},"end":{"line":161,"column":22,"offset":2255}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"setcenter"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setcenter","aria-label":"setcenter permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setCenter()","position":{"start":{"line":163,"column":5,"offset":2261},"end":{"line":163,"column":16,"offset":2272}}}],"position":{"start":{"line":163,"column":1,"offset":2257},"end":{"line":163,"column":16,"offset":2272}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图中心点坐标","position":{"start":{"line":164,"column":1,"offset":2273},"end":{"line":164,"column":10,"offset":2282}}}],"position":{"start":{"line":164,"column":1,"offset":2273},"end":{"line":164,"column":10,"offset":2282}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setCenter([lng, lat]);\n
","position":{"start":{"line":166,"column":1,"offset":2284},"end":{"line":168,"column":4,"offset":2328}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:","position":{"start":{"line":170,"column":1,"offset":2330},"end":{"line":170,"column":4,"offset":2333}}},{"type":"raw","value":"center","position":{"start":{"line":170,"column":4,"offset":2333},"end":{"line":170,"column":12,"offset":2341}}},{"type":"text","value":" {LngLat} 地图中心点","position":{"start":{"line":170,"column":12,"offset":2341},"end":{"line":170,"column":28,"offset":2357}}}],"position":{"start":{"line":170,"column":1,"offset":2330},"end":{"line":170,"column":28,"offset":2357}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"setzoomandcenter"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setzoomandcenter","aria-label":"setzoomandcenter permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setZoomAndCenter","position":{"start":{"line":173,"column":5,"offset":2364},"end":{"line":173,"column":21,"offset":2380}}}],"position":{"start":{"line":173,"column":1,"offset":2360},"end":{"line":173,"column":21,"offset":2380}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图等级和中心","position":{"start":{"line":174,"column":1,"offset":2381},"end":{"line":174,"column":10,"offset":2390}}}],"position":{"start":{"line":174,"column":1,"offset":2381},"end":{"line":174,"column":10,"offset":2390}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setZoomAndCenter(zoom, center);\n
","position":{"start":{"line":175,"column":1,"offset":2391},"end":{"line":177,"column":4,"offset":2444}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:zoom {number}","position":{"start":{"line":179,"column":1,"offset":2446},"end":{"line":179,"column":17,"offset":2462}}},{"type":"raw","value":"
","position":{"start":{"line":179,"column":17,"offset":2462},"end":{"line":179,"column":23,"offset":2468}}},{"type":"text","value":"center {LngLat}","position":{"start":{"line":179,"column":23,"offset":2468},"end":{"line":179,"column":38,"offset":2483}}}],"position":{"start":{"line":179,"column":1,"offset":2446},"end":{"line":179,"column":38,"offset":2483}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"setrotation"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setrotation","aria-label":"setrotation permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setRotation","position":{"start":{"line":182,"column":5,"offset":2490},"end":{"line":182,"column":16,"offset":2501}}}],"position":{"start":{"line":182,"column":1,"offset":2486},"end":{"line":182,"column":16,"offset":2501}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图顺时针旋转角度,旋转原点为地图容器中心点,取值范围 ","position":{"start":{"line":183,"column":1,"offset":2502},"end":{"line":183,"column":31,"offset":2532}}},{"type":"text","value":"[0-360]","position":{"start":{"line":183,"column":32,"offset":2533},"end":{"line":183,"column":37,"offset":2538}}}],"position":{"start":{"line":183,"column":1,"offset":2502},"end":{"line":183,"column":38,"offset":2539}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setRotation(rotation);\n
","position":{"start":{"line":184,"column":1,"offset":2540},"end":{"line":186,"column":4,"offset":2585}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数: ","position":{"start":{"line":188,"column":1,"offset":2587},"end":{"line":188,"column":5,"offset":2591}}},{"type":"raw","value":"rotation","position":{"start":{"line":188,"column":5,"offset":2591},"end":{"line":188,"column":15,"offset":2601}}},{"type":"text","value":" {number}","position":{"start":{"line":188,"column":15,"offset":2601},"end":{"line":188,"column":26,"offset":2612}}}],"position":{"start":{"line":188,"column":1,"offset":2587},"end":{"line":188,"column":26,"offset":2612}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"zoomin"},"children":[{"type":"element","tagName":"a","properties":{"href":"#zoomin","aria-label":"zoomin permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"zoomIn","position":{"start":{"line":190,"column":5,"offset":2618},"end":{"line":190,"column":11,"offset":2624}}}],"position":{"start":{"line":190,"column":1,"offset":2614},"end":{"line":190,"column":11,"offset":2624}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图放大一级","position":{"start":{"line":191,"column":1,"offset":2625},"end":{"line":191,"column":7,"offset":2631}}}],"position":{"start":{"line":191,"column":1,"offset":2625},"end":{"line":191,"column":7,"offset":2631}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.zoomIn();\n
","position":{"start":{"line":192,"column":1,"offset":2632},"end":{"line":194,"column":4,"offset":2664}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"zoomout"},"children":[{"type":"element","tagName":"a","properties":{"href":"#zoomout","aria-label":"zoomout permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"zoomOut","position":{"start":{"line":196,"column":5,"offset":2670},"end":{"line":196,"column":12,"offset":2677}}}],"position":{"start":{"line":196,"column":1,"offset":2666},"end":{"line":196,"column":12,"offset":2677}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图缩小一级","position":{"start":{"line":197,"column":1,"offset":2678},"end":{"line":197,"column":7,"offset":2684}}}],"position":{"start":{"line":197,"column":1,"offset":2678},"end":{"line":197,"column":7,"offset":2684}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.ZoomOUt();\n
","position":{"start":{"line":198,"column":1,"offset":2685},"end":{"line":200,"column":4,"offset":2718}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"panto"},"children":[{"type":"element","tagName":"a","properties":{"href":"#panto","aria-label":"panto permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"panTo","position":{"start":{"line":202,"column":5,"offset":2724},"end":{"line":202,"column":10,"offset":2729}}}],"position":{"start":{"line":202,"column":1,"offset":2720},"end":{"line":202,"column":10,"offset":2729}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图平移到指定的位置","position":{"start":{"line":203,"column":1,"offset":2730},"end":{"line":203,"column":11,"offset":2740}}}],"position":{"start":{"line":203,"column":1,"offset":2730},"end":{"line":203,"column":11,"offset":2740}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.panTo(LngLat);\n
","position":{"start":{"line":204,"column":1,"offset":2741},"end":{"line":206,"column":4,"offset":2778}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:","position":{"start":{"line":208,"column":1,"offset":2780},"end":{"line":208,"column":4,"offset":2783}}},{"type":"raw","value":"center","position":{"start":{"line":208,"column":4,"offset":2783},"end":{"line":208,"column":12,"offset":2791}}},{"type":"text","value":" LngLat 中心位置坐标","position":{"start":{"line":208,"column":12,"offset":2791},"end":{"line":208,"column":27,"offset":2806}}}],"position":{"start":{"line":208,"column":1,"offset":2780},"end":{"line":208,"column":27,"offset":2806}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"panby"},"children":[{"type":"element","tagName":"a","properties":{"href":"#panby","aria-label":"panby permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"panBy","position":{"start":{"line":210,"column":5,"offset":2812},"end":{"line":210,"column":10,"offset":2817}}}],"position":{"start":{"line":210,"column":1,"offset":2808},"end":{"line":210,"column":10,"offset":2817}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"以像素为单位沿X方向和Y方向移动地图","position":{"start":{"line":211,"column":1,"offset":2818},"end":{"line":211,"column":19,"offset":2836}}}],"position":{"start":{"line":211,"column":1,"offset":2818},"end":{"line":211,"column":19,"offset":2836}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.panBy(x, y);\n
","position":{"start":{"line":212,"column":1,"offset":2837},"end":{"line":214,"column":4,"offset":2871}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:","position":{"start":{"line":215,"column":1,"offset":2872},"end":{"line":215,"column":4,"offset":2875}}},{"type":"raw","value":"
","position":{"start":{"line":215,"column":4,"offset":2875},"end":{"line":215,"column":10,"offset":2881}}},{"type":"raw","value":"x","position":{"start":{"line":215,"column":10,"offset":2881},"end":{"line":215,"column":13,"offset":2884}}},{"type":"text","value":" {number} 水平方向移动像素 向右为正方向","position":{"start":{"line":215,"column":13,"offset":2884},"end":{"line":215,"column":38,"offset":2909}}},{"type":"raw","value":"
","position":{"start":{"line":215,"column":38,"offset":2909},"end":{"line":215,"column":44,"offset":2915}}},{"type":"text","value":"      ","position":{"start":{"line":215,"column":44,"offset":2915},"end":{"line":215,"column":50,"offset":2921}}},{"type":"raw","value":"y","position":{"start":{"line":215,"column":50,"offset":2921},"end":{"line":215,"column":53,"offset":2924}}},{"type":"text","value":" {number} 垂直方向移动像素 向下为正方向","position":{"start":{"line":215,"column":53,"offset":2924},"end":{"line":215,"column":79,"offset":2950}}}],"position":{"start":{"line":215,"column":1,"offset":2872},"end":{"line":215,"column":79,"offset":2950}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"setpitch"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setpitch","aria-label":"setpitch permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setPitch","position":{"start":{"line":218,"column":5,"offset":2957},"end":{"line":218,"column":13,"offset":2965}}}],"position":{"start":{"line":218,"column":1,"offset":2953},"end":{"line":218,"column":13,"offset":2965}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图仰俯角度","position":{"start":{"line":219,"column":1,"offset":2966},"end":{"line":219,"column":9,"offset":2974}}}],"position":{"start":{"line":219,"column":1,"offset":2966},"end":{"line":219,"column":9,"offset":2974}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setPitch(pitch);\n
","position":{"start":{"line":220,"column":1,"offset":2975},"end":{"line":222,"column":4,"offset":3014}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数 :","position":{"start":{"line":224,"column":1,"offset":3016},"end":{"line":224,"column":5,"offset":3020}}},{"type":"raw","value":"
","position":{"start":{"line":224,"column":5,"offset":3020},"end":{"line":224,"column":11,"offset":3026}}},{"type":"text","value":"   ","position":{"start":{"line":224,"column":11,"offset":3026},"end":{"line":224,"column":14,"offset":3029}}},{"type":"raw","value":"pitch","position":{"start":{"line":224,"column":14,"offset":3029},"end":{"line":224,"column":21,"offset":3036}}},{"type":"text","value":" {number}","position":{"start":{"line":224,"column":21,"offset":3036},"end":{"line":224,"column":31,"offset":3046}}}],"position":{"start":{"line":224,"column":1,"offset":3016},"end":{"line":224,"column":31,"offset":3046}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":""},"children":[{"type":"element","tagName":"a","properties":{"href":"#","aria-label":" permalink","class":"anchor"},"children":[{"type":"raw","value":""}]}],"position":{"start":{"line":226,"column":1,"offset":3048},"end":{"line":226,"column":5,"offset":3052}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"setstatus"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setstatus","aria-label":"setstatus permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setStatus","position":{"start":{"line":228,"column":5,"offset":3058},"end":{"line":228,"column":14,"offset":3067}}}],"position":{"start":{"line":228,"column":1,"offset":3054},"end":{"line":228,"column":14,"offset":3067}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置当前地图显示状态,包括是否可鼠标拖拽移动地图、地图是否可缩放、地图是否可旋转(rotateEnable)、是否可双击放大地图、是否可以通过键盘控制地图旋转(keyboardEnable)等   ","position":{"start":{"line":229,"column":1,"offset":3068},"end":{"line":229,"column":100,"offset":3167}}}],"position":{"start":{"line":229,"column":1,"offset":3068},"end":{"line":229,"column":100,"offset":3167}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setStatus({\n  dragEnable: true,\n  keyboardEnable: true,\n  doubleClickZoom: true,\n  zoomEnable: true,\n  rotateEnable: true,\n});\n
","position":{"start":{"line":231,"column":1,"offset":3169},"end":{"line":239,"column":4,"offset":3346}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"fitbounds"},"children":[{"type":"element","tagName":"a","properties":{"href":"#fitbounds","aria-label":"fitbounds permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"fitBounds","position":{"start":{"line":242,"column":5,"offset":3353},"end":{"line":242,"column":14,"offset":3362}}}],"position":{"start":{"line":242,"column":1,"offset":3349},"end":{"line":242,"column":14,"offset":3362}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图缩放到某个范围内","position":{"start":{"line":243,"column":1,"offset":3363},"end":{"line":243,"column":11,"offset":3373}}},{"type":"raw","value":"
","position":{"start":{"line":243,"column":11,"offset":3373},"end":{"line":243,"column":17,"offset":3379}}},{"type":"text","value":"参数 :","position":{"start":{"line":243,"column":17,"offset":3379},"end":{"line":243,"column":21,"offset":3383}}},{"type":"raw","value":"
","position":{"start":{"line":243,"column":21,"offset":3383},"end":{"line":243,"column":27,"offset":3389}}},{"type":"text","value":"  ","position":{"start":{"line":243,"column":27,"offset":3389},"end":{"line":243,"column":29,"offset":3391}}},{"type":"raw","value":"extent","position":{"start":{"line":243,"column":29,"offset":3391},"end":{"line":243,"column":37,"offset":3399}}},{"type":"text","value":" { array} 经纬度范围 ","position":{"start":{"line":243,"column":37,"offset":3399},"end":{"line":243,"column":53,"offset":3415}}},{"type":"text","value":"[minlng,minlat,maxlng,maxlat]","position":{"start":{"line":243,"column":54,"offset":3416},"end":{"line":243,"column":81,"offset":3443}}}],"position":{"start":{"line":243,"column":1,"offset":3363},"end":{"line":243,"column":82,"offset":3444}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.fitBounds([112, 32, 114, 35]);\n
","position":{"start":{"line":245,"column":1,"offset":3446},"end":{"line":247,"column":4,"offset":3497}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"removelayer"},"children":[{"type":"element","tagName":"a","properties":{"href":"#removelayer","aria-label":"removelayer permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"removeLayer","position":{"start":{"line":251,"column":5,"offset":3505},"end":{"line":251,"column":16,"offset":3516}}}],"position":{"start":{"line":251,"column":1,"offset":3501},"end":{"line":251,"column":16,"offset":3516}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除layer","position":{"start":{"line":252,"column":1,"offset":3517},"end":{"line":252,"column":8,"offset":3524}}}],"position":{"start":{"line":252,"column":1,"offset":3517},"end":{"line":252,"column":8,"offset":3524}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.removeLayer(layer);\n
","position":{"start":{"line":254,"column":1,"offset":3526},"end":{"line":256,"column":4,"offset":3568}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数","position":{"start":{"line":258,"column":1,"offset":3570},"end":{"line":258,"column":3,"offset":3572}}},{"type":"raw","value":"
","position":{"start":{"line":258,"column":3,"offset":3572},"end":{"line":258,"column":9,"offset":3578}}},{"type":"raw","value":"layer","position":{"start":{"line":258,"column":9,"offset":3578},"end":{"line":258,"column":16,"offset":3585}}},{"type":"text","value":" {Layer}","position":{"start":{"line":258,"column":16,"offset":3585},"end":{"line":258,"column":25,"offset":3594}}}],"position":{"start":{"line":258,"column":1,"offset":3570},"end":{"line":258,"column":25,"offset":3594}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"getlayers-1"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getlayers-1","aria-label":"getlayers 1 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getLayers","position":{"start":{"line":260,"column":5,"offset":3600},"end":{"line":260,"column":14,"offset":3609}}}],"position":{"start":{"line":260,"column":1,"offset":3596},"end":{"line":260,"column":14,"offset":3609}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":" 获取所有的layer","position":{"start":{"line":261,"column":1,"offset":3610},"end":{"line":261,"column":12,"offset":3621}}}],"position":{"start":{"line":261,"column":1,"offset":3610},"end":{"line":261,"column":12,"offset":3621}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getLayers();\n
","position":{"start":{"line":263,"column":1,"offset":3623},"end":{"line":265,"column":4,"offset":3658}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return layers  {array}","position":{"start":{"line":267,"column":1,"offset":3660},"end":{"line":267,"column":24,"offset":3683}}}],"position":{"start":{"line":267,"column":1,"offset":3660},"end":{"line":267,"column":24,"offset":3683}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"事件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E4%BA%8B%E4%BB%B6","aria-label":"事件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"事件","position":{"start":{"line":269,"column":4,"offset":3688},"end":{"line":269,"column":6,"offset":3690}}}],"position":{"start":{"line":269,"column":1,"offset":3685},"end":{"line":269,"column":6,"offset":3690}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"on"},"children":[{"type":"element","tagName":"a","properties":{"href":"#on","aria-label":"on permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"on","position":{"start":{"line":272,"column":5,"offset":3697},"end":{"line":272,"column":7,"offset":3699}}}],"position":{"start":{"line":272,"column":1,"offset":3693},"end":{"line":272,"column":7,"offset":3699}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"事件监听","position":{"start":{"line":273,"column":1,"offset":3700},"end":{"line":273,"column":5,"offset":3704}}}],"position":{"start":{"line":273,"column":1,"offset":3700},"end":{"line":273,"column":5,"offset":3704}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"参数"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E5%8F%82%E6%95%B0","aria-label":"参数 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"参数","position":{"start":{"line":275,"column":6,"offset":3711},"end":{"line":275,"column":8,"offset":3713}}}],"position":{"start":{"line":275,"column":1,"offset":3706},"end":{"line":275,"column":8,"offset":3713}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"raw","value":"eventName","position":{"start":{"line":276,"column":1,"offset":3714},"end":{"line":276,"column":12,"offset":3725}}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":276,"column":12,"offset":3725},"end":{"line":276,"column":26,"offset":3739}}},{"type":"raw","value":"
","position":{"start":{"line":276,"column":26,"offset":3739},"end":{"line":276,"column":32,"offset":3745}}},{"type":"raw","value":"hander","position":{"start":{"line":276,"column":32,"offset":3745},"end":{"line":276,"column":40,"offset":3753}}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":276,"column":40,"offset":3753},"end":{"line":276,"column":60,"offset":3773}}}],"position":{"start":{"line":276,"column":1,"offset":3714},"end":{"line":276,"column":60,"offset":3773}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"off"},"children":[{"type":"element","tagName":"a","properties":{"href":"#off","aria-label":"off permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"off","position":{"start":{"line":279,"column":5,"offset":3780},"end":{"line":279,"column":8,"offset":3783}}}],"position":{"start":{"line":279,"column":1,"offset":3776},"end":{"line":279,"column":8,"offset":3783}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除事件监听","position":{"start":{"line":280,"column":1,"offset":3784},"end":{"line":280,"column":7,"offset":3790}}},{"type":"raw","value":"
","position":{"start":{"line":280,"column":7,"offset":3790},"end":{"line":280,"column":13,"offset":3796}}},{"type":"raw","value":"eventName","position":{"start":{"line":280,"column":13,"offset":3796},"end":{"line":280,"column":24,"offset":3807}}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":280,"column":24,"offset":3807},"end":{"line":280,"column":38,"offset":3821}}},{"type":"raw","value":"
","position":{"start":{"line":280,"column":38,"offset":3821},"end":{"line":280,"column":44,"offset":3827}}},{"type":"raw","value":"hander","position":{"start":{"line":280,"column":44,"offset":3827},"end":{"line":280,"column":52,"offset":3835}}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":280,"column":52,"offset":3835},"end":{"line":280,"column":72,"offset":3855}}}],"position":{"start":{"line":280,"column":1,"offset":3784},"end":{"line":280,"column":72,"offset":3855}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"地图事件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E5%9C%B0%E5%9B%BE%E4%BA%8B%E4%BB%B6","aria-label":"地图事件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"地图事件","position":{"start":{"line":283,"column":5,"offset":3862},"end":{"line":283,"column":9,"offset":3866}}}],"position":{"start":{"line":283,"column":1,"offset":3858},"end":{"line":283,"column":9,"offset":3866}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.on('loaded', () => {}); //地图加载完成触发\nscene.on('mapmove', () => {}); // 地图平移时触发事件\nscene.on('movestart', () => {}); // 地图平移开始时触发\nscene.on('moveend', () => {}); // 地图移动结束后触发,包括平移,以及中心点变化的缩放。如地图有拖拽缓动效果,则在缓动结束后触发\nscene.on('zoomchange', () => {}); // 地图缩放级别更改后触发\nscene.on('zoomstart', () => {}); // 缩放开始时触发\nscene.on('zoomend', () => {}); // 缩放停止时触发\n
","position":{"start":{"line":284,"column":1,"offset":3867},"end":{"line":292,"column":4,"offset":4204}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"鼠标事件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E9%BC%A0%E6%A0%87%E4%BA%8B%E4%BB%B6","aria-label":"鼠标事件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"鼠标事件","position":{"start":{"line":295,"column":5,"offset":4211},"end":{"line":295,"column":9,"offset":4215}}}],"position":{"start":{"line":295,"column":1,"offset":4207},"end":{"line":295,"column":9,"offset":4215}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.on('click', (ev) => {}); // 鼠标左键点击事件\nscene.on('dblclick', (ev) => {}); // 鼠标左键双击事件\nscene.on('mousemove', (ev) => {}); // 鼠标在地图上移动时触发\nscene.on('mousewheel', (ev) => {}); // 鼠标滚轮开始缩放地图时触发\nscene.on('mouseover', (ev) => {}); // 鼠标移入地图容器内时触发\nscene.on('mouseout', (ev) => {}); // 鼠标移出地图容器时触发\nscene.on('mouseup', (ev) => {}); // 鼠标在地图上单击抬起时触发\nscene.on('mousedown', (ev) => {}); // 鼠标在地图上单击按下时触发\nscene.on('rightclick', (ev) => {}); // 鼠标右键单击事件\nscene.on('dragstart', (ev) => {}); //开始拖拽地图时触发\nscene.on('dragging', (ev) => {}); // 拖拽地图过程中触发\nscene.on('dragend', (ev) => {}); //停止拖拽地图时触发。如地图有拖拽缓动效果,则在拽停止,缓动开始前触发\n
","position":{"start":{"line":297,"column":1,"offset":4217},"end":{"line":310,"column":4,"offset":4924}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"其它事件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E5%85%B6%E5%AE%83%E4%BA%8B%E4%BB%B6","aria-label":"其它事件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"其它事件","position":{"start":{"line":312,"column":5,"offset":4930},"end":{"line":312,"column":9,"offset":4934}}}],"position":{"start":{"line":312,"column":1,"offset":4926},"end":{"line":312,"column":9,"offset":4934}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.on('resize', () => {}); // 地图容器大小改变事件\n
","position":{"start":{"line":313,"column":1,"offset":4935},"end":{"line":315,"column":4,"offset":4992}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":318,"column":1,"offset":4995}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-335fc52df6558698584a4c58a93133dc.json b/.cache/caches/gatsby-transformer-remark/diskstore-335fc52df6558698584a4c58a93133dc.json new file mode 100644 index 0000000000..11d6a83512 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-335fc52df6558698584a4c58a93133dc.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-51dbb367647851670b43ae45a9e937df-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

内容

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-34caa57442541fb555e65adf766c9dbf.json b/.cache/caches/gatsby-transformer-remark/diskstore-34caa57442541fb555e65adf766c9dbf.json new file mode 100644 index 0000000000..180fe66efc --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-34caa57442541fb555e65adf766c9dbf.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-ast-51dbb367647851670b43ae45a9e937df-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"内容","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":3,"offset":3}}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":3,"offset":3}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":3,"column":1,"offset":4}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-468b5bae8ef758f28811323986a026ca.json b/.cache/caches/gatsby-transformer-remark/diskstore-468b5bae8ef758f28811323986a026ca.json new file mode 100644 index 0000000000..c1698876db --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-468b5bae8ef758f28811323986a026ca.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-ast-57531815410aa78dc10e42270cb201dd-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"L7 地理空间可视化设计语言","position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":15,"offset":14},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":15,"offset":14},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":2,"column":1,"offset":15}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-479f7412bfaf2ad395f176418584631a.json b/.cache/caches/gatsby-transformer-remark/diskstore-479f7412bfaf2ad395f176418584631a.json new file mode 100644 index 0000000000..ccf18d0280 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-479f7412bfaf2ad395f176418584631a.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-toc-d1a5a1e053cc8aaf5e0018566456ceec-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-4959c881d2fccc57dea5cba657223041.json b/.cache/caches/gatsby-transformer-remark/diskstore-4959c881d2fccc57dea5cba657223041.json new file mode 100644 index 0000000000..f637ccde29 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-4959c881d2fccc57dea5cba657223041.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-ast-99b5b2f90b0432fb92044e231041ffca-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":1,"offset":0}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-51d0f3b693c1d063f395570395293fb4.json b/.cache/caches/gatsby-transformer-remark/diskstore-51d0f3b693c1d063f395570395293fb4.json new file mode 100644 index 0000000000..f7346e7a30 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-51d0f3b693c1d063f395570395293fb4.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-toc-4e775806f930bb554f175748236303d7-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json b/.cache/caches/gatsby-transformer-remark/diskstore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json new file mode 100644 index 0000000000..ec0d0f0b54 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-ast-d1a5a1e053cc8aaf5e0018566456ceec-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"Marker 地图标注 目前只支持2D dom标注","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":26,"offset":26},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":26,"offset":26},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#构造函数","title":null,"children":[],"data":{"hProperties":{"aria-label":"构造函数 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"构造函数","position":{"start":{"line":5,"column":4,"offset":32},"end":{"line":5,"column":8,"offset":36},"indent":[]}}],"position":{"start":{"line":5,"column":1,"offset":29},"end":{"line":5,"column":8,"offset":36},"indent":[]},"data":{"id":"构造函数","htmlAttributes":{"id":"构造函数"},"hProperties":{"id":"构造函数"}}},{"type":"paragraph","children":[{"type":"text","value":"Marker","position":{"start":{"line":6,"column":1,"offset":37},"end":{"line":6,"column":7,"offset":43},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":6,"column":7,"offset":43},"end":{"line":6,"column":13,"offset":49},"indent":[]}},{"type":"html","value":"const Marker = new L7.Marker(option)","position":{"start":{"line":6,"column":13,"offset":49},"end":{"line":6,"column":51,"offset":87},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":37},"end":{"line":6,"column":51,"offset":87},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#option","title":null,"children":[],"data":{"hProperties":{"aria-label":"option permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"option","position":{"start":{"line":9,"column":6,"offset":95},"end":{"line":9,"column":12,"offset":101},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":90},"end":{"line":9,"column":12,"offset":101},"indent":[]},"data":{"id":"option","htmlAttributes":{"id":"option"},"hProperties":{"id":"option"}}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"color        ","position":{"start":{"line":11,"column":3,"offset":105},"end":{"line":11,"column":16,"offset":118},"indent":[]}},{"type":"html","value":"string","position":{"start":{"line":11,"column":16,"offset":118},"end":{"line":11,"column":25,"offset":127},"indent":[]}},{"type":"text","value":"   ","position":{"start":{"line":11,"column":25,"offset":127},"end":{"line":11,"column":28,"offset":130},"indent":[]}},{"type":"image","title":null,"url":"https://cdn.nlark.com/yuque/0/2019/png/104251/1566814628445-4f3152c8-71d1-4908-a651-246c17e507b5.png#align=left&display=inline&height=32&name=map-marker.png&originHeight=32&originWidth=32&size=635&status=done&width=32","alt":"map-marker.png","position":{"start":{"line":11,"column":28,"offset":130},"end":{"line":11,"column":264,"offset":366},"indent":[]}},{"type":"text","value":" 设置默认marker的颜色","position":{"start":{"line":11,"column":264,"offset":366},"end":{"line":11,"column":278,"offset":380},"indent":[]}}],"position":{"start":{"line":11,"column":3,"offset":105},"end":{"line":11,"column":278,"offset":380},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":103},"end":{"line":11,"column":278,"offset":380},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"element    ","position":{"start":{"line":12,"column":3,"offset":383},"end":{"line":12,"column":14,"offset":394},"indent":[]}},{"type":"html","value":"Dom|string","position":{"start":{"line":12,"column":14,"offset":394},"end":{"line":12,"column":26,"offset":406},"indent":[]}},{"type":"text","value":"    自定义marker Dom节点,可以是dom实例,也可以是dom id","position":{"start":{"line":12,"column":26,"offset":406},"end":{"line":12,"column":65,"offset":445},"indent":[]}}],"position":{"start":{"line":12,"column":3,"offset":383},"end":{"line":12,"column":65,"offset":445},"indent":[]}}],"position":{"start":{"line":12,"column":1,"offset":381},"end":{"line":12,"column":65,"offset":445},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"anchor     ","position":{"start":{"line":13,"column":3,"offset":448},"end":{"line":13,"column":14,"offset":459},"indent":[]}},{"type":"html","value":"string","position":{"start":{"line":13,"column":14,"offset":459},"end":{"line":13,"column":22,"offset":467},"indent":[]}},{"type":"text","value":"  锚点位置  支持 center, top, top-left, top-right, bottom, bottom-left,bottom-                        right,left, right","position":{"start":{"line":13,"column":22,"offset":467},"end":{"line":13,"column":135,"offset":580},"indent":[]}}],"position":{"start":{"line":13,"column":3,"offset":448},"end":{"line":13,"column":135,"offset":580},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":446},"end":{"line":13,"column":135,"offset":580},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"offset    ","position":{"start":{"line":14,"column":3,"offset":583},"end":{"line":14,"column":13,"offset":593},"indent":[]}},{"type":"html","value":"Array","position":{"start":{"line":14,"column":13,"offset":593},"end":{"line":14,"column":20,"offset":600},"indent":[]}},{"type":"text","value":"  偏移量 ","position":{"start":{"line":14,"column":20,"offset":600},"end":{"line":14,"column":26,"offset":606},"indent":[]}},{"type":"linkReference","identifier":" 0, 0 ","label":" 0, 0 ","referenceType":"shortcut","children":[{"type":"text","value":" 0, 0 ","position":{"start":{"line":14,"column":27,"offset":607},"end":{"line":14,"column":33,"offset":613},"indent":[]}}],"position":{"start":{"line":14,"column":26,"offset":606},"end":{"line":14,"column":34,"offset":614},"indent":[]}},{"type":"text","value":" 分别表示 X, Y 的偏移量","position":{"start":{"line":14,"column":34,"offset":614},"end":{"line":14,"column":49,"offset":629},"indent":[]}}],"position":{"start":{"line":14,"column":3,"offset":583},"end":{"line":14,"column":49,"offset":629},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":581},"end":{"line":14,"column":49,"offset":629},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":103},"end":{"line":14,"column":49,"offset":629},"indent":[1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#方法","title":null,"children":[],"data":{"hProperties":{"aria-label":"方法 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"方法","position":{"start":{"line":17,"column":4,"offset":635},"end":{"line":17,"column":6,"offset":637},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":632},"end":{"line":17,"column":6,"offset":637},"indent":[]},"data":{"id":"方法","htmlAttributes":{"id":"方法"},"hProperties":{"id":"方法"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#setlnglat","title":null,"children":[],"data":{"hProperties":{"aria-label":"setlnglat permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setLnglat","position":{"start":{"line":19,"column":6,"offset":644},"end":{"line":19,"column":15,"offset":653},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":639},"end":{"line":19,"column":15,"offset":653},"indent":[]},"data":{"id":"setlnglat","htmlAttributes":{"id":"setlnglat"},"hProperties":{"id":"setlnglat"}}},{"type":"paragraph","children":[{"type":"text","value":"设置marker经纬度位置","position":{"start":{"line":20,"column":1,"offset":654},"end":{"line":20,"column":14,"offset":667},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":654},"end":{"line":20,"column":14,"offset":667},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#addto","title":null,"children":[],"data":{"hProperties":{"aria-label":"addto permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"addTo","position":{"start":{"line":22,"column":6,"offset":674},"end":{"line":22,"column":11,"offset":679},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":669},"end":{"line":22,"column":11,"offset":679},"indent":[]},"data":{"id":"addto","htmlAttributes":{"id":"addto"},"hProperties":{"id":"addto"}}},{"type":"paragraph","children":[{"type":"text","value":"将marker添加到地图Scene","position":{"start":{"line":23,"column":1,"offset":680},"end":{"line":23,"column":18,"offset":697},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":680},"end":{"line":23,"column":18,"offset":697},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#remove","title":null,"children":[],"data":{"hProperties":{"aria-label":"remove permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"remove","position":{"start":{"line":25,"column":6,"offset":704},"end":{"line":25,"column":12,"offset":710},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":699},"end":{"line":25,"column":12,"offset":710},"indent":[]},"data":{"id":"remove","htmlAttributes":{"id":"remove"},"hProperties":{"id":"remove"}}},{"type":"paragraph","children":[{"type":"text","value":"移除marker","position":{"start":{"line":26,"column":1,"offset":711},"end":{"line":26,"column":9,"offset":719},"indent":[]}}],"position":{"start":{"line":26,"column":1,"offset":711},"end":{"line":26,"column":9,"offset":719},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#getelement","title":null,"children":[],"data":{"hProperties":{"aria-label":"getelement permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getElement","position":{"start":{"line":28,"column":6,"offset":726},"end":{"line":28,"column":16,"offset":736},"indent":[]}}],"position":{"start":{"line":28,"column":1,"offset":721},"end":{"line":28,"column":16,"offset":736},"indent":[]},"data":{"id":"getelement","htmlAttributes":{"id":"getelement"},"hProperties":{"id":"getelement"}}},{"type":"paragraph","children":[{"type":"text","value":"获取marker dom Element","position":{"start":{"line":29,"column":1,"offset":737},"end":{"line":29,"column":21,"offset":757},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":737},"end":{"line":29,"column":21,"offset":757},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#getlnglat","title":null,"children":[],"data":{"hProperties":{"aria-label":"getlnglat permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getLngLat","position":{"start":{"line":31,"column":6,"offset":764},"end":{"line":31,"column":15,"offset":773},"indent":[]}}],"position":{"start":{"line":31,"column":1,"offset":759},"end":{"line":31,"column":15,"offset":773},"indent":[]},"data":{"id":"getlnglat","htmlAttributes":{"id":"getlnglat"},"hProperties":{"id":"getlnglat"}}},{"type":"paragraph","children":[{"type":"text","value":"获取marker经纬度坐标","position":{"start":{"line":32,"column":1,"offset":774},"end":{"line":32,"column":14,"offset":787},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":774},"end":{"line":32,"column":14,"offset":787},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#togglepopup","title":null,"children":[],"data":{"hProperties":{"aria-label":"togglepopup permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"togglePopup","position":{"start":{"line":34,"column":6,"offset":794},"end":{"line":34,"column":17,"offset":805},"indent":[]}}],"position":{"start":{"line":34,"column":1,"offset":789},"end":{"line":34,"column":17,"offset":805},"indent":[]},"data":{"id":"togglepopup","htmlAttributes":{"id":"togglepopup"},"hProperties":{"id":"togglepopup"}}},{"type":"paragraph","children":[{"type":"text","value":"开启或者关闭marker弹出框","position":{"start":{"line":35,"column":1,"offset":806},"end":{"line":35,"column":16,"offset":821},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":806},"end":{"line":35,"column":16,"offset":821},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#setpopup","title":null,"children":[],"data":{"hProperties":{"aria-label":"setpopup permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setPopup","position":{"start":{"line":37,"column":6,"offset":828},"end":{"line":37,"column":14,"offset":836},"indent":[]}}],"position":{"start":{"line":37,"column":1,"offset":823},"end":{"line":37,"column":14,"offset":836},"indent":[]},"data":{"id":"setpopup","htmlAttributes":{"id":"setpopup"},"hProperties":{"id":"setpopup"}}},{"type":"paragraph","children":[{"type":"text","value":"为marker设置popup","position":{"start":{"line":38,"column":1,"offset":837},"end":{"line":38,"column":15,"offset":851},"indent":[]}}],"position":{"start":{"line":38,"column":1,"offset":837},"end":{"line":38,"column":15,"offset":851},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#getpopup","title":null,"children":[],"data":{"hProperties":{"aria-label":"getpopup permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getPopup","position":{"start":{"line":40,"column":6,"offset":858},"end":{"line":40,"column":14,"offset":866},"indent":[]}}],"position":{"start":{"line":40,"column":1,"offset":853},"end":{"line":40,"column":14,"offset":866},"indent":[]},"data":{"id":"getpopup","htmlAttributes":{"id":"getpopup"},"hProperties":{"id":"getpopup"}}},{"type":"paragraph","children":[{"type":"text","value":"获取marker弹出框","position":{"start":{"line":41,"column":1,"offset":867},"end":{"line":41,"column":12,"offset":878},"indent":[]}}],"position":{"start":{"line":41,"column":1,"offset":867},"end":{"line":41,"column":12,"offset":878},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#示例代码","title":null,"children":[],"data":{"hProperties":{"aria-label":"示例代码 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"示例代码","position":{"start":{"line":44,"column":4,"offset":884},"end":{"line":44,"column":8,"offset":888},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":881},"end":{"line":44,"column":8,"offset":888},"indent":[]},"data":{"id":"示例代码","htmlAttributes":{"id":"示例代码"},"hProperties":{"id":"示例代码"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#默认marker","title":null,"children":[],"data":{"hProperties":{"aria-label":"默认marker permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"默认Marker","position":{"start":{"line":46,"column":6,"offset":895},"end":{"line":46,"column":14,"offset":903},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":890},"end":{"line":46,"column":14,"offset":903},"indent":[]},"data":{"id":"默认marker","htmlAttributes":{"id":"默认marker"},"hProperties":{"id":"默认marker"}}},{"type":"paragraph","children":[{"type":"text","value":"**","position":{"start":{"line":47,"column":1,"offset":904},"end":{"line":47,"column":3,"offset":906},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":47,"column":3,"offset":906},"end":{"line":47,"column":9,"offset":912},"indent":[]}},{"type":"html","value":"const marker = new L7.Marker({color:'blue'})","position":{"start":{"line":47,"column":9,"offset":912},"end":{"line":47,"column":56,"offset":959},"indent":[]}}],"position":{"start":{"line":47,"column":1,"offset":904},"end":{"line":47,"column":56,"offset":959},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#自定义marker","title":null,"children":[],"data":{"hProperties":{"aria-label":"自定义marker permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"自定义Marker","position":{"start":{"line":50,"column":6,"offset":967},"end":{"line":50,"column":15,"offset":976},"indent":[]}}],"position":{"start":{"line":50,"column":1,"offset":962},"end":{"line":50,"column":15,"offset":976},"indent":[]},"data":{"id":"自定义marker","htmlAttributes":{"id":"自定义marker"},"hProperties":{"id":"自定义marker"}}},{"type":"html","lang":"javascript","meta":null,"value":"
var el = document.createElement('label');\nel.className = 'lableclass';\nel.textContent = data[i].v;\nel.style.background = getColor(data[i].v);\nnew L7.Marker({\n  element: el,\n})\n  .setLnglat([data[i].x * 1, data[i].y])\n  .addTo(scene);\n
","position":{"start":{"line":52,"column":1,"offset":978},"end":{"line":62,"column":4,"offset":1281},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#设置-popup","title":null,"children":[],"data":{"hProperties":{"aria-label":"设置 popup permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"设置 popup","position":{"start":{"line":65,"column":6,"offset":1289},"end":{"line":65,"column":14,"offset":1297},"indent":[]}}],"position":{"start":{"line":65,"column":1,"offset":1284},"end":{"line":65,"column":14,"offset":1297},"indent":[]},"data":{"id":"设置-popup","htmlAttributes":{"id":"设置-popup"},"hProperties":{"id":"设置-popup"}}},{"type":"html","lang":"javascript","meta":null,"value":"
var popup = new L7.Popup({\n  anchor: 'left',\n}).setText(item.name);\n\nnew L7.Marker({\n  element: el,\n})\n  .setLnglat(item.coordinates)\n  .setPopup(popup)\n  .addTo(scene);\n
","position":{"start":{"line":67,"column":1,"offset":1299},"end":{"line":77,"column":4,"offset":1499},"indent":[1,1,1,1,1,1,1,1,1,1]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":80,"column":1,"offset":1502}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-5aa0c32748bae2a74e08828fed4fd3a6.json b/.cache/caches/gatsby-transformer-remark/diskstore-5aa0c32748bae2a74e08828fed4fd3a6.json new file mode 100644 index 0000000000..9ecc233750 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-5aa0c32748bae2a74e08828fed4fd3a6.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-ast-d1a5a1e053cc8aaf5e0018566456ceec-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Marker 地图标注 目前只支持2D dom标注","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":26,"offset":26}}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":26,"offset":26}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"构造函数"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0","aria-label":"构造函数 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"构造函数","position":{"start":{"line":5,"column":4,"offset":32},"end":{"line":5,"column":8,"offset":36}}}],"position":{"start":{"line":5,"column":1,"offset":29},"end":{"line":5,"column":8,"offset":36}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Marker","position":{"start":{"line":6,"column":1,"offset":37},"end":{"line":6,"column":7,"offset":43}}},{"type":"raw","value":"
","position":{"start":{"line":6,"column":7,"offset":43},"end":{"line":6,"column":13,"offset":49}}},{"type":"raw","value":"const Marker = new L7.Marker(option)","position":{"start":{"line":6,"column":13,"offset":49},"end":{"line":6,"column":51,"offset":87}}}],"position":{"start":{"line":6,"column":1,"offset":37},"end":{"line":6,"column":51,"offset":87}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"option"},"children":[{"type":"element","tagName":"a","properties":{"href":"#option","aria-label":"option permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"option","position":{"start":{"line":9,"column":6,"offset":95},"end":{"line":9,"column":12,"offset":101}}}],"position":{"start":{"line":9,"column":1,"offset":90},"end":{"line":9,"column":12,"offset":101}}},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"color        ","position":{"start":{"line":11,"column":3,"offset":105},"end":{"line":11,"column":16,"offset":118}}},{"type":"raw","value":"string","position":{"start":{"line":11,"column":16,"offset":118},"end":{"line":11,"column":25,"offset":127}}},{"type":"text","value":"   ","position":{"start":{"line":11,"column":25,"offset":127},"end":{"line":11,"column":28,"offset":130}}},{"type":"element","tagName":"img","properties":{"src":"https://cdn.nlark.com/yuque/0/2019/png/104251/1566814628445-4f3152c8-71d1-4908-a651-246c17e507b5.png#align=left&display=inline&height=32&name=map-marker.png&originHeight=32&originWidth=32&size=635&status=done&width=32","alt":"map-marker.png"},"children":[],"position":{"start":{"line":11,"column":28,"offset":130},"end":{"line":11,"column":264,"offset":366}}},{"type":"text","value":" 设置默认marker的颜色","position":{"start":{"line":11,"column":264,"offset":366},"end":{"line":11,"column":278,"offset":380}}}],"position":{"start":{"line":11,"column":1,"offset":103},"end":{"line":11,"column":278,"offset":380}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"element    ","position":{"start":{"line":12,"column":3,"offset":383},"end":{"line":12,"column":14,"offset":394}}},{"type":"raw","value":"Dom|string","position":{"start":{"line":12,"column":14,"offset":394},"end":{"line":12,"column":26,"offset":406}}},{"type":"text","value":"    自定义marker Dom节点,可以是dom实例,也可以是dom id","position":{"start":{"line":12,"column":26,"offset":406},"end":{"line":12,"column":65,"offset":445}}}],"position":{"start":{"line":12,"column":1,"offset":381},"end":{"line":12,"column":65,"offset":445}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"anchor     ","position":{"start":{"line":13,"column":3,"offset":448},"end":{"line":13,"column":14,"offset":459}}},{"type":"raw","value":"string","position":{"start":{"line":13,"column":14,"offset":459},"end":{"line":13,"column":22,"offset":467}}},{"type":"text","value":"  锚点位置  支持 center, top, top-left, top-right, bottom, bottom-left,bottom-                        right,left, right","position":{"start":{"line":13,"column":22,"offset":467},"end":{"line":13,"column":135,"offset":580}}}],"position":{"start":{"line":13,"column":1,"offset":446},"end":{"line":13,"column":135,"offset":580}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"offset    ","position":{"start":{"line":14,"column":3,"offset":583},"end":{"line":14,"column":13,"offset":593}}},{"type":"raw","value":"Array","position":{"start":{"line":14,"column":13,"offset":593},"end":{"line":14,"column":20,"offset":600}}},{"type":"text","value":"  偏移量 ","position":{"start":{"line":14,"column":20,"offset":600},"end":{"line":14,"column":26,"offset":606}}},{"type":"text","value":"[ 0, 0 ]","position":{"start":{"line":14,"column":27,"offset":607},"end":{"line":14,"column":33,"offset":613}}},{"type":"text","value":" 分别表示 X, Y 的偏移量","position":{"start":{"line":14,"column":34,"offset":614},"end":{"line":14,"column":49,"offset":629}}}],"position":{"start":{"line":14,"column":1,"offset":581},"end":{"line":14,"column":49,"offset":629}}},{"type":"text","value":"\n"}],"position":{"start":{"line":11,"column":1,"offset":103},"end":{"line":14,"column":49,"offset":629}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"方法"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%96%B9%E6%B3%95","aria-label":"方法 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"方法","position":{"start":{"line":17,"column":4,"offset":635},"end":{"line":17,"column":6,"offset":637}}}],"position":{"start":{"line":17,"column":1,"offset":632},"end":{"line":17,"column":6,"offset":637}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"setlnglat"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setlnglat","aria-label":"setlnglat permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setLnglat","position":{"start":{"line":19,"column":6,"offset":644},"end":{"line":19,"column":15,"offset":653}}}],"position":{"start":{"line":19,"column":1,"offset":639},"end":{"line":19,"column":15,"offset":653}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置marker经纬度位置","position":{"start":{"line":20,"column":1,"offset":654},"end":{"line":20,"column":14,"offset":667}}}],"position":{"start":{"line":20,"column":1,"offset":654},"end":{"line":20,"column":14,"offset":667}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"addto"},"children":[{"type":"element","tagName":"a","properties":{"href":"#addto","aria-label":"addto permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"addTo","position":{"start":{"line":22,"column":6,"offset":674},"end":{"line":22,"column":11,"offset":679}}}],"position":{"start":{"line":22,"column":1,"offset":669},"end":{"line":22,"column":11,"offset":679}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"将marker添加到地图Scene","position":{"start":{"line":23,"column":1,"offset":680},"end":{"line":23,"column":18,"offset":697}}}],"position":{"start":{"line":23,"column":1,"offset":680},"end":{"line":23,"column":18,"offset":697}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"remove"},"children":[{"type":"element","tagName":"a","properties":{"href":"#remove","aria-label":"remove permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"remove","position":{"start":{"line":25,"column":6,"offset":704},"end":{"line":25,"column":12,"offset":710}}}],"position":{"start":{"line":25,"column":1,"offset":699},"end":{"line":25,"column":12,"offset":710}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除marker","position":{"start":{"line":26,"column":1,"offset":711},"end":{"line":26,"column":9,"offset":719}}}],"position":{"start":{"line":26,"column":1,"offset":711},"end":{"line":26,"column":9,"offset":719}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"getelement"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getelement","aria-label":"getelement permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getElement","position":{"start":{"line":28,"column":6,"offset":726},"end":{"line":28,"column":16,"offset":736}}}],"position":{"start":{"line":28,"column":1,"offset":721},"end":{"line":28,"column":16,"offset":736}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取marker dom Element","position":{"start":{"line":29,"column":1,"offset":737},"end":{"line":29,"column":21,"offset":757}}}],"position":{"start":{"line":29,"column":1,"offset":737},"end":{"line":29,"column":21,"offset":757}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"getlnglat"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getlnglat","aria-label":"getlnglat permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getLngLat","position":{"start":{"line":31,"column":6,"offset":764},"end":{"line":31,"column":15,"offset":773}}}],"position":{"start":{"line":31,"column":1,"offset":759},"end":{"line":31,"column":15,"offset":773}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取marker经纬度坐标","position":{"start":{"line":32,"column":1,"offset":774},"end":{"line":32,"column":14,"offset":787}}}],"position":{"start":{"line":32,"column":1,"offset":774},"end":{"line":32,"column":14,"offset":787}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"togglepopup"},"children":[{"type":"element","tagName":"a","properties":{"href":"#togglepopup","aria-label":"togglepopup permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"togglePopup","position":{"start":{"line":34,"column":6,"offset":794},"end":{"line":34,"column":17,"offset":805}}}],"position":{"start":{"line":34,"column":1,"offset":789},"end":{"line":34,"column":17,"offset":805}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"开启或者关闭marker弹出框","position":{"start":{"line":35,"column":1,"offset":806},"end":{"line":35,"column":16,"offset":821}}}],"position":{"start":{"line":35,"column":1,"offset":806},"end":{"line":35,"column":16,"offset":821}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"setpopup"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setpopup","aria-label":"setpopup permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setPopup","position":{"start":{"line":37,"column":6,"offset":828},"end":{"line":37,"column":14,"offset":836}}}],"position":{"start":{"line":37,"column":1,"offset":823},"end":{"line":37,"column":14,"offset":836}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"为marker设置popup","position":{"start":{"line":38,"column":1,"offset":837},"end":{"line":38,"column":15,"offset":851}}}],"position":{"start":{"line":38,"column":1,"offset":837},"end":{"line":38,"column":15,"offset":851}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"getpopup"},"children":[{"type":"element","tagName":"a","properties":{"href":"#getpopup","aria-label":"getpopup permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"getPopup","position":{"start":{"line":40,"column":6,"offset":858},"end":{"line":40,"column":14,"offset":866}}}],"position":{"start":{"line":40,"column":1,"offset":853},"end":{"line":40,"column":14,"offset":866}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取marker弹出框","position":{"start":{"line":41,"column":1,"offset":867},"end":{"line":41,"column":12,"offset":878}}}],"position":{"start":{"line":41,"column":1,"offset":867},"end":{"line":41,"column":12,"offset":878}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"示例代码"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81","aria-label":"示例代码 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"示例代码","position":{"start":{"line":44,"column":4,"offset":884},"end":{"line":44,"column":8,"offset":888}}}],"position":{"start":{"line":44,"column":1,"offset":881},"end":{"line":44,"column":8,"offset":888}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"默认marker"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E9%BB%98%E8%AE%A4marker","aria-label":"默认marker permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"默认Marker","position":{"start":{"line":46,"column":6,"offset":895},"end":{"line":46,"column":14,"offset":903}}}],"position":{"start":{"line":46,"column":1,"offset":890},"end":{"line":46,"column":14,"offset":903}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"**","position":{"start":{"line":47,"column":1,"offset":904},"end":{"line":47,"column":3,"offset":906}}},{"type":"raw","value":"
","position":{"start":{"line":47,"column":3,"offset":906},"end":{"line":47,"column":9,"offset":912}}},{"type":"raw","value":"const marker = new L7.Marker({color:'blue'})","position":{"start":{"line":47,"column":9,"offset":912},"end":{"line":47,"column":56,"offset":959}}}],"position":{"start":{"line":47,"column":1,"offset":904},"end":{"line":47,"column":56,"offset":959}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"自定义marker"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E8%87%AA%E5%AE%9A%E4%B9%89marker","aria-label":"自定义marker permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"自定义Marker","position":{"start":{"line":50,"column":6,"offset":967},"end":{"line":50,"column":15,"offset":976}}}],"position":{"start":{"line":50,"column":1,"offset":962},"end":{"line":50,"column":15,"offset":976}}},{"type":"text","value":"\n"},{"type":"raw","value":"
var el = document.createElement('label');\nel.className = 'lableclass';\nel.textContent = data[i].v;\nel.style.background = getColor(data[i].v);\nnew L7.Marker({\n  element: el,\n})\n  .setLnglat([data[i].x * 1, data[i].y])\n  .addTo(scene);\n
","position":{"start":{"line":52,"column":1,"offset":978},"end":{"line":62,"column":4,"offset":1281}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"设置-popup"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E8%AE%BE%E7%BD%AE-popup","aria-label":"设置 popup permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"设置 popup","position":{"start":{"line":65,"column":6,"offset":1289},"end":{"line":65,"column":14,"offset":1297}}}],"position":{"start":{"line":65,"column":1,"offset":1284},"end":{"line":65,"column":14,"offset":1297}}},{"type":"text","value":"\n"},{"type":"raw","value":"
var popup = new L7.Popup({\n  anchor: 'left',\n}).setText(item.name);\n\nnew L7.Marker({\n  element: el,\n})\n  .setLnglat(item.coordinates)\n  .setPopup(popup)\n  .addTo(scene);\n
","position":{"start":{"line":67,"column":1,"offset":1299},"end":{"line":77,"column":4,"offset":1499}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":80,"column":1,"offset":1502}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-5ce457da6f1384d2d0a1c8d65aa7035f.json b/.cache/caches/gatsby-transformer-remark/diskstore-5ce457da6f1384d2d0a1c8d65aa7035f.json new file mode 100644 index 0000000000..6fb1d6eea6 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-5ce457da6f1384d2d0a1c8d65aa7035f.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-ast-a4fdd704fadc6272a50f61c3eb36ad4b-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"heading","depth":1,"children":[{"type":"link","url":"#popup","title":null,"children":[],"data":{"hProperties":{"aria-label":"popup permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"popup","position":{"start":{"line":1,"column":3,"offset":2},"end":{"line":1,"column":8,"offset":7},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":8,"offset":7},"indent":[]},"data":{"id":"popup","htmlAttributes":{"id":"popup"},"hProperties":{"id":"popup"}}},{"type":"paragraph","children":[{"type":"text","value":"地图标注信息窗口,用于展示地图要素的属性信息","position":{"start":{"line":3,"column":1,"offset":9},"end":{"line":3,"column":23,"offset":31},"indent":[]}}],"position":{"start":{"line":3,"column":1,"offset":9},"end":{"line":3,"column":23,"offset":31},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#构造函数","title":null,"children":[],"data":{"hProperties":{"aria-label":"构造函数 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"构造函数","position":{"start":{"line":6,"column":4,"offset":37},"end":{"line":6,"column":8,"offset":41},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":34},"end":{"line":6,"column":8,"offset":41},"indent":[]},"data":{"id":"构造函数","htmlAttributes":{"id":"构造函数"},"hProperties":{"id":"构造函数"}}},{"type":"paragraph","children":[{"type":"text","value":"Popup","position":{"start":{"line":7,"column":1,"offset":42},"end":{"line":7,"column":6,"offset":47},"indent":[]}}],"position":{"start":{"line":7,"column":1,"offset":42},"end":{"line":7,"column":6,"offset":47},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
const popup = new L7.Popup(option);\n
","position":{"start":{"line":9,"column":1,"offset":49},"end":{"line":11,"column":4,"offset":101},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#option","title":null,"children":[],"data":{"hProperties":{"aria-label":"option permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"option","position":{"start":{"line":14,"column":6,"offset":109},"end":{"line":14,"column":12,"offset":115},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":104},"end":{"line":14,"column":12,"offset":115},"indent":[]},"data":{"id":"option","htmlAttributes":{"id":"option"},"hProperties":{"id":"option"}}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"closeButton","position":{"start":{"line":16,"column":3,"offset":119},"end":{"line":16,"column":14,"offset":130},"indent":[]}}],"position":{"start":{"line":16,"column":3,"offset":119},"end":{"line":16,"column":14,"offset":130},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":117},"end":{"line":16,"column":14,"offset":130},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"closeOnClick","position":{"start":{"line":17,"column":3,"offset":133},"end":{"line":17,"column":15,"offset":145},"indent":[]}}],"position":{"start":{"line":17,"column":3,"offset":133},"end":{"line":17,"column":15,"offset":145},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":131},"end":{"line":17,"column":15,"offset":145},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"maxWidth","position":{"start":{"line":18,"column":3,"offset":148},"end":{"line":18,"column":11,"offset":156},"indent":[]}}],"position":{"start":{"line":18,"column":3,"offset":148},"end":{"line":18,"column":11,"offset":156},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":146},"end":{"line":18,"column":11,"offset":156},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"anchor","position":{"start":{"line":19,"column":3,"offset":159},"end":{"line":19,"column":9,"offset":165},"indent":[]}}],"position":{"start":{"line":19,"column":3,"offset":159},"end":{"line":19,"column":9,"offset":165},"indent":[]}}],"position":{"start":{"line":19,"column":1,"offset":157},"end":{"line":19,"column":9,"offset":165},"indent":[]}}],"position":{"start":{"line":16,"column":1,"offset":117},"end":{"line":19,"column":9,"offset":165},"indent":[1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#方法","title":null,"children":[],"data":{"hProperties":{"aria-label":"方法 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"方法","position":{"start":{"line":22,"column":4,"offset":171},"end":{"line":22,"column":6,"offset":173},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":168},"end":{"line":22,"column":6,"offset":173},"indent":[]},"data":{"id":"方法","htmlAttributes":{"id":"方法"},"hProperties":{"id":"方法"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#setlnglat","title":null,"children":[],"data":{"hProperties":{"aria-label":"setlnglat permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setLnglat","position":{"start":{"line":24,"column":6,"offset":180},"end":{"line":24,"column":15,"offset":189},"indent":[]}}],"position":{"start":{"line":24,"column":1,"offset":175},"end":{"line":24,"column":15,"offset":189},"indent":[]},"data":{"id":"setlnglat","htmlAttributes":{"id":"setlnglat"},"hProperties":{"id":"setlnglat"}}},{"type":"paragraph","children":[{"type":"text","value":"设置popup的经纬度位置","position":{"start":{"line":25,"column":1,"offset":190},"end":{"line":25,"column":14,"offset":203},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":25,"column":14,"offset":203},"end":{"line":25,"column":20,"offset":209},"indent":[]}},{"type":"strong","children":[{"type":"text","value":"参数","position":{"start":{"line":25,"column":22,"offset":211},"end":{"line":25,"column":24,"offset":213},"indent":[]}}],"position":{"start":{"line":25,"column":20,"offset":209},"end":{"line":25,"column":26,"offset":215},"indent":[]}},{"type":"text","value":":lnglat 经纬度数组 ","position":{"start":{"line":25,"column":26,"offset":215},"end":{"line":25,"column":40,"offset":229},"indent":[]}},{"type":"linkReference","identifier":"112,32","label":"112,32","referenceType":"shortcut","children":[{"type":"text","value":"112,32","position":{"start":{"line":25,"column":41,"offset":230},"end":{"line":25,"column":47,"offset":236},"indent":[]}}],"position":{"start":{"line":25,"column":40,"offset":229},"end":{"line":25,"column":48,"offset":237},"indent":[]}}],"position":{"start":{"line":25,"column":1,"offset":190},"end":{"line":25,"column":48,"offset":237},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
popup.setLnglat([112, 32]);\n
","position":{"start":{"line":27,"column":1,"offset":239},"end":{"line":29,"column":4,"offset":284},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#addto","title":null,"children":[],"data":{"hProperties":{"aria-label":"addto permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"addTo","position":{"start":{"line":32,"column":6,"offset":292},"end":{"line":32,"column":11,"offset":297},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":287},"end":{"line":32,"column":11,"offset":297},"indent":[]},"data":{"id":"addto","htmlAttributes":{"id":"addto"},"hProperties":{"id":"addto"}}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"参数","position":{"start":{"line":33,"column":3,"offset":300},"end":{"line":33,"column":5,"offset":302},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":298},"end":{"line":33,"column":7,"offset":304},"indent":[]}},{"type":"text","value":":scene 地图scene实例","position":{"start":{"line":33,"column":7,"offset":304},"end":{"line":33,"column":23,"offset":320},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":298},"end":{"line":33,"column":23,"offset":320},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"将popup添加到地图scene显示","position":{"start":{"line":35,"column":1,"offset":322},"end":{"line":35,"column":19,"offset":340},"indent":[]}}],"position":{"start":{"line":35,"column":1,"offset":322},"end":{"line":35,"column":19,"offset":340},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
popup.addTo(scene);\n
","position":{"start":{"line":37,"column":1,"offset":342},"end":{"line":39,"column":4,"offset":379},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#sethtml","title":null,"children":[],"data":{"hProperties":{"aria-label":"sethtml permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setHtml","position":{"start":{"line":42,"column":6,"offset":387},"end":{"line":42,"column":13,"offset":394},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":382},"end":{"line":42,"column":13,"offset":394},"indent":[]},"data":{"id":"sethtml","htmlAttributes":{"id":"sethtml"},"hProperties":{"id":"sethtml"}}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"参数","position":{"start":{"line":43,"column":3,"offset":397},"end":{"line":43,"column":5,"offset":399},"indent":[]}}],"position":{"start":{"line":43,"column":1,"offset":395},"end":{"line":43,"column":7,"offset":401},"indent":[]}},{"type":"text","value":":html 字符串","position":{"start":{"line":43,"column":7,"offset":401},"end":{"line":43,"column":16,"offset":410},"indent":[]}}],"position":{"start":{"line":43,"column":1,"offset":395},"end":{"line":43,"column":16,"offset":410},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"设置popup html 内容","position":{"start":{"line":45,"column":1,"offset":412},"end":{"line":45,"column":16,"offset":427},"indent":[]}}],"position":{"start":{"line":45,"column":1,"offset":412},"end":{"line":45,"column":16,"offset":427},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
var html =\n  '<p>\\u7701\\u4EFD\\uFF1A' +\n  feature.s +\n  '</p>\\n        <p>\\u5730\\u533A\\uFF1A' +\n  feature.m +\n  '</p>\\n        <p>\\u6E29\\u5EA6\\uFF1A' +\n  feature.t +\n  '</p>\\n        ';\npopup.setHtml(html);\n
","position":{"start":{"line":47,"column":1,"offset":429},"end":{"line":51,"column":4,"offset":639},"indent":[1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#settext","title":null,"children":[],"data":{"hProperties":{"aria-label":"settext permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setText","position":{"start":{"line":54,"column":6,"offset":647},"end":{"line":54,"column":13,"offset":654},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":642},"end":{"line":54,"column":13,"offset":654},"indent":[]},"data":{"id":"settext","htmlAttributes":{"id":"settext"},"hProperties":{"id":"settext"}}},{"type":"paragraph","children":[{"type":"text","value":"设置 popup 显示文本内容","position":{"start":{"line":55,"column":1,"offset":655},"end":{"line":55,"column":16,"offset":670},"indent":[]}}],"position":{"start":{"line":55,"column":1,"offset":655},"end":{"line":55,"column":16,"offset":670},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
popup.setText('hello world');\n
","position":{"start":{"line":57,"column":1,"offset":672},"end":{"line":59,"column":4,"offset":719},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#remove","title":null,"children":[],"data":{"hProperties":{"aria-label":"remove permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"remove","position":{"start":{"line":62,"column":6,"offset":727},"end":{"line":62,"column":12,"offset":733},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":722},"end":{"line":62,"column":12,"offset":733},"indent":[]},"data":{"id":"remove","htmlAttributes":{"id":"remove"},"hProperties":{"id":"remove"}}},{"type":"paragraph","children":[{"type":"text","value":"移除popup","position":{"start":{"line":63,"column":1,"offset":734},"end":{"line":63,"column":8,"offset":741},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":734},"end":{"line":63,"column":8,"offset":741},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
popup.remove();\n
","position":{"start":{"line":65,"column":1,"offset":743},"end":{"line":67,"column":4,"offset":775},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#事件","title":null,"children":[],"data":{"hProperties":{"aria-label":"事件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"事件","position":{"start":{"line":70,"column":4,"offset":781},"end":{"line":70,"column":6,"offset":783},"indent":[]}}],"position":{"start":{"line":70,"column":1,"offset":778},"end":{"line":70,"column":6,"offset":783},"indent":[]},"data":{"id":"事件","htmlAttributes":{"id":"事件"},"hProperties":{"id":"事件"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#close","title":null,"children":[],"data":{"hProperties":{"aria-label":"close permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"close","position":{"start":{"line":72,"column":6,"offset":790},"end":{"line":72,"column":11,"offset":795},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":785},"end":{"line":72,"column":11,"offset":795},"indent":[]},"data":{"id":"close","htmlAttributes":{"id":"close"},"hProperties":{"id":"close"}}},{"type":"html","lang":"javascript","meta":null,"value":"
popup.on('close', () => {});\n
","position":{"start":{"line":74,"column":1,"offset":797},"end":{"line":76,"column":4,"offset":839},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#示例代码","title":null,"children":[],"data":{"hProperties":{"aria-label":"示例代码 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"示例代码","position":{"start":{"line":79,"column":4,"offset":845},"end":{"line":79,"column":8,"offset":849},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":842},"end":{"line":79,"column":8,"offset":849},"indent":[]},"data":{"id":"示例代码","htmlAttributes":{"id":"示例代码"},"hProperties":{"id":"示例代码"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#添加popup","title":null,"children":[],"data":{"hProperties":{"aria-label":"添加popup permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"添加popup","position":{"start":{"line":81,"column":6,"offset":856},"end":{"line":81,"column":13,"offset":863},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":851},"end":{"line":81,"column":13,"offset":863},"indent":[]},"data":{"id":"添加popup","htmlAttributes":{"id":"添加popup"},"hProperties":{"id":"添加popup"}}},{"type":"html","lang":null,"meta":null,"value":"
  var html = '<p>'+feature.m+'</p>';\n  const new L7.Popup().setLnglat([112, 32]).setHTML(html).addTo(scene);
","position":{"start":{"line":83,"column":1,"offset":865},"end":{"line":86,"column":4,"offset":981},"indent":[1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#faq","title":null,"children":[],"data":{"hProperties":{"aria-label":"faq permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"FAQ","position":{"start":{"line":88,"column":5,"offset":987},"end":{"line":88,"column":8,"offset":990},"indent":[]}}],"position":{"start":{"line":88,"column":1,"offset":983},"end":{"line":88,"column":8,"offset":990},"indent":[]},"data":{"id":"faq","htmlAttributes":{"id":"faq"},"hProperties":{"id":"faq"}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":89,"column":1,"offset":991}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-60ffaa0253ce67428f5a7e31a4a0bad1.json b/.cache/caches/gatsby-transformer-remark/diskstore-60ffaa0253ce67428f5a7e31a4a0bad1.json new file mode 100644 index 0000000000..2bc8cb0c5f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-60ffaa0253ce67428f5a7e31a4a0bad1.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-b1a6eb4a5fb92e03f562537f31f11c68-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

数据

\n

目前L7支持的数据格式有GeoJson,CSV,JSon Image

\n

GeoJSON 支持点、线、面,等所有的空间数据格式。
CSV 支持,点,线段,弧线的支持。
JSON 支持简单的点、线,面,不支持多点,多线的,多面数据格式。

\n

GeoJSON

\n
\n

GeoJSON是一种对各种地理数据结构进行编码的格式。GeoJSON对象可以表示几何、特征或者特征集合。GeoJSON支持下面几何类型:点、线、面、多点、多线、多面和几何集合。GeoJSON里的特征包含一个几何对象和其他属性,特征集合表示一系列特征。

\n
\n
{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n    {\n      \"type\": \"Feature\",\n      \"properties\": {},\n      \"geometry\": {\n        \"type\": \"Polygon\",\n        \"coordinates\": [\n          [\n            [110.478515625, 32.76880048488168],\n            [117.68554687499999, 32.76880048488168],\n            [117.68554687499999, 37.64903402157866],\n            [110.478515625, 37.64903402157866],\n            [110.478515625, 32.76880048488168]\n          ]\n        ]\n      }\n    }\n  ]\n}\n
\n

地理统计分析工具

\n

turfjs:  地理数据计算,处理,统计,分析的Javascript 库

\n

在线工具

\n

http://geojson.io/    可以在线查看,绘制,修改GeoJSON数据

\n

https://mapshaper.org/  可以查看较大的geojson,还能够简化GeoJSON数据

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-6195db1b342fb1235a247e18694e1cc8.json b/.cache/caches/gatsby-transformer-remark/diskstore-6195db1b342fb1235a247e18694e1cc8.json new file mode 100644 index 0000000000..b7e199c59e --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-6195db1b342fb1235a247e18694e1cc8.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-ast-4e775806f930bb554f175748236303d7-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"heading","depth":1,"children":[{"type":"link","url":"#control","title":null,"children":[],"data":{"hProperties":{"aria-label":"control permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"control","position":{"start":{"line":1,"column":3,"offset":2},"end":{"line":1,"column":10,"offset":9},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":10,"offset":9},"indent":[]},"data":{"id":"control","htmlAttributes":{"id":"control"},"hProperties":{"id":"control"}}},{"type":"paragraph","children":[{"type":"text","value":"地图组件 用于控制地图的状态如果平移,缩放,或者展示地图一些的辅助信息如图例,比例尺","position":{"start":{"line":3,"column":1,"offset":11},"end":{"line":3,"column":43,"offset":53},"indent":[]}}],"position":{"start":{"line":3,"column":1,"offset":11},"end":{"line":3,"column":43,"offset":53},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#构造函数","title":null,"children":[],"data":{"hProperties":{"aria-label":"构造函数 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"构造函数","position":{"start":{"line":6,"column":4,"offset":59},"end":{"line":6,"column":8,"offset":63},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":56},"end":{"line":6,"column":8,"offset":63},"indent":[]},"data":{"id":"构造函数","htmlAttributes":{"id":"构造函数"},"hProperties":{"id":"构造函数"}}},{"type":"html","lang":"javascript","meta":null,"value":"
const baseControl = new L7.Control.Base(option);\n
","position":{"start":{"line":8,"column":1,"offset":65},"end":{"line":10,"column":4,"offset":131},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#option","title":null,"children":[],"data":{"hProperties":{"aria-label":"option permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"option","position":{"start":{"line":13,"column":6,"offset":139},"end":{"line":13,"column":12,"offset":145},"indent":[]}}],"position":{"start":{"line":13,"column":1,"offset":134},"end":{"line":13,"column":12,"offset":145},"indent":[]},"data":{"id":"option","htmlAttributes":{"id":"option"},"hProperties":{"id":"option"}}},{"type":"paragraph","children":[{"type":"text","value":" position: ","position":{"start":{"line":14,"column":1,"offset":146},"end":{"line":14,"column":12,"offset":157},"indent":[]}},{"type":"html","value":"string","position":{"start":{"line":14,"column":12,"offset":157},"end":{"line":14,"column":20,"offset":165},"indent":[]}},{"type":"text","value":" 控件位置支持是个方位 ","position":{"start":{"line":14,"column":20,"offset":165},"end":{"line":14,"column":32,"offset":177},"indent":[]}},{"type":"html","value":"bottomright, topright, bottomleft, topleft","position":{"start":{"line":14,"column":32,"offset":177},"end":{"line":14,"column":76,"offset":221},"indent":[]}}],"position":{"start":{"line":14,"column":1,"offset":146},"end":{"line":14,"column":76,"offset":221},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#scene-内置地图组件","title":null,"children":[],"data":{"hProperties":{"aria-label":"scene 内置地图组件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"scene 内置地图组件","position":{"start":{"line":17,"column":6,"offset":229},"end":{"line":17,"column":18,"offset":241},"indent":[]}}],"position":{"start":{"line":17,"column":1,"offset":224},"end":{"line":17,"column":18,"offset":241},"indent":[]},"data":{"id":"scene-内置地图组件","htmlAttributes":{"id":"scene-内置地图组件"},"hProperties":{"id":"scene-内置地图组件"}}},{"type":"paragraph","children":[{"type":"text","value":"zoom 地图放大缩小  默认添加","position":{"start":{"line":18,"column":1,"offset":242},"end":{"line":18,"column":18,"offset":259},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":18,"column":18,"offset":259},"end":{"line":18,"column":24,"offset":265},"indent":[]}},{"type":"text","value":"Scale 地图比例尺   默认添加","position":{"start":{"line":18,"column":24,"offset":265},"end":{"line":18,"column":42,"offset":283},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":18,"column":42,"offset":283},"end":{"line":18,"column":48,"offset":289},"indent":[]}},{"type":"text","value":"attribution 地图数据属性  默认添加","position":{"start":{"line":18,"column":48,"offset":289},"end":{"line":18,"column":72,"offset":313},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":18,"column":72,"offset":313},"end":{"line":18,"column":78,"offset":319},"indent":[]}},{"type":"text","value":"layer 图层列表","position":{"start":{"line":18,"column":78,"offset":319},"end":{"line":18,"column":88,"offset":329},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":242},"end":{"line":18,"column":88,"offset":329},"indent":[]}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"scene配置项设置控件添加状态","position":{"start":{"line":20,"column":3,"offset":333},"end":{"line":20,"column":19,"offset":349},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":331},"end":{"line":20,"column":21,"offset":351},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":331},"end":{"line":20,"column":21,"offset":351},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene = new L7.scene({\n  zoomControl: true,\n  scaleControl: true,\n  attributionControl: true,\n});\n
","position":{"start":{"line":22,"column":1,"offset":353},"end":{"line":28,"column":4,"offset":469},"indent":[1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#","title":null,"children":[],"data":{"hProperties":{"aria-label":" permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}}],"position":{"start":{"line":30,"column":1,"offset":471},"end":{"line":30,"column":6,"offset":476},"indent":[]},"data":{"id":"","htmlAttributes":{"id":""},"hProperties":{"id":""}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#zoom","title":null,"children":[],"data":{"hProperties":{"aria-label":"zoom permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"Zoom","position":{"start":{"line":32,"column":6,"offset":483},"end":{"line":32,"column":10,"offset":487},"indent":[]}}],"position":{"start":{"line":32,"column":1,"offset":478},"end":{"line":32,"column":10,"offset":487},"indent":[]},"data":{"id":"zoom","htmlAttributes":{"id":"zoom"},"hProperties":{"id":"zoom"}}},{"type":"paragraph","children":[{"type":"text","value":"放大缩小组件 默认 左上角","position":{"start":{"line":33,"column":1,"offset":488},"end":{"line":33,"column":14,"offset":501},"indent":[]}}],"position":{"start":{"line":33,"column":1,"offset":488},"end":{"line":33,"column":14,"offset":501},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
new L7.Control.Zoom({\n  position: 'topleft',\n}).addTo(scene);\n
","position":{"start":{"line":35,"column":1,"offset":503},"end":{"line":39,"column":4,"offset":590},"indent":[1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#scale","title":null,"children":[],"data":{"hProperties":{"aria-label":"scale permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"Scale","position":{"start":{"line":42,"column":6,"offset":598},"end":{"line":42,"column":11,"offset":603},"indent":[]}}],"position":{"start":{"line":42,"column":1,"offset":593},"end":{"line":42,"column":11,"offset":603},"indent":[]},"data":{"id":"scale","htmlAttributes":{"id":"scale"},"hProperties":{"id":"scale"}}},{"type":"paragraph","children":[{"type":"text","value":"比例尺组件默认左下角","position":{"start":{"line":43,"column":1,"offset":604},"end":{"line":43,"column":11,"offset":614},"indent":[]}}],"position":{"start":{"line":43,"column":1,"offset":604},"end":{"line":43,"column":11,"offset":614},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
new L7.Control.Scale({\n  position: 'bottomleft',\n}).addTo(scene);\n
","position":{"start":{"line":45,"column":1,"offset":616},"end":{"line":49,"column":4,"offset":707},"indent":[1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#attribution","title":null,"children":[],"data":{"hProperties":{"aria-label":"attribution permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"attribution","position":{"start":{"line":52,"column":6,"offset":715},"end":{"line":52,"column":17,"offset":726},"indent":[]}}],"position":{"start":{"line":52,"column":1,"offset":710},"end":{"line":52,"column":17,"offset":726},"indent":[]},"data":{"id":"attribution","htmlAttributes":{"id":"attribution"},"hProperties":{"id":"attribution"}}},{"type":"paragraph","children":[{"type":"text","value":"默认右下角","position":{"start":{"line":53,"column":1,"offset":727},"end":{"line":53,"column":6,"offset":732},"indent":[]}}],"position":{"start":{"line":53,"column":1,"offset":727},"end":{"line":53,"column":6,"offset":732},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
new L7.Control.Attribution({\n  position: 'bottomleft',\n}).addTo(scene);\n
","position":{"start":{"line":55,"column":1,"offset":734},"end":{"line":59,"column":4,"offset":830},"indent":[1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#layer","title":null,"children":[],"data":{"hProperties":{"aria-label":"layer permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"layer","position":{"start":{"line":62,"column":6,"offset":838},"end":{"line":62,"column":11,"offset":843},"indent":[]}}],"position":{"start":{"line":62,"column":1,"offset":833},"end":{"line":62,"column":11,"offset":843},"indent":[]},"data":{"id":"layer","htmlAttributes":{"id":"layer"},"hProperties":{"id":"layer"}}},{"type":"paragraph","children":[{"type":"text","value":"图层列表目前只支持可视化overlayers 图层控制","position":{"start":{"line":63,"column":1,"offset":844},"end":{"line":63,"column":28,"offset":871},"indent":[]}}],"position":{"start":{"line":63,"column":1,"offset":844},"end":{"line":63,"column":28,"offset":871},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
var overlayers = {\n  围栏填充: layer,\n  围栏边界: layer2,\n};\nnew L7.Control.Layers({\n  overlayers: overlayers,\n}).addTo(scene);\n
","position":{"start":{"line":65,"column":1,"offset":873},"end":{"line":73,"column":4,"offset":1031},"indent":[1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#方法","title":null,"children":[],"data":{"hProperties":{"aria-label":"方法 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"方法","position":{"start":{"line":76,"column":4,"offset":1037},"end":{"line":76,"column":6,"offset":1039},"indent":[]}}],"position":{"start":{"line":76,"column":1,"offset":1034},"end":{"line":76,"column":6,"offset":1039},"indent":[]},"data":{"id":"方法","htmlAttributes":{"id":"方法"},"hProperties":{"id":"方法"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#onadd","title":null,"children":[],"data":{"hProperties":{"aria-label":"onadd permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"onAdd","position":{"start":{"line":78,"column":6,"offset":1046},"end":{"line":78,"column":11,"offset":1051},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":1041},"end":{"line":78,"column":11,"offset":1051},"indent":[]},"data":{"id":"onadd","htmlAttributes":{"id":"onadd"},"hProperties":{"id":"onadd"}}},{"type":"paragraph","children":[{"type":"text","value":"组件添加到地图Scene时调用,自定义组件时需要实现此方法","position":{"start":{"line":79,"column":1,"offset":1052},"end":{"line":79,"column":30,"offset":1081},"indent":[]}}],"position":{"start":{"line":79,"column":1,"offset":1052},"end":{"line":79,"column":30,"offset":1081},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#addto","title":null,"children":[],"data":{"hProperties":{"aria-label":"addto permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"addTo","position":{"start":{"line":82,"column":6,"offset":1089},"end":{"line":82,"column":11,"offset":1094},"indent":[]}}],"position":{"start":{"line":82,"column":1,"offset":1084},"end":{"line":82,"column":11,"offset":1094},"indent":[]},"data":{"id":"addto","htmlAttributes":{"id":"addto"},"hProperties":{"id":"addto"}}},{"type":"paragraph","children":[{"type":"text","value":"添加到地图scene","position":{"start":{"line":83,"column":1,"offset":1095},"end":{"line":83,"column":11,"offset":1105},"indent":[]}}],"position":{"start":{"line":83,"column":1,"offset":1095},"end":{"line":83,"column":11,"offset":1105},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
control.addTo(scene);\n
","position":{"start":{"line":85,"column":1,"offset":1107},"end":{"line":87,"column":4,"offset":1146},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#setposition","title":null,"children":[],"data":{"hProperties":{"aria-label":"setposition permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setPosition","position":{"start":{"line":90,"column":6,"offset":1154},"end":{"line":90,"column":17,"offset":1165},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":1149},"end":{"line":90,"column":17,"offset":1165},"indent":[]},"data":{"id":"setposition","htmlAttributes":{"id":"setposition"},"hProperties":{"id":"setposition"}}},{"type":"paragraph","children":[{"type":"text","value":"设置组件位置","position":{"start":{"line":91,"column":1,"offset":1166},"end":{"line":91,"column":7,"offset":1172},"indent":[]}}],"position":{"start":{"line":91,"column":1,"offset":1166},"end":{"line":91,"column":7,"offset":1172},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
control.setPosition('bottomright');\n
","position":{"start":{"line":93,"column":1,"offset":1174},"end":{"line":95,"column":4,"offset":1227},"indent":[1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#remove","title":null,"children":[],"data":{"hProperties":{"aria-label":"remove permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"remove","position":{"start":{"line":98,"column":6,"offset":1235},"end":{"line":98,"column":12,"offset":1241},"indent":[]}}],"position":{"start":{"line":98,"column":1,"offset":1230},"end":{"line":98,"column":12,"offset":1241},"indent":[]},"data":{"id":"remove","htmlAttributes":{"id":"remove"},"hProperties":{"id":"remove"}}},{"type":"paragraph","children":[{"type":"text","value":"移除地图组件","position":{"start":{"line":99,"column":1,"offset":1242},"end":{"line":99,"column":7,"offset":1248},"indent":[]}}],"position":{"start":{"line":99,"column":1,"offset":1242},"end":{"line":99,"column":7,"offset":1248},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
control.remove();\n
","position":{"start":{"line":101,"column":1,"offset":1250},"end":{"line":103,"column":4,"offset":1285},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#示例代码","title":null,"children":[],"data":{"hProperties":{"aria-label":"示例代码 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"示例代码","position":{"start":{"line":107,"column":4,"offset":1292},"end":{"line":107,"column":8,"offset":1296},"indent":[]}}],"position":{"start":{"line":107,"column":1,"offset":1289},"end":{"line":107,"column":8,"offset":1296},"indent":[]},"data":{"id":"示例代码","htmlAttributes":{"id":"示例代码"},"hProperties":{"id":"示例代码"}}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#自定义图例控件","title":null,"children":[],"data":{"hProperties":{"aria-label":"自定义图例控件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"自定义图例控件","position":{"start":{"line":110,"column":6,"offset":1304},"end":{"line":110,"column":13,"offset":1311},"indent":[]}}],"position":{"start":{"line":110,"column":1,"offset":1299},"end":{"line":110,"column":13,"offset":1311},"indent":[]},"data":{"id":"自定义图例控件","htmlAttributes":{"id":"自定义图例控件"},"hProperties":{"id":"自定义图例控件"}}},{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://antv.alipay.com/zh-cn/l7/1.x/demo/component/extendControl.html","children":[{"type":"text","value":"源码","position":{"start":{"line":111,"column":2,"offset":1313},"end":{"line":111,"column":4,"offset":1315},"indent":[]}}],"position":{"start":{"line":111,"column":1,"offset":1312},"end":{"line":111,"column":77,"offset":1388},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}}],"position":{"start":{"line":111,"column":1,"offset":1312},"end":{"line":111,"column":77,"offset":1388},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
var legend = new L7.Control.Base({\n  position: 'bottomright',\n});\nlegend.onAdd = function() {\n  var el = document.createElement('div');\n  el.className = 'infolegend legend';\n  var grades = [0, 8, 15, 30, 65, 120];\n  for (var i = 0; i < grades.length; i++) {\n    el.innerHTML +=\n      '<i style=\"background:' +\n      colors[i] +\n      '\"></i> ' +\n      grades[i] +\n      (grades[i + 1] ? '–' + grades[i + 1] + '<br>' : '+');\n  }\n  return el;\n};\nlegend.addTo(scene);\n
","position":{"start":{"line":113,"column":1,"offset":1390},"end":{"line":128,"column":4,"offset":1914},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#-1","title":null,"children":[],"data":{"hProperties":{"aria-label":" 1 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}}],"position":{"start":{"line":130,"column":1,"offset":1916},"end":{"line":130,"column":4,"offset":1919},"indent":[]},"data":{"id":"-1","htmlAttributes":{"id":"-1"},"hProperties":{"id":"-1"}}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#faq","title":null,"children":[],"data":{"hProperties":{"aria-label":"faq permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"FAQ","position":{"start":{"line":132,"column":4,"offset":1924},"end":{"line":132,"column":7,"offset":1927},"indent":[]}}],"position":{"start":{"line":132,"column":1,"offset":1921},"end":{"line":132,"column":7,"offset":1927},"indent":[]},"data":{"id":"faq","htmlAttributes":{"id":"faq"},"hProperties":{"id":"faq"}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":134,"column":1,"offset":1929}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-61c1d71d82d9e8cb724bc675e994ee07.json b/.cache/caches/gatsby-transformer-remark/diskstore-61c1d71d82d9e8cb724bc675e994ee07.json new file mode 100644 index 0000000000..cb2ca352e7 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-61c1d71d82d9e8cb724bc675e994ee07.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-ast-6c75c6b34b379d2a97680d76e3983681-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"link","url":"#简介","title":null,"children":[],"data":{"hProperties":{"aria-label":"简介 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"简介","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":6,"offset":6},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":6,"offset":6},"indent":[]},"data":{"id":"简介","htmlAttributes":{"id":"简介"},"hProperties":{"id":"简介"}}},{"type":"paragraph","children":[{"type":"html","value":"Scene","position":{"start":{"line":3,"column":1,"offset":7},"end":{"line":3,"column":9,"offset":15},"indent":[]}},{"type":"text","value":"基础的地图类,提供地图创建,图层创建,管理等功能","position":{"start":{"line":3,"column":9,"offset":15},"end":{"line":3,"column":33,"offset":39},"indent":[]}}],"position":{"start":{"line":3,"column":1,"offset":7},"end":{"line":3,"column":33,"offset":39},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"示例代码","position":{"start":{"line":5,"column":1,"offset":41},"end":{"line":5,"column":5,"offset":45},"indent":[]}}],"position":{"start":{"line":5,"column":1,"offset":41},"end":{"line":5,"column":5,"offset":45},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
import {Scene} from '@l7/scene';\nconst scene =new L7.Scene({\n    id:'map'\n    mapStyle:'dark',\n    center:[ 110.770672, 34.159869 ],\n    pitch:45\n})
","position":{"start":{"line":7,"column":1,"offset":47},"end":{"line":15,"column":4,"offset":213},"indent":[1,1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#构造函数","title":null,"children":[],"data":{"hProperties":{"aria-label":"构造函数 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"构造函数","position":{"start":{"line":18,"column":5,"offset":220},"end":{"line":18,"column":9,"offset":224},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":216},"end":{"line":18,"column":9,"offset":224},"indent":[]},"data":{"id":"构造函数","htmlAttributes":{"id":"构造函数"},"hProperties":{"id":"构造函数"}}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Scene","position":{"start":{"line":20,"column":3,"offset":228},"end":{"line":20,"column":8,"offset":233},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":226},"end":{"line":20,"column":10,"offset":235},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":20,"column":10,"offset":235},"end":{"line":20,"column":16,"offset":241},"indent":[]}},{"type":"text","value":"支持两种实例化方式","position":{"start":{"line":20,"column":16,"offset":241},"end":{"line":20,"column":25,"offset":250},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":226},"end":{"line":20,"column":25,"offset":250},"indent":[]}},{"type":"list","ordered":false,"start":null,"spread":false,"children":[{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"独立实例化 内部根据id自动穿件地图实例","position":{"start":{"line":22,"column":3,"offset":254},"end":{"line":22,"column":23,"offset":274},"indent":[]}}],"position":{"start":{"line":22,"column":3,"offset":254},"end":{"line":22,"column":23,"offset":274},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":252},"end":{"line":22,"column":23,"offset":274},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"传入地图实例","position":{"start":{"line":23,"column":3,"offset":277},"end":{"line":23,"column":9,"offset":283},"indent":[]}}],"position":{"start":{"line":23,"column":3,"offset":277},"end":{"line":23,"column":9,"offset":283},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":275},"end":{"line":23,"column":9,"offset":283},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":252},"end":{"line":23,"column":9,"offset":283},"indent":[1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#独立实例化-scene","title":null,"children":[],"data":{"hProperties":{"aria-label":"独立实例化 scene permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"独立实例化 Scene","position":{"start":{"line":29,"column":6,"offset":294},"end":{"line":29,"column":17,"offset":305},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":289},"end":{"line":29,"column":17,"offset":305},"indent":[]},"data":{"id":"独立实例化-scene","htmlAttributes":{"id":"独立实例化-scene"},"hProperties":{"id":"独立实例化-scene"}}},{"type":"html","lang":"javascript","meta":null,"value":"
const scene = new L7.Scene({\n  id: 'map',\n  mapStyle: 'dark',\n  center: [120.19382669582967, 30.258134],\n  pitch: 0,\n  zoom: 12,\n  maxZoom: 20,\n  minZoom: 0,\n});\n
","position":{"start":{"line":31,"column":1,"offset":307},"end":{"line":41,"column":4,"offset":487},"indent":[1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#根据map-实例创建sence","title":null,"children":[],"data":{"hProperties":{"aria-label":"根据map 实例创建sence permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"根据map 实例创建Sence","position":{"start":{"line":44,"column":6,"offset":495},"end":{"line":44,"column":21,"offset":510},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":490},"end":{"line":44,"column":21,"offset":510},"indent":[]},"data":{"id":"根据map-实例创建sence","htmlAttributes":{"id":"根据map-实例创建sence"},"hProperties":{"id":"根据map-实例创建sence"}}},{"type":"paragraph","children":[{"type":"text","value":"_L7 基于高德地图3D模式开发的,因此传入Map实例 _","position":{"start":{"line":46,"column":1,"offset":512},"end":{"line":46,"column":30,"offset":541},"indent":[]}},{"type":"emphasis","children":[{"type":"text","value":"viewModes需要设置成3d","position":{"start":{"line":46,"column":31,"offset":542},"end":{"line":46,"column":47,"offset":558},"indent":[]}}],"position":{"start":{"line":46,"column":30,"offset":541},"end":{"line":46,"column":48,"offset":559},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":46,"column":48,"offset":559},"end":{"line":46,"column":54,"offset":565},"indent":[]}},{"type":"text","value":"_","position":{"start":{"line":46,"column":54,"offset":565},"end":{"line":46,"column":55,"offset":566},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":512},"end":{"line":46,"column":55,"offset":566},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
var mapinstance = new AMap.Map('map', {\n  center: [120.19382669582967, 30.258134],\n  viewMode: '3D',\n  pitch: 0,\n  zoom: 12,\n  maxZoom: 20,\n  minZoom: 0,\n});\n\nconst scene = new L7.Scene({\n  mapStyle: 'dark',\n  map: mapinstance,\n});\n
","position":{"start":{"line":47,"column":1,"offset":567},"end":{"line":61,"column":4,"offset":826},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#map","title":null,"children":[],"data":{"hProperties":{"aria-label":"map permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"map","position":{"start":{"line":64,"column":4,"offset":832},"end":{"line":64,"column":7,"offset":835},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":829},"end":{"line":64,"column":7,"offset":835},"indent":[]},"data":{"id":"map","htmlAttributes":{"id":"map"},"hProperties":{"id":"map"}}},{"type":"paragraph","children":[{"type":"text","value":"L7 在scene 下保留了高德地图实例,可以通过scene.map 调用高德地图的map方法。","position":{"start":{"line":65,"column":1,"offset":836},"end":{"line":65,"column":49,"offset":884},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":65,"column":49,"offset":884},"end":{"line":65,"column":55,"offset":890},"indent":[]}},{"type":"text","value":"map 实例方法见","position":{"start":{"line":65,"column":55,"offset":890},"end":{"line":65,"column":64,"offset":899},"indent":[]}},{"type":"link","title":null,"url":"https://lbs.amap.com/api/javascript-api/reference/map","children":[{"type":"text","value":"高德地图文档","position":{"start":{"line":65,"column":65,"offset":900},"end":{"line":65,"column":71,"offset":906},"indent":[]}}],"position":{"start":{"line":65,"column":64,"offset":899},"end":{"line":65,"column":127,"offset":962},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}}],"position":{"start":{"line":65,"column":1,"offset":836},"end":{"line":65,"column":127,"offset":962},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.map;\n
","position":{"start":{"line":67,"column":1,"offset":964},"end":{"line":69,"column":4,"offset":991},"indent":[1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#构造类","title":null,"children":[],"data":{"hProperties":{"aria-label":"构造类 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"构造类","position":{"start":{"line":72,"column":4,"offset":997},"end":{"line":72,"column":7,"offset":1000},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":994},"end":{"line":72,"column":7,"offset":1000},"indent":[]},"data":{"id":"构造类","htmlAttributes":{"id":"构造类"},"hProperties":{"id":"构造类"}}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#pointlayer","title":null,"children":[],"data":{"hProperties":{"aria-label":"pointlayer permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"PointLayer","position":{"start":{"line":74,"column":5,"offset":1006},"end":{"line":74,"column":15,"offset":1016},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":1002},"end":{"line":74,"column":15,"offset":1016},"indent":[]},"data":{"id":"pointlayer","htmlAttributes":{"id":"pointlayer"},"hProperties":{"id":"pointlayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建点图层","position":{"start":{"line":75,"column":1,"offset":1017},"end":{"line":75,"column":6,"offset":1022},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":1017},"end":{"line":75,"column":6,"offset":1022},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#polylinelayer","title":null,"children":[],"data":{"hProperties":{"aria-label":"polylinelayer permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"PolylineLayer","position":{"start":{"line":77,"column":5,"offset":1028},"end":{"line":77,"column":18,"offset":1041},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":1024},"end":{"line":77,"column":18,"offset":1041},"indent":[]},"data":{"id":"polylinelayer","htmlAttributes":{"id":"polylinelayer"},"hProperties":{"id":"polylinelayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建线图层","position":{"start":{"line":78,"column":1,"offset":1042},"end":{"line":78,"column":6,"offset":1047},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":1042},"end":{"line":78,"column":6,"offset":1047},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#polygonlayer","title":null,"children":[],"data":{"hProperties":{"aria-label":"polygonlayer permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"PolygonLayer","position":{"start":{"line":80,"column":5,"offset":1053},"end":{"line":80,"column":17,"offset":1065},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":1049},"end":{"line":80,"column":17,"offset":1065},"indent":[]},"data":{"id":"polygonlayer","htmlAttributes":{"id":"polygonlayer"},"hProperties":{"id":"polygonlayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建面图层","position":{"start":{"line":81,"column":1,"offset":1066},"end":{"line":81,"column":6,"offset":1071},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":1066},"end":{"line":81,"column":6,"offset":1071},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#imagelayer","title":null,"children":[],"data":{"hProperties":{"aria-label":"imagelayer permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"ImageLayer","position":{"start":{"line":83,"column":5,"offset":1077},"end":{"line":83,"column":15,"offset":1087},"indent":[]}}],"position":{"start":{"line":83,"column":1,"offset":1073},"end":{"line":83,"column":15,"offset":1087},"indent":[]},"data":{"id":"imagelayer","htmlAttributes":{"id":"imagelayer"},"hProperties":{"id":"imagelayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建图片图层","position":{"start":{"line":84,"column":1,"offset":1088},"end":{"line":84,"column":7,"offset":1094},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":1088},"end":{"line":84,"column":7,"offset":1094},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#配置项","title":null,"children":[],"data":{"hProperties":{"aria-label":"配置项 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"配置项","position":{"start":{"line":87,"column":4,"offset":1100},"end":{"line":87,"column":7,"offset":1103},"indent":[]}}],"position":{"start":{"line":87,"column":1,"offset":1097},"end":{"line":87,"column":7,"offset":1103},"indent":[]},"data":{"id":"配置项","htmlAttributes":{"id":"配置项"},"hProperties":{"id":"配置项"}}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#id","title":null,"children":[],"data":{"hProperties":{"aria-label":"id permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"id","position":{"start":{"line":89,"column":5,"offset":1109},"end":{"line":89,"column":7,"offset":1111},"indent":[]}}],"position":{"start":{"line":89,"column":1,"offset":1105},"end":{"line":89,"column":7,"offset":1111},"indent":[]},"data":{"id":"id","htmlAttributes":{"id":"id"},"hProperties":{"id":"id"}}},{"type":"paragraph","children":[{"type":"text","value":"需传入 dom 容器或者容器 id  {domObject || string} ","position":{"start":{"line":90,"column":1,"offset":1112},"end":{"line":90,"column":42,"offset":1153},"indent":[]}},{"type":"linkReference","identifier":"必选","label":"必选","referenceType":"shortcut","children":[{"type":"text","value":"必选","position":{"start":{"line":90,"column":43,"offset":1154},"end":{"line":90,"column":45,"offset":1156},"indent":[]}}],"position":{"start":{"line":90,"column":42,"offset":1153},"end":{"line":90,"column":46,"offset":1157},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":1112},"end":{"line":90,"column":46,"offset":1157},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#zoom","title":null,"children":[],"data":{"hProperties":{"aria-label":"zoom permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"zoom","position":{"start":{"line":93,"column":5,"offset":1164},"end":{"line":93,"column":9,"offset":1168},"indent":[]}}],"position":{"start":{"line":93,"column":1,"offset":1160},"end":{"line":93,"column":9,"offset":1168},"indent":[]},"data":{"id":"zoom","htmlAttributes":{"id":"zoom"},"hProperties":{"id":"zoom"}}},{"type":"paragraph","children":[{"type":"text","value":"地图初始显示级别 {number} (0-22)","position":{"start":{"line":94,"column":1,"offset":1169},"end":{"line":94,"column":26,"offset":1194},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":1169},"end":{"line":94,"column":26,"offset":1194},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#center","title":null,"children":[],"data":{"hProperties":{"aria-label":"center permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"center","position":{"start":{"line":96,"column":5,"offset":1200},"end":{"line":96,"column":11,"offset":1206},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":1196},"end":{"line":96,"column":11,"offset":1206},"indent":[]},"data":{"id":"center","htmlAttributes":{"id":"center"},"hProperties":{"id":"center"}}},{"type":"paragraph","children":[{"type":"text","value":"地图初始中心经纬度 {Lnglat}","position":{"start":{"line":97,"column":1,"offset":1207},"end":{"line":97,"column":19,"offset":1225},"indent":[]}}],"position":{"start":{"line":97,"column":1,"offset":1207},"end":{"line":97,"column":19,"offset":1225},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#pitch","title":null,"children":[],"data":{"hProperties":{"aria-label":"pitch permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"pitch","position":{"start":{"line":99,"column":5,"offset":1231},"end":{"line":99,"column":10,"offset":1236},"indent":[]}}],"position":{"start":{"line":99,"column":1,"offset":1227},"end":{"line":99,"column":10,"offset":1236},"indent":[]},"data":{"id":"pitch","htmlAttributes":{"id":"pitch"},"hProperties":{"id":"pitch"}}},{"type":"paragraph","children":[{"type":"text","value":"地图初始俯仰角度 {number}  default 0","position":{"start":{"line":100,"column":1,"offset":1237},"end":{"line":100,"column":29,"offset":1265},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":1237},"end":{"line":100,"column":29,"offset":1265},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#mapsyle","title":null,"children":[],"data":{"hProperties":{"aria-label":"mapsyle permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"mapSyle","position":{"start":{"line":102,"column":5,"offset":1271},"end":{"line":102,"column":12,"offset":1278},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":1267},"end":{"line":102,"column":12,"offset":1278},"indent":[]},"data":{"id":"mapsyle","htmlAttributes":{"id":"mapsyle"},"hProperties":{"id":"mapsyle"}}},{"type":"paragraph","children":[{"type":"text","value":"地图样式 {style} 目前仅支持高德地图。 default 'dark'","position":{"start":{"line":103,"column":1,"offset":1279},"end":{"line":103,"column":39,"offset":1317},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":103,"column":39,"offset":1317},"end":{"line":103,"column":45,"offset":1323},"indent":[]}},{"type":"text","value":"L7 内置三种种默认地图样式 dark | light|blank 空地图","position":{"start":{"line":103,"column":45,"offset":1323},"end":{"line":103,"column":82,"offset":1360},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":1279},"end":{"line":103,"column":82,"offset":1360},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"设置地图的显示样式,目前支持两种地图样式:","position":{"start":{"line":105,"column":1,"offset":1362},"end":{"line":105,"column":22,"offset":1383},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":22,"offset":1383},"end":{"line":105,"column":28,"offset":1389},"indent":[]}},{"type":"text","value":"第一种:自定义地图样式,如","position":{"start":{"line":105,"column":28,"offset":1389},"end":{"line":105,"column":41,"offset":1402},"indent":[]}},{"type":"html","value":""amap://styles/d6bf8c1d69cea9f5c696185ad4ac4c86"","position":{"start":{"line":105,"column":41,"offset":1402},"end":{"line":105,"column":91,"offset":1452},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":91,"offset":1452},"end":{"line":105,"column":97,"offset":1458},"indent":[]}},{"type":"text","value":"可前往","position":{"start":{"line":105,"column":97,"offset":1458},"end":{"line":105,"column":100,"offset":1461},"indent":[]}},{"type":"link","title":null,"url":"https://lbs.amap.com/dev/mapstyle/index","children":[{"type":"text","value":"地图自定义平台","position":{"start":{"line":105,"column":101,"offset":1462},"end":{"line":105,"column":108,"offset":1469},"indent":[]}}],"position":{"start":{"line":105,"column":100,"offset":1461},"end":{"line":105,"column":150,"offset":1511},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}},{"type":"text","value":"定制自己的个性地图样式;","position":{"start":{"line":105,"column":150,"offset":1511},"end":{"line":105,"column":162,"offset":1523},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":162,"offset":1523},"end":{"line":105,"column":168,"offset":1529},"indent":[]}},{"type":"text","value":"第二种:官方样式模版,如","position":{"start":{"line":105,"column":168,"offset":1529},"end":{"line":105,"column":180,"offset":1541},"indent":[]}},{"type":"html","value":""amap://styles/grey"","position":{"start":{"line":105,"column":180,"offset":1541},"end":{"line":105,"column":202,"offset":1563},"indent":[]}},{"type":"text","value":"。","position":{"start":{"line":105,"column":202,"offset":1563},"end":{"line":105,"column":203,"offset":1564},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":203,"offset":1564},"end":{"line":105,"column":209,"offset":1570},"indent":[]}},{"type":"text","value":"其他模版样式及自定义地图的使用说明见","position":{"start":{"line":105,"column":209,"offset":1570},"end":{"line":105,"column":227,"offset":1588},"indent":[]}},{"type":"link","title":null,"url":"https://lbs.amap.com/api/javascript-api/guide/create-map/mapstye/","children":[{"type":"text","value":"开发指南","position":{"start":{"line":105,"column":228,"offset":1589},"end":{"line":105,"column":232,"offset":1593},"indent":[]}}],"position":{"start":{"line":105,"column":227,"offset":1588},"end":{"line":105,"column":300,"offset":1661},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}}],"position":{"start":{"line":105,"column":1,"offset":1362},"end":{"line":105,"column":300,"offset":1661},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#minzoom","title":null,"children":[],"data":{"hProperties":{"aria-label":"minzoom permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"minZoom","position":{"start":{"line":108,"column":5,"offset":1668},"end":{"line":108,"column":12,"offset":1675},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":1664},"end":{"line":108,"column":12,"offset":1675},"indent":[]},"data":{"id":"minzoom","htmlAttributes":{"id":"minzoom"},"hProperties":{"id":"minzoom"}}},{"type":"paragraph","children":[{"type":"text","value":"地图最小缩放等级 {number}  default 0 (0-22)","position":{"start":{"line":109,"column":1,"offset":1676},"end":{"line":109,"column":37,"offset":1712},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":1676},"end":{"line":109,"column":37,"offset":1712},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#maxzoom","title":null,"children":[],"data":{"hProperties":{"aria-label":"maxzoom permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"maxZoom","position":{"start":{"line":111,"column":5,"offset":1718},"end":{"line":111,"column":12,"offset":1725},"indent":[]}}],"position":{"start":{"line":111,"column":1,"offset":1714},"end":{"line":111,"column":12,"offset":1725},"indent":[]},"data":{"id":"maxzoom","htmlAttributes":{"id":"maxzoom"},"hProperties":{"id":"maxzoom"}}},{"type":"paragraph","children":[{"type":"text","value":"地图最大缩放等级 {number}  default 22 (0-22)","position":{"start":{"line":112,"column":1,"offset":1726},"end":{"line":112,"column":38,"offset":1763},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":1726},"end":{"line":112,"column":38,"offset":1763},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#rotateenable","title":null,"children":[],"data":{"hProperties":{"aria-label":"rotateenable permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"rotateEnable","position":{"start":{"line":114,"column":5,"offset":1769},"end":{"line":114,"column":17,"offset":1781},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":1765},"end":{"line":114,"column":17,"offset":1781},"indent":[]},"data":{"id":"rotateenable","htmlAttributes":{"id":"rotateenable"},"hProperties":{"id":"rotateenable"}}},{"type":"paragraph","children":[{"type":"text","value":"地图是否可旋转 {Boolean} default true","position":{"start":{"line":115,"column":1,"offset":1782},"end":{"line":115,"column":31,"offset":1812},"indent":[]}}],"position":{"start":{"line":115,"column":1,"offset":1782},"end":{"line":115,"column":31,"offset":1812},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#方法","title":null,"children":[],"data":{"hProperties":{"aria-label":"方法 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"方法","position":{"start":{"line":120,"column":4,"offset":1820},"end":{"line":120,"column":6,"offset":1822},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":1817},"end":{"line":120,"column":6,"offset":1822},"indent":[]},"data":{"id":"方法","htmlAttributes":{"id":"方法"},"hProperties":{"id":"方法"}}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#getzoom","title":null,"children":[],"data":{"hProperties":{"aria-label":"getzoom permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getZoom","position":{"start":{"line":122,"column":5,"offset":1828},"end":{"line":122,"column":12,"offset":1835},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":1824},"end":{"line":122,"column":12,"offset":1835},"indent":[]},"data":{"id":"getzoom","htmlAttributes":{"id":"getzoom"},"hProperties":{"id":"getzoom"}}},{"type":"paragraph","children":[{"type":"text","value":"获取当前缩放等级","position":{"start":{"line":123,"column":1,"offset":1836},"end":{"line":123,"column":9,"offset":1844},"indent":[]}}],"position":{"start":{"line":123,"column":1,"offset":1836},"end":{"line":123,"column":9,"offset":1844},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getZoom();\n
","position":{"start":{"line":125,"column":1,"offset":1846},"end":{"line":127,"column":4,"offset":1880},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return {float}  当前缩放等级","position":{"start":{"line":129,"column":1,"offset":1882},"end":{"line":129,"column":24,"offset":1905},"indent":[]}}],"position":{"start":{"line":129,"column":1,"offset":1882},"end":{"line":129,"column":24,"offset":1905},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#getlayers","title":null,"children":[],"data":{"hProperties":{"aria-label":"getlayers permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getLayers()","position":{"start":{"line":131,"column":5,"offset":1911},"end":{"line":131,"column":16,"offset":1922},"indent":[]}}],"position":{"start":{"line":131,"column":1,"offset":1907},"end":{"line":131,"column":16,"offset":1922},"indent":[]},"data":{"id":"getlayers","htmlAttributes":{"id":"getlayers"},"hProperties":{"id":"getlayers"}}},{"type":"paragraph","children":[{"type":"text","value":"获取所有的地图图层","position":{"start":{"line":132,"column":1,"offset":1923},"end":{"line":132,"column":10,"offset":1932},"indent":[]}}],"position":{"start":{"line":132,"column":1,"offset":1923},"end":{"line":132,"column":10,"offset":1932},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getLayers();\n
","position":{"start":{"line":133,"column":1,"offset":1933},"end":{"line":135,"column":4,"offset":1969},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return 图层数组 {Array}","position":{"start":{"line":137,"column":1,"offset":1971},"end":{"line":137,"column":21,"offset":1991},"indent":[]}}],"position":{"start":{"line":137,"column":1,"offset":1971},"end":{"line":137,"column":21,"offset":1991},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#getcenter","title":null,"children":[],"data":{"hProperties":{"aria-label":"getcenter permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getCenter()","position":{"start":{"line":140,"column":5,"offset":1998},"end":{"line":140,"column":16,"offset":2009},"indent":[]}}],"position":{"start":{"line":140,"column":1,"offset":1994},"end":{"line":140,"column":16,"offset":2009},"indent":[]},"data":{"id":"getcenter","htmlAttributes":{"id":"getcenter"},"hProperties":{"id":"getcenter"}}},{"type":"paragraph","children":[{"type":"text","value":"获取地图中心点","position":{"start":{"line":141,"column":1,"offset":2010},"end":{"line":141,"column":8,"offset":2017},"indent":[]}}],"position":{"start":{"line":141,"column":1,"offset":2010},"end":{"line":141,"column":8,"offset":2017},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getCenter();\n
","position":{"start":{"line":142,"column":1,"offset":2018},"end":{"line":144,"column":4,"offset":2053},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return {Lnglat} :地图中心点","position":{"start":{"line":146,"column":1,"offset":2055},"end":{"line":146,"column":23,"offset":2077},"indent":[]}}],"position":{"start":{"line":146,"column":1,"offset":2055},"end":{"line":146,"column":23,"offset":2077},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#getsize","title":null,"children":[],"data":{"hProperties":{"aria-label":"getsize permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getSize()","position":{"start":{"line":148,"column":5,"offset":2083},"end":{"line":148,"column":14,"offset":2092},"indent":[]}}],"position":{"start":{"line":148,"column":1,"offset":2079},"end":{"line":148,"column":14,"offset":2092},"indent":[]},"data":{"id":"getsize","htmlAttributes":{"id":"getsize"},"hProperties":{"id":"getsize"}}},{"type":"paragraph","children":[{"type":"text","value":"获取地图容器大小","position":{"start":{"line":149,"column":1,"offset":2093},"end":{"line":149,"column":9,"offset":2101},"indent":[]}}],"position":{"start":{"line":149,"column":1,"offset":2093},"end":{"line":149,"column":9,"offset":2101},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getSize();\n
","position":{"start":{"line":150,"column":1,"offset":2102},"end":{"line":152,"column":4,"offset":2135},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return { Object } 地图容器的 width,height","position":{"start":{"line":153,"column":1,"offset":2136},"end":{"line":153,"column":37,"offset":2172},"indent":[]}}],"position":{"start":{"line":153,"column":1,"offset":2136},"end":{"line":153,"column":37,"offset":2172},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#getpitch","title":null,"children":[],"data":{"hProperties":{"aria-label":"getpitch permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getPitch()","position":{"start":{"line":155,"column":5,"offset":2178},"end":{"line":155,"column":15,"offset":2188},"indent":[]}}],"position":{"start":{"line":155,"column":1,"offset":2174},"end":{"line":155,"column":15,"offset":2188},"indent":[]},"data":{"id":"getpitch","htmlAttributes":{"id":"getpitch"},"hProperties":{"id":"getpitch"}}},{"type":"paragraph","children":[{"type":"text","value":"获取地图俯仰角","position":{"start":{"line":156,"column":1,"offset":2189},"end":{"line":156,"column":8,"offset":2196},"indent":[]}}],"position":{"start":{"line":156,"column":1,"offset":2189},"end":{"line":156,"column":8,"offset":2196},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getPitch();\n
","position":{"start":{"line":157,"column":1,"offset":2197},"end":{"line":159,"column":4,"offset":2232},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return {number} pitch","position":{"start":{"line":161,"column":1,"offset":2234},"end":{"line":161,"column":22,"offset":2255},"indent":[]}}],"position":{"start":{"line":161,"column":1,"offset":2234},"end":{"line":161,"column":22,"offset":2255},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#setcenter","title":null,"children":[],"data":{"hProperties":{"aria-label":"setcenter permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setCenter()","position":{"start":{"line":163,"column":5,"offset":2261},"end":{"line":163,"column":16,"offset":2272},"indent":[]}}],"position":{"start":{"line":163,"column":1,"offset":2257},"end":{"line":163,"column":16,"offset":2272},"indent":[]},"data":{"id":"setcenter","htmlAttributes":{"id":"setcenter"},"hProperties":{"id":"setcenter"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图中心点坐标","position":{"start":{"line":164,"column":1,"offset":2273},"end":{"line":164,"column":10,"offset":2282},"indent":[]}}],"position":{"start":{"line":164,"column":1,"offset":2273},"end":{"line":164,"column":10,"offset":2282},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setCenter([lng, lat]);\n
","position":{"start":{"line":166,"column":1,"offset":2284},"end":{"line":168,"column":4,"offset":2328},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:","position":{"start":{"line":170,"column":1,"offset":2330},"end":{"line":170,"column":4,"offset":2333},"indent":[]}},{"type":"html","value":"center","position":{"start":{"line":170,"column":4,"offset":2333},"end":{"line":170,"column":12,"offset":2341},"indent":[]}},{"type":"text","value":" {LngLat} 地图中心点","position":{"start":{"line":170,"column":12,"offset":2341},"end":{"line":170,"column":28,"offset":2357},"indent":[]}}],"position":{"start":{"line":170,"column":1,"offset":2330},"end":{"line":170,"column":28,"offset":2357},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#setzoomandcenter","title":null,"children":[],"data":{"hProperties":{"aria-label":"setzoomandcenter permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setZoomAndCenter","position":{"start":{"line":173,"column":5,"offset":2364},"end":{"line":173,"column":21,"offset":2380},"indent":[]}}],"position":{"start":{"line":173,"column":1,"offset":2360},"end":{"line":173,"column":21,"offset":2380},"indent":[]},"data":{"id":"setzoomandcenter","htmlAttributes":{"id":"setzoomandcenter"},"hProperties":{"id":"setzoomandcenter"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图等级和中心","position":{"start":{"line":174,"column":1,"offset":2381},"end":{"line":174,"column":10,"offset":2390},"indent":[]}}],"position":{"start":{"line":174,"column":1,"offset":2381},"end":{"line":174,"column":10,"offset":2390},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setZoomAndCenter(zoom, center);\n
","position":{"start":{"line":175,"column":1,"offset":2391},"end":{"line":177,"column":4,"offset":2444},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:zoom {number}","position":{"start":{"line":179,"column":1,"offset":2446},"end":{"line":179,"column":17,"offset":2462},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":179,"column":17,"offset":2462},"end":{"line":179,"column":23,"offset":2468},"indent":[]}},{"type":"text","value":"center {LngLat}","position":{"start":{"line":179,"column":23,"offset":2468},"end":{"line":179,"column":38,"offset":2483},"indent":[]}}],"position":{"start":{"line":179,"column":1,"offset":2446},"end":{"line":179,"column":38,"offset":2483},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#setrotation","title":null,"children":[],"data":{"hProperties":{"aria-label":"setrotation permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setRotation","position":{"start":{"line":182,"column":5,"offset":2490},"end":{"line":182,"column":16,"offset":2501},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":2486},"end":{"line":182,"column":16,"offset":2501},"indent":[]},"data":{"id":"setrotation","htmlAttributes":{"id":"setrotation"},"hProperties":{"id":"setrotation"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图顺时针旋转角度,旋转原点为地图容器中心点,取值范围 ","position":{"start":{"line":183,"column":1,"offset":2502},"end":{"line":183,"column":31,"offset":2532},"indent":[]}},{"type":"linkReference","identifier":"0-360","label":"0-360","referenceType":"shortcut","children":[{"type":"text","value":"0-360","position":{"start":{"line":183,"column":32,"offset":2533},"end":{"line":183,"column":37,"offset":2538},"indent":[]}}],"position":{"start":{"line":183,"column":31,"offset":2532},"end":{"line":183,"column":38,"offset":2539},"indent":[]}}],"position":{"start":{"line":183,"column":1,"offset":2502},"end":{"line":183,"column":38,"offset":2539},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setRotation(rotation);\n
","position":{"start":{"line":184,"column":1,"offset":2540},"end":{"line":186,"column":4,"offset":2585},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数: ","position":{"start":{"line":188,"column":1,"offset":2587},"end":{"line":188,"column":5,"offset":2591},"indent":[]}},{"type":"html","value":"rotation","position":{"start":{"line":188,"column":5,"offset":2591},"end":{"line":188,"column":15,"offset":2601},"indent":[]}},{"type":"text","value":" {number}","position":{"start":{"line":188,"column":15,"offset":2601},"end":{"line":188,"column":26,"offset":2612},"indent":[]}}],"position":{"start":{"line":188,"column":1,"offset":2587},"end":{"line":188,"column":26,"offset":2612},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#zoomin","title":null,"children":[],"data":{"hProperties":{"aria-label":"zoomin permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"zoomIn","position":{"start":{"line":190,"column":5,"offset":2618},"end":{"line":190,"column":11,"offset":2624},"indent":[]}}],"position":{"start":{"line":190,"column":1,"offset":2614},"end":{"line":190,"column":11,"offset":2624},"indent":[]},"data":{"id":"zoomin","htmlAttributes":{"id":"zoomin"},"hProperties":{"id":"zoomin"}}},{"type":"paragraph","children":[{"type":"text","value":"地图放大一级","position":{"start":{"line":191,"column":1,"offset":2625},"end":{"line":191,"column":7,"offset":2631},"indent":[]}}],"position":{"start":{"line":191,"column":1,"offset":2625},"end":{"line":191,"column":7,"offset":2631},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.zoomIn();\n
","position":{"start":{"line":192,"column":1,"offset":2632},"end":{"line":194,"column":4,"offset":2664},"indent":[1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#zoomout","title":null,"children":[],"data":{"hProperties":{"aria-label":"zoomout permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"zoomOut","position":{"start":{"line":196,"column":5,"offset":2670},"end":{"line":196,"column":12,"offset":2677},"indent":[]}}],"position":{"start":{"line":196,"column":1,"offset":2666},"end":{"line":196,"column":12,"offset":2677},"indent":[]},"data":{"id":"zoomout","htmlAttributes":{"id":"zoomout"},"hProperties":{"id":"zoomout"}}},{"type":"paragraph","children":[{"type":"text","value":"地图缩小一级","position":{"start":{"line":197,"column":1,"offset":2678},"end":{"line":197,"column":7,"offset":2684},"indent":[]}}],"position":{"start":{"line":197,"column":1,"offset":2678},"end":{"line":197,"column":7,"offset":2684},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.ZoomOUt();\n
","position":{"start":{"line":198,"column":1,"offset":2685},"end":{"line":200,"column":4,"offset":2718},"indent":[1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#panto","title":null,"children":[],"data":{"hProperties":{"aria-label":"panto permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"panTo","position":{"start":{"line":202,"column":5,"offset":2724},"end":{"line":202,"column":10,"offset":2729},"indent":[]}}],"position":{"start":{"line":202,"column":1,"offset":2720},"end":{"line":202,"column":10,"offset":2729},"indent":[]},"data":{"id":"panto","htmlAttributes":{"id":"panto"},"hProperties":{"id":"panto"}}},{"type":"paragraph","children":[{"type":"text","value":"地图平移到指定的位置","position":{"start":{"line":203,"column":1,"offset":2730},"end":{"line":203,"column":11,"offset":2740},"indent":[]}}],"position":{"start":{"line":203,"column":1,"offset":2730},"end":{"line":203,"column":11,"offset":2740},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.panTo(LngLat);\n
","position":{"start":{"line":204,"column":1,"offset":2741},"end":{"line":206,"column":4,"offset":2778},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:","position":{"start":{"line":208,"column":1,"offset":2780},"end":{"line":208,"column":4,"offset":2783},"indent":[]}},{"type":"html","value":"center","position":{"start":{"line":208,"column":4,"offset":2783},"end":{"line":208,"column":12,"offset":2791},"indent":[]}},{"type":"text","value":" LngLat 中心位置坐标","position":{"start":{"line":208,"column":12,"offset":2791},"end":{"line":208,"column":27,"offset":2806},"indent":[]}}],"position":{"start":{"line":208,"column":1,"offset":2780},"end":{"line":208,"column":27,"offset":2806},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#panby","title":null,"children":[],"data":{"hProperties":{"aria-label":"panby permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"panBy","position":{"start":{"line":210,"column":5,"offset":2812},"end":{"line":210,"column":10,"offset":2817},"indent":[]}}],"position":{"start":{"line":210,"column":1,"offset":2808},"end":{"line":210,"column":10,"offset":2817},"indent":[]},"data":{"id":"panby","htmlAttributes":{"id":"panby"},"hProperties":{"id":"panby"}}},{"type":"paragraph","children":[{"type":"text","value":"以像素为单位沿X方向和Y方向移动地图","position":{"start":{"line":211,"column":1,"offset":2818},"end":{"line":211,"column":19,"offset":2836},"indent":[]}}],"position":{"start":{"line":211,"column":1,"offset":2818},"end":{"line":211,"column":19,"offset":2836},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.panBy(x, y);\n
","position":{"start":{"line":212,"column":1,"offset":2837},"end":{"line":214,"column":4,"offset":2871},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:","position":{"start":{"line":215,"column":1,"offset":2872},"end":{"line":215,"column":4,"offset":2875},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":215,"column":4,"offset":2875},"end":{"line":215,"column":10,"offset":2881},"indent":[]}},{"type":"html","value":"x","position":{"start":{"line":215,"column":10,"offset":2881},"end":{"line":215,"column":13,"offset":2884},"indent":[]}},{"type":"text","value":" {number} 水平方向移动像素 向右为正方向","position":{"start":{"line":215,"column":13,"offset":2884},"end":{"line":215,"column":38,"offset":2909},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":215,"column":38,"offset":2909},"end":{"line":215,"column":44,"offset":2915},"indent":[]}},{"type":"text","value":"      ","position":{"start":{"line":215,"column":44,"offset":2915},"end":{"line":215,"column":50,"offset":2921},"indent":[]}},{"type":"html","value":"y","position":{"start":{"line":215,"column":50,"offset":2921},"end":{"line":215,"column":53,"offset":2924},"indent":[]}},{"type":"text","value":" {number} 垂直方向移动像素 向下为正方向","position":{"start":{"line":215,"column":53,"offset":2924},"end":{"line":215,"column":79,"offset":2950},"indent":[]}}],"position":{"start":{"line":215,"column":1,"offset":2872},"end":{"line":215,"column":79,"offset":2950},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#setpitch","title":null,"children":[],"data":{"hProperties":{"aria-label":"setpitch permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setPitch","position":{"start":{"line":218,"column":5,"offset":2957},"end":{"line":218,"column":13,"offset":2965},"indent":[]}}],"position":{"start":{"line":218,"column":1,"offset":2953},"end":{"line":218,"column":13,"offset":2965},"indent":[]},"data":{"id":"setpitch","htmlAttributes":{"id":"setpitch"},"hProperties":{"id":"setpitch"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图仰俯角度","position":{"start":{"line":219,"column":1,"offset":2966},"end":{"line":219,"column":9,"offset":2974},"indent":[]}}],"position":{"start":{"line":219,"column":1,"offset":2966},"end":{"line":219,"column":9,"offset":2974},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setPitch(pitch);\n
","position":{"start":{"line":220,"column":1,"offset":2975},"end":{"line":222,"column":4,"offset":3014},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数 :","position":{"start":{"line":224,"column":1,"offset":3016},"end":{"line":224,"column":5,"offset":3020},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":224,"column":5,"offset":3020},"end":{"line":224,"column":11,"offset":3026},"indent":[]}},{"type":"text","value":"   ","position":{"start":{"line":224,"column":11,"offset":3026},"end":{"line":224,"column":14,"offset":3029},"indent":[]}},{"type":"html","value":"pitch","position":{"start":{"line":224,"column":14,"offset":3029},"end":{"line":224,"column":21,"offset":3036},"indent":[]}},{"type":"text","value":" {number}","position":{"start":{"line":224,"column":21,"offset":3036},"end":{"line":224,"column":31,"offset":3046},"indent":[]}}],"position":{"start":{"line":224,"column":1,"offset":3016},"end":{"line":224,"column":31,"offset":3046},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#","title":null,"children":[],"data":{"hProperties":{"aria-label":" permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}}],"position":{"start":{"line":226,"column":1,"offset":3048},"end":{"line":226,"column":5,"offset":3052},"indent":[]},"data":{"id":"","htmlAttributes":{"id":""},"hProperties":{"id":""}}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#setstatus","title":null,"children":[],"data":{"hProperties":{"aria-label":"setstatus permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"setStatus","position":{"start":{"line":228,"column":5,"offset":3058},"end":{"line":228,"column":14,"offset":3067},"indent":[]}}],"position":{"start":{"line":228,"column":1,"offset":3054},"end":{"line":228,"column":14,"offset":3067},"indent":[]},"data":{"id":"setstatus","htmlAttributes":{"id":"setstatus"},"hProperties":{"id":"setstatus"}}},{"type":"paragraph","children":[{"type":"text","value":"设置当前地图显示状态,包括是否可鼠标拖拽移动地图、地图是否可缩放、地图是否可旋转(rotateEnable)、是否可双击放大地图、是否可以通过键盘控制地图旋转(keyboardEnable)等   ","position":{"start":{"line":229,"column":1,"offset":3068},"end":{"line":229,"column":100,"offset":3167},"indent":[]}}],"position":{"start":{"line":229,"column":1,"offset":3068},"end":{"line":229,"column":100,"offset":3167},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setStatus({\n  dragEnable: true,\n  keyboardEnable: true,\n  doubleClickZoom: true,\n  zoomEnable: true,\n  rotateEnable: true,\n});\n
","position":{"start":{"line":231,"column":1,"offset":3169},"end":{"line":239,"column":4,"offset":3346},"indent":[1,1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#fitbounds","title":null,"children":[],"data":{"hProperties":{"aria-label":"fitbounds permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"fitBounds","position":{"start":{"line":242,"column":5,"offset":3353},"end":{"line":242,"column":14,"offset":3362},"indent":[]}}],"position":{"start":{"line":242,"column":1,"offset":3349},"end":{"line":242,"column":14,"offset":3362},"indent":[]},"data":{"id":"fitbounds","htmlAttributes":{"id":"fitbounds"},"hProperties":{"id":"fitbounds"}}},{"type":"paragraph","children":[{"type":"text","value":"地图缩放到某个范围内","position":{"start":{"line":243,"column":1,"offset":3363},"end":{"line":243,"column":11,"offset":3373},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":243,"column":11,"offset":3373},"end":{"line":243,"column":17,"offset":3379},"indent":[]}},{"type":"text","value":"参数 :","position":{"start":{"line":243,"column":17,"offset":3379},"end":{"line":243,"column":21,"offset":3383},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":243,"column":21,"offset":3383},"end":{"line":243,"column":27,"offset":3389},"indent":[]}},{"type":"text","value":"  ","position":{"start":{"line":243,"column":27,"offset":3389},"end":{"line":243,"column":29,"offset":3391},"indent":[]}},{"type":"html","value":"extent","position":{"start":{"line":243,"column":29,"offset":3391},"end":{"line":243,"column":37,"offset":3399},"indent":[]}},{"type":"text","value":" { array} 经纬度范围 ","position":{"start":{"line":243,"column":37,"offset":3399},"end":{"line":243,"column":53,"offset":3415},"indent":[]}},{"type":"linkReference","identifier":"minlng,minlat,maxlng,maxlat","label":"minlng,minlat,maxlng,maxlat","referenceType":"shortcut","children":[{"type":"text","value":"minlng,minlat,maxlng,maxlat","position":{"start":{"line":243,"column":54,"offset":3416},"end":{"line":243,"column":81,"offset":3443},"indent":[]}}],"position":{"start":{"line":243,"column":53,"offset":3415},"end":{"line":243,"column":82,"offset":3444},"indent":[]}}],"position":{"start":{"line":243,"column":1,"offset":3363},"end":{"line":243,"column":82,"offset":3444},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.fitBounds([112, 32, 114, 35]);\n
","position":{"start":{"line":245,"column":1,"offset":3446},"end":{"line":247,"column":4,"offset":3497},"indent":[1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#removelayer","title":null,"children":[],"data":{"hProperties":{"aria-label":"removelayer permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"removeLayer","position":{"start":{"line":251,"column":5,"offset":3505},"end":{"line":251,"column":16,"offset":3516},"indent":[]}}],"position":{"start":{"line":251,"column":1,"offset":3501},"end":{"line":251,"column":16,"offset":3516},"indent":[]},"data":{"id":"removelayer","htmlAttributes":{"id":"removelayer"},"hProperties":{"id":"removelayer"}}},{"type":"paragraph","children":[{"type":"text","value":"移除layer","position":{"start":{"line":252,"column":1,"offset":3517},"end":{"line":252,"column":8,"offset":3524},"indent":[]}}],"position":{"start":{"line":252,"column":1,"offset":3517},"end":{"line":252,"column":8,"offset":3524},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.removeLayer(layer);\n
","position":{"start":{"line":254,"column":1,"offset":3526},"end":{"line":256,"column":4,"offset":3568},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数","position":{"start":{"line":258,"column":1,"offset":3570},"end":{"line":258,"column":3,"offset":3572},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":258,"column":3,"offset":3572},"end":{"line":258,"column":9,"offset":3578},"indent":[]}},{"type":"html","value":"layer","position":{"start":{"line":258,"column":9,"offset":3578},"end":{"line":258,"column":16,"offset":3585},"indent":[]}},{"type":"text","value":" {Layer}","position":{"start":{"line":258,"column":16,"offset":3585},"end":{"line":258,"column":25,"offset":3594},"indent":[]}}],"position":{"start":{"line":258,"column":1,"offset":3570},"end":{"line":258,"column":25,"offset":3594},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#getlayers-1","title":null,"children":[],"data":{"hProperties":{"aria-label":"getlayers 1 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"getLayers","position":{"start":{"line":260,"column":5,"offset":3600},"end":{"line":260,"column":14,"offset":3609},"indent":[]}}],"position":{"start":{"line":260,"column":1,"offset":3596},"end":{"line":260,"column":14,"offset":3609},"indent":[]},"data":{"id":"getlayers-1","htmlAttributes":{"id":"getlayers-1"},"hProperties":{"id":"getlayers-1"}}},{"type":"paragraph","children":[{"type":"text","value":" 获取所有的layer","position":{"start":{"line":261,"column":1,"offset":3610},"end":{"line":261,"column":12,"offset":3621},"indent":[]}}],"position":{"start":{"line":261,"column":1,"offset":3610},"end":{"line":261,"column":12,"offset":3621},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getLayers();\n
","position":{"start":{"line":263,"column":1,"offset":3623},"end":{"line":265,"column":4,"offset":3658},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return layers  {array}","position":{"start":{"line":267,"column":1,"offset":3660},"end":{"line":267,"column":24,"offset":3683},"indent":[]}}],"position":{"start":{"line":267,"column":1,"offset":3660},"end":{"line":267,"column":24,"offset":3683},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#事件","title":null,"children":[],"data":{"hProperties":{"aria-label":"事件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"事件","position":{"start":{"line":269,"column":4,"offset":3688},"end":{"line":269,"column":6,"offset":3690},"indent":[]}}],"position":{"start":{"line":269,"column":1,"offset":3685},"end":{"line":269,"column":6,"offset":3690},"indent":[]},"data":{"id":"事件","htmlAttributes":{"id":"事件"},"hProperties":{"id":"事件"}}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#on","title":null,"children":[],"data":{"hProperties":{"aria-label":"on permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"on","position":{"start":{"line":272,"column":5,"offset":3697},"end":{"line":272,"column":7,"offset":3699},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":3693},"end":{"line":272,"column":7,"offset":3699},"indent":[]},"data":{"id":"on","htmlAttributes":{"id":"on"},"hProperties":{"id":"on"}}},{"type":"paragraph","children":[{"type":"text","value":"事件监听","position":{"start":{"line":273,"column":1,"offset":3700},"end":{"line":273,"column":5,"offset":3704},"indent":[]}}],"position":{"start":{"line":273,"column":1,"offset":3700},"end":{"line":273,"column":5,"offset":3704},"indent":[]}},{"type":"heading","depth":4,"children":[{"type":"link","url":"#参数","title":null,"children":[],"data":{"hProperties":{"aria-label":"参数 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"参数","position":{"start":{"line":275,"column":6,"offset":3711},"end":{"line":275,"column":8,"offset":3713},"indent":[]}}],"position":{"start":{"line":275,"column":1,"offset":3706},"end":{"line":275,"column":8,"offset":3713},"indent":[]},"data":{"id":"参数","htmlAttributes":{"id":"参数"},"hProperties":{"id":"参数"}}},{"type":"paragraph","children":[{"type":"html","value":"eventName","position":{"start":{"line":276,"column":1,"offset":3714},"end":{"line":276,"column":12,"offset":3725},"indent":[]}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":276,"column":12,"offset":3725},"end":{"line":276,"column":26,"offset":3739},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":276,"column":26,"offset":3739},"end":{"line":276,"column":32,"offset":3745},"indent":[]}},{"type":"html","value":"hander","position":{"start":{"line":276,"column":32,"offset":3745},"end":{"line":276,"column":40,"offset":3753},"indent":[]}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":276,"column":40,"offset":3753},"end":{"line":276,"column":60,"offset":3773},"indent":[]}}],"position":{"start":{"line":276,"column":1,"offset":3714},"end":{"line":276,"column":60,"offset":3773},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#off","title":null,"children":[],"data":{"hProperties":{"aria-label":"off permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"off","position":{"start":{"line":279,"column":5,"offset":3780},"end":{"line":279,"column":8,"offset":3783},"indent":[]}}],"position":{"start":{"line":279,"column":1,"offset":3776},"end":{"line":279,"column":8,"offset":3783},"indent":[]},"data":{"id":"off","htmlAttributes":{"id":"off"},"hProperties":{"id":"off"}}},{"type":"paragraph","children":[{"type":"text","value":"移除事件监听","position":{"start":{"line":280,"column":1,"offset":3784},"end":{"line":280,"column":7,"offset":3790},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":280,"column":7,"offset":3790},"end":{"line":280,"column":13,"offset":3796},"indent":[]}},{"type":"html","value":"eventName","position":{"start":{"line":280,"column":13,"offset":3796},"end":{"line":280,"column":24,"offset":3807},"indent":[]}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":280,"column":24,"offset":3807},"end":{"line":280,"column":38,"offset":3821},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":280,"column":38,"offset":3821},"end":{"line":280,"column":44,"offset":3827},"indent":[]}},{"type":"html","value":"hander","position":{"start":{"line":280,"column":44,"offset":3827},"end":{"line":280,"column":52,"offset":3835},"indent":[]}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":280,"column":52,"offset":3835},"end":{"line":280,"column":72,"offset":3855},"indent":[]}}],"position":{"start":{"line":280,"column":1,"offset":3784},"end":{"line":280,"column":72,"offset":3855},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#地图事件","title":null,"children":[],"data":{"hProperties":{"aria-label":"地图事件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"地图事件","position":{"start":{"line":283,"column":5,"offset":3862},"end":{"line":283,"column":9,"offset":3866},"indent":[]}}],"position":{"start":{"line":283,"column":1,"offset":3858},"end":{"line":283,"column":9,"offset":3866},"indent":[]},"data":{"id":"地图事件","htmlAttributes":{"id":"地图事件"},"hProperties":{"id":"地图事件"}}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.on('loaded', () => {}); //地图加载完成触发\nscene.on('mapmove', () => {}); // 地图平移时触发事件\nscene.on('movestart', () => {}); // 地图平移开始时触发\nscene.on('moveend', () => {}); // 地图移动结束后触发,包括平移,以及中心点变化的缩放。如地图有拖拽缓动效果,则在缓动结束后触发\nscene.on('zoomchange', () => {}); // 地图缩放级别更改后触发\nscene.on('zoomstart', () => {}); // 缩放开始时触发\nscene.on('zoomend', () => {}); // 缩放停止时触发\n
","position":{"start":{"line":284,"column":1,"offset":3867},"end":{"line":292,"column":4,"offset":4204},"indent":[1,1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#鼠标事件","title":null,"children":[],"data":{"hProperties":{"aria-label":"鼠标事件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"鼠标事件","position":{"start":{"line":295,"column":5,"offset":4211},"end":{"line":295,"column":9,"offset":4215},"indent":[]}}],"position":{"start":{"line":295,"column":1,"offset":4207},"end":{"line":295,"column":9,"offset":4215},"indent":[]},"data":{"id":"鼠标事件","htmlAttributes":{"id":"鼠标事件"},"hProperties":{"id":"鼠标事件"}}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.on('click', (ev) => {}); // 鼠标左键点击事件\nscene.on('dblclick', (ev) => {}); // 鼠标左键双击事件\nscene.on('mousemove', (ev) => {}); // 鼠标在地图上移动时触发\nscene.on('mousewheel', (ev) => {}); // 鼠标滚轮开始缩放地图时触发\nscene.on('mouseover', (ev) => {}); // 鼠标移入地图容器内时触发\nscene.on('mouseout', (ev) => {}); // 鼠标移出地图容器时触发\nscene.on('mouseup', (ev) => {}); // 鼠标在地图上单击抬起时触发\nscene.on('mousedown', (ev) => {}); // 鼠标在地图上单击按下时触发\nscene.on('rightclick', (ev) => {}); // 鼠标右键单击事件\nscene.on('dragstart', (ev) => {}); //开始拖拽地图时触发\nscene.on('dragging', (ev) => {}); // 拖拽地图过程中触发\nscene.on('dragend', (ev) => {}); //停止拖拽地图时触发。如地图有拖拽缓动效果,则在拽停止,缓动开始前触发\n
","position":{"start":{"line":297,"column":1,"offset":4217},"end":{"line":310,"column":4,"offset":4924},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#其它事件","title":null,"children":[],"data":{"hProperties":{"aria-label":"其它事件 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"其它事件","position":{"start":{"line":312,"column":5,"offset":4930},"end":{"line":312,"column":9,"offset":4934},"indent":[]}}],"position":{"start":{"line":312,"column":1,"offset":4926},"end":{"line":312,"column":9,"offset":4934},"indent":[]},"data":{"id":"其它事件","htmlAttributes":{"id":"其它事件"},"hProperties":{"id":"其它事件"}}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.on('resize', () => {}); // 地图容器大小改变事件\n
","position":{"start":{"line":313,"column":1,"offset":4935},"end":{"line":315,"column":4,"offset":4992},"indent":[1,1]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":318,"column":1,"offset":4995}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-8152d0a6832522eb79f34eecc5e89cd4.json b/.cache/caches/gatsby-transformer-remark/diskstore-8152d0a6832522eb79f34eecc5e89cd4.json new file mode 100644 index 0000000000..779a16ce0f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8152d0a6832522eb79f34eecc5e89cd4.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-toc-b1a6eb4a5fb92e03f562537f31f11c68-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-8a657829abac5ed5e9e205e519d6ded0.json b/.cache/caches/gatsby-transformer-remark/diskstore-8a657829abac5ed5e9e205e519d6ded0.json new file mode 100644 index 0000000000..8bf901ca3e --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8a657829abac5ed5e9e205e519d6ded0.json @@ -0,0 +1 @@ +{"expireTime":9007200827720708000,"key":"transformer-remark-markdown-toc-99b5b2f90b0432fb92044e231041ffca-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-8c6f6648e48a1e25d0879cba52c6f15c.json b/.cache/caches/gatsby-transformer-remark/diskstore-8c6f6648e48a1e25d0879cba52c6f15c.json new file mode 100644 index 0000000000..145440e1d6 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8c6f6648e48a1e25d0879cba52c6f15c.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-toc-6c75c6b34b379d2a97680d76e3983681-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-9429c44d730cc08b4b28804d3d7d5a2c.json b/.cache/caches/gatsby-transformer-remark/diskstore-9429c44d730cc08b4b28804d3d7d5a2c.json new file mode 100644 index 0000000000..9d5e17f3cd --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-9429c44d730cc08b4b28804d3d7d5a2c.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-html-57531815410aa78dc10e42270cb201dd-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

L7 地理空间可视化设计语言

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-a7725b15bd64a40f9d4d5eb35340b314.json b/.cache/caches/gatsby-transformer-remark/diskstore-a7725b15bd64a40f9d4d5eb35340b314.json new file mode 100644 index 0000000000..e511d89343 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-a7725b15bd64a40f9d4d5eb35340b314.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-ast-a4fdd704fadc6272a50f61c3eb36ad4b-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"h1","properties":{"id":"popup"},"children":[{"type":"element","tagName":"a","properties":{"href":"#popup","aria-label":"popup permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"popup","position":{"start":{"line":1,"column":3,"offset":2},"end":{"line":1,"column":8,"offset":7}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":8,"offset":7}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图标注信息窗口,用于展示地图要素的属性信息","position":{"start":{"line":3,"column":1,"offset":9},"end":{"line":3,"column":23,"offset":31}}}],"position":{"start":{"line":3,"column":1,"offset":9},"end":{"line":3,"column":23,"offset":31}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"构造函数"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0","aria-label":"构造函数 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"构造函数","position":{"start":{"line":6,"column":4,"offset":37},"end":{"line":6,"column":8,"offset":41}}}],"position":{"start":{"line":6,"column":1,"offset":34},"end":{"line":6,"column":8,"offset":41}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Popup","position":{"start":{"line":7,"column":1,"offset":42},"end":{"line":7,"column":6,"offset":47}}}],"position":{"start":{"line":7,"column":1,"offset":42},"end":{"line":7,"column":6,"offset":47}}},{"type":"text","value":"\n"},{"type":"raw","value":"
const popup = new L7.Popup(option);\n
","position":{"start":{"line":9,"column":1,"offset":49},"end":{"line":11,"column":4,"offset":101}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"option"},"children":[{"type":"element","tagName":"a","properties":{"href":"#option","aria-label":"option permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"option","position":{"start":{"line":14,"column":6,"offset":109},"end":{"line":14,"column":12,"offset":115}}}],"position":{"start":{"line":14,"column":1,"offset":104},"end":{"line":14,"column":12,"offset":115}}},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"closeButton","position":{"start":{"line":16,"column":3,"offset":119},"end":{"line":16,"column":14,"offset":130}}}],"position":{"start":{"line":16,"column":1,"offset":117},"end":{"line":16,"column":14,"offset":130}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"closeOnClick","position":{"start":{"line":17,"column":3,"offset":133},"end":{"line":17,"column":15,"offset":145}}}],"position":{"start":{"line":17,"column":1,"offset":131},"end":{"line":17,"column":15,"offset":145}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"maxWidth","position":{"start":{"line":18,"column":3,"offset":148},"end":{"line":18,"column":11,"offset":156}}}],"position":{"start":{"line":18,"column":1,"offset":146},"end":{"line":18,"column":11,"offset":156}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"anchor","position":{"start":{"line":19,"column":3,"offset":159},"end":{"line":19,"column":9,"offset":165}}}],"position":{"start":{"line":19,"column":1,"offset":157},"end":{"line":19,"column":9,"offset":165}}},{"type":"text","value":"\n"}],"position":{"start":{"line":16,"column":1,"offset":117},"end":{"line":19,"column":9,"offset":165}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"方法"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%96%B9%E6%B3%95","aria-label":"方法 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"方法","position":{"start":{"line":22,"column":4,"offset":171},"end":{"line":22,"column":6,"offset":173}}}],"position":{"start":{"line":22,"column":1,"offset":168},"end":{"line":22,"column":6,"offset":173}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"setlnglat"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setlnglat","aria-label":"setlnglat permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setLnglat","position":{"start":{"line":24,"column":6,"offset":180},"end":{"line":24,"column":15,"offset":189}}}],"position":{"start":{"line":24,"column":1,"offset":175},"end":{"line":24,"column":15,"offset":189}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置popup的经纬度位置","position":{"start":{"line":25,"column":1,"offset":190},"end":{"line":25,"column":14,"offset":203}}},{"type":"raw","value":"
","position":{"start":{"line":25,"column":14,"offset":203},"end":{"line":25,"column":20,"offset":209}}},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"参数","position":{"start":{"line":25,"column":22,"offset":211},"end":{"line":25,"column":24,"offset":213}}}],"position":{"start":{"line":25,"column":20,"offset":209},"end":{"line":25,"column":26,"offset":215}}},{"type":"text","value":":lnglat 经纬度数组 ","position":{"start":{"line":25,"column":26,"offset":215},"end":{"line":25,"column":40,"offset":229}}},{"type":"text","value":"[112,32]","position":{"start":{"line":25,"column":41,"offset":230},"end":{"line":25,"column":47,"offset":236}}}],"position":{"start":{"line":25,"column":1,"offset":190},"end":{"line":25,"column":48,"offset":237}}},{"type":"text","value":"\n"},{"type":"raw","value":"
popup.setLnglat([112, 32]);\n
","position":{"start":{"line":27,"column":1,"offset":239},"end":{"line":29,"column":4,"offset":284}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"addto"},"children":[{"type":"element","tagName":"a","properties":{"href":"#addto","aria-label":"addto permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"addTo","position":{"start":{"line":32,"column":6,"offset":292},"end":{"line":32,"column":11,"offset":297}}}],"position":{"start":{"line":32,"column":1,"offset":287},"end":{"line":32,"column":11,"offset":297}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"参数","position":{"start":{"line":33,"column":3,"offset":300},"end":{"line":33,"column":5,"offset":302}}}],"position":{"start":{"line":33,"column":1,"offset":298},"end":{"line":33,"column":7,"offset":304}}},{"type":"text","value":":scene 地图scene实例","position":{"start":{"line":33,"column":7,"offset":304},"end":{"line":33,"column":23,"offset":320}}}],"position":{"start":{"line":33,"column":1,"offset":298},"end":{"line":33,"column":23,"offset":320}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"将popup添加到地图scene显示","position":{"start":{"line":35,"column":1,"offset":322},"end":{"line":35,"column":19,"offset":340}}}],"position":{"start":{"line":35,"column":1,"offset":322},"end":{"line":35,"column":19,"offset":340}}},{"type":"text","value":"\n"},{"type":"raw","value":"
popup.addTo(scene);\n
","position":{"start":{"line":37,"column":1,"offset":342},"end":{"line":39,"column":4,"offset":379}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"sethtml"},"children":[{"type":"element","tagName":"a","properties":{"href":"#sethtml","aria-label":"sethtml permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setHtml","position":{"start":{"line":42,"column":6,"offset":387},"end":{"line":42,"column":13,"offset":394}}}],"position":{"start":{"line":42,"column":1,"offset":382},"end":{"line":42,"column":13,"offset":394}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"参数","position":{"start":{"line":43,"column":3,"offset":397},"end":{"line":43,"column":5,"offset":399}}}],"position":{"start":{"line":43,"column":1,"offset":395},"end":{"line":43,"column":7,"offset":401}}},{"type":"text","value":":html 字符串","position":{"start":{"line":43,"column":7,"offset":401},"end":{"line":43,"column":16,"offset":410}}}],"position":{"start":{"line":43,"column":1,"offset":395},"end":{"line":43,"column":16,"offset":410}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置popup html 内容","position":{"start":{"line":45,"column":1,"offset":412},"end":{"line":45,"column":16,"offset":427}}}],"position":{"start":{"line":45,"column":1,"offset":412},"end":{"line":45,"column":16,"offset":427}}},{"type":"text","value":"\n"},{"type":"raw","value":"
var html =\n  '<p>\\u7701\\u4EFD\\uFF1A' +\n  feature.s +\n  '</p>\\n        <p>\\u5730\\u533A\\uFF1A' +\n  feature.m +\n  '</p>\\n        <p>\\u6E29\\u5EA6\\uFF1A' +\n  feature.t +\n  '</p>\\n        ';\npopup.setHtml(html);\n
","position":{"start":{"line":47,"column":1,"offset":429},"end":{"line":51,"column":4,"offset":639}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"settext"},"children":[{"type":"element","tagName":"a","properties":{"href":"#settext","aria-label":"settext permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setText","position":{"start":{"line":54,"column":6,"offset":647},"end":{"line":54,"column":13,"offset":654}}}],"position":{"start":{"line":54,"column":1,"offset":642},"end":{"line":54,"column":13,"offset":654}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置 popup 显示文本内容","position":{"start":{"line":55,"column":1,"offset":655},"end":{"line":55,"column":16,"offset":670}}}],"position":{"start":{"line":55,"column":1,"offset":655},"end":{"line":55,"column":16,"offset":670}}},{"type":"text","value":"\n"},{"type":"raw","value":"
popup.setText('hello world');\n
","position":{"start":{"line":57,"column":1,"offset":672},"end":{"line":59,"column":4,"offset":719}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"remove"},"children":[{"type":"element","tagName":"a","properties":{"href":"#remove","aria-label":"remove permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"remove","position":{"start":{"line":62,"column":6,"offset":727},"end":{"line":62,"column":12,"offset":733}}}],"position":{"start":{"line":62,"column":1,"offset":722},"end":{"line":62,"column":12,"offset":733}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除popup","position":{"start":{"line":63,"column":1,"offset":734},"end":{"line":63,"column":8,"offset":741}}}],"position":{"start":{"line":63,"column":1,"offset":734},"end":{"line":63,"column":8,"offset":741}}},{"type":"text","value":"\n"},{"type":"raw","value":"
popup.remove();\n
","position":{"start":{"line":65,"column":1,"offset":743},"end":{"line":67,"column":4,"offset":775}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"事件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E4%BA%8B%E4%BB%B6","aria-label":"事件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"事件","position":{"start":{"line":70,"column":4,"offset":781},"end":{"line":70,"column":6,"offset":783}}}],"position":{"start":{"line":70,"column":1,"offset":778},"end":{"line":70,"column":6,"offset":783}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"close"},"children":[{"type":"element","tagName":"a","properties":{"href":"#close","aria-label":"close permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"close","position":{"start":{"line":72,"column":6,"offset":790},"end":{"line":72,"column":11,"offset":795}}}],"position":{"start":{"line":72,"column":1,"offset":785},"end":{"line":72,"column":11,"offset":795}}},{"type":"text","value":"\n"},{"type":"raw","value":"
popup.on('close', () => {});\n
","position":{"start":{"line":74,"column":1,"offset":797},"end":{"line":76,"column":4,"offset":839}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"示例代码"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81","aria-label":"示例代码 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"示例代码","position":{"start":{"line":79,"column":4,"offset":845},"end":{"line":79,"column":8,"offset":849}}}],"position":{"start":{"line":79,"column":1,"offset":842},"end":{"line":79,"column":8,"offset":849}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"添加popup"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%B7%BB%E5%8A%A0popup","aria-label":"添加popup permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"添加popup","position":{"start":{"line":81,"column":6,"offset":856},"end":{"line":81,"column":13,"offset":863}}}],"position":{"start":{"line":81,"column":1,"offset":851},"end":{"line":81,"column":13,"offset":863}}},{"type":"text","value":"\n"},{"type":"raw","value":"
  var html = '<p>'+feature.m+'</p>';\n  const new L7.Popup().setLnglat([112, 32]).setHTML(html).addTo(scene);
","position":{"start":{"line":83,"column":1,"offset":865},"end":{"line":86,"column":4,"offset":981}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"faq"},"children":[{"type":"element","tagName":"a","properties":{"href":"#faq","aria-label":"faq permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"FAQ","position":{"start":{"line":88,"column":5,"offset":987},"end":{"line":88,"column":8,"offset":990}}}],"position":{"start":{"line":88,"column":1,"offset":983},"end":{"line":88,"column":8,"offset":990}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":89,"column":1,"offset":991}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-b0407a444ef8acb3f4819a2fd00c5ae3.json b/.cache/caches/gatsby-transformer-remark/diskstore-b0407a444ef8acb3f4819a2fd00c5ae3.json new file mode 100644 index 0000000000..5110e2d73c --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b0407a444ef8acb3f4819a2fd00c5ae3.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-ast-4e775806f930bb554f175748236303d7-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"h1","properties":{"id":"control"},"children":[{"type":"element","tagName":"a","properties":{"href":"#control","aria-label":"control permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"control","position":{"start":{"line":1,"column":3,"offset":2},"end":{"line":1,"column":10,"offset":9}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":10,"offset":9}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图组件 用于控制地图的状态如果平移,缩放,或者展示地图一些的辅助信息如图例,比例尺","position":{"start":{"line":3,"column":1,"offset":11},"end":{"line":3,"column":43,"offset":53}}}],"position":{"start":{"line":3,"column":1,"offset":11},"end":{"line":3,"column":43,"offset":53}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"构造函数"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%9E%84%E9%80%A0%E5%87%BD%E6%95%B0","aria-label":"构造函数 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"构造函数","position":{"start":{"line":6,"column":4,"offset":59},"end":{"line":6,"column":8,"offset":63}}}],"position":{"start":{"line":6,"column":1,"offset":56},"end":{"line":6,"column":8,"offset":63}}},{"type":"text","value":"\n"},{"type":"raw","value":"
const baseControl = new L7.Control.Base(option);\n
","position":{"start":{"line":8,"column":1,"offset":65},"end":{"line":10,"column":4,"offset":131}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"option"},"children":[{"type":"element","tagName":"a","properties":{"href":"#option","aria-label":"option permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"option","position":{"start":{"line":13,"column":6,"offset":139},"end":{"line":13,"column":12,"offset":145}}}],"position":{"start":{"line":13,"column":1,"offset":134},"end":{"line":13,"column":12,"offset":145}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":" position: ","position":{"start":{"line":14,"column":1,"offset":146},"end":{"line":14,"column":12,"offset":157}}},{"type":"raw","value":"string","position":{"start":{"line":14,"column":12,"offset":157},"end":{"line":14,"column":20,"offset":165}}},{"type":"text","value":" 控件位置支持是个方位 ","position":{"start":{"line":14,"column":20,"offset":165},"end":{"line":14,"column":32,"offset":177}}},{"type":"raw","value":"bottomright, topright, bottomleft, topleft","position":{"start":{"line":14,"column":32,"offset":177},"end":{"line":14,"column":76,"offset":221}}}],"position":{"start":{"line":14,"column":1,"offset":146},"end":{"line":14,"column":76,"offset":221}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"scene-内置地图组件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#scene-%E5%86%85%E7%BD%AE%E5%9C%B0%E5%9B%BE%E7%BB%84%E4%BB%B6","aria-label":"scene 内置地图组件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"scene 内置地图组件","position":{"start":{"line":17,"column":6,"offset":229},"end":{"line":17,"column":18,"offset":241}}}],"position":{"start":{"line":17,"column":1,"offset":224},"end":{"line":17,"column":18,"offset":241}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"zoom 地图放大缩小  默认添加","position":{"start":{"line":18,"column":1,"offset":242},"end":{"line":18,"column":18,"offset":259}}},{"type":"raw","value":"
","position":{"start":{"line":18,"column":18,"offset":259},"end":{"line":18,"column":24,"offset":265}}},{"type":"text","value":"Scale 地图比例尺   默认添加","position":{"start":{"line":18,"column":24,"offset":265},"end":{"line":18,"column":42,"offset":283}}},{"type":"raw","value":"
","position":{"start":{"line":18,"column":42,"offset":283},"end":{"line":18,"column":48,"offset":289}}},{"type":"text","value":"attribution 地图数据属性  默认添加","position":{"start":{"line":18,"column":48,"offset":289},"end":{"line":18,"column":72,"offset":313}}},{"type":"raw","value":"
","position":{"start":{"line":18,"column":72,"offset":313},"end":{"line":18,"column":78,"offset":319}}},{"type":"text","value":"layer 图层列表","position":{"start":{"line":18,"column":78,"offset":319},"end":{"line":18,"column":88,"offset":329}}}],"position":{"start":{"line":18,"column":1,"offset":242},"end":{"line":18,"column":88,"offset":329}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"scene配置项设置控件添加状态","position":{"start":{"line":20,"column":3,"offset":333},"end":{"line":20,"column":19,"offset":349}}}],"position":{"start":{"line":20,"column":1,"offset":331},"end":{"line":20,"column":21,"offset":351}}}],"position":{"start":{"line":20,"column":1,"offset":331},"end":{"line":20,"column":21,"offset":351}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene = new L7.scene({\n  zoomControl: true,\n  scaleControl: true,\n  attributionControl: true,\n});\n
","position":{"start":{"line":22,"column":1,"offset":353},"end":{"line":28,"column":4,"offset":469}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":""},"children":[{"type":"element","tagName":"a","properties":{"href":"#","aria-label":" permalink","class":"anchor"},"children":[{"type":"raw","value":""}]}],"position":{"start":{"line":30,"column":1,"offset":471},"end":{"line":30,"column":6,"offset":476}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"zoom"},"children":[{"type":"element","tagName":"a","properties":{"href":"#zoom","aria-label":"zoom permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"Zoom","position":{"start":{"line":32,"column":6,"offset":483},"end":{"line":32,"column":10,"offset":487}}}],"position":{"start":{"line":32,"column":1,"offset":478},"end":{"line":32,"column":10,"offset":487}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"放大缩小组件 默认 左上角","position":{"start":{"line":33,"column":1,"offset":488},"end":{"line":33,"column":14,"offset":501}}}],"position":{"start":{"line":33,"column":1,"offset":488},"end":{"line":33,"column":14,"offset":501}}},{"type":"text","value":"\n"},{"type":"raw","value":"
new L7.Control.Zoom({\n  position: 'topleft',\n}).addTo(scene);\n
","position":{"start":{"line":35,"column":1,"offset":503},"end":{"line":39,"column":4,"offset":590}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"scale"},"children":[{"type":"element","tagName":"a","properties":{"href":"#scale","aria-label":"scale permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"Scale","position":{"start":{"line":42,"column":6,"offset":598},"end":{"line":42,"column":11,"offset":603}}}],"position":{"start":{"line":42,"column":1,"offset":593},"end":{"line":42,"column":11,"offset":603}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"比例尺组件默认左下角","position":{"start":{"line":43,"column":1,"offset":604},"end":{"line":43,"column":11,"offset":614}}}],"position":{"start":{"line":43,"column":1,"offset":604},"end":{"line":43,"column":11,"offset":614}}},{"type":"text","value":"\n"},{"type":"raw","value":"
new L7.Control.Scale({\n  position: 'bottomleft',\n}).addTo(scene);\n
","position":{"start":{"line":45,"column":1,"offset":616},"end":{"line":49,"column":4,"offset":707}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"attribution"},"children":[{"type":"element","tagName":"a","properties":{"href":"#attribution","aria-label":"attribution permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"attribution","position":{"start":{"line":52,"column":6,"offset":715},"end":{"line":52,"column":17,"offset":726}}}],"position":{"start":{"line":52,"column":1,"offset":710},"end":{"line":52,"column":17,"offset":726}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"默认右下角","position":{"start":{"line":53,"column":1,"offset":727},"end":{"line":53,"column":6,"offset":732}}}],"position":{"start":{"line":53,"column":1,"offset":727},"end":{"line":53,"column":6,"offset":732}}},{"type":"text","value":"\n"},{"type":"raw","value":"
new L7.Control.Attribution({\n  position: 'bottomleft',\n}).addTo(scene);\n
","position":{"start":{"line":55,"column":1,"offset":734},"end":{"line":59,"column":4,"offset":830}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"layer"},"children":[{"type":"element","tagName":"a","properties":{"href":"#layer","aria-label":"layer permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"layer","position":{"start":{"line":62,"column":6,"offset":838},"end":{"line":62,"column":11,"offset":843}}}],"position":{"start":{"line":62,"column":1,"offset":833},"end":{"line":62,"column":11,"offset":843}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"图层列表目前只支持可视化overlayers 图层控制","position":{"start":{"line":63,"column":1,"offset":844},"end":{"line":63,"column":28,"offset":871}}}],"position":{"start":{"line":63,"column":1,"offset":844},"end":{"line":63,"column":28,"offset":871}}},{"type":"text","value":"\n"},{"type":"raw","value":"
var overlayers = {\n  围栏填充: layer,\n  围栏边界: layer2,\n};\nnew L7.Control.Layers({\n  overlayers: overlayers,\n}).addTo(scene);\n
","position":{"start":{"line":65,"column":1,"offset":873},"end":{"line":73,"column":4,"offset":1031}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"方法"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E6%96%B9%E6%B3%95","aria-label":"方法 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"方法","position":{"start":{"line":76,"column":4,"offset":1037},"end":{"line":76,"column":6,"offset":1039}}}],"position":{"start":{"line":76,"column":1,"offset":1034},"end":{"line":76,"column":6,"offset":1039}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"onadd"},"children":[{"type":"element","tagName":"a","properties":{"href":"#onadd","aria-label":"onadd permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"onAdd","position":{"start":{"line":78,"column":6,"offset":1046},"end":{"line":78,"column":11,"offset":1051}}}],"position":{"start":{"line":78,"column":1,"offset":1041},"end":{"line":78,"column":11,"offset":1051}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"组件添加到地图Scene时调用,自定义组件时需要实现此方法","position":{"start":{"line":79,"column":1,"offset":1052},"end":{"line":79,"column":30,"offset":1081}}}],"position":{"start":{"line":79,"column":1,"offset":1052},"end":{"line":79,"column":30,"offset":1081}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"addto"},"children":[{"type":"element","tagName":"a","properties":{"href":"#addto","aria-label":"addto permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"addTo","position":{"start":{"line":82,"column":6,"offset":1089},"end":{"line":82,"column":11,"offset":1094}}}],"position":{"start":{"line":82,"column":1,"offset":1084},"end":{"line":82,"column":11,"offset":1094}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"添加到地图scene","position":{"start":{"line":83,"column":1,"offset":1095},"end":{"line":83,"column":11,"offset":1105}}}],"position":{"start":{"line":83,"column":1,"offset":1095},"end":{"line":83,"column":11,"offset":1105}}},{"type":"text","value":"\n"},{"type":"raw","value":"
control.addTo(scene);\n
","position":{"start":{"line":85,"column":1,"offset":1107},"end":{"line":87,"column":4,"offset":1146}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"setposition"},"children":[{"type":"element","tagName":"a","properties":{"href":"#setposition","aria-label":"setposition permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"setPosition","position":{"start":{"line":90,"column":6,"offset":1154},"end":{"line":90,"column":17,"offset":1165}}}],"position":{"start":{"line":90,"column":1,"offset":1149},"end":{"line":90,"column":17,"offset":1165}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置组件位置","position":{"start":{"line":91,"column":1,"offset":1166},"end":{"line":91,"column":7,"offset":1172}}}],"position":{"start":{"line":91,"column":1,"offset":1166},"end":{"line":91,"column":7,"offset":1172}}},{"type":"text","value":"\n"},{"type":"raw","value":"
control.setPosition('bottomright');\n
","position":{"start":{"line":93,"column":1,"offset":1174},"end":{"line":95,"column":4,"offset":1227}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"remove"},"children":[{"type":"element","tagName":"a","properties":{"href":"#remove","aria-label":"remove permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"remove","position":{"start":{"line":98,"column":6,"offset":1235},"end":{"line":98,"column":12,"offset":1241}}}],"position":{"start":{"line":98,"column":1,"offset":1230},"end":{"line":98,"column":12,"offset":1241}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除地图组件","position":{"start":{"line":99,"column":1,"offset":1242},"end":{"line":99,"column":7,"offset":1248}}}],"position":{"start":{"line":99,"column":1,"offset":1242},"end":{"line":99,"column":7,"offset":1248}}},{"type":"text","value":"\n"},{"type":"raw","value":"
control.remove();\n
","position":{"start":{"line":101,"column":1,"offset":1250},"end":{"line":103,"column":4,"offset":1285}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"示例代码"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81","aria-label":"示例代码 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"示例代码","position":{"start":{"line":107,"column":4,"offset":1292},"end":{"line":107,"column":8,"offset":1296}}}],"position":{"start":{"line":107,"column":1,"offset":1289},"end":{"line":107,"column":8,"offset":1296}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h4","properties":{"id":"自定义图例控件"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%9B%BE%E4%BE%8B%E6%8E%A7%E4%BB%B6","aria-label":"自定义图例控件 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"自定义图例控件","position":{"start":{"line":110,"column":6,"offset":1304},"end":{"line":110,"column":13,"offset":1311}}}],"position":{"start":{"line":110,"column":1,"offset":1299},"end":{"line":110,"column":13,"offset":1311}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"a","properties":{"href":"https://antv.alipay.com/zh-cn/l7/1.x/demo/component/extendControl.html","target":"_self","rel":"nofollow"},"children":[{"type":"text","value":"源码","position":{"start":{"line":111,"column":2,"offset":1313},"end":{"line":111,"column":4,"offset":1315}}}],"position":{"start":{"line":111,"column":1,"offset":1312},"end":{"line":111,"column":77,"offset":1388}}}],"position":{"start":{"line":111,"column":1,"offset":1312},"end":{"line":111,"column":77,"offset":1388}}},{"type":"text","value":"\n"},{"type":"raw","value":"
var legend = new L7.Control.Base({\n  position: 'bottomright',\n});\nlegend.onAdd = function() {\n  var el = document.createElement('div');\n  el.className = 'infolegend legend';\n  var grades = [0, 8, 15, 30, 65, 120];\n  for (var i = 0; i < grades.length; i++) {\n    el.innerHTML +=\n      '<i style=\"background:' +\n      colors[i] +\n      '\"></i> ' +\n      grades[i] +\n      (grades[i + 1] ? '–' + grades[i + 1] + '<br>' : '+');\n  }\n  return el;\n};\nlegend.addTo(scene);\n
","position":{"start":{"line":113,"column":1,"offset":1390},"end":{"line":128,"column":4,"offset":1914}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"-1"},"children":[{"type":"element","tagName":"a","properties":{"href":"#-1","aria-label":" 1 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]}],"position":{"start":{"line":130,"column":1,"offset":1916},"end":{"line":130,"column":4,"offset":1919}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"faq"},"children":[{"type":"element","tagName":"a","properties":{"href":"#faq","aria-label":"faq permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"FAQ","position":{"start":{"line":132,"column":4,"offset":1924},"end":{"line":132,"column":7,"offset":1927}}}],"position":{"start":{"line":132,"column":1,"offset":1921},"end":{"line":132,"column":7,"offset":1927}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":134,"column":1,"offset":1929}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-b089023713dde4294665d832c48ccd63.json b/.cache/caches/gatsby-transformer-remark/diskstore-b089023713dde4294665d832c48ccd63.json new file mode 100644 index 0000000000..4010140e01 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b089023713dde4294665d832c48ccd63.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-toc-a4fdd704fadc6272a50f61c3eb36ad4b-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-b923ecb39dc7dd6f4752bf9bbf5c94da.json b/.cache/caches/gatsby-transformer-remark/diskstore-b923ecb39dc7dd6f4752bf9bbf5c94da.json new file mode 100644 index 0000000000..f9722eff41 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b923ecb39dc7dd6f4752bf9bbf5c94da.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-4e775806f930bb554f175748236303d7-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

control

\n

地图组件 用于控制地图的状态如果平移,缩放,或者展示地图一些的辅助信息如图例,比例尺

\n

构造函数

\n
const baseControl = new L7.Control.Base(option);\n
\n

option

\n

 position: string 控件位置支持是个方位 bottomright, topright, bottomleft, topleft

\n

scene 内置地图组件

\n

zoom 地图放大缩小  默认添加
Scale 地图比例尺   默认添加
attribution 地图数据属性  默认添加
layer 图层列表

\n

scene配置项设置控件添加状态

\n
scene = new L7.scene({\n  zoomControl: true,\n  scaleControl: true,\n  attributionControl: true,\n});\n
\n

\n

Zoom

\n

放大缩小组件 默认 左上角

\n
new L7.Control.Zoom({\n  position: 'topleft',\n}).addTo(scene);\n
\n

Scale

\n

比例尺组件默认左下角

\n
new L7.Control.Scale({\n  position: 'bottomleft',\n}).addTo(scene);\n
\n

attribution

\n

默认右下角

\n
new L7.Control.Attribution({\n  position: 'bottomleft',\n}).addTo(scene);\n
\n

layer

\n

图层列表目前只支持可视化overlayers 图层控制

\n
var overlayers = {\n  围栏填充: layer,\n  围栏边界: layer2,\n};\nnew L7.Control.Layers({\n  overlayers: overlayers,\n}).addTo(scene);\n
\n

方法

\n

onAdd

\n

组件添加到地图Scene时调用,自定义组件时需要实现此方法

\n

addTo

\n

添加到地图scene

\n
control.addTo(scene);\n
\n

setPosition

\n

设置组件位置

\n
control.setPosition('bottomright');\n
\n

remove

\n

移除地图组件

\n
control.remove();\n
\n

示例代码

\n

自定义图例控件

\n

源码

\n
var legend = new L7.Control.Base({\n  position: 'bottomright',\n});\nlegend.onAdd = function() {\n  var el = document.createElement('div');\n  el.className = 'infolegend legend';\n  var grades = [0, 8, 15, 30, 65, 120];\n  for (var i = 0; i < grades.length; i++) {\n    el.innerHTML +=\n      '<i style=\"background:' +\n      colors[i] +\n      '\"></i> ' +\n      grades[i] +\n      (grades[i + 1] ? '–' + grades[i + 1] + '<br>' : '+');\n  }\n  return el;\n};\nlegend.addTo(scene);\n
\n

\n

FAQ

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-bee012580db1a2e5f57e03421caf971f.json b/.cache/caches/gatsby-transformer-remark/diskstore-bee012580db1a2e5f57e03421caf971f.json new file mode 100644 index 0000000000..5714159f3a --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-bee012580db1a2e5f57e03421caf971f.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-ast-51dbb367647851670b43ae45a9e937df-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"内容","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":3,"offset":3},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":3,"offset":3},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":3,"column":1,"offset":4}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json b/.cache/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json new file mode 100644 index 0000000000..f83c907429 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-a4fdd704fadc6272a50f61c3eb36ad4b-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

popup

\n

地图标注信息窗口,用于展示地图要素的属性信息

\n

构造函数

\n

Popup

\n
const popup = new L7.Popup(option);\n
\n

option

\n
    \n
  • closeButton
  • \n
  • closeOnClick
  • \n
  • maxWidth
  • \n
  • anchor
  • \n
\n

方法

\n

setLnglat

\n

设置popup的经纬度位置
参数:lnglat 经纬度数组 [112,32]

\n
popup.setLnglat([112, 32]);\n
\n

addTo

\n

参数:scene 地图scene实例

\n

将popup添加到地图scene显示

\n
popup.addTo(scene);\n
\n

setHtml

\n

参数:html 字符串

\n

设置popup html 内容

\n
var html =\n  '<p>\\u7701\\u4EFD\\uFF1A' +\n  feature.s +\n  '</p>\\n        <p>\\u5730\\u533A\\uFF1A' +\n  feature.m +\n  '</p>\\n        <p>\\u6E29\\u5EA6\\uFF1A' +\n  feature.t +\n  '</p>\\n        ';\npopup.setHtml(html);\n
\n

setText

\n

设置 popup 显示文本内容

\n
popup.setText('hello world');\n
\n

remove

\n

移除popup

\n
popup.remove();\n
\n

事件

\n

close

\n
popup.on('close', () => {});\n
\n

示例代码

\n

添加popup

\n
  var html = '<p>'+feature.m+'</p>';\n  const new L7.Popup().setLnglat([112, 32]).setHTML(html).addTo(scene);
\n

FAQ

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-d2b3f82b0a8e66040aa810a8958afe0d.json b/.cache/caches/gatsby-transformer-remark/diskstore-d2b3f82b0a8e66040aa810a8958afe0d.json new file mode 100644 index 0000000000..adf86771e9 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-d2b3f82b0a8e66040aa810a8958afe0d.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-d1a5a1e053cc8aaf5e0018566456ceec-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

Marker 地图标注 目前只支持2D dom标注

\n

构造函数

\n

Marker
const Marker = new L7.Marker(option)

\n

option

\n
    \n
  • color        string   \"map-marker.png\" 设置默认marker的颜色
  • \n
  • element    Dom|string    自定义marker Dom节点,可以是dom实例,也可以是dom id
  • \n
  • anchor     string  锚点位置  支持 center, top, top-left, top-right, bottom, bottom-left,bottom-                        right,left, right
  • \n
  • offset    Array  偏移量 [ 0, 0 ] 分别表示 X, Y 的偏移量
  • \n
\n

方法

\n

setLnglat

\n

设置marker经纬度位置

\n

addTo

\n

将marker添加到地图Scene

\n

remove

\n

移除marker

\n

getElement

\n

获取marker dom Element

\n

getLngLat

\n

获取marker经纬度坐标

\n

togglePopup

\n

开启或者关闭marker弹出框

\n

setPopup

\n

为marker设置popup

\n

getPopup

\n

获取marker弹出框

\n

示例代码

\n

默认Marker

\n

**
const marker = new L7.Marker({color:'blue'})

\n

自定义Marker

\n
var el = document.createElement('label');\nel.className = 'lableclass';\nel.textContent = data[i].v;\nel.style.background = getColor(data[i].v);\nnew L7.Marker({\n  element: el,\n})\n  .setLnglat([data[i].x * 1, data[i].y])\n  .addTo(scene);\n
\n

设置 popup

\n
var popup = new L7.Popup({\n  anchor: 'left',\n}).setText(item.name);\n\nnew L7.Marker({\n  element: el,\n})\n  .setLnglat(item.coordinates)\n  .setPopup(popup)\n  .addTo(scene);\n
"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-dc1901f7f1baf243df1556f52717b2ba.json b/.cache/caches/gatsby-transformer-remark/diskstore-dc1901f7f1baf243df1556f52717b2ba.json new file mode 100644 index 0000000000..f69a720a70 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-dc1901f7f1baf243df1556f52717b2ba.json @@ -0,0 +1 @@ +{"expireTime":9007200827720708000,"key":"transformer-remark-markdown-toc-57531815410aa78dc10e42270cb201dd-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-ddc1db31dfe2bcb6d2040bce323f5828.json b/.cache/caches/gatsby-transformer-remark/diskstore-ddc1db31dfe2bcb6d2040bce323f5828.json new file mode 100644 index 0000000000..4bb9a67fb3 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ddc1db31dfe2bcb6d2040bce323f5828.json @@ -0,0 +1 @@ +{"expireTime":9007200827713851000,"key":"transformer-remark-markdown-ast-b1a6eb4a5fb92e03f562537f31f11c68-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"heading","depth":2,"children":[{"type":"link","url":"#数据","title":null,"children":[],"data":{"hProperties":{"aria-label":"数据 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"数据","position":{"start":{"line":2,"column":4,"offset":4},"end":{"line":2,"column":6,"offset":6},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":6,"offset":6},"indent":[]},"data":{"id":"数据","htmlAttributes":{"id":"数据"},"hProperties":{"id":"数据"}}},{"type":"paragraph","children":[{"type":"text","value":"目前L7支持的数据格式有GeoJson,CSV,JSon Image","position":{"start":{"line":4,"column":1,"offset":8},"end":{"line":4,"column":35,"offset":42},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":8},"end":{"line":4,"column":35,"offset":42},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"GeoJSON 支持点、线、面,等所有的空间数据格式。","position":{"start":{"line":6,"column":1,"offset":44},"end":{"line":6,"column":28,"offset":71},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":6,"column":28,"offset":71},"end":{"line":6,"column":34,"offset":77},"indent":[]}},{"type":"text","value":"CSV 支持,点,线段,弧线的支持。","position":{"start":{"line":6,"column":34,"offset":77},"end":{"line":6,"column":52,"offset":95},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":6,"column":52,"offset":95},"end":{"line":6,"column":58,"offset":101},"indent":[]}},{"type":"text","value":"JSON 支持简单的点、线,面,不支持多点,多线的,多面数据格式。","position":{"start":{"line":6,"column":58,"offset":101},"end":{"line":6,"column":91,"offset":134},"indent":[]}}],"position":{"start":{"line":6,"column":1,"offset":44},"end":{"line":6,"column":91,"offset":134},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#geojson","title":null,"children":[],"data":{"hProperties":{"aria-label":"geojson permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"GeoJSON","position":{"start":{"line":9,"column":4,"offset":140},"end":{"line":9,"column":11,"offset":147},"indent":[]}}],"position":{"start":{"line":9,"column":1,"offset":137},"end":{"line":9,"column":11,"offset":147},"indent":[]},"data":{"id":"geojson","htmlAttributes":{"id":"geojson"},"hProperties":{"id":"geojson"}}},{"type":"blockquote","children":[{"type":"paragraph","children":[{"type":"text","value":"GeoJSON是一种对各种地理数据结构进行编码的格式。GeoJSON对象可以表示几何、特征或者特征集合。GeoJSON支持下面几何类型:点、线、面、多点、多线、多面和几何集合。GeoJSON里的特征包含一个几何对象和其他属性,特征集合表示一系列特征。","position":{"start":{"line":11,"column":3,"offset":151},"end":{"line":11,"column":128,"offset":276},"indent":[]}}],"position":{"start":{"line":11,"column":3,"offset":151},"end":{"line":11,"column":128,"offset":276},"indent":[]}}],"position":{"start":{"line":11,"column":1,"offset":149},"end":{"line":11,"column":128,"offset":276},"indent":[]}},{"type":"html","lang":"json","meta":null,"value":"
{\n  \"type\": \"FeatureCollection\",\n  \"features\": [\n    {\n      \"type\": \"Feature\",\n      \"properties\": {},\n      \"geometry\": {\n        \"type\": \"Polygon\",\n        \"coordinates\": [\n          [\n            [110.478515625, 32.76880048488168],\n            [117.68554687499999, 32.76880048488168],\n            [117.68554687499999, 37.64903402157866],\n            [110.478515625, 37.64903402157866],\n            [110.478515625, 32.76880048488168]\n          ]\n        ]\n      }\n    }\n  ]\n}\n
","position":{"start":{"line":15,"column":1,"offset":280},"end":{"line":52,"column":4,"offset":980},"indent":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#地理统计分析工具","title":null,"children":[],"data":{"hProperties":{"aria-label":"地理统计分析工具 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"地理统计分析工具","position":{"start":{"line":54,"column":4,"offset":985},"end":{"line":54,"column":12,"offset":993},"indent":[]}}],"position":{"start":{"line":54,"column":1,"offset":982},"end":{"line":54,"column":12,"offset":993},"indent":[]},"data":{"id":"地理统计分析工具","htmlAttributes":{"id":"地理统计分析工具"},"hProperties":{"id":"地理统计分析工具"}}},{"type":"paragraph","children":[{"type":"link","title":null,"url":"http://turfjs.org/","children":[{"type":"text","value":"turfjs","position":{"start":{"line":55,"column":2,"offset":995},"end":{"line":55,"column":8,"offset":1001},"indent":[]}}],"position":{"start":{"line":55,"column":1,"offset":994},"end":{"line":55,"column":29,"offset":1022},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}},{"type":"text","value":":  地理数据计算,处理,统计,分析的Javascript 库","position":{"start":{"line":55,"column":29,"offset":1022},"end":{"line":55,"column":60,"offset":1053},"indent":[]}}],"position":{"start":{"line":55,"column":1,"offset":994},"end":{"line":55,"column":60,"offset":1053},"indent":[]}},{"type":"heading","depth":2,"children":[{"type":"link","url":"#在线工具","title":null,"children":[],"data":{"hProperties":{"aria-label":"在线工具 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"在线工具","position":{"start":{"line":57,"column":4,"offset":1058},"end":{"line":57,"column":8,"offset":1062},"indent":[]}}],"position":{"start":{"line":57,"column":1,"offset":1055},"end":{"line":57,"column":8,"offset":1062},"indent":[]},"data":{"id":"在线工具","htmlAttributes":{"id":"在线工具"},"hProperties":{"id":"在线工具"}}},{"type":"paragraph","children":[{"type":"link","title":null,"url":"http://geojson.io/","children":[{"type":"text","value":"http://geojson.io/","position":{"start":{"line":59,"column":2,"offset":1065},"end":{"line":59,"column":20,"offset":1083},"indent":[]}}],"position":{"start":{"line":59,"column":1,"offset":1064},"end":{"line":59,"column":41,"offset":1104},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}},{"type":"text","value":"    可以在线查看,绘制,修改GeoJSON数据","position":{"start":{"line":59,"column":41,"offset":1104},"end":{"line":59,"column":66,"offset":1129},"indent":[]}}],"position":{"start":{"line":59,"column":1,"offset":1064},"end":{"line":59,"column":66,"offset":1129},"indent":[]}},{"type":"paragraph","children":[{"type":"link","title":null,"url":"https://mapshaper.org/","children":[{"type":"text","value":"https://mapshaper.org/","position":{"start":{"line":61,"column":2,"offset":1132},"end":{"line":61,"column":24,"offset":1154},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":1131},"end":{"line":61,"column":49,"offset":1179},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}},{"type":"text","value":"  可以查看较大的geojson,还能够简化GeoJSON数据","position":{"start":{"line":61,"column":49,"offset":1179},"end":{"line":61,"column":80,"offset":1210},"indent":[]}}],"position":{"start":{"line":61,"column":1,"offset":1131},"end":{"line":61,"column":80,"offset":1210},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":62,"column":1,"offset":1211}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-df75817e83ad0a2f79b98ce42e6056a8.json b/.cache/caches/gatsby-transformer-remark/diskstore-df75817e83ad0a2f79b98ce42e6056a8.json new file mode 100644 index 0000000000..4c606c67ba --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-df75817e83ad0a2f79b98ce42e6056a8.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-ast-c9cb5e0c306ae6f6211ba629c1a3fc15-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"初始 L7 地图实例","position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":11,"offset":10}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":11,"offset":10}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"何时使用"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E4%BD%95%E6%97%B6%E4%BD%BF%E7%94%A8","aria-label":"何时使用 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"何时使用","position":{"start":{"line":3,"column":5,"offset":16},"end":{"line":3,"column":9,"offset":20}}}],"position":{"start":{"line":3,"column":1,"offset":12},"end":{"line":3,"column":9,"offset":20}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":5,"column":1,"offset":22}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-e49d5822f90847d686ab7ed05c412e0b.json b/.cache/caches/gatsby-transformer-remark/diskstore-e49d5822f90847d686ab7ed05c412e0b.json new file mode 100644 index 0000000000..1f695f7f55 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-e49d5822f90847d686ab7ed05c412e0b.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-a2af20f3d9589fe523949960b78be6a8-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

图表的基本描述。

\n

何时使用

"} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-e72135977ad05cc3007997a59f58e7ed.json b/.cache/caches/gatsby-transformer-remark/diskstore-e72135977ad05cc3007997a59f58e7ed.json new file mode 100644 index 0000000000..3795853c26 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-e72135977ad05cc3007997a59f58e7ed.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-ast-a2af20f3d9589fe523949960b78be6a8-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"图表的基本描述。","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":9,"offset":9},"indent":[]}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":9,"offset":9},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#何时使用","title":null,"children":[],"data":{"hProperties":{"aria-label":"何时使用 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"何时使用","position":{"start":{"line":4,"column":5,"offset":15},"end":{"line":4,"column":9,"offset":19},"indent":[]}}],"position":{"start":{"line":4,"column":1,"offset":11},"end":{"line":4,"column":9,"offset":19},"indent":[]},"data":{"id":"何时使用","htmlAttributes":{"id":"何时使用"},"hProperties":{"id":"何时使用"}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":6,"column":1,"offset":21}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-ec259f9adac459854ebecf9375d97a8d.json b/.cache/caches/gatsby-transformer-remark/diskstore-ec259f9adac459854ebecf9375d97a8d.json new file mode 100644 index 0000000000..c644fdfb56 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ec259f9adac459854ebecf9375d97a8d.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-ast-c9cb5e0c306ae6f6211ba629c1a3fc15-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"paragraph","children":[{"type":"text","value":"初始 L7 地图实例","position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":11,"offset":10},"indent":[]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":1,"column":11,"offset":10},"indent":[]}},{"type":"heading","depth":3,"children":[{"type":"link","url":"#何时使用","title":null,"children":[],"data":{"hProperties":{"aria-label":"何时使用 permalink","class":"anchor"},"hChildren":[{"type":"raw","value":""}]}},{"type":"text","value":"何时使用","position":{"start":{"line":3,"column":5,"offset":16},"end":{"line":3,"column":9,"offset":20},"indent":[]}}],"position":{"start":{"line":3,"column":1,"offset":12},"end":{"line":3,"column":9,"offset":20},"indent":[]},"data":{"id":"何时使用","htmlAttributes":{"id":"何时使用"},"hProperties":{"id":"何时使用"}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":5,"column":1,"offset":22}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-fb18e835921f3dc32ae5b74bdfb36220.json b/.cache/caches/gatsby-transformer-remark/diskstore-fb18e835921f3dc32ae5b74bdfb36220.json new file mode 100644 index 0000000000..e96b7d573e --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fb18e835921f3dc32ae5b74bdfb36220.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-ast-a2af20f3d9589fe523949960b78be6a8-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"图表的基本描述。","position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":9,"offset":9}}}],"position":{"start":{"line":2,"column":1,"offset":1},"end":{"line":2,"column":9,"offset":9}}},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"何时使用"},"children":[{"type":"element","tagName":"a","properties":{"href":"#%E4%BD%95%E6%97%B6%E4%BD%BF%E7%94%A8","aria-label":"何时使用 permalink","class":"anchor"},"children":[{"type":"raw","value":""}]},{"type":"text","value":"何时使用","position":{"start":{"line":4,"column":5,"offset":15},"end":{"line":4,"column":9,"offset":19}}}],"position":{"start":{"line":4,"column":1,"offset":11},"end":{"line":4,"column":9,"offset":19}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":6,"column":1,"offset":21}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-fbddf0de549e59cfa8bf242898a85984.json b/.cache/caches/gatsby-transformer-remark/diskstore-fbddf0de549e59cfa8bf242898a85984.json new file mode 100644 index 0000000000..7caac3363d --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fbddf0de549e59cfa8bf242898a85984.json @@ -0,0 +1 @@ +{"expireTime":9007200827720709000,"key":"transformer-remark-markdown-toc-51dbb367647851670b43ae45a9e937df-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-{\"heading\":null,\"maxDepth\":6,\"pathToSlugField\":\"fields.slug\"}-","val":""} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-fffb15ec8285c18963c880046e7fccce.json b/.cache/caches/gatsby-transformer-remark/diskstore-fffb15ec8285c18963c880046e7fccce.json new file mode 100644 index 0000000000..bfe2b9bfd3 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fffb15ec8285c18963c880046e7fccce.json @@ -0,0 +1 @@ +{"expireTime":9007200827713852000,"key":"transformer-remark-markdown-html-6c75c6b34b379d2a97680d76e3983681-gatsby-remark-prettiergatsby-remark-prismjsgatsby-remark-external-linksgatsby-remark-autolink-headersgatsby-remark-reading-time-","val":"

简介

\n

Scene基础的地图类,提供地图创建,图层创建,管理等功能

\n

示例代码

\n
import {Scene} from '@l7/scene';\nconst scene =new L7.Scene({\n    id:'map'\n    mapStyle:'dark',\n    center:[ 110.770672, 34.159869 ],\n    pitch:45\n})
\n

构造函数

\n

Scene
支持两种实例化方式

\n
    \n
  • 独立实例化 内部根据id自动穿件地图实例
  • \n
  • 传入地图实例
  • \n
\n

独立实例化 Scene

\n
const scene = new L7.Scene({\n  id: 'map',\n  mapStyle: 'dark',\n  center: [120.19382669582967, 30.258134],\n  pitch: 0,\n  zoom: 12,\n  maxZoom: 20,\n  minZoom: 0,\n});\n
\n

根据map 实例创建Sence

\n

_L7 基于高德地图3D模式开发的,因此传入Map实例 _viewModes需要设置成3d
_

\n
var mapinstance = new AMap.Map('map', {\n  center: [120.19382669582967, 30.258134],\n  viewMode: '3D',\n  pitch: 0,\n  zoom: 12,\n  maxZoom: 20,\n  minZoom: 0,\n});\n\nconst scene = new L7.Scene({\n  mapStyle: 'dark',\n  map: mapinstance,\n});\n
\n

map

\n

L7 在scene 下保留了高德地图实例,可以通过scene.map 调用高德地图的map方法。
map 实例方法见高德地图文档

\n
scene.map;\n
\n

构造类

\n

PointLayer

\n

新建点图层

\n

PolylineLayer

\n

新建线图层

\n

PolygonLayer

\n

新建面图层

\n

ImageLayer

\n

新建图片图层

\n

配置项

\n

id

\n

需传入 dom 容器或者容器 id  {domObject || string} [必选]

\n

zoom

\n

地图初始显示级别 {number} (0-22)

\n

center

\n

地图初始中心经纬度 {Lnglat}

\n

pitch

\n

地图初始俯仰角度 {number}  default 0

\n

mapSyle

\n

地图样式 {style} 目前仅支持高德地图。 default 'dark'
L7 内置三种种默认地图样式 dark | light|blank 空地图

\n

设置地图的显示样式,目前支持两种地图样式:
第一种:自定义地图样式,如"amap://styles/d6bf8c1d69cea9f5c696185ad4ac4c86"
可前往地图自定义平台定制自己的个性地图样式;
第二种:官方样式模版,如"amap://styles/grey"
其他模版样式及自定义地图的使用说明见开发指南

\n

minZoom

\n

地图最小缩放等级 {number}  default 0 (0-22)

\n

maxZoom

\n

地图最大缩放等级 {number}  default 22 (0-22)

\n

rotateEnable

\n

地图是否可旋转 {Boolean} default true

\n

方法

\n

getZoom

\n

获取当前缩放等级

\n
scene.getZoom();\n
\n

return {float}  当前缩放等级

\n

getLayers()

\n

获取所有的地图图层

\n
scene.getLayers();\n
\n

return 图层数组 {Array}

\n

getCenter()

\n

获取地图中心点

\n
scene.getCenter();\n
\n

return {Lnglat} :地图中心点

\n

getSize()

\n

获取地图容器大小

\n
scene.getSize();\n
\n

return { Object } 地图容器的 width,height

\n

getPitch()

\n

获取地图俯仰角

\n
scene.getPitch();\n
\n

return {number} pitch

\n

setCenter()

\n

设置地图中心点坐标

\n
scene.setCenter([lng, lat]);\n
\n

参数:center {LngLat} 地图中心点

\n

setZoomAndCenter

\n

设置地图等级和中心

\n
scene.setZoomAndCenter(zoom, center);\n
\n

参数:zoom {number}
center {LngLat}

\n

setRotation

\n

设置地图顺时针旋转角度,旋转原点为地图容器中心点,取值范围 [0-360]

\n
scene.setRotation(rotation);\n
\n

参数: rotation {number}

\n

zoomIn

\n

地图放大一级

\n
scene.zoomIn();\n
\n

zoomOut

\n

地图缩小一级

\n
scene.ZoomOUt();\n
\n

panTo

\n

地图平移到指定的位置

\n
scene.panTo(LngLat);\n
\n

参数:center LngLat 中心位置坐标

\n

panBy

\n

以像素为单位沿X方向和Y方向移动地图

\n
scene.panBy(x, y);\n
\n

参数:
x {number} 水平方向移动像素 向右为正方向
      y {number} 垂直方向移动像素 向下为正方向

\n

setPitch

\n

设置地图仰俯角度

\n
scene.setPitch(pitch);\n
\n

参数 :
   pitch {number}

\n

\n

setStatus

\n

设置当前地图显示状态,包括是否可鼠标拖拽移动地图、地图是否可缩放、地图是否可旋转(rotateEnable)、是否可双击放大地图、是否可以通过键盘控制地图旋转(keyboardEnable)等   

\n
scene.setStatus({\n  dragEnable: true,\n  keyboardEnable: true,\n  doubleClickZoom: true,\n  zoomEnable: true,\n  rotateEnable: true,\n});\n
\n

fitBounds

\n

地图缩放到某个范围内
参数 :
  extent { array} 经纬度范围 [minlng,minlat,maxlng,maxlat]

\n
scene.fitBounds([112, 32, 114, 35]);\n
\n

removeLayer

\n

移除layer

\n
scene.removeLayer(layer);\n
\n

参数
layer {Layer}

\n

getLayers

\n

 获取所有的layer

\n
scene.getLayers();\n
\n

return layers  {array}

\n

事件

\n

on

\n

事件监听

\n

参数

\n

eventName {string} 事件名
hander {function } 事件回调函数

\n

off

\n

移除事件监听
eventName {string} 事件名
hander {function } 事件回调函数

\n

地图事件

\n
scene.on('loaded', () => {}); //地图加载完成触发\nscene.on('mapmove', () => {}); // 地图平移时触发事件\nscene.on('movestart', () => {}); // 地图平移开始时触发\nscene.on('moveend', () => {}); // 地图移动结束后触发,包括平移,以及中心点变化的缩放。如地图有拖拽缓动效果,则在缓动结束后触发\nscene.on('zoomchange', () => {}); // 地图缩放级别更改后触发\nscene.on('zoomstart', () => {}); // 缩放开始时触发\nscene.on('zoomend', () => {}); // 缩放停止时触发\n
\n

鼠标事件

\n
scene.on('click', (ev) => {}); // 鼠标左键点击事件\nscene.on('dblclick', (ev) => {}); // 鼠标左键双击事件\nscene.on('mousemove', (ev) => {}); // 鼠标在地图上移动时触发\nscene.on('mousewheel', (ev) => {}); // 鼠标滚轮开始缩放地图时触发\nscene.on('mouseover', (ev) => {}); // 鼠标移入地图容器内时触发\nscene.on('mouseout', (ev) => {}); // 鼠标移出地图容器时触发\nscene.on('mouseup', (ev) => {}); // 鼠标在地图上单击抬起时触发\nscene.on('mousedown', (ev) => {}); // 鼠标在地图上单击按下时触发\nscene.on('rightclick', (ev) => {}); // 鼠标右键单击事件\nscene.on('dragstart', (ev) => {}); //开始拖拽地图时触发\nscene.on('dragging', (ev) => {}); // 拖拽地图过程中触发\nscene.on('dragend', (ev) => {}); //停止拖拽地图时触发。如地图有拖拽缓动效果,则在拽停止,缓动开始前触发\n
\n

其它事件

\n
scene.on('resize', () => {}); // 地图容器大小改变事件\n
"} \ No newline at end of file diff --git a/.cache/commonjs/api-runner-browser-plugins.js b/.cache/commonjs/api-runner-browser-plugins.js new file mode 100644 index 0000000000..856ca4608f --- /dev/null +++ b/.cache/commonjs/api-runner-browser-plugins.js @@ -0,0 +1,15 @@ +"use strict"; + +// During bootstrap, we write requires at top of this file which looks +// basically like: +// module.exports = [ +// { +// plugin: require("/path/to/plugin1/gatsby-browser.js"), +// options: { ... }, +// }, +// { +// plugin: require("/path/to/plugin2/gatsby-browser.js"), +// options: { ... }, +// }, +// ] +module.exports = []; \ No newline at end of file diff --git a/.cache/commonjs/api-runner-browser.js b/.cache/commonjs/api-runner-browser.js new file mode 100644 index 0000000000..fb76cb89a6 --- /dev/null +++ b/.cache/commonjs/api-runner-browser.js @@ -0,0 +1,61 @@ +"use strict"; + +const plugins = require(`./api-runner-browser-plugins`); + +const { + getResourcesForPathname, + getResourcesForPathnameSync, + getResourceURLsForPathname, + loadPage, + loadPageSync +} = require(`./loader`).publicLoader; + +exports.apiRunner = (api, args = {}, defaultReturn, argTransform) => { + // Hooks for gatsby-cypress's API handler + if (process.env.CYPRESS_SUPPORT) { + if (window.___apiHandler) { + window.___apiHandler(api); + } else if (window.___resolvedAPIs) { + window.___resolvedAPIs.push(api); + } else { + window.___resolvedAPIs = [api]; + } + } + + let results = plugins.map(plugin => { + if (!plugin.plugin[api]) { + return undefined; + } // Deprecated April 2019. Use `loadPageSync` instead + + + args.getResourcesForPathnameSync = getResourcesForPathnameSync; // Deprecated April 2019. Use `loadPage` instead + + args.getResourcesForPathname = getResourcesForPathname; + args.getResourceURLsForPathname = getResourceURLsForPathname; + args.loadPage = loadPage; + args.loadPageSync = loadPageSync; + const result = plugin.plugin[api](args, plugin.options); + + if (result && argTransform) { + args = argTransform({ + args, + result, + plugin + }); + } + + return result; + }); // Filter out undefined results. + + results = results.filter(result => typeof result !== `undefined`); + + if (results.length > 0) { + return results; + } else if (defaultReturn) { + return [defaultReturn]; + } else { + return []; + } +}; + +exports.apiRunnerAsync = (api, args, defaultReturn) => plugins.reduce((previous, next) => next.plugin[api] ? previous.then(() => next.plugin[api](args, next.options)) : previous, Promise.resolve()); \ No newline at end of file diff --git a/.cache/commonjs/api-runner-ssr.js b/.cache/commonjs/api-runner-ssr.js new file mode 100644 index 0000000000..ba6125debe --- /dev/null +++ b/.cache/commonjs/api-runner-ssr.js @@ -0,0 +1,48 @@ +"use strict"; + +// During bootstrap, we write requires at top of this file which looks like: +// var plugins = [ +// { +// plugin: require("/path/to/plugin1/gatsby-ssr.js"), +// options: { ... }, +// }, +// { +// plugin: require("/path/to/plugin2/gatsby-ssr.js"), +// options: { ... }, +// }, +// ] +const apis = require(`./api-ssr-docs`); // Run the specified API in any plugins that have implemented it + + +module.exports = (api, args, defaultReturn, argTransform) => { + if (!apis[api]) { + console.log(`This API doesn't exist`, api); + } // Run each plugin in series. + // eslint-disable-next-line no-undef + + + let results = plugins.map(plugin => { + if (!plugin.plugin[api]) { + return undefined; + } + + const result = plugin.plugin[api](args, plugin.options); + + if (result && argTransform) { + args = argTransform({ + args, + result + }); + } + + return result; + }); // Filter out undefined results. + + results = results.filter(result => typeof result !== `undefined`); + + if (results.length > 0) { + return results; + } else { + return [defaultReturn]; + } +}; \ No newline at end of file diff --git a/.cache/commonjs/api-ssr-docs.js b/.cache/commonjs/api-ssr-docs.js new file mode 100644 index 0000000000..d1c15c4174 --- /dev/null +++ b/.cache/commonjs/api-ssr-docs.js @@ -0,0 +1,200 @@ +"use strict"; + +/** + * Object containing options defined in `gatsby-config.js` + * @typedef {object} pluginOptions + */ + +/** + * Replace the default server renderer. This is useful for integration with + * Redux, css-in-js libraries, etc. that need custom setups for server + * rendering. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.replaceBodyHTMLString Call this with the HTML string + * you render. **WARNING** if multiple plugins implement this API it's the + * last plugin that "wins". TODO implement an automated warning against this. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * // From gatsby-plugin-glamor + * const { renderToString } = require("react-dom/server") + * const inline = require("glamor-inline") + * + * exports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => { + * const bodyHTML = renderToString(bodyComponent) + * const inlinedHTML = inline(bodyHTML) + * + * replaceBodyHTMLString(inlinedHTML) + * } + */ +exports.replaceRenderer = true; +/** + * Called after every page Gatsby server renders while building HTML so you can + * set head and body components to be rendered in your `html.js`. + * + * Gatsby does a two-pass render for HTML. It loops through your pages first + * rendering only the body and then takes the result body HTML string and + * passes it as the `body` prop to your `html.js` to complete the render. + * + * It's often handy to be able to send custom components to your `html.js`. + * For example, it's a very common pattern for React.js libraries that + * support server rendering to pull out data generated during the render to + * add to your HTML. + * + * Using this API over [`replaceRenderer`](#replaceRenderer) is preferable as + * multiple plugins can implement this API where only one plugin can take + * over server rendering. However, if your plugin requires taking over server + * rendering then that's the one to + * use + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {function} $0.setHeadComponents Takes an array of components as its + * first argument which are added to the `headComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setHtmlAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setBodyAttributes Takes an object of props which will + * spread into the `` component. + * @param {function} $0.setPreBodyComponents Takes an array of components as its + * first argument which are added to the `preBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setPostBodyComponents Takes an array of components as its + * first argument which are added to the `postBodyComponents` array which is passed + * to the `html.js` component. + * @param {function} $0.setBodyProps Takes an object of data which + * is merged with other body props and passed to `html.js` as `bodyProps`. + * @param {pluginOptions} pluginOptions + * @example + * const { Helmet } = require("react-helmet") + * + * exports.onRenderBody = ( + * { setHeadComponents, setHtmlAttributes, setBodyAttributes }, + * pluginOptions + * ) => { + * const helmet = Helmet.renderStatic() + * setHtmlAttributes(helmet.htmlAttributes.toComponent()) + * setBodyAttributes(helmet.bodyAttributes.toComponent()) + * setHeadComponents([ + * helmet.title.toComponent(), + * helmet.link.toComponent(), + * helmet.meta.toComponent(), + * helmet.noscript.toComponent(), + * helmet.script.toComponent(), + * helmet.style.toComponent(), + * ]) + * } + */ + +exports.onRenderBody = true; +/** + * Called after every page Gatsby server renders while building HTML so you can + * replace head components to be rendered in your `html.js`. This is useful if + * you need to reorder scripts or styles added by other plugins. + * @param {object} $0 + * @param {string} $0.pathname The pathname of the page currently being rendered. + * @param {Array} $0.getHeadComponents Returns the current `headComponents` array. + * @param {function} $0.replaceHeadComponents Takes an array of components as its + * first argument which replace the `headComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPreBodyComponents Returns the current `preBodyComponents` array. + * @param {function} $0.replacePreBodyComponents Takes an array of components as its + * first argument which replace the `preBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {Array} $0.getPostBodyComponents Returns the current `postBodyComponents` array. + * @param {function} $0.replacePostBodyComponents Takes an array of components as its + * first argument which replace the `postBodyComponents` array which is passed + * to the `html.js` component. **WARNING** if multiple plugins implement this + * API it's the last plugin that "wins". + * @param {pluginOptions} pluginOptions + * @example + * // Move Typography.js styles to the top of the head section so they're loaded first. + * exports.onPreRenderHTML = ({ getHeadComponents, replaceHeadComponents }) => { + * const headComponents = getHeadComponents() + * headComponents.sort((x, y) => { + * if (x.key === 'TypographyStyle') { + * return -1 + * } else if (y.key === 'TypographyStyle') { + * return 1 + * } + * return 0 + * }) + * replaceHeadComponents(headComponents) + * } + */ + +exports.onPreRenderHTML = true; +/** + * Allow a plugin to wrap the page element. + * + * This is useful for setting wrapper components around pages that won't get + * unmounted on page changes. For setting Provider components, use [wrapRootElement](#wrapRootElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapPageElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using i18n](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-i18n). + * @param {object} $0 + * @param {ReactNode} $0.element The "Page" React Element built by Gatsby. + * @param {object} $0.props Props object used by page. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const Layout = require("./src/components/layout").default + * + * exports.wrapPageElement = ({ element, props }) => { + * // props provide same data to Layout as Page element will get + * // including location, data, etc - you don't need to pass it + * return {element} + * } + */ + +exports.wrapPageElement = true; +/** + * Allow a plugin to wrap the root element. + * + * This is useful to set up any Provider components that will wrap your application. + * For setting persistent UI elements around pages use [wrapPageElement](#wrapPageElement). + * + * _Note:_ + * There is an equivalent hook in Gatsby's [Browser API](/docs/browser-apis/#wrapRootElement). + * It is recommended to use both APIs together. + * For example usage, check out [Using redux](https://github.com/gatsbyjs/gatsby/tree/master/examples/using-redux). + * @param {object} $0 + * @param {ReactNode} $0.element The "Root" React Element built by Gatsby. + * @param {pluginOptions} pluginOptions + * @returns {ReactNode} Wrapped element + * @example + * const React = require("react") + * const { Provider } = require("react-redux") + * + * const createStore = require("./src/state/createStore") + * const store = createStore() + * + * exports.wrapRootElement = ({ element }) => { + * return ( + * + * {element} + * + * ) + * } + */ + +exports.wrapRootElement = true; \ No newline at end of file diff --git a/.cache/commonjs/app.js b/.cache/commonjs/app.js new file mode 100644 index 0000000000..59707c697b --- /dev/null +++ b/.cache/commonjs/app.js @@ -0,0 +1,69 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +var _react = _interopRequireDefault(require("react")); + +var _reactDom = _interopRequireDefault(require("react-dom")); + +var _domready = _interopRequireDefault(require("@mikaelkristiansson/domready")); + +var _socketIo = _interopRequireDefault(require("./socketIo")); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _loader = require("./loader"); + +var _devLoader = _interopRequireDefault(require("./dev-loader")); + +var _syncRequires = _interopRequireDefault(require("./sync-requires")); + +var _matchPaths = _interopRequireDefault(require("./match-paths.json")); + +// Generated during bootstrap +window.___emitter = _emitter.default; +const loader = new _devLoader.default(_syncRequires.default, _matchPaths.default); +(0, _loader.setLoader)(loader); +loader.setApiRunner(_apiRunnerBrowser.apiRunner); +window.___loader = _loader.publicLoader; // Let the site/plugins run code very early. + +(0, _apiRunnerBrowser.apiRunnerAsync)(`onClientEntry`).then(() => { + // Hook up the client to socket.io on server + const socket = (0, _socketIo.default)(); + + if (socket) { + socket.on(`reload`, () => { + window.location.reload(); + }); + } + /** + * Service Workers are persistent by nature. They stick around, + * serving a cached version of the site if they aren't removed. + * This is especially frustrating when you need to test the + * production build on your local machine. + * + * Let's warn if we find service workers in development. + */ + + + if (`serviceWorker` in navigator) { + navigator.serviceWorker.getRegistrations().then(registrations => { + if (registrations.length > 0) console.warn(`Warning: found one or more service workers present.`, `If your site isn't behaving as expected, you might want to remove these.`, registrations); + }); + } + + const rootElement = document.getElementById(`___gatsby`); + const renderer = (0, _apiRunnerBrowser.apiRunner)(`replaceHydrateFunction`, undefined, _reactDom.default.render)[0]; + Promise.all([loader.loadPage(`/dev-404-page/`), loader.loadPage(`/404.html`), loader.loadPage(window.location.pathname)]).then(() => { + const preferDefault = m => m && m.default || m; + + let Root = preferDefault(require(`./root`)); + (0, _domready.default)(() => { + renderer(_react.default.createElement(Root, null), rootElement, () => { + (0, _apiRunnerBrowser.apiRunner)(`onInitialClientRender`); + }); + }); + }); +}); \ No newline at end of file diff --git a/.cache/commonjs/create-react-context.js b/.cache/commonjs/create-react-context.js new file mode 100644 index 0000000000..d8f31c4c3a --- /dev/null +++ b/.cache/commonjs/create-react-context.js @@ -0,0 +1,11 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _default = _react.default.createContext; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/default-html.js b/.cache/commonjs/default-html.js new file mode 100644 index 0000000000..bb6e0bf77e --- /dev/null +++ b/.cache/commonjs/default-html.js @@ -0,0 +1,40 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = HTML; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +function HTML(props) { + return _react.default.createElement("html", props.htmlAttributes, _react.default.createElement("head", null, _react.default.createElement("meta", { + charSet: "utf-8" + }), _react.default.createElement("meta", { + httpEquiv: "x-ua-compatible", + content: "ie=edge" + }), _react.default.createElement("meta", { + name: "viewport", + content: "width=device-width, initial-scale=1, shrink-to-fit=no" + }), props.headComponents), _react.default.createElement("body", props.bodyAttributes, props.preBodyComponents, _react.default.createElement("noscript", { + key: "noscript", + id: "gatsby-noscript" + }, "This app works best with JavaScript enabled."), _react.default.createElement("div", { + key: `body`, + id: "___gatsby", + dangerouslySetInnerHTML: { + __html: props.body + } + }), props.postBodyComponents)); +} + +HTML.propTypes = { + htmlAttributes: _propTypes.default.object, + headComponents: _propTypes.default.array, + bodyAttributes: _propTypes.default.object, + preBodyComponents: _propTypes.default.array, + body: _propTypes.default.string, + postBodyComponents: _propTypes.default.array +}; \ No newline at end of file diff --git a/.cache/commonjs/dev-loader.js b/.cache/commonjs/dev-loader.js new file mode 100644 index 0000000000..e122372a0e --- /dev/null +++ b/.cache/commonjs/dev-loader.js @@ -0,0 +1,41 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _loader = require("./loader"); + +var _findPath = require("./find-path"); + +class DevLoader extends _loader.BaseLoader { + constructor(syncRequires, matchPaths) { + const loadComponent = chunkName => Promise.resolve(syncRequires.components[chunkName]); + + super(loadComponent, matchPaths); + } + + loadPage(pagePath) { + const realPath = (0, _findPath.findPath)(pagePath); + return super.loadPage(realPath).then(result => require(`./socketIo`).getPageData(realPath).then(() => result)); + } + + loadPageDataJson(rawPath) { + return super.loadPageDataJson(rawPath).then(data => { + // when we can't find a proper 404.html we fallback to dev-404-page + // we need to make sure to mark it as not found. + if (data.status === `failure`) { + return this.loadPageDataJson(`/dev-404-page/`).then(result => Object.assign({}, data, result)); + } + + return data; + }); + } + + doPrefetch(pagePath) { + return Promise.resolve(require(`./socketIo`).getPageData(pagePath)); + } + +} + +var _default = DevLoader; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/develop-static-entry.js b/.cache/commonjs/develop-static-entry.js new file mode 100644 index 0000000000..948fea5484 --- /dev/null +++ b/.cache/commonjs/develop-static-entry.js @@ -0,0 +1,135 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _server = require("react-dom/server"); + +var _lodash = require("lodash"); + +var _apiRunnerSsr = _interopRequireDefault(require("./api-runner-ssr")); + +// import testRequireError from "./test-require-error" +// For some extremely mysterious reason, webpack adds the above module *after* +// this module so that when this code runs, testRequireError is undefined. +// So in the meantime, we'll just inline it. +const testRequireError = (moduleName, err) => { + const regex = new RegExp(`Error: Cannot find module\\s.${moduleName}`); + const firstLine = err.toString().split(`\n`)[0]; + return regex.test(firstLine); +}; + +let Html; + +try { + Html = require(`../src/html`); +} catch (err) { + if (testRequireError(`../src/html`, err)) { + Html = require(`./default-html`); + } else { + console.log(`There was an error requiring "src/html.js"\n\n`, err, `\n\n`); + process.exit(); + } +} + +Html = Html && Html.__esModule ? Html.default : Html; + +var _default = (pagePath, callback) => { + let headComponents = [_react.default.createElement("meta", { + key: "environment", + name: "note", + content: "environment=development" + })]; + let htmlAttributes = {}; + let bodyAttributes = {}; + let preBodyComponents = []; + let postBodyComponents = []; + let bodyProps = {}; + let htmlStr; + + const setHeadComponents = components => { + headComponents = headComponents.concat(components); + }; + + const setHtmlAttributes = attributes => { + htmlAttributes = (0, _lodash.merge)(htmlAttributes, attributes); + }; + + const setBodyAttributes = attributes => { + bodyAttributes = (0, _lodash.merge)(bodyAttributes, attributes); + }; + + const setPreBodyComponents = components => { + preBodyComponents = preBodyComponents.concat(components); + }; + + const setPostBodyComponents = components => { + postBodyComponents = postBodyComponents.concat(components); + }; + + const setBodyProps = props => { + bodyProps = (0, _lodash.merge)({}, bodyProps, props); + }; + + const getHeadComponents = () => headComponents; + + const replaceHeadComponents = components => { + headComponents = components; + }; + + const getPreBodyComponents = () => preBodyComponents; + + const replacePreBodyComponents = components => { + preBodyComponents = components; + }; + + const getPostBodyComponents = () => postBodyComponents; + + const replacePostBodyComponents = components => { + postBodyComponents = components; + }; + + (0, _apiRunnerSsr.default)(`onRenderBody`, { + setHeadComponents, + setHtmlAttributes, + setBodyAttributes, + setPreBodyComponents, + setPostBodyComponents, + setBodyProps, + pathname: pagePath + }); + (0, _apiRunnerSsr.default)(`onPreRenderHTML`, { + getHeadComponents, + replaceHeadComponents, + getPreBodyComponents, + replacePreBodyComponents, + getPostBodyComponents, + replacePostBodyComponents, + pathname: pagePath + }); + + const htmlElement = _react.default.createElement(Html, Object.assign({}, bodyProps, { + body: ``, + headComponents: headComponents.concat([_react.default.createElement("script", { + key: `io`, + src: "/socket.io/socket.io.js" + })]), + htmlAttributes, + bodyAttributes, + preBodyComponents, + postBodyComponents: postBodyComponents.concat([_react.default.createElement("script", { + key: `commons`, + src: "/commons.js" + })]) + })); + + htmlStr = (0, _server.renderToStaticMarkup)(htmlElement); + htmlStr = `${htmlStr}`; + callback(null, htmlStr); +}; + +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/emitter.js b/.cache/commonjs/emitter.js new file mode 100644 index 0000000000..eaac98b5f3 --- /dev/null +++ b/.cache/commonjs/emitter.js @@ -0,0 +1,12 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _mitt = _interopRequireDefault(require("mitt")); + +const emitter = (0, _mitt.default)(); +var _default = emitter; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/ensure-resources.js b/.cache/commonjs/ensure-resources.js new file mode 100644 index 0000000000..b6dcecc354 --- /dev/null +++ b/.cache/commonjs/ensure-resources.js @@ -0,0 +1,94 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _loader = _interopRequireDefault(require("./loader")); + +var _shallowCompare = _interopRequireDefault(require("shallow-compare")); + +class EnsureResources extends _react.default.Component { + constructor(props) { + super(); + const { + location, + pageResources + } = props; + this.state = { + location: Object.assign({}, location), + pageResources: pageResources || _loader.default.loadPageSync(location.pathname) + }; + } + + static getDerivedStateFromProps({ + location + }, prevState) { + if (prevState.location.href !== location.href) { + const pageResources = _loader.default.loadPageSync(location.pathname); + + return { + pageResources, + location: Object.assign({}, location) + }; + } + + return { + location: Object.assign({}, location) + }; + } + + loadResources(rawPath) { + _loader.default.loadPage(rawPath).then(pageResources => { + if (pageResources && pageResources.status !== `error`) { + this.setState({ + location: Object.assign({}, window.location), + pageResources + }); + } else { + window.history.replaceState({}, ``, location.href); + window.location = rawPath; + } + }); + } + + shouldComponentUpdate(nextProps, nextState) { + // Always return false if we're missing resources. + if (!nextState.pageResources) { + this.loadResources(nextProps.location.pathname); + return false; + } // Check if the component or json have changed. + + + if (this.state.pageResources !== nextState.pageResources) { + return true; + } + + if (this.state.pageResources.component !== nextState.pageResources.component) { + return true; + } + + if (this.state.pageResources.json !== nextState.pageResources.json) { + return true; + } // Check if location has changed on a page using internal routing + // via matchPath configuration. + + + if (this.state.location.key !== nextState.location.key && nextState.pageResources.page && (nextState.pageResources.page.matchPath || nextState.pageResources.page.path)) { + return true; + } + + return (0, _shallowCompare.default)(this, nextProps, nextState); + } + + render() { + return this.props.children(this.state); + } + +} + +var _default = EnsureResources; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/error-overlay-handler.js b/.cache/commonjs/error-overlay-handler.js new file mode 100644 index 0000000000..41785a572d --- /dev/null +++ b/.cache/commonjs/error-overlay-handler.js @@ -0,0 +1,67 @@ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +exports.__esModule = true; +exports.errorMap = exports.reportError = exports.clearError = void 0; + +var ErrorOverlay = _interopRequireWildcard(require("react-error-overlay")); + +// Report runtime errors +ErrorOverlay.startReportingRuntimeErrors({ + onError: () => {}, + filename: `/commons.js` +}); +ErrorOverlay.setEditorHandler(errorLocation => window.fetch(`/__open-stack-frame-in-editor?fileName=` + window.encodeURIComponent(errorLocation.fileName) + `&lineNumber=` + window.encodeURIComponent(errorLocation.lineNumber || 1))); +const errorMap = {}; +exports.errorMap = errorMap; + +function flat(arr) { + return Array.prototype.flat ? arr.flat() : [].concat(...arr); +} + +const handleErrorOverlay = () => { + const errors = Object.values(errorMap); + let errorStringsToDisplay = []; + + if (errors.length > 0) { + errorStringsToDisplay = flat(errors).map(error => { + if (typeof error === `string`) { + return error; + } else if (typeof error === `object`) { + const errorStrBuilder = [error.text]; + + if (error.filePath) { + errorStrBuilder.push(`File: ${error.filePath}`); + } + + return errorStrBuilder.join(`\n\n`); + } + + return null; + }).filter(Boolean); + } + + if (errorStringsToDisplay.length > 0) { + ErrorOverlay.reportBuildError(errorStringsToDisplay.join(`\n\n`)); + } else { + ErrorOverlay.dismissBuildError(); + } +}; + +const clearError = errorID => { + delete errorMap[errorID]; + handleErrorOverlay(); +}; + +exports.clearError = clearError; + +const reportError = (errorID, error) => { + if (error) { + errorMap[errorID] = error; + } + + handleErrorOverlay(); +}; + +exports.reportError = reportError; \ No newline at end of file diff --git a/.cache/commonjs/find-path.js b/.cache/commonjs/find-path.js new file mode 100644 index 0000000000..f4a2c05af5 --- /dev/null +++ b/.cache/commonjs/find-path.js @@ -0,0 +1,111 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.cleanPath = exports.findPath = exports.findMatchPath = exports.setMatchPaths = void 0; + +var _utils = require("@reach/router/lib/utils"); + +var _stripPrefix = _interopRequireDefault(require("./strip-prefix")); + +var _normalizePagePath = _interopRequireDefault(require("./normalize-page-path")); + +const pathCache = new Map(); +let matchPaths = []; + +const trimPathname = rawPathname => { + let pathname = decodeURIComponent(rawPathname); // Remove the pathPrefix from the pathname. + + let trimmedPathname = (0, _stripPrefix.default)(pathname, __BASE_PATH__) // Remove any hashfragment + .split(`#`)[0] // Remove search query + .split(`?`)[0]; + return trimmedPathname; +}; +/** + * Set list of matchPaths + * + * @param {Array<{path: string, matchPath: string}>} value collection of matchPaths + */ + + +const setMatchPaths = value => { + matchPaths = value; +}; +/** + * Return a matchpath url + * if `match-paths.json` contains `{ "/foo*": "/page1", ...}`, then + * `/foo?bar=far` => `/page1` + * + * @param {string} rawPathname A raw pathname + * @return {string|null} + */ + + +exports.setMatchPaths = setMatchPaths; + +const findMatchPath = rawPathname => { + const trimmedPathname = cleanPath(rawPathname); + + for (const { + matchPath, + path + } of matchPaths) { + if ((0, _utils.match)(matchPath, trimmedPathname)) { + return (0, _normalizePagePath.default)(path); + } + } + + return null; +}; // Given a raw URL path, returns the cleaned version of it (trim off +// `#` and query params), or if it matches an entry in +// `match-paths.json`, its matched path is returned +// +// E.g `/foo?bar=far` => `/foo` +// +// Or if `match-paths.json` contains `{ "/foo*": "/page1", ...}`, then +// `/foo?bar=far` => `/page1` + + +exports.findMatchPath = findMatchPath; + +const findPath = rawPathname => { + const trimmedPathname = trimPathname(rawPathname); + + if (pathCache.has(trimmedPathname)) { + return pathCache.get(trimmedPathname); + } + + let foundPath = findMatchPath(trimmedPathname); + + if (!foundPath) { + foundPath = cleanPath(rawPathname); + } + + pathCache.set(trimmedPathname, foundPath); + return foundPath; +}; +/** + * Clean a url and converts /index.html => / + * E.g `/foo?bar=far` => `/foo` + * + * @param {string} rawPathname A raw pathname + * @return {string} + */ + + +exports.findPath = findPath; + +const cleanPath = rawPathname => { + const trimmedPathname = trimPathname(rawPathname); + let foundPath = trimmedPathname; + + if (foundPath === `/index.html`) { + foundPath = `/`; + } + + foundPath = (0, _normalizePagePath.default)(foundPath); + return foundPath; +}; + +exports.cleanPath = cleanPath; \ No newline at end of file diff --git a/.cache/commonjs/gatsby-browser-entry.js b/.cache/commonjs/gatsby-browser-entry.js new file mode 100644 index 0000000000..d2dc9823f4 --- /dev/null +++ b/.cache/commonjs/gatsby-browser-entry.js @@ -0,0 +1,90 @@ +"use strict"; + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.graphql = graphql; +exports.prefetchPathname = exports.useStaticQuery = exports.StaticQuery = exports.StaticQueryContext = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _gatsbyLink = _interopRequireWildcard(require("gatsby-link")); + +exports.Link = _gatsbyLink.default; +exports.withPrefix = _gatsbyLink.withPrefix; +exports.withAssetPrefix = _gatsbyLink.withAssetPrefix; +exports.navigate = _gatsbyLink.navigate; +exports.push = _gatsbyLink.push; +exports.replace = _gatsbyLink.replace; +exports.navigateTo = _gatsbyLink.navigateTo; +exports.parsePath = _gatsbyLink.parsePath; + +var _publicPageRenderer = _interopRequireDefault(require("./public-page-renderer")); + +exports.PageRenderer = _publicPageRenderer.default; + +var _loader = _interopRequireDefault(require("./loader")); + +const prefetchPathname = _loader.default.enqueue; +exports.prefetchPathname = prefetchPathname; + +const StaticQueryContext = _react.default.createContext({}); + +exports.StaticQueryContext = StaticQueryContext; + +function StaticQueryDataRenderer({ + staticQueryData, + data, + query, + render +}) { + const finalData = data ? data.data : staticQueryData[query] && staticQueryData[query].data; + return _react.default.createElement(_react.default.Fragment, null, finalData && render(finalData), !finalData && _react.default.createElement("div", null, "Loading (StaticQuery)")); +} + +const StaticQuery = props => { + const { + data, + query, + render, + children + } = props; + return _react.default.createElement(StaticQueryContext.Consumer, null, staticQueryData => _react.default.createElement(StaticQueryDataRenderer, { + data: data, + query: query, + render: render || children, + staticQueryData: staticQueryData + })); +}; + +exports.StaticQuery = StaticQuery; + +const useStaticQuery = query => { + if (typeof _react.default.useContext !== `function` && process.env.NODE_ENV === `development`) { + throw new Error(`You're likely using a version of React that doesn't support Hooks\n` + `Please update React and ReactDOM to 16.8.0 or later to use the useStaticQuery hook.`); + } + + const context = _react.default.useContext(StaticQueryContext); + + if (context[query] && context[query].data) { + return context[query].data; + } else { + throw new Error(`The result of this StaticQuery could not be fetched.\n\n` + `This is likely a bug in Gatsby and if refreshing the page does not fix it, ` + `please open an issue in https://github.com/gatsbyjs/gatsby/issues`); + } +}; + +exports.useStaticQuery = useStaticQuery; +StaticQuery.propTypes = { + data: _propTypes.default.object, + query: _propTypes.default.string.isRequired, + render: _propTypes.default.func, + children: _propTypes.default.func +}; + +function graphql() { + throw new Error(`It appears like Gatsby is misconfigured. Gatsby related \`graphql\` calls ` + `are supposed to only be evaluated at compile time, and then compiled away. ` + `Unfortunately, something went wrong and the query was left in the compiled code.\n\n` + `Unless your site has a complex or custom babel/Gatsby configuration this is likely a bug in Gatsby.`); +} \ No newline at end of file diff --git a/.cache/commonjs/json-store.js b/.cache/commonjs/json-store.js new file mode 100644 index 0000000000..734df1c76f --- /dev/null +++ b/.cache/commonjs/json-store.js @@ -0,0 +1,93 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); + +var _react = _interopRequireDefault(require("react")); + +var _pageRenderer = _interopRequireDefault(require("./page-renderer")); + +var _normalizePagePath = _interopRequireDefault(require("./normalize-page-path")); + +var _gatsby = require("gatsby"); + +var _socketIo = require("./socketIo"); + +if (process.env.NODE_ENV === `production`) { + throw new Error(`It appears like Gatsby is misconfigured. JSONStore is Gatsby internal ` + `development-only component and should never be used in production.\n\n` + `Unless your site has a complex or custom webpack/Gatsby ` + `configuration this is likely a bug in Gatsby. ` + `Please report this at https://github.com/gatsbyjs/gatsby/issues ` + `with steps to reproduce this error.`); +} + +const getPathFromProps = props => props.pageResources && props.pageResources.page ? (0, _normalizePagePath.default)(props.pageResources.page.path) : undefined; + +class JSONStore extends _react.default.Component { + constructor(props) { + super(props); + (0, _defineProperty2.default)(this, "handleMittEvent", (type, event) => { + this.setState({ + staticQueryData: (0, _socketIo.getStaticQueryData)(), + pageQueryData: (0, _socketIo.getPageQueryData)() + }); + }); + this.state = { + staticQueryData: (0, _socketIo.getStaticQueryData)(), + pageQueryData: (0, _socketIo.getPageQueryData)(), + path: null + }; + } + + componentDidMount() { + (0, _socketIo.registerPath)(getPathFromProps(this.props)); + + ___emitter.on(`*`, this.handleMittEvent); + } + + componentWillUnmount() { + (0, _socketIo.unregisterPath)(this.state.path); + + ___emitter.off(`*`, this.handleMittEvent); + } + + static getDerivedStateFromProps(props, state) { + const newPath = getPathFromProps(props); + + if (newPath !== state.path) { + (0, _socketIo.unregisterPath)(state.path); + (0, _socketIo.registerPath)(newPath); + return { + path: newPath + }; + } + + return null; + } + + shouldComponentUpdate(nextProps, nextState) { + // We want to update this component when: + // - location changed + // - page data for path changed + // - static query results changed + return this.props.location !== nextProps.location || this.state.path !== nextState.path || this.state.pageQueryData[(0, _normalizePagePath.default)(nextState.path)] !== nextState.pageQueryData[(0, _normalizePagePath.default)(nextState.path)] || this.state.staticQueryData !== nextState.staticQueryData; + } + + render() { + const data = this.state.pageQueryData[getPathFromProps(this.props)]; // eslint-disable-next-line + + if (!data) { + return _react.default.createElement("div", null); + } + + return _react.default.createElement(_gatsby.StaticQueryContext.Provider, { + value: this.state.staticQueryData + }, _react.default.createElement(_pageRenderer.default, (0, _extends2.default)({}, this.props, data))); + } + +} + +var _default = JSONStore; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/loader.js b/.cache/commonjs/loader.js new file mode 100644 index 0000000000..d5150faa0b --- /dev/null +++ b/.cache/commonjs/loader.js @@ -0,0 +1,434 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = exports.publicLoader = exports.setLoader = exports.ProdLoader = exports.BaseLoader = void 0; + +var _prefetch = _interopRequireDefault(require("./prefetch")); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _findPath = require("./find-path"); + +const preferDefault = m => m && m.default || m; + +const stripSurroundingSlashes = s => { + s = s[0] === `/` ? s.slice(1) : s; + s = s.endsWith(`/`) ? s.slice(0, -1) : s; + return s; +}; + +const createPageDataUrl = path => { + const fixedPath = path === `/` ? `index` : stripSurroundingSlashes(path); + return `${__PATH_PREFIX__}/page-data/${fixedPath}/page-data.json`; +}; + +const doFetch = (url, method = `GET`) => new Promise((resolve, reject) => { + const req = new XMLHttpRequest(); + req.open(method, url, true); + + req.onreadystatechange = () => { + if (req.readyState == 4) { + resolve(req); + } + }; + + req.send(null); +}); + +const loadPageDataJson = loadObj => { + const { + pagePath, + retries = 0 + } = loadObj; + const url = createPageDataUrl(pagePath); + return doFetch(url).then(req => { + const { + status, + responseText + } = req; // Handle 200 + + if (status === 200) { + try { + const jsonPayload = JSON.parse(responseText); + + if (jsonPayload.path === undefined) { + throw new Error(`not a valid pageData response`); + } + + return Object.assign(loadObj, { + status: `success`, + payload: jsonPayload + }); + } catch (err) {// continue regardless of error + } + } // Handle 404 + + + if (status === 404 || status === 200) { + // If the request was for a 404 page and it doesn't exist, we're done + if (pagePath === `/404.html`) { + return Object.assign(loadObj, { + status: `failure` + }); + } // Need some code here to cache the 404 request. In case + // multiple loadPageDataJsons result in 404s + + + return loadPageDataJson(Object.assign(loadObj, { + pagePath: `/404.html`, + notFound: true + })); + } // handle 500 response (Unrecoverable) + + + if (status === 500) { + return Object.assign(loadObj, { + status: `error` + }); + } // Handle everything else, including status === 0, and 503s. Should retry + + + if (retries < 3) { + return loadPageDataJson(Object.assign(loadObj, { + retries: retries + 1 + })); + } // Retried 3 times already, result is a failure. + + + return Object.assign(loadObj, { + status: `error` + }); + }); +}; + +const doesConnectionSupportPrefetch = () => { + if (`connection` in navigator && typeof navigator.connection !== `undefined`) { + if ((navigator.connection.effectiveType || ``).includes(`2g`)) { + return false; + } + + if (navigator.connection.saveData) { + return false; + } + } + + return true; +}; + +const toPageResources = (pageData, component = null) => { + const page = { + componentChunkName: pageData.componentChunkName, + path: pageData.path, + webpackCompilationHash: pageData.webpackCompilationHash, + matchPath: pageData.matchPath + }; + return { + component, + json: pageData.result, + page + }; +}; + +class BaseLoader { + constructor(loadComponent, matchPaths) { + // Map of pagePath -> Page. Where Page is an object with: { + // status: `success` || `error`, + // payload: PageResources, // undefined if `error` + // } + // PageResources is { + // component, + // json: pageData.result, + // page: { + // componentChunkName, + // path, + // webpackCompilationHash, + // } + // } + this.pageDb = new Map(); + this.inFlightDb = new Map(); + this.pageDataDb = new Map(); + this.prefetchTriggered = new Set(); + this.prefetchCompleted = new Set(); + this.loadComponent = loadComponent; + (0, _findPath.setMatchPaths)(matchPaths); + } + + setApiRunner(apiRunner) { + this.apiRunner = apiRunner; + this.prefetchDisabled = apiRunner(`disableCorePrefetching`).some(a => a); + } + + loadPageDataJson(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + + if (this.pageDataDb.has(pagePath)) { + return Promise.resolve(this.pageDataDb.get(pagePath)); + } + + return loadPageDataJson({ + pagePath + }).then(pageData => { + this.pageDataDb.set(pagePath, pageData); + return pageData; + }); + } + + findMatchPath(rawPath) { + return (0, _findPath.findMatchPath)(rawPath); + } // TODO check all uses of this and whether they use undefined for page resources not exist + + + loadPage(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + + if (this.pageDb.has(pagePath)) { + const page = this.pageDb.get(pagePath); + return Promise.resolve(page.payload); + } + + if (this.inFlightDb.has(pagePath)) { + return this.inFlightDb.get(pagePath); + } + + const inFlight = Promise.all([this.loadAppData(), this.loadPageDataJson(pagePath)]).then(allData => { + const result = allData[1]; + + if (result.status === `error`) { + return { + status: `error` + }; + } + + if (result.status === `failure`) { + // throw an error so error trackers can pick this up + throw new Error(`404 page could not be found. Checkout https://www.gatsbyjs.org/docs/add-404-page/`); + } + + let pageData = result.payload; + const { + componentChunkName + } = pageData; + return this.loadComponent(componentChunkName).then(component => { + const finalResult = { + createdAt: new Date() + }; + let pageResources; + + if (!component) { + finalResult.status = `error`; + } else { + finalResult.status = `success`; + + if (result.notFound === true) { + finalResult.notFound = true; + } + + pageData = Object.assign(pageData, { + webpackCompilationHash: allData[0] ? allData[0].webpackCompilationHash : `` + }); + pageResources = toPageResources(pageData, component); + finalResult.payload = pageResources; + + _emitter.default.emit(`onPostLoadPageResources`, { + page: pageResources, + pageResources + }); + } + + this.pageDb.set(pagePath, finalResult); // undefined if final result is an error + + return pageResources; + }); + }) // prefer duplication with then + catch over .finally to prevent problems in ie11 + firefox + .then(response => { + this.inFlightDb.delete(pagePath); + return response; + }).catch(err => { + this.inFlightDb.delete(pagePath); + throw err; + }); + this.inFlightDb.set(pagePath, inFlight); + return inFlight; + } // returns undefined if loading page ran into errors + + + loadPageSync(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + + if (this.pageDb.has(pagePath)) { + return this.pageDb.get(pagePath).payload; + } + + return undefined; + } + + shouldPrefetch(pagePath) { + // Skip prefetching if we know user is on slow or constrained connection + if (!doesConnectionSupportPrefetch()) { + return false; + } // Check if the page exists. + + + if (this.pageDb.has(pagePath)) { + return false; + } + + return true; + } + + prefetch(pagePath) { + if (!this.shouldPrefetch(pagePath)) { + return false; + } // Tell plugins with custom prefetching logic that they should start + // prefetching this path. + + + if (!this.prefetchTriggered.has(pagePath)) { + this.apiRunner(`onPrefetchPathname`, { + pathname: pagePath + }); + this.prefetchTriggered.add(pagePath); + } // If a plugin has disabled core prefetching, stop now. + + + if (this.prefetchDisabled) { + return false; + } + + const realPath = (0, _findPath.findPath)(pagePath); // Todo make doPrefetch logic cacheable + // eslint-disable-next-line consistent-return + + this.doPrefetch(realPath).then(() => { + if (!this.prefetchCompleted.has(pagePath)) { + this.apiRunner(`onPostPrefetchPathname`, { + pathname: pagePath + }); + this.prefetchCompleted.add(pagePath); + } + }); + return true; + } + + doPrefetch(pagePath) { + throw new Error(`doPrefetch not implemented`); + } + + hovering(rawPath) { + this.loadPage(rawPath); + } + + getResourceURLsForPathname(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + const page = this.pageDataDb.get(pagePath); + + if (page) { + const pageResources = toPageResources(page.payload); + return [...createComponentUrls(pageResources.page.componentChunkName), createPageDataUrl(pagePath)]; + } else { + return null; + } + } + + isPageNotFound(rawPath) { + const pagePath = (0, _findPath.findPath)(rawPath); + const page = this.pageDb.get(pagePath); + return page && page.notFound === true; + } + + loadAppData(retries = 0) { + return doFetch(`${__PATH_PREFIX__}/page-data/app-data.json`).then(req => { + const { + status, + responseText + } = req; + let appData; + + if (status !== 200 && retries < 3) { + // Retry 3 times incase of failures + return this.loadAppData(retries + 1); + } // Handle 200 + + + if (status === 200) { + try { + const jsonPayload = JSON.parse(responseText); + + if (jsonPayload.webpackCompilationHash === undefined) { + throw new Error(`not a valid app-data response`); + } + + appData = jsonPayload; + } catch (err) {// continue regardless of error + } + } + + return appData; + }); + } + +} + +exports.BaseLoader = BaseLoader; + +const createComponentUrls = componentChunkName => window.___chunkMapping[componentChunkName].map(chunk => __PATH_PREFIX__ + chunk); + +class ProdLoader extends BaseLoader { + constructor(asyncRequires, matchPaths) { + const loadComponent = chunkName => asyncRequires.components[chunkName]().then(preferDefault); + + super(loadComponent, matchPaths); + } + + doPrefetch(pagePath) { + const pageDataUrl = createPageDataUrl(pagePath); + return (0, _prefetch.default)(pageDataUrl).then(() => // This was just prefetched, so will return a response from + // the cache instead of making another request to the server + this.loadPageDataJson(pagePath)).then(result => { + if (result.status !== `success`) { + return Promise.resolve(); + } + + const pageData = result.payload; + const chunkName = pageData.componentChunkName; + const componentUrls = createComponentUrls(chunkName); + return Promise.all(componentUrls.map(_prefetch.default)).then(() => pageData); + }); + } + +} + +exports.ProdLoader = ProdLoader; +let instance; + +const setLoader = _loader => { + instance = _loader; +}; + +exports.setLoader = setLoader; +const publicLoader = { + // Deprecated methods. As far as we're aware, these are only used by + // core gatsby and the offline plugin, however there's a very small + // chance they're called by others. + getResourcesForPathname: rawPath => { + console.warn(`Warning: getResourcesForPathname is deprecated. Use loadPage instead`); + return instance.i.loadPage(rawPath); + }, + getResourcesForPathnameSync: rawPath => { + console.warn(`Warning: getResourcesForPathnameSync is deprecated. Use loadPageSync instead`); + return instance.i.loadPageSync(rawPath); + }, + enqueue: rawPath => instance.prefetch(rawPath), + // Real methods + getResourceURLsForPathname: rawPath => instance.getResourceURLsForPathname(rawPath), + loadPage: rawPath => instance.loadPage(rawPath), + loadPageSync: rawPath => instance.loadPageSync(rawPath), + prefetch: rawPath => instance.prefetch(rawPath), + isPageNotFound: rawPath => instance.isPageNotFound(rawPath), + hovering: rawPath => instance.hovering(rawPath), + loadAppData: () => instance.loadAppData() +}; +exports.publicLoader = publicLoader; +var _default = publicLoader; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/navigation.js b/.cache/commonjs/navigation.js new file mode 100644 index 0000000000..b6157c0fd6 --- /dev/null +++ b/.cache/commonjs/navigation.js @@ -0,0 +1,233 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.init = init; +exports.shouldUpdateScroll = shouldUpdateScroll; +exports.RouteUpdates = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = _interopRequireDefault(require("./loader")); + +var _redirects = _interopRequireDefault(require("./redirects.json")); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _router = require("@reach/router"); + +var _gatsbyLink = require("gatsby-link"); + +const redirectMap = _redirects.default.reduce((map, redirect) => { + map[redirect.fromPath] = redirect; + return map; +}, {}); + +function maybeRedirect(pathname) { + const redirect = redirectMap[pathname]; + + if (redirect != null) { + if (process.env.NODE_ENV !== `production`) { + const pageResources = _loader.default.loadPageSync(pathname); + + if (pageResources != null) { + console.error(`The route "${pathname}" matches both a page and a redirect; this is probably not intentional.`); + } + } + + window.___replace(redirect.toPath); + + return true; + } else { + return false; + } +} + +const onPreRouteUpdate = (location, prevLocation) => { + if (!maybeRedirect(location.pathname)) { + (0, _apiRunnerBrowser.apiRunner)(`onPreRouteUpdate`, { + location, + prevLocation + }); + } +}; + +const onRouteUpdate = (location, prevLocation) => { + if (!maybeRedirect(location.pathname)) { + (0, _apiRunnerBrowser.apiRunner)(`onRouteUpdate`, { + location, + prevLocation + }); // Temp hack while awaiting https://github.com/reach/router/issues/119 + + window.__navigatingToLink = false; + } +}; + +const navigate = (to, options = {}) => { + // Temp hack while awaiting https://github.com/reach/router/issues/119 + if (!options.replace) { + window.__navigatingToLink = true; + } + + let { + pathname + } = (0, _gatsbyLink.parsePath)(to); + const redirect = redirectMap[pathname]; // If we're redirecting, just replace the passed in pathname + // to the one we want to redirect to. + + if (redirect) { + to = redirect.toPath; + pathname = (0, _gatsbyLink.parsePath)(to).pathname; + } // If we had a service worker update, no matter the path, reload window and + // reset the pathname whitelist + + + if (window.___swUpdated) { + window.location = pathname; + return; + } // Start a timer to wait for a second before transitioning and showing a + // loader in case resources aren't around yet. + + + const timeoutId = setTimeout(() => { + _emitter.default.emit(`onDelayedLoadPageResources`, { + pathname + }); + + (0, _apiRunnerBrowser.apiRunner)(`onRouteUpdateDelayed`, { + location: window.location + }); + }, 1000); + + _loader.default.loadPage(pathname).then(pageResources => { + // If no page resources, then refresh the page + // Do this, rather than simply `window.location.reload()`, so that + // pressing the back/forward buttons work - otherwise when pressing + // back, the browser will just change the URL and expect JS to handle + // the change, which won't always work since it might not be a Gatsby + // page. + if (!pageResources || pageResources.status === `error`) { + window.history.replaceState({}, ``, location.href); + window.location = pathname; + } // If the loaded page has a different compilation hash to the + // window, then a rebuild has occurred on the server. Reload. + + + if (process.env.NODE_ENV === `production` && pageResources) { + if (pageResources.page.webpackCompilationHash !== window.___webpackCompilationHash) { + // Purge plugin-offline cache + if (`serviceWorker` in navigator && navigator.serviceWorker.controller !== null && navigator.serviceWorker.controller.state === `activated`) { + navigator.serviceWorker.controller.postMessage({ + gatsbyApi: `clearPathResources` + }); + } + + console.log(`Site has changed on server. Reloading browser`); + window.location = pathname; + } + } + + (0, _router.navigate)(to, options); + clearTimeout(timeoutId); + }); +}; + +function shouldUpdateScroll(prevRouterProps, { + location +}) { + const { + pathname, + hash + } = location; + const results = (0, _apiRunnerBrowser.apiRunner)(`shouldUpdateScroll`, { + prevRouterProps, + // `pathname` for backwards compatibility + pathname, + routerProps: { + location + }, + getSavedScrollPosition: args => this._stateStorage.read(args) + }); + + if (results.length > 0) { + // Use the latest registered shouldUpdateScroll result, this allows users to override plugin's configuration + // @see https://github.com/gatsbyjs/gatsby/issues/12038 + return results[results.length - 1]; + } + + if (prevRouterProps) { + const { + location: { + pathname: oldPathname + } + } = prevRouterProps; + + if (oldPathname === pathname) { + // Scroll to element if it exists, if it doesn't, or no hash is provided, + // scroll to top. + return hash ? hash.slice(1) : [0, 0]; + } + } + + return true; +} + +function init() { + // Temp hack while awaiting https://github.com/reach/router/issues/119 + window.__navigatingToLink = false; + + window.___push = to => navigate(to, { + replace: false + }); + + window.___replace = to => navigate(to, { + replace: true + }); + + window.___navigate = (to, options) => navigate(to, options); // Check for initial page-load redirect + + + maybeRedirect(window.location.pathname); +} // Fire on(Pre)RouteUpdate APIs + + +class RouteUpdates extends _react.default.Component { + constructor(props) { + super(props); + onPreRouteUpdate(props.location, null); + } + + componentDidMount() { + onRouteUpdate(this.props.location, null); + } + + componentDidUpdate(prevProps, prevState, shouldFireRouteUpdate) { + if (shouldFireRouteUpdate) { + onRouteUpdate(this.props.location, prevProps.location); + } + } + + getSnapshotBeforeUpdate(prevProps) { + if (this.props.location.pathname !== prevProps.location.pathname) { + onPreRouteUpdate(this.props.location, prevProps.location); + return true; + } + + return false; + } + + render() { + return this.props.children; + } + +} + +exports.RouteUpdates = RouteUpdates; +RouteUpdates.propTypes = { + location: _propTypes.default.object.isRequired +}; \ No newline at end of file diff --git a/.cache/commonjs/normalize-page-path.js b/.cache/commonjs/normalize-page-path.js new file mode 100644 index 0000000000..1311e3902c --- /dev/null +++ b/.cache/commonjs/normalize-page-path.js @@ -0,0 +1,22 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +var _default = path => { + if (path === undefined) { + return path; + } + + if (path === `/`) { + return `/`; + } + + if (path.charAt(path.length - 1) === `/`) { + return path.slice(0, -1); + } + + return path; +}; + +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/page-renderer.js b/.cache/commonjs/page-renderer.js new file mode 100644 index 0000000000..fe83e7cc64 --- /dev/null +++ b/.cache/commonjs/page-renderer.js @@ -0,0 +1,53 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireWildcard(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = require("./loader"); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +class PageRenderer extends _react.default.Component { + render() { + const props = Object.assign({}, this.props, { + pathContext: this.props.pageContext + }); + const [replacementElement] = (0, _apiRunnerBrowser.apiRunner)(`replaceComponentRenderer`, { + props: this.props, + loader: _loader.publicLoader + }); + const pageElement = replacementElement || (0, _react.createElement)(this.props.pageResources.component, Object.assign({}, props, { + key: this.props.path || this.props.pageResources.page.path + })); + const wrappedPage = (0, _apiRunnerBrowser.apiRunner)(`wrapPageElement`, { + element: pageElement, + props + }, pageElement, ({ + result + }) => { + return { + element: result, + props + }; + }).pop(); + return wrappedPage; + } + +} + +PageRenderer.propTypes = { + location: _propTypes.default.object.isRequired, + pageResources: _propTypes.default.object.isRequired, + data: _propTypes.default.object, + pageContext: _propTypes.default.object.isRequired +}; +var _default = PageRenderer; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/prefetch.js b/.cache/commonjs/prefetch.js new file mode 100644 index 0000000000..a71ac166f5 --- /dev/null +++ b/.cache/commonjs/prefetch.js @@ -0,0 +1,76 @@ +"use strict"; + +exports.__esModule = true; +exports.default = void 0; + +const support = function (feature) { + if (typeof document === `undefined`) { + return false; + } + + const fakeLink = document.createElement(`link`); + + try { + if (fakeLink.relList && typeof fakeLink.relList.supports === `function`) { + return fakeLink.relList.supports(feature); + } + } catch (err) { + return false; + } + + return false; +}; + +const linkPrefetchStrategy = function (url) { + return new Promise((resolve, reject) => { + if (typeof document === `undefined`) { + reject(); + return; + } + + const link = document.createElement(`link`); + link.setAttribute(`rel`, `prefetch`); + link.setAttribute(`href`, url); + link.onload = resolve; + link.onerror = reject; + const parentElement = document.getElementsByTagName(`head`)[0] || document.getElementsByName(`script`)[0].parentNode; + parentElement.appendChild(link); + }); +}; + +const xhrPrefetchStrategy = function (url) { + return new Promise((resolve, reject) => { + const req = new XMLHttpRequest(); + req.open(`GET`, url, true); + + req.onload = () => { + if (req.status === 200) { + resolve(); + } else { + reject(); + } + }; + + req.send(null); + }); +}; + +const supportedPrefetchStrategy = support(`prefetch`) ? linkPrefetchStrategy : xhrPrefetchStrategy; +const preFetched = {}; + +const prefetch = function (url) { + return new Promise(resolve => { + if (preFetched[url]) { + resolve(); + return; + } + + supportedPrefetchStrategy(url).then(() => { + resolve(); + preFetched[url] = true; + }).catch(() => {}); // 404s are logged to the console anyway + }); +}; + +var _default = prefetch; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/production-app.js b/.cache/commonjs/production-app.js new file mode 100644 index 0000000000..cf37e826cd --- /dev/null +++ b/.cache/commonjs/production-app.js @@ -0,0 +1,139 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _react = _interopRequireDefault(require("react")); + +var _reactDom = _interopRequireDefault(require("react-dom")); + +var _router = require("@reach/router"); + +var _gatsbyReactRouterScroll = require("gatsby-react-router-scroll"); + +var _domready = _interopRequireDefault(require("@mikaelkristiansson/domready")); + +var _navigation = require("./navigation"); + +var _emitter = _interopRequireDefault(require("./emitter")); + +var _pageRenderer = _interopRequireDefault(require("./page-renderer")); + +var _asyncRequires = _interopRequireDefault(require("./async-requires")); + +var _loader = require("./loader"); + +var _ensureResources = _interopRequireDefault(require("./ensure-resources")); + +var _stripPrefix = _interopRequireDefault(require("./strip-prefix")); + +var _matchPaths = _interopRequireDefault(require("./match-paths.json")); + +// Generated during bootstrap +const loader = new _loader.ProdLoader(_asyncRequires.default, _matchPaths.default); +(0, _loader.setLoader)(loader); +loader.setApiRunner(_apiRunnerBrowser.apiRunner); +window.asyncRequires = _asyncRequires.default; +window.___emitter = _emitter.default; +window.___loader = _loader.publicLoader; +(0, _navigation.init)(); +(0, _apiRunnerBrowser.apiRunnerAsync)(`onClientEntry`).then(() => { + // Let plugins register a service worker. The plugin just needs + // to return true. + if ((0, _apiRunnerBrowser.apiRunner)(`registerServiceWorker`).length > 0) { + require(`./register-service-worker`); + } // In gatsby v2 if Router is used in page using matchPaths + // paths need to contain full path. + // For example: + // - page have `/app/*` matchPath + // - inside template user needs to use `/app/xyz` as path + // Resetting `basepath`/`baseuri` keeps current behaviour + // to not introduce breaking change. + // Remove this in v3 + + + const RouteHandler = props => _react.default.createElement(_router.BaseContext.Provider, { + value: { + baseuri: `/`, + basepath: `/` + } + }, _react.default.createElement(_pageRenderer.default, props)); + + class LocationHandler extends _react.default.Component { + render() { + const { + location + } = this.props; + return _react.default.createElement(_ensureResources.default, { + location: location + }, ({ + pageResources, + location + }) => _react.default.createElement(_navigation.RouteUpdates, { + location: location + }, _react.default.createElement(_gatsbyReactRouterScroll.ScrollContext, { + location: location, + shouldUpdateScroll: _navigation.shouldUpdateScroll + }, _react.default.createElement(_router.Router, { + basepath: __BASE_PATH__, + location: location, + id: "gatsby-focus-wrapper" + }, _react.default.createElement(RouteHandler, (0, _extends2.default)({ + path: encodeURI(pageResources.page.path === `/404.html` ? (0, _stripPrefix.default)(location.pathname, __BASE_PATH__) : pageResources.page.matchPath || pageResources.page.path) + }, this.props, { + location: location, + pageResources: pageResources + }, pageResources.json)))))); + } + + } + + const { + pagePath, + location: browserLoc + } = window; // Explicitly call navigate if the canonical path (window.pagePath) + // is different to the browser path (window.location.pathname). But + // only if NONE of the following conditions hold: + // + // - The url matches a client side route (page.matchPath) + // - it's a 404 page + // - it's the offline plugin shell (/offline-plugin-app-shell-fallback/) + + if (pagePath && __BASE_PATH__ + pagePath !== browserLoc.pathname && !(loader.findMatchPath((0, _stripPrefix.default)(browserLoc.pathname, __BASE_PATH__)) || pagePath === `/404.html` || pagePath.match(/^\/404\/?$/) || pagePath.match(/^\/offline-plugin-app-shell-fallback\/?$/))) { + (0, _router.navigate)(__BASE_PATH__ + pagePath + browserLoc.search + browserLoc.hash, { + replace: true + }); + } + + _loader.publicLoader.loadPage(browserLoc.pathname).then(page => { + if (!page || page.status === `error`) { + throw new Error(`page resources for ${browserLoc.pathname} not found. Not rendering React`); + } + + window.___webpackCompilationHash = page.page.webpackCompilationHash; + + const Root = () => _react.default.createElement(_router.Location, null, locationContext => _react.default.createElement(LocationHandler, locationContext)); + + const WrappedRoot = (0, _apiRunnerBrowser.apiRunner)(`wrapRootElement`, { + element: _react.default.createElement(Root, null) + }, _react.default.createElement(Root, null), ({ + result + }) => { + return { + element: result + }; + }).pop(); + + let NewRoot = () => WrappedRoot; + + const renderer = (0, _apiRunnerBrowser.apiRunner)(`replaceHydrateFunction`, undefined, _reactDom.default.hydrate)[0]; + (0, _domready.default)(() => { + renderer(_react.default.createElement(NewRoot, null), typeof window !== `undefined` ? document.getElementById(`___gatsby`) : void 0, () => { + (0, _apiRunnerBrowser.apiRunner)(`onInitialClientRender`); + }); + }); + }); +}); \ No newline at end of file diff --git a/.cache/commonjs/public-page-renderer-dev.js b/.cache/commonjs/public-page-renderer-dev.js new file mode 100644 index 0000000000..1f2ad92aca --- /dev/null +++ b/.cache/commonjs/public-page-renderer-dev.js @@ -0,0 +1,33 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _loader = _interopRequireDefault(require("./loader")); + +var _jsonStore = _interopRequireDefault(require("./json-store")); + +const DevPageRenderer = ({ + location +}) => { + const pageResources = _loader.default.loadPageSync(location.pathname); + + return _react.default.createElement(_jsonStore.default, { + location, + pageResources + }); +}; + +DevPageRenderer.propTypes = { + location: _propTypes.default.shape({ + pathname: _propTypes.default.string.isRequired + }).isRequired +}; +var _default = DevPageRenderer; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/public-page-renderer-prod.js b/.cache/commonjs/public-page-renderer-prod.js new file mode 100644 index 0000000000..b0da15eab0 --- /dev/null +++ b/.cache/commonjs/public-page-renderer-prod.js @@ -0,0 +1,34 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _react = _interopRequireDefault(require("react")); + +var _propTypes = _interopRequireDefault(require("prop-types")); + +var _pageRenderer = _interopRequireDefault(require("./page-renderer")); + +const ProdPageRenderer = ({ + location, + pageResources +}) => { + if (!pageResources) { + return null; + } + + return _react.default.createElement(_pageRenderer.default, Object.assign({ + location, + pageResources + }, pageResources.json)); +}; + +ProdPageRenderer.propTypes = { + location: _propTypes.default.shape({ + pathname: _propTypes.default.string.isRequired + }).isRequired +}; +var _default = ProdPageRenderer; +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/public-page-renderer.js b/.cache/commonjs/public-page-renderer.js new file mode 100644 index 0000000000..589fe20c2a --- /dev/null +++ b/.cache/commonjs/public-page-renderer.js @@ -0,0 +1,11 @@ +"use strict"; + +const preferDefault = m => m && m.default || m; + +if (process.env.BUILD_STAGE === `develop`) { + module.exports = preferDefault(require(`./public-page-renderer-dev`)); +} else if (process.env.BUILD_STAGE === `build-javascript`) { + module.exports = preferDefault(require(`./public-page-renderer-prod`)); +} else { + module.exports = () => null; +} \ No newline at end of file diff --git a/.cache/commonjs/react-lifecycles-compat.js b/.cache/commonjs/react-lifecycles-compat.js new file mode 100644 index 0000000000..ebf5374734 --- /dev/null +++ b/.cache/commonjs/react-lifecycles-compat.js @@ -0,0 +1,3 @@ +"use strict"; + +exports.polyfill = Component => Component; \ No newline at end of file diff --git a/.cache/commonjs/register-service-worker.js b/.cache/commonjs/register-service-worker.js new file mode 100644 index 0000000000..9551aadefc --- /dev/null +++ b/.cache/commonjs/register-service-worker.js @@ -0,0 +1,66 @@ +"use strict"; + +var _apiRunnerBrowser = require("./api-runner-browser"); + +if (window.location.protocol !== `https:` && window.location.hostname !== `localhost`) { + console.error(`Service workers can only be used over HTTPS, or on localhost for development`); +} else if (`serviceWorker` in navigator) { + navigator.serviceWorker.register(`${__BASE_PATH__}/sw.js`).then(function (reg) { + reg.addEventListener(`updatefound`, () => { + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerUpdateFound`, { + serviceWorker: reg + }); // The updatefound event implies that reg.installing is set; see + // https://w3c.github.io/ServiceWorker/#service-worker-registration-updatefound-event + + const installingWorker = reg.installing; + console.log(`installingWorker`, installingWorker); + installingWorker.addEventListener(`statechange`, () => { + switch (installingWorker.state) { + case `installed`: + if (navigator.serviceWorker.controller) { + // At this point, the old content will have been purged and the fresh content will + // have been added to the cache. + // We set a flag so Gatsby Link knows to refresh the page on next navigation attempt + window.___swUpdated = true; // We call the onServiceWorkerUpdateReady API so users can show update prompts. + + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerUpdateReady`, { + serviceWorker: reg + }); // If resources failed for the current page, reload. + + if (window.___failedResources) { + console.log(`resources failed, SW updated - reloading`); + window.location.reload(); + } + } else { + // At this point, everything has been precached. + // It's the perfect time to display a "Content is cached for offline use." message. + console.log(`Content is now available offline!`); // Post to service worker that install is complete. + // Delay to allow time for the event listener to be added -- + // otherwise fetch is called too soon and resources aren't cached. + + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerInstalled`, { + serviceWorker: reg + }); + } + + break; + + case `redundant`: + console.error(`The installing service worker became redundant.`); + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerRedundant`, { + serviceWorker: reg + }); + break; + + case `activated`: + (0, _apiRunnerBrowser.apiRunner)(`onServiceWorkerActive`, { + serviceWorker: reg + }); + break; + } + }); + }); + }).catch(function (e) { + console.error(`Error during service worker registration:`, e); + }); +} \ No newline at end of file diff --git a/.cache/commonjs/root.js b/.cache/commonjs/root.js new file mode 100644 index 0000000000..a7ff0da14b --- /dev/null +++ b/.cache/commonjs/root.js @@ -0,0 +1,131 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +var _react = _interopRequireDefault(require("react")); + +var _router = require("@reach/router"); + +var _gatsbyReactRouterScroll = require("gatsby-react-router-scroll"); + +var _navigation = require("./navigation"); + +var _apiRunnerBrowser = require("./api-runner-browser"); + +var _loader = _interopRequireDefault(require("./loader")); + +var _jsonStore = _interopRequireDefault(require("./json-store")); + +var _ensureResources = _interopRequireDefault(require("./ensure-resources")); + +var _errorOverlayHandler = require("./error-overlay-handler"); + +if (window.__webpack_hot_middleware_reporter__ !== undefined) { + const overlayErrorID = `webpack`; // Report build errors + + window.__webpack_hot_middleware_reporter__.useCustomOverlay({ + showProblems(type, obj) { + if (type !== `errors`) { + (0, _errorOverlayHandler.clearError)(overlayErrorID); + return; + } + + (0, _errorOverlayHandler.reportError)(overlayErrorID, obj[0]); + }, + + clear() { + (0, _errorOverlayHandler.clearError)(overlayErrorID); + } + + }); +} + +(0, _navigation.init)(); // In gatsby v2 if Router is used in page using matchPaths +// paths need to contain full path. +// For example: +// - page have `/app/*` matchPath +// - inside template user needs to use `/app/xyz` as path +// Resetting `basepath`/`baseuri` keeps current behaviour +// to not introduce breaking change. +// Remove this in v3 + +const RouteHandler = props => _react.default.createElement(_router.BaseContext.Provider, { + value: { + baseuri: `/`, + basepath: `/` + } +}, _react.default.createElement(_jsonStore.default, props)); + +class LocationHandler extends _react.default.Component { + render() { + let { + location + } = this.props; + + if (!_loader.default.isPageNotFound(location.pathname)) { + return _react.default.createElement(_ensureResources.default, { + location: location + }, locationAndPageResources => _react.default.createElement(_navigation.RouteUpdates, { + location: location + }, _react.default.createElement(_gatsbyReactRouterScroll.ScrollContext, { + location: location, + shouldUpdateScroll: _navigation.shouldUpdateScroll + }, _react.default.createElement(_router.Router, { + basepath: __BASE_PATH__, + location: location, + id: "gatsby-focus-wrapper" + }, _react.default.createElement(RouteHandler, (0, _extends2.default)({ + path: encodeURI(locationAndPageResources.pageResources.page.matchPath || locationAndPageResources.pageResources.page.path) + }, this.props, locationAndPageResources)))))); + } + + const dev404PageResources = _loader.default.loadPageSync(`/dev-404-page`); + + const real404PageResources = _loader.default.loadPageSync(`/404.html`); + + let custom404; + + if (real404PageResources) { + custom404 = _react.default.createElement(_jsonStore.default, (0, _extends2.default)({}, this.props, { + pageResources: real404PageResources + })); + } + + return _react.default.createElement(_navigation.RouteUpdates, { + location: location + }, _react.default.createElement(_router.Router, { + basepath: __BASE_PATH__, + location: location, + id: "gatsby-focus-wrapper" + }, _react.default.createElement(RouteHandler, { + path: location.pathname, + location: location, + pageResources: dev404PageResources, + custom404: custom404 + }))); + } + +} + +const Root = () => _react.default.createElement(_router.Location, null, locationContext => _react.default.createElement(LocationHandler, locationContext)); // Let site, plugins wrap the site e.g. for Redux. + + +const WrappedRoot = (0, _apiRunnerBrowser.apiRunner)(`wrapRootElement`, { + element: _react.default.createElement(Root, null) +}, _react.default.createElement(Root, null), ({ + result, + plugin +}) => { + return { + element: result + }; +}).pop(); + +var _default = () => WrappedRoot; + +exports.default = _default; \ No newline at end of file diff --git a/.cache/commonjs/socketIo.js b/.cache/commonjs/socketIo.js new file mode 100644 index 0000000000..fb18ce9ba6 --- /dev/null +++ b/.cache/commonjs/socketIo.js @@ -0,0 +1,122 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = socketIo; +exports.getPageData = getPageData; +exports.registerPath = registerPath; +exports.unregisterPath = unregisterPath; +exports.getIsInitialized = exports.getPageQueryData = exports.getStaticQueryData = void 0; + +var _errorOverlayHandler = require("./error-overlay-handler"); + +var _normalizePagePath = _interopRequireDefault(require("./normalize-page-path")); + +let socket = null; +let staticQueryData = {}; +let pageQueryData = {}; +let isInitialized = false; + +const getStaticQueryData = () => staticQueryData; + +exports.getStaticQueryData = getStaticQueryData; + +const getPageQueryData = () => pageQueryData; + +exports.getPageQueryData = getPageQueryData; + +const getIsInitialized = () => isInitialized; + +exports.getIsInitialized = getIsInitialized; + +function socketIo() { + if (process.env.NODE_ENV !== `production`) { + if (!socket) { + // Try to initialize web socket if we didn't do it already + try { + // eslint-disable-next-line no-undef + socket = io(); + + const didDataChange = (msg, queryData) => { + const id = msg.type === `staticQueryResult` ? msg.payload.id : (0, _normalizePagePath.default)(msg.payload.id); + return !(id in queryData) || JSON.stringify(msg.payload.result) !== JSON.stringify(queryData[id]); + }; + + socket.on(`message`, msg => { + if (msg.type === `staticQueryResult`) { + if (didDataChange(msg, staticQueryData)) { + staticQueryData = Object.assign({}, staticQueryData, { + [msg.payload.id]: msg.payload.result + }); + } + } else if (msg.type === `pageQueryResult`) { + if (didDataChange(msg, pageQueryData)) { + pageQueryData = Object.assign({}, pageQueryData, { + [(0, _normalizePagePath.default)(msg.payload.id)]: msg.payload.result + }); + } + } else if (msg.type === `overlayError`) { + if (msg.payload.message) { + (0, _errorOverlayHandler.reportError)(msg.payload.id, msg.payload.message); + } else { + (0, _errorOverlayHandler.clearError)(msg.payload.id); + } + } + + if (msg.type && msg.payload) { + ___emitter.emit(msg.type, msg.payload); + } + }); + } catch (err) { + console.error(`Could not connect to socket.io on dev server.`); + } + } + + return socket; + } else { + return null; + } +} + +const inFlightGetPageDataPromiseCache = {}; + +function getPageData(pathname) { + pathname = (0, _normalizePagePath.default)(pathname); + + if (inFlightGetPageDataPromiseCache[pathname]) { + return inFlightGetPageDataPromiseCache[pathname]; + } else { + inFlightGetPageDataPromiseCache[pathname] = new Promise(resolve => { + if (pageQueryData[pathname]) { + delete inFlightGetPageDataPromiseCache[pathname]; + resolve(pageQueryData[pathname]); + } else { + const onPageDataCallback = msg => { + if (msg.type === `pageQueryResult` && (0, _normalizePagePath.default)(msg.payload.id) === pathname) { + socket.off(`message`, onPageDataCallback); + delete inFlightGetPageDataPromiseCache[pathname]; + resolve(pageQueryData[pathname]); + } + }; + + socket.on(`message`, onPageDataCallback); + socket.emit(`getDataForPath`, pathname); + } + }); + } + + return inFlightGetPageDataPromiseCache[pathname]; +} // Tell websocket-manager.js the new path we're on. +// This will help the backend prioritize queries for this +// path. + + +function registerPath(path) { + socket.emit(`registerPath`, path); +} // Unregister the former path + + +function unregisterPath(path) { + socket.emit(`unregisterPath`, path); +} \ No newline at end of file diff --git a/.cache/commonjs/static-entry.js b/.cache/commonjs/static-entry.js new file mode 100644 index 0000000000..f3cc396a25 --- /dev/null +++ b/.cache/commonjs/static-entry.js @@ -0,0 +1,406 @@ +"use strict"; + +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +exports.__esModule = true; +exports.default = exports.sanitizeComponents = void 0; + +var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); + +const React = require(`react`); + +const fs = require(`fs`); + +const { + join +} = require(`path`); + +const { + renderToString, + renderToStaticMarkup +} = require(`react-dom/server`); + +const { + ServerLocation, + Router, + isRedirect +} = require(`@reach/router`); + +const { + get, + merge, + isObject, + flatten, + uniqBy, + flattenDeep, + replace +} = require(`lodash`); + +const apiRunner = require(`./api-runner-ssr`); + +const syncRequires = require(`./sync-requires`); + +const { + version: gatsbyVersion +} = require(`gatsby/package.json`); + +const stats = JSON.parse(fs.readFileSync(`${process.cwd()}/public/webpack.stats.json`, `utf-8`)); +const chunkMapping = JSON.parse(fs.readFileSync(`${process.cwd()}/public/chunk-map.json`, `utf-8`)); // const testRequireError = require("./test-require-error") +// For some extremely mysterious reason, webpack adds the above module *after* +// this module so that when this code runs, testRequireError is undefined. +// So in the meantime, we'll just inline it. + +const testRequireError = (moduleName, err) => { + const regex = new RegExp(`Error: Cannot find module\\s.${moduleName}`); + const firstLine = err.toString().split(`\n`)[0]; + return regex.test(firstLine); +}; + +let Html; + +try { + Html = require(`../src/html`); +} catch (err) { + if (testRequireError(`../src/html`, err)) { + Html = require(`./default-html`); + } else { + throw err; + } +} + +Html = Html && Html.__esModule ? Html.default : Html; + +const getPageDataPath = path => { + const fixedPagePath = path === `/` ? `index` : path; + return join(`page-data`, fixedPagePath, `page-data.json`); +}; + +const getPageDataUrl = pagePath => { + const pageDataPath = getPageDataPath(pagePath); + return `${__PATH_PREFIX__}/${pageDataPath}`; +}; + +const getPageDataFile = pagePath => { + const pageDataPath = getPageDataPath(pagePath); + return join(process.cwd(), `public`, pageDataPath); +}; + +const loadPageDataSync = pagePath => { + const pageDataPath = getPageDataPath(pagePath); + const pageDataFile = join(process.cwd(), `public`, pageDataPath); + + try { + const pageDataJson = fs.readFileSync(pageDataFile); + return JSON.parse(pageDataJson); + } catch (error) { + // not an error if file is not found. There's just no page data + return null; + } +}; + +const createElement = React.createElement; + +const sanitizeComponents = components => { + const componentsArray = ensureArray(components); + return componentsArray.map(component => { + // Ensure manifest is always loaded from content server + // And not asset server when an assetPrefix is used + if (__ASSET_PREFIX__ && component.props.rel === `manifest`) { + return React.cloneElement(component, { + href: replace(component.props.href, __ASSET_PREFIX__, ``) + }); + } + + return component; + }); +}; + +exports.sanitizeComponents = sanitizeComponents; + +const ensureArray = components => { + if (Array.isArray(components)) { + // remove falsy items and flatten + return flattenDeep(components.filter(val => Array.isArray(val) ? val.length > 0 : val)); + } else { + // we also accept single components, so we need to handle this case as well + return components ? [components] : []; + } +}; + +var _default = (pagePath, callback) => { + let bodyHtml = ``; + let headComponents = [React.createElement("meta", { + name: "generator", + content: `Gatsby ${gatsbyVersion}`, + key: `generator-${gatsbyVersion}` + })]; + let htmlAttributes = {}; + let bodyAttributes = {}; + let preBodyComponents = []; + let postBodyComponents = []; + let bodyProps = {}; + + const replaceBodyHTMLString = body => { + bodyHtml = body; + }; + + const setHeadComponents = components => { + headComponents = headComponents.concat(sanitizeComponents(components)); + }; + + const setHtmlAttributes = attributes => { + htmlAttributes = merge(htmlAttributes, attributes); + }; + + const setBodyAttributes = attributes => { + bodyAttributes = merge(bodyAttributes, attributes); + }; + + const setPreBodyComponents = components => { + preBodyComponents = preBodyComponents.concat(sanitizeComponents(components)); + }; + + const setPostBodyComponents = components => { + postBodyComponents = postBodyComponents.concat(sanitizeComponents(components)); + }; + + const setBodyProps = props => { + bodyProps = merge({}, bodyProps, props); + }; + + const getHeadComponents = () => headComponents; + + const replaceHeadComponents = components => { + headComponents = sanitizeComponents(components); + }; + + const getPreBodyComponents = () => preBodyComponents; + + const replacePreBodyComponents = components => { + preBodyComponents = sanitizeComponents(components); + }; + + const getPostBodyComponents = () => postBodyComponents; + + const replacePostBodyComponents = components => { + postBodyComponents = sanitizeComponents(components); + }; + + const pageDataRaw = fs.readFileSync(getPageDataFile(pagePath)); + const pageData = JSON.parse(pageDataRaw); + const pageDataUrl = getPageDataUrl(pagePath); + const { + componentChunkName + } = pageData; + + class RouteHandler extends React.Component { + render() { + const props = Object.assign({}, this.props, {}, pageData.result, { + // pathContext was deprecated in v2. Renamed to pageContext + pathContext: pageData.result ? pageData.result.pageContext : undefined + }); + const pageElement = createElement(syncRequires.components[componentChunkName], props); + const wrappedPage = apiRunner(`wrapPageElement`, { + element: pageElement, + props + }, pageElement, ({ + result + }) => { + return { + element: result, + props + }; + }).pop(); + return wrappedPage; + } + + } + + const routerElement = createElement(ServerLocation, { + url: `${__BASE_PATH__}${pagePath}` + }, createElement(Router, { + id: `gatsby-focus-wrapper`, + baseuri: `${__BASE_PATH__}` + }, createElement(RouteHandler, { + path: `/*` + }))); + const bodyComponent = apiRunner(`wrapRootElement`, { + element: routerElement, + pathname: pagePath + }, routerElement, ({ + result + }) => { + return { + element: result, + pathname: pagePath + }; + }).pop(); // Let the site or plugin render the page component. + + apiRunner(`replaceRenderer`, { + bodyComponent, + replaceBodyHTMLString, + setHeadComponents, + setHtmlAttributes, + setBodyAttributes, + setPreBodyComponents, + setPostBodyComponents, + setBodyProps, + pathname: pagePath, + pathPrefix: __PATH_PREFIX__ + }); // If no one stepped up, we'll handle it. + + if (!bodyHtml) { + try { + bodyHtml = renderToString(bodyComponent); + } catch (e) { + // ignore @reach/router redirect errors + if (!isRedirect(e)) throw e; + } + } // Create paths to scripts + + + let scriptsAndStyles = flatten([`app`, componentChunkName].map(s => { + const fetchKey = `assetsByChunkName[${s}]`; + let chunks = get(stats, fetchKey); + let namedChunkGroups = get(stats, `namedChunkGroups`); + + if (!chunks) { + return null; + } + + chunks = chunks.map(chunk => { + if (chunk === `/`) { + return null; + } + + return { + rel: `preload`, + name: chunk + }; + }); + namedChunkGroups[s].assets.forEach(asset => chunks.push({ + rel: `preload`, + name: asset + })); + const childAssets = namedChunkGroups[s].childAssets; + + for (const rel in childAssets) { + chunks = merge(chunks, childAssets[rel].map(chunk => { + return { + rel, + name: chunk + }; + })); + } + + return chunks; + })).filter(s => isObject(s)).sort((s1, s2) => s1.rel == `preload` ? -1 : 1); // given priority to preload + + scriptsAndStyles = uniqBy(scriptsAndStyles, item => item.name); + const scripts = scriptsAndStyles.filter(script => script.name && script.name.endsWith(`.js`)); + const styles = scriptsAndStyles.filter(style => style.name && style.name.endsWith(`.css`)); + apiRunner(`onRenderBody`, { + setHeadComponents, + setHtmlAttributes, + setBodyAttributes, + setPreBodyComponents, + setPostBodyComponents, + setBodyProps, + pathname: pagePath, + loadPageDataSync, + bodyHtml, + scripts, + styles, + pathPrefix: __PATH_PREFIX__ + }); + scripts.slice(0).reverse().forEach(script => { + // Add preload/prefetch s for scripts. + headComponents.push(React.createElement("link", { + as: "script", + rel: script.rel, + key: script.name, + href: `${__PATH_PREFIX__}/${script.name}` + })); + }); + + if (pageData) { + headComponents.push(React.createElement("link", { + as: "fetch", + rel: "preload", + key: pageDataUrl, + href: pageDataUrl, + crossOrigin: "anonymous" + })); + } + + styles.slice(0).reverse().forEach(style => { + // Add s for styles that should be prefetched + // otherwise, inline as a