Skip to content

Commit

Permalink
deckPlugin2
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Kuznecov committed Oct 13, 2023
1 parent 96b82e3 commit cfd48d4
Show file tree
Hide file tree
Showing 22 changed files with 2,290 additions and 322 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ npm install @2gis/deck2gis-layer
Import the deck2gisLayer plugin to your project and use it:

```typescript
import { Deck2gisLayer, initDeck2gisProps } from '@2gis/deck2gis-layer';
import { Deck2gisLayer, initDeck } from '@2gis/deck2gis-layer';
// Init mapgl
const map = new mapgl.Map('container', {
center: [55.31878, 25.23584],
zoom: 13,
key: 'Your API access key',
});
// Init deck.gl
const deck = new Deck(initDeck2gisProps(map));
const deck = initDeck(map, Deck, { antialiasing: 'msaa' });

// create Deck2gisLayer
const layer = new Deck2gisLayer<HexagonLayer<any>>({
Expand Down
11 changes: 7 additions & 4 deletions demo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HeatmapLayer, HexagonLayer } from '@deck.gl/aggregation-layers/typed';
import { TextLayer } from '@deck.gl/layers';
import { Color, Deck } from '@deck.gl/core/typed';
import { data } from './data';
import { initDeck2gisProps } from '../src/utils';
import { initDeck } from '../src/utils';

declare const mapgl: any;

Expand All @@ -15,9 +15,10 @@ const map = new mapgl.Map('container', {
webglVersion: 2,
});

const deck = new Deck(initDeck2gisProps(map, { antialiasing: 'none' }));
map.once('styleload', () => {
setTimeout(() => initDeckGL(), 3000);
let deck;
map.once('idle', () => {
deck = initDeck(map, Deck, { antialiasing: 'msaa' });
initDeckGL();
});

function initDeckGL() {
Expand All @@ -29,6 +30,8 @@ function initDeckGL() {
map.addLayer(deckLayer3);
const deckLayer4 = createTextlayer(data);
map.addLayer(deckLayer4);
map.removeLayer('deckgl-HexagonLayer');
map.addLayer(deckLayer2);
}

const COLOR_RANGE: Color[] = [
Expand Down
Loading

0 comments on commit cfd48d4

Please sign in to comment.