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

DataSource API design #2114

Closed
pjcozzi opened this issue Sep 4, 2014 · 5 comments
Closed

DataSource API design #2114

pjcozzi opened this issue Sep 4, 2014 · 5 comments
Assignees

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 4, 2014

Sorry if this is already planned. Looking at this example:

var dataSource = new Cesium.GeoJsonDataSource();
viewer.dataSources.add(dataSource);
dataSource.loadUrl('../../SampleData/ne_10m_us_states.topojson');

1 . Can this be as concise as primitives like Model:

var dataSource = viewer.dataSources.add(
  Cesium.GeoJsonDataSource.fromUrl('../../SampleData/ne_10m_us_states.topojson'));

2 . Are we sure viewer should own dataSources? Shouldn't this be part of scene so users reach into the same object to access terrain, imagery, primitives, data sources, camera, and so on? Isn't viewer a UI container, not really part of the animation/rendering engine?

@emackey
Copy link
Contributor

emackey commented Sep 5, 2014

Good API cleanup in 1, and interesting thought in 2. @mramato and I have talked about bringing viewerEntityMixin into the viewer, but maybe we should combine that with this effort, and reconsider how far down to push the different pieces. Viewer would still own InfoBox and SelectionIndicator of course, but the dataSources would move down to the Scene level, and the scene would own the clock. This could change the rules for things like camera views that depend on data source entities.

@shunter
Copy link
Contributor

shunter commented Sep 5, 2014

For item 1, I agree it would be a convenient addition. The existing loadUrl function returns a promise so that the caller can run code as soon as the load has completed, which you'd lose if you used the fromUrl function, but in many cases you may not need access to the promise.

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Sep 5, 2014

Also, just to be clear, I expect most of the code will still live outside of Scene.js, but the user will just access it through scene instead of viewer.

@mramato
Copy link
Contributor

mramato commented Sep 30, 2014

The reason we were not doing 1 was because it only allowed you to easily add data with the Cesium default styling, which is pretty useless. However, now that I added support for the simplstyle spec, it's much more useful. I added it as part of #2162

For 2. I'm all for "promoting" it to scene, but does that mean if I add a data source to scene.dataSources then it automatically get rendered? Right now there is a DataSourceDisplay instance in Viewer that would need to be moved into Scene as well, and updated as part of the render loop. There might be some layer violations with trying to do this, but I think it's worth alook.

@pjcozzi
Copy link
Contributor Author

pjcozzi commented Sep 30, 2014

if I add a data source to scene.dataSources then it automatically get rendered

I would imagine so. Perhaps primitives and data sources can have very similar paradigms (which could mean changes for either).

I think it's worth a look.

Sounds good. I'm happy to discuss.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants