I’m starting to implement the PolyDraw and PolyEdit tool for some pretty cool stuff.
What I have in place now is a customjs callback that triggers when the polydraw/polyedit tool’s renderer CDS changes. I also have a separate glyph/datasource of rects storing data/spatial information. The callback identifies the rects (centroid only) that are contained within the polygon the user just drew (and set them as the selected indices too just for visual aid). Then I can do useful aggregation/analysis of those arbitrarily selected points like make histograms etc. They can then also move that polygon around and or edit it’s vertices and the selection will update accordingly. Essentially I’ve just reinvented the polyselect tool with the polydraw tool but with the added benefit of being able to edit vertices (via polyedit), move that selection polygon around (via drag), and (eventually… not implemented yet), allow for multiple polygon selections in two completely different areas to happen.
Here’s what it looks like:
It’s pretty sweet and almost exactly what I want. Notice how the selection only updates when I “release” the drag? I am wondering if I can get it to work more like this d3js mona lisa example:
Where it’s updating the polydraw’s datasource dynamically while I drag it around (MouseMove?)? This question would extend to the polyedit tool, where it would update the datasource dynamically as i move a vertex around. This is how it works with the selection tool, so maybe there’s some code/logic in there I could utilize… As always, any insight appreciated!
Gaelen