Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label/Billboard show/hide bug #4408

Closed
hpinkos opened this issue Oct 6, 2016 · 7 comments
Closed

Label/Billboard show/hide bug #4408

hpinkos opened this issue Oct 6, 2016 · 7 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Oct 6, 2016

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

  1. Load the example and zoom in to see the labels
  2. Hit hide - This works correctly
  3. Hit show - Only the labels come back, the billboards don't
  4. Now neither the show or hide button have any effect
var viewer = new Cesium.Viewer('cesiumContainer');
var options = {
    camera : viewer.scene.camera,
    canvas : viewer.scene.canvas
};
var kml = '../../SampleData/kml/facilities/facilities.kml';
var kmlds;

viewer.dataSources.add(Cesium.KmlDataSource.load(kml, options))
.then(function(ds) {
    kmlds = ds;
});

Sandcastle.addToolbarButton('Hide', function() {
    kmlds.show = false;
});
Sandcastle.addToolbarButton('Show', function() {
    kmlds.show = true;
});
@hpinkos
Copy link
Contributor Author

hpinkos commented Oct 6, 2016

https://groups.google.com/forum/?hl=en#!topic/cesium-dev/hPY2I3HZzyA
Creating the entities from the Entity API causes the same problem:

var viewer = new Cesium.Viewer('cesiumContainer');

var label = viewer.entities.add({
    position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
    point: {
        pixelSize: 5,
        outlineColor: Cesium.Color.BLACK,
        outlineWidth: 1
    },
     label: {
        text: 'Label',
        font: '20pt Verdana',
        pixelOffset: new Cesium.Cartesian2(0, -30),
        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
    }
});

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function() {
    label.show = label.show ? false : true;
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

@hpinkos hpinkos changed the title KmlDataSource show/hide bug Label/Billboard show/hide bug Oct 6, 2016
@hpinkos
Copy link
Contributor Author

hpinkos commented Oct 12, 2016

Also reported here: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/L5-UMH051RY

I labeled this for next release since it's effecting a number of users

@lilleyse
Copy link
Contributor

@tfili
Copy link
Contributor

tfili commented Oct 19, 2016

@bagnell It looks like this is caused by clustering. I can only reproduce this with the KML example. Another thing I noticed is that when it worked before clustering turning on the entities was pretty quick, now its really slow (even when clustering isn't enabled).

@bagnell
Copy link
Contributor

bagnell commented Oct 19, 2016

@tfili I tracked down the show problem, but the performance problem has to do with height referenced billboards and labels.

@mramato
Copy link
Contributor

mramato commented Oct 19, 2016

KML is defaulting to terrain clamping for billboards even though it shouldn't, which is why performance there is slow there, #4459 should fix the default behavior, but it will still be slow when clamping is on.

@bagnell bagnell closed this as completed Oct 19, 2016
@Kulvinderjatt
Copy link

var viewer = new Cesium.Viewer('cesiumContainer');

var label = viewer.entities.add({
position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
point: {
pixelSize: 5,
outlineColor: Cesium.Color.BLACK,
outlineWidth: 1
},
label: {
text: 'Label',
font: '20pt Verdana',
pixelOffset: new Cesium.Cartesian2(0, -30),
verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
}
});

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function() {
label.show = label.show ? false : true;
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

This works like a charm. Thanks alot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants