Skip to content

Commit

Permalink
Add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia committed Sep 11, 2019
1 parent 849f071 commit 2473f86
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ export default class App extends Component {
zoom
}
});
},
onTileLoad: (tile) => {
// force update rendering
this.forceUpdate();
},
}
});

return (<DeckGL {...viewport} layers={[layer]} />);
Expand All @@ -60,10 +56,10 @@ new Tile3DLayer({});
To use pre-bundled scripts:

```html
<script src="https://unpkg.com/deck.gl@~7.0.0/dist.min.js"></script>
<script src="https://unpkg.com/deck.gl@~7.3.0/dist.min.js"></script>
<!-- or -->
<script src="https://unpkg.com/@deck.gl/core@~7.0.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@~7.0.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/core@~7.3.0/dist.min.js"></script>
<script src="https://unpkg.com/@deck.gl/layers@~7.3.0/dist.min.js"></script>
```

```js
Expand All @@ -84,10 +80,12 @@ Along with other options as below,

- url to fetch tiles entry point [Tileset JSON](https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/specification#tileset-json) file.

##### `ionAssetId` (Number|String, Optional)
##### `ionAccessToken` (String, Optional)
### Experimental Properties

- `ionAssetId` and `ionAccessToken` are used to fetch ion dataset.
##### `_ionAssetId` (Number|String, Optional)
##### `_ionAccessToken` (String, Optional)

- `_ionAssetId` and `_ionAccessToken` are used to fetch ion dataset.

[Set up Ion account](https://cesium.com/docs/tutorials/getting-started/#your-first-app);

Expand Down
2 changes: 1 addition & 1 deletion examples/layer-browser/src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class Map extends PureComponent {
mapViewState: {
latitude: 37.752,
longitude: -122.427,
zoom: 17.36,
zoom: 11.5,
pitch: 0,
bearing: 0
},
Expand Down
15 changes: 8 additions & 7 deletions modules/geo-layers/src/tile-3d-layer/tile-3d-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const defaultProps = {
pickable: true,

tilesetUrl: null,
ionAssetId: null,
ionAccessToken: null,
_ionAssetId: null,
_ionAccessToken: null,
depthLimit: Number.MAX_SAFE_INTEGER,
onTilesetLoad: tileset3d => {},
onTileLoad: tileHeader => {}
Expand Down Expand Up @@ -74,10 +74,11 @@ export default class Tile3DLayer extends CompositeLayer {
if (props.tilesetUrl && props.tilesetUrl !== oldProps.tilesetUrl) {
await this._loadTileset(props.tilesetUrl);
} else if (
(props.ionAccessToken || props.ionAssetId) &&
(props.ionAccessToken !== oldProps.ionAccessToken || props.ionAssetId !== oldProps.ionAssetId)
(props._ionAccessToken || props._ionAssetId) &&
(props._ionAccessToken !== oldProps._ionAccessToken ||
props._ionAssetId !== oldProps._ionAssetId)
) {
await this._loadTilesetFromIon(props.ionAccessToken, props.ionAssetId);
await this._loadTilesetFromIon(props._ionAccessToken, props._ionAssetId);
}

const {tileset3d} = this.state;
Expand Down Expand Up @@ -113,8 +114,8 @@ export default class Tile3DLayer extends CompositeLayer {
}
}

async _loadTilesetFromIon(ionAccessToken, ionAssetId) {
const ionMetadata = await _getIonTilesetMetadata(ionAccessToken, ionAssetId);
async _loadTilesetFromIon(_ionAccessToken, _ionAssetId) {
const ionMetadata = await _getIonTilesetMetadata(_ionAccessToken, _ionAssetId);
const {url, headers} = ionMetadata;
return await this._loadTileset(url, {headers}, ionMetadata);
}
Expand Down
4 changes: 2 additions & 2 deletions test/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test('Render Test', t => {
t.timeoutAfter(TEST_CASES.length * 2000);

new SnapshotTestRunner({width: WIDTH, height: HEIGHT})
.add(TEST_CASES.slice(-1))
.add(TEST_CASES)
.run({
onTestStart: testCase => t.comment(testCase.name),
onTestPass: (testCase, result) => t.pass(`match: ${result.matchPercentage}`),
Expand All @@ -36,7 +36,7 @@ test('Render Test', t => {
imageDiffOptions: {
threshold: 0.99
// uncomment to save screenshot to disk
// saveOnFail: true
// saveOnFail: true,
// uncomment `saveAs` to overwrite current golden images
// if left commented will be saved as `[name]-fail.png.` enabling comparison
// saveAs: '[name].png'
Expand Down
4 changes: 4 additions & 0 deletions website/contents/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,10 @@ export const docPages = generatePath([
name: 'TileLayer',
content: getDocUrl('layers/tile-layer.md')
},
{
name: 'Tile3DLayer',
content: getDocUrl('layers/tile-3d-layer.md')
},
{
name: 'TripsLayer',
content: getDocUrl('layers/trips-layer.md')
Expand Down

0 comments on commit 2473f86

Please sign in to comment.