Skip to content
New issue

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

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

Already on GitHub? # to your account

Add sun and moon labels #1218

Closed
pjcozzi opened this issue Oct 3, 2013 · 3 comments
Closed

Add sun and moon labels #1218

pjcozzi opened this issue Oct 3, 2013 · 3 comments

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented Oct 3, 2013

As mentioned in #1189

@pjcozzi pjcozzi mentioned this issue Oct 4, 2013
@pjcozzi
Copy link
Contributor Author

pjcozzi commented May 13, 2015

No one has asked for this except me and this can be done at the app level so I am OK with closing this. Anyone feel otherwise?

@emackey
Copy link
Contributor

emackey commented May 13, 2015

Can we post a sample of app code that does this?

@mramato
Copy link
Contributor

mramato commented Oct 14, 2015

@emackey, here's a quick 2 minute example I whipped up using the Entity API. In 3D the near/far plane kicks in so you don't see them, but they do work in 2D.

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

var sunPositionProperty = new Cesium.CallbackProperty(function(time, result){
    Cesium.Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame(time, result);
     return Cesium.PositionProperty.convertToReferenceFrame(
        time,
        result,
        Cesium.ReferenceFrame.INERTIAL,
        Cesium.ReferenceFrame.FIXED,
        result);
}, false);

var moonPositionProperty = new Cesium.CallbackProperty(function(time, result){
    Cesium.Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame(time, result);
     return Cesium.PositionProperty.convertToReferenceFrame(
        time,
        result,
        Cesium.ReferenceFrame.INERTIAL,
        Cesium.ReferenceFrame.FIXED,
        result);
}, false);

viewer.entities.add({
    position :  sunPositionProperty,
    label : {
        text : 'Sun'
    }
});

viewer.entities.add({
    position :  moonPositionProperty,
    label : {
        text : 'Moon'
    }
});

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

No branches or pull requests

4 participants