gcode-mirror / earth-api-samples

Automatically exported from code.google.com/p/earth-api-samples
0 stars 0 forks source link

Can't color polygon with altitude #105

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Once a polygon is placed above ground level with

var polygon = ge.createPolygon('');
            polygon.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);

Changing the colour values of the polygon have no effect. The transparency
and the colour of the line can change.

var polyColor = placemark.getStyleSelector().getPolyStyle().getColor();
polyColor.setA(255); //Set opacity - will work
polyColor.setR(255); //Set red - won't work

Original issue reported on code.google.com by edmund.h...@gmail.com on 3 Dec 2008 at 10:03

GoogleCodeExporter commented 9 years ago
Hi edmund, I can't reproduce this; it may be something with your code. Also 
make sure
that your polygon coordinates are in counterclockwise order.

Can you post a more complete sample to the group? Thanks.

Here's a sample that does work:

var outerBoundary = ge.createLinearRing('');
var coords = outerBoundary.getCoordinates();
coords.pushLatLngAlt(0, 0, 10000); 
coords.pushLatLngAlt(0, 1, 10000); 
coords.pushLatLngAlt(1, 1, 10000); 
coords.pushLatLngAlt(1, 0, 10000); 

var polygon = ge.createPolygon('');
polygon.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND);
polygon.setOuterBoundary(outerBoundary);

var polygonPlacemark = ge.createPlacemark('');
polygonPlacemark.setGeometry(polygon);
ge.getFeatures().appendChild(polygonPlacemark);

polygonPlacemark.setStyleSelector(ge.createStyle(''));
var polyColor = polygonPlacemark.getStyleSelector().getPolyStyle().getColor();
polyColor.setA(255);
polyColor.setB(0);
polyColor.setG(255);
polyColor.setR(255);

Original comment by api.roman.public@gmail.com on 10 Dec 2008 at 6:29

GoogleCodeExporter commented 9 years ago
Hi,

I changed my code to make the circle in an anti-clockwise direction and this 
works fine.

Thanks

Original comment by edmund.h...@gmail.com on 11 Dec 2008 at 12:29