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 polylines on terrain via entity API #6689

Merged

Conversation

Projects
None yet
4 participants
@likangning93
Copy link
Contributor

likangning93 commented Jun 14, 2018

See #6615

@cesium-concierge

This comment has been minimized.

Copy link

cesium-concierge commented Jun 14, 2018

Signed CLA is on file.

@likangning93, thanks for the pull request! Maintainers, we have a signed CLA from @likangning93, so you can review this at any time.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@likangning93 likangning93 force-pushed the likangning93:polylinesOnTerrain-entity branch from f5f1817 to 55da339 Jun 14, 2018

/**
* @private
*/
function StaticGroundPolylinePerMaterialBatch(orderedGroundPrimitives) {

This comment has been minimized.

Copy link
@likangning93

likangning93 Jun 14, 2018

Author Contributor

This is mostly copied from StaticGroundGeometryPerMaterialBatch, it just allows a lot more flexibility in batching and needs its own primitive-type.

onselect : function() {
if (!Cesium.Entity.supportsPolylinesOnTerrain(viewer.scene)) {
console.log('Polylines on terrain is not supported on this platform');

This comment has been minimized.

Copy link
@bagnell

bagnell Jun 15, 2018

Member

is -> are

rectangle : {
coordinates : Cesium.Rectangle.fromDegrees(-99.5, 31.0, -90.0, 41.0),
material : Cesium.Color.BLUE,
zIndex: 1
}
});
if (!Cesium.Entity.supportsPolylinesOnTerrain(viewer.scene)) {
console.log('Polylines on terrain is not supported on this platform, Z-index will be ignored');

This comment has been minimized.

Copy link
@bagnell

bagnell Jun 15, 2018

Member

is -> are for here and below.

var that = this;

// Load terrain heights
if (!this._terrainHeightsReady) {

This comment has been minimized.

Copy link
@bagnell

bagnell Jun 15, 2018

Member

Check GroundPolylinePrimitive._initialized or make a private function so this doesn't wait on the promise for every instance.

@@ -513,8 +575,11 @@ define([

this._line = line;
this._primitives = primitives;
this._groundPrimitives = groundPrimitives;
this._groundPolylinePrimitive = undefined;

This comment has been minimized.

Copy link
@bagnell

bagnell Jun 15, 2018

Member

Since this could be a line in a PolylineCollection of a GroundPolylinePrimitive, delay the PolylineCollection creation and the line added until you know which.

This comment has been minimized.

Copy link
@bagnell

bagnell Jun 15, 2018

Member

This could potentially create and destroy primitives a lot if clampToGround is dynamic. What do you think @mramato?

@bagnell

This comment has been minimized.

Copy link
Member

bagnell commented Jun 15, 2018

Should we automatically clamp to ground when all of the position heights are zero?

@likangning93

This comment has been minimized.

Copy link
Contributor Author

likangning93 commented Jun 16, 2018

Should we automatically clamp to ground when all of the position heights are zero?

I was wondering if this would be kind of a breaking change, but I guess I can't see a use case where users would be counting on intentional heights of 0 behaving like they do now.

It does put additional onus on the Entity API layer to check position heights though, which seems like it could duplicate a lot of the cartesian-to-cartographic work in GroundPolylineGeometry.

@mramato

This comment has been minimized.

Copy link
Member

mramato commented Jun 16, 2018

I was wondering if this would be kind of a breaking change, but I guess I can't see a use case where users would be counting on intentional heights of 0 behaving like they do now.

It does put additional onus on the Entity API layer to check position heights though, which seems like it could duplicate a lot of the cartesian-to-cartographic work in GroundPolylineGeometry.

I would recommend against this change. There are certainly places in the world where the ground is below 0, so it's not even a guarantee on the ground is what is desired, plus there are performance issues to consider as well. We might change our mind later (when terrain is on by default) but I wouldn't suggest it for this PR.

likangning93 added some commits Jun 18, 2018

@likangning93

This comment has been minimized.

Copy link
Contributor Author

likangning93 commented Jun 18, 2018

@bagnell updated!

@bagnell

This comment has been minimized.

Copy link
Member

bagnell commented Jun 18, 2018

👍

@bagnell bagnell merged commit 6d55550 into AnalyticalGraphicsInc:master Jun 18, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@likangning93 likangning93 deleted the likangning93:polylinesOnTerrain-entity branch Jun 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.