資源描述:
《google_earth_api開發(fā)者指南(高級(jí))》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫(kù)。
1、[2008-07-09]Google?Earth?API開發(fā)者指南(高級(jí))(2008-07-1012:43:39)標(biāo)簽:google?earth?開發(fā)?應(yīng)用?財(cái)經(jīng)?分類:學(xué)海拾貝感慨:GoogleEarth真是一個(gè)好東東,而其愛好者更是天才啊。我們與老美在科技上的差距,不是我們以環(huán)境、資源為代價(jià)的粗放式快速增長(zhǎng)的GDP所能掩蓋的。?GoogleEarthAPI開發(fā)者指南(高級(jí))---摘自Godeyes??創(chuàng)建地面覆蓋地面覆蓋,允許您在GoogleEarth的地表上放置圖像。其中,圖像源自網(wǎng)絡(luò),圖片的URL包含在“Icon”對(duì)象內(nèi)。v
2、argroundOverlay=ge.createGroundOverlay(??);groundOverlay.setIcon(ge.createIcon(??))groundOverlay.getIcon().setHref("http://www.google.com/intl/en_ALL/images/logo.gif");groundOverlay.setLatLonBox(ge.createLatLonBox(??));varcenter=ge.getView().copyAsLookAt(ge.ALTITUDE_RE
3、LATIVE_TO_GROUND);varnorth=center.getLatitude()+.85;varsouth=center.getLatitude()-.85;vareast=center.getLongitude()+.55;varwest=center.getLongitude()-.55;varrotation=0;varlatLonBox=groundOverlay.getLatLonBox();latLonBox.setBox(north,south,east,west,rotation);ge.getFeat
4、ures().appendChild(groundOverlay);此例中,Google的logo被疊放在加州總部山景城的位置。地面覆蓋的特點(diǎn)是始終吸附在地表,無(wú)論圖像放在山脈還是河谷,如下圖所示:創(chuàng)建屏幕覆蓋屏幕覆蓋是指圖片固定在屏幕上,不像地面覆蓋那樣跟隨地表起伏而變化。屏幕覆蓋通常用來(lái)做logo、商標(biāo)、圖例等,其長(zhǎng)寬尺寸由size屬性決定。圖像位置(screenXY屬性)由圖中的安置點(diǎn)(overlayXY屬性)控制,其旋轉(zhuǎn)角度由rotationXY屬性決定。下列代碼將用Google標(biāo)志圖來(lái)創(chuàng)建一個(gè)屏幕覆蓋,并傾斜一定角度。va
5、rscreenOverlay=ge.createScreenOverlay(??);screenOverlay.setIcon(ge.createIcon(??));screenOverlay.getIcon().setHref("http://www.google.com/intl/en_ALL/images/logo.gif");//SetscreenpositioninpixelsscreenOverlay.getOverlayXY().setXUnits(ge.UNITS_PIXELS);screenOverlay.getO
6、verlayXY().setYUnits(ge.UNITS_PIXELS);screenOverlay.getOverlayXY().setX(400);screenOverlay.getOverlayXY().setY(200);//Rotatearoundobject?scenterpointscreenOverlay.getRotationXY().setXUnits(ge.UNITS_FRACTION);screenOverlay.getRotationXY().setYUnits(ge.UNITS_FRACTION);sc
7、reenOverlay.getRotationXY().setX(0.5);screenOverlay.getRotationXY().setY(0.5);//Setobject?ssizeinpixelsscreenOverlay.getSize().setXUnits(ge.UNITS_PIXELS);screenOverlay.getSize().setYUnits(ge.UNITS_PIXELS);screenOverlay.getSize().setX(300);screenOverlay.getSize().setY(7
8、5);//Rotate45degreesscreenOverlay.setRotation(45);ge.getFeatures().appendChild(screenOverlay);效果如下圖所示:樣式地圖樣式地圖在一般情況為地