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

Text from a KML/vector layer is not correctly rendered in 3D mode #345

Open
jmgomezpoveda opened this issue Apr 11, 2016 · 10 comments
Open

Comments

@jmgomezpoveda
Copy link
Contributor

Text defined in the style of items in a vector layer is not correctly rendered when in 3D mode.

  • The text appears much larger compared to the feature images than it was in 2D mode.
  • The text appears behind the feature images, so it can only be partially seen (this is critical when the text may just be one or two digits).
@gberaudo
Copy link
Member

Do you have a screenshot?

@jmgomezpoveda
Copy link
Contributor Author

Screenshots attached. This is the same map, just enabling the 3d mode.

vector-text-2d
vector-text-3d

@gberaudo
Copy link
Member

Text style is handled in src/featureconverter.js, in olcs.FeatureConverter.prototype.olGeometry4326TextPartToCesium.

For having texts above the circles, there is the https://cesiumjs.org/Cesium/Build/Documentation/Label.html?classFilter=label#eyeOffset property in Cesium.

@jmgomezpoveda
Copy link
Contributor Author

The vectors sample shows the same issue as above (text labels are too big and behind the feature), plus an additional issue, that letter within a piece of text are not vertically aligned (some letters are higher than others).

screenshot from 2016-05-02 09-38-33

@gberaudo
Copy link
Member

gberaudo commented May 2, 2016

Regarding the size of the text, there is certainly some adjustement we should do.
Regarding alignment, it may be related to CesiumGS/cesium#3166
Regarding order, maybe we could put an eyeoffset: https://cesiumjs.org/Cesium/Build/Documentation/Billboard.html#eyeOffset.

@jmgomezpoveda
Copy link
Contributor Author

Indeed, the alignment issue seems to be the one reported in CesiumGS/cesium#3166.

On the order, as per the documentation, eyeOffset seems to move the billboard in the y axis, but does not seem to change the z order.

As a workaround I was thinking more along the lines of defining the style as two separate styles for the image and the text, hoping that one will be drawn after the other, though I am not sure if that is supported by style functions.

@gberaudo
Copy link
Member

gberaudo commented May 3, 2016

The documentation example is: b.eyeOffset = new Cartesian3(0.0, 8000000.0, 0.0); which moves in the y direction. Having non zero value for z will move in the z direction.

@jmgomezpoveda
Copy link
Contributor Author

As suggested, adding options.eyeOffset = new Cesium.Cartesian3(0.0, 0.0, -5.0); to olGeometry4326TextPartToCesium solves the issue with the z-order. Though, that -5 seems a bit arbitrary (I have tried smaller values, -1 and -2, and in those cases the text was still behind the polygon). Should I send a PR?

@gberaudo
Copy link
Member

gberaudo commented May 9, 2016

I don't see an easy and general way to handle this. So I would skip the PR for the moment.

@jmgomezpoveda
Copy link
Contributor Author

Ok, let me know if you have any other ideas or you want me to test anything.

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

No branches or pull requests

2 participants