Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a handy script to run the testing config #24

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,7 @@ dmypy.json
# testing / NPM
test/run-cesium/node_modules/*
test/run-cesium/package.json
test/run-cesium/package-lock.json
test/run-cesium/package-lock.json
test/run-cesium/testing_config.js
yarn.lock
node_modules
62 changes: 62 additions & 0 deletions run_testing.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/bin/bash

CESIUM_DIR="./test/run-cesium"
config="${CESIUM_DIR}/testing_config.js"
if [[ ! -e "$config" ]]
then
cp "${CESIUM_DIR}/testing_config_tmpl.js" "${CESIUM_DIR}/testing_config.js"
fi

rm "$CESIUM_DIR/cesium.js"
touch "$CESIUM_DIR/cesium.js"
cat > "$CESIUM_DIR/cesium.js" <<EOF
token = my_config.MY_TOKEN
data_dir = my_config.data_dir

Cesium.Ion.defaultAccessToken = token

const viewer = new Cesium.Viewer('cesiumContainer');

const imageryLayers = viewer.imageryLayers;

const myNewProvider = new Cesium.WebMapTileServiceImageryProvider({

"url": data_dir + "/iwp_coverage/WGS1984Quad/{TileMatrix}/{TileCol}/{TileRow}.png",
"tilingScheme": new Cesium.GeographicTilingScheme()
})
const myNewLayer = new Cesium.ImageryLayer(myNewProvider)
imageryLayers.add(myNewLayer)
EOF

rm "$CESIUM_DIR/index.html"
touch "$CESIUM_DIR/index.html"
cat > "$CESIUM_DIR/index.html" <<EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Include the CesiumJS JavaScript and CSS files -->
<script src="https://cesium.com/downloads/cesiumjs/releases/1.77/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.77/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
</head>
<body>
<div id="cesiumContainer"></div>
<script src="testing_config.js" type="text/javascript"></script>
<script src="cesium.js" type="text/javascript"></script>

</body>
</html>
EOF

cd $CESIUM_DIR

if [[ -e "yarn.lock" ]]
then
yarn start
else
node server.js
fi




4 changes: 4 additions & 0 deletions test/run-cesium/testing_config_tmpl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_config = {
"my_token": "YOUR TOKEN HERE",
"data_dir": "web_tiles"
}