Control over slider window on click of polygon

Is there any way to not show this slider(as in screenshot below) on click of few polygons but to show on click of few other polygons? To simplify what I mean to say, suppose This slider should be shown on click of blue polygon but should not be shown when red polygon is clicked, but I want to keep the ids for both polygons.

ooEl4.png

Hello,

This is a frequently requested feature, we have an issue written up about it here: https://github.com/AnalyticalGraphicsInc/cesium/issues/1592

In the meantime, you can write a custom click handler to set the selected and tracked entities. Here is a code example:

// Remove old click handlers
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

function selectEntity(event) {
var picked = viewer.scene.pick(event.position);
if (Cesium.defined(picked)) {
var id = Cesium.defaultValue(picked.id, picked.primitive.id);
if (id instanceof Cesium.Entity && [INSERT CONDITION HERE]) {
viewer.selectedEntity = id;
}
}
}
function trackEntity(event) {
var picked = viewer.scene.pick(event.position);
if (Cesium.defined(picked)) {
var id = Cesium.defaultValue(picked.id, picked.primitive.id);
if (id instanceof Cesium.Entity && [INSERT CONDITION HERE]) {
viewer.trackedEntity = id;
}
}
}
// Set new click handlers
viewer.cesiumWidget.screenSpaceEventHandler.setInputAction(selectEntity, Cesium.ScreenSpaceEventType.LEFT_CLICK);
viewer.cesiumWidget.screenSpaceEventHandler.setInputAction(trackEntity, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

``

For example, if you only wanted to select opaque ellipses, you could add this condition: id.ellipse.material.getValue(viewer.clock.currentTime).color.alpha === 1.0

Best,

Hannah

Thanks Hannah!!

It worked for the polygons for which I do not want to show infobox. But the infobox does not show the ID of selected entity when clicked for other polygons.

What is causing this?

cap2.PNG

Hi MP, I couldn’t reproduce this. Can you give me an example polygon?

-Hannah

Hi Hannah,

I have created a GIST to replicate the issue:

http://cesiumjs.org/Cesium/Apps/Sandcastle/?src=Hello%20World.html&label=Showcases&gist=b9b5051d60905cab680acb625e64cb1e

You need to set viewer.selectedEntity = pickedObject.id; instead of pickedObject.id._id;

-Hannah

Ohh. thankyou.

try setting the viewer property ‘selectionIndicator’ to false