-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Height Reference for Corridor, Ellipse, Polygon and Rectangle #6717
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
31448d7
geometry height reference property
3dd3914
Merge branch 'geometry-compute-rectangle' into entity-geometry-height…
6522aa5
cleanup
cae76e9
fix instanceof and sandcastle example
cd8c763
Merge branch 'master' into entity-geometry-height-reference
665e72b
update sandcastle, fix bounding spheres
4c6a6b2
eslint
a6a4d1f
cleanup
fb85bdd
okay, I guess that wasn't so bad
1ef29b5
Merge branch 'fix-ie-offset-geometry' into entity-geometry-height-ref…
e9d6eb8
Merge branch 'fix-ie-offset-geometry' into entity-geometry-height-ref…
787a99a
terrain offset performance
4f7b6c4
Merge remote-tracking branch 'origin/master' into entity-geometry-hei…
mramato eb0974f
CHANGES.md
1ee4e6e
Merge branch 'offset-2d' into entity-geometry-height-reference
4c3f1d0
Merge branch 'offset-2d' into entity-geometry-height-reference
f41cd2d
Merge branch 'master' into entity-geometry-height-reference
04a8259
fix height 2D/CV
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<!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="An example for how to use the GeometryHeightProperty to height reference a corridor, ellipse, polygon or rectangle."> | ||
<meta name="cesium-sandcastle-labels" content="Geometries"> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script> | ||
<script type="text/javascript"> | ||
if(typeof require === "function") { | ||
require.config({ | ||
baseUrl : '../../../Source', | ||
waitSeconds : 120 | ||
}); | ||
} | ||
</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 cesiumTerrainProvider = Cesium.createWorldTerrain(); | ||
var ellipsoidTerrainProvider = new Cesium.EllipsoidTerrainProvider(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A line break could probably help here. |
||
|
||
var viewer = new Cesium.Viewer('cesiumContainer', { | ||
baseLayerPicker : false, | ||
terrainProvider : cesiumTerrainProvider | ||
}); | ||
|
||
// depth test against terrain is required to make the polygons clamp to terrain | ||
// instead of showing through it from underground | ||
viewer.scene.globe.depthTestAgainstTerrain = true; | ||
|
||
Sandcastle.addToolbarMenu([{ | ||
text : 'Terrain Enabled', | ||
onselect : function() { | ||
viewer.scene.terrainProvider = cesiumTerrainProvider; | ||
} | ||
}, { | ||
text : 'Terrain Disabled', | ||
onselect : function() { | ||
viewer.scene.terrainProvider = ellipsoidTerrainProvider; | ||
} | ||
}]); | ||
|
||
var longitude = 6.850615989890521; | ||
var latitude = 45.89546589994886; | ||
var delta = 0.001; | ||
|
||
function addEntity(i, j) { | ||
var west = longitude + delta * i; | ||
var east = longitude + delta * i + delta; | ||
|
||
var south = latitude + delta * j; | ||
var north = latitude + delta * j + delta; | ||
var a = Cesium.Cartesian3.fromDegrees(west, south); | ||
var b = Cesium.Cartesian3.fromDegrees(west, north); | ||
var c = Cesium.Cartesian3.fromDegrees(east, north); | ||
var d = Cesium.Cartesian3.fromDegrees(east, south); | ||
|
||
var positions = [a, b, c, d]; | ||
viewer.entities.add({ | ||
polygon : { | ||
hierarchy : positions, | ||
material : Cesium.Color.fromRandom({alpha : 1}), | ||
height : 40.0, | ||
heightReference : Cesium.HeightReference.RELATIVE_TO_GROUND, | ||
extrudedHeight : 0.0, | ||
extrudedHeightReference : Cesium.HeightReference.CLAMP_TO_GROUND | ||
} | ||
}); | ||
} | ||
|
||
// create 16 polygons that are side-by-side | ||
for (var i = 0; i < 4; i++) { | ||
for (var j = 0; j < 4; j++) { | ||
addEntity(i, j); | ||
} | ||
} | ||
|
||
viewer.camera.lookAt(Cesium.Cartesian3.fromDegrees(longitude, latitude, 500), new Cesium.HeadingPitchRange(Cesium.Math.PI, -Cesium.Math.PI_OVER_FOUR, 2000)); | ||
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments in #6434 (comment) still apply here. I would also like to see some inline comments to explain the feature. If I'm just trying to learn Cesium's capabilities from Sandcastle examples, there's very little context here.