Skip to content

Significant lag in PointPrimitiveCollection.removeAll #3018

@hpinkos

Description

@hpinkos

With a large number of points, PointPrimitiveCollection.removeAll can take a few seconds to hide the points from the scene.

var viewer = new Cesium.Viewer('cesiumContainer');
var numPoints = 100000;
var pointPrimitives = viewer.scene.primitives.add(new Cesium.PointPrimitiveCollection());
var base = viewer.scene.globe.ellipsoid.radii.x;
var color = Cesium.Color.LIGHTSKYBLUE;
var outlineColor = Cesium.Color.BLACK;

for (var j = 0; j < numPoints; ++j) {
    var position = new Cesium.Cartesian3(
        16000000 * Math.random() - 8000000,
        -(4000000 * j / numPoints + base),
        2000000 * Math.random() - 1000000);

    pointPrimitives.add({
        pixelSize : 5,
        color : color,
        outlineColor : outlineColor,
        outlineWidth : 0,
        position : position
    });
}

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function() {
    pointPrimitives.removeAll();
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

Reported in the forum: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/WiFG75oEkFM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions