Ideas for Cesium Mixins

I’ve been working with Cesium for a long time. I’m made lots of little side projects with Cesium. Between work and side projects I’ve written some of the same code over and over again. I finally decided to do something about it and started making some mixins that I’ll eventually put in npm but, wondering what ideas people would have for good addiitonal functionality built into Cesium as a mixin.

So far, things I have are:

  • selection: call Viewer.select() and it will return a Promise, allowing the user to click and select points on the globe, drawing a rectangle. The Promise resolves an array of entities that were within that rectangle.
  • pickLocation: call Viewer.pickLocation() and it returns a Promise that resolves to a cartographic point (in degrees) that the user clicked on the globe.
  • pickEntity: call Viewer.pickEntity() and it returns a Promise that resolves to an entity that the user clicked on the globe.
  • cursor: Provides a small UI block in the top left corner that shows the user’s mouse cursor position in cartographic degrees
  • tooltip: Shows a tooltip next to the cursor when the user moves their mouse over an entity.
  • controls: Removes the current animation controller and replaces it with something that looks better (still working on this one)
  • measure: call Viewer.measure() and the user can click a point and begin drawing a line to the next location that they click and shows the range of the line in a floating box at the top of the window.
  • drawcircle: call Viewer.drawcircle() and the user can click a point and begin moving their cursor to draw an ellipse on the globe. The second click will set the radius of the ellipse. The radius is shown in a floating box at the top.

These are basic things that I’ve built over and over again. I’m still adding functionality to them. The drawing tools (measure and drawcircle) don’t draw persistent entities right now. Their current implementation is just to get a quick idea of an idea and then are cleared. Being able to draw persistent entities is something that will be added though.

Drop a comment, let me know some other ideas of things that could be added.

2 Likes