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

Zoom When Model Load Failure #6272

Closed
jpthompson212 opened this issue Feb 26, 2018 · 7 comments · Fixed by #6305
Closed

Zoom When Model Load Failure #6272

jpthompson212 opened this issue Feb 26, 2018 · 7 comments · Fixed by #6305
Labels
good first issue An opportunity for first time contributors type - bug

Comments

@jpthompson212
Copy link

When loading a CZML file and the model fails to load it causes the camera to never zoom to the entity. This is most likely because there is no detection of the model load failure.

Ideally, the model load failure would be detected and then the camera would zoom to the entity anyways.

@mramato mramato added the good first issue An opportunity for first time contributors label Feb 26, 2018
@mramato
Copy link
Contributor

mramato commented Feb 26, 2018

Thanks @jpthompson212! This issue has been around forever but mostly off our radar. Pretty sure it's a simple fix in ModelVisualizer.js. Basically, we need to update onModelError to record that the model failed in the modelHash and check if the modelData fail flag is set in getBoundingSphere and return failed there if so.

Another good beginner issue. We'd be happy to take a PR if you want to take a crack at this. 😄

@srwiseman
Copy link
Contributor

Hey guys,

Do you mind if I take a crack at this one?

@jpthompson212
Copy link
Author

Hey @srwiseman,

Of course not!

@srwiseman
Copy link
Contributor

Awesome. @jpthompson212 Can you post some quick reproduction steps, so that I know I'm seeing the exact same thing?

@hpinkos
Copy link
Contributor

hpinkos commented Feb 28, 2018

Hi @srwiseman! Thanks for volunteering!

To get started, see our contributor documentation. The Build Guide will give you instructions for checking out the code base and building the project.

As @mramato said above, you'll most likely have to make changes to ModelVisualizer.js

Here is an example to reproduce the issue:

var czml = [{
    "id" : "document",
    "name" : "box",
    "version" : "1.0"
}, {
    "id" : "shape1",
    "name" : "Blue box",
    "position" : {
        "cartographicDegrees" : [-114.0, 40.0, 300000.0]
    },
    "box" : {
        "dimensions" : {
            "cartesian": [400000.0, 300000.0, 500000.0]
        },
        "material" : {
            "solidColor" : {
                "color" : {
                    "rgba" : [0, 0, 255, 255]
                }
            }
        }
    }
}, {
    "id" : "aircraft model",
    "name" : "Cesium Air",
    "position" : {
        "cartographicDegrees" : [-77, 37, 10000]
    },
    "model": {
        "gltf" : "invalid/model/path.glb",
        "scale" : 2.0,
        "minimumPixelSize": 128
    }
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var dataSourcePromise = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);

Let us know if you have any questions! Looking forward to your pull request =)

@srwiseman
Copy link
Contributor

Awesome! Thanks!

@srwiseman
Copy link
Contributor

Ok, I've fixed this by adding a fail flag to the modelData, then adding a check for the failure condition in getBoundingSphere. I'll prepare the PR soon! :)

srwiseman added a commit to srwiseman/cesium that referenced this issue Mar 2, 2018
likangning93 pushed a commit to likangning93/cesium that referenced this issue Apr 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An opportunity for first time contributors type - bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants