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..30bb6883cf --- /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---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" */), + "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" */) +} + 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..41356475f3 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-03f70e3c5a52291e52b331e3d35900a4.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-0a7272d65d13b205250497d2b3522e3d.json b/.cache/caches/gatsby-transformer-remark/diskstore-0a7272d65d13b205250497d2b3522e3d.json new file mode 100644 index 0000000000..de6d516d08 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-0a7272d65d13b205250497d2b3522e3d.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-ast-94a83b1b7402a40717e5c1b92c85015a-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-15c9fa5529ebd49664861c7bcf4e6952.json b/.cache/caches/gatsby-transformer-remark/diskstore-15c9fa5529ebd49664861c7bcf4e6952.json new file mode 100644 index 0000000000..4a54be89ca --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-15c9fa5529ebd49664861c7bcf4e6952.json @@ -0,0 +1 @@ +{"expireTime":9007200827957881000,"key":"transformer-remark-markdown-toc-b203d64bdde854a7c4141aaf3bd814db-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-20649dc8fd4cdde49b1d9ea0c26371b2.json b/.cache/caches/gatsby-transformer-remark/diskstore-20649dc8fd4cdde49b1d9ea0c26371b2.json new file mode 100644 index 0000000000..7b4c385aeb --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-20649dc8fd4cdde49b1d9ea0c26371b2.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..747026c81f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-2b8cd1df4f8a6941bff4108301b5d6a9.json @@ -0,0 +1 @@ +{"expireTime":9007200828128391000,"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..e9bdea54d4 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-2c713f7ba9a30ac45cbadf6d86d5d544.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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..da275b0c32 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-2e9a5d11bfbd9e331e877b0e013a0ab8.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-308215140d91d466921fde8b44e96c70.json b/.cache/caches/gatsby-transformer-remark/diskstore-308215140d91d466921fde8b44e96c70.json new file mode 100644 index 0000000000..b07a9d57a7 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-308215140d91d466921fde8b44e96c70.json @@ -0,0 +1 @@ +{"expireTime":9007200828128391000,"key":"transformer-remark-markdown-html-b627c832a1f77c6bd67b3f67116e04eb-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-335fc52df6558698584a4c58a93133dc.json b/.cache/caches/gatsby-transformer-remark/diskstore-335fc52df6558698584a4c58a93133dc.json new file mode 100644 index 0000000000..6caddf6c37 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-335fc52df6558698584a4c58a93133dc.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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..7c0c57c4e5 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-34caa57442541fb555e65adf766c9dbf.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-36c2072d077e6736d848e30c50da70bf.json b/.cache/caches/gatsby-transformer-remark/diskstore-36c2072d077e6736d848e30c50da70bf.json new file mode 100644 index 0000000000..a698919854 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-36c2072d077e6736d848e30c50da70bf.json @@ -0,0 +1 @@ +{"expireTime":9007200827958528000,"key":"transformer-remark-markdown-ast-e0eda26454f7aaeda47989e111060318-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-3cf9cbd2e002119e2f428dfed8eb94da.json b/.cache/caches/gatsby-transformer-remark/diskstore-3cf9cbd2e002119e2f428dfed8eb94da.json new file mode 100644 index 0000000000..ed3260b29f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-3cf9cbd2e002119e2f428dfed8eb94da.json @@ -0,0 +1 @@ +{"expireTime":9007200828128391000,"key":"transformer-remark-markdown-html-30a51869612bca077eda87f35f662bad-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-468b5bae8ef758f28811323986a026ca.json b/.cache/caches/gatsby-transformer-remark/diskstore-468b5bae8ef758f28811323986a026ca.json new file mode 100644 index 0000000000..a58a2006dc --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-468b5bae8ef758f28811323986a026ca.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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..d4ee19c55b --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-479f7412bfaf2ad395f176418584631a.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-49025698b564146544fecd0e3e64cd6a.json b/.cache/caches/gatsby-transformer-remark/diskstore-49025698b564146544fecd0e3e64cd6a.json new file mode 100644 index 0000000000..63e6766327 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-49025698b564146544fecd0e3e64cd6a.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-html-ast-51cffb57f20c685f94203902c79f04c6-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":3,"column":1,"offset":2}}}} \ 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..3c3864b987 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-4959c881d2fccc57dea5cba657223041.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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..3c69636924 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-51d0f3b693c1d063f395570395293fb4.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-57199a69f7efd5decc9f72929e6eaab6.json b/.cache/caches/gatsby-transformer-remark/diskstore-57199a69f7efd5decc9f72929e6eaab6.json new file mode 100644 index 0000000000..1d05382ee6 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-57199a69f7efd5decc9f72929e6eaab6.json @@ -0,0 +1 @@ +{"expireTime":9007200828128384000,"key":"transformer-remark-markdown-html-0b8b19ff19f6a64f7b2cae67200ccd88-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-57b56149d19b6dd403afccc6bfe3ffd1.json b/.cache/caches/gatsby-transformer-remark/diskstore-57b56149d19b6dd403afccc6bfe3ffd1.json new file mode 100644 index 0000000000..52361847cd --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-57b56149d19b6dd403afccc6bfe3ffd1.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-html-ast-b627c832a1f77c6bd67b3f67116e04eb-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-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json b/.cache/caches/gatsby-transformer-remark/diskstore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json new file mode 100644 index 0000000000..fec527f21d --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-5a894e6dcf41aaf38dcfe7c4ef24bb6c.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..8ba69204fb --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-5aa0c32748bae2a74e08828fed4fd3a6.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..ebd32978d5 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-5ce457da6f1384d2d0a1c8d65aa7035f.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..0c3a36456c --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-60ffaa0253ce67428f5a7e31a4a0bad1.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..af5e8eb744 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-6195db1b342fb1235a247e18694e1cc8.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..72ea29b2eb --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-61c1d71d82d9e8cb724bc675e994ee07.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-63a23b09e546002dd44db88012dd9ea9.json b/.cache/caches/gatsby-transformer-remark/diskstore-63a23b09e546002dd44db88012dd9ea9.json new file mode 100644 index 0000000000..2f422d46aa --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-63a23b09e546002dd44db88012dd9ea9.json @@ -0,0 +1 @@ +{"expireTime":9007200828058191000,"key":"transformer-remark-markdown-ast-46d92e293407aa2f9b2f1b0b9fc86991-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-6848789e646bc12b2cbd26760f339042.json b/.cache/caches/gatsby-transformer-remark/diskstore-6848789e646bc12b2cbd26760f339042.json new file mode 100644 index 0000000000..468ba31d0e --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-6848789e646bc12b2cbd26760f339042.json @@ -0,0 +1 @@ +{"expireTime":9007200827957881000,"key":"transformer-remark-markdown-ast-b203d64bdde854a7c4141aaf3bd814db-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});\n
","position":{"start":{"line":7,"column":1,"offset":47},"end":{"line":15,"column":4,"offset":214},"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":221},"end":{"line":18,"column":9,"offset":225},"indent":[]}}],"position":{"start":{"line":18,"column":1,"offset":217},"end":{"line":18,"column":9,"offset":225},"indent":[]},"data":{"id":"构造函数","htmlAttributes":{"id":"构造函数"},"hProperties":{"id":"构造函数"}}},{"type":"paragraph","children":[{"type":"strong","children":[{"type":"text","value":"Scene","position":{"start":{"line":20,"column":3,"offset":229},"end":{"line":20,"column":8,"offset":234},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":227},"end":{"line":20,"column":10,"offset":236},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":20,"column":10,"offset":236},"end":{"line":20,"column":16,"offset":242},"indent":[]}},{"type":"text","value":"支持两种实例化方式","position":{"start":{"line":20,"column":16,"offset":242},"end":{"line":20,"column":25,"offset":251},"indent":[]}}],"position":{"start":{"line":20,"column":1,"offset":227},"end":{"line":20,"column":25,"offset":251},"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":255},"end":{"line":22,"column":23,"offset":275},"indent":[]}}],"position":{"start":{"line":22,"column":3,"offset":255},"end":{"line":22,"column":23,"offset":275},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":253},"end":{"line":22,"column":23,"offset":275},"indent":[]}},{"type":"listItem","spread":false,"checked":null,"children":[{"type":"paragraph","children":[{"type":"text","value":"传入地图实例","position":{"start":{"line":23,"column":3,"offset":278},"end":{"line":23,"column":9,"offset":284},"indent":[]}}],"position":{"start":{"line":23,"column":3,"offset":278},"end":{"line":23,"column":9,"offset":284},"indent":[]}}],"position":{"start":{"line":23,"column":1,"offset":276},"end":{"line":23,"column":9,"offset":284},"indent":[]}}],"position":{"start":{"line":22,"column":1,"offset":253},"end":{"line":23,"column":9,"offset":284},"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":295},"end":{"line":29,"column":17,"offset":306},"indent":[]}}],"position":{"start":{"line":29,"column":1,"offset":290},"end":{"line":29,"column":17,"offset":306},"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":308},"end":{"line":41,"column":4,"offset":488},"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":496},"end":{"line":44,"column":21,"offset":511},"indent":[]}}],"position":{"start":{"line":44,"column":1,"offset":491},"end":{"line":44,"column":21,"offset":511},"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":513},"end":{"line":46,"column":30,"offset":542},"indent":[]}},{"type":"emphasis","children":[{"type":"text","value":"viewModes需要设置成3d","position":{"start":{"line":46,"column":31,"offset":543},"end":{"line":46,"column":47,"offset":559},"indent":[]}}],"position":{"start":{"line":46,"column":30,"offset":542},"end":{"line":46,"column":48,"offset":560},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":46,"column":48,"offset":560},"end":{"line":46,"column":54,"offset":566},"indent":[]}},{"type":"text","value":"_","position":{"start":{"line":46,"column":54,"offset":566},"end":{"line":46,"column":55,"offset":567},"indent":[]}}],"position":{"start":{"line":46,"column":1,"offset":513},"end":{"line":46,"column":55,"offset":567},"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":568},"end":{"line":61,"column":4,"offset":827},"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":833},"end":{"line":64,"column":7,"offset":836},"indent":[]}}],"position":{"start":{"line":64,"column":1,"offset":830},"end":{"line":64,"column":7,"offset":836},"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":837},"end":{"line":65,"column":49,"offset":885},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":65,"column":49,"offset":885},"end":{"line":65,"column":55,"offset":891},"indent":[]}},{"type":"text","value":"map 实例方法见","position":{"start":{"line":65,"column":55,"offset":891},"end":{"line":65,"column":64,"offset":900},"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":901},"end":{"line":65,"column":71,"offset":907},"indent":[]}}],"position":{"start":{"line":65,"column":64,"offset":900},"end":{"line":65,"column":127,"offset":963},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}}],"position":{"start":{"line":65,"column":1,"offset":837},"end":{"line":65,"column":127,"offset":963},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.map;\n
","position":{"start":{"line":67,"column":1,"offset":965},"end":{"line":69,"column":4,"offset":992},"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":998},"end":{"line":72,"column":7,"offset":1001},"indent":[]}}],"position":{"start":{"line":72,"column":1,"offset":995},"end":{"line":72,"column":7,"offset":1001},"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":1007},"end":{"line":74,"column":15,"offset":1017},"indent":[]}}],"position":{"start":{"line":74,"column":1,"offset":1003},"end":{"line":74,"column":15,"offset":1017},"indent":[]},"data":{"id":"pointlayer","htmlAttributes":{"id":"pointlayer"},"hProperties":{"id":"pointlayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建点图层","position":{"start":{"line":75,"column":1,"offset":1018},"end":{"line":75,"column":6,"offset":1023},"indent":[]}}],"position":{"start":{"line":75,"column":1,"offset":1018},"end":{"line":75,"column":6,"offset":1023},"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":1029},"end":{"line":77,"column":18,"offset":1042},"indent":[]}}],"position":{"start":{"line":77,"column":1,"offset":1025},"end":{"line":77,"column":18,"offset":1042},"indent":[]},"data":{"id":"polylinelayer","htmlAttributes":{"id":"polylinelayer"},"hProperties":{"id":"polylinelayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建线图层","position":{"start":{"line":78,"column":1,"offset":1043},"end":{"line":78,"column":6,"offset":1048},"indent":[]}}],"position":{"start":{"line":78,"column":1,"offset":1043},"end":{"line":78,"column":6,"offset":1048},"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":1054},"end":{"line":80,"column":17,"offset":1066},"indent":[]}}],"position":{"start":{"line":80,"column":1,"offset":1050},"end":{"line":80,"column":17,"offset":1066},"indent":[]},"data":{"id":"polygonlayer","htmlAttributes":{"id":"polygonlayer"},"hProperties":{"id":"polygonlayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建面图层","position":{"start":{"line":81,"column":1,"offset":1067},"end":{"line":81,"column":6,"offset":1072},"indent":[]}}],"position":{"start":{"line":81,"column":1,"offset":1067},"end":{"line":81,"column":6,"offset":1072},"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":1078},"end":{"line":83,"column":15,"offset":1088},"indent":[]}}],"position":{"start":{"line":83,"column":1,"offset":1074},"end":{"line":83,"column":15,"offset":1088},"indent":[]},"data":{"id":"imagelayer","htmlAttributes":{"id":"imagelayer"},"hProperties":{"id":"imagelayer"}}},{"type":"paragraph","children":[{"type":"text","value":"新建图片图层","position":{"start":{"line":84,"column":1,"offset":1089},"end":{"line":84,"column":7,"offset":1095},"indent":[]}}],"position":{"start":{"line":84,"column":1,"offset":1089},"end":{"line":84,"column":7,"offset":1095},"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":1101},"end":{"line":87,"column":7,"offset":1104},"indent":[]}}],"position":{"start":{"line":87,"column":1,"offset":1098},"end":{"line":87,"column":7,"offset":1104},"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":1110},"end":{"line":89,"column":7,"offset":1112},"indent":[]}}],"position":{"start":{"line":89,"column":1,"offset":1106},"end":{"line":89,"column":7,"offset":1112},"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":1113},"end":{"line":90,"column":42,"offset":1154},"indent":[]}},{"type":"linkReference","identifier":"必选","label":"必选","referenceType":"shortcut","children":[{"type":"text","value":"必选","position":{"start":{"line":90,"column":43,"offset":1155},"end":{"line":90,"column":45,"offset":1157},"indent":[]}}],"position":{"start":{"line":90,"column":42,"offset":1154},"end":{"line":90,"column":46,"offset":1158},"indent":[]}}],"position":{"start":{"line":90,"column":1,"offset":1113},"end":{"line":90,"column":46,"offset":1158},"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":1165},"end":{"line":93,"column":9,"offset":1169},"indent":[]}}],"position":{"start":{"line":93,"column":1,"offset":1161},"end":{"line":93,"column":9,"offset":1169},"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":1170},"end":{"line":94,"column":26,"offset":1195},"indent":[]}}],"position":{"start":{"line":94,"column":1,"offset":1170},"end":{"line":94,"column":26,"offset":1195},"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":1201},"end":{"line":96,"column":11,"offset":1207},"indent":[]}}],"position":{"start":{"line":96,"column":1,"offset":1197},"end":{"line":96,"column":11,"offset":1207},"indent":[]},"data":{"id":"center","htmlAttributes":{"id":"center"},"hProperties":{"id":"center"}}},{"type":"paragraph","children":[{"type":"text","value":"地图初始中心经纬度 {Lnglat}","position":{"start":{"line":97,"column":1,"offset":1208},"end":{"line":97,"column":19,"offset":1226},"indent":[]}}],"position":{"start":{"line":97,"column":1,"offset":1208},"end":{"line":97,"column":19,"offset":1226},"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":1232},"end":{"line":99,"column":10,"offset":1237},"indent":[]}}],"position":{"start":{"line":99,"column":1,"offset":1228},"end":{"line":99,"column":10,"offset":1237},"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":1238},"end":{"line":100,"column":29,"offset":1266},"indent":[]}}],"position":{"start":{"line":100,"column":1,"offset":1238},"end":{"line":100,"column":29,"offset":1266},"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":1272},"end":{"line":102,"column":12,"offset":1279},"indent":[]}}],"position":{"start":{"line":102,"column":1,"offset":1268},"end":{"line":102,"column":12,"offset":1279},"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":1280},"end":{"line":103,"column":39,"offset":1318},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":103,"column":39,"offset":1318},"end":{"line":103,"column":45,"offset":1324},"indent":[]}},{"type":"text","value":"L7 内置三种种默认地图样式 dark | light|blank 空地图","position":{"start":{"line":103,"column":45,"offset":1324},"end":{"line":103,"column":82,"offset":1361},"indent":[]}}],"position":{"start":{"line":103,"column":1,"offset":1280},"end":{"line":103,"column":82,"offset":1361},"indent":[]}},{"type":"paragraph","children":[{"type":"text","value":"设置地图的显示样式,目前支持两种地图样式:","position":{"start":{"line":105,"column":1,"offset":1363},"end":{"line":105,"column":22,"offset":1384},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":22,"offset":1384},"end":{"line":105,"column":28,"offset":1390},"indent":[]}},{"type":"text","value":"第一种:自定义地图样式,如","position":{"start":{"line":105,"column":28,"offset":1390},"end":{"line":105,"column":41,"offset":1403},"indent":[]}},{"type":"html","value":""amap://styles/d6bf8c1d69cea9f5c696185ad4ac4c86"","position":{"start":{"line":105,"column":41,"offset":1403},"end":{"line":105,"column":91,"offset":1453},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":91,"offset":1453},"end":{"line":105,"column":97,"offset":1459},"indent":[]}},{"type":"text","value":"可前往","position":{"start":{"line":105,"column":97,"offset":1459},"end":{"line":105,"column":100,"offset":1462},"indent":[]}},{"type":"link","title":null,"url":"https://lbs.amap.com/dev/mapstyle/index","children":[{"type":"text","value":"地图自定义平台","position":{"start":{"line":105,"column":101,"offset":1463},"end":{"line":105,"column":108,"offset":1470},"indent":[]}}],"position":{"start":{"line":105,"column":100,"offset":1462},"end":{"line":105,"column":150,"offset":1512},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}},{"type":"text","value":"定制自己的个性地图样式;","position":{"start":{"line":105,"column":150,"offset":1512},"end":{"line":105,"column":162,"offset":1524},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":162,"offset":1524},"end":{"line":105,"column":168,"offset":1530},"indent":[]}},{"type":"text","value":"第二种:官方样式模版,如","position":{"start":{"line":105,"column":168,"offset":1530},"end":{"line":105,"column":180,"offset":1542},"indent":[]}},{"type":"html","value":""amap://styles/grey"","position":{"start":{"line":105,"column":180,"offset":1542},"end":{"line":105,"column":202,"offset":1564},"indent":[]}},{"type":"text","value":"。","position":{"start":{"line":105,"column":202,"offset":1564},"end":{"line":105,"column":203,"offset":1565},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":105,"column":203,"offset":1565},"end":{"line":105,"column":209,"offset":1571},"indent":[]}},{"type":"text","value":"其他模版样式及自定义地图的使用说明见","position":{"start":{"line":105,"column":209,"offset":1571},"end":{"line":105,"column":227,"offset":1589},"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":1590},"end":{"line":105,"column":232,"offset":1594},"indent":[]}}],"position":{"start":{"line":105,"column":227,"offset":1589},"end":{"line":105,"column":300,"offset":1662},"indent":[]},"data":{"hProperties":{"target":"_self","rel":"nofollow"}}}],"position":{"start":{"line":105,"column":1,"offset":1363},"end":{"line":105,"column":300,"offset":1662},"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":1669},"end":{"line":108,"column":12,"offset":1676},"indent":[]}}],"position":{"start":{"line":108,"column":1,"offset":1665},"end":{"line":108,"column":12,"offset":1676},"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":1677},"end":{"line":109,"column":37,"offset":1713},"indent":[]}}],"position":{"start":{"line":109,"column":1,"offset":1677},"end":{"line":109,"column":37,"offset":1713},"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":1719},"end":{"line":111,"column":12,"offset":1726},"indent":[]}}],"position":{"start":{"line":111,"column":1,"offset":1715},"end":{"line":111,"column":12,"offset":1726},"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":1727},"end":{"line":112,"column":38,"offset":1764},"indent":[]}}],"position":{"start":{"line":112,"column":1,"offset":1727},"end":{"line":112,"column":38,"offset":1764},"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":1770},"end":{"line":114,"column":17,"offset":1782},"indent":[]}}],"position":{"start":{"line":114,"column":1,"offset":1766},"end":{"line":114,"column":17,"offset":1782},"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":1783},"end":{"line":115,"column":31,"offset":1813},"indent":[]}}],"position":{"start":{"line":115,"column":1,"offset":1783},"end":{"line":115,"column":31,"offset":1813},"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":1821},"end":{"line":120,"column":6,"offset":1823},"indent":[]}}],"position":{"start":{"line":120,"column":1,"offset":1818},"end":{"line":120,"column":6,"offset":1823},"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":1829},"end":{"line":122,"column":12,"offset":1836},"indent":[]}}],"position":{"start":{"line":122,"column":1,"offset":1825},"end":{"line":122,"column":12,"offset":1836},"indent":[]},"data":{"id":"getzoom","htmlAttributes":{"id":"getzoom"},"hProperties":{"id":"getzoom"}}},{"type":"paragraph","children":[{"type":"text","value":"获取当前缩放等级","position":{"start":{"line":123,"column":1,"offset":1837},"end":{"line":123,"column":9,"offset":1845},"indent":[]}}],"position":{"start":{"line":123,"column":1,"offset":1837},"end":{"line":123,"column":9,"offset":1845},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getZoom();\n
","position":{"start":{"line":125,"column":1,"offset":1847},"end":{"line":127,"column":4,"offset":1881},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return {float}  当前缩放等级","position":{"start":{"line":129,"column":1,"offset":1883},"end":{"line":129,"column":24,"offset":1906},"indent":[]}}],"position":{"start":{"line":129,"column":1,"offset":1883},"end":{"line":129,"column":24,"offset":1906},"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":1912},"end":{"line":131,"column":16,"offset":1923},"indent":[]}}],"position":{"start":{"line":131,"column":1,"offset":1908},"end":{"line":131,"column":16,"offset":1923},"indent":[]},"data":{"id":"getlayers","htmlAttributes":{"id":"getlayers"},"hProperties":{"id":"getlayers"}}},{"type":"paragraph","children":[{"type":"text","value":"获取所有的地图图层","position":{"start":{"line":132,"column":1,"offset":1924},"end":{"line":132,"column":10,"offset":1933},"indent":[]}}],"position":{"start":{"line":132,"column":1,"offset":1924},"end":{"line":132,"column":10,"offset":1933},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getLayers();\n
","position":{"start":{"line":133,"column":1,"offset":1934},"end":{"line":135,"column":4,"offset":1970},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return 图层数组 {Array}","position":{"start":{"line":137,"column":1,"offset":1972},"end":{"line":137,"column":21,"offset":1992},"indent":[]}}],"position":{"start":{"line":137,"column":1,"offset":1972},"end":{"line":137,"column":21,"offset":1992},"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":1999},"end":{"line":140,"column":16,"offset":2010},"indent":[]}}],"position":{"start":{"line":140,"column":1,"offset":1995},"end":{"line":140,"column":16,"offset":2010},"indent":[]},"data":{"id":"getcenter","htmlAttributes":{"id":"getcenter"},"hProperties":{"id":"getcenter"}}},{"type":"paragraph","children":[{"type":"text","value":"获取地图中心点","position":{"start":{"line":141,"column":1,"offset":2011},"end":{"line":141,"column":8,"offset":2018},"indent":[]}}],"position":{"start":{"line":141,"column":1,"offset":2011},"end":{"line":141,"column":8,"offset":2018},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getCenter();\n
","position":{"start":{"line":142,"column":1,"offset":2019},"end":{"line":144,"column":4,"offset":2054},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return {Lnglat} :地图中心点","position":{"start":{"line":146,"column":1,"offset":2056},"end":{"line":146,"column":23,"offset":2078},"indent":[]}}],"position":{"start":{"line":146,"column":1,"offset":2056},"end":{"line":146,"column":23,"offset":2078},"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":2084},"end":{"line":148,"column":14,"offset":2093},"indent":[]}}],"position":{"start":{"line":148,"column":1,"offset":2080},"end":{"line":148,"column":14,"offset":2093},"indent":[]},"data":{"id":"getsize","htmlAttributes":{"id":"getsize"},"hProperties":{"id":"getsize"}}},{"type":"paragraph","children":[{"type":"text","value":"获取地图容器大小","position":{"start":{"line":149,"column":1,"offset":2094},"end":{"line":149,"column":9,"offset":2102},"indent":[]}}],"position":{"start":{"line":149,"column":1,"offset":2094},"end":{"line":149,"column":9,"offset":2102},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getSize();\n
","position":{"start":{"line":150,"column":1,"offset":2103},"end":{"line":152,"column":4,"offset":2136},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return { Object } 地图容器的 width,height","position":{"start":{"line":153,"column":1,"offset":2137},"end":{"line":153,"column":37,"offset":2173},"indent":[]}}],"position":{"start":{"line":153,"column":1,"offset":2137},"end":{"line":153,"column":37,"offset":2173},"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":2179},"end":{"line":155,"column":15,"offset":2189},"indent":[]}}],"position":{"start":{"line":155,"column":1,"offset":2175},"end":{"line":155,"column":15,"offset":2189},"indent":[]},"data":{"id":"getpitch","htmlAttributes":{"id":"getpitch"},"hProperties":{"id":"getpitch"}}},{"type":"paragraph","children":[{"type":"text","value":"获取地图俯仰角","position":{"start":{"line":156,"column":1,"offset":2190},"end":{"line":156,"column":8,"offset":2197},"indent":[]}}],"position":{"start":{"line":156,"column":1,"offset":2190},"end":{"line":156,"column":8,"offset":2197},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getPitch();\n
","position":{"start":{"line":157,"column":1,"offset":2198},"end":{"line":159,"column":4,"offset":2233},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return {number} pitch","position":{"start":{"line":161,"column":1,"offset":2235},"end":{"line":161,"column":22,"offset":2256},"indent":[]}}],"position":{"start":{"line":161,"column":1,"offset":2235},"end":{"line":161,"column":22,"offset":2256},"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":2262},"end":{"line":163,"column":16,"offset":2273},"indent":[]}}],"position":{"start":{"line":163,"column":1,"offset":2258},"end":{"line":163,"column":16,"offset":2273},"indent":[]},"data":{"id":"setcenter","htmlAttributes":{"id":"setcenter"},"hProperties":{"id":"setcenter"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图中心点坐标","position":{"start":{"line":164,"column":1,"offset":2274},"end":{"line":164,"column":10,"offset":2283},"indent":[]}}],"position":{"start":{"line":164,"column":1,"offset":2274},"end":{"line":164,"column":10,"offset":2283},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setCenter([lng, lat]);\n
","position":{"start":{"line":166,"column":1,"offset":2285},"end":{"line":168,"column":4,"offset":2329},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:","position":{"start":{"line":170,"column":1,"offset":2331},"end":{"line":170,"column":4,"offset":2334},"indent":[]}},{"type":"html","value":"center","position":{"start":{"line":170,"column":4,"offset":2334},"end":{"line":170,"column":12,"offset":2342},"indent":[]}},{"type":"text","value":" {LngLat} 地图中心点","position":{"start":{"line":170,"column":12,"offset":2342},"end":{"line":170,"column":28,"offset":2358},"indent":[]}}],"position":{"start":{"line":170,"column":1,"offset":2331},"end":{"line":170,"column":28,"offset":2358},"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":2365},"end":{"line":173,"column":21,"offset":2381},"indent":[]}}],"position":{"start":{"line":173,"column":1,"offset":2361},"end":{"line":173,"column":21,"offset":2381},"indent":[]},"data":{"id":"setzoomandcenter","htmlAttributes":{"id":"setzoomandcenter"},"hProperties":{"id":"setzoomandcenter"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图等级和中心","position":{"start":{"line":174,"column":1,"offset":2382},"end":{"line":174,"column":10,"offset":2391},"indent":[]}}],"position":{"start":{"line":174,"column":1,"offset":2382},"end":{"line":174,"column":10,"offset":2391},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setZoomAndCenter(zoom, center);\n
","position":{"start":{"line":175,"column":1,"offset":2392},"end":{"line":177,"column":4,"offset":2445},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:zoom {number}","position":{"start":{"line":179,"column":1,"offset":2447},"end":{"line":179,"column":17,"offset":2463},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":179,"column":17,"offset":2463},"end":{"line":179,"column":23,"offset":2469},"indent":[]}},{"type":"text","value":"center {LngLat}","position":{"start":{"line":179,"column":23,"offset":2469},"end":{"line":179,"column":38,"offset":2484},"indent":[]}}],"position":{"start":{"line":179,"column":1,"offset":2447},"end":{"line":179,"column":38,"offset":2484},"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":2491},"end":{"line":182,"column":16,"offset":2502},"indent":[]}}],"position":{"start":{"line":182,"column":1,"offset":2487},"end":{"line":182,"column":16,"offset":2502},"indent":[]},"data":{"id":"setrotation","htmlAttributes":{"id":"setrotation"},"hProperties":{"id":"setrotation"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图顺时针旋转角度,旋转原点为地图容器中心点,取值范围 ","position":{"start":{"line":183,"column":1,"offset":2503},"end":{"line":183,"column":31,"offset":2533},"indent":[]}},{"type":"linkReference","identifier":"0-360","label":"0-360","referenceType":"shortcut","children":[{"type":"text","value":"0-360","position":{"start":{"line":183,"column":32,"offset":2534},"end":{"line":183,"column":37,"offset":2539},"indent":[]}}],"position":{"start":{"line":183,"column":31,"offset":2533},"end":{"line":183,"column":38,"offset":2540},"indent":[]}}],"position":{"start":{"line":183,"column":1,"offset":2503},"end":{"line":183,"column":38,"offset":2540},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setRotation(rotation);\n
","position":{"start":{"line":184,"column":1,"offset":2541},"end":{"line":186,"column":4,"offset":2586},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数: ","position":{"start":{"line":188,"column":1,"offset":2588},"end":{"line":188,"column":5,"offset":2592},"indent":[]}},{"type":"html","value":"rotation","position":{"start":{"line":188,"column":5,"offset":2592},"end":{"line":188,"column":15,"offset":2602},"indent":[]}},{"type":"text","value":" {number}","position":{"start":{"line":188,"column":15,"offset":2602},"end":{"line":188,"column":26,"offset":2613},"indent":[]}}],"position":{"start":{"line":188,"column":1,"offset":2588},"end":{"line":188,"column":26,"offset":2613},"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":2619},"end":{"line":190,"column":11,"offset":2625},"indent":[]}}],"position":{"start":{"line":190,"column":1,"offset":2615},"end":{"line":190,"column":11,"offset":2625},"indent":[]},"data":{"id":"zoomin","htmlAttributes":{"id":"zoomin"},"hProperties":{"id":"zoomin"}}},{"type":"paragraph","children":[{"type":"text","value":"地图放大一级","position":{"start":{"line":191,"column":1,"offset":2626},"end":{"line":191,"column":7,"offset":2632},"indent":[]}}],"position":{"start":{"line":191,"column":1,"offset":2626},"end":{"line":191,"column":7,"offset":2632},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.zoomIn();\n
","position":{"start":{"line":192,"column":1,"offset":2633},"end":{"line":194,"column":4,"offset":2665},"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":2671},"end":{"line":196,"column":12,"offset":2678},"indent":[]}}],"position":{"start":{"line":196,"column":1,"offset":2667},"end":{"line":196,"column":12,"offset":2678},"indent":[]},"data":{"id":"zoomout","htmlAttributes":{"id":"zoomout"},"hProperties":{"id":"zoomout"}}},{"type":"paragraph","children":[{"type":"text","value":"地图缩小一级","position":{"start":{"line":197,"column":1,"offset":2679},"end":{"line":197,"column":7,"offset":2685},"indent":[]}}],"position":{"start":{"line":197,"column":1,"offset":2679},"end":{"line":197,"column":7,"offset":2685},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.ZoomOUt();\n
","position":{"start":{"line":198,"column":1,"offset":2686},"end":{"line":200,"column":4,"offset":2719},"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":2725},"end":{"line":202,"column":10,"offset":2730},"indent":[]}}],"position":{"start":{"line":202,"column":1,"offset":2721},"end":{"line":202,"column":10,"offset":2730},"indent":[]},"data":{"id":"panto","htmlAttributes":{"id":"panto"},"hProperties":{"id":"panto"}}},{"type":"paragraph","children":[{"type":"text","value":"地图平移到指定的位置","position":{"start":{"line":203,"column":1,"offset":2731},"end":{"line":203,"column":11,"offset":2741},"indent":[]}}],"position":{"start":{"line":203,"column":1,"offset":2731},"end":{"line":203,"column":11,"offset":2741},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.panTo(LngLat);\n
","position":{"start":{"line":204,"column":1,"offset":2742},"end":{"line":206,"column":4,"offset":2779},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:","position":{"start":{"line":208,"column":1,"offset":2781},"end":{"line":208,"column":4,"offset":2784},"indent":[]}},{"type":"html","value":"center","position":{"start":{"line":208,"column":4,"offset":2784},"end":{"line":208,"column":12,"offset":2792},"indent":[]}},{"type":"text","value":" LngLat 中心位置坐标","position":{"start":{"line":208,"column":12,"offset":2792},"end":{"line":208,"column":27,"offset":2807},"indent":[]}}],"position":{"start":{"line":208,"column":1,"offset":2781},"end":{"line":208,"column":27,"offset":2807},"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":2813},"end":{"line":210,"column":10,"offset":2818},"indent":[]}}],"position":{"start":{"line":210,"column":1,"offset":2809},"end":{"line":210,"column":10,"offset":2818},"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":2819},"end":{"line":211,"column":19,"offset":2837},"indent":[]}}],"position":{"start":{"line":211,"column":1,"offset":2819},"end":{"line":211,"column":19,"offset":2837},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.panBy(x, y);\n
","position":{"start":{"line":212,"column":1,"offset":2838},"end":{"line":214,"column":4,"offset":2872},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数:","position":{"start":{"line":215,"column":1,"offset":2873},"end":{"line":215,"column":4,"offset":2876},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":215,"column":4,"offset":2876},"end":{"line":215,"column":10,"offset":2882},"indent":[]}},{"type":"html","value":"x","position":{"start":{"line":215,"column":10,"offset":2882},"end":{"line":215,"column":13,"offset":2885},"indent":[]}},{"type":"text","value":" {number} 水平方向移动像素 向右为正方向","position":{"start":{"line":215,"column":13,"offset":2885},"end":{"line":215,"column":38,"offset":2910},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":215,"column":38,"offset":2910},"end":{"line":215,"column":44,"offset":2916},"indent":[]}},{"type":"text","value":"      ","position":{"start":{"line":215,"column":44,"offset":2916},"end":{"line":215,"column":50,"offset":2922},"indent":[]}},{"type":"html","value":"y","position":{"start":{"line":215,"column":50,"offset":2922},"end":{"line":215,"column":53,"offset":2925},"indent":[]}},{"type":"text","value":" {number} 垂直方向移动像素 向下为正方向","position":{"start":{"line":215,"column":53,"offset":2925},"end":{"line":215,"column":79,"offset":2951},"indent":[]}}],"position":{"start":{"line":215,"column":1,"offset":2873},"end":{"line":215,"column":79,"offset":2951},"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":2958},"end":{"line":218,"column":13,"offset":2966},"indent":[]}}],"position":{"start":{"line":218,"column":1,"offset":2954},"end":{"line":218,"column":13,"offset":2966},"indent":[]},"data":{"id":"setpitch","htmlAttributes":{"id":"setpitch"},"hProperties":{"id":"setpitch"}}},{"type":"paragraph","children":[{"type":"text","value":"设置地图仰俯角度","position":{"start":{"line":219,"column":1,"offset":2967},"end":{"line":219,"column":9,"offset":2975},"indent":[]}}],"position":{"start":{"line":219,"column":1,"offset":2967},"end":{"line":219,"column":9,"offset":2975},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.setPitch(pitch);\n
","position":{"start":{"line":220,"column":1,"offset":2976},"end":{"line":222,"column":4,"offset":3015},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数 :","position":{"start":{"line":224,"column":1,"offset":3017},"end":{"line":224,"column":5,"offset":3021},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":224,"column":5,"offset":3021},"end":{"line":224,"column":11,"offset":3027},"indent":[]}},{"type":"text","value":"   ","position":{"start":{"line":224,"column":11,"offset":3027},"end":{"line":224,"column":14,"offset":3030},"indent":[]}},{"type":"html","value":"pitch","position":{"start":{"line":224,"column":14,"offset":3030},"end":{"line":224,"column":21,"offset":3037},"indent":[]}},{"type":"text","value":" {number}","position":{"start":{"line":224,"column":21,"offset":3037},"end":{"line":224,"column":31,"offset":3047},"indent":[]}}],"position":{"start":{"line":224,"column":1,"offset":3017},"end":{"line":224,"column":31,"offset":3047},"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":3049},"end":{"line":226,"column":5,"offset":3053},"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":3059},"end":{"line":228,"column":14,"offset":3068},"indent":[]}}],"position":{"start":{"line":228,"column":1,"offset":3055},"end":{"line":228,"column":14,"offset":3068},"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":3069},"end":{"line":229,"column":100,"offset":3168},"indent":[]}}],"position":{"start":{"line":229,"column":1,"offset":3069},"end":{"line":229,"column":100,"offset":3168},"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":3170},"end":{"line":239,"column":4,"offset":3347},"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":3354},"end":{"line":242,"column":14,"offset":3363},"indent":[]}}],"position":{"start":{"line":242,"column":1,"offset":3350},"end":{"line":242,"column":14,"offset":3363},"indent":[]},"data":{"id":"fitbounds","htmlAttributes":{"id":"fitbounds"},"hProperties":{"id":"fitbounds"}}},{"type":"paragraph","children":[{"type":"text","value":"地图缩放到某个范围内","position":{"start":{"line":243,"column":1,"offset":3364},"end":{"line":243,"column":11,"offset":3374},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":243,"column":11,"offset":3374},"end":{"line":243,"column":17,"offset":3380},"indent":[]}},{"type":"text","value":"参数 :","position":{"start":{"line":243,"column":17,"offset":3380},"end":{"line":243,"column":21,"offset":3384},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":243,"column":21,"offset":3384},"end":{"line":243,"column":27,"offset":3390},"indent":[]}},{"type":"text","value":"  ","position":{"start":{"line":243,"column":27,"offset":3390},"end":{"line":243,"column":29,"offset":3392},"indent":[]}},{"type":"html","value":"extent","position":{"start":{"line":243,"column":29,"offset":3392},"end":{"line":243,"column":37,"offset":3400},"indent":[]}},{"type":"text","value":" { array} 经纬度范围 ","position":{"start":{"line":243,"column":37,"offset":3400},"end":{"line":243,"column":53,"offset":3416},"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":3417},"end":{"line":243,"column":81,"offset":3444},"indent":[]}}],"position":{"start":{"line":243,"column":53,"offset":3416},"end":{"line":243,"column":82,"offset":3445},"indent":[]}}],"position":{"start":{"line":243,"column":1,"offset":3364},"end":{"line":243,"column":82,"offset":3445},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.fitBounds([112, 32, 114, 35]);\n
","position":{"start":{"line":245,"column":1,"offset":3447},"end":{"line":247,"column":4,"offset":3498},"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":3506},"end":{"line":251,"column":16,"offset":3517},"indent":[]}}],"position":{"start":{"line":251,"column":1,"offset":3502},"end":{"line":251,"column":16,"offset":3517},"indent":[]},"data":{"id":"removelayer","htmlAttributes":{"id":"removelayer"},"hProperties":{"id":"removelayer"}}},{"type":"paragraph","children":[{"type":"text","value":"移除layer","position":{"start":{"line":252,"column":1,"offset":3518},"end":{"line":252,"column":8,"offset":3525},"indent":[]}}],"position":{"start":{"line":252,"column":1,"offset":3518},"end":{"line":252,"column":8,"offset":3525},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.removeLayer(layer);\n
","position":{"start":{"line":254,"column":1,"offset":3527},"end":{"line":256,"column":4,"offset":3569},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"参数","position":{"start":{"line":258,"column":1,"offset":3571},"end":{"line":258,"column":3,"offset":3573},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":258,"column":3,"offset":3573},"end":{"line":258,"column":9,"offset":3579},"indent":[]}},{"type":"html","value":"layer","position":{"start":{"line":258,"column":9,"offset":3579},"end":{"line":258,"column":16,"offset":3586},"indent":[]}},{"type":"text","value":" {Layer}","position":{"start":{"line":258,"column":16,"offset":3586},"end":{"line":258,"column":25,"offset":3595},"indent":[]}}],"position":{"start":{"line":258,"column":1,"offset":3571},"end":{"line":258,"column":25,"offset":3595},"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":3601},"end":{"line":260,"column":14,"offset":3610},"indent":[]}}],"position":{"start":{"line":260,"column":1,"offset":3597},"end":{"line":260,"column":14,"offset":3610},"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":3611},"end":{"line":261,"column":12,"offset":3622},"indent":[]}}],"position":{"start":{"line":261,"column":1,"offset":3611},"end":{"line":261,"column":12,"offset":3622},"indent":[]}},{"type":"html","lang":"javascript","meta":null,"value":"
scene.getLayers();\n
","position":{"start":{"line":263,"column":1,"offset":3624},"end":{"line":265,"column":4,"offset":3659},"indent":[1,1]}},{"type":"paragraph","children":[{"type":"text","value":"return layers  {array}","position":{"start":{"line":267,"column":1,"offset":3661},"end":{"line":267,"column":24,"offset":3684},"indent":[]}}],"position":{"start":{"line":267,"column":1,"offset":3661},"end":{"line":267,"column":24,"offset":3684},"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":3689},"end":{"line":269,"column":6,"offset":3691},"indent":[]}}],"position":{"start":{"line":269,"column":1,"offset":3686},"end":{"line":269,"column":6,"offset":3691},"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":3698},"end":{"line":272,"column":7,"offset":3700},"indent":[]}}],"position":{"start":{"line":272,"column":1,"offset":3694},"end":{"line":272,"column":7,"offset":3700},"indent":[]},"data":{"id":"on","htmlAttributes":{"id":"on"},"hProperties":{"id":"on"}}},{"type":"paragraph","children":[{"type":"text","value":"事件监听","position":{"start":{"line":273,"column":1,"offset":3701},"end":{"line":273,"column":5,"offset":3705},"indent":[]}}],"position":{"start":{"line":273,"column":1,"offset":3701},"end":{"line":273,"column":5,"offset":3705},"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":3712},"end":{"line":275,"column":8,"offset":3714},"indent":[]}}],"position":{"start":{"line":275,"column":1,"offset":3707},"end":{"line":275,"column":8,"offset":3714},"indent":[]},"data":{"id":"参数","htmlAttributes":{"id":"参数"},"hProperties":{"id":"参数"}}},{"type":"paragraph","children":[{"type":"html","value":"eventName","position":{"start":{"line":276,"column":1,"offset":3715},"end":{"line":276,"column":12,"offset":3726},"indent":[]}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":276,"column":12,"offset":3726},"end":{"line":276,"column":26,"offset":3740},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":276,"column":26,"offset":3740},"end":{"line":276,"column":32,"offset":3746},"indent":[]}},{"type":"html","value":"hander","position":{"start":{"line":276,"column":32,"offset":3746},"end":{"line":276,"column":40,"offset":3754},"indent":[]}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":276,"column":40,"offset":3754},"end":{"line":276,"column":60,"offset":3774},"indent":[]}}],"position":{"start":{"line":276,"column":1,"offset":3715},"end":{"line":276,"column":60,"offset":3774},"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":3781},"end":{"line":279,"column":8,"offset":3784},"indent":[]}}],"position":{"start":{"line":279,"column":1,"offset":3777},"end":{"line":279,"column":8,"offset":3784},"indent":[]},"data":{"id":"off","htmlAttributes":{"id":"off"},"hProperties":{"id":"off"}}},{"type":"paragraph","children":[{"type":"text","value":"移除事件监听","position":{"start":{"line":280,"column":1,"offset":3785},"end":{"line":280,"column":7,"offset":3791},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":280,"column":7,"offset":3791},"end":{"line":280,"column":13,"offset":3797},"indent":[]}},{"type":"html","value":"eventName","position":{"start":{"line":280,"column":13,"offset":3797},"end":{"line":280,"column":24,"offset":3808},"indent":[]}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":280,"column":24,"offset":3808},"end":{"line":280,"column":38,"offset":3822},"indent":[]}},{"type":"html","value":"
","position":{"start":{"line":280,"column":38,"offset":3822},"end":{"line":280,"column":44,"offset":3828},"indent":[]}},{"type":"html","value":"hander","position":{"start":{"line":280,"column":44,"offset":3828},"end":{"line":280,"column":52,"offset":3836},"indent":[]}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":280,"column":52,"offset":3836},"end":{"line":280,"column":72,"offset":3856},"indent":[]}}],"position":{"start":{"line":280,"column":1,"offset":3785},"end":{"line":280,"column":72,"offset":3856},"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":3863},"end":{"line":283,"column":9,"offset":3867},"indent":[]}}],"position":{"start":{"line":283,"column":1,"offset":3859},"end":{"line":283,"column":9,"offset":3867},"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":3868},"end":{"line":292,"column":4,"offset":4205},"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":4212},"end":{"line":295,"column":9,"offset":4216},"indent":[]}}],"position":{"start":{"line":295,"column":1,"offset":4208},"end":{"line":295,"column":9,"offset":4216},"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":4218},"end":{"line":310,"column":4,"offset":4925},"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":4931},"end":{"line":312,"column":9,"offset":4935},"indent":[]}}],"position":{"start":{"line":312,"column":1,"offset":4927},"end":{"line":312,"column":9,"offset":4935},"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":4936},"end":{"line":315,"column":4,"offset":4993},"indent":[1,1]}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":318,"column":1,"offset":4996}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-75ccc6c53e13e0d176bf3912a21c1610.json b/.cache/caches/gatsby-transformer-remark/diskstore-75ccc6c53e13e0d176bf3912a21c1610.json new file mode 100644 index 0000000000..135e096278 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-75ccc6c53e13e0d176bf3912a21c1610.json @@ -0,0 +1 @@ +{"expireTime":9007200828058199000,"key":"transformer-remark-markdown-ast-0b8b19ff19f6a64f7b2cae67200ccd88-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-8152d0a6832522eb79f34eecc5e89cd4.json b/.cache/caches/gatsby-transformer-remark/diskstore-8152d0a6832522eb79f34eecc5e89cd4.json new file mode 100644 index 0000000000..018de3a5d3 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8152d0a6832522eb79f34eecc5e89cd4.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-8589291dd9d97abb4ea73a913e98ba63.json b/.cache/caches/gatsby-transformer-remark/diskstore-8589291dd9d97abb4ea73a913e98ba63.json new file mode 100644 index 0000000000..d76c9424af --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8589291dd9d97abb4ea73a913e98ba63.json @@ -0,0 +1 @@ +{"expireTime":9007200827958508000,"key":"transformer-remark-markdown-html-ast-a1d219db4ea61081778ff63395ff3e91-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-8a657829abac5ed5e9e205e519d6ded0.json b/.cache/caches/gatsby-transformer-remark/diskstore-8a657829abac5ed5e9e205e519d6ded0.json new file mode 100644 index 0000000000..271f4506f0 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8a657829abac5ed5e9e205e519d6ded0.json @@ -0,0 +1 @@ +{"expireTime":9007200828128385000,"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..04d4732214 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-8c6f6648e48a1e25d0879cba52c6f15c.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-927d1c346e0d6649106a86c202abe79b.json b/.cache/caches/gatsby-transformer-remark/diskstore-927d1c346e0d6649106a86c202abe79b.json new file mode 100644 index 0000000000..39f520030f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-927d1c346e0d6649106a86c202abe79b.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-html-ast-30a51869612bca077eda87f35f662bad-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-9429c44d730cc08b4b28804d3d7d5a2c.json b/.cache/caches/gatsby-transformer-remark/diskstore-9429c44d730cc08b4b28804d3d7d5a2c.json new file mode 100644 index 0000000000..436de1c39c --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-9429c44d730cc08b4b28804d3d7d5a2c.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-994b78daf72919990af1bf2269cd4372.json b/.cache/caches/gatsby-transformer-remark/diskstore-994b78daf72919990af1bf2269cd4372.json new file mode 100644 index 0000000000..51c924c93a --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-994b78daf72919990af1bf2269cd4372.json @@ -0,0 +1 @@ +{"expireTime":9007200827958528000,"key":"transformer-remark-markdown-html-ast-e0eda26454f7aaeda47989e111060318-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-9cf731425f928d78c08a41fa53dbea26.json b/.cache/caches/gatsby-transformer-remark/diskstore-9cf731425f928d78c08a41fa53dbea26.json new file mode 100644 index 0000000000..a2f0676c66 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-9cf731425f928d78c08a41fa53dbea26.json @@ -0,0 +1 @@ +{"expireTime":9007200828128384000,"key":"transformer-remark-markdown-html-6e9c5aea4f7ea7c85d806fb35a09a394-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-a3ad6ea9016c2bbe5a2cd975be604ff5.json b/.cache/caches/gatsby-transformer-remark/diskstore-a3ad6ea9016c2bbe5a2cd975be604ff5.json new file mode 100644 index 0000000000..59cbf5730e --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-a3ad6ea9016c2bbe5a2cd975be604ff5.json @@ -0,0 +1 @@ +{"expireTime":9007200828058191000,"key":"transformer-remark-markdown-html-ast-46d92e293407aa2f9b2f1b0b9fc86991-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-a7725b15bd64a40f9d4d5eb35340b314.json b/.cache/caches/gatsby-transformer-remark/diskstore-a7725b15bd64a40f9d4d5eb35340b314.json new file mode 100644 index 0000000000..661498f2fd --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-a7725b15bd64a40f9d4d5eb35340b314.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-ab3c328a2b98edcd782e2b4ea47d83c8.json b/.cache/caches/gatsby-transformer-remark/diskstore-ab3c328a2b98edcd782e2b4ea47d83c8.json new file mode 100644 index 0000000000..767d1987c0 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ab3c328a2b98edcd782e2b4ea47d83c8.json @@ -0,0 +1 @@ +{"expireTime":9007200827957881000,"key":"transformer-remark-markdown-html-ast-b203d64bdde854a7c4141aaf3bd814db-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});\n
","position":{"start":{"line":7,"column":1,"offset":47},"end":{"line":15,"column":4,"offset":214}}},{"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":221},"end":{"line":18,"column":9,"offset":225}}}],"position":{"start":{"line":18,"column":1,"offset":217},"end":{"line":18,"column":9,"offset":225}}},{"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":229},"end":{"line":20,"column":8,"offset":234}}}],"position":{"start":{"line":20,"column":1,"offset":227},"end":{"line":20,"column":10,"offset":236}}},{"type":"raw","value":"
","position":{"start":{"line":20,"column":10,"offset":236},"end":{"line":20,"column":16,"offset":242}}},{"type":"text","value":"支持两种实例化方式","position":{"start":{"line":20,"column":16,"offset":242},"end":{"line":20,"column":25,"offset":251}}}],"position":{"start":{"line":20,"column":1,"offset":227},"end":{"line":20,"column":25,"offset":251}}},{"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":255},"end":{"line":22,"column":23,"offset":275}}}],"position":{"start":{"line":22,"column":1,"offset":253},"end":{"line":22,"column":23,"offset":275}}},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"传入地图实例","position":{"start":{"line":23,"column":3,"offset":278},"end":{"line":23,"column":9,"offset":284}}}],"position":{"start":{"line":23,"column":1,"offset":276},"end":{"line":23,"column":9,"offset":284}}},{"type":"text","value":"\n"}],"position":{"start":{"line":22,"column":1,"offset":253},"end":{"line":23,"column":9,"offset":284}}},{"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":295},"end":{"line":29,"column":17,"offset":306}}}],"position":{"start":{"line":29,"column":1,"offset":290},"end":{"line":29,"column":17,"offset":306}}},{"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":308},"end":{"line":41,"column":4,"offset":488}}},{"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":496},"end":{"line":44,"column":21,"offset":511}}}],"position":{"start":{"line":44,"column":1,"offset":491},"end":{"line":44,"column":21,"offset":511}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"_L7 基于高德地图3D模式开发的,因此传入Map实例 _","position":{"start":{"line":46,"column":1,"offset":513},"end":{"line":46,"column":30,"offset":542}}},{"type":"element","tagName":"em","properties":{},"children":[{"type":"text","value":"viewModes需要设置成3d","position":{"start":{"line":46,"column":31,"offset":543},"end":{"line":46,"column":47,"offset":559}}}],"position":{"start":{"line":46,"column":30,"offset":542},"end":{"line":46,"column":48,"offset":560}}},{"type":"raw","value":"
","position":{"start":{"line":46,"column":48,"offset":560},"end":{"line":46,"column":54,"offset":566}}},{"type":"text","value":"_","position":{"start":{"line":46,"column":54,"offset":566},"end":{"line":46,"column":55,"offset":567}}}],"position":{"start":{"line":46,"column":1,"offset":513},"end":{"line":46,"column":55,"offset":567}}},{"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":568},"end":{"line":61,"column":4,"offset":827}}},{"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":833},"end":{"line":64,"column":7,"offset":836}}}],"position":{"start":{"line":64,"column":1,"offset":830},"end":{"line":64,"column":7,"offset":836}}},{"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":837},"end":{"line":65,"column":49,"offset":885}}},{"type":"raw","value":"
","position":{"start":{"line":65,"column":49,"offset":885},"end":{"line":65,"column":55,"offset":891}}},{"type":"text","value":"map 实例方法见","position":{"start":{"line":65,"column":55,"offset":891},"end":{"line":65,"column":64,"offset":900}}},{"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":901},"end":{"line":65,"column":71,"offset":907}}}],"position":{"start":{"line":65,"column":64,"offset":900},"end":{"line":65,"column":127,"offset":963}}}],"position":{"start":{"line":65,"column":1,"offset":837},"end":{"line":65,"column":127,"offset":963}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.map;\n
","position":{"start":{"line":67,"column":1,"offset":965},"end":{"line":69,"column":4,"offset":992}}},{"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":998},"end":{"line":72,"column":7,"offset":1001}}}],"position":{"start":{"line":72,"column":1,"offset":995},"end":{"line":72,"column":7,"offset":1001}}},{"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":1007},"end":{"line":74,"column":15,"offset":1017}}}],"position":{"start":{"line":74,"column":1,"offset":1003},"end":{"line":74,"column":15,"offset":1017}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建点图层","position":{"start":{"line":75,"column":1,"offset":1018},"end":{"line":75,"column":6,"offset":1023}}}],"position":{"start":{"line":75,"column":1,"offset":1018},"end":{"line":75,"column":6,"offset":1023}}},{"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":1029},"end":{"line":77,"column":18,"offset":1042}}}],"position":{"start":{"line":77,"column":1,"offset":1025},"end":{"line":77,"column":18,"offset":1042}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建线图层","position":{"start":{"line":78,"column":1,"offset":1043},"end":{"line":78,"column":6,"offset":1048}}}],"position":{"start":{"line":78,"column":1,"offset":1043},"end":{"line":78,"column":6,"offset":1048}}},{"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":1054},"end":{"line":80,"column":17,"offset":1066}}}],"position":{"start":{"line":80,"column":1,"offset":1050},"end":{"line":80,"column":17,"offset":1066}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建面图层","position":{"start":{"line":81,"column":1,"offset":1067},"end":{"line":81,"column":6,"offset":1072}}}],"position":{"start":{"line":81,"column":1,"offset":1067},"end":{"line":81,"column":6,"offset":1072}}},{"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":1078},"end":{"line":83,"column":15,"offset":1088}}}],"position":{"start":{"line":83,"column":1,"offset":1074},"end":{"line":83,"column":15,"offset":1088}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"新建图片图层","position":{"start":{"line":84,"column":1,"offset":1089},"end":{"line":84,"column":7,"offset":1095}}}],"position":{"start":{"line":84,"column":1,"offset":1089},"end":{"line":84,"column":7,"offset":1095}}},{"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":1101},"end":{"line":87,"column":7,"offset":1104}}}],"position":{"start":{"line":87,"column":1,"offset":1098},"end":{"line":87,"column":7,"offset":1104}}},{"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":1110},"end":{"line":89,"column":7,"offset":1112}}}],"position":{"start":{"line":89,"column":1,"offset":1106},"end":{"line":89,"column":7,"offset":1112}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"需传入 dom 容器或者容器 id  {domObject || string} ","position":{"start":{"line":90,"column":1,"offset":1113},"end":{"line":90,"column":42,"offset":1154}}},{"type":"text","value":"[必选]","position":{"start":{"line":90,"column":43,"offset":1155},"end":{"line":90,"column":45,"offset":1157}}}],"position":{"start":{"line":90,"column":1,"offset":1113},"end":{"line":90,"column":46,"offset":1158}}},{"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":1165},"end":{"line":93,"column":9,"offset":1169}}}],"position":{"start":{"line":93,"column":1,"offset":1161},"end":{"line":93,"column":9,"offset":1169}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图初始显示级别 {number} (0-22)","position":{"start":{"line":94,"column":1,"offset":1170},"end":{"line":94,"column":26,"offset":1195}}}],"position":{"start":{"line":94,"column":1,"offset":1170},"end":{"line":94,"column":26,"offset":1195}}},{"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":1201},"end":{"line":96,"column":11,"offset":1207}}}],"position":{"start":{"line":96,"column":1,"offset":1197},"end":{"line":96,"column":11,"offset":1207}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图初始中心经纬度 {Lnglat}","position":{"start":{"line":97,"column":1,"offset":1208},"end":{"line":97,"column":19,"offset":1226}}}],"position":{"start":{"line":97,"column":1,"offset":1208},"end":{"line":97,"column":19,"offset":1226}}},{"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":1232},"end":{"line":99,"column":10,"offset":1237}}}],"position":{"start":{"line":99,"column":1,"offset":1228},"end":{"line":99,"column":10,"offset":1237}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图初始俯仰角度 {number}  default 0","position":{"start":{"line":100,"column":1,"offset":1238},"end":{"line":100,"column":29,"offset":1266}}}],"position":{"start":{"line":100,"column":1,"offset":1238},"end":{"line":100,"column":29,"offset":1266}}},{"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":1272},"end":{"line":102,"column":12,"offset":1279}}}],"position":{"start":{"line":102,"column":1,"offset":1268},"end":{"line":102,"column":12,"offset":1279}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图样式 {style} 目前仅支持高德地图。 default 'dark'","position":{"start":{"line":103,"column":1,"offset":1280},"end":{"line":103,"column":39,"offset":1318}}},{"type":"raw","value":"
","position":{"start":{"line":103,"column":39,"offset":1318},"end":{"line":103,"column":45,"offset":1324}}},{"type":"text","value":"L7 内置三种种默认地图样式 dark | light|blank 空地图","position":{"start":{"line":103,"column":45,"offset":1324},"end":{"line":103,"column":82,"offset":1361}}}],"position":{"start":{"line":103,"column":1,"offset":1280},"end":{"line":103,"column":82,"offset":1361}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图的显示样式,目前支持两种地图样式:","position":{"start":{"line":105,"column":1,"offset":1363},"end":{"line":105,"column":22,"offset":1384}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":22,"offset":1384},"end":{"line":105,"column":28,"offset":1390}}},{"type":"text","value":"第一种:自定义地图样式,如","position":{"start":{"line":105,"column":28,"offset":1390},"end":{"line":105,"column":41,"offset":1403}}},{"type":"raw","value":""amap://styles/d6bf8c1d69cea9f5c696185ad4ac4c86"","position":{"start":{"line":105,"column":41,"offset":1403},"end":{"line":105,"column":91,"offset":1453}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":91,"offset":1453},"end":{"line":105,"column":97,"offset":1459}}},{"type":"text","value":"可前往","position":{"start":{"line":105,"column":97,"offset":1459},"end":{"line":105,"column":100,"offset":1462}}},{"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":1463},"end":{"line":105,"column":108,"offset":1470}}}],"position":{"start":{"line":105,"column":100,"offset":1462},"end":{"line":105,"column":150,"offset":1512}}},{"type":"text","value":"定制自己的个性地图样式;","position":{"start":{"line":105,"column":150,"offset":1512},"end":{"line":105,"column":162,"offset":1524}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":162,"offset":1524},"end":{"line":105,"column":168,"offset":1530}}},{"type":"text","value":"第二种:官方样式模版,如","position":{"start":{"line":105,"column":168,"offset":1530},"end":{"line":105,"column":180,"offset":1542}}},{"type":"raw","value":""amap://styles/grey"","position":{"start":{"line":105,"column":180,"offset":1542},"end":{"line":105,"column":202,"offset":1564}}},{"type":"text","value":"。","position":{"start":{"line":105,"column":202,"offset":1564},"end":{"line":105,"column":203,"offset":1565}}},{"type":"raw","value":"
","position":{"start":{"line":105,"column":203,"offset":1565},"end":{"line":105,"column":209,"offset":1571}}},{"type":"text","value":"其他模版样式及自定义地图的使用说明见","position":{"start":{"line":105,"column":209,"offset":1571},"end":{"line":105,"column":227,"offset":1589}}},{"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":1590},"end":{"line":105,"column":232,"offset":1594}}}],"position":{"start":{"line":105,"column":227,"offset":1589},"end":{"line":105,"column":300,"offset":1662}}}],"position":{"start":{"line":105,"column":1,"offset":1363},"end":{"line":105,"column":300,"offset":1662}}},{"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":1669},"end":{"line":108,"column":12,"offset":1676}}}],"position":{"start":{"line":108,"column":1,"offset":1665},"end":{"line":108,"column":12,"offset":1676}}},{"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":1677},"end":{"line":109,"column":37,"offset":1713}}}],"position":{"start":{"line":109,"column":1,"offset":1677},"end":{"line":109,"column":37,"offset":1713}}},{"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":1719},"end":{"line":111,"column":12,"offset":1726}}}],"position":{"start":{"line":111,"column":1,"offset":1715},"end":{"line":111,"column":12,"offset":1726}}},{"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":1727},"end":{"line":112,"column":38,"offset":1764}}}],"position":{"start":{"line":112,"column":1,"offset":1727},"end":{"line":112,"column":38,"offset":1764}}},{"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":1770},"end":{"line":114,"column":17,"offset":1782}}}],"position":{"start":{"line":114,"column":1,"offset":1766},"end":{"line":114,"column":17,"offset":1782}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图是否可旋转 {Boolean} default true","position":{"start":{"line":115,"column":1,"offset":1783},"end":{"line":115,"column":31,"offset":1813}}}],"position":{"start":{"line":115,"column":1,"offset":1783},"end":{"line":115,"column":31,"offset":1813}}},{"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":1821},"end":{"line":120,"column":6,"offset":1823}}}],"position":{"start":{"line":120,"column":1,"offset":1818},"end":{"line":120,"column":6,"offset":1823}}},{"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":1829},"end":{"line":122,"column":12,"offset":1836}}}],"position":{"start":{"line":122,"column":1,"offset":1825},"end":{"line":122,"column":12,"offset":1836}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取当前缩放等级","position":{"start":{"line":123,"column":1,"offset":1837},"end":{"line":123,"column":9,"offset":1845}}}],"position":{"start":{"line":123,"column":1,"offset":1837},"end":{"line":123,"column":9,"offset":1845}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getZoom();\n
","position":{"start":{"line":125,"column":1,"offset":1847},"end":{"line":127,"column":4,"offset":1881}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return {float}  当前缩放等级","position":{"start":{"line":129,"column":1,"offset":1883},"end":{"line":129,"column":24,"offset":1906}}}],"position":{"start":{"line":129,"column":1,"offset":1883},"end":{"line":129,"column":24,"offset":1906}}},{"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":1912},"end":{"line":131,"column":16,"offset":1923}}}],"position":{"start":{"line":131,"column":1,"offset":1908},"end":{"line":131,"column":16,"offset":1923}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取所有的地图图层","position":{"start":{"line":132,"column":1,"offset":1924},"end":{"line":132,"column":10,"offset":1933}}}],"position":{"start":{"line":132,"column":1,"offset":1924},"end":{"line":132,"column":10,"offset":1933}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getLayers();\n
","position":{"start":{"line":133,"column":1,"offset":1934},"end":{"line":135,"column":4,"offset":1970}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return 图层数组 {Array}","position":{"start":{"line":137,"column":1,"offset":1972},"end":{"line":137,"column":21,"offset":1992}}}],"position":{"start":{"line":137,"column":1,"offset":1972},"end":{"line":137,"column":21,"offset":1992}}},{"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":1999},"end":{"line":140,"column":16,"offset":2010}}}],"position":{"start":{"line":140,"column":1,"offset":1995},"end":{"line":140,"column":16,"offset":2010}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取地图中心点","position":{"start":{"line":141,"column":1,"offset":2011},"end":{"line":141,"column":8,"offset":2018}}}],"position":{"start":{"line":141,"column":1,"offset":2011},"end":{"line":141,"column":8,"offset":2018}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getCenter();\n
","position":{"start":{"line":142,"column":1,"offset":2019},"end":{"line":144,"column":4,"offset":2054}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return {Lnglat} :地图中心点","position":{"start":{"line":146,"column":1,"offset":2056},"end":{"line":146,"column":23,"offset":2078}}}],"position":{"start":{"line":146,"column":1,"offset":2056},"end":{"line":146,"column":23,"offset":2078}}},{"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":2084},"end":{"line":148,"column":14,"offset":2093}}}],"position":{"start":{"line":148,"column":1,"offset":2080},"end":{"line":148,"column":14,"offset":2093}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取地图容器大小","position":{"start":{"line":149,"column":1,"offset":2094},"end":{"line":149,"column":9,"offset":2102}}}],"position":{"start":{"line":149,"column":1,"offset":2094},"end":{"line":149,"column":9,"offset":2102}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getSize();\n
","position":{"start":{"line":150,"column":1,"offset":2103},"end":{"line":152,"column":4,"offset":2136}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return { Object } 地图容器的 width,height","position":{"start":{"line":153,"column":1,"offset":2137},"end":{"line":153,"column":37,"offset":2173}}}],"position":{"start":{"line":153,"column":1,"offset":2137},"end":{"line":153,"column":37,"offset":2173}}},{"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":2179},"end":{"line":155,"column":15,"offset":2189}}}],"position":{"start":{"line":155,"column":1,"offset":2175},"end":{"line":155,"column":15,"offset":2189}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"获取地图俯仰角","position":{"start":{"line":156,"column":1,"offset":2190},"end":{"line":156,"column":8,"offset":2197}}}],"position":{"start":{"line":156,"column":1,"offset":2190},"end":{"line":156,"column":8,"offset":2197}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getPitch();\n
","position":{"start":{"line":157,"column":1,"offset":2198},"end":{"line":159,"column":4,"offset":2233}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return {number} pitch","position":{"start":{"line":161,"column":1,"offset":2235},"end":{"line":161,"column":22,"offset":2256}}}],"position":{"start":{"line":161,"column":1,"offset":2235},"end":{"line":161,"column":22,"offset":2256}}},{"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":2262},"end":{"line":163,"column":16,"offset":2273}}}],"position":{"start":{"line":163,"column":1,"offset":2258},"end":{"line":163,"column":16,"offset":2273}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图中心点坐标","position":{"start":{"line":164,"column":1,"offset":2274},"end":{"line":164,"column":10,"offset":2283}}}],"position":{"start":{"line":164,"column":1,"offset":2274},"end":{"line":164,"column":10,"offset":2283}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setCenter([lng, lat]);\n
","position":{"start":{"line":166,"column":1,"offset":2285},"end":{"line":168,"column":4,"offset":2329}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:","position":{"start":{"line":170,"column":1,"offset":2331},"end":{"line":170,"column":4,"offset":2334}}},{"type":"raw","value":"center","position":{"start":{"line":170,"column":4,"offset":2334},"end":{"line":170,"column":12,"offset":2342}}},{"type":"text","value":" {LngLat} 地图中心点","position":{"start":{"line":170,"column":12,"offset":2342},"end":{"line":170,"column":28,"offset":2358}}}],"position":{"start":{"line":170,"column":1,"offset":2331},"end":{"line":170,"column":28,"offset":2358}}},{"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":2365},"end":{"line":173,"column":21,"offset":2381}}}],"position":{"start":{"line":173,"column":1,"offset":2361},"end":{"line":173,"column":21,"offset":2381}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图等级和中心","position":{"start":{"line":174,"column":1,"offset":2382},"end":{"line":174,"column":10,"offset":2391}}}],"position":{"start":{"line":174,"column":1,"offset":2382},"end":{"line":174,"column":10,"offset":2391}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setZoomAndCenter(zoom, center);\n
","position":{"start":{"line":175,"column":1,"offset":2392},"end":{"line":177,"column":4,"offset":2445}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:zoom {number}","position":{"start":{"line":179,"column":1,"offset":2447},"end":{"line":179,"column":17,"offset":2463}}},{"type":"raw","value":"
","position":{"start":{"line":179,"column":17,"offset":2463},"end":{"line":179,"column":23,"offset":2469}}},{"type":"text","value":"center {LngLat}","position":{"start":{"line":179,"column":23,"offset":2469},"end":{"line":179,"column":38,"offset":2484}}}],"position":{"start":{"line":179,"column":1,"offset":2447},"end":{"line":179,"column":38,"offset":2484}}},{"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":2491},"end":{"line":182,"column":16,"offset":2502}}}],"position":{"start":{"line":182,"column":1,"offset":2487},"end":{"line":182,"column":16,"offset":2502}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图顺时针旋转角度,旋转原点为地图容器中心点,取值范围 ","position":{"start":{"line":183,"column":1,"offset":2503},"end":{"line":183,"column":31,"offset":2533}}},{"type":"text","value":"[0-360]","position":{"start":{"line":183,"column":32,"offset":2534},"end":{"line":183,"column":37,"offset":2539}}}],"position":{"start":{"line":183,"column":1,"offset":2503},"end":{"line":183,"column":38,"offset":2540}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setRotation(rotation);\n
","position":{"start":{"line":184,"column":1,"offset":2541},"end":{"line":186,"column":4,"offset":2586}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数: ","position":{"start":{"line":188,"column":1,"offset":2588},"end":{"line":188,"column":5,"offset":2592}}},{"type":"raw","value":"rotation","position":{"start":{"line":188,"column":5,"offset":2592},"end":{"line":188,"column":15,"offset":2602}}},{"type":"text","value":" {number}","position":{"start":{"line":188,"column":15,"offset":2602},"end":{"line":188,"column":26,"offset":2613}}}],"position":{"start":{"line":188,"column":1,"offset":2588},"end":{"line":188,"column":26,"offset":2613}}},{"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":2619},"end":{"line":190,"column":11,"offset":2625}}}],"position":{"start":{"line":190,"column":1,"offset":2615},"end":{"line":190,"column":11,"offset":2625}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图放大一级","position":{"start":{"line":191,"column":1,"offset":2626},"end":{"line":191,"column":7,"offset":2632}}}],"position":{"start":{"line":191,"column":1,"offset":2626},"end":{"line":191,"column":7,"offset":2632}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.zoomIn();\n
","position":{"start":{"line":192,"column":1,"offset":2633},"end":{"line":194,"column":4,"offset":2665}}},{"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":2671},"end":{"line":196,"column":12,"offset":2678}}}],"position":{"start":{"line":196,"column":1,"offset":2667},"end":{"line":196,"column":12,"offset":2678}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图缩小一级","position":{"start":{"line":197,"column":1,"offset":2679},"end":{"line":197,"column":7,"offset":2685}}}],"position":{"start":{"line":197,"column":1,"offset":2679},"end":{"line":197,"column":7,"offset":2685}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.ZoomOUt();\n
","position":{"start":{"line":198,"column":1,"offset":2686},"end":{"line":200,"column":4,"offset":2719}}},{"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":2725},"end":{"line":202,"column":10,"offset":2730}}}],"position":{"start":{"line":202,"column":1,"offset":2721},"end":{"line":202,"column":10,"offset":2730}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图平移到指定的位置","position":{"start":{"line":203,"column":1,"offset":2731},"end":{"line":203,"column":11,"offset":2741}}}],"position":{"start":{"line":203,"column":1,"offset":2731},"end":{"line":203,"column":11,"offset":2741}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.panTo(LngLat);\n
","position":{"start":{"line":204,"column":1,"offset":2742},"end":{"line":206,"column":4,"offset":2779}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:","position":{"start":{"line":208,"column":1,"offset":2781},"end":{"line":208,"column":4,"offset":2784}}},{"type":"raw","value":"center","position":{"start":{"line":208,"column":4,"offset":2784},"end":{"line":208,"column":12,"offset":2792}}},{"type":"text","value":" LngLat 中心位置坐标","position":{"start":{"line":208,"column":12,"offset":2792},"end":{"line":208,"column":27,"offset":2807}}}],"position":{"start":{"line":208,"column":1,"offset":2781},"end":{"line":208,"column":27,"offset":2807}}},{"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":2813},"end":{"line":210,"column":10,"offset":2818}}}],"position":{"start":{"line":210,"column":1,"offset":2809},"end":{"line":210,"column":10,"offset":2818}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"以像素为单位沿X方向和Y方向移动地图","position":{"start":{"line":211,"column":1,"offset":2819},"end":{"line":211,"column":19,"offset":2837}}}],"position":{"start":{"line":211,"column":1,"offset":2819},"end":{"line":211,"column":19,"offset":2837}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.panBy(x, y);\n
","position":{"start":{"line":212,"column":1,"offset":2838},"end":{"line":214,"column":4,"offset":2872}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数:","position":{"start":{"line":215,"column":1,"offset":2873},"end":{"line":215,"column":4,"offset":2876}}},{"type":"raw","value":"
","position":{"start":{"line":215,"column":4,"offset":2876},"end":{"line":215,"column":10,"offset":2882}}},{"type":"raw","value":"x","position":{"start":{"line":215,"column":10,"offset":2882},"end":{"line":215,"column":13,"offset":2885}}},{"type":"text","value":" {number} 水平方向移动像素 向右为正方向","position":{"start":{"line":215,"column":13,"offset":2885},"end":{"line":215,"column":38,"offset":2910}}},{"type":"raw","value":"
","position":{"start":{"line":215,"column":38,"offset":2910},"end":{"line":215,"column":44,"offset":2916}}},{"type":"text","value":"      ","position":{"start":{"line":215,"column":44,"offset":2916},"end":{"line":215,"column":50,"offset":2922}}},{"type":"raw","value":"y","position":{"start":{"line":215,"column":50,"offset":2922},"end":{"line":215,"column":53,"offset":2925}}},{"type":"text","value":" {number} 垂直方向移动像素 向下为正方向","position":{"start":{"line":215,"column":53,"offset":2925},"end":{"line":215,"column":79,"offset":2951}}}],"position":{"start":{"line":215,"column":1,"offset":2873},"end":{"line":215,"column":79,"offset":2951}}},{"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":2958},"end":{"line":218,"column":13,"offset":2966}}}],"position":{"start":{"line":218,"column":1,"offset":2954},"end":{"line":218,"column":13,"offset":2966}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置地图仰俯角度","position":{"start":{"line":219,"column":1,"offset":2967},"end":{"line":219,"column":9,"offset":2975}}}],"position":{"start":{"line":219,"column":1,"offset":2967},"end":{"line":219,"column":9,"offset":2975}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.setPitch(pitch);\n
","position":{"start":{"line":220,"column":1,"offset":2976},"end":{"line":222,"column":4,"offset":3015}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数 :","position":{"start":{"line":224,"column":1,"offset":3017},"end":{"line":224,"column":5,"offset":3021}}},{"type":"raw","value":"
","position":{"start":{"line":224,"column":5,"offset":3021},"end":{"line":224,"column":11,"offset":3027}}},{"type":"text","value":"   ","position":{"start":{"line":224,"column":11,"offset":3027},"end":{"line":224,"column":14,"offset":3030}}},{"type":"raw","value":"pitch","position":{"start":{"line":224,"column":14,"offset":3030},"end":{"line":224,"column":21,"offset":3037}}},{"type":"text","value":" {number}","position":{"start":{"line":224,"column":21,"offset":3037},"end":{"line":224,"column":31,"offset":3047}}}],"position":{"start":{"line":224,"column":1,"offset":3017},"end":{"line":224,"column":31,"offset":3047}}},{"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":3049},"end":{"line":226,"column":5,"offset":3053}}},{"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":3059},"end":{"line":228,"column":14,"offset":3068}}}],"position":{"start":{"line":228,"column":1,"offset":3055},"end":{"line":228,"column":14,"offset":3068}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"设置当前地图显示状态,包括是否可鼠标拖拽移动地图、地图是否可缩放、地图是否可旋转(rotateEnable)、是否可双击放大地图、是否可以通过键盘控制地图旋转(keyboardEnable)等   ","position":{"start":{"line":229,"column":1,"offset":3069},"end":{"line":229,"column":100,"offset":3168}}}],"position":{"start":{"line":229,"column":1,"offset":3069},"end":{"line":229,"column":100,"offset":3168}}},{"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":3170},"end":{"line":239,"column":4,"offset":3347}}},{"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":3354},"end":{"line":242,"column":14,"offset":3363}}}],"position":{"start":{"line":242,"column":1,"offset":3350},"end":{"line":242,"column":14,"offset":3363}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"地图缩放到某个范围内","position":{"start":{"line":243,"column":1,"offset":3364},"end":{"line":243,"column":11,"offset":3374}}},{"type":"raw","value":"
","position":{"start":{"line":243,"column":11,"offset":3374},"end":{"line":243,"column":17,"offset":3380}}},{"type":"text","value":"参数 :","position":{"start":{"line":243,"column":17,"offset":3380},"end":{"line":243,"column":21,"offset":3384}}},{"type":"raw","value":"
","position":{"start":{"line":243,"column":21,"offset":3384},"end":{"line":243,"column":27,"offset":3390}}},{"type":"text","value":"  ","position":{"start":{"line":243,"column":27,"offset":3390},"end":{"line":243,"column":29,"offset":3392}}},{"type":"raw","value":"extent","position":{"start":{"line":243,"column":29,"offset":3392},"end":{"line":243,"column":37,"offset":3400}}},{"type":"text","value":" { array} 经纬度范围 ","position":{"start":{"line":243,"column":37,"offset":3400},"end":{"line":243,"column":53,"offset":3416}}},{"type":"text","value":"[minlng,minlat,maxlng,maxlat]","position":{"start":{"line":243,"column":54,"offset":3417},"end":{"line":243,"column":81,"offset":3444}}}],"position":{"start":{"line":243,"column":1,"offset":3364},"end":{"line":243,"column":82,"offset":3445}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.fitBounds([112, 32, 114, 35]);\n
","position":{"start":{"line":245,"column":1,"offset":3447},"end":{"line":247,"column":4,"offset":3498}}},{"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":3506},"end":{"line":251,"column":16,"offset":3517}}}],"position":{"start":{"line":251,"column":1,"offset":3502},"end":{"line":251,"column":16,"offset":3517}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除layer","position":{"start":{"line":252,"column":1,"offset":3518},"end":{"line":252,"column":8,"offset":3525}}}],"position":{"start":{"line":252,"column":1,"offset":3518},"end":{"line":252,"column":8,"offset":3525}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.removeLayer(layer);\n
","position":{"start":{"line":254,"column":1,"offset":3527},"end":{"line":256,"column":4,"offset":3569}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"参数","position":{"start":{"line":258,"column":1,"offset":3571},"end":{"line":258,"column":3,"offset":3573}}},{"type":"raw","value":"
","position":{"start":{"line":258,"column":3,"offset":3573},"end":{"line":258,"column":9,"offset":3579}}},{"type":"raw","value":"layer","position":{"start":{"line":258,"column":9,"offset":3579},"end":{"line":258,"column":16,"offset":3586}}},{"type":"text","value":" {Layer}","position":{"start":{"line":258,"column":16,"offset":3586},"end":{"line":258,"column":25,"offset":3595}}}],"position":{"start":{"line":258,"column":1,"offset":3571},"end":{"line":258,"column":25,"offset":3595}}},{"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":3601},"end":{"line":260,"column":14,"offset":3610}}}],"position":{"start":{"line":260,"column":1,"offset":3597},"end":{"line":260,"column":14,"offset":3610}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":" 获取所有的layer","position":{"start":{"line":261,"column":1,"offset":3611},"end":{"line":261,"column":12,"offset":3622}}}],"position":{"start":{"line":261,"column":1,"offset":3611},"end":{"line":261,"column":12,"offset":3622}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.getLayers();\n
","position":{"start":{"line":263,"column":1,"offset":3624},"end":{"line":265,"column":4,"offset":3659}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"return layers  {array}","position":{"start":{"line":267,"column":1,"offset":3661},"end":{"line":267,"column":24,"offset":3684}}}],"position":{"start":{"line":267,"column":1,"offset":3661},"end":{"line":267,"column":24,"offset":3684}}},{"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":3689},"end":{"line":269,"column":6,"offset":3691}}}],"position":{"start":{"line":269,"column":1,"offset":3686},"end":{"line":269,"column":6,"offset":3691}}},{"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":3698},"end":{"line":272,"column":7,"offset":3700}}}],"position":{"start":{"line":272,"column":1,"offset":3694},"end":{"line":272,"column":7,"offset":3700}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"事件监听","position":{"start":{"line":273,"column":1,"offset":3701},"end":{"line":273,"column":5,"offset":3705}}}],"position":{"start":{"line":273,"column":1,"offset":3701},"end":{"line":273,"column":5,"offset":3705}}},{"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":3712},"end":{"line":275,"column":8,"offset":3714}}}],"position":{"start":{"line":275,"column":1,"offset":3707},"end":{"line":275,"column":8,"offset":3714}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"raw","value":"eventName","position":{"start":{"line":276,"column":1,"offset":3715},"end":{"line":276,"column":12,"offset":3726}}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":276,"column":12,"offset":3726},"end":{"line":276,"column":26,"offset":3740}}},{"type":"raw","value":"
","position":{"start":{"line":276,"column":26,"offset":3740},"end":{"line":276,"column":32,"offset":3746}}},{"type":"raw","value":"hander","position":{"start":{"line":276,"column":32,"offset":3746},"end":{"line":276,"column":40,"offset":3754}}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":276,"column":40,"offset":3754},"end":{"line":276,"column":60,"offset":3774}}}],"position":{"start":{"line":276,"column":1,"offset":3715},"end":{"line":276,"column":60,"offset":3774}}},{"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":3781},"end":{"line":279,"column":8,"offset":3784}}}],"position":{"start":{"line":279,"column":1,"offset":3777},"end":{"line":279,"column":8,"offset":3784}}},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"移除事件监听","position":{"start":{"line":280,"column":1,"offset":3785},"end":{"line":280,"column":7,"offset":3791}}},{"type":"raw","value":"
","position":{"start":{"line":280,"column":7,"offset":3791},"end":{"line":280,"column":13,"offset":3797}}},{"type":"raw","value":"eventName","position":{"start":{"line":280,"column":13,"offset":3797},"end":{"line":280,"column":24,"offset":3808}}},{"type":"text","value":" {string} 事件名","position":{"start":{"line":280,"column":24,"offset":3808},"end":{"line":280,"column":38,"offset":3822}}},{"type":"raw","value":"
","position":{"start":{"line":280,"column":38,"offset":3822},"end":{"line":280,"column":44,"offset":3828}}},{"type":"raw","value":"hander","position":{"start":{"line":280,"column":44,"offset":3828},"end":{"line":280,"column":52,"offset":3836}}},{"type":"text","value":" {function } 事件回调函数","position":{"start":{"line":280,"column":52,"offset":3836},"end":{"line":280,"column":72,"offset":3856}}}],"position":{"start":{"line":280,"column":1,"offset":3785},"end":{"line":280,"column":72,"offset":3856}}},{"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":3863},"end":{"line":283,"column":9,"offset":3867}}}],"position":{"start":{"line":283,"column":1,"offset":3859},"end":{"line":283,"column":9,"offset":3867}}},{"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":3868},"end":{"line":292,"column":4,"offset":4205}}},{"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":4212},"end":{"line":295,"column":9,"offset":4216}}}],"position":{"start":{"line":295,"column":1,"offset":4208},"end":{"line":295,"column":9,"offset":4216}}},{"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":4218},"end":{"line":310,"column":4,"offset":4925}}},{"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":4931},"end":{"line":312,"column":9,"offset":4935}}}],"position":{"start":{"line":312,"column":1,"offset":4927},"end":{"line":312,"column":9,"offset":4935}}},{"type":"text","value":"\n"},{"type":"raw","value":"
scene.on('resize', () => {}); // 地图容器大小改变事件\n
","position":{"start":{"line":313,"column":1,"offset":4936},"end":{"line":315,"column":4,"offset":4993}}}],"position":{"start":{"line":1,"column":1,"offset":0},"end":{"line":318,"column":1,"offset":4996}}}} \ 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..1542a33dd0 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b0407a444ef8acb3f4819a2fd00c5ae3.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..9c4db4fc2f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b089023713dde4294665d832c48ccd63.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-b196fbb424293a9c110515c8e22586c7.json b/.cache/caches/gatsby-transformer-remark/diskstore-b196fbb424293a9c110515c8e22586c7.json new file mode 100644 index 0000000000..b2f5f677a9 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b196fbb424293a9c110515c8e22586c7.json @@ -0,0 +1 @@ +{"expireTime":9007200828128384000,"key":"transformer-remark-markdown-html-e0eda26454f7aaeda47989e111060318-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-b196fbb424293a9c110515c8e22586c7.lock.STALE b/.cache/caches/gatsby-transformer-remark/diskstore-b196fbb424293a9c110515c8e22586c7.lock.STALE new file mode 100644 index 0000000000..e69de29bb2 diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-b1b5e0d9876730d4959b263d0d42828a.json b/.cache/caches/gatsby-transformer-remark/diskstore-b1b5e0d9876730d4959b263d0d42828a.json new file mode 100644 index 0000000000..797ec984c3 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b1b5e0d9876730d4959b263d0d42828a.json @@ -0,0 +1 @@ +{"expireTime":9007200827958508000,"key":"transformer-remark-markdown-html-a1d219db4ea61081778ff63395ff3e91-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-b7df9406be8c4ec4d4cc6d6850b2bee1.json b/.cache/caches/gatsby-transformer-remark/diskstore-b7df9406be8c4ec4d4cc6d6850b2bee1.json new file mode 100644 index 0000000000..3657915b2d --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b7df9406be8c4ec4d4cc6d6850b2bee1.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-ast-51cffb57f20c685f94203902c79f04c6-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":3,"column":1,"offset":2}}}} \ No newline at end of file diff --git a/.cache/caches/gatsby-transformer-remark/diskstore-b87fe1434166fa5d7b0fdf27b13495ca.json b/.cache/caches/gatsby-transformer-remark/diskstore-b87fe1434166fa5d7b0fdf27b13495ca.json new file mode 100644 index 0000000000..b94da0283d --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b87fe1434166fa5d7b0fdf27b13495ca.json @@ -0,0 +1 @@ +{"expireTime":9007200827958197000,"key":"transformer-remark-markdown-html-ast-6e9c5aea4f7ea7c85d806fb35a09a394-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-b923ecb39dc7dd6f4752bf9bbf5c94da.json b/.cache/caches/gatsby-transformer-remark/diskstore-b923ecb39dc7dd6f4752bf9bbf5c94da.json new file mode 100644 index 0000000000..5034376365 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-b923ecb39dc7dd6f4752bf9bbf5c94da.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-bed602677090371493b02b2541d3b187.json b/.cache/caches/gatsby-transformer-remark/diskstore-bed602677090371493b02b2541d3b187.json new file mode 100644 index 0000000000..a151ae916f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-bed602677090371493b02b2541d3b187.json @@ -0,0 +1 @@ +{"expireTime":9007200828128391000,"key":"transformer-remark-markdown-html-51cffb57f20c685f94203902c79f04c6-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-bee012580db1a2e5f57e03421caf971f.json b/.cache/caches/gatsby-transformer-remark/diskstore-bee012580db1a2e5f57e03421caf971f.json new file mode 100644 index 0000000000..ecff474429 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-bee012580db1a2e5f57e03421caf971f.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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-bfa695e84c9fbd040b43c6cebb35a0a8.json b/.cache/caches/gatsby-transformer-remark/diskstore-bfa695e84c9fbd040b43c6cebb35a0a8.json new file mode 100644 index 0000000000..85e22c9c4f --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-bfa695e84c9fbd040b43c6cebb35a0a8.json @@ -0,0 +1 @@ +{"expireTime":9007200828128391000,"key":"transformer-remark-markdown-html-94a83b1b7402a40717e5c1b92c85015a-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-c8fad00cb084cbc8999fbb860f29832b.json b/.cache/caches/gatsby-transformer-remark/diskstore-c8fad00cb084cbc8999fbb860f29832b.json new file mode 100644 index 0000000000..9d0096ce36 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-c8fad00cb084cbc8999fbb860f29832b.json @@ -0,0 +1 @@ +{"expireTime":9007200827957881000,"key":"transformer-remark-markdown-html-b203d64bdde854a7c4141aaf3bd814db-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

构造函数

\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/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json b/.cache/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json new file mode 100644 index 0000000000..4ff0b04814 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ca2fb97dfd9c7f243ca223efc08ffba5.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-cafc1d44d78b4d5d1eeed021967c1780.json b/.cache/caches/gatsby-transformer-remark/diskstore-cafc1d44d78b4d5d1eeed021967c1780.json new file mode 100644 index 0000000000..692a9a8d92 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-cafc1d44d78b4d5d1eeed021967c1780.json @@ -0,0 +1 @@ +{"expireTime":9007200828058192000,"key":"transformer-remark-markdown-html-46d92e293407aa2f9b2f1b0b9fc86991-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-d229c256337a024e6b0fdc8384b0e43f.json b/.cache/caches/gatsby-transformer-remark/diskstore-d229c256337a024e6b0fdc8384b0e43f.json new file mode 100644 index 0000000000..994a817613 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-d229c256337a024e6b0fdc8384b0e43f.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-ast-30a51869612bca077eda87f35f662bad-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-d2b3f82b0a8e66040aa810a8958afe0d.json b/.cache/caches/gatsby-transformer-remark/diskstore-d2b3f82b0a8e66040aa810a8958afe0d.json new file mode 100644 index 0000000000..12a9415adb --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-d2b3f82b0a8e66040aa810a8958afe0d.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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..8d3ddf7016 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-dc1901f7f1baf243df1556f52717b2ba.json @@ -0,0 +1 @@ +{"expireTime":9007200828128384000,"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-dcad9b2243b3882cf312517a41b078c4.json b/.cache/caches/gatsby-transformer-remark/diskstore-dcad9b2243b3882cf312517a41b078c4.json new file mode 100644 index 0000000000..b90694af2d --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-dcad9b2243b3882cf312517a41b078c4.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-html-ast-94a83b1b7402a40717e5c1b92c85015a-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-ddc1db31dfe2bcb6d2040bce323f5828.json b/.cache/caches/gatsby-transformer-remark/diskstore-ddc1db31dfe2bcb6d2040bce323f5828.json new file mode 100644 index 0000000000..92dbdb88cd --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ddc1db31dfe2bcb6d2040bce323f5828.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"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-ee3ebf12b33fbdab54fcd9cf8c05164d.json b/.cache/caches/gatsby-transformer-remark/diskstore-ee3ebf12b33fbdab54fcd9cf8c05164d.json new file mode 100644 index 0000000000..356a54cf31 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-ee3ebf12b33fbdab54fcd9cf8c05164d.json @@ -0,0 +1 @@ +{"expireTime":9007200827958508000,"key":"transformer-remark-markdown-ast-a1d219db4ea61081778ff63395ff3e91-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-f985d7004910f1f75504b918d598a379.json b/.cache/caches/gatsby-transformer-remark/diskstore-f985d7004910f1f75504b918d598a379.json new file mode 100644 index 0000000000..09631d2220 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-f985d7004910f1f75504b918d598a379.json @@ -0,0 +1 @@ +{"expireTime":9007200827958197000,"key":"transformer-remark-markdown-ast-6e9c5aea4f7ea7c85d806fb35a09a394-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-fbddf0de549e59cfa8bf242898a85984.json b/.cache/caches/gatsby-transformer-remark/diskstore-fbddf0de549e59cfa8bf242898a85984.json new file mode 100644 index 0000000000..bcf07317d4 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fbddf0de549e59cfa8bf242898a85984.json @@ -0,0 +1 @@ +{"expireTime":9007200828128385000,"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-fd880f1d7896439a1f4085b003961e52.json b/.cache/caches/gatsby-transformer-remark/diskstore-fd880f1d7896439a1f4085b003961e52.json new file mode 100644 index 0000000000..5f0c7d3bc8 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fd880f1d7896439a1f4085b003961e52.json @@ -0,0 +1 @@ +{"expireTime":9007200827957780000,"key":"transformer-remark-markdown-ast-b627c832a1f77c6bd67b3f67116e04eb-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-fed5770f608dd2a2a26b956dd6c5ab02.json b/.cache/caches/gatsby-transformer-remark/diskstore-fed5770f608dd2a2a26b956dd6c5ab02.json new file mode 100644 index 0000000000..47673e2416 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fed5770f608dd2a2a26b956dd6c5ab02.json @@ -0,0 +1 @@ +{"expireTime":9007200828058199000,"key":"transformer-remark-markdown-html-ast-0b8b19ff19f6a64f7b2cae67200ccd88-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-fffb15ec8285c18963c880046e7fccce.json b/.cache/caches/gatsby-transformer-remark/diskstore-fffb15ec8285c18963c880046e7fccce.json new file mode 100644 index 0000000000..4a47fb5c07 --- /dev/null +++ b/.cache/caches/gatsby-transformer-remark/diskstore-fffb15ec8285c18963c880046e7fccce.json @@ -0,0 +1 @@ +{"expireTime":9007200827957779000,"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 \ No newline at end of file diff --git a/packages/component/src/images/logo.png b/packages/component/src/images/logo.png new file mode 100644 index 0000000000..7599f280a0 Binary files /dev/null and b/packages/component/src/images/logo.png differ diff --git a/packages/component/src/index.ts b/packages/component/src/index.ts index b31d6fbd0b..21eaa07aae 100644 --- a/packages/component/src/index.ts +++ b/packages/component/src/index.ts @@ -1,6 +1,9 @@ import Control from './control/BaseControl'; +import Layers from './control/layer'; +import Logo from './control/logo'; import Scale from './control/scale'; import Zoom from './control/zoom'; import Marker from './marker'; import Popup from './popup'; -export { Control, Scale, Zoom, Marker, Popup }; + +export { Control, Logo, Scale, Zoom, Layers, Marker, Popup }; diff --git a/packages/core/src/inversify.config.ts b/packages/core/src/inversify.config.ts index 71f4a8980f..be2e81e98d 100644 --- a/packages/core/src/inversify.config.ts +++ b/packages/core/src/inversify.config.ts @@ -53,7 +53,7 @@ const container = new Container(); container .bind(TYPES.ISceneService) .to(SceneService) - .inSingletonScope(); + .inTransientScope(); container .bind(TYPES.IGlobalConfigService) .to(GlobalConfigService) @@ -100,7 +100,7 @@ container // @see https://github.com/inversify/InversifyJS/blob/master/wiki/inheritance.md#what-can-i-do-when-my-base-class-is-provided-by-a-third-party-module decorate(injectable(), EventEmitter); - +container.bind(TYPES.IEventEmitter).to(EventEmitter); // 支持 L7 使用 new 而非容器实例化的场景,同时禁止 lazyInject cache // @see https://github.com/inversify/inversify-inject-decorators#caching-vs-non-caching-behaviour const DECORATORS = getDecorators(container, false); diff --git a/packages/core/src/services/asset/FontService.ts b/packages/core/src/services/asset/FontService.ts index 045e5787af..656fffc5e2 100644 --- a/packages/core/src/services/asset/FontService.ts +++ b/packages/core/src/services/asset/FontService.ts @@ -64,6 +64,7 @@ export default class FontService implements IFontService { private key: string; private cache: LRUCache = new LRUCache(CACHE_LIMIT); public init() { + this.cache.clear(); this.fontOptions = { fontFamily: DEFAULT_FONT_FAMILY, fontWeight: DEFAULT_FONT_WEIGHT, diff --git a/packages/core/src/services/asset/IIconService.ts b/packages/core/src/services/asset/IIconService.ts index 5327519aa4..f71632015f 100644 --- a/packages/core/src/services/asset/IIconService.ts +++ b/packages/core/src/services/asset/IIconService.ts @@ -5,11 +5,11 @@ export type Listener = (...args: any[]) => void; export interface IIconValue { x: number; y: number; - image: HTMLImageElement; + image?: HTMLImageElement; } export interface IIcon { id: string; - image: HTMLImageElement; + image?: HTMLImageElement; height: number; width: number; } diff --git a/packages/core/src/services/asset/IconService.ts b/packages/core/src/services/asset/IconService.ts index f165bfeee2..2b593388a8 100644 --- a/packages/core/src/services/asset/IconService.ts +++ b/packages/core/src/services/asset/IconService.ts @@ -33,15 +33,26 @@ export default class IconService extends EventEmitter implements IIconService { if (this.hasImage(id)) { throw new Error('Image Id already exists'); } - + this.iconData.push({ + id, + width: imageSize, + height: imageSize, + }); + this.updateIconMap(); this.loadImage(image).then((img) => { imagedata = img as HTMLImageElement; - this.iconData.push({ - id, - image: imagedata, - width: imageSize, - height: imageSize, + const iconImage = this.iconData.find((icon: IIcon) => { + return icon.id === id; }); + if (iconImage) { + iconImage.image = imagedata; + } + // this.iconData.push({ + // id, + // image: imagedata, + // width: imageSize, + // height: imageSize, + // }); this.update(); }); } @@ -86,7 +97,9 @@ export default class IconService extends EventEmitter implements IIconService { this.canvas.height = this.canvasHeight; Object.keys(this.iconMap).forEach((item: string) => { const { x, y, image } = this.iconMap[item]; - this.ctx.drawImage(image, x, y, imageSize, imageSize); + if (image) { + this.ctx.drawImage(image, x, y, imageSize, imageSize); + } }); } diff --git a/packages/core/src/services/component/ControlService.ts b/packages/core/src/services/component/ControlService.ts index 6775b1fb06..f2024d4fe4 100644 --- a/packages/core/src/services/component/ControlService.ts +++ b/packages/core/src/services/component/ControlService.ts @@ -15,6 +15,7 @@ export default class ControlService implements IControlService { public controlContainer: HTMLElement; private controls: IControl[] = []; public init(cfg: IControlServiceCfg) { + this.destroy(); this.container = cfg.container; this.initControlPos(); } @@ -23,7 +24,6 @@ export default class ControlService implements IControlService { ctr.addTo(mapService); // scene对象 this.controls.push(ctr); } - public removeControl(ctr: IControl): this { const index = this.controls.indexOf(ctr); if (index > -1) { @@ -68,7 +68,9 @@ export default class ControlService implements IControlService { DOM.remove(this.controlCorners[i]); } } - DOM.remove(this.controlContainer); + if (this.controlContainer) { + DOM.remove(this.controlContainer); + } delete this.controlCorners; delete this.controlContainer; } diff --git a/packages/core/src/services/interaction/InteractionService.ts b/packages/core/src/services/interaction/InteractionService.ts index e1860a3297..b4a8d064b2 100644 --- a/packages/core/src/services/interaction/InteractionService.ts +++ b/packages/core/src/services/interaction/InteractionService.ts @@ -23,6 +23,7 @@ export default class InteractionService extends EventEmitter public init() { // 注册事件在地图底图上 + this.clear(); this.addEventListenerOnMap(); } @@ -68,4 +69,11 @@ export default class InteractionService extends EventEmitter private onHover = ({ x, y }: MouseEvent) => { this.emit(InteractionEvent.Hover, { x, y }); }; + private clear() { + if (this.hammertime) { + this.hammertime.destroy(); + } + this.removeEventListenerOnMap(); + this.off(InteractionEvent.Hover); + } } diff --git a/packages/core/src/services/layer/ILayerService.ts b/packages/core/src/services/layer/ILayerService.ts index ff8462936a..40da3c56fc 100644 --- a/packages/core/src/services/layer/ILayerService.ts +++ b/packages/core/src/services/layer/ILayerService.ts @@ -6,6 +6,7 @@ import { ISource, ISourceCFG } from '../source/ISourceService'; import { IEncodeFeature, IScale, + IScaleOptions, IStyleAttributeService, StyleAttrField, StyleAttributeOption, @@ -32,8 +33,10 @@ export interface IPickedFeature { export interface ILayer { id: string; // 一个场景中同一类型 Layer 可能存在多个 name: string; // 代表 Layer 的类型 - // visible: boolean; - // zIndex: number; + visible: boolean; + zIndex: number; + minZoom: number; + maxZoom: number; configService: IGlobalConfigService; plugins: ILayerPlugin[]; hooks: { @@ -62,8 +65,12 @@ export interface ILayer { // filter(field: string, value: StyleAttributeOption): ILayer; // active(option: ActiveOption): ILayer; style(options: unknown): ILayer; - // hide(): ILayer; - // show(): ILayer; + hide(): ILayer; + show(): ILayer; + setIndex(index: number): ILayer; + isVisible(): boolean; + setMaxZoom(min: number): ILayer; + setMinZoom(max: number): ILayer; // animate(field: string, option: any): ILayer; render(): ILayer; destroy(): void; @@ -74,6 +81,13 @@ export interface ILayer { setEncodedData(encodedData: IEncodeFeature[]): void; getEncodedData(): IEncodeFeature[]; getStyleOptions(): Partial; + getScaleOptions(): IScaleOptions; + /** + * 事件 + */ + on(type: string, hander: (...args: any[]) => void): void; + off(type: string, hander: (...args: any[]) => void): void; + once(type: string, hander: (...args: any[]) => void): void; /** * JSON Schema 用于校验配置项 */ @@ -96,6 +110,10 @@ export interface ILayerPlugin { * Layer 初始化参数 */ export interface ILayerInitializationOptions { + minZoom: number; + maxZoom: number; + visible: boolean; + zIndex: number; enableMultiPassRenderer: boolean; passes: Array; @@ -129,6 +147,10 @@ export interface ILayerInitializationOptions { export interface ILayerService { add(layer: ILayer): void; initLayers(): void; + getLayers(): ILayer[]; + getLayer(name: string): ILayer | undefined; + remove(layer: ILayer): void; + updateRenderOrder(): void; renderLayers(): void; destroy(): void; } diff --git a/packages/core/src/services/layer/IStyleAttributeService.ts b/packages/core/src/services/layer/IStyleAttributeService.ts index 03f8b69533..410fd946ee 100644 --- a/packages/core/src/services/layer/IStyleAttributeService.ts +++ b/packages/core/src/services/layer/IStyleAttributeService.ts @@ -46,6 +46,9 @@ export interface IScaleOption { format?: () => any; domain?: any[]; } +export interface IScaleOptions { + [key: string]: IScale; +} export interface IStyleScale { scale: any; field: string; diff --git a/packages/core/src/services/layer/LayerService.ts b/packages/core/src/services/layer/LayerService.ts index aa83486282..c3bc886389 100644 --- a/packages/core/src/services/layer/LayerService.ts +++ b/packages/core/src/services/layer/LayerService.ts @@ -17,6 +17,10 @@ export default class LayerService implements ILayerService { public add(layer: ILayer) { this.layers.push(layer); + this.initPlugin(layer); + layer.init(); + // 添加完成需要触发重绘 + // this.renderLayers(); } public initLayers() { @@ -29,10 +33,29 @@ export default class LayerService implements ILayerService { }); } + public getLayers(): ILayer[] { + return this.layers; + } + + public getLayer(id: string): ILayer | undefined { + return this.layers.find((layer) => layer.id === id); + } + + public remove(layer: ILayer): void { + const layerIndex = this.layers.indexOf(layer); + if (layerIndex > -1) { + this.layers.splice(layerIndex, 1); + } + layer.destroy(); + this.renderLayers(); + } + public renderLayers() { // TODO:脏检查,只渲染发生改变的 Layer + // + this.clear(); this.layers - // .filter((layer) => layer.isDirty()) + .filter((layer) => layer.isVisible()) .forEach((layer) => { // trigger hooks layer.hooks.beforeRender.call(); @@ -41,8 +64,27 @@ export default class LayerService implements ILayerService { }); } + public updateRenderOrder() { + this.layers.sort((pre: ILayer, next: ILayer) => { + return pre.zIndex - next.zIndex; + }); + this.renderLayers(); + } + public destroy() { this.layers.forEach((layer) => layer.destroy()); this.layers = []; } + private initPlugin(layer: ILayer) { + for (const plugin of layer.plugins) { + plugin.apply(layer); + } + } + private clear() { + this.renderService.clear({ + color: [0, 0, 0, 0], + depth: 1, + framebuffer: null, + }); + } } diff --git a/packages/core/src/services/log/LogService.ts b/packages/core/src/services/log/LogService.ts index 179e50d735..92c739bc20 100644 --- a/packages/core/src/services/log/LogService.ts +++ b/packages/core/src/services/log/LogService.ts @@ -2,7 +2,7 @@ import { injectable } from 'inversify'; import { Log } from 'probe.gl'; import { ILogService } from './ILogService'; -const Logger = new Log({ id: 'L7' }).enable(); +const Logger = new Log({ id: 'L7' }).enable(false); @injectable() export default class LogService implements ILogService { diff --git a/packages/core/src/services/map/IMapService.ts b/packages/core/src/services/map/IMapService.ts index de2998f0d0..ad374006a6 100644 --- a/packages/core/src/services/map/IMapService.ts +++ b/packages/core/src/services/map/IMapService.ts @@ -22,6 +22,7 @@ export interface IMapService { on(type: string, hander: (...args: any[]) => void): void; off(type: string, hander: (...args: any[]) => void): void; + once(type: string, hander: (...args: any[]) => void): void; // get dom getContainer(): HTMLElement | null; getSize(): [number, number]; @@ -59,6 +60,8 @@ export enum MapType { mapbox = 'mapbox', } +export const MapServiceEvent = ['mapload']; + /** * 地图初始化配置项 */ diff --git a/packages/core/src/services/renderer/IModel.ts b/packages/core/src/services/renderer/IModel.ts index 7441227450..280491fc2d 100644 --- a/packages/core/src/services/renderer/IModel.ts +++ b/packages/core/src/services/renderer/IModel.ts @@ -54,6 +54,8 @@ export interface IModelInitializationOptions { */ instances?: number; + colorMask?: [boolean, boolean, boolean, boolean]; + /** * depth buffer */ diff --git a/packages/core/src/services/renderer/passes/BasePostProcessingPass.ts b/packages/core/src/services/renderer/passes/BasePostProcessingPass.ts index 785f7e82f5..52bcb3eda8 100644 --- a/packages/core/src/services/renderer/passes/BasePostProcessingPass.ts +++ b/packages/core/src/services/renderer/passes/BasePostProcessingPass.ts @@ -87,7 +87,6 @@ export default class BasePostProcessingPass const postProcessor = layer.multiPassRenderer.getPostProcessor(); const { useFramebuffer, getViewportSize } = this.rendererService; const { width, height } = getViewportSize(); - useFramebuffer( this.renderToScreen ? null : postProcessor.getWriteFBO(), () => { diff --git a/packages/core/src/services/renderer/passes/PixelPickingPass.ts b/packages/core/src/services/renderer/passes/PixelPickingPass.ts index 415c65e058..dd5f9f22da 100644 --- a/packages/core/src/services/renderer/passes/PixelPickingPass.ts +++ b/packages/core/src/services/renderer/passes/PixelPickingPass.ts @@ -97,7 +97,7 @@ export default class PixelPickingPass implements IPa depth: 1, }); - this.logger.info(`picking fbo cleared ${width} ${height}`); + // this.logger.info(`picking fbo cleared ${width} ${height}`); /** * picking pass 不需要 multipass,原因如下: diff --git a/packages/core/src/services/renderer/passes/PostProcessor.ts b/packages/core/src/services/renderer/passes/PostProcessor.ts index ba65064f79..f76437f3e5 100644 --- a/packages/core/src/services/renderer/passes/PostProcessor.ts +++ b/packages/core/src/services/renderer/passes/PostProcessor.ts @@ -52,7 +52,6 @@ export default class PostProcessor implements IPostProcessor { public async render(layer: ILayer) { for (let i = 0; i < this.passes.length; i++) { const pass = this.passes[i]; - // last pass should render to screen pass.setRenderToScreen(this.isLastEnabledPass(i)); await pass.render(layer); diff --git a/packages/core/src/services/renderer/passes/TAAPass.ts b/packages/core/src/services/renderer/passes/TAAPass.ts index 7dd63fbedb..0a33a02a49 100644 --- a/packages/core/src/services/renderer/passes/TAAPass.ts +++ b/packages/core/src/services/renderer/passes/TAAPass.ts @@ -232,7 +232,7 @@ export default class TAAPass this.blendModel.draw({ uniforms: { // @ts-ignore - u_Opacity: layerStyleOptions.opacity || 1, + u_opacity: layerStyleOptions.opacity || 1, u_MixRatio: this.frame === 0 ? 1 : 0.9, u_Diffuse1: this.sampleRenderTarget, u_Diffuse2: diff --git a/packages/core/src/services/scene/ISceneService.ts b/packages/core/src/services/scene/ISceneService.ts index b9ead753fa..e0b742e5d4 100644 --- a/packages/core/src/services/scene/ISceneService.ts +++ b/packages/core/src/services/scene/ISceneService.ts @@ -13,4 +13,5 @@ export interface ISceneService { render(): void; destroy(): void; } -export const SceneEventList = ['loaded', 'resize', 'destroy']; +// scene 事件 +export const SceneEventList = ['loaded', 'maploaded', 'resize', 'destroy']; diff --git a/packages/core/src/services/scene/SceneService.ts b/packages/core/src/services/scene/SceneService.ts index 2eccda0f9a..4f3ca3853a 100644 --- a/packages/core/src/services/scene/SceneService.ts +++ b/packages/core/src/services/scene/SceneService.ts @@ -72,7 +72,6 @@ export default class Scene extends EventEmitter implements ISceneService { public constructor() { super(); - // @see https://github.com/webpack/tapable#usage this.hooks = { /** @@ -86,6 +85,7 @@ export default class Scene extends EventEmitter implements ISceneService { } public init(globalConfig: IGlobalConfig) { + this.initClear(); this.configService.setAndCheckConfig(globalConfig); // 初始化资源管理 图片 @@ -148,23 +148,25 @@ export default class Scene extends EventEmitter implements ISceneService { public addLayer(layer: ILayer) { this.logger.info(`add layer ${layer.name}`); + this.layerService.add(layer); } public async render() { + // 首次初始化,或者地图的容器被强制销毁的需要重新初始化 if (!this.inited) { // 首次渲染需要等待底图、相机初始化 await this.hooks.init.promise(this.configService.getConfig()); // 初始化marker 容器 this.map.addMarkerContainer(); - this.emit('loaded'); this.inited = true; - this.layerService.initLayers(); + this.layerService.renderLayers(); + this.emit('loaded'); } this.layerService.renderLayers(); - this.logger.info('render'); + // this.logger.info('render'); } public destroy() { @@ -205,4 +207,14 @@ export default class Scene extends EventEmitter implements ISceneService { this.cameraService.update(viewport); this.render(); }; + private initClear() { + this.inited = false; + this.layerService.destroy(); + this.configService.reset(); + this.interactionService.destroy(); + this.controlService.destroy(); + this.removeAllListeners(); + this.map.destroy(); + window.removeEventListener('resize', this.handleWindowResized, false); + } } diff --git a/packages/core/src/services/shader/IShaderModuleService.ts b/packages/core/src/services/shader/IShaderModuleService.ts index 223aeb6d8a..7a0a4089ed 100644 --- a/packages/core/src/services/shader/IShaderModuleService.ts +++ b/packages/core/src/services/shader/IShaderModuleService.ts @@ -20,4 +20,5 @@ export interface IShaderModuleService { * 注册 L7 内置 shader module */ registerBuiltinModules(): void; + destroy(): void; } diff --git a/packages/core/src/services/shader/ShaderModuleService.ts b/packages/core/src/services/shader/ShaderModuleService.ts index 56660717d1..24476daf36 100644 --- a/packages/core/src/services/shader/ShaderModuleService.ts +++ b/packages/core/src/services/shader/ShaderModuleService.ts @@ -22,6 +22,7 @@ export default class ShaderModuleService implements IShaderModuleService { private rawContentCache: { [key: string]: IModuleParams } = {}; public registerBuiltinModules() { + this.destroy(); this.registerModule('common', { vs: common, fs: common }); this.registerModule('decode', { vs: decode, fs: '' }); this.registerModule('projection', { vs: projection, fs: '' }); @@ -50,7 +51,10 @@ export default class ShaderModuleService implements IShaderModuleService { vs: extractedVS, }; } - + public destroy() { + this.moduleCache = {}; + this.rawContentCache = {}; + } public getModule(moduleName: string): IModuleParams { if (this.moduleCache[moduleName]) { return this.moduleCache[moduleName]; diff --git a/packages/core/src/shaders/post-processing/blend.glsl b/packages/core/src/shaders/post-processing/blend.glsl index 98d595cedb..2a8cbf98dd 100644 --- a/packages/core/src/shaders/post-processing/blend.glsl +++ b/packages/core/src/shaders/post-processing/blend.glsl @@ -1,4 +1,4 @@ -uniform float u_Opacity : 1.0; +uniform float u_opacity : 1.0; uniform float u_MixRatio : 0.5; uniform sampler2D u_Diffuse1; @@ -9,5 +9,5 @@ varying vec2 v_UV; void main() { vec4 texel1 = texture2D(u_Diffuse1, v_UV); vec4 texel2 = texture2D(u_Diffuse2, v_UV); - gl_FragColor = u_Opacity * mix(texel1, texel2, u_MixRatio); -} \ No newline at end of file + gl_FragColor = u_opacity * mix(texel1, texel2, u_MixRatio); +} diff --git a/packages/core/src/shaders/projection.glsl b/packages/core/src/shaders/projection.glsl index ef4c8fa490..53ef0fdf52 100644 --- a/packages/core/src/shaders/projection.glsl +++ b/packages/core/src/shaders/projection.glsl @@ -63,6 +63,14 @@ vec3 project_offset_normal(vec3 vector) { return project_normal(vector); } +// reverse Y +vec3 reverse_offset_normal(vec3 vector) { + if (u_CoordinateSystem == COORDINATE_SYSTEM_P20) { + return vector * vec3(1.0,-1.0, 1.0); + } + return vector; +} + vec4 project_position(vec4 position) { if (u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) { @@ -120,4 +128,14 @@ vec4 project_common_position_to_clipspace(vec4 position) { u_ViewProjectionMatrix, u_ViewportCenterProjection ); -} \ No newline at end of file +} + +vec4 unproject_clipspace_to_position(vec4 clipspacePos, mat4 u_InverseViewProjectionMatrix) { + vec4 pos = u_InverseViewProjectionMatrix * (clipspacePos - u_ViewportCenterProjection); + if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || + u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) { + // Needs to be divided with project_uCommonUnitsPerMeter + pos.w /= u_PixelsPerMeter.z; + } + return pos; +} diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index eead635857..388c2fdf5d 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1,4 +1,5 @@ const TYPES = { + IEventEmitter: Symbol.for('IEventEmitter'), ISceneService: Symbol.for('ISceneService'), IGlobalConfigService: Symbol.for('IGlobalConfigService'), ICameraService: Symbol.for('ICameraService'), diff --git a/packages/layers/src/core/BaseLayer.ts b/packages/layers/src/core/BaseLayer.ts index 13d60d574d..c46e5cbf8e 100644 --- a/packages/layers/src/core/BaseLayer.ts +++ b/packages/layers/src/core/BaseLayer.ts @@ -1,4 +1,5 @@ import { + gl, ICameraService, IEncodeFeature, IFontService, @@ -8,11 +9,14 @@ import { ILayer, ILayerInitializationOptions, ILayerPlugin, + ILayerService, IMapService, IModel, IModelInitializationOptions, IMultiPassRenderer, IRendererService, + IScale, + IScaleOptions, IShaderModuleService, ISourceCFG, IStyleAttributeService, @@ -25,7 +29,8 @@ import { TYPES, } from '@l7/core'; import Source from '@l7/source'; -import { isFunction } from 'lodash'; +import { EventEmitter } from 'eventemitter3'; +import { isFunction, isObject } from 'lodash'; // @ts-ignore import mergeJsonSchemas from 'merge-json-schemas'; import { SyncBailHook, SyncHook } from 'tapable'; @@ -50,7 +55,11 @@ let layerIdCounter = 0; const defaultLayerInitializationOptions: Partial< ILayerInitializationOptions > = { - enableMultiPassRenderer: true, + minZoom: 0, + maxZoom: 20, + visible: true, + zIndex: 0, + enableMultiPassRenderer: false, enablePicking: false, enableHighlight: false, highlightColor: 'red', @@ -58,9 +67,14 @@ const defaultLayerInitializationOptions: Partial< jitterScale: 1, }; -export default class BaseLayer implements ILayer { +export default class BaseLayer extends EventEmitter + implements ILayer { public id: string = `${layerIdCounter++}`; public name: string; + public visible: boolean = true; + public zIndex: number = 0; + public minZoom: number; + public maxZoom: number; // 生命周期钩子 public hooks = { @@ -113,6 +127,9 @@ export default class BaseLayer implements ILayer { @lazyInject(TYPES.IMapService) protected readonly map: IMapService; + @lazyInject(TYPES.ILayerService) + protected readonly layerService: ILayerService; + private encodedData: IEncodeFeature[]; private configSchema: object; @@ -123,6 +140,13 @@ export default class BaseLayer implements ILayer { private styleOptions: Partial< ILayerInitializationOptions & ChildLayerStyleOptions >; + private scaleOptions: IScaleOptions = {}; + + private enodeOptions: { + [type: string]: { + field: string; + }; + }; @lazyInject(TYPES.IInteractionService) private readonly interactionService: IInteractionService; @@ -130,10 +154,17 @@ export default class BaseLayer implements ILayer { constructor( styleOptions: Partial, ) { + super(); this.styleOptions = { ...defaultLayerInitializationOptions, ...styleOptions, }; + const { minZoom, maxZoom, zIndex, visible } = this + .styleOptions as ILayerInitializationOptions; + this.visible = visible; + this.zIndex = zIndex; + this.minZoom = minZoom; + this.maxZoom = maxZoom; } public addPlugin(plugin: ILayerPlugin) { @@ -254,6 +285,17 @@ export default class BaseLayer implements ILayer { }; return this; } + public scale(field: string | IScaleOptions, cfg: IScale) { + if (isObject(field)) { + this.scaleOptions = { + ...this.scaleOptions, + ...field, + }; + } else { + this.scaleOptions[field] = cfg; + } + return this; + } public render(): ILayer { if (this.multiPassRenderer && this.multiPassRenderer.getRenderFlag()) { this.multiPassRenderer.render(); @@ -262,6 +304,39 @@ export default class BaseLayer implements ILayer { } return this; } + + public show(): ILayer { + this.visible = true; + this.layerService.renderLayers(); + return this; + } + + public hide(): ILayer { + this.visible = false; + this.layerService.renderLayers(); + return this; + } + + public setIndex(index: number): ILayer { + this.zIndex = index; + this.layerService.updateRenderOrder(); + return this; + } + + public isVisible(): boolean { + const zoom = this.map.getZoom(); + return this.visible && zoom >= this.minZoom && zoom <= this.maxZoom; + } + + public setMinZoom(min: number): ILayer { + this.minZoom = min; + return this; + } + + public setMaxZoom(max: number): ILayer { + this.maxZoom = max; + return this; + } /** * zoom to layer Bounds */ @@ -303,6 +378,9 @@ export default class BaseLayer implements ILayer { public getStyleOptions() { return this.styleOptions; } + public getScaleOptions() { + return this.scaleOptions; + } public setEncodedData(encodedData: IEncodeFeature[]) { this.encodedData = encodedData; @@ -358,6 +436,15 @@ export default class BaseLayer implements ILayer { fs, vs, elements, + blend: { + enable: true, + func: { + srcRGB: gl.SRC_ALPHA, + srcAlpha: 1, + dstRGB: gl.ONE_MINUS_SRC_ALPHA, + dstAlpha: 1, + }, + }, ...rest, }); } diff --git a/packages/layers/src/core/triangulation.ts b/packages/layers/src/core/triangulation.ts index 8ddedad28c..0cbb42e72a 100644 --- a/packages/layers/src/core/triangulation.ts +++ b/packages/layers/src/core/triangulation.ts @@ -61,10 +61,10 @@ export function LineTriangulation(feature: IEncodeFeature) { const { coordinates } = feature; const line = getNormals(coordinates as number[][], false, 0); return { - vertices: line.attrPos, // [ x,y,z, distance, miter ] + vertices: line.attrPos, // [ x,y,z, distance, miter,total ] indices: line.attrIndex, normals: line.normals, - size: 5, + size: 6, }; } @@ -87,7 +87,7 @@ export function HeatmapGridTriangulation(feature: IEncodeFeature) { | ShapeType2D | ShapeType3D); return { - vertices: positions, // [ x, y, z ] + vertices: positions, // [ x, y, z ] 多边形顶点 indices: index, normals: Array.from(computeVertexNormals(positions, index)), size: 3, diff --git a/packages/layers/src/heatmap/grid.ts b/packages/layers/src/heatmap/grid.ts index 388f4ff8ec..0061eceaf2 100644 --- a/packages/layers/src/heatmap/grid.ts +++ b/packages/layers/src/heatmap/grid.ts @@ -27,7 +27,7 @@ export default class HeatMapGrid extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, u_coverage: coverage || 1.0, u_radius: [ this.getSource().data.xOffset, @@ -43,19 +43,11 @@ export default class HeatMapGrid extends BaseLayer { this.registerBuiltinAttributes(this); this.models = [ this.buildLayerModel({ - moduleName: 'pointExtrude', + moduleName: 'gridheatmap', vertexShader: heatmapGridVert, fragmentShader: heatmapGridFrag, triangulation: HeatmapGridTriangulation, - blend: { - enable: true, - func: { - srcRGB: gl.SRC_ALPHA, - srcAlpha: 1, - dstRGB: gl.ONE_MINUS_SRC_ALPHA, - dstAlpha: 1, - }, - }, + depth: { enable: false }, }), ]; } diff --git a/packages/layers/src/heatmap/heatmap.ts b/packages/layers/src/heatmap/heatmap.ts index ddd039c596..747da07589 100644 --- a/packages/layers/src/heatmap/heatmap.ts +++ b/packages/layers/src/heatmap/heatmap.ts @@ -106,8 +106,8 @@ export default class HeatMapLayer extends BaseLayer { height: imageData.height, wrapS: gl.CLAMP_TO_EDGE, wrapT: gl.CLAMP_TO_EDGE, - min: gl.NEAREST, - mag: gl.NEAREST, + min: gl.LINEAR, + mag: gl.LINEAR, flipY: true, }); } @@ -223,6 +223,15 @@ export default class HeatMapLayer extends BaseLayer { depth: { enable: false, }, + blend: { + enable: true, + func: { + srcRGB: gl.SRC_ALPHA, + srcAlpha: 1, + dstRGB: gl.ONE_MINUS_SRC_ALPHA, + dstAlpha: 1, + }, + }, count: 6, elements: createElements({ data: [0, 2, 1, 2, 3, 1], @@ -235,7 +244,7 @@ export default class HeatMapLayer extends BaseLayer { const { opacity, intensity = 10, radius = 5 } = this.getStyleOptions(); this.intensityModel.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, u_radius: radius, u_intensity: intensity, }, @@ -246,7 +255,7 @@ export default class HeatMapLayer extends BaseLayer { const { opacity } = this.getStyleOptions(); this.colorModel.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, u_colorTexture: this.colorTexture, u_texture: this.heatmapFramerBuffer, }, @@ -254,7 +263,6 @@ export default class HeatMapLayer extends BaseLayer { } private draw3DHeatMap() { const { opacity } = this.getStyleOptions(); - const mapbounds = this.map.getBounds(); const invert = mat4.invert( mat4.create(), // @ts-ignore @@ -262,10 +270,9 @@ export default class HeatMapLayer extends BaseLayer { ) as mat4; this.colorModel.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, u_colorTexture: this.colorTexture, u_texture: this.heatmapFramerBuffer, - u_extent: [-179.9476, -60.0959, 179.9778, 79.5651], u_InverseViewProjectionMatrix: [...invert], }, }); @@ -273,7 +280,7 @@ export default class HeatMapLayer extends BaseLayer { private build3dHeatMap() { const { getViewportSize } = this.rendererService; const { width, height } = getViewportSize(); - const triangulation = heatMap3DTriangulation(256, 128); + const triangulation = heatMap3DTriangulation(width / 4.0, height / 4.0); this.shaderModuleService.registerModule('heatmap3dColor', { vs: heatmap3DVert, fs: heatmap3DFrag, @@ -312,7 +319,16 @@ export default class HeatMapLayer extends BaseLayer { ...uniforms, }, depth: { - enable: false, + enable: true, + }, + blend: { + enable: true, + func: { + srcRGB: gl.SRC_ALPHA, + srcAlpha: 1, + dstRGB: gl.ONE_MINUS_SRC_ALPHA, + dstAlpha: 1, + }, }, elements: createElements({ data: triangulation.indices, diff --git a/packages/layers/src/heatmap/shaders/heatmap_3d_frag.glsl b/packages/layers/src/heatmap/shaders/heatmap_3d_frag.glsl index f2c35866d3..f3b00b62b1 100644 --- a/packages/layers/src/heatmap/shaders/heatmap_3d_frag.glsl +++ b/packages/layers/src/heatmap/shaders/heatmap_3d_frag.glsl @@ -1,16 +1,18 @@ uniform sampler2D u_texture; uniform sampler2D u_colorTexture; -uniform float u_Opacity; +uniform float u_opacity; varying vec2 v_texCoord; +varying float v_intensity; void main(){ float intensity = texture2D(u_texture, v_texCoord).r; vec2 ramp_pos = vec2( - fract(16.0 * (1.0 - intensity)), - floor(16.0 * (1.0 - intensity)) / 16.0); + fract(16.0 * (1.0 - v_intensity)), + floor(16.0 * (1.0 - v_intensity)) / 16.0); // vec4 color = texture2D(u_colorTexture,vec2(0.5,1.0-intensity)); vec4 color = texture2D(u_colorTexture,ramp_pos); gl_FragColor = color; - // gl_FragColor.a = color.a * smoothstep(0.0,0.12,intensity) * u_Opacity; + // gl_FragColor.a = color.a * smoothstep(0.0, 0.01, v_intensity) * u_opacity; + // gl_FragColor.a = 0.2; } diff --git a/packages/layers/src/heatmap/shaders/heatmap_3d_vert.glsl b/packages/layers/src/heatmap/shaders/heatmap_3d_vert.glsl index 087e4328bd..e00eec61a5 100644 --- a/packages/layers/src/heatmap/shaders/heatmap_3d_vert.glsl +++ b/packages/layers/src/heatmap/shaders/heatmap_3d_vert.glsl @@ -2,41 +2,44 @@ precision highp float; attribute vec3 a_Position; attribute vec2 a_Uv; uniform sampler2D u_texture; -uniform vec4 u_extent; varying vec2 v_texCoord; uniform mat4 u_ModelMatrix; uniform mat4 u_InverseViewProjectionMatrix; +varying float v_intensity; + +vec2 toBezier(float t, vec2 P0, vec2 P1, vec2 P2, vec2 P3) { + float t2 = t * t; + float one_minus_t = 1.0 - t; + float one_minus_t2 = one_minus_t * one_minus_t; + return (P0 * one_minus_t2 * one_minus_t + P1 * 3.0 * t * one_minus_t2 + P2 * 3.0 * t2 * one_minus_t + P3 * t2 * t); +} +vec2 toBezier(float t, vec4 p){ + return toBezier(t, vec2(0.0, 0.0), vec2(p.x, p.y), vec2(p.z, p.w), vec2(1.0, 1.0)); +} #pragma include "projection" void main() { v_texCoord = a_Uv; - vec2 pos = a_Uv * vec2(2.0) - vec2(1.0); + vec2 pos = 1.8 * (a_Uv * vec2(2.0) - vec2(1.0)); - vec4 n_0 = vec4(pos, 0.0, 1.0) - u_ViewportCenterProjection; - vec4 n_1 = vec4(pos, 1.0, 1.0) - u_ViewportCenterProjection; - vec4 m_0 = u_InverseViewProjectionMatrix * n_0 ; - vec4 m_1 = u_InverseViewProjectionMatrix * n_1; - m_0 = m_0 / m_0.w; - m_1 = m_1 / m_1.w; + vec4 p1 = vec4(pos, 0.0, 1.0); + vec4 p2 = vec4(pos, 1.0, 1.0); - float zPos = (0.0 - m_0.z) / (m_1.z - m_0.z); - vec4 mapCoord = m_0 + zPos * (m_1 - m_0); + vec4 inverseP1 = unproject_clipspace_to_position(p1, u_InverseViewProjectionMatrix); + vec4 inverseP2 = unproject_clipspace_to_position(p2, u_InverseViewProjectionMatrix) ; - // vec4 p = u_InverseViewProjectionMatrix * (vec4(pos,0,1) - u_ViewportCenterProjection); - // p = p /p.w; - // pos.y = 1.0 -pos.y; - // vec2 minxy = project_position(vec4(u_extent.xy, 0, 1.0)).xy; - // vec2 maxxy = project_position(vec4(u_extent.zw, 0, 1.0)).xy; + inverseP1 = inverseP1 / inverseP1.w; + inverseP2 = inverseP2 / inverseP2.w; - // vec2 step = (maxxy - minxy); + float zPos = (0.0 - inverseP1.z) / (inverseP2.z - inverseP1.z); + vec4 position = inverseP1 + zPos * (inverseP2 - inverseP1); - // vec2 pos = minxy + (vec2(a_Position.x, a_Position.y ) + vec2(1.0)) / vec2(2.0) * step; + vec4 b= vec4(0.5000, 0, 1, 0.5000); + float fh; - float intensity = texture2D(u_texture, v_texCoord).r; - gl_Position = project_common_position_to_clipspace(vec4(mapCoord.xy, intensity * 100., 1.0)); - // gl_Position = vec4(pos,0.,1.0); - // v_texCoord = (gl_Position.xy + vec2(1.0)) / vec2(2.0) / gl_Position.w; - // v_texCoord.y = 1.0 - v_texCoord.y; + v_intensity = texture2D(u_texture, v_texCoord).r; + fh = toBezier(v_intensity, b).y; + gl_Position = project_common_position_to_clipspace(vec4(position.xy, v_intensity * 50., 1.0)); } diff --git a/packages/layers/src/heatmap/shaders/heatmap_frag.glsl b/packages/layers/src/heatmap/shaders/heatmap_frag.glsl index f3f83b7c2a..8e817872e3 100644 --- a/packages/layers/src/heatmap/shaders/heatmap_frag.glsl +++ b/packages/layers/src/heatmap/shaders/heatmap_frag.glsl @@ -1,6 +1,6 @@ uniform sampler2D u_texture; uniform sampler2D u_colorTexture; -uniform float u_Opacity; +uniform float u_opacity; varying vec2 v_texCoord; void main(){ @@ -11,6 +11,6 @@ void main(){ // vec4 color = texture2D(u_colorTexture,vec2(0.5,1.0-intensity)); vec4 color = texture2D(u_colorTexture,ramp_pos); gl_FragColor = color; - gl_FragColor.a = color.a * smoothstep(0.1,0.5,intensity) * u_Opacity; + gl_FragColor.a = color.a * smoothstep(0.,0.01,intensity) * u_opacity; } diff --git a/packages/layers/src/heatmap/shaders/hexagon_frag.glsl b/packages/layers/src/heatmap/shaders/hexagon_frag.glsl index 9bc316c11d..540a73c75e 100644 --- a/packages/layers/src/heatmap/shaders/hexagon_frag.glsl +++ b/packages/layers/src/heatmap/shaders/hexagon_frag.glsl @@ -1,7 +1,7 @@ precision highp float; varying vec4 v_color; -uniform float u_Opacity: 0.1; +uniform float u_opacity: 0.1; void main() { gl_FragColor = v_color; - gl_FragColor.a *= u_Opacity; + gl_FragColor.a *= u_opacity; } diff --git a/packages/layers/src/heatmap/shaders/hexagon_vert.glsl b/packages/layers/src/heatmap/shaders/hexagon_vert.glsl index 2f68a0d4e4..65ec9461a3 100644 --- a/packages/layers/src/heatmap/shaders/hexagon_vert.glsl +++ b/packages/layers/src/heatmap/shaders/hexagon_vert.glsl @@ -12,7 +12,7 @@ varying vec4 v_color; void main() { v_color = a_Color; mat2 rotationMatrix = mat2(cos(u_angle), sin(u_angle), -sin(u_angle), cos(u_angle)); - vec2 offset =(vec2(a_Position.xy * u_radius * u_coverage * rotationMatrix)); + vec2 offset =(vec2(a_Position.xy * u_radius * rotationMatrix )); vec4 project_pos = project_position(vec4(a_Pos.xy + offset, 0, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0., 1.0)); } diff --git a/packages/layers/src/index.ts b/packages/layers/src/index.ts index acd403c13b..e5301a2fbb 100644 --- a/packages/layers/src/index.ts +++ b/packages/layers/src/index.ts @@ -4,10 +4,12 @@ import HeatMapGridLayer from './heatmap/grid'; import HeatMapLayer from './heatmap/heatmap'; import ArcLineLayer from './line/arc'; import Arc2DLineLayer from './line/arc2d'; +import Arc3DLineLayer from './line/arc3d'; +import DashLineLayer from './line/dash'; import LineLayer from './line/index'; import Point3dLayer from './point/extrude'; +import PointLayer from './point/fill'; import PointImageLayer from './point/image'; -import PointLayer from './point/index'; import TextLayer from './point/text'; // import Point from './point/point'; import PolygonLayer from './polygon'; @@ -79,11 +81,13 @@ export { Point3dLayer, PointImageLayer, LineLayer, + DashLineLayer, Polygon3DLayer, ImageLayer, HeatMapGridLayer, ArcLineLayer, Arc2DLineLayer, + Arc3DLineLayer, RasterLayer, HeatMapLayer, TextLayer, diff --git a/packages/layers/src/line/arc.ts b/packages/layers/src/line/arc.ts index 5813156a68..aa325cfc13 100644 --- a/packages/layers/src/line/arc.ts +++ b/packages/layers/src/line/arc.ts @@ -2,10 +2,11 @@ import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; import BaseLayer from '../core/BaseLayer'; import { LineArcTriangulation } from '../core/triangulation'; import line_arc_frag from './shaders/line_arc_frag.glsl'; -import line_arc_vert from './shaders/line_arc_vert.glsl'; +import line_arc2d_vert from './shaders/line_bezier_vert.glsl'; interface IArcLayerStyleOptions { opacity: number; segmentNumber: number; + blur: number; } export default class ArcLineLayer extends BaseLayer { public name: string = 'LineLayer'; @@ -23,12 +24,13 @@ export default class ArcLineLayer extends BaseLayer { } protected renderModels() { - const { opacity } = this.getStyleOptions(); + const { opacity, blur = 0.99 } = this.getStyleOptions(); this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1, + u_opacity: opacity || 1, segmentNumber: 30, + u_blur: blur, }, }), ); @@ -39,10 +41,11 @@ export default class ArcLineLayer extends BaseLayer { this.registerBuiltinAttributes(this); this.models = [ this.buildLayerModel({ - moduleName: 'arcline', - vertexShader: line_arc_vert, + moduleName: 'arc2dline', + vertexShader: line_arc2d_vert, fragmentShader: line_arc_frag, triangulation: LineArcTriangulation, + depth: { enable: false }, blend: { enable: true, func: { diff --git a/packages/layers/src/line/arc2d.ts b/packages/layers/src/line/arc2d.ts index 18e3c7a16d..c35b23edba 100644 --- a/packages/layers/src/line/arc2d.ts +++ b/packages/layers/src/line/arc2d.ts @@ -6,8 +6,11 @@ import line_arc_frag from './shaders/line_arc_frag.glsl'; interface IArcLayerStyleOptions { opacity: number; segmentNumber: number; + blur: number; } -export default class Arc2DLineLayer extends BaseLayer { +export default class ArcCircleLineLayer extends BaseLayer< + IArcLayerStyleOptions +> { public name: string = 'LineLayer'; protected getConfigSchema() { @@ -23,12 +26,13 @@ export default class Arc2DLineLayer extends BaseLayer { } protected renderModels() { - const { opacity } = this.getStyleOptions(); + const { opacity, blur = 0.99 } = this.getStyleOptions(); this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1, + u_opacity: opacity || 1, segmentNumber: 30, + u_blur: blur, }, }), ); diff --git a/packages/layers/src/line/arc3d.ts b/packages/layers/src/line/arc3d.ts new file mode 100644 index 0000000000..369ca56356 --- /dev/null +++ b/packages/layers/src/line/arc3d.ts @@ -0,0 +1,107 @@ +import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; +import BaseLayer from '../core/BaseLayer'; +import { LineArcTriangulation } from '../core/triangulation'; +import line_arc_frag from './shaders/line_arc_frag.glsl'; +import line_arc_vert from './shaders/line_arc_vert.glsl'; +interface IArcLayerStyleOptions { + opacity: number; + segmentNumber: number; +} +export default class Arc3DLineLayer extends BaseLayer { + public name: string = 'LineLayer'; + + protected getConfigSchema() { + return { + properties: { + opacity: { + type: 'number', + minimum: 0, + maximum: 1, + }, + }, + }; + } + + protected renderModels() { + const { opacity } = this.getStyleOptions(); + this.models.forEach((model) => + model.draw({ + uniforms: { + u_opacity: opacity || 1, + segmentNumber: 30, + }, + }), + ); + return this; + } + + protected buildModels() { + this.registerBuiltinAttributes(this); + this.models = [ + this.buildLayerModel({ + moduleName: 'arcline', + vertexShader: line_arc_vert, + fragmentShader: line_arc_frag, + triangulation: LineArcTriangulation, + blend: { + enable: true, + func: { + srcRGB: gl.ONE, + srcAlpha: 1, + dstRGB: gl.ONE, + dstAlpha: 1, + }, + }, + }), + ]; + } + + private registerBuiltinAttributes(layer: ILayer) { + // point layer size; + layer.styleAttributeService.registerStyleAttribute({ + name: 'size', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Size', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const { size } = feature; + return Array.isArray(size) ? [size[0]] : [size as number]; + }, + }, + }); + + layer.styleAttributeService.registerStyleAttribute({ + name: 'instance', // 弧线起始点信息 + type: AttributeType.Attribute, + descriptor: { + name: 'a_Instance', + buffer: { + usage: gl.STATIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 4, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + return [vertex[3], vertex[4], vertex[5], vertex[6]]; + }, + }, + }); + } +} diff --git a/packages/layers/src/line/dash.ts b/packages/layers/src/line/dash.ts new file mode 100644 index 0000000000..56c9a47e12 --- /dev/null +++ b/packages/layers/src/line/dash.ts @@ -0,0 +1,206 @@ +import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; +import BaseLayer from '../core/BaseLayer'; +import { LineTriangulation } from '../core/triangulation'; +import line_dash_frag from './shaders/line_dash_frag.glsl'; +import line_dash_vert from './shaders/line_dash_vert.glsl'; +interface IDashLineLayerStyleOptions { + opacity: number; + dashArray: [number, number]; +} +export default class DashLineLayer extends BaseLayer< + IDashLineLayerStyleOptions +> { + public name: string = 'LineLayer'; + + protected getConfigSchema() { + return { + properties: { + opacity: { + type: 'number', + minimum: 0, + maximum: 1, + }, + }, + }; + } + + protected renderModels() { + const { opacity, dashArray = [10, 5] } = this.getStyleOptions(); + this.models.forEach((model) => + model.draw({ + uniforms: { + u_opacity: opacity || 1.0, + u_dash_array: dashArray, + }, + }), + ); + return this; + } + + protected buildModels() { + this.registerBuiltinAttributes(this); + this.models = [ + this.buildLayerModel({ + moduleName: 'line_dash', + vertexShader: line_dash_vert, + fragmentShader: line_dash_frag, + triangulation: LineTriangulation, + blend: { + enable: true, + func: { + srcRGB: gl.SRC_ALPHA, + srcAlpha: 1, + dstRGB: gl.ONE_MINUS_SRC_ALPHA, + dstAlpha: 1, + }, + }, + }), + ]; + } + + private registerBuiltinAttributes(layer: ILayer) { + // point layer size; + layer.styleAttributeService.registerStyleAttribute({ + name: 'size', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Size', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const { size } = feature; + return Array.isArray(size) ? [size[0]] : [size as number]; + }, + }, + }); + + // point layer size; + layer.styleAttributeService.registerStyleAttribute({ + name: 'normal', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Normal', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.STATIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 3, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + normal: number[], + ) => { + return normal; + }, + }, + }); + + layer.styleAttributeService.registerStyleAttribute({ + name: 'miter', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Miter', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + return [vertex[4]]; + }, + }, + }); + + layer.styleAttributeService.registerStyleAttribute({ + name: 'startPos', + type: AttributeType.Attribute, + descriptor: { + name: 'a_StartPos', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 3, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const coordinates = feature.coordinates as number[][]; + const coord = coordinates[0]; + return coord.length === 3 ? coord : [...coord, 0.0]; + }, + }, + }); + + layer.styleAttributeService.registerStyleAttribute({ + name: 'distance', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Distance', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + return [vertex[3]]; + }, + }, + }); + + layer.styleAttributeService.registerStyleAttribute({ + name: 'total_distance', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Total_Distance', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + return [vertex[5]]; + }, + }, + }); + } +} diff --git a/packages/layers/src/line/index.ts b/packages/layers/src/line/index.ts index 9524f8c49f..6048748cf6 100644 --- a/packages/layers/src/line/index.ts +++ b/packages/layers/src/line/index.ts @@ -26,7 +26,7 @@ export default class LineLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, }, }), ); @@ -127,28 +127,5 @@ export default class LineLayer extends BaseLayer { }, }, }); - - layer.styleAttributeService.registerStyleAttribute({ - name: 'distance', - type: AttributeType.Attribute, - descriptor: { - name: 'a_Distance', - buffer: { - // give the WebGL driver a hint that this buffer may change - usage: gl.DYNAMIC_DRAW, - data: [], - type: gl.FLOAT, - }, - size: 1, - update: ( - feature: IEncodeFeature, - featureIdx: number, - vertex: number[], - attributeIdx: number, - ) => { - return [vertex[3]]; - }, - }, - }); } } diff --git a/packages/layers/src/line/shaders/arc_chunks.vert.glsl b/packages/layers/src/line/shaders/arc_chunks.vert.glsl new file mode 100644 index 0000000000..f0d2689c4c --- /dev/null +++ b/packages/layers/src/line/shaders/arc_chunks.vert.glsl @@ -0,0 +1,21 @@ +vec2 interpolate (vec2 source, vec2 target, float t) { + // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation + vec2 mid = midPoint(source, target); + vec3 x = vec3(source.x, mid.x, target.x); + vec3 y = vec3(source.y, mid.y, target.y) + return vec2(bezier3(x ,t), bezier3(y,t)); +} +float bezier3(vec3 arr, float t) { + float ut = 1 - t + return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t +} +vec2 midPoint(vec2 source, vec2 target) { + vec2 center = target - source; + float r = length(center); + float theta = atan(center.y, center.x); + float thetaOffset = 0.314; + float r2 = r / 2.0 / cos(thetaOffset); + float theta2 = theta + thetaOffset; + vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y); + return mid; +} diff --git a/packages/layers/src/line/shaders/line_arc2d_vert.glsl b/packages/layers/src/line/shaders/line_arc2d_vert.glsl index 360aed1ee5..6bb16a07f9 100644 --- a/packages/layers/src/line/shaders/line_arc2d_vert.glsl +++ b/packages/layers/src/line/shaders/line_arc2d_vert.glsl @@ -6,6 +6,7 @@ attribute float a_Size; uniform mat4 u_ModelMatrix; uniform float segmentNumber; varying vec4 v_color; +varying vec2 v_normal; #pragma include "projection" @@ -39,7 +40,14 @@ vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) { // rotate by 90 degrees dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); vec2 offset = dir_screenspace * offset_direction * a_Size / 2.0; - return offset; + return offset * vec2(1.0, -1.0); +} +vec2 getNormal(vec2 line_clipspace, float offset_direction) { + // normalized direction of the line + vec2 dir_screenspace = normalize(line_clipspace); + // rotate by 90 degrees + dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); + return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction); } float getAngularDist (vec2 source, vec2 target) { vec2 delta = source - target; @@ -77,12 +85,10 @@ void main() { float segmentRatio = getSegmentRatio(segmentIndex); float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir); - vec4 curr = project_position(vec4(degrees(interpolate(source, target, angularDist, segmentRatio)), 0.0, 1.0)); vec4 next = project_position(vec4(degrees(interpolate(source, target, angularDist, nextSegmentRatio)), 0.0, 1.0)); - - vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y); - + v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y); + vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y)); // vec4 project_pos = project_position(vec4(curr.xy, 0, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0)); } diff --git a/packages/layers/src/line/shaders/line_arc_frag.glsl b/packages/layers/src/line/shaders/line_arc_frag.glsl index b8f0e5bbb4..e60a9710cd 100644 --- a/packages/layers/src/line/shaders/line_arc_frag.glsl +++ b/packages/layers/src/line/shaders/line_arc_frag.glsl @@ -1,10 +1,13 @@ precision mediump float; - uniform float u_Opacity; + uniform float u_opacity; varying vec4 v_color; + uniform float u_blur : 0.90; + varying vec2 v_normal; void main() { gl_FragColor = v_color; - gl_FragColor.a = v_color.a * u_Opacity; + float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy)); + gl_FragColor.a *= (blur * u_opacity); } diff --git a/packages/layers/src/line/shaders/line_arc_vert.glsl b/packages/layers/src/line/shaders/line_arc_vert.glsl index abefcf54bd..5a548d510d 100644 --- a/packages/layers/src/line/shaders/line_arc_vert.glsl +++ b/packages/layers/src/line/shaders/line_arc_vert.glsl @@ -8,6 +8,7 @@ attribute float a_Size; uniform mat4 u_ModelMatrix; uniform float segmentNumber; varying vec4 v_color; +varying vec2 v_normal; #pragma include "projection" float maps (float value, float start1, float stop1, float start2, float stop2) { @@ -44,7 +45,13 @@ vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) { return offset; } - +vec2 getNormal(vec2 line_clipspace, float offset_direction) { + // normalized direction of the line + vec2 dir_screenspace = normalize(line_clipspace); + // rotate by 90 degrees + dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); + return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction); +} void main() { v_color = a_Color; @@ -58,9 +65,8 @@ void main() { vec3 curr = getPos(source, target, segmentRatio); vec3 next = getPos(source, target, nextSegmentRatio); vec2 offset = getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y); + v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y); - // vec4 project_pos = project_position(vec4(curr, 1.0)); - - gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0)); + gl_Position = project_common_position_to_clipspace(vec4(curr.xy + project_pixel(offset), curr.z, 1.0)); } diff --git a/packages/layers/src/line/shaders/line_bezier_vert.glsl b/packages/layers/src/line/shaders/line_bezier_vert.glsl new file mode 100644 index 0000000000..c20ad08621 --- /dev/null +++ b/packages/layers/src/line/shaders/line_bezier_vert.glsl @@ -0,0 +1,67 @@ +precision mediump float; +attribute vec4 a_Color; +attribute vec3 a_Position; +attribute vec4 a_Instance; +attribute float a_Size; +uniform mat4 u_ModelMatrix; +uniform float segmentNumber; +varying vec4 v_color; +varying vec2 v_normal; +#pragma include "projection" + +float bezier3(vec3 arr, float t) { + float ut = 1. - t; + return (arr.x * ut + arr.y * t) * ut + (arr.y * ut + arr.z * t) * t; +} +vec2 midPoint(vec2 source, vec2 target) { + vec2 center = target - source; + float r = length(center); + float theta = atan(center.y, center.x); + float thetaOffset = 0.314; + float r2 = r / 2.0 / cos(thetaOffset); + float theta2 = theta + thetaOffset; + vec2 mid = vec2(r2*cos(theta2) + source.x, r2*sin(theta2) + source.y); + return mid; +} +float getSegmentRatio(float index) { + return smoothstep(0.0, 1.0, index / (segmentNumber - 1.)); +} +vec2 interpolate (vec2 source, vec2 target, float t) { + // if the angularDist is PI, linear interpolation is applied. otherwise, use spherical interpolation + vec2 mid = midPoint(source, target); + vec3 x = vec3(source.x, mid.x, target.x); + vec3 y = vec3(source.y, mid.y, target.y); + return vec2(bezier3(x ,t), bezier3(y,t)); +} +vec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) { + // normalized direction of the line + vec2 dir_screenspace = normalize(line_clipspace); + // rotate by 90 degrees + dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); + vec2 offset = dir_screenspace * offset_direction * a_Size / 2.0; + return offset * vec2(1.0, -1.0); +} +vec2 getNormal(vec2 line_clipspace, float offset_direction) { + // normalized direction of the line + vec2 dir_screenspace = normalize(line_clipspace); + // rotate by 90 degrees + dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x); + return reverse_offset_normal(vec3(dir_screenspace,1.0)).xy * sign(offset_direction); +} + +void main() { + v_color = a_Color; + vec2 source = a_Instance.rg; + vec2 target = a_Instance.ba; + float segmentIndex = a_Position.x; + float segmentRatio = getSegmentRatio(segmentIndex); + float indexDir = mix(-1.0, 1.0, step(segmentIndex, 0.0)); + float nextSegmentRatio = getSegmentRatio(segmentIndex + indexDir); + + vec4 curr = project_position(vec4(interpolate(source, target, segmentRatio), 0.0, 1.0)); + vec4 next = project_position(vec4(interpolate(source, target, nextSegmentRatio), 0.0, 1.0)); + v_normal = getNormal((next.xy - curr.xy) * indexDir, a_Position.y); + vec2 offset = project_pixel(getExtrusionOffset((next.xy - curr.xy) * indexDir, a_Position.y)); + + gl_Position = project_common_position_to_clipspace(vec4(curr.xy + offset, 0, 1.0)); +} diff --git a/packages/layers/src/line/shaders/line_dash_frag.glsl b/packages/layers/src/line/shaders/line_dash_frag.glsl new file mode 100644 index 0000000000..2dbee9d6d1 --- /dev/null +++ b/packages/layers/src/line/shaders/line_dash_frag.glsl @@ -0,0 +1,18 @@ +uniform float u_blur : 0.9; +uniform float u_opacity : 1.0; +uniform float u_dash_offset : 0.0; +uniform float u_dash_ratio : 0.1; +varying vec4 v_color; +varying vec2 v_normal; + +varying float v_distance_ratio; +varying vec2 v_dash_array; +void main() { + gl_FragColor = v_color; + // gl_FragColor.a = v_distance_ratio; + // anti-alias + float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy)) * u_opacity; + // gl_FragColor.a *= blur * ceil(mod(v_distance_ratio, v_dash_array.x) - v_dash_array.y); + gl_FragColor.a *= blur * (1.0- step(v_dash_array.x, mod(v_distance_ratio, v_dash_array.x +v_dash_array.y))); + +} diff --git a/packages/layers/src/line/shaders/line_dash_vert.glsl b/packages/layers/src/line/shaders/line_dash_vert.glsl new file mode 100644 index 0000000000..34e6b9b1ab --- /dev/null +++ b/packages/layers/src/line/shaders/line_dash_vert.glsl @@ -0,0 +1,32 @@ + +attribute float a_Miter; +attribute vec4 a_Color; +attribute float a_Size; +attribute vec3 a_Normal; +attribute float a_Total_Distance; +attribute vec3 a_Position; +attribute float a_Distance; +uniform mat4 u_ModelMatrix; +uniform vec2 u_dash_array: [10.0, 5.]; +uniform float u_dash_offset: 0; + +varying vec4 v_color; +varying vec2 v_dash_array; +varying vec2 v_normal; + +varying float v_distance_ratio; + +#pragma include "projection" +void main() { + + v_distance_ratio = a_Distance / a_Total_Distance; + + v_dash_array = pow(2.0, 20.0 - u_Zoom) * u_dash_array / a_Total_Distance; + + v_normal = vec2(reverse_offset_normal(a_Normal) * sign(a_Miter)); + v_color = a_Color; + vec3 size = a_Miter * a_Size * reverse_offset_normal(a_Normal); //v_normal * vec3(1., -1., 1.0); + vec2 offset = project_pixel(size.xy); + vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0)); + gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0, 1.0)); +} diff --git a/packages/layers/src/line/shaders/line_frag.glsl b/packages/layers/src/line/shaders/line_frag.glsl index 8379af0d5e..0af8c88906 100644 --- a/packages/layers/src/line/shaders/line_frag.glsl +++ b/packages/layers/src/line/shaders/line_frag.glsl @@ -1,9 +1,16 @@ -uniform float u_blur : 0.99; +uniform float u_blur : 0.9; +uniform float u_opacity : 1.0; +uniform float u_dash_offset : 0.0; +uniform float u_dash_ratio : 0.0; varying vec4 v_color; -varying vec3 v_normal; +varying vec2 v_normal; + +varying float v_distance_ratio; +varying float v_dash_array; void main() { gl_FragColor = v_color; // anti-alias - float blur = smoothstep(u_blur, 1., length(v_normal.xy)); + float blur = 1.- smoothstep(u_blur, 1., length(v_normal.xy)) * u_opacity; gl_FragColor.a *= blur; -} \ No newline at end of file + +} diff --git a/packages/layers/src/line/shaders/line_vert.glsl b/packages/layers/src/line/shaders/line_vert.glsl index 75f3992525..dd7f9a1792 100644 --- a/packages/layers/src/line/shaders/line_vert.glsl +++ b/packages/layers/src/line/shaders/line_vert.glsl @@ -2,22 +2,17 @@ attribute float a_Miter; attribute vec4 a_Color; attribute float a_Size; -attribute float a_Distance; -attribute float a_dash_array; -attribute float a_total_distance; attribute vec3 a_Normal; attribute vec3 a_Position; uniform mat4 u_ModelMatrix; - +#pragma include "projection" varying vec4 v_color; varying float v_dash_array; -varying vec3 v_normal; - -#pragma include "projection" +varying vec2 v_normal; void main() { - v_normal = a_Normal; + v_normal = vec2(reverse_offset_normal(a_Normal) * sign(a_Miter)); v_color = a_Color; - vec3 size = a_Miter * a_Size * v_normal; + vec3 size = a_Miter * a_Size * reverse_offset_normal(a_Normal); //v_normal * vec3(1., -1., 1.0); vec2 offset = project_pixel(size.xy); vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0, 1.0)); diff --git a/packages/layers/src/plugins/DataMappingPlugin.ts b/packages/layers/src/plugins/DataMappingPlugin.ts index f864dfddfe..b4db541cb3 100644 --- a/packages/layers/src/plugins/DataMappingPlugin.ts +++ b/packages/layers/src/plugins/DataMappingPlugin.ts @@ -85,16 +85,14 @@ export default class DataMappingPlugin implements ILayerPlugin { if (!attribute.scale) { return []; } - const scalers = attribute?.scale?.scalers || []; const params: unknown[] = []; scalers.forEach(({ field }) => { - if (record[field]) { + if (record.hasOwnProperty(field) || attribute.scale?.type ==='variable') { params.push(record[field]); } }); - return attribute.mapping ? attribute.mapping(params) : []; } } diff --git a/packages/layers/src/plugins/FeatureScalePlugin.ts b/packages/layers/src/plugins/FeatureScalePlugin.ts index 93abe798ba..8147ca885b 100644 --- a/packages/layers/src/plugins/FeatureScalePlugin.ts +++ b/packages/layers/src/plugins/FeatureScalePlugin.ts @@ -4,6 +4,7 @@ import { ILayerPlugin, ILogService, IScale, + IScaleOptions, IStyleAttribute, IStyleScale, lazyInject, @@ -47,14 +48,18 @@ export default class FeatureScalePlugin implements ILayerPlugin { [field: string]: IStyleScale; } = {}; + private scaleOptions: IScaleOptions = {} + public apply(layer: ILayer) { layer.hooks.init.tap('FeatureScalePlugin', () => { + this.scaleOptions = layer.getScaleOptions(); const attributes = layer.styleAttributeService.getLayerStyleAttributes(); const { dataArray } = layer.getSource().data; this.caculateScalesForAttributes(attributes || [], dataArray); }); layer.hooks.beforeRender.tap('FeatureScalePlugin', () => { + this.scaleOptions = layer.getScaleOptions(); const attributes = layer.styleAttributeService.getLayerStyleAttributes(); if (attributes) { const { dataArray } = layer.getSource().data; @@ -154,15 +159,13 @@ export default class FeatureScalePlugin implements ILayerPlugin { private createScale(field: string, data?: IParseDataItem[]): IStyleScale { // 首先查找全局默认配置例如 color - const scaleOption: IScale | undefined = this.configService.getConfig()?.scales?.[field]; - + const scaleOption: IScale | undefined = this.scaleOptions[field]; const styleScale: IStyleScale = { field, scale: undefined, type: StyleScaleType.VARIABLE, option: scaleOption, }; - if (!data || !data.length) { if (scaleOption && scaleOption.type) { @@ -214,6 +217,8 @@ export default class FeatureScalePlugin implements ILayerPlugin { cfg.domain = extent(values); } else if (type === ScaleTypes.CAT) { cfg.domain = uniq(values); + } else if(type === ScaleTypes.QUANTILE) { + cfg.domain = values } return cfg; } diff --git a/packages/layers/src/plugins/MultiPassRendererPlugin.ts b/packages/layers/src/plugins/MultiPassRendererPlugin.ts index 9a9a9b5d29..02bff96d62 100644 --- a/packages/layers/src/plugins/MultiPassRendererPlugin.ts +++ b/packages/layers/src/plugins/MultiPassRendererPlugin.ts @@ -76,13 +76,6 @@ export default class MultiPassRendererPlugin implements ILayerPlugin { // 渲染前根据 viewport 调整 FBO size const { width, height } = this.rendererService.getViewportSize(); layer.multiPassRenderer.resize(width, height); - } else { - // 未开启 MultiPassRenderer,由于没有 ClearPass,渲染前需要手动 clear - this.rendererService.clear({ - color: [0, 0, 0, 0], - depth: 1, - framebuffer: null, - }); } }); } @@ -99,7 +92,7 @@ export default class MultiPassRendererPlugin implements ILayerPlugin { const { enablePicking, enableTAA } = layer.getStyleOptions(); // clear first - multiPassRenderer.add(new ClearPass()); + // multiPassRenderer.add(new ClearPass()); // picking pass if enabled if (enablePicking) { diff --git a/packages/layers/src/point/extrude.ts b/packages/layers/src/point/extrude.ts index 2d8d3fcade..82d4cf7ce3 100644 --- a/packages/layers/src/point/extrude.ts +++ b/packages/layers/src/point/extrude.ts @@ -26,7 +26,7 @@ export default class PointLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, }, }), ); @@ -78,7 +78,6 @@ export default class PointLayer extends BaseLayer { if (size) { let buffersize: number[] = []; if (Array.isArray(size)) { - // TODO 多维size支持 buffersize = size.length === 2 ? [size[0], size[0], size[1]] : size; } diff --git a/packages/layers/src/point/fill.ts b/packages/layers/src/point/fill.ts new file mode 100644 index 0000000000..a94fefbe69 --- /dev/null +++ b/packages/layers/src/point/fill.ts @@ -0,0 +1,154 @@ +import { + AttributeType, + gl, + IEncodeFeature, + ILayer, + ILayerPlugin, + ILogService, + IStyleAttributeService, + lazyInject, + TYPES, +} from '@l7/core'; +import BaseLayer from '../core/BaseLayer'; +import { rgb2arr } from '../utils/color'; +import pointFillFrag from './shaders/fill_frag.glsl'; +import pointFillVert from './shaders/fill_vert.glsl'; +interface IPointLayerStyleOptions { + opacity: number; + strokeWidth: number; + strokeColor: string; +} +export function PointTriangulation(feature: IEncodeFeature) { + const coordinates = feature.coordinates as number[]; + return { + vertices: [...coordinates, ...coordinates, ...coordinates, ...coordinates], + extrude: [-1, -1, 1, -1, 1, 1, -1, 1], + indices: [0, 1, 2, 2, 3, 0], + size: coordinates.length, + }; +} +export default class PointLayer extends BaseLayer { + public name: string = 'PointLayer'; + + protected getConfigSchema() { + return { + properties: { + opacity: { + type: 'number', + minimum: 0, + maximum: 1, + }, + }, + }; + } + + protected renderModels() { + const { + opacity = 1, + strokeColor = 'rgb(0,0,0,0)', + strokeWidth = 1, + } = this.getStyleOptions(); + this.models.forEach((model) => + model.draw({ + uniforms: { + u_opacity: opacity, + u_stroke_width: strokeWidth, + u_stroke_color: rgb2arr(strokeColor), + }, + }), + ); + return this; + } + + protected buildModels() { + this.registerBuiltinAttributes(this); + this.models = [ + this.buildLayerModel({ + moduleName: 'pointfill', + vertexShader: pointFillVert, + fragmentShader: pointFillFrag, + triangulation: PointTriangulation, + depth: { enable: false }, + }), + ]; + } + + private registerBuiltinAttributes(layer: ILayer) { + layer.styleAttributeService.registerStyleAttribute({ + name: 'extrude', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Extrude', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 2, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const extrude = [-1, -1, 1, -1, 1, 1, -1, 1]; + const extrudeIndex = (attributeIdx % 4) * 2; + return [extrude[extrudeIndex], extrude[extrudeIndex + 1]]; + }, + }, + }); + + // point layer size; + layer.styleAttributeService.registerStyleAttribute({ + name: 'size', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Size', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const { size } = feature; + return Array.isArray(size) ? [size[0]] : [size as number]; + }, + }, + }); + + // point layer size; + layer.styleAttributeService.registerStyleAttribute({ + name: 'shape', + type: AttributeType.Attribute, + descriptor: { + name: 'a_Shape', + buffer: { + // give the WebGL driver a hint that this buffer may change + usage: gl.DYNAMIC_DRAW, + data: [], + type: gl.FLOAT, + }, + size: 1, + update: ( + feature: IEncodeFeature, + featureIdx: number, + vertex: number[], + attributeIdx: number, + ) => { + const { shape = 2 } = feature; + const shape2d = layer.configService.getConfig().shape2d as string[]; + const shapeIndex = shape2d.indexOf(shape as string); + return [shapeIndex]; + }, + }, + }); + } +} diff --git a/packages/layers/src/point/image.ts b/packages/layers/src/point/image.ts index 0da6fb6c4d..0112f7be08 100644 --- a/packages/layers/src/point/image.ts +++ b/packages/layers/src/point/image.ts @@ -6,6 +6,7 @@ import { ILayerPlugin, ILogService, IStyleAttributeService, + ITexture2D, lazyInject, TYPES, } from '@l7/core'; @@ -27,7 +28,7 @@ export function PointTriangulation(feature: IEncodeFeature) { } export default class PointLayer extends BaseLayer { public name: string = 'PointLayer'; - + private texture: ITexture2D; protected getConfigSchema() { return { properties: { @@ -46,12 +47,9 @@ export default class PointLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, - u_texture: createTexture2D({ - data: this.iconService.getCanvas(), - width: 1024, - height: this.iconService.canvasHeight || 64, - }), + u_opacity: opacity || 1.0, + u_texture: this.texture, + u_textSize: [1024, this.iconService.canvasHeight || 128], }, }), ); @@ -61,7 +59,9 @@ export default class PointLayer extends BaseLayer { protected buildModels() { this.registerBuiltinAttributes(this); + this.updateTexture(); this.iconService.on('imageUpdate', () => { + this.updateTexture(); this.renderModels(); }); this.models = [ @@ -131,6 +131,7 @@ export default class PointLayer extends BaseLayer { attributeIdx: number, ) => { const iconMap = this.iconService.getIconMap(); + const { shape } = feature; const { x, y } = iconMap[shape as string] || { x: 0, y: 0 }; return [x, y]; @@ -138,4 +139,12 @@ export default class PointLayer extends BaseLayer { }, }); } + private updateTexture() { + const { createTexture2D } = this.rendererService; + this.texture = createTexture2D({ + data: this.iconService.getCanvas(), + width: 1024, + height: this.iconService.canvasHeight || 128, + }); + } } diff --git a/packages/layers/src/point/index.ts b/packages/layers/src/point/index.ts index ee41bcf005..07ea0c83c6 100644 --- a/packages/layers/src/point/index.ts +++ b/packages/layers/src/point/index.ts @@ -10,10 +10,13 @@ import { TYPES, } from '@l7/core'; import BaseLayer from '../core/BaseLayer'; +import { rgb2arr } from '../utils/color'; import pointFillFrag from './shaders/fill_frag.glsl'; import pointFillVert from './shaders/fill_vert.glsl'; interface IPointLayerStyleOptions { opacity: number; + strokeWidth: number; + strokeColor: string; } export function PointTriangulation(feature: IEncodeFeature) { const coordinates = feature.coordinates as number[]; @@ -40,11 +43,17 @@ export default class PointLayer extends BaseLayer { } protected renderModels() { - const { opacity } = this.getStyleOptions(); + const { + opacity = 1, + strokeColor = '#fff', + strokeWidth = 1, + } = this.getStyleOptions(); this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity, + u_stroke_width: strokeWidth, + u_stroke_color: rgb2arr(strokeColor), }, }), ); @@ -60,15 +69,6 @@ export default class PointLayer extends BaseLayer { fragmentShader: pointFillFrag, triangulation: PointTriangulation, depth: { enable: false }, - blend: { - enable: true, - func: { - srcRGB: gl.SRC_ALPHA, - srcAlpha: 1, - dstRGB: gl.ONE_MINUS_SRC_ALPHA, - dstAlpha: 1, - }, - }, }), ]; } diff --git a/packages/layers/src/point/point.ts b/packages/layers/src/point/point.ts deleted file mode 100644 index 59f97bef18..0000000000 --- a/packages/layers/src/point/point.ts +++ /dev/null @@ -1,130 +0,0 @@ -// import { -// gl, -// IIconService, -// IRendererService, -// IShaderModuleService, -// lazyInject, -// TYPES, -// } from '@l7/core'; -// import BaseLayer from '../core/BaseLayer'; -// import ExtrudeBuffer from './buffers/ExtrudeBuffer'; -// import ImageBuffer from './buffers/ImageBuffer'; -// import extrude_frag from './shaders/extrude_frag.glsl'; -// import extrude_vert from './shaders/extrude_vert.glsl'; -// import image_frag from './shaders/image_frag.glsl'; -// import image_vert from './shaders/image_vert.glsl'; - -// export default class PointLayer extends BaseLayer { -// public name: string = 'PointLayer'; - -// @lazyInject(TYPES.IShaderModuleService) -// private readonly shaderModule: IShaderModuleService; - -// @lazyInject(TYPES.IRendererService) -// private readonly renderer: IRendererService; - -// protected renderModels() { -// this.models.forEach((model) => -// model.draw({ -// uniforms: { -// u_ModelMatrix: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], -// }, -// }), -// ); -// return this; -// } - -// protected buildModels(): void { -// this.shaderModule.registerModule('point', { -// vs: extrude_vert, -// fs: extrude_frag, -// }); -// this.shaderModule.registerModule('pointImage', { -// vs: image_vert, -// fs: image_frag, -// }); - -// this.models = []; -// const { vs, fs, uniforms } = this.shaderModule.getModule('pointImage'); -// // const buffer = new ExtrudeBuffer({ -// // data: this.getEncodedData(), -// // }); -// // buffer.computeVertexNormals('miters', false); -// const { -// createAttribute, -// createBuffer, -// createElements, -// createTexture2D, -// createModel, -// } = this.renderer; -// const buffer = new ImageBuffer({ -// data: this.getEncodedData(), -// iconMap: this.iconService.getIconMap(), -// }); -// this.models.push( -// createModel({ -// attributes: { -// a_Position: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.positions, -// type: gl.FLOAT, -// }), -// size: 3, -// }), -// a_normal: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.normals, -// type: gl.FLOAT, -// }), -// size: 3, -// }), -// a_color: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.colors, -// type: gl.FLOAT, -// }), -// size: 4, -// }), -// a_size: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.sizes, -// type: gl.FLOAT, -// }), -// size: 1, -// }), -// a_uv: createAttribute({ -// buffer: createBuffer({ -// data: buffer.attributes.uv, -// type: gl.FLOAT, -// }), -// size: 2, -// }), -// // a_shape: createAttribute({ -// // buffer: createBuffer({ -// // data: buffer.attributes.miters, -// // type: gl.FLOAT, -// // }), -// // size: 3, -// // }), -// }, -// uniforms: { -// ...uniforms, -// u_opacity: this.styleOption.opacity as number, -// u_texture: createTexture2D({ -// data: this.iconService.getCanvas(), -// width: 1024, -// height: this.iconService.canvasHeight, -// }), -// }, -// fs, -// vs, -// primitive: gl.POINTS, -// count: buffer.verticesCount, -// // elements: createElements({ -// // data: buffer.indexArray, -// // type: gl.UNSIGNED_INT, -// // }), -// }), -// ); -// } -// } diff --git a/packages/layers/src/point/shaders/circle_frag.glsl b/packages/layers/src/point/shaders/circle_frag.glsl index 82b8a77362..ca6b845eb1 100644 --- a/packages/layers/src/point/shaders/circle_frag.glsl +++ b/packages/layers/src/point/shaders/circle_frag.glsl @@ -58,4 +58,4 @@ void main() { ); gl_FragColor = opacity_t * mix(v_color * u_opacity, u_stroke_color * u_stroke_opacity, color_t); -} \ No newline at end of file +} diff --git a/packages/layers/src/point/shaders/circle_vert.glsl b/packages/layers/src/point/shaders/circle_vert.glsl index f26e1f34d7..3bea5f4854 100644 --- a/packages/layers/src/point/shaders/circle_vert.glsl +++ b/packages/layers/src/point/shaders/circle_vert.glsl @@ -49,4 +49,4 @@ void main() { // construct point coords v_data = vec4(extrude, antialiasblur, shape_type); -} \ No newline at end of file +} diff --git a/packages/layers/src/point/shaders/extrude_frag.glsl b/packages/layers/src/point/shaders/extrude_frag.glsl index 6f26ac6083..3f0cf17883 100644 --- a/packages/layers/src/point/shaders/extrude_frag.glsl +++ b/packages/layers/src/point/shaders/extrude_frag.glsl @@ -3,4 +3,4 @@ uniform float u_opacity: 1.0; void main() { gl_FragColor = v_color; gl_FragColor.a *= u_opacity; -} \ No newline at end of file +} diff --git a/packages/layers/src/point/shaders/fill_frag.glsl b/packages/layers/src/point/shaders/fill_frag.glsl index ca6b845eb1..b1eecf6211 100644 --- a/packages/layers/src/point/shaders/fill_frag.glsl +++ b/packages/layers/src/point/shaders/fill_frag.glsl @@ -1,7 +1,7 @@ uniform float u_blur : 0; uniform float u_opacity : 1; uniform float u_stroke_width : 1; -uniform vec4 u_stroke_color : [1, 1, 1, 1]; +uniform vec4 u_stroke_color : [0, 0, 0, 0]; uniform float u_stroke_opacity : 1; varying vec4 v_data; @@ -9,6 +9,7 @@ varying vec4 v_color; varying float v_radius; #pragma include "sdf_2d" +#pragma include "picking" void main() { int shape = int(floor(v_data.w + 0.5)); @@ -56,6 +57,7 @@ void main() { 0.0, inner_df ); + vec4 strokeColor = u_stroke_color == vec4(0) ? v_color : u_stroke_color; - gl_FragColor = opacity_t * mix(v_color * u_opacity, u_stroke_color * u_stroke_opacity, color_t); + gl_FragColor = opacity_t * mix(vec4(v_color.rgb, v_color.a * u_opacity), strokeColor * u_stroke_opacity, color_t); } diff --git a/packages/layers/src/point/shaders/fill_vert.glsl b/packages/layers/src/point/shaders/fill_vert.glsl index dc9a93d76e..af5cb17eb2 100644 --- a/packages/layers/src/point/shaders/fill_vert.glsl +++ b/packages/layers/src/point/shaders/fill_vert.glsl @@ -10,7 +10,9 @@ uniform float u_stroke_width : 2; varying vec4 v_data; varying vec4 v_color; varying float v_radius; + #pragma include "projection" +#pragma include "picking" void main() { // unpack color(vec2) @@ -33,4 +35,6 @@ void main() { // construct point coords v_data = vec4(extrude, antialiasblur, shape_type); + + setPickingColor(a_PickingColor); } diff --git a/packages/layers/src/point/shaders/image_frag.glsl b/packages/layers/src/point/shaders/image_frag.glsl index a7a2e01450..58992a075f 100644 --- a/packages/layers/src/point/shaders/image_frag.glsl +++ b/packages/layers/src/point/shaders/image_frag.glsl @@ -1,12 +1,26 @@ + uniform sampler2D u_texture; varying vec4 v_color; varying vec2 v_uv; +uniform vec2 u_textSize; +uniform float u_stroke_width : 1; +uniform vec4 u_stroke_color : [1, 1, 1, 1]; +uniform float u_stroke_opacity : 1; +uniform float u_opacity : 1; + +varying float v_size; void main(){ - vec2 pos= v_uv + gl_PointCoord / vec2(1024.,128.)* 64.; -// pos.y= 1.- pos.y; +vec2 pos= v_uv / u_textSize + gl_PointCoord / u_textSize * 64.; +vec2 fragmentPosition = 2.0*gl_PointCoord - 1.0; +float distance = length(fragmentPosition); +float distanceSqrd = distance * distance; +float radius = 1.; +float r = 1.0 - smoothstep(radius-(radius*0.01), + radius+(radius*0.01), + distanceSqrd); vec4 textureColor=texture2D(u_texture,pos); if(v_color == vec4(0.)){ - gl_FragColor= textureColor; + gl_FragColor= vec4(textureColor.xyz, textureColor.w * r); }else { gl_FragColor= step(0.01, textureColor.x) * v_color; } diff --git a/packages/layers/src/point/shaders/image_vert.glsl b/packages/layers/src/point/shaders/image_vert.glsl index 5b86d4df16..7aa6a25aa7 100644 --- a/packages/layers/src/point/shaders/image_vert.glsl +++ b/packages/layers/src/point/shaders/image_vert.glsl @@ -1,3 +1,4 @@ + precision highp float; attribute vec3 a_Position; attribute vec4 a_Color; @@ -6,12 +7,18 @@ attribute float a_Size; varying vec4 v_color; varying vec2 v_uv; uniform mat4 u_ModelMatrix; +uniform float u_stroke_width : 1; +varying float v_size; + #pragma include "projection" + void main() { v_color = a_Color; v_uv = a_Uv; vec4 project_pos = project_position(vec4(a_Position, 1.0)); + v_size = a_Size; + gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); - gl_PointSize = a_Size; + gl_PointSize = a_Size * 2.0 * u_DevicePixelRatio; } diff --git a/packages/layers/src/point/shaders/text_frag.glsl b/packages/layers/src/point/shaders/text_frag.glsl index c10cd7a96a..d3dfa93034 100644 --- a/packages/layers/src/point/shaders/text_frag.glsl +++ b/packages/layers/src/point/shaders/text_frag.glsl @@ -18,10 +18,10 @@ void main() { lowp float buff = (6.0 - u_strokeWidth / fontScale) / SDF_PX; highp float gamma = (u_halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale); - + highp float gamma_scaled = gamma * v_gamma_scale; highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist); gl_FragColor = mix(v_color * u_opacity, u_stroke, smoothstep(0., 0.5, 1. - dist)) * alpha; -} \ No newline at end of file +} diff --git a/packages/layers/src/point/text.ts b/packages/layers/src/point/text.ts index 21c8958b1c..d31753e987 100644 --- a/packages/layers/src/point/text.ts +++ b/packages/layers/src/point/text.ts @@ -56,7 +56,7 @@ export default class TextLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, }, }), ); diff --git a/packages/layers/src/polygon/index.ts b/packages/layers/src/polygon/index.ts index ec6fee9464..cf37f37f66 100644 --- a/packages/layers/src/polygon/index.ts +++ b/packages/layers/src/polygon/index.ts @@ -40,7 +40,7 @@ export default class PolygonLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, }, }), ); diff --git a/packages/layers/src/polygon/polygon3D.ts b/packages/layers/src/polygon/polygon3D.ts index 9e981a4e19..3c33e2f089 100644 --- a/packages/layers/src/polygon/polygon3D.ts +++ b/packages/layers/src/polygon/polygon3D.ts @@ -26,7 +26,7 @@ export default class PointLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1.0, + u_opacity: opacity || 1.0, }, }), ); diff --git a/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl b/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl index 72a94d2edc..6a07a19084 100644 --- a/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl +++ b/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl @@ -1,10 +1,10 @@ -uniform float u_Opacity: 1.0; +uniform float u_opacity: 1.0; varying vec4 v_Color; #pragma include "picking" void main() { gl_FragColor = v_Color; - gl_FragColor.a *= u_Opacity; + gl_FragColor.a *= u_opacity; gl_FragColor = filterColor(gl_FragColor); } diff --git a/packages/layers/src/polygon/shaders/polygon_frag.glsl b/packages/layers/src/polygon/shaders/polygon_frag.glsl index 6543d1b4d5..6a07a19084 100644 --- a/packages/layers/src/polygon/shaders/polygon_frag.glsl +++ b/packages/layers/src/polygon/shaders/polygon_frag.glsl @@ -1,10 +1,10 @@ -uniform float u_Opacity: 1.0; +uniform float u_opacity: 1.0; varying vec4 v_Color; #pragma include "picking" void main() { gl_FragColor = v_Color; - gl_FragColor.a *= u_Opacity; + gl_FragColor.a *= u_opacity; gl_FragColor = filterColor(gl_FragColor); -} \ No newline at end of file +} diff --git a/packages/layers/src/raster/image.ts b/packages/layers/src/raster/image.ts index 74a6e84465..38c29f6569 100644 --- a/packages/layers/src/raster/image.ts +++ b/packages/layers/src/raster/image.ts @@ -40,7 +40,7 @@ export default class ImageLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1, + u_opacity: opacity || 1, u_texture: this.texture, }, }), diff --git a/packages/layers/src/raster/raster.ts b/packages/layers/src/raster/raster.ts index 011eaef5bd..8a4d87bc83 100644 --- a/packages/layers/src/raster/raster.ts +++ b/packages/layers/src/raster/raster.ts @@ -48,7 +48,7 @@ export default class RasterLayer extends BaseLayer { this.models.forEach((model) => model.draw({ uniforms: { - u_Opacity: opacity || 1, + u_opacity: opacity || 1, u_texture: this.texture, u_min: min, u_width: width, diff --git a/packages/layers/src/raster/shaders/raster_frag.glsl b/packages/layers/src/raster/shaders/raster_frag.glsl index bc97a61bcb..8c56cd6d8d 100644 --- a/packages/layers/src/raster/shaders/raster_frag.glsl +++ b/packages/layers/src/raster/shaders/raster_frag.glsl @@ -1,9 +1,9 @@ varying vec4 v_color; -uniform float u_Opacity: 1.0; +uniform float u_opacity: 1.0; #define PI 3.141592653589793 void main() { gl_FragColor = v_color; - gl_FragColor.a *= u_Opacity; + gl_FragColor.a *= u_opacity; } diff --git a/packages/layers/src/utils/polylineNormal.ts b/packages/layers/src/utils/polylineNormal.ts index ddfed304a3..3ac7ee0d54 100644 --- a/packages/layers/src/utils/polylineNormal.ts +++ b/packages/layers/src/utils/polylineNormal.ts @@ -48,9 +48,10 @@ function addNext( } function lineSegmentDistance(end: vec2, start: vec2) { - const dx = start[0] - end[0]; - const dy = start[1] - end[1]; - // const dz = start[2] - end[2]; + const a1 = aProjectFlat([start[0], start[1]]); + const b1 = aProjectFlat([end[0], end[1]]); + const dx = a1[0] - b1[0]; + const dy = a1[1] - b1[1]; return Math.sqrt(dx * dx + dy * dy); } @@ -212,12 +213,14 @@ export default function( } const pickData = []; for (let i = 0; i < miters.length; i++) { + const totalDistance = attrDistance[attrDistance.length - 1]; pickData.push( attrPos[i * 3], attrPos[i * 3 + 1], attrPos[i * 3 + 1], attrDistance[i], miters[i], + totalDistance, ); } return { diff --git a/packages/maps/src/amap/Viewport.ts b/packages/maps/src/amap/Viewport.ts index 0338737dd6..d7b63e5ca5 100644 --- a/packages/maps/src/amap/Viewport.ts +++ b/packages/maps/src/amap/Viewport.ts @@ -24,7 +24,6 @@ export default class Viewport implements IViewport { far = 1000, fov = 0, } = mapCamera; - this.zoom = zoom; this.center = center; diff --git a/packages/maps/src/amap/index.ts b/packages/maps/src/amap/index.ts index c1bbd6cb4f..696f06db42 100644 --- a/packages/maps/src/amap/index.ts +++ b/packages/maps/src/amap/index.ts @@ -10,16 +10,18 @@ import { IMapService, IPoint, IViewport, + MapServiceEvent, MapType, TYPES, } from '@l7/core'; import { DOM } from '@l7/utils'; import { inject, injectable } from 'inversify'; import { IAMapEvent, IAMapInstance } from '../../typings/index'; +import { MapTheme } from './theme'; import Viewport from './Viewport'; const AMAP_API_KEY: string = '15cd8a57710d40c9b7c0e3cc120f1200'; -const AMAP_VERSION: string = '1.4.8'; +const AMAP_VERSION: string = '1.4.15'; const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12; /** @@ -31,8 +33,9 @@ export default class AMapService implements IMapService { @inject(TYPES.ICoordinateSystemService) private readonly coordinateSystemService: ICoordinateSystemService; + @inject(TYPES.IEventEmitter) + private eventEmitter: IEventEmitter; private markerContainer: HTMLElement; - private $mapContainer: HTMLElement | null; private $jsapi: HTMLScriptElement; @@ -56,9 +59,12 @@ export default class AMapService implements IMapService { // map event public on(type: string, handle: (...args: any[]) => void): void { - this.map.on(type, handle); + if (MapServiceEvent.indexOf(type) !== -1) { + this.eventEmitter.on(type, handle); + } else { + this.map.on(type, handle); + } } - public off(type: string, handle: (...args: any[]) => void): void { this.map.off(type, handle); } @@ -137,7 +143,7 @@ export default class AMapService implements IMapService { this.map.setZoomAndCenter(zoom, center); } public setMapStyle(style: string): void { - this.setMapStyle(style); + this.map.setMapStyle(this.getMapStyle(style)); } public pixelToLngLat(pixel: [number, number]): ILngLat { const lngLat = this.map.pixelToLngLat(new AMap.Pixel(pixel[0], pixel[1])); @@ -168,10 +174,18 @@ export default class AMapService implements IMapService { } public async init(mapConfig: IMapConfig): Promise { - const { id, style, ...rest } = mapConfig; + const { + id, + style = 'light', + minZoom = 0, + maxZoom = 18, + ...rest + } = mapConfig; this.$mapContainer = document.getElementById(id); + // this.eventEmitter = container.get(TYPES.IEventEmitter); + // tslint:disable-next-line:typedef await new Promise((resolve) => { // 异步加载高德地图 @@ -179,13 +193,15 @@ export default class AMapService implements IMapService { window.onload = (): void => { // @ts-ignore this.map = new AMap.Map(id, { - mapStyle: style, + mapStyle: this.getMapStyle(style), + zooms: [minZoom, maxZoom], viewMode: '3D', ...rest, }); // 监听地图相机时间 this.map.on('camerachange', this.handleCameraChanged); + this.emit('mapload'); resolve(); }; @@ -198,10 +214,20 @@ export default class AMapService implements IMapService { this.viewport = new Viewport(); } + public emit(name: string, ...args: any[]) { + this.eventEmitter.emit(name, ...args); + } + + public once(name: string, ...args: any[]) { + this.eventEmitter.once(name, ...args); + } public destroy() { - this.map.destroy(); - document.head.removeChild(this.$jsapi); + this.eventEmitter.removeAllListeners(); + if (this.map) { + this.map.destroy(); + document.head.removeChild(this.$jsapi); + } } public getMapContainer() { @@ -224,7 +250,6 @@ export default class AMapService implements IMapService { position, } = e.camera; const { lng, lat } = this.getCenter(); - if (this.cameraChangedCallback) { // resync viewport this.viewport.syncWithMapCamera({ @@ -244,15 +269,20 @@ export default class AMapService implements IMapService { }); // set coordinate system - if (this.viewport.getZoom() > LNGLAT_OFFSET_ZOOM_THRESHOLD) { - this.coordinateSystemService.setCoordinateSystem( - CoordinateSystem.P20_OFFSET, - ); - } else { - this.coordinateSystemService.setCoordinateSystem(CoordinateSystem.P20); - } - + // if (this.viewport.getZoom() > LNGLAT_OFFSET_ZOOM_THRESHOLD) { + // // TODO:偏移坐标系高德地图不支持 pith bear 同步 + // this.coordinateSystemService.setCoordinateSystem( + // CoordinateSystem.P20_OFFSET, + // ); + // } else { + // this.coordinateSystemService.setCoordinateSystem(CoordinateSystem.P20); + // } + this.coordinateSystemService.setCoordinateSystem(CoordinateSystem.P20); this.cameraChangedCallback(this.viewport); } }; + + private getMapStyle(name: string) { + return MapTheme[name] ? MapTheme[name] : name; + } } diff --git a/packages/maps/src/amap/theme.ts b/packages/maps/src/amap/theme.ts new file mode 100644 index 0000000000..ce284d7338 --- /dev/null +++ b/packages/maps/src/amap/theme.ts @@ -0,0 +1,7 @@ +export const MapTheme: { + [key: string]: any; +} = { + dark: 'amap://styles/2a09079c3daac9420ee53b67307a8006?isPublic=true', + light: 'amap://styles/1fd9f8ef9751298f11f5c56968312c70?isPublic=true', + normal: 'amap://styles/12db649ba3493333b098127ed892c0cb?isPublic=true', +}; diff --git a/packages/maps/src/map.ts b/packages/maps/src/map.ts new file mode 100644 index 0000000000..25f1799d7d --- /dev/null +++ b/packages/maps/src/map.ts @@ -0,0 +1,34 @@ +import { + Bounds, + container, + CoordinateSystem, + ICoordinateSystemService, + ILngLat, + IMapConfig, + IMapService, + IPoint, + IViewport, + MapType, + TYPES, +} from '@l7/core'; +import { DOM } from '@l7/utils'; +import { inject, injectable } from 'inversify'; +import { IAMapEvent, IAMapInstance } from '../typings/index'; + +@injectable() +export default class MapService implements IMapService { + public map: MapInstance; + + @inject(TYPES.ICoordinateSystemService) + protected readonly coordinateSystemService: ICoordinateSystemService; + @inject(TYPES.IEventEmitter) + protected eventEmitter: IEventEmitter; + protected markerContainer: HTMLElement; + protected $mapContainer: HTMLElement | null; + + private cameraChangedCallback: (viewport: IViewport) => void; + + public getMarkerContainer(): HTMLElement { + return this.markerContainer; + } +} diff --git a/packages/maps/src/mapbox/index.ts b/packages/maps/src/mapbox/index.ts index 2ce6f0d59c..218a89788b 100644 --- a/packages/maps/src/mapbox/index.ts +++ b/packages/maps/src/mapbox/index.ts @@ -10,6 +10,7 @@ import { IMapService, IPoint, IViewport, + MapServiceEvent, MapType, TYPES, } from '@l7/core'; @@ -24,7 +25,7 @@ const EventMap: { mapmove: 'move', camerachange: 'move', }; - +import { MapTheme } from './theme'; mapboxgl.accessToken = 'pk.eyJ1IjoieGlhb2l2ZXIiLCJhIjoiY2pxcmc5OGNkMDY3cjQzbG42cXk5NTl3YiJ9.hUC5Chlqzzh0FFd_aEc-uQ'; const LNGLAT_OFFSET_ZOOM_THRESHOLD = 12; @@ -37,6 +38,9 @@ export default class MapboxService implements IMapService { public map: Map & IMapboxInstance; @inject(TYPES.ICoordinateSystemService) private readonly coordinateSystemService: ICoordinateSystemService; + + @inject(TYPES.IEventEmitter) + private eventEmitter: IEventEmitter; private viewport: Viewport; private markerContainer: HTMLElement; private cameraChangedCallback: (viewport: IViewport) => void; @@ -55,7 +59,12 @@ export default class MapboxService implements IMapService { // map event public on(type: string, handle: (...args: any[]) => void): void { - this.map.on(EventMap[type] || type, handle); + if (MapServiceEvent.indexOf('mapload') !== -1) { + this.eventEmitter.on(type, handle); + } else { + // 统一事件名称 + this.map.on(EventMap[type] || type, handle); + } } public off(type: string, handle: (...args: any[]) => void): void { this.map.off(EventMap[type] || type, handle); @@ -142,7 +151,7 @@ export default class MapboxService implements IMapService { } public setMapStyle(style: string): void { - this.map.setStyle(style); + this.map.setStyle(this.getMapStyle(style)); } // TODO: 计算像素坐标 public pixelToLngLat(pixel: [number, number]): ILngLat { @@ -162,7 +171,12 @@ export default class MapboxService implements IMapService { } public async init(mapConfig: IMapConfig): Promise { - const { id, attributionControl = false, ...rest } = mapConfig; + const { + id, + attributionControl = false, + style = 'light', + ...rest + } = mapConfig; this.$mapContainer = document.getElementById(id); this.viewport = new Viewport(); @@ -174,9 +188,11 @@ export default class MapboxService implements IMapService { // @ts-ignore this.map = new mapboxgl.Map({ container: id, + style: this.getMapStyle(style), attributionControl, ...rest, }); + this.map.on('load', this.handleCameraChanged); this.map.on('move', this.handleCameraChanged); // 不同于高德地图,需要手动触发首次渲染 @@ -191,9 +207,18 @@ export default class MapboxService implements IMapService { } public destroy() { - document.head.removeChild(this.$link); - this.$mapContainer = null; - this.map.remove(); + this.eventEmitter.removeAllListeners(); + if (this.map) { + this.map.remove(); + document.head.removeChild(this.$link); + this.$mapContainer = null; + } + } + public emit(name: string, ...args: any[]) { + this.eventEmitter.emit(name, ...args); + } + public once(name: string, ...args: any[]) { + this.eventEmitter.once(name, ...args); } public getMapContainer() { @@ -234,6 +259,7 @@ export default class MapboxService implements IMapService { this.cameraChangedCallback(this.viewport); }; + private removeLogoControl(): void { // @ts-ignore const controls = this.map._controls as IControl[]; @@ -246,4 +272,8 @@ export default class MapboxService implements IMapService { this.map.removeControl(logoCtr); } } + + private getMapStyle(name: string) { + return MapTheme[name] ? MapTheme[name] : name; + } } diff --git a/packages/maps/src/mapbox/theme.ts b/packages/maps/src/mapbox/theme.ts new file mode 100644 index 0000000000..9b16ab1e5c --- /dev/null +++ b/packages/maps/src/mapbox/theme.ts @@ -0,0 +1,7 @@ +export const MapTheme: { + [key: string]: any; +} = { + light: 'mapbox://styles/zcxduo/ck233y3ru1di71cnulo9jdg2v', + dark: 'mapbox://styles/zcxduo/ck241p6413s0b1cpayzldv7x7', + normal: 'mapbox://styles/zcxduo/ck2mzfaem0vdw1covi2yy793s', +}; diff --git a/packages/maps/typings/index.d.ts b/packages/maps/typings/index.d.ts index e4dcf73132..2cc081b0c5 100644 --- a/packages/maps/typings/index.d.ts +++ b/packages/maps/typings/index.d.ts @@ -1,4 +1,5 @@ /// +/// import { IControl } from 'mapbox-gl'; @@ -29,3 +30,22 @@ interface IMapboxInstance { height: number; }; } +interface IEventEmitter { + emit(event: EventTypes, ...args: any[]): boolean; + /** + * Add a listener for a given event. + */ + on(event: EventTypes, handle: (...args: any[]) => void, context?: any): this; + + off( + event: EventTypes, + handle: (...args: any[]) => void, + context?: any, + once?: boolean, + ): this; + + /** + * Remove all listeners, or those of the specified event. + */ + removeAllListeners(event?: EventTypes): this; +} diff --git a/packages/renderer/src/regl/ReglModel.ts b/packages/renderer/src/regl/ReglModel.ts index 16730973cb..661d4f4a79 100644 --- a/packages/renderer/src/regl/ReglModel.ts +++ b/packages/renderer/src/regl/ReglModel.ts @@ -85,7 +85,6 @@ export default class ReglModel implements IModel { this.initBlendDrawParams({ blend }, drawParams); this.initStencilDrawParams({ stencil }, drawParams); this.initCullDrawParams({ cull }, drawParams); - this.drawCommand = reGl(drawParams); } @@ -132,7 +131,6 @@ export default class ReglModel implements IModel { | ReglTexture2D).get(); } }); - this.drawCommand(reglDrawProps); } diff --git a/packages/scene/package.json b/packages/scene/package.json index 09fde486c7..1787e32e86 100644 --- a/packages/scene/package.json +++ b/packages/scene/package.json @@ -22,6 +22,7 @@ "@l7/core": "^0.0.1", "@l7/maps": "^0.0.1", "@l7/renderer": "^0.0.1", + "@l7/component": "^0.0.1", "mapbox-gl": "^1.2.1", "inversify": "^5.0.1", "inversify-inject-decorators": "^3.1.0", diff --git a/packages/scene/src/index.ts b/packages/scene/src/index.ts index ca35343e94..3b0243cd73 100644 --- a/packages/scene/src/index.ts +++ b/packages/scene/src/index.ts @@ -1,3 +1,4 @@ +import { Logo } from '@l7/component'; import { Bounds, container, @@ -6,6 +7,7 @@ import { IIconService, IImage, ILayer, + ILayerService, ILngLat, IMapConfig, IMapService, @@ -64,16 +66,16 @@ let mapType: MapType; * scene.render(); */ class Scene { - public map: AMap.Map | Map; + // public map: AMap.Map | Map; private sceneService: ISceneService; private mapService: IMapService; private controlService: IControlService; + private layerService: ILayerService; private iconService: IIconService; public constructor(config: IMapConfig & IRenderConfig) { const { type = MapType.amap } = config; - // 根据用户传入参数绑定地图服务 let mapServiceImpl: new (...args: any[]) => IMapService; if (type === MapType.mapbox) { @@ -104,8 +106,11 @@ class Scene { this.mapService = container.get(TYPES.IMapService); this.iconService = container.get(TYPES.IIconService); this.controlService = container.get(TYPES.IControlService); - this.map = this.mapService.map; // 暴露原生map方法 + this.layerService = container.get(TYPES.ILayerService); mapType = this.mapService.getType(); + // 初始化 scene + + this.init(); } public getMapService(): IMapService { @@ -113,10 +118,26 @@ class Scene { // } + public get map() { + return this.mapService.map; + } + public addLayer(layer: ILayer): void { this.sceneService.addLayer(layer); } + public getLayers(): ILayer[] { + return this.layerService.getLayers(); + } + + public getLayer(id: string): ILayer | undefined { + return this.layerService.getLayer(id); + } + + public removeLayer(layer: ILayer): void { + this.layerService.remove(layer); + } + public render(): void { this.sceneService.render(); } @@ -136,7 +157,13 @@ class Scene { // map control method public addControl(ctr: IControl) { - this.controlService.addControl(ctr, this.mapService); + if (this.mapService.map) { + this.controlService.addControl(ctr, this.mapService); + } else { + this.mapService.once('mapload', () => { + this.controlService.addControl(ctr, this.mapService); + }); + } } public removeControl(ctr: IControl) { @@ -238,6 +265,15 @@ class Scene { // TODO: 清理其他 Service 例如 IconService } + private init(): void { + this.initControl(); + this.render(); + } + + private initControl(): void { + this.addControl(new Logo()); + } + // 资源管理 } diff --git a/packages/source/src/transform/grid.ts b/packages/source/src/transform/grid.ts index 54aada184d..1d829ea49a 100644 --- a/packages/source/src/transform/grid.ts +++ b/packages/source/src/transform/grid.ts @@ -19,8 +19,8 @@ export function aggregatorToGrid(data: IParserData, option: ITransform) { const { gridHash, gridOffset } = _pointsGridHash(dataArray, size); const layerData = _getGridLayerDataFromGridHash(gridHash, gridOffset, option); return { - yOffset: gridOffset.yOffset / 1.8, - xOffset: gridOffset.xOffset / 1.8, + yOffset: gridOffset.yOffset / 1.6, + xOffset: gridOffset.xOffset / 1.6, radius: gridOffset.xOffset, dataArray: layerData, }; diff --git a/site/locale.json b/site/locale.json new file mode 100644 index 0000000000..e69de29bb2 diff --git a/site/pages/index.en.ts b/site/pages/index.en.ts new file mode 100644 index 0000000000..4816cd94d3 --- /dev/null +++ b/site/pages/index.en.ts @@ -0,0 +1,2 @@ +import Index from './index.zh'; +export default Index; diff --git a/site/pages/index.zh.ts b/site/pages/index.zh.ts new file mode 100644 index 0000000000..41eb5c9ca2 --- /dev/null +++ b/site/pages/index.zh.ts @@ -0,0 +1,5 @@ +const IndexPage = () => { + return 'test'; +}; + +export default IndexPage; diff --git a/stories/Animation/components/Polygon.tsx b/stories/Animation/components/Polygon.tsx index be6b7594ad..3786c27b78 100644 --- a/stories/Animation/components/Polygon.tsx +++ b/stories/Animation/components/Polygon.tsx @@ -56,7 +56,7 @@ export default class Mapbox extends React.Component { ]) .shape('fill') .style({ - opacity: 0.8, + opacity: 0.3, }); scene.addLayer(layer); scene.render(); diff --git a/stories/Layers/components/Line.tsx b/stories/Layers/components/Line.tsx index 55dd4d5bcb..e3542876d2 100644 --- a/stories/Layers/components/Line.tsx +++ b/stories/Layers/components/Line.tsx @@ -57,7 +57,7 @@ export default class LineDemo extends React.Component { '#002466', ].reverse(), ) - .render(); + scene.addLayer(lineLayer); scene.render(); this.scene = scene; diff --git a/stories/Layers/components/Point.tsx b/stories/Layers/components/Point.tsx index 00c39467ce..303a9217d6 100644 --- a/stories/Layers/components/Point.tsx +++ b/stories/Layers/components/Point.tsx @@ -53,7 +53,11 @@ export default class Point3D extends React.Component { 'rhombus', 'vesica', ]) - .size('scalerank', [2, 4, 6, 8, 10]); + .size('scalerank', [5,10]) + .style({ + opacity: 1.0 + }) + ; scene.addLayer(pointLayer); console.log(pointLayer); scene.render(); diff --git a/stories/Layers/components/heatMap.tsx b/stories/Layers/components/heatMap.tsx index 4dc2c55241..932a838c23 100644 --- a/stories/Layers/components/heatMap.tsx +++ b/stories/Layers/components/heatMap.tsx @@ -23,7 +23,7 @@ export default class HeatMapLayerDemo extends React.Component { zoom: 2, }); const layer = new HeatMapLayer({ - enableTAA: true, + enableTAA: false, }); layer .source(await response.json()) @@ -31,10 +31,9 @@ export default class HeatMapLayerDemo extends React.Component { .style({ intensity: 2, radius: 20, - opacity: 0.5, + opacity: 0.6, rampColors: { colors: [ - 'rgba(0,0,0,0)', '#2E8AE6', '#69D1AB', '#DAF291', @@ -42,7 +41,7 @@ export default class HeatMapLayerDemo extends React.Component { '#FF7A45', '#CF1D49', ], - positions: [0, 0.1, 0.2, 0.4, 0.6, 0.8, 1.0], + positions: [0,0.2, 0.4, 0.6, 0.8, 1.0], }, }); scene.addLayer(layer); diff --git a/stories/Layers/components/pointImage.tsx b/stories/Layers/components/pointImage.tsx index 7d2dcf820f..1d35687395 100644 --- a/stories/Layers/components/pointImage.tsx +++ b/stories/Layers/components/pointImage.tsx @@ -1,4 +1,4 @@ -import { PointImageLayer } from '@l7/layers'; +import { PointImageLayer, PointLayer } from '@l7/layers'; import { Scene } from '@l7/scene'; import * as React from 'react'; import data from '../data/data.json'; @@ -9,39 +9,51 @@ export default class PointImage extends React.Component { this.scene.destroy(); } - public componentDidMount() { + public async componentDidMount() { + const response = await fetch( + 'https://gw.alipayobjects.com/os/basement_prod/893d1d5f-11d9-45f3-8322-ee9140d288ae.json', + ); const scene = new Scene({ - center: [120.19382669582967, 30.258134], + center: [121.40, 31.258134], + zoom: 15, id: 'map', pitch: 0, type: 'mapbox', style: 'mapbox://styles/mapbox/streets-v9', - zoom: 1, }); - const pointLayer = new PointImageLayer({}); - const p1 = { - type: 'FeatureCollection', - features: [ - { - type: 'Feature', - properties: {}, - geometry: { - type: 'Point', - coordinates: [83.671875, 44.84029065139799], - }, - }, - ], - }; scene.addImage( '00', - 'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*kzTMQqS2QdUAAAAAAAAAAABkARQnAQ', + 'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*Rq6tQ5b4_JMAAAAAAAAAAABkARQnAQ', ); - pointLayer - .source(data) - .shape('00') - .size(30); - scene.addLayer(pointLayer); - scene.render(); + scene.addImage( + '01', + 'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*0D0SQ6AgkRMAAAAAAAAAAABkARQnAQ', + ); + scene.addImage( + '02', + 'https://gw.alipayobjects.com/mdn/antv_site/afts/img/A*o16fSIvcKdUAAAAAAAAAAABkARQnAQ', + ); + this.scene = scene; + scene.on('loaded', () => { + run(); + }); + const imageLayer = new PointImageLayer({}) + .source(await response.json(), { + parser: { + type: 'json', + x: 'longitude', + y: 'latitude', + } + }) + .shape('name', ['00', '01', '02']) + .size(60); + scene.addLayer(imageLayer); + + function run() { + scene.render(); + console.log('render'); + requestAnimationFrame(run); + } this.scene = scene; } diff --git a/stories/Picking/components/Highlight.tsx b/stories/Picking/components/Highlight.tsx index 3211675500..6c004bd8cb 100644 --- a/stories/Picking/components/Highlight.tsx +++ b/stories/Picking/components/Highlight.tsx @@ -38,7 +38,7 @@ export default class Highlight extends React.Component { highlightColor: [0, 0, 1, 1], onHover: (pickedFeature) => { // tslint:disable-next-line:no-console - console.log(pickedFeature); + // console.log(pickedFeature); }, }); @@ -59,7 +59,7 @@ export default class Highlight extends React.Component { }); scene.addLayer(layer); scene.render(); - + console.log(layer); this.scene = scene; /*** 运行时修改样式属性 ***/ diff --git a/stories/Picking/components/Tooltip.tsx b/stories/Picking/components/Tooltip.tsx index 120f0dc957..d833036b65 100644 --- a/stories/Picking/components/Tooltip.tsx +++ b/stories/Picking/components/Tooltip.tsx @@ -29,7 +29,7 @@ export default class Mapbox extends React.Component { enableHighlight: false, onHover: (pickedFeature) => { // tslint:disable-next-line:no-console - console.log(pickedFeature); + // console.log(pickedFeature); }, }); diff --git a/tslint.json b/tslint.json index 8cd0ecd6f6..25de824011 100644 --- a/tslint.json +++ b/tslint.json @@ -17,5 +17,8 @@ "no-bitwise": false, "object-literal-sort-keys": false, "no-implicit-dependencies": false + }, + "globals": { + "AMap": true } } diff --git a/tslint.prod.json b/tslint.prod.json index 3cae08d96e..24d12a308b 100644 --- a/tslint.prod.json +++ b/tslint.prod.json @@ -6,4 +6,4 @@ "linterOptions": { "exclude": ["**/*.d.ts", "**/*.{test,story}.ts{,x}"] } -} \ No newline at end of file +}