Skip to content

Commit

Permalink
[add] openglobus code.
Browse files Browse the repository at this point in the history
  • Loading branch information
wewindy committed May 20, 2021
1 parent 557a744 commit 10e4717
Show file tree
Hide file tree
Showing 20 changed files with 2,380 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
- [email protected]
- [email protected]
- [email protected]
- openglobus(todo)
- openglobus@0.8.10



Expand All @@ -35,9 +35,14 @@ window['CESIUM_BASE_URL'] = `path/to/cesium/Source/`



# 2 TODO
## ③ openglobus 注意

因为 openglobus 在我初次写时还没有类型定义库,所以用的是 JavaScript 来写。初始视角用的是官方默认的。



# 2 Future

- 添加 openglobus 示例
- 使用 svelte 试写一次


Expand All @@ -46,4 +51,4 @@ window['CESIUM_BASE_URL'] = `path/to/cesium/Source/`

例如,openlayers 可以使用 [rlayers](https://www.npmjs.com/package/rlayers),leaflet 可以使用 [react-leaflet](https://www.npmjs.com/package/react-leaflet)[vue2-leaflet](https://www.npmjs.com/package/vue2-leaflet)

是因为我希望原汁原味,无它
是因为我希望原汁原味,无它
5 changes: 5 additions & 0 deletions react-js-openglobus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
13 changes: 13 additions & 0 deletions react-js-openglobus/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title> OpenGlobus App in React Js </title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions react-js-openglobus/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "react-js-openglobus",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"@openglobus/og": "^0.8.10",
"react": "^17.0.0",
"react-dom": "^17.0.0"
},
"devDependencies": {
"@vitejs/plugin-react-refresh": "^1.3.1",
"vite": "^2.3.3"
}
}
4 changes: 4 additions & 0 deletions react-js-openglobus/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#globus-container {
width: 100vw;
height: 100vh;
}
30 changes: 30 additions & 0 deletions react-js-openglobus/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useEffect } from 'react'
import './App.css'
import { layer, terrain, Globe } from '@openglobus/og'

import '../node_modules/@openglobus/og/css/og.css'

function App() {

let globus
useEffect(() => {
globus = new Globe({
target: 'globus-container',
name: 'earth',
terrain: new terrain.GlobusTerrain(),
layers: [
new layer.XYZ("OpenStreetMap", {
isBaseLayer: true,
url: '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
visibility: true
})
],
autoActivated: true,
viewExtent: [5.56707, 45.15679, 5.88834, 45.22260]
})
}, []);

return <div id="globus-container"></div>
}

export default App
15 changes: 15 additions & 0 deletions react-js-openglobus/src/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions react-js-openglobus/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
html, body {
margin: 0;
padding: 0;
}

#root {
height: 100vh;
width: 100vw;
}
9 changes: 9 additions & 0 deletions react-js-openglobus/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'

ReactDOM.render(
<App />,
document.getElementById('root')
)
7 changes: 7 additions & 0 deletions react-js-openglobus/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import reactRefresh from '@vitejs/plugin-react-refresh'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [reactRefresh()]
})
Loading

0 comments on commit 10e4717

Please sign in to comment.