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

KmlDataSource (Polyline) vs clampToGround #4131

Closed
jaforom opened this issue Jul 18, 2016 · 7 comments
Closed

KmlDataSource (Polyline) vs clampToGround #4131

jaforom opened this issue Jul 18, 2016 · 7 comments

Comments

@jaforom
Copy link
Contributor

jaforom commented Jul 18, 2016

Dears,

The clampToGround property doesn't seem to go right with KML LineString (it's ok with Polygon and Point). Here it is the example code:

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([{
    text : 'Polygon',
    onselect : function() {
        var ds = Cesium.KmlDataSource.load(
            'http://visortf.grafcan.es/KML/rep/Sand_Polygon.kml',
            {
                camera: viewer.scene.camera,
                canvas: viewer.scene.canvas,
                clampToGround:true
            }
        );
        Cesium.when(ds,function(dataSource) {
            viewer.dataSources.add(dataSource);
            viewer.flyTo(dataSource);
        });
    }
}, {
    text : 'Polyline',
    onselect : function() {
        var ds = Cesium.KmlDataSource.load(
            'http://visortf.grafcan.es/KML/rep/Sand_Polyline.kml',
            {
                camera: viewer.scene.camera,
                canvas: viewer.scene.canvas,
                clampToGround:true
            }
        );
        Cesium.when(ds,function(dataSource) {
            viewer.dataSources.add(dataSource);
            viewer.flyTo(dataSource);
        });
    }
}], 'zoomButtons');

Sandcastle.reset = function () {
    viewer.entities.removeAll();
    viewer.dataSources.removeAll();
};
  • First combo item: Sand_Polygon.kml (a single polygon and no style).
  • Second combo item: Sand_Polyline.kml contains a single polyline with no style, too.

I don't know if I'm doing something wrong...

Regards

@hpinkos
Copy link
Contributor

hpinkos commented Jul 18, 2016

Hello @jaforom
Cesium does not yet have support for polylines on terrain. It's on our roapmap, but we need to do a bit more research to figure out the best way to implement it.
Thanks!

@hpinkos hpinkos closed this as completed Jul 18, 2016
@mramato mramato reopened this Jul 18, 2016
@mramato
Copy link
Contributor

mramato commented Jul 18, 2016

The latest version of Cesium converts LineString to entity corridors if clampToGround is set to true. This looks like a valid bug to me. @tfili can you take a look?

@denverpierce
Copy link
Contributor

The tested KML doesn't have <tessellate> so it returns undefined when cesium checks for clamp-ability.

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/DataSources/KmlDataSource.js#L1148

@jaforom
Copy link
Contributor Author

jaforom commented Jul 27, 2016

Ok, I see. But Cesium fails if the LineString is styled and tessellate is true (1):

Cesium.js:477 An error occurred while rendering.  Rendering has stopped.
undefined
TypeError: r.getType is not a function
TypeError: r.getType is not a function
    at Function.o.getValue (http://.../Cesium/last/Cesium.js:445:2670)
    at a.update (http://.../Cesium/last/Cesium.js:450:16643)
    at s.update (http://.../Cesium/last/Cesium.js:450:19123)
    at m.update (http://.../Cesium/last/Cesium.js:451:844)
    at x.update (http://.../Cesium/last/Cesium.js:456:26898)
    at X._onTick (http://.../Cesium/last/Cesium.js:479:25189)
    at r.raiseEvent (http://.../Cesium/last/Cesium.js:423:24345)
    at u.tick (http://.../Cesium/last/Cesium.js:431:6066)
    at A.render (http://.../Cesium/last/Cesium.js:477:3022)
    at t (http://.../Cesium/last/Cesium.js:476:25339)

@jaforom
Copy link
Contributor Author

jaforom commented Jul 27, 2016

I forgot to comment that I modified the sample KML, http://visortf.grafcan.es/KML/rep/Sand_Polyline.kml, and I included the following elements: tessellate and Style.

@denverpierce
Copy link
Contributor

That looks legit. The override clamped corridors are getting Cesium Colors from the polyline, instead of new ColorMaterialProperties.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jul 31, 2016

Please test out the fix in #4157 kindly contributed by @AndreyOrlov.

tfili pushed a commit that referenced this issue Aug 2, 2016
@jaforom jaforom closed this as completed Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants