Marking an entity as not pickable?

837 views
Skip to first unread message

kry...@gmail.com

unread,
Mar 4, 2016, 1:57:29 PM3/4/16
to cesium-dev
Hi guys,

I have a scene made from a very large flat rectangle and a bunch of small extruded ellipses.  

At most angles, everything is fine and the ellipses extrude overtop of the rectangle.  At some angles however, the rectangle goes overtop of the ellipses and they are no longer pickable by clicking.

The Visualizing Spacial Data tutorial hints that it's possible to disable selection of an entity:

"Unless we specifically disable it, clicking on an entity in the Viewer will show the SelectionIndicator widget at the Entity’s location..."

I've poured over all the docs and can't find any mention of how this behavior can be disabled for a particular entity.  Am I missing something?  

Thanks,
--Mike

Hannah Pinkos

unread,
Mar 4, 2016, 3:14:35 PM3/4/16
to cesium-dev
Hello Mike,

That comment from the tutorial means to say the SelectionIndicator will show unless you disable the SelectionIndicator.  Right now, there isn't currently a way to disable picking for entities.
It's a very frequently requested feature, so hopefully someone will get a chance to work on it soon.

Best,

Hannah

Mike Ravkine

unread,
Mar 7, 2016, 12:04:06 PM3/7/16
to cesiu...@googlegroups.com
Hi Hannah,

Thanks that was actually really helpful.

I've now got a version of Viewer.pickEntity that behaves the way I want (won't return things if Entity.pickable is set to false) and it works.. but I have to hack the Cesium code, which is not ideal.

I have tried several different ways to override Viewer.pickEntity from outside cesium but to no avail:

// Doesn't work #1
var viewer = Cesium.Viewer(..);
viewer.pickEntity = function(viewer,e) {...};

// Doesn't work #2
var viewer = Cesium.Viewer(..);
function override_pickEntity(viewer, options) {
    alert('mixin called!');
    viewer.pickEntity = function(viewer, e) {...};
}
viewer.extend(override_pickEntity, {});

// Doesn't work #3
var orig_Mybasefunction = Cesium.Viewer;
Cesium.Viewer = function(container, options) {
    orig_Mybasefunction(container, options);
    this.pickEntity = function(viewer, e) { ... }
}
var viewer = Cesium.Viewer(..);

Attempts #1 and #2 seem to do nothing, my pickEntity function is never called.  Attempt #3 produces a run-time error.

I don't know JavaScript well enough to understand how you guys are building up your objects, what is the correct way to override this function on my Cesium.Viewer instance?

Thanks,
--Mike


--
You received this message because you are subscribed to a topic in the Google Groups "cesium-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cesium-dev/0XA8qWPQfRE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hannah Pinkos

unread,
Mar 7, 2016, 1:28:39 PM3/7/16
to cesium-dev
Hi Mike,

pickEnttiy is a private function within Viewer, so you can't override it outside of Cesium.  You will have to download the code, make the change and combine the changes in to a new Cesium.js file.
That will give you instructions for getting the code base and running our build scripts.  You can use the 'minify' command to get a minified Cesium.js file.

Best,

Hannah
Reply all
Reply to author
Forward
0 new messages