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

Polygon entity fails to update when color property changes from dynamic to static #3807

Closed
hpinkos opened this issue Apr 6, 2016 · 2 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Apr 6, 2016

See details in this forum post: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/j5u54nu5oOc

var czml = [{
    "clock": {
        "currentTime": "2016-01-01T00:00:00Z",
        "interval": "2016-01-01T00:00:00Z/2024-12-31T23:59:58Z",
        "range": "LOOP_STOP",
        "step": "SYSTEM_CLOCK_MULTIPLIER",
        "multiplier": 20000000
    },
    "name": "test",
    "version": "1.0",
    "id": "document",
    "properties": null
}, {
    "polygon": {
        "material": {
            "solidColor": {
                "color": {
                    "rgba": [0, 255, 0, 179]
                }
            }
        },
        "positions": {
            "cartographicDegrees": [144.991, -37.914, 0.0,
                                    144.991, -37.720, 0.0,
                                    145.284, -37.720, 0.0,
                                    145.284, -37.914, 0.0]
        },
        "outlineColor": {
            "rgba": [50, 50, 50, 255]
        },
        "outline": true
    },
    "name": "Something",
    "description": "foo"
}];

var viewer = new Cesium.Viewer('cesiumContainer');
var dataSource = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSource);
viewer.zoomTo(dataSource);

var options = [{
    text : 'Static Green',
    onselect : function() {
        viewer.dataSources.get(0).entities.values[0].polygon.material = Cesium.Color.fromCssColorString('#00FF00');
    }
}, {
    text : 'Static Red',
    onselect : function() {
        viewer.dataSources.get(0).entities.values[0].polygon.material = Cesium.Color.fromCssColorString('#FF0000');
    }
}, {
    text : 'Time dynamic blue',
    onselect : function() {
        var tic = new Cesium.TimeIntervalCollectionProperty();
        tic.intervals.addInterval(new Cesium.TimeInterval({
            start: Cesium.JulianDate.fromIso8601('2015-01-01'),
            stop: Cesium.JulianDate.fromIso8601('2025-01-01'),
            data: Cesium.Color.fromCssColorString('#0000FF')
        }));
        viewer.dataSources.get(0).entities.values[0].polygon.material = new Cesium.ColorMaterialProperty(tic);
    }
}];

Sandcastle.addToolbarMenu(options);
@lilleyse
Copy link
Contributor

lilleyse commented Jul 8, 2016

This seems to work fine on master right now, @kring can you confirm?

@kring
Copy link
Member

kring commented Jul 9, 2016

Yes this is working nicely now. Thanks @lilleyse!

@kring kring closed this as completed Jul 9, 2016
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

3 participants