Skip to content

Commit

Permalink
Merge pull request #8880 from CesiumGS/buildings-sandcastle
Browse files Browse the repository at this point in the history
Add new Sandcastle example.
  • Loading branch information
Omar Shehata authored May 27, 2020
2 parents d49c0c3 + 438b7ef commit 1b2a2cb
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
62 changes: 62 additions & 0 deletions Apps/Sandcastle/gallery/Cesium OSM Buildings.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta
name="description"
content="Worldwide 3D buildings with rich metadata from OpenStreetMap."
/>
<meta
name="cesium-sandcastle-labels"
content="Beginner, Showcases, ion Assets"
/>
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script
type="text/javascript"
src="../../../Build/CesiumUnminified/Cesium.js"
nomodule
></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body
class="sandcastle-loading"
data-sandcastle-bucket="bucket-requirejs.html"
>
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
"use strict";
//Sandcastle_Begin
var viewer = new Cesium.Viewer("cesiumContainer", {
terrainProvider: Cesium.createWorldTerrain(),
});

viewer.scene.primitives.add(Cesium.createOsmBuildings());

viewer.scene.camera.flyTo({
destination: Cesium.Cartesian3.fromDegrees(-74.019, 40.6912, 750),
orientation: {
heading: Cesium.Math.toRadians(20),
pitch: Cesium.Math.toRadians(-20),
},
}); //Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
startup(Cesium);
}
</script>
</body>
</html>
Binary file added Apps/Sandcastle/gallery/Cesium OSM Buildings.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions Source/Scene/createOsmBuildings.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ import Cesium3DTileStyle from "./Cesium3DTileStyle.js";

/**
* Creates a {@link Cesium3DTileset} instance for the
* {@link https://cesium.com/content/#cesium-osm-buildings|Cesium OSM Buildings}
* {@link https://cesium.com/content/cesium-osm-buildings/|Cesium OSM Buildings}
* tileset.
*
* @exports createOsmBuildings
*
* @param {Object} [options] Construction options. Any options allowed by the {@link Cesium3DTileset} constructor
* may be specified here. In addition to those, the following properties are supported:
* @param {Color} [options.defaultColor=Color.WHITE] The default color to use for buildings
* that do not have a color. This parameter is ignored if `options.style` is specified.
* that do not have a color. This parameter is ignored if <code>options.style</code> is specified.
* @param {Cesium3DTileStyle} [options.style] The style to use with the tileset. If not
* specified, a default style is used which gives each building or building part a
* color inferred from its OpenStreetMap `tags`. If no color can be inferred,
* `options.defaultColor` is used.
* color inferred from its OpenStreetMap <code>tags</code>. If no color can be inferred,
* <code>options.defaultColor</code> is used.
* @returns {Cesium3DTileset}
*
* @see Ion
Expand Down

0 comments on commit 1b2a2cb

Please sign in to comment.