Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Xiaoji Chen
committed
Oct 3, 2019
1 parent
0147b8c
commit 708c566
Showing
12 changed files
with
585 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"origin": { | ||
"x": 0, | ||
"y": 0, | ||
"width": 128, | ||
"height": 128, | ||
"anchorX": 92, | ||
"anchorY": 118 | ||
}, | ||
"reference": { | ||
"x": 128, | ||
"y": 0, | ||
"width": 128, | ||
"height": 128, | ||
"anchorX": 36, | ||
"anchorY": 118 | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset='UTF-8' /> | ||
<title>streetscape.gl quick start</title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
body { margin: 0; } | ||
#container { position: fixed; display: flex; width: 100vw; height: 100vh; overflow: hidden; } | ||
#timeline { background: #fff; padding: 24px 0; position: fixed; bottom: 0; width: 100%; } | ||
</style> | ||
</head> | ||
<body> | ||
<div id="app"></div> | ||
<script src='bundle.js'></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "streetscape.gl-quick-start", | ||
"description": "A template app of streetscape.gl", | ||
"version": "0.1.0", | ||
"scripts": { | ||
"start-local": "webpack-dev-server --env.local --progress --hot --open", | ||
"start": "webpack-dev-server --progress --hot --open" | ||
}, | ||
"dependencies": { | ||
"@turf/bearing": "^6.0.1", | ||
"@turf/distance": "^6.0.1", | ||
"react": "^16.3.0", | ||
"react-dom": "^16.3.0", | ||
"streetscape.gl": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"@babel/core": "^7.0.0", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/preset-react": "^7.0.0", | ||
"babel-loader": "^8.0.0", | ||
"source-map-loader": "^0.2.3", | ||
"webpack": "^4.20.0", | ||
"webpack-cli": "^3.1.2", | ||
"webpack-dev-server": "^3.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) 2019 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
/* global document */ | ||
/* eslint-disable no-unused-vars, no-undef */ | ||
import React, {PureComponent} from 'react'; | ||
import {render} from 'react-dom'; | ||
|
||
import {setXVIZConfig} from '@xviz/parser'; | ||
import {LogViewer, PlaybackControl, VIEW_MODE} from 'streetscape.gl'; | ||
|
||
import {XVIZ_CONFIG, MAPBOX_TOKEN, MAP_STYLE, CAR} from './constants'; | ||
import log from './log-from-file'; | ||
import TapeMeasureLayer from './tape-measure-layer'; | ||
|
||
setXVIZConfig(XVIZ_CONFIG); | ||
|
||
class Example extends PureComponent { | ||
componentDidMount() { | ||
log.connect(); | ||
} | ||
|
||
render() { | ||
const customLayers = [new TapeMeasureLayer({id: 'tape-measure', zIndex: 99})]; | ||
|
||
return ( | ||
<div id="container"> | ||
<LogViewer | ||
log={log} | ||
mapboxApiAccessToken={MAPBOX_TOKEN} | ||
mapStyle={MAP_STYLE} | ||
car={CAR} | ||
customLayers={customLayers} | ||
viewMode={VIEW_MODE.PERSPECTIVE} | ||
/> | ||
<div id="timeline"> | ||
<PlaybackControl | ||
width="100%" | ||
log={log} | ||
formatTimestamp={x => new Date(x).toUTCString()} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
render(<Example />, document.getElementById('app')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2019 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
import {CarMesh} from 'streetscape.gl'; | ||
|
||
/* eslint-disable camelcase */ | ||
export const MAPBOX_TOKEN = process.env.MapboxAccessToken; // eslint-disable-line | ||
|
||
export const MAP_STYLE = 'mapbox://styles/mapbox/light-v9'; | ||
|
||
export const XVIZ_CONFIG = { | ||
PLAYBACK_FRAME_RATE: 10 | ||
}; | ||
|
||
export const CAR = CarMesh.sedan({ | ||
origin: [1.08, -0.32, 0], | ||
length: 4.3, | ||
width: 2.2, | ||
height: 1.5, | ||
color: [160, 160, 160] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) 2019 Uber Technologies, Inc. | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
// THE SOFTWARE. | ||
|
||
import {XVIZFileLoader} from 'streetscape.gl'; | ||
|
||
export default new XVIZFileLoader({ | ||
timingsFilePath: | ||
'https://raw.githubusercontent.com/uber/xviz-data/master/kitti/2011_09_26_drive_0005_sync/0-frame.json', | ||
getFilePath: index => | ||
`https://raw.githubusercontent.com/uber/xviz-data/master/kitti/2011_09_26_drive_0005_sync/${index + | ||
1}-frame.glb`, | ||
worker: true, | ||
maxConcurrency: 4 | ||
}); |
Oops, something went wrong.