-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Z-ordering for ground geometry entities #6362
Changes from 2 commits
bd55144
c970417
ce145b5
e34d7c5
343f3cf
a4da7e5
85df9ef
423762a
a1636d5
e04ab01
3f408e4
045a2ea
ba34dc8
b0a31b7
8d7902c
e656a8d
30ae474
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<!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="Draw a rectangle or extruded rectangle that conforms to the surface of the globe."> | ||
<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 viewer = new Cesium.Viewer('cesiumContainer'); | ||
|
||
viewer.entities.add({ | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-110.0, 20.0, -100.5, 30.0), | ||
material : Cesium.Color.RED, | ||
zIndex: 1 | ||
} | ||
}); | ||
|
||
viewer.entities.add({ | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-112.0, 25.0, -102.5, 35.0), | ||
material : Cesium.Color.GREEN, | ||
zIndex: 2 | ||
} | ||
}); | ||
|
||
viewer.entities.add({ | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-110.0, 31.0, -100.5, 41.0), | ||
material : Cesium.Color.BLUE, | ||
zIndex: 3 | ||
} | ||
}); | ||
|
||
viewer.entities.add({ | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-99.5, 20.0, -90.0, 30.0), | ||
material : Cesium.Color.RED, | ||
zIndex: 3 | ||
} | ||
}); | ||
|
||
viewer.entities.add({ | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-97.5, 25.0, -88.0, 35.0), | ||
material : Cesium.Color.GREEN, | ||
zIndex: 2 | ||
} | ||
}); | ||
|
||
viewer.entities.add({ | ||
rectangle : { | ||
coordinates : Cesium.Rectangle.fromDegrees(-99.5, 31.0, -90.0, 41.0), | ||
material : Cesium.Color.BLUE, | ||
zIndex: 1 | ||
} | ||
}); | ||
|
||
viewer.zoomTo(viewer.entities); | ||
//Sandcastle_End | ||
Sandcastle.finishedLoading(); | ||
} | ||
if (typeof Cesium !== "undefined") { | ||
startup(Cesium); | ||
} else if (typeof require === "function") { | ||
require(["Cesium"], startup); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,5 +47,7 @@ define([ | |
|
||
oneTimeWarning.geometryOutlines = 'Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.'; | ||
|
||
oneTimeWarning.geometryZIndex = 'Entity geometry with zIndex are unsupported when the entity is dynamic, or height or extrudedHeight are defined. zIndex will be ignored'; | ||
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. Are dynamic entities still not supported? This message appears to only be used in one place and doesn't check anything about dynamic. 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. Oh yeah no, I fixed that. I'll update the message |
||
|
||
return oneTimeWarning; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ define([ | |
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the distance between each latitude and longitude. | ||
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the corridor casts or receives shadows from each light source. | ||
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this corridor will be displayed. | ||
* @param {ConstantProperty} [options.zIndex] A Property specifying the zIndex of the corridor, used for ordering. Only has an effect if height and extrudedHeight are undefined, and if the corridor is static. | ||
* | ||
* @see Entity | ||
* @demo {@link https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Corridor.html|Cesium Sandcastle Corridor Demo} | ||
|
@@ -74,6 +75,8 @@ define([ | |
this._distanceDisplayConditionSubscription = undefined; | ||
this._classificationType = undefined; | ||
this._classificationTypeSubscription = undefined; | ||
this._zIndex = undefined; | ||
this._zIndexSubscription = undefined; | ||
this._definitionChanged = new Event(); | ||
|
||
this.merge(defaultValue(options, defaultValue.EMPTY_OBJECT)); | ||
|
@@ -209,7 +212,15 @@ define([ | |
* @type {Property} | ||
* @default ClassificationType.BOTH | ||
*/ | ||
classificationType : createPropertyDescriptor('classificationType') | ||
classificationType : createPropertyDescriptor('classificationType'), | ||
|
||
/** | ||
* Gets or sets the zIndex Property specifying the ordering of the corridor. Only has an effect if the coridor is static and neither height or exturdedHeight are specified. | ||
* @memberof CorridorGraphics.prototype | ||
* @type {ConstantProperty} | ||
* @default 0 | ||
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. All of the defaults say 0, but there's not actually a default is there? It's just undefined. 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. undefined === 0 for zIndex. I |
||
*/ | ||
zIndex: createPropertyDescriptor('zIndex') | ||
}); | ||
|
||
/** | ||
|
@@ -237,6 +248,7 @@ define([ | |
result.shadows = this.shadows; | ||
result.distanceDisplayCondition = this.distanceDisplayCondition; | ||
result.classificationType = this.classificationType; | ||
result.zIndex = this.zIndex; | ||
return result; | ||
}; | ||
|
||
|
@@ -268,6 +280,7 @@ define([ | |
this.shadows = defaultValue(this.shadows, source.shadows); | ||
this.distanceDisplayCondition = defaultValue(this.distanceDisplayCondition, source.distanceDisplayCondition); | ||
this.classificationType = defaultValue(this.classificationType, source.classificationType); | ||
this.zIndex = defaultValue(this.zIndex, source.zIndex); | ||
}; | ||
|
||
return CorridorGraphics; | ||
|
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.
I would rename this to
Z-Indexing Geometry
, to both be consistent with our internal terminology and because Z-Indexing is the standard term.