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 polyline arrow material to CzmlDataSource #3860

Merged
merged 5 commits into from
Apr 25, 2016
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
42 changes: 21 additions & 21 deletions Apps/Sandcastle/gallery/CZML Polyline.html
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
<!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 Polyline">
<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">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
<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 Polyline">
<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">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
Expand All @@ -26,8 +26,8 @@

<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
'use strict';
//Sandcastle_Begin
var czml = [
{
"id" : "document",
Expand Down Expand Up @@ -101,7 +101,7 @@
},
{
"id" : "purpleLine",
"name" : "Purple straight line at height",
"name" : "Purple arrow at height",
"polyline" : {
"positions" : {
"cartographicDegrees" : [
Expand All @@ -110,7 +110,7 @@
]
},
"material" : {
"solidColor" : {
"polylineArrow" : {
"color" : {
"rgba" : [148, 0, 211, 255]
}
Expand All @@ -128,12 +128,12 @@
viewer.zoomTo(dataSource);

//Sandcastle_End
Sandcastle.finishedLoading();
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
require(["Cesium"], startup);
}
</script>
</body>
Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Change Log
* Fixed issue causing the fog to go dark and the atmosphere to flicker when the camera clips the globe. [#3178](https://github.com/AnalyticalGraphicsInc/cesium/issues/3178)
* Fixed a bug that caused an exception and rendering to stop when using `ArcGisMapServerImageryProvider` to connect to a MapServer specifying the Web Mercator projection and a fullExtent bigger than the valid extent of the projection. [#3854](https://github.com/AnalyticalGraphicsInc/cesium/pull/3854)
* Fixed issue causing an exception when switching scene modes with an active KML network link. [#3865](https://github.com/AnalyticalGraphicsInc/cesium/issues/3865)
* Added support for polyline arrow material to `CzmlDataSource` [#3860](https://github.com/AnalyticalGraphicsInc/cesium/pull/3860)

### 1.20 - 2016-04-01

Expand Down
8 changes: 8 additions & 0 deletions Source/DataSources/CzmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ define([
'./PathGraphics',
'./PointGraphics',
'./PolygonGraphics',
'./PolylineArrowMaterialProperty',
'./PolylineGlowMaterialProperty',
'./PolylineGraphics',
'./PolylineOutlineMaterialProperty',
Expand Down Expand Up @@ -128,6 +129,7 @@ define([
PathGraphics,
PointGraphics,
PolygonGraphics,
PolylineArrowMaterialProperty,
PolylineGlowMaterialProperty,
PolylineGraphics,
PolylineOutlineMaterialProperty,
Expand Down Expand Up @@ -829,6 +831,12 @@ define([
materialData = packetData.polylineGlow;
processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, sourceUri, entityCollection);
processPacketData(Number, existingMaterial, 'glowPower', materialData.glowPower, undefined, sourceUri, entityCollection);
} else if (defined(packetData.polylineArrow)) {
if (!(existingMaterial instanceof PolylineArrowMaterialProperty)) {
existingMaterial = new PolylineArrowMaterialProperty();
}
materialData = packetData.polylineArrow;
processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, undefined, entityCollection);
}

if (defined(existingInterval)) {
Expand Down
21 changes: 21 additions & 0 deletions Specs/DataSources/CzmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2157,6 +2157,27 @@ defineSuite([
expect(entity.polyline.material.glowPower.getValue()).toEqual(0.75);
});

it('Polyline arrow.', function() {
var packet = {
id : 'polylineArrow',
polyline : {
material : {
polylineArrow : {
color : {
rgbaf : [0.1, 0.2, 0.3, 0.4]
}
}
}
}
};

var dataSource = new CzmlDataSource();
dataSource.load(makePacket(packet));

var entity = dataSource.entities.getById('polylineArrow');
expect(entity.polyline.material.color.getValue()).toEqual(new Color(0.1, 0.2, 0.3, 0.4));
});

it('Processes extrapolation options', function() {
var packet = {
id : 'point',
Expand Down