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

Support for vertical polygons #6791

Merged
merged 8 commits into from
Jul 16, 2018
Merged
Changes from 5 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
28 changes: 22 additions & 6 deletions Apps/Sandcastle/gallery/Polygon.html
Original file line number Diff line number Diff line change
@@ -10,10 +10,12 @@
<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
});
if(typeof require === "function") {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
@@ -108,8 +110,22 @@
}
});

viewer.zoomTo(viewer.entities);
//Sandcastle_End
var cyanPolygon = viewer.entities.add({
name : 'Orange polygon with per-position heights and outline',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This name needs to be updated.

polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArrayHeights([
-90.0, 41.0, 0.0,
-85.0, 41.0, 500000.0,
-80.0, 41.0, 0.0
]),
perPositionHeight : true,
material : Cesium.Color.CYAN.withAlpha(0.5),
outline : true,
outlineColor : Cesium.Color.BLACK
}
});

viewer.zoomTo(viewer.entities);//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
Binary file modified Apps/Sandcastle/gallery/Polygon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ Change Log
##### Additions :tada:
* Added support for loading Draco compressed Point Cloud tiles for 2-3x better compression. [#6559](https://github.com/AnalyticalGraphicsInc/cesium/pull/6559)
* Added `TimeDynamicPointCloud` for playback of time-dynamic point cloud data, where each frame is a 3D Tiles Point Cloud tile. [#6721](https://github.com/AnalyticalGraphicsInc/cesium/pull/6721)
* Added `CoplanarPolygonGeometry` and `CoplanarPolygonGeometryOutline` for drawing polygons composed of coplanar positions that are not necessarliy on the ellipsoid surface. [#6769](https://github.com/AnalyticalGraphicsInc/cesium/pull/6769)
* Added `CoplanarPolygonGeometry` and `CoplanarPolygonGeometryOutline` for drawing polygons composed of coplanar positions that are not necessarily on the ellipsoid surface. [#6769](https://github.com/AnalyticalGraphicsInc/cesium/pull/6769)
* Improved support for polygon entities using `perPositionHeight`, including supporting vertical polygons. This also improves KML compatibility. [#6791](https://github.com/AnalyticalGraphicsInc/cesium/pull/6791)

##### Deprecated :hourglass_flowing_sand:
* Support for 3D Tiles `content.url` is deprecated to reflect updates to the [3D Tiles spec](https://github.com/AnalyticalGraphicsInc/3d-tiles/pull/301). Use `content.uri instead`. Support for `content.url` will remain for backwards compatibility. [#6744](https://github.com/AnalyticalGraphicsInc/cesium/pull/6744)
27 changes: 23 additions & 4 deletions Source/DataSources/PolygonGeometryUpdater.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@ define([
'../Core/Check',
'../Core/Color',
'../Core/ColorGeometryInstanceAttribute',
'../Core/CoplanarPolygonGeometry',
'../Core/CoplanarPolygonOutlineGeometry',
'../Core/defined',
'../Core/DeveloperError',
'../Core/DistanceDisplayConditionGeometryInstanceAttribute',
@@ -32,6 +34,8 @@ define([
Check,
Color,
ColorGeometryInstanceAttribute,
CoplanarPolygonGeometry,
CoplanarPolygonOutlineGeometry,
defined,
DeveloperError,
DistanceDisplayConditionGeometryInstanceAttribute,
@@ -120,6 +124,7 @@ define([

var entity = this._entity;
var isAvailable = entity.isAvailable(time);
var options = this._options;

var attributes = {
show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)),
@@ -138,13 +143,20 @@ define([
}
attributes.color = ColorGeometryInstanceAttribute.fromColor(currentColor);
}
if (defined(this._options.offsetAttribute)) {
if (defined(options.offsetAttribute)) {
attributes.offset = OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty, time, defaultOffset, offsetScratch));
}

var geometry;
if (options.perPositionHeight && !defined(options.extrudedHeight)) {
geometry = new CoplanarPolygonGeometry(options);
} else {
geometry = new PolygonGeometry(options);
}

return new GeometryInstance({
id : entity,
geometry : new PolygonGeometry(this._options),
geometry : geometry,
attributes : attributes
});
};
@@ -168,6 +180,7 @@ define([

var entity = this._entity;
var isAvailable = entity.isAvailable(time);
var options = this._options;
var outlineColor = Property.getValueOrDefault(this._outlineColorProperty, time, Color.BLACK, scratchColor);
var distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(time);

@@ -178,13 +191,19 @@ define([
offset : undefined
};

if (defined(this._options.offsetAttribute)) {
if (defined(options.offsetAttribute)) {
attributes.offset = OffsetGeometryInstanceAttribute.fromCartesian3(Property.getValueOrDefault(this._terrainOffsetProperty, time, defaultOffset, offsetScratch));
}

var geometry;
if (options.perPositionHeight && !defined(options.extrudedHeight)) {
geometry = new CoplanarPolygonOutlineGeometry(options);
} else {
geometry = new PolygonOutlineGeometry(options);
}
return new GeometryInstance({
id : entity,
geometry : new PolygonOutlineGeometry(this._options),
geometry : geometry,
attributes : attributes
});
};