2012-11-08 53 views
0

問題是我需要改變拉伸線的邊界的默認顏色和不透明度。這是來自GE API的image造型擠壓線在GE

所以,我需要自定義線條下的灰色「牆」。它如何重新調整?謝謝。

回答

0

,基本上「擠出的線的邊界」是一個多邊形對象和應分別樣式。

下面是從GE API將樣品與一個附加的線和一條新方法getPolyStyle(),這增加了自定義風格的「牆」:

// Create the placemark 
var lineStringPlacemark = ge.createPlacemark(''); 

// Create the LineString; set it to extend down to the ground 
// and set the altitude mode 
var lineString = ge.createLineString(''); 
lineStringPlacemark.setGeometry(lineString); 
lineString.setExtrude(true); 
lineString.setAltitudeMode(ge.ALTITUDE_RELATIVE_TO_GROUND); 

// Add LineString points 
lineString.getCoordinates().pushLatLngAlt(48.754, -121.835, 700); 
lineString.getCoordinates().pushLatLngAlt(48.764, -121.828, 700); 
lineString.getCoordinates().pushLatLngAlt(48.776, -121.818, 700); 
lineString.getCoordinates().pushLatLngAlt(48.787, -121.794, 700); 
lineString.getCoordinates().pushLatLngAlt(48.781, -121.778, 700); 
lineString.getCoordinates().pushLatLngAlt(48.771, -121.766, 700); 
lineString.getCoordinates().pushLatLngAlt(48.757, -121.768, 700); 
lineString.getCoordinates().pushLatLngAlt(48.747, -121.773, 700); 

// Create a style and set width and color of line 
lineStringPlacemark.setStyleSelector(ge.createStyle('')); 
var lineStyle = lineStringPlacemark.getStyleSelector().getLineStyle(); 

/*** STYLING THE POLYGON ('WALL') UNDER THE LINE ***/ 
lineStringPlacemark.getStyleSelector().getPolyStyle().getColor().set('9900ffff'); 
/***************************************************/ 

lineStyle.setWidth(5); 
lineStyle.getColor().set('9900ffff'); // aabbggrr format 

// Add the feature to Earth 
ge.getFeatures().appendChild(lineStringPlacemark); 
0

基本上你需要添加一個LineStyle樣式到你的特徵並指定顏色。

多邊形顏色指定填充的顏色(該多邊形區域內)和線的顏色指定線,環,和多邊形的線邊界。

GE API的一個例子可以在這裏找到。 http://earth-api-samples.googlecode.com/svn/trunk/examples/linestring-style.html

要指定不透明度,你需要在aabbggrr格式設置的阿爾法值(FF =完全不透明)代碼顏色在此代碼段:所以

var lineStyle = placemark.getStyleSelector().getLineStyle(); 
lineStyle.setWidth(lineStyle.getWidth() + 2); 
lineStyle.getColor().set('6600ffff'); // aabbggrr format 
+0

感謝您的暗示! – evenfrost