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

Don't clamp KML or GeoJSON billboards and labels if clampToGround is false. #4459

Merged
merged 3 commits into from
Oct 20, 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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Change Log
* Fixed a bug affected models with multiple meshes without indices. [#4237](https://github.com/AnalyticalGraphicsInc/cesium/issues/4237)
* Fixed a glTF transparency bug where `blendFuncSeparate` parameters were loaded in the wrong order. [#4435](https://github.com/AnalyticalGraphicsInc/cesium/pull/4435)
* Fixed a bug where creating a custom geometry with attributes and indices that have values that are not a typed array would cause a crash. [#4419](https://github.com/AnalyticalGraphicsInc/cesium/pull/4419)
* `KmlDataSource` and `GeoJsonDataSource` were not honoring the `clampToGround` option for billboards and labels and was instead always clamping, reducing performance in cases when it was unneeded.
* Fixed a bug with rotated, textured rectangles. [#4430](https://github.com/AnalyticalGraphicsInc/cesium/pull/4430)
* Fixed a bug when morphing from 2D to 3D. [#4388](https://github.com/AnalyticalGraphicsInc/cesium/pull/4388)
* Fixed a bug where when KML features had duplicate IDs, only one was drawn. [#3941](https://github.com/AnalyticalGraphicsInc/cesium/issues/3941)
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/GeoJsonDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ define([
billboard.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);

// Clamp to ground if there isn't a height specified
if (coordinates.length === 2) {
if (coordinates.length === 2 && options.clampToGround) {
billboard.heightReference = HeightReference.CLAMP_TO_GROUND;
}

Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1089,7 +1089,7 @@ define([
}
}

if (defined(heightReference)) {
if (defined(heightReference) && dataSource._clampToGround) {
billboard.heightReference = heightReference;
label.heightReference = heightReference;
}
Expand Down
28 changes: 22 additions & 6 deletions Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2192,15 +2192,19 @@ defineSuite([
});
});

it('Geometry Point: sets heightReference to clampToGround (the default)', function() {
it('Geometry Point: sets heightReference to clampToGround', function() {
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<Placemark>\
<Point>\
<coordinates>1,2,3</coordinates>\
</Point>\
</Placemark>';

return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), options).then(function(dataSource) {
return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), {
camera : options.camera,
canvas : options.canvas,
clampToGround : true
}).then(function(dataSource) {
var entities = dataSource.entities.values;
expect(entities.length).toEqual(1);
expect(entities[0].billboard.heightReference.getValue(Iso8601.MINIMUM_VALUE)).toEqual(HeightReference.CLAMP_TO_GROUND);
Expand Down Expand Up @@ -2705,7 +2709,7 @@ defineSuite([
});
});

it('Geometry gx:Track: sets position and availability (clampToGround default)', function() {
it('Geometry gx:Track: sets position and availability', function() {
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<Placemark xmlns="http://www.opengis.net/kml/2.2"\
xmlns:gx="http://www.google.com/kml/ext/2.2">\
Expand All @@ -2719,7 +2723,11 @@ defineSuite([
</gx:Track>\
</Placemark>';

return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), options).then(function(dataSource) {
return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), {
camera : options.camera,
canvas : options.canvas,
clampToGround : true
}).then(function(dataSource) {
var time1 = JulianDate.fromIso8601('2000-01-01T00:00:00Z');
var time2 = JulianDate.fromIso8601('2000-01-01T00:00:01Z');
var time3 = JulianDate.fromIso8601('2000-01-01T00:00:02Z');
Expand Down Expand Up @@ -2754,7 +2762,11 @@ defineSuite([
</gx:Track>\
</Placemark>';

return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), options).then(function(dataSource) {
return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), {
camera : options.camera,
canvas : options.canvas,
clampToGround : true
}).then(function(dataSource) {
var time1 = JulianDate.fromIso8601('2000-01-01T00:00:00Z');
var time2 = JulianDate.fromIso8601('2000-01-01T00:00:01Z');
var time3 = JulianDate.fromIso8601('2000-01-01T00:00:02Z');
Expand Down Expand Up @@ -2847,7 +2859,11 @@ defineSuite([
</gx:Track>\
</Placemark>';

return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), options).then(function(dataSource) {
return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), {
camera : options.camera,
canvas : options.canvas,
clampToGround : true
}).then(function(dataSource) {
var time1 = JulianDate.fromIso8601('2000-01-01T00:00:00Z');
var time2 = JulianDate.fromIso8601('2000-01-01T00:00:01Z');
var time3 = JulianDate.fromIso8601('2000-01-01T00:00:02Z');
Expand Down