ol-stac 1.0.0-beta.6 → 1.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.github/workflows/deploy.yml +67 -0
- package/.github/workflows/publish.yml +32 -0
- package/.github/workflows/release.yml +21 -0
- package/.github/workflows/test.yml +82 -0
- package/CHANGELOG.md +57 -0
- package/DEVELOPING.md +104 -0
- package/config/jsdoc/api/conf.json +37 -0
- package/config/jsdoc/api/index.md +3 -0
- package/config/jsdoc/api/readme.md +61 -0
- package/config/jsdoc/api/template/README.md +3 -0
- package/config/jsdoc/api/template/publish.js +743 -0
- package/config/jsdoc/api/template/static/scripts/linenumber.js +11 -0
- package/config/jsdoc/api/template/static/scripts/main.js +305 -0
- package/config/jsdoc/api/template/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/config/jsdoc/api/template/static/scripts/prettify/lang-css.js +2 -0
- package/config/jsdoc/api/template/static/scripts/prettify/prettify.js +28 -0
- package/config/jsdoc/api/template/static/styles/carbon.css +65 -0
- package/config/jsdoc/api/template/static/styles/jaguar.css +512 -0
- package/config/jsdoc/api/template/static/styles/prettify-jsdoc.css +111 -0
- package/config/jsdoc/api/template/static/styles/prettify-tomorrow.css +132 -0
- package/config/jsdoc/api/template/static/theme +1 -0
- package/config/jsdoc/api/template/tmpl/container.tmpl +197 -0
- package/config/jsdoc/api/template/tmpl/details.tmpl +84 -0
- package/config/jsdoc/api/template/tmpl/example.tmpl +2 -0
- package/config/jsdoc/api/template/tmpl/examples.tmpl +16 -0
- package/config/jsdoc/api/template/tmpl/exceptions.tmpl +30 -0
- package/config/jsdoc/api/template/tmpl/layout.tmpl +93 -0
- package/config/jsdoc/api/template/tmpl/mainpage.tmpl +14 -0
- package/config/jsdoc/api/template/tmpl/members.tmpl +38 -0
- package/config/jsdoc/api/template/tmpl/method.tmpl +132 -0
- package/config/jsdoc/api/template/tmpl/navigation.tmpl +59 -0
- package/config/jsdoc/api/template/tmpl/observables.tmpl +39 -0
- package/config/jsdoc/api/template/tmpl/params.tmpl +109 -0
- package/config/jsdoc/api/template/tmpl/properties.tmpl +85 -0
- package/config/jsdoc/api/template/tmpl/returns.tmpl +72 -0
- package/config/jsdoc/api/template/tmpl/source.tmpl +8 -0
- package/config/jsdoc/api/template/tmpl/stability.tmpl +7 -0
- package/config/jsdoc/api/template/tmpl/tutorial.tmpl +19 -0
- package/config/jsdoc/api/template/tmpl/type.tmpl +7 -0
- package/config/jsdoc/info/conf.json +22 -0
- package/config/jsdoc/info/publish.js +175 -0
- package/config/jsdoc/package.json +4 -0
- package/config/jsdoc/plugins/api.cjs +163 -0
- package/config/jsdoc/plugins/default-export.cjs +35 -0
- package/config/jsdoc/plugins/define-plugin.cjs +33 -0
- package/config/jsdoc/plugins/events.cjs +39 -0
- package/config/jsdoc/plugins/inline-options.cjs +102 -0
- package/config/jsdoc/plugins/markdown.cjs +119 -0
- package/config/jsdoc/plugins/virtual-plugin.cjs +16 -0
- package/config/tsconfig-build.json +25 -0
- package/examples/.eslintrc +29 -0
- package/examples/index.html +100 -0
- package/examples/index.js +109 -0
- package/examples/planetary-computer.html +14 -0
- package/examples/planetary-computer.js +56 -0
- package/examples/resources/Jugl.js +15 -0
- package/examples/resources/common.js +111 -0
- package/examples/stac-collection-pmtiles-raster.html +9 -0
- package/examples/stac-collection-pmtiles-raster.js +55 -0
- package/examples/stac-collection-pmtiles-vector.html +9 -0
- package/examples/stac-collection-pmtiles-vector.js +58 -0
- package/examples/stac-collection-wms.html +9 -0
- package/examples/stac-collection-wms.js +56 -0
- package/examples/stac-item-from-object.html +9 -0
- package/examples/stac-item-from-object.js +102 -0
- package/examples/stac-item-tileserver.html +9 -0
- package/examples/stac-item-tileserver.js +34 -0
- package/examples/stac-item.html +9 -0
- package/examples/stac-item.js +45 -0
- package/examples/stac-itemcollection.html +11 -0
- package/examples/stac-itemcollection.js +39 -0
- package/examples/templates/example.html +206 -0
- package/examples/templates/readme.md +3 -0
- package/examples/webpack/config.mjs +69 -0
- package/examples/webpack/example-builder.js +411 -0
- package/package.json +77 -2
- package/site/build.js +26 -0
- package/site/layouts/default.hbs +82 -0
- package/site/src/doc/faq.md +40 -0
- package/site/src/doc/index.md +16 -0
- package/site/src/doc/quickstart.md +45 -0
- package/site/src/doc/tutorials/index.md +8 -0
- package/site/src/download/index.hbs +47 -0
- package/site/src/favicon.ico +0 -0
- package/site/src/index.hbs +94 -0
- package/site/src/theme/index.css +26 -0
- package/site/src/theme/site.css +531 -0
- package/{events → src/ol/events}/ErrorEvent.js +12 -10
- package/src/ol/layer/STAC.js +860 -0
- package/{source → src/ol/source}/GeoTIFF2.js +16 -9
- package/src/ol/source/type.js +108 -0
- package/src/ol/util.js +183 -0
- package/tasks/.eslintrc +5 -0
- package/tasks/build-website.sh +90 -0
- package/tasks/create-release.js +107 -0
- package/tasks/get-latest-release.js +36 -0
- package/tasks/newest-tag.js +47 -0
- package/tasks/prepare-package.js +41 -0
- package/tasks/publish.sh +90 -0
- package/test/README.md +56 -0
- package/test/browser/.eslintrc +14 -0
- package/test/browser/karma.config.cjs +94 -0
- package/test/browser/spec/ol/layer/STAC.test.js +18 -0
- package/test/browser/test-extensions.js +419 -0
- package/tsconfig.json +17 -0
- package/events/ErrorEvent.d.ts +0 -20
- package/events/ErrorEvent.d.ts.map +0 -1
- package/events/ErrorEvent.js.map +0 -1
- package/layer/STAC.d.ts +0 -400
- package/layer/STAC.d.ts.map +0 -1
- package/layer/STAC.js +0 -724
- package/layer/STAC.js.map +0 -1
- package/source/GeoTIFF2.d.ts +0 -33
- package/source/GeoTIFF2.d.ts.map +0 -1
- package/source/GeoTIFF2.js.map +0 -1
- package/source/type.d.ts +0 -51
- package/source/type.d.ts.map +0 -1
- package/source/type.js +0 -46
- package/source/type.js.map +0 -1
- package/util.d.ts +0 -58
- package/util.d.ts.map +0 -1
- package/util.js +0 -166
- package/util.js.map +0 -1
package/.eslintignore
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Deploy Website
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- 'v*.*.*'
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: "deploy"
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
deploy-branch:
|
|
15
|
+
if: startsWith(github.ref, 'refs/heads/')
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
- uses: actions/checkout@v3
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
- name: Build Website
|
|
25
|
+
run: ./tasks/build-website.sh -l $(node tasks/get-latest-release.js)
|
|
26
|
+
- uses: actions/checkout@v3
|
|
27
|
+
with:
|
|
28
|
+
ref: gh-pages
|
|
29
|
+
clean: false
|
|
30
|
+
- name: Commit to GitHub Pages
|
|
31
|
+
run: |
|
|
32
|
+
cp -r build/site/* .
|
|
33
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
34
|
+
git config user.name "$(git --no-pager log --format=format:'%an' -n 1)"
|
|
35
|
+
git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
|
|
36
|
+
git add .
|
|
37
|
+
git commit -m "Website updates"
|
|
38
|
+
git push origin gh-pages
|
|
39
|
+
fi
|
|
40
|
+
deploy-tag:
|
|
41
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/setup-node@v3
|
|
45
|
+
with:
|
|
46
|
+
node-version: '20'
|
|
47
|
+
- uses: actions/checkout@v3
|
|
48
|
+
- name: Install dependencies
|
|
49
|
+
run: npm ci
|
|
50
|
+
- name: Assert Latest Release
|
|
51
|
+
run: node tasks/newest-tag.js --tag ${GITHUB_REF_NAME}
|
|
52
|
+
- name: Build Website
|
|
53
|
+
run: ./tasks/build-website.sh -l ${GITHUB_REF_NAME} -v ${GITHUB_REF_NAME}
|
|
54
|
+
- uses: actions/checkout@v3
|
|
55
|
+
with:
|
|
56
|
+
ref: gh-pages
|
|
57
|
+
clean: false
|
|
58
|
+
- name: Commit to GitHub Pages
|
|
59
|
+
run: |
|
|
60
|
+
cp -r build/site/* .
|
|
61
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
62
|
+
git config user.name "$(git --no-pager log --format=format:'%an' -n 1)"
|
|
63
|
+
git config user.email "$(git --no-pager log --format=format:'%ae' -n 1)"
|
|
64
|
+
git add .
|
|
65
|
+
git commit -m "Website updates"
|
|
66
|
+
git push origin gh-pages
|
|
67
|
+
fi
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Publish Package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish-tag:
|
|
14
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
- uses: actions/setup-node@v3
|
|
19
|
+
with:
|
|
20
|
+
node-version: '20'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: npm ci
|
|
24
|
+
- name: Assert Latest Release
|
|
25
|
+
run: node tasks/newest-tag.js --tag ${GITHUB_REF_NAME}
|
|
26
|
+
- name: Publish
|
|
27
|
+
run: |
|
|
28
|
+
npm run build-package
|
|
29
|
+
cd build/ol
|
|
30
|
+
npm publish --provenance
|
|
31
|
+
env:
|
|
32
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Create Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*.*.*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
release:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v3
|
|
13
|
+
- uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: '20'
|
|
16
|
+
- name: Install dependencies
|
|
17
|
+
run: npm ci
|
|
18
|
+
- name: Build Release Assets
|
|
19
|
+
run: ./tasks/build-website.sh -l ${GITHUB_REF_NAME} -v ${GITHUB_REF_NAME}
|
|
20
|
+
- name: Create Release
|
|
21
|
+
run: node tasks/create-release.js --token ${{secrets.GITHUB_TOKEN}} --tag ${GITHUB_REF_NAME} --package build/${GITHUB_REF_NAME}-package.zip --site build/${GITHUB_REF_NAME}-site.zip
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
pull_request:
|
|
8
|
+
branches:
|
|
9
|
+
- main
|
|
10
|
+
|
|
11
|
+
env:
|
|
12
|
+
CI: true
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
pretest:
|
|
19
|
+
name: Pre-Test
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
|
|
22
|
+
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
|
+
|
|
25
|
+
steps:
|
|
26
|
+
- name: Clone Repository
|
|
27
|
+
uses: actions/checkout@v3
|
|
28
|
+
|
|
29
|
+
- name: Set Node.js Version
|
|
30
|
+
uses: actions/setup-node@v3
|
|
31
|
+
with:
|
|
32
|
+
node-version: '16'
|
|
33
|
+
|
|
34
|
+
- name: Install Dependencies
|
|
35
|
+
run: npm ci
|
|
36
|
+
|
|
37
|
+
- name: Run Tests
|
|
38
|
+
run: npm run pretest
|
|
39
|
+
|
|
40
|
+
browser:
|
|
41
|
+
name: Browser
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
|
|
44
|
+
strategy:
|
|
45
|
+
fail-fast: false
|
|
46
|
+
|
|
47
|
+
steps:
|
|
48
|
+
- name: Clone Repository
|
|
49
|
+
uses: actions/checkout@v3
|
|
50
|
+
|
|
51
|
+
- name: Set Node.js Version
|
|
52
|
+
uses: actions/setup-node@v3
|
|
53
|
+
with:
|
|
54
|
+
node-version: '20'
|
|
55
|
+
|
|
56
|
+
- name: Install Dependencies
|
|
57
|
+
run: npm ci
|
|
58
|
+
|
|
59
|
+
- name: Run Tests
|
|
60
|
+
run: npm run test-browser
|
|
61
|
+
|
|
62
|
+
build:
|
|
63
|
+
name: Build
|
|
64
|
+
runs-on: ubuntu-latest
|
|
65
|
+
|
|
66
|
+
strategy:
|
|
67
|
+
fail-fast: false
|
|
68
|
+
|
|
69
|
+
steps:
|
|
70
|
+
- name: Clone Repository
|
|
71
|
+
uses: actions/checkout@v3
|
|
72
|
+
|
|
73
|
+
- name: Set Node.js Version
|
|
74
|
+
uses: actions/setup-node@v3
|
|
75
|
+
with:
|
|
76
|
+
node-version: '20'
|
|
77
|
+
|
|
78
|
+
- name: Install Dependencies
|
|
79
|
+
run: npm ci
|
|
80
|
+
|
|
81
|
+
- name: Build the Package
|
|
82
|
+
run: npm run build-package
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
All notable changes to this project will be documented in this file.
|
|
3
|
+
|
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [1.0.0-beta.7] - 2024-01-26
|
|
10
|
+
|
|
11
|
+
- Added an option to hide footprints (geometry/bounding box) by default
|
|
12
|
+
- Added support for image formats in WMS and WMTS
|
|
13
|
+
- Expose `SourceType` as public API
|
|
14
|
+
- Removed note about Firefox issues in the examples
|
|
15
|
+
|
|
16
|
+
## [1.0.0-beta.6] - 2023-08-28
|
|
17
|
+
|
|
18
|
+
- OpenLayers is now a peer dependency
|
|
19
|
+
- Add support for PMTiles (via Web Map Links extension)
|
|
20
|
+
- New general purpose option `getSourceOptions(type, options, ref)` to customize source options.
|
|
21
|
+
It also applies to all web-map-link source options now.
|
|
22
|
+
It replaces:
|
|
23
|
+
- `getGeoTIFFSourceOptions(options, ref)`
|
|
24
|
+
- `getImageStaticSourceOptions(options, ref)`
|
|
25
|
+
- `getXYZSourceOptions(options, ref)`
|
|
26
|
+
- Added `SourceType` enum for `getSourceOptions`
|
|
27
|
+
|
|
28
|
+
## [1.0.0-beta.5] - 2023-08-23
|
|
29
|
+
|
|
30
|
+
- Don't enforce the nodata value to be `NaN` if not present in STAC metadata
|
|
31
|
+
|
|
32
|
+
## [1.0.0-beta.4] - 2023-08-22
|
|
33
|
+
|
|
34
|
+
- Fix the default entry point (you can now really use `import STAC from 'ol-stac';`)
|
|
35
|
+
|
|
36
|
+
## [1.0.0-beta.3] - 2023-08-22
|
|
37
|
+
|
|
38
|
+
- Pass `properties` option to the LayerGroup.
|
|
39
|
+
|
|
40
|
+
## [1.0.0-beta.2] - 2023-08-22
|
|
41
|
+
|
|
42
|
+
- Move the `stacUtils.js` from `ol/layer` to `ol-stac/utils.js`
|
|
43
|
+
- Provide a default entry point (you can now use `import STAC from 'ol-stac';`)
|
|
44
|
+
- Documentation improvements
|
|
45
|
+
|
|
46
|
+
## [1.0.0-beta.1] - 2023-08-22
|
|
47
|
+
|
|
48
|
+
- First release
|
|
49
|
+
|
|
50
|
+
[Unreleased]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.7...HEAD>
|
|
51
|
+
[1.0.0-beta.6]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.6...v1.0.0-beta.7>
|
|
52
|
+
[1.0.0-beta.6]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.5...v1.0.0-beta.6>
|
|
53
|
+
[1.0.0-beta.5]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.4...v1.0.0-beta.5>
|
|
54
|
+
[1.0.0-beta.4]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.3...v1.0.0-beta.4>
|
|
55
|
+
[1.0.0-beta.3]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.2...v1.0.0-beta.3>
|
|
56
|
+
[1.0.0-beta.2]: <https://github.com/stac-extensions/contacts/compare/v1.0.0-beta.1...v1.0.0-beta.2>
|
|
57
|
+
[1.0.0-beta.1]: <https://github.com/stac-extensions/contacts/tree/v1.0.0-beta.1>
|
package/DEVELOPING.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Developing
|
|
2
|
+
|
|
3
|
+
## Setting up development environment
|
|
4
|
+
|
|
5
|
+
You will start by [forking](https://github.com/m-mohr/ol-stac/fork) the OL STAC repository.
|
|
6
|
+
|
|
7
|
+
### Installing dependencies
|
|
8
|
+
|
|
9
|
+
The minimum requirements are:
|
|
10
|
+
|
|
11
|
+
* Git
|
|
12
|
+
* [Node.js](https://nodejs.org/) (version 16 and above)
|
|
13
|
+
|
|
14
|
+
The executables `git` and `node` should be in your `PATH`.
|
|
15
|
+
|
|
16
|
+
To install the project dependencies run
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
npm install
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Style guidelines
|
|
24
|
+
|
|
25
|
+
We use [ESLint](https://eslint.org/) rules to ensure a consistent coding style and catch potential bugs. ESLint and the rules used by the project are installed as part of the development dependencies in the step above – so you don't need to have any additional executables installed globally.
|
|
26
|
+
|
|
27
|
+
When you submit a pull request, the styling rules are enforced by running the `npm run lint` task. This happens as part of an automated workflow, so you don't need to run it yourself. However, it can be useful to run the `npm run lint` task before submitting a pull request so that you can fix any styling issues ahead of time.
|
|
28
|
+
|
|
29
|
+
The best way to conform with the style guidelines is to configure your editor to detect the ESLint configuration from the repository's `package.json` file. See the [ESLint integration documentation](https://eslint.org/docs/latest/use/integrations) for details on configuring your editor. If you don't already have a preferred editor that is capable of running ESLint rules, we recommend using [VS Code](https://code.visualstudio.com/) with the [ESLint plugin](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint).
|
|
30
|
+
|
|
31
|
+
In addition to having your editor warn you when the style guidelines are not being followed, you can set things up so many of the violations are automatically fixed. This saves you from having to think about tedious things like spacing and whitespace while developing. Using the ESLint plugin for VS Code, you can add the following to your settings to automatically fix issues when you save a file:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"editor.codeActionsOnSave": {
|
|
36
|
+
"source.fixAll": true
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## Running examples
|
|
43
|
+
|
|
44
|
+
To run the examples you first need to start the dev server:
|
|
45
|
+
|
|
46
|
+
```shell
|
|
47
|
+
npm run serve-examples
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Then, load <http://localhost:8080/> in your browser.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
## Running tests
|
|
54
|
+
|
|
55
|
+
To run the tests once:
|
|
56
|
+
|
|
57
|
+
```shell
|
|
58
|
+
npm test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
To run the tests continuously during development:
|
|
62
|
+
|
|
63
|
+
```shell
|
|
64
|
+
npm run karma
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Adding examples
|
|
69
|
+
|
|
70
|
+
Adding functionality often implies adding one or several examples. This
|
|
71
|
+
section provides explanations related to adding examples.
|
|
72
|
+
|
|
73
|
+
The examples are located in the `examples` directory. Adding a new example
|
|
74
|
+
implies creating two or three files in this directory, an `.html` file, a `.js`
|
|
75
|
+
file, and, optionally, a `.css` file.
|
|
76
|
+
|
|
77
|
+
You can use `simple.js` and `simple.html` as templates for new examples.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## Linking Package
|
|
81
|
+
|
|
82
|
+
The `ol-stac` package is published from the `build/ol` folder of the `ol-stac` repo.
|
|
83
|
+
|
|
84
|
+
After you've cloned the `ol-stac` repo locally run the `npm build-package` to prepare the build then use the `npm link` command to connect it your project.
|
|
85
|
+
|
|
86
|
+
Below is an example of how to build and link it to `sample-project`.
|
|
87
|
+
|
|
88
|
+
```shell
|
|
89
|
+
cd ol-stac
|
|
90
|
+
npm run build-package
|
|
91
|
+
cd build/ol
|
|
92
|
+
npm link
|
|
93
|
+
cd /sample-project
|
|
94
|
+
npm link ol-stac
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
To remove the link run the following commands
|
|
98
|
+
|
|
99
|
+
```shell
|
|
100
|
+
cd sample-project
|
|
101
|
+
npm unlink --no-save ol-stac
|
|
102
|
+
cd ../ol-stac
|
|
103
|
+
npm unlink
|
|
104
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"opts": {
|
|
3
|
+
"recurse": true,
|
|
4
|
+
"template": "config/jsdoc/api/template"
|
|
5
|
+
},
|
|
6
|
+
"tags": {
|
|
7
|
+
"allowUnknownTags": true
|
|
8
|
+
},
|
|
9
|
+
"source": {
|
|
10
|
+
"includePattern": ".+\\.js$",
|
|
11
|
+
"excludePattern": "(^|\\/|\\\\)_",
|
|
12
|
+
"include": [
|
|
13
|
+
"src/ol"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"plugins": [
|
|
17
|
+
"jsdoc-plugin-intersection",
|
|
18
|
+
"config/jsdoc/plugins/markdown.cjs",
|
|
19
|
+
"jsdoc-plugin-typescript",
|
|
20
|
+
"config/jsdoc/plugins/inline-options.cjs",
|
|
21
|
+
"config/jsdoc/plugins/events.cjs",
|
|
22
|
+
"config/jsdoc/plugins/api.cjs",
|
|
23
|
+
"config/jsdoc/plugins/default-export.cjs"
|
|
24
|
+
],
|
|
25
|
+
"typescript": {
|
|
26
|
+
"moduleRoot": "src"
|
|
27
|
+
},
|
|
28
|
+
"templates": {
|
|
29
|
+
"cleverLinks": true,
|
|
30
|
+
"monospaceLinks": true,
|
|
31
|
+
"default": {
|
|
32
|
+
"outputSourceFiles": false
|
|
33
|
+
},
|
|
34
|
+
"applicationName": "OL STAC"
|
|
35
|
+
},
|
|
36
|
+
"jsVersion": 180
|
|
37
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# API Documentation
|
|
2
|
+
|
|
3
|
+
This directory contains configuration (`conf.json`), static content (`index.md`), template (`template/`) and plugins (`plugins/`) for the [JSDoc3](https://jsdoc.app/) API generator.
|
|
4
|
+
|
|
5
|
+
## Documenting the source code
|
|
6
|
+
|
|
7
|
+
JSDoc annotations are used for metadata used by the compiler, for defining the user facing API, and for user documentation.
|
|
8
|
+
|
|
9
|
+
In the simplest case, a JSDoc block can look like this:
|
|
10
|
+
```js
|
|
11
|
+
/**
|
|
12
|
+
* Add the given control to the map.
|
|
13
|
+
* @param {ol.control.Control} control Control.
|
|
14
|
+
* @api
|
|
15
|
+
*/
|
|
16
|
+
ol.Map.prototype.addControl = function(control) {
|
|
17
|
+
// ...
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
The first line is text for the user documentation. This can be long, and it can
|
|
21
|
+
contain Markdown.
|
|
22
|
+
|
|
23
|
+
The second line tells the Closure compiler the type of the argument.
|
|
24
|
+
|
|
25
|
+
The third line (`@api`) marks the method as part of the api and thus exportable. Without such an api annotation, the method will not be documented in the generated API documentation. Symbols without an api annotation will also not be exportable.
|
|
26
|
+
|
|
27
|
+
In general, `@api` annotations should never be used on abstract methods (only on their implementations).
|
|
28
|
+
|
|
29
|
+
### Events
|
|
30
|
+
|
|
31
|
+
Events are documented using `@fires` and `@event` annotations:
|
|
32
|
+
```js
|
|
33
|
+
/**
|
|
34
|
+
* Constants for event names.
|
|
35
|
+
* @enum {string}
|
|
36
|
+
*/
|
|
37
|
+
ol.MapBrowserEventType = {
|
|
38
|
+
/**
|
|
39
|
+
* A true single click with no dragging and no double click. Note that this
|
|
40
|
+
* event is delayed by 250 ms to ensure that it is not a double click.
|
|
41
|
+
* @event ol.MapBrowserEvent#singleclick
|
|
42
|
+
* @api
|
|
43
|
+
*/
|
|
44
|
+
SINGLECLICK: 'singleclick',
|
|
45
|
+
// ...
|
|
46
|
+
};
|
|
47
|
+
```
|
|
48
|
+
Note the value of the `@event` annotation. The text before the hash refers to the event class that the event belongs to, and the text after the hash is the type of the event.
|
|
49
|
+
|
|
50
|
+
To document which events are fired by a class or method, the `@fires` annotation is used:
|
|
51
|
+
```js
|
|
52
|
+
/**
|
|
53
|
+
* @fires ol.MapBrowserEvent
|
|
54
|
+
* @fires ol.MapEvent
|
|
55
|
+
* @fires ol.render.Event
|
|
56
|
+
* ...
|
|
57
|
+
*/
|
|
58
|
+
ol.Map = function(options) {
|
|
59
|
+
// ...
|
|
60
|
+
};
|
|
61
|
+
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
This template is based on the [Jaguar](https://github.com/davidshimjs/jaguarjs/tree/master/docs/templates/jaguar) template. [JaguarJS](https://github.com/davidshimjs/jaguarjs) is licensed under the [LGPL license](https://github.com/davidshimjs/jaguarjs/tree/master/LICENSE).
|
|
2
|
+
|
|
3
|
+
The default template for JSDoc 3 uses: [the Salty Database library](https://www.npmjs.com/package/@jsdoc/salty) and the [Underscore Template library](https://underscorejs.org/#template).
|