AnalyticalGraphicsInc/cesium — pull request #838 by mramato (2013-06-04 00:54:14+00:00)
Title: Replace CesiumViewerWidget

This isn't quite ready yet, but I'm opening it up for feedback so you guys can help me put the finishing touches on everything.

This change removes the Dojo-based `CesiumViewerWidget` and replaces it with a leaner, more streamlined `Viewer` widget which does not depend on dojo and is part of the combined Cesium.js. Unlike CesiumViewerWidget, which was basically an entire application in widget form, the new Viewer widget is meant to serve as a foundation for new applications. The new Viewer is also fully documented and unit tested.

The new base widget is very simple. It includes all of the standard widgets, but allows you to specify at construction time which ones you actually want to use. It also handles resize and layout so that things look good no matter which widgets you turn on or off. Finally, it provides a DataSourceCollection instances which makes it easy to add/remove/manage multiple data sources and will also be forward compatible with the to-be-developed `TableOfContents` widget.

The widget has very little built in functionality in order to make it as flexible as possible. For example, there's no "click-to-zoom" or "drag&drop" functionality. Instead, you can extend the base functionality by adding mix-in types, `ViewerDropHandler` and `ViewerDynamicSceneControls` are the current two we have. This allows users to trade flexibilty for built-in functionality with just one or two lines of code.

There's still a few more things that need to be done before this is ready for master.

1. [ ] Change the utility classes to extend Viewer as actual mix-in styles objects. Also need to finish up `ViewerDynamicSceneControls`.
2. [ ] Fix resize behavior so that logo and credits move to the bottom or left when Timeline or Animation are not shown.
3. [ ] While I've updated all of the Sandcastle examples already, we need to verify that the ones that no longer need Dojo have been updated to use the non-dojo buckets.
4. [ ] Do a final pass on documentation.
5. [ ] Update CHANGES

__Other changes in this branch__

1. The `Client CZML` SandCastle demo has been removed. It's redunant with the `Simple CZML demo` and will become less and less relevant as we improve client-side data generation in the DynamicScene layer.
2. The `Two Viewer Widgets` SandCastle demo has been removed. This is because we don't actually have "real" support for multiple widgets yet and doing so properly is not something we are ready to undertake yet. We will add back a multi-scene example when we have a good architecture for it in place.
3. `highlightObject` has been removed. I was originally planning on sticking this function in Scene/highlightObject.js, however, now that I've looked at it, I'd rather just remove it completely. It's only used in 5 of the current Sandcastle examples and I don't really feel it adds that much since we have the code highlighting in place anyway. Also, the nature of its current implementation doesn't really make it useful in general (in my opinion). I'd love to see us add a highlightPrimitive function in the future, preferably one that uses post-process or some other graphics means that doesn't involve modifying the object being highlighted; but I don't think the current one is worth being kept around. If there are strong objections to removing it, we could potentially add it as a mix-in to the standard Viewer control and add doc and specs for it so that we can verify it's functionality.
4. Fixed an issue in `BaseLayerPicker` where destroy wasn't properly cleaning everything up.
5. Extracted all of the default imagery providers in the `BaseLayerPicker` to a helper function, `BaseLayerPicker\createDefaultBaseLayers.js`
6. Added the ability to unsubscribe to the Timeline events. The Timeline itself still needs a lot of cleanup, but that's outside the scope of this request.
7. Added a `screenSpaceEventHandler` property to `CesiumWidget`. Also added a `sceneMode` option to the constructor to set the starting scene mode.

CC @shunter @emackey