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

Entities on terrain #3903

Merged
merged 103 commits into from
Jun 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
5efbaea
Initial support for Entity billboard/label clamping.
mramato Apr 24, 2015
48eccdf
CZML support for billboard/label height reference.
mramato Apr 24, 2015
87e405a
Merge remote-tracking branch 'origin/billboard-clamp-to-ground' into …
mramato Apr 29, 2015
9bd9185
Fix Visualizer bounding sphere computation for billboards and labels.
mramato Apr 29, 2015
e8bf33e
Merge remote-tracking branch 'origin/billboard-clamp-to-ground' into …
mramato Apr 29, 2015
d258e3c
Merge remote-tracking branch 'origin/master' into entity-clamp-to-ground
mramato Jun 6, 2015
216dac4
Merge remote-tracking branch 'origin/master' into entity-clamp-to-ground
mramato Jun 22, 2015
61a0bce
Merge remote-tracking branch 'origin/master' into entity-clamp-to-ground
mramato Jul 14, 2015
af20762
Started working on it.
Sep 16, 2015
1f904a1
Merge remote-tracking branch 'origin/master' into entity-clamp-to-ground
mramato Oct 29, 2015
fb299a2
Merge branch 'master' into kml-terrain-primitives
Jan 8, 2016
ddb1143
Still can't the rectangle to show up on terrain.
Jan 11, 2016
0cfa82c
Got rectangle geometries on terrain to work.
Jan 11, 2016
50d4f87
Added option for geojson on terrain that uses corridors instead of po…
Jan 12, 2016
ebe1fe8
Some tweaks from PR review.
Jan 13, 2016
bb40182
Added Polygon & Corridor
Jan 13, 2016
07b0778
Made onTerrain and option because we don't want to always create grou…
Jan 13, 2016
e57c8ab
Merge remote-tracking branch 'origin/master' into entity-clamp-to-ground
mramato Jan 13, 2016
614c165
Merge remote-tracking branch 'agi/entity-clamp-to-ground' into entity…
Jan 13, 2016
d3458a8
Added terrain option to geojson and hooked it up.
Jan 13, 2016
a6c3af6
Merge remote-tracking branch 'agi/ground-primitive-batch' into entity…
Jan 14, 2016
2ea7698
Added StaticGroundGeometryColorBatch.
Jan 14, 2016
f00122f
Added oneTimeWarning function to display issues that may happen alot …
Jan 15, 2016
9645d33
Added support for geojson on terrain.
Jan 15, 2016
beadf48
Merge remote-tracking branch 'agi/master' into entity-terrain
Jan 21, 2016
daa04b9
Updated tests to work with changes and added new ones that make sure …
Jan 21, 2016
22c92ff
Fixed ground primitives to actually batch by color.
Jan 21, 2016
7b4de17
Fixed all billboard and label tests.
Jan 21, 2016
ec49f06
Added tests to make sure we remove batches when colors change.
Jan 21, 2016
b736018
Tweak.
Jan 21, 2016
6aa13c5
Merge branch 'master' into entity-terrain
Jan 22, 2016
bf9dbee
Removed comma.
Jan 22, 2016
5c138c7
sorted requires.
Jan 22, 2016
d59b0e6
Merge branch 'master' into entity-terrain
Jan 25, 2016
459d66a
Fixed unneeded assignment.
Jan 26, 2016
759627c
Merge branch 'master' into entity-terrain
Feb 4, 2016
489274d
Merge remote-tracking branch 'origin/master' into tfili-entity-terrain
mramato Feb 17, 2016
5cd1ff7
Merge branch 'master' into entity-terrain
Feb 29, 2016
c28c9c2
Added a check to make sure GroundPrimitives are supported before we u…
Mar 2, 2016
eea17e0
Merge branch 'master' into entity-terrain
Mar 2, 2016
10881bd
Merge branch 'master' into entity-terrain
Mar 25, 2016
3d6f1d8
Merge branch 'master' into entity-terrain
Apr 20, 2016
75c7e43
Got bounding volume pretty much corrrect based on low res terrain jso…
Apr 22, 2016
c258b8e
Merged in master
May 9, 2016
267f0fd
Merge branch 'master' into entity-terrain
May 12, 2016
afdb8c2
A little hackiness to do some testing. Need to remove the GroundPrimi…
May 13, 2016
fbc7218
Compute correct terrain height in the correct place. We were generati…
May 13, 2016
6949be9
Merge branch 'master' into entity-terrain
May 16, 2016
407867f
More tweaking for getting entities on terrain to work with all geomet…
May 16, 2016
ab02243
Added first changes for point entities on terrain.
May 17, 2016
723f313
Got points working on terrain. Still need tests.
May 17, 2016
9eddbaf
Merged master
May 23, 2016
6be09c8
Added model entities on terrain.
May 24, 2016
8e5c1f2
Merge branch 'master' into entity-terrain
May 24, 2016
9f1fac8
Merge branch 'entity-terrain' into entity-terrain-models
May 24, 2016
96434ae
Added getRectangle for ellipse and fixed them for polygon and rectangle.
May 26, 2016
59fadac
Added Corridor getRectangle method. Still need to handle different co…
May 26, 2016
8d5e199
we were using the incorrect caps for non-rounded corridors.
May 27, 2016
4522a14
Fixed all the geometry tests.
May 27, 2016
c864de5
Fixed unit tests.
May 27, 2016
2e0afad
Merge pull request #3954 from AnalyticalGraphicsInc/entity-terrain-mo…
mramato Jun 9, 2016
bc215c8
Merged master
Jun 9, 2016
1da9eba
Tweaks from PR comments.
Jun 9, 2016
d283972
AddMore tweaks from PR comments.
Jun 9, 2016
b481155
Added loading of terrain heights to GroundPrimitives.
Jun 9, 2016
606f3cb
Fixed all failing tests.
Jun 9, 2016
bc241b0
Added polygon tests.
Jun 10, 2016
3706e02
More tests.
Jun 10, 2016
f6c1744
Doc update.
Jun 13, 2016
eb66261
Merge branch 'master' into entity-terrain
Jun 13, 2016
921d682
Added tests for Corridor, Polygon and Rectangle geometries rectangle …
Jun 13, 2016
9fb69b7
Added tests for ellipse and circle geometries' rectangle property.
Jun 13, 2016
8dc5e2a
Doc fix.
Jun 13, 2016
6ac6f46
Fix label vertical origin.
Jun 13, 2016
1041d61
Fixing labels.
Jun 13, 2016
af622bd
Labels not on terrain now work as expected.
Jun 13, 2016
5b22186
Fixed unit tests.
Jun 14, 2016
77148b1
Fixed labeling issues.
Jun 14, 2016
b4264e0
Fixed PolygonGeometry test and did some cleanup.
Jun 14, 2016
fcec7ef
Made polygon geometry smaller to help with precision issues.
Jun 14, 2016
003bedf
Fixed test names.
Jun 15, 2016
02a3fe8
Added Rectangle.fromCartesianArray and changed deprecationWarning to …
Jun 16, 2016
0abefa3
More tweaks from PR comments.
Jun 16, 2016
8e6dbcc
Merged master
Jun 16, 2016
2add81d
Added more unit tests to fill in coverage holes.
Jun 16, 2016
1dc55f7
Formatting fix.
Jun 16, 2016
4ce37f3
Computed correct min height.
Jun 17, 2016
34ddabb
Fixed bounding volume for GroundPrimitives.
Jun 17, 2016
f1bd7cb
Removed typo.
Jun 17, 2016
26feae0
Fixed jshint error and more tweaks from PR comments.
Jun 17, 2016
f5aaf12
PR comment changes and sandcastle example. Also updated CHANGES.md
Jun 17, 2016
1e26eab
Merged master
Jun 17, 2016
51ae791
Fixed issue where clampedMatrix may not be defined.
Jun 18, 2016
4d7174c
More fixes from PR comments.
Jun 23, 2016
bf8af67
Fixed error where destroyed objects were still registered for events.
Jun 23, 2016
fd816f5
Fixed issues with really slow labels.
Jun 23, 2016
59979bd
Fixed unit tests.
Jun 23, 2016
bc18491
More PR fixes.
Jun 24, 2016
a0b9639
Merged master
Jun 24, 2016
b14bee0
Sped up deleting of custom data from a QuadtreeTile.
Jun 24, 2016
56914bd
Merge pull request #4045 from AnalyticalGraphicsInc/entity-terrain-sl…
mramato Jun 26, 2016
1a9fbc6
Added KML opt-in
Jun 28, 2016
85b366f
Updated CHANGES.md and some other doc.
Jun 29, 2016
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
142 changes: 142 additions & 0 deletions Apps/Sandcastle/gallery/Ground Clamping.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
<!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="Clamp primitives to the terrain.">
<meta name="cesium-sandcastle-labels" content="Tutorials, Showcases">
<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>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<div id="terrainMenu"></div>
<div id="zoomButtons"></div>
<div id="toggleLighting"></div>
<div id="sampleButtons"></div>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
url : 'https://assets.agi.com/stk-terrain/world',
requestWaterMask : true,
requestVertexNormals : true
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;

Sandcastle.addDefaultToolbarMenu([{
//
// To clamp points or billboards set the heightReference to CLAMP_TO_GROUND or RELATIVE_TO_GROUND
//
text : 'Draw Points',
onselect : function() {
var e = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-122.1958, 46.1915),
point : {
color : Cesium.Color.SKYBLUE,
pixelSize : 10,
outlineColor : Cesium.Color.YELLOW,
outlineWidth : 3,
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND
}
});

viewer.trackedEntity = e;
}
}, {
text : 'Draw Billboard',
onselect : function() {
var e = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-122.1958, 46.1915),
billboard : {
image : '../images/facility.gif',
heightReference : Cesium.HeightReference.CLAMP_TO_GROUND
}
});

viewer.trackedEntity = e;
}
}, {
//
// Corridors, polygons and rectangles will be clamped automatically if they are filled with a constant color and
// has no height or extruded height.
// NOTE: Setting height to 0 will disable clamping.
//
text : 'Draw Corridor',
onselect : function() {
var e = viewer.entities.add({
corridor : {
positions : Cesium.Cartesian3.fromDegreesArray([
-122.19, 46.1914,
-122.21, 46.21,
-122.23, 46.21
]),
width : 2000.0,
material : Cesium.Color.GREEN.withAlpha(0.5)
}
});

viewer.trackedEntity = e;
}
}, {
text : 'Draw Polygon',
onselect : function() {
var e = viewer.entities.add({
polygon : {
hierarchy : {
positions : [new Cesium.Cartesian3(-2358138.847340281, -3744072.459541374, 4581158.5714175375),
new Cesium.Cartesian3(-2357231.4925370603, -3745103.7886602185, 4580702.9757762635),
new Cesium.Cartesian3(-2355912.902205431, -3744249.029778454, 4582402.154378103),
new Cesium.Cartesian3(-2357208.0209552636, -3743553.4420488174, 4581961.863286629)]
},
material : Cesium.Color.BLUE.withAlpha(0.5)
}
});

viewer.trackedEntity = e;
}
}, {
text : 'Draw Rectangle',
onselect : function() {
var e = viewer.entities.add({
rectangle : {
coordinates : Cesium.Rectangle.fromDegrees(-122.3, 46.0, -122.0, 46.3),
material : Cesium.Color.RED.withAlpha(0.5)
}
});

viewer.trackedEntity = e;
}
}], 'zoomButtons');

Sandcastle.reset = function () {
viewer.entities.removeAll();
};

//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/Ground Clamping.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 17 additions & 4 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,30 @@ Change Log

### 1.23 - 2016-07-01

* Breaking changes
* `GroundPrimitive.initializeTerrainHeights()` must be called and have the returned promise resolve before a `GroundPrimitive` can be added syncronously.
* Added entities on terrain
* Added `heightReference` property to point, billboard and model entities that would allow them to be rendered relative to terrain.
* Changed corridor, ellipse, polygon and rectangle entities to conform to terrain by using a `GroundPrimitive` if it's material is a `ColorMaterialProperty` and it doesn't have a `height` or `extrudedHeight`. Geometry that has any other type of material won't be drawn on terrain.
* `KMLDataSource`
* Point and model features will always respect `altitudeMode`.
* Adds an option `clampToGround` that when set to true will clamp `Polygon`, `LineString` and `LinearRing` features to the ground if their `altitudeMode` is `clampToGround`. For this case, lines use a corridor instead of a polyline.
* `GeoJsonDataSource`
* Points with a height will be drawn at that height, otherwise they will be clamped to the ground.
* Adds an option `clampToGround` that when set to true will clamp `Polygon` and `LineString` features to the ground. For this case, lines use a corridor instead of a polyline.
* Added `Ground Clamping` example to Sandcastle [here](https://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Ground%20Clamping.html&label=Showcases).
* Improved performance in `GroundPrimitive`.
* Add a `rotatable2D` option to to `Scene`, `CesiumWidget` and `Viewer` to enable a rotatable map in 2D. [#3897](https://github.com/AnalyticalGraphicsInc/cesium/issues/3897)
* `Camera.setView` and `Camera.flyTo` will now use the `orientation.heading` parameter in 2D if the map is rotatable.
* Made changes to KML processing that allows for some incorrect KML (specifically KML that reuses IDs) to still be parsed correctly
* Added `packArray` and `unpackArray` functions to `Cartesian2`, `Cartesian3`, and `Cartesian4`.
* Fix some large polygon triangulations. [#2788](https://github.com/AnalyticalGraphicsInc/cesium/issues/2788)
* Improved performance and accuracy of polygon triangulation by using the [earcut](https://github.com/mapbox/earcut) library. Loading a GeoJSON with polygons for each country was 2x faster.
* Added CZML support for `Box`, `Corridor` and `Cylinder`. Added new CZML properties:
* `Billboard`: `width`, `height`, `scaleByDistance`, `translucencyByDistance`, `pixelOffsetScaleByDistance`, `imageSubRegion`
* `Label`: `translucencyByDistance`, `pixelOffsetScaleByDistance`
* `Model`: `maximumScale`
* `Point`: `scaleByDistance`, `translucencyByDistance`
* `Billboard`: `width`, `height`, `heightReference`, `scaleByDistance`, `translucencyByDistance`, `pixelOffsetScaleByDistance`, `imageSubRegion`
* `Label`: `heightReference`, `translucencyByDistance`, `pixelOffsetScaleByDistance`
* `Model`: `heightReference`, `maximumScale`
* `Point`: `heightReference`, `scaleByDistance`, `translucencyByDistance`
* `Ellipsoid`: `subdivisions`, `stackPartitions`, `slicePartitions`
* `Clock` now keeps its configuration settings self-consistent. Previously, this was done by `AnimationViewModel` and could become inconsistent in certain cases. [#4007](https://github.com/AnalyticalGraphicsInc/cesium/pull/4007)
* Updated Cardboard Sandcastle example.
Expand Down
1 change: 1 addition & 0 deletions Source/Assets/approximateTerrainHeights.json

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions Source/Core/CircleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([
'./Cartesian3',
'./defaultValue',
'./defined',
'./defineProperties',
'./DeveloperError',
'./EllipseGeometry',
'./Ellipsoid',
Expand All @@ -12,6 +13,7 @@ define([
Cartesian3,
defaultValue,
defined,
defineProperties,
DeveloperError,
EllipseGeometry,
Ellipsoid,
Expand Down Expand Up @@ -174,6 +176,17 @@ define([
vertexFormat : VertexFormat.POSITION_ONLY
});
};

defineProperties(CircleGeometry.prototype, {
/**
* @private
*/
rectangle : {
Copy link
Contributor

Choose a reason for hiding this comment

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

Throughout, this is probably better named boundingRectangle. At first, I was confused, for example, why a circle returns a rectangle.

The bounding prefix is also used throughout the graphics code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I started doing this and there was some name collisions. Throughout Cesium boundingRectangle is used to mean a rectanglular volume in Cartesian space, while Rectangle is a lat/lon rectangle which is what this property is. I think making it boundingRectangle would be more confusing, don't you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Eh, OK. This name isn't great, but perhaps the lesser of two evils.

get : function() {
return this._ellipseGeometry.rectangle;
}
}
});

return CircleGeometry;
});
Loading