label is rendering under ground

201 views
Skip to first unread message

emree...@gmail.com

unread,
Dec 17, 2014, 10:50:41 AM12/17/14
to cesiu...@googlegroups.com
code is

//Get the array of entities
var entities = dataSource.entities.entities;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
var name = entity.name;

//Make sure it's a polygon and doesn't already have a position.
if (!entity.position && entity.polygon) {
var center = Cesium.BoundingSphere.fromPoints(entity.polygon.positions.getValue()).center;
Cesium.Ellipsoid.WGS84.scaleToGeodeticSurface(center, center);
entity.position = new Cesium.ConstantPositionProperty(center);
}

//Set up the label.
var label = new Cesium.LabelGraphics();
label.text = new Cesium.ConstantProperty(name);
label.font = new Cesium.ConstantProperty('12pt SoberanaSans');
label.fillColor = new Cesium.ConstantProperty(Cesium.Color.WHITE);
label.outlineColor = new Cesium.ConstantProperty(Cesium.Color.BLACK);
label.outlineWidth = new Cesium.ConstantProperty(1);
label.style = new Cesium.ConstantProperty(Cesium.LabelStyle.FILL_AND_OUTLINE)
entity.label = label;
}

result is

http://tinypic.com/r/2cnhwk8/8

how can I resolve this problem.

Chris M.

unread,
Dec 17, 2014, 10:56:05 AM12/17/14
to cesiu...@googlegroups.com, emree...@gmail.com
Try disabling depth testing against terrain. If you're drawing the labels near the surface, parts of them may be considered underground and will be hid under the earth. This setting can be found in scene.globe.depthTestingAgainstTerrain. 

emree...@gmail.com

unread,
Dec 17, 2014, 2:31:29 PM12/17/14
to cesiu...@googlegroups.com, emree...@gmail.com
not working, still under ground.

terrain is not opened. Is cesium not support surface geometries?

I want to render polygon over globe with terrain
Reply all
Reply to author
Forward
0 new messages