Skip to content

Commit

Permalink
fix: handle plugins option
Browse files Browse the repository at this point in the history
  • Loading branch information
hongfaqiu committed Apr 15, 2024
1 parent 3199eea commit 4c98212
Show file tree
Hide file tree
Showing 18 changed files with 72 additions and 13 deletions.
12 changes: 12 additions & 0 deletions examples/vite/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# dde-earth-vite-example

## 0.0.11

### Patch Changes

- Updated dependencies
- [email protected]
- @dde-earth/plugin-martini-terrain-loader@1.0.2
- @dde-earth/plugin-mvt-loader@1.2.2
- @dde-earth/plugin-nc-loader@1.2.2
- @dde-earth/plugin-tiff-loader@1.2.2
- @dde-earth/recommend-plugins@1.3.2

## 0.0.10

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion examples/vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dde-earth-vite-example",
"version": "0.0.10",
"version": "0.0.11",
"private": true,
"scripts": {
"dev": "vite",
Expand Down
4 changes: 1 addition & 3 deletions examples/vite/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ const earth = new Earth("container", {
toolOptions: {
i18n: {},
},
plugins: [new LayerLoaders(), new TIFFLayerLoader()],
});

earth.usePlugin(new LayerLoaders());

earth.layerManager.changeBaseLayer({
url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
enablePickFeatures: false,
Expand Down Expand Up @@ -63,7 +62,6 @@ const str = (earth.i18n.getT as I18N.TranslateFunc<typeof msg>)("dde-earth")(
);
console.log(str);

earth.usePlugin(new TIFFLayerLoader());
earth.usePlugin(new MartiniTerrainLoader());

earth.setTerrain({
Expand Down
6 changes: 6 additions & 0 deletions packages/dde-earth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# dde-earth

## 1.2.2

### Patch Changes

- handle plugins option

## 1.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/dde-earth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dde-earth",
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
5 changes: 3 additions & 2 deletions packages/dde-earth/src/core/earth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export class Earth {
private _ready: boolean = false;
readonly viewer: Viewer;
readonly options: Earth.EarthOptions;
readonly plugins: Record<string, IPlugin> = {};
readonly pluginManager: PluginManager;
readonly i18n: I18N;
readonly layerManager: LayerManager;
Expand Down Expand Up @@ -61,10 +60,12 @@ export class Earth {
this.terrainManager = new TerrainManager(this);
this.setTerrain = this.terrainManager.setTerrain.bind(this.terrainManager);

this.pluginManager = new PluginManager(this, this.plugins);
this.pluginManager = new PluginManager(this);
this.usePlugin = this.pluginManager.use.bind(this.pluginManager);
this.getPlugin = this.pluginManager.get.bind(this.pluginManager);
this.removePlugin = this.pluginManager.remove.bind(this.pluginManager);
options?.plugins?.map(this.usePlugin);

this._ready = true;
}

Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-geojson-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dde-earth/plugin-geojson-loader

## 1.2.2

### Patch Changes

- Updated dependencies
- [email protected]

## 1.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-geojson-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dde-earth/plugin-geojson-loader",
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-martini-terrain-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dde-earth/plugin-martini-terrain-loader

## 1.0.2

### Patch Changes

- Updated dependencies
- [email protected]

## 1.0.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-martini-terrain-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dde-earth/plugin-martini-terrain-loader",
"version": "1.0.1",
"version": "1.0.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-mvt-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dde-earth/plugin-mvt-loader

## 1.2.2

### Patch Changes

- Updated dependencies
- [email protected]

## 1.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-mvt-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dde-earth/plugin-mvt-loader",
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-nc-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dde-earth/plugin-nc-loader

## 1.2.2

### Patch Changes

- Updated dependencies
- [email protected]

## 1.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-nc-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dde-earth/plugin-nc-loader",
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-tiff-loader/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dde-earth/plugin-tiff-loader

## 1.2.2

### Patch Changes

- Updated dependencies
- [email protected]

## 1.2.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-tiff-loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dde-earth/plugin-tiff-loader",
"version": "1.2.1",
"version": "1.2.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/recommend-plugins/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @dde-earth/recommend-plugins

## 1.3.2

### Patch Changes

- Updated dependencies
- [email protected]

## 1.3.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/recommend-plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dde-earth/recommend-plugins",
"version": "1.3.1",
"version": "1.3.2",
"type": "module",
"main": "./dist/lib/index.js",
"module": "./dist/es/index.js",
Expand Down

0 comments on commit 4c98212

Please sign in to comment.