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 zIndex to CZML #6708

Merged
merged 4 commits into from
Jun 21, 2018
Merged
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
133 changes: 133 additions & 0 deletions Apps/Sandcastle/gallery/CZML ZIndex.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
<!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="CZML Z-indexing">
<meta name="cesium-sandcastle-labels" content="CZML">
<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 czml = [{
"id" : "document",
"name" : "CZML zIndex",
"version" : "1.0"
}, {
"id" : "shape1",
"name" : "Blue circle",
"position" : {
"cartographicDegrees" : [-105.0, 40.0, 0.0]
},
"ellipse" : {
"semiMinorAxis" : 300000.0,
"semiMajorAxis" : 300000.0,
"zIndex" : 3,
"material" : {
"solidColor" : {
"color" : {
"rgba" : [0, 0, 255, 255]
}
}
}
}
}, {
"id" : "shape2",
"name" : "Green corridor",
"corridor" : {
"positions" : {
"cartographicDegrees" : [
-90.0, 43.0, 0,
-95.0, 43.0, 0,
-95.0, 38.0, 0
]
},
"width" : 200000.0,
"zIndex" : 3,
"material" : {
"solidColor" : {
"color" : {
"rgba" : [0, 255, 0, 255]
}
}
}
}
}, {
"id" : "shape3",
"name" : "Red polygon",
"polygon" : {
"positions" : {
"cartographicDegrees" : [
-115.0, 47.0, 0,
-115.0, 42.0, 0,
-107.0, 43.0, 0,
-102.0, 41.0, 0,
-102.0, 45.0, 0
]
},
"zIndex" : 1,
"material" : {
"solidColor" : {
"color" : {
"rgba" : [255, 0, 0, 255]
}
}
}
}
}, {
"id" : "shape4",
"name" : "Striped rectangle",
"rectangle" : {
"coordinates" : {
"wsenDegrees" : [-105, 40, -95, 50]
},
"zIndex" : 2,
"fill" : true,
"material" : {
"stripe" : {
"orientation" : "VERTICAL",
"evenColor" : { "rgba" : [255, 255, 0, 255] },
"oddColor" : { "rgba" : [255, 0, 255, 255] },
"repeat" : 5
}
}
}
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var dataSourcePromise = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);

//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
Binary file added Apps/Sandcastle/gallery/CZML ZIndex.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 6 additions & 8 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ Change Log
* KML and GeoJSON now use `PolylineGraphics` instead of `CorridorGraphics` for polylines on terrain. [#6706](https://github.com/AnalyticalGraphicsInc/cesium/pull/6706)

##### Additions :tada:
* Added support for Polylines on Terrain via the `Entity` API [#6689](https://github.com/AnalyticalGraphicsInc/cesium/pull/6689)
* Use the `clampToGround` option for `PolylineGraphics`.
* Requires depth texture support (`WEBGL_depth_texture` or `WEBKIT_WEBGL_depth_texture`), otherwise `clampToGround` will be ignored.
* Added `Entity.supportsPolylinesOnTerrain` for checking if the current platform supports `clampToGround`.
* Added `GroundPolylinePrimitive` and `GroundPolylineGeometry` for rendering polylines on terrain via the `Primitive` API. [#6615](https://github.com/AnalyticalGraphicsInc/cesium/pull/6615)
* Requires depth texture support (`WEBGL_depth_texture` or `WEBKIT_WEBGL_depth_texture`).
* Use `GroundPolylinePrimitive.isSupported` to check for support.
* CZML now supports `clampToGround` and `zIndex` properties for polylines. [#6706](https://github.com/AnalyticalGraphicsInc/cesium/pull/6706)
* Added support for polylines on terrain [#6689](https://github.com/AnalyticalGraphicsInc/cesium/pull/6689) [#6615](https://github.com/AnalyticalGraphicsInc/cesium/pull/6615)
* Use the `clampToGround` option for `PolylineGraphics` (polyline entities).
* Requires depth texture support (`WEBGL_depth_texture` or `WEBKIT_WEBGL_depth_texture`), otherwise `clampToGround` will be ignored. Use `Entity.supportsPolylinesOnTerrain` to check for support.
* Added `GroundPolylinePrimitive` and `GroundPolylineGeometry`
* `PostProcessStage` has a `selected` property which is an array of primitives used for selectively applying a post-process stage. [#6476](https://github.com/AnalyticalGraphicsInc/cesium/pull/6476)
* The `PostProcessStageLibrary.createBlackAndWhiteStage` and `PostProcessStageLibrary.createSilhouetteStage` have per-feature support.
* Added CZML support for `zIndex` for `corridor`, `ellipse`, `polygon`, `polyline` and `rectangle`. [#6708](https://github.com/AnalyticalGraphicsInc/cesium/pull/6708)
* Added CZML `clampToGround` option for `polyline`. [#6706](https://github.com/AnalyticalGraphicsInc/cesium/pull/6706)

##### Fixes :wrench:
* Fixed a bug causing crashes with custom vertex attributes on `Geometry` crossing the IDL. Attributes will be barycentrically interpolated. [#6644](https://github.com/AnalyticalGraphicsInc/cesium/pull/6644)
Expand Down
4 changes: 4 additions & 0 deletions Source/DataSources/CzmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ define([
processPacketData(Number, corridor, 'outlineWidth', corridorData.outlineWidth, interval, sourceUri, entityCollection);
processPacketData(ShadowMode, corridor, 'shadows', corridorData.shadows, interval, sourceUri, entityCollection);
processPacketData(DistanceDisplayCondition, corridor, 'distanceDisplayCondition', corridorData.distanceDisplayCondition, interval, sourceUri, entityCollection);
processPacketData(Number, corridor, 'zIndex', corridorData.zIndex, interval, sourceUri, entityCollection);
}

function processCylinder(entity, packet, entityCollection, sourceUri) {
Expand Down Expand Up @@ -1505,6 +1506,7 @@ define([
processPacketData(Number, ellipse, 'numberOfVerticalLines', ellipseData.numberOfVerticalLines, interval, sourceUri, entityCollection);
processPacketData(ShadowMode, ellipse, 'shadows', ellipseData.shadows, interval, sourceUri, entityCollection);
processPacketData(DistanceDisplayCondition, ellipse, 'distanceDisplayCondition', ellipseData.distanceDisplayCondition, interval, sourceUri, entityCollection);
processPacketData(Number, ellipse, 'zIndex', ellipseData.zIndex, interval, sourceUri, entityCollection);
}

function processEllipsoid(entity, packet, entityCollection, sourceUri) {
Expand Down Expand Up @@ -1765,6 +1767,7 @@ define([
processPacketData(Boolean, polygon, 'closeBottom', polygonData.closeBottom, interval, sourceUri, entityCollection);
processPacketData(ShadowMode, polygon, 'shadows', polygonData.shadows, interval, sourceUri, entityCollection);
processPacketData(DistanceDisplayCondition, polygon, 'distanceDisplayCondition', polygonData.distanceDisplayCondition, interval, sourceUri, entityCollection);
processPacketData(Number, polygon, 'zIndex', polygonData.zIndex, interval, sourceUri, entityCollection);
}

function processPolyline(entity, packet, entityCollection, sourceUri) {
Expand Down Expand Up @@ -1830,6 +1833,7 @@ define([
processPacketData(Number, rectangle, 'outlineWidth', rectangleData.outlineWidth, interval, sourceUri, entityCollection);
processPacketData(ShadowMode, rectangle, 'shadows', rectangleData.shadows, interval, sourceUri, entityCollection);
processPacketData(DistanceDisplayCondition, rectangle, 'distanceDisplayCondition', rectangleData.distanceDisplayCondition, interval, sourceUri, entityCollection);
processPacketData(Number, rectangle, 'zIndex', rectangleData.zIndex, interval, sourceUri, entityCollection);
}

function processWall(entity, packet, entityCollection, sourceUri) {
Expand Down
16 changes: 12 additions & 4 deletions Specs/DataSources/CzmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,8 @@ defineSuite([
rgbaf : [0.2, 0.2, 0.2, 0.2]
},
outlineWidth : 6,
shadows : 'ENABLED'
shadows : 'ENABLED',
zIndex: 8
}
};

Expand All @@ -1131,6 +1132,7 @@ defineSuite([
expect(entity.ellipse.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
expect(entity.ellipse.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6);
expect(entity.ellipse.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ShadowMode.ENABLED);
expect(entity.ellipse.zIndex.getValue(Iso8601.MINIMUM_VALUE)).toEqual(8);
});
});

Expand Down Expand Up @@ -2370,7 +2372,8 @@ defineSuite([
outlineWidth : 6,
closeTop : false,
closeBottom : false,
shadows : 'ENABLED'
shadows : 'ENABLED',
zIndex: 3
}
};

Expand All @@ -2391,6 +2394,7 @@ defineSuite([
expect(entity.polygon.closeTop.getValue(Iso8601.MINIMUM_VALUE)).toEqual(false);
expect(entity.polygon.closeBottom.getValue(Iso8601.MINIMUM_VALUE)).toEqual(false);
expect(entity.polygon.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ShadowMode.ENABLED);
expect(entity.polygon.zIndex.getValue(Iso8601.MINIMUM_VALUE)).toEqual(3);
});
});

Expand Down Expand Up @@ -2924,7 +2928,8 @@ defineSuite([
rgbaf : [0.2, 0.2, 0.2, 0.2]
},
outlineWidth : 6,
shadows : 'ENABLED'
shadows : 'ENABLED',
zIndex : 6
}
};

Expand All @@ -2947,6 +2952,7 @@ defineSuite([
expect(entity.rectangle.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
expect(entity.rectangle.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6);
expect(entity.rectangle.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ShadowMode.ENABLED);
expect(entity.rectangle.zIndex.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6);
});
});

Expand Down Expand Up @@ -3210,7 +3216,8 @@ defineSuite([
rgbaf : [0.2, 0.2, 0.2, 0.2]
},
outlineWidth : 6,
shadows : 'ENABLED'
shadows : 'ENABLED',
zIndex: 5
}
};

Expand All @@ -3233,6 +3240,7 @@ defineSuite([
expect(entity.corridor.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
expect(entity.corridor.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(6);
expect(entity.corridor.shadows.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ShadowMode.ENABLED);
expect(entity.corridor.zIndex.getValue(Iso8601.MINIMUM_VALUE)).toEqual(5);
});
});

Expand Down