problem with cesium entity outlineWidth

837 views
Skip to first unread message

kfirbene

unread,
Jul 19, 2017, 10:37:17 AM7/19/17
to cesium-dev
Hi,

I have a cesium application and I am creating Cesium entities of various types:
Billboards, polylines, polygons and ellipse.

Here is how I am creating them:

                     var ellipse= Cesium.entities.add({
                              id: 'myEllipse',
                              position: new Cesium.Cartesian3.fromDegrees(parseFloat(center.x), parseFloat(center.y), parseFloat(center.z)),
                              ellipse: {
                                  semiMinorAxis: 600,
                                  semiMajorAxis: 600,
                                  material: Cesium.Color.RED.withAlpha(0.1),
                                  outline: true,
                                  outlineColor: Cesium.Color.RED,
                                  outlineWidth: 3.5,
                                  show: true,
                                  fill: false
                              }
                     });
                     var myEntity = Cesium.entities.add({
                          position: new Cesium.Cartesian3.fromDegrees(parseFloat(position.x), parseFloat(position.y), parseFloat(position.z)),
                          id: name,
                          billboard: {
                              name: name,
                              scale: 0.9,
                              image: icon,
                              rotation: Cesium.Math.toRadians(parseFloat(angle))
                          },
                          polyline: {
                              positions: [new Cesium.Cartesian3.fromDegrees(parseFloat(position.x), parseFloat(position.y), parseFloat(position.z)),
                                  new Cesium.Cartesian3.fromDegrees(parseFloat(center.x), parseFloat(center.y), parseFloat(center.z))],
                              width: 3.5,
                              material: Cesium.Color.RED
                          }
                     });

                    var polygon = Cesium.entities.add({
                          id: name,
                          polygon: {
                              hierarchy: new Cesium.Cartesian3.fromDegreesArray(groundProjectionArray),
                              extrudedHeight: 0,
                              perPositionHeight: false,
                              material: Cesium.Color.RED.withAlpha(0.1),
                              outline: true,
                              outlineWidth: 3.5,
                              outlineColor: Cesium.Color.RED,
                              show: true,
                              fill: true
                          }
                      });


The issue is that I need thicker outlineWidth but it is working only on the polyline and not on the ellipse and polygon.

How do I set it correctly?

Thanks.

Rachel Hwang

unread,
Jul 20, 2017, 11:32:05 AM7/20/17
to cesium-dev
Hi there,

Try adding height : 0 to your polygon and ellipse objects. When height is undefined, Cesium by default will clamp your geometry to the ground, and outlines are not supported when shapes are ground clamped.

Hope that helps,
- Rachel

kfirbene

unread,
Jul 23, 2017, 3:00:10 AM7/23/17
to cesium-dev
Hi Rachel,

Now I understand why the out lines width are not working, but the height: 0 did not solve it.

Any idea why?

Rachel Hwang

unread,
Jul 24, 2017, 9:06:45 AM7/24/17
to cesium-dev
Hi there,

I don't see anything else wrong with your code right now -- try double checking against similar sandcastle examples: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Polygon.html&label=Showcases

Hope that helps,
- Rachel

On Wednesday, July 19, 2017 at 10:37:17 AM UTC-4, kfirbene wrote:
Reply all
Reply to author
Forward
0 new messages