Mouse over picking when polygons switch between batches causes errors
See original GitHub issueI get the following error message:
Uncaught RuntimeError: An entity with id 26912e0a-e73c-4b55-ac1b-f1bfed18bd22 already exists in this collection.
Error
at new RuntimeError (http://localhost:8080/Source/Core/RuntimeError.js:43:19)
at EntityCollection.add (http://localhost:8080/Source/DataSources/EntityCollection.js:283:19)
at <anonymous>:58:32
at handleMouseMove (http://localhost:8080/Source/Core/ScreenSpaceEventHandler.js:251:13)
at HTMLDocument.listener (http://localhost:8080/Source/Core/ScreenSpaceEventHandler.js:68:13) (on line 283 of http://localhost:8080/Source/DataSources/EntityCollection.js)
when I run the following sandcastle examples
var viewer = new Cesium.Viewer('cesiumContainer', {
selectionIndicator : false,
infoBox : false
});
var scene = viewer.scene;
var handler;
var pickedEntities = new Cesium.EntityCollection();
var pickColor = Cesium.Color.YELLOW;
function makeProperty(entity, color) {
var colorProperty = new Cesium.CallbackProperty(function(time, result) {
if (pickedEntities.contains(entity)) {
return pickColor.clone(result);
}
return color.clone(result);
}, false);
entity.polygon.material = new Cesium.ColorMaterialProperty(colorProperty);
}
var red = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-70.0, 30.0,
-60.0, 30.0,
-60.0, 40.0,
-70.0, 40.0]),
height : 0
}
});
makeProperty(red, Cesium.Color.RED.withAlpha(0.5));
var blue = viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-75.0, 34.0,
-63.0, 34.0,
-63.0, 40.0,
-75.0, 40.0]),
height : 0
}
});
makeProperty(blue, Cesium.Color.BLUE.withAlpha(0.5));
// Move the primitive that the mouse is over to the top.
handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(movement) {
// get an array of all primitives at the mouse position
var pickedObjects = scene.drillPick(movement.endPosition);
if (Cesium.defined(pickedObjects)) {
//Update the collection of picked entities.
pickedEntities.removeAll();
for (var i = 0; i < pickedObjects.length; ++i) {
var entity = pickedObjects[i].id;
pickedEntities.add(entity);
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
This occurs using Primitives. If you remove the height : 0 from both entities the same thing will occur with GroundPrimitives. It only happens when you force the entity to switch batches during the pick. For Primitive it has to switch between opaque and translucent, for GroundPrimitive it just has to switch color.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Altium Bugs And Things To Watch Out For - mbedded.ninja
If you are finding that when you draw polygons that Altium is not staying the correct distance away from zones you draw on...
Read more >Slowness in specific areas | Altium Designer | Knowledge Base
Sometimes there are settings or things about your documents that can cause unusual slowness. Here are some things to look for.
Read more >AutoCAD Hatch Problems & Tips | 2 Minute Tuesday - YouTube
AutoCAD Hatch Problems & Tips - Boundary Errors + Time Saving ... how to fix any unclosed areas or boundary issues with hatches...
Read more >Help - iTOL
To switch the display mode, click the corresponding button in the Mode section on the top of the Basic controls tab. Trees which...
Read more >BD FACSDiva Software 6.0 Reference Manual
The information in this guide is subject to change without notice. ... to ensure accuracy, BD Biosciences assumes no liability for any errors...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@pjcozzi It looks like this is fixed for
GroundPrimitives, but is still an issue with regularPrimitives (withheight:0in the code).I suspect that the GroundPrimitives were fixed in 203bdf3c6671a4e6fea6b0fd43b77d62605b497b
@tfili: