1
API 및 Google 플러그인을 사용하여 Google 어스 환경에서 3D 모델을 나타내고 싶습니다.Google 어스 API에서 3D 모델 복제
내가 코드를 가지고 :
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_HIDE);
// Placemark
var placemark = ge.createPlacemark('Modello1');
placemark.setName('model');
var place2 = ge.createPlacemark('Modello2');
place2.setName('modello2');
// Placemark/Model (geometry)
var model = ge.createModel('Mod1');
placemark.setGeometry(model);
var modello2 = ge.createModel('Mod2');
place2.setGeometry(modello2);
// Placemark/Model/Link
var link = ge.createLink('File1');
link.setHref("http://myhost.org/table2/models/table2.dae");
model.setLink(link);
var link2 = ge.createLink('File2');
link2.setHref("http://myhost.org/tavolo/models/table2.dae");
modello2.setLink(link2);
// get center look at location
var lookAt = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
// Placemark/Model/Location
var loc = ge.createLocation('');
loc.setLatitude(40.01000594412381);
loc.setLongitude(-105.2727379358738);
model.setLocation(loc);
//slightly varying coordinates...
var loc2 = ge.createLocation('');
loc2.setLatitude(40.01000594412389);
loc2.setLongitude(-105.2727379358731);
modello2.setLocation(loc2);
// add the model placemark to Earth
ge.getFeatures().appendChild(placemark);
ge.getFeatures().appendChild(place2);
// zoom into the model
lookAt.setLatitude(40.01000594412381);
lookAt.setLongitude(-105.2727379358738);
lookAt.setRange(300);
lookAt.setTilt(80);
ge.getView().setAbstractView(lookAt);
}
function failureCB(errorCode) {
}
google.setOnLoadCallback(init);
내가 다른 COLLADA (.dae 만)을로드 아무런 문제가 나타나지 파일 ...하지만 동일한 표 2 번로드하지 않습니다! 왜?!?
또한 인스턴스와 파일을 분리하려고 시도했지만 문제가 지속됩니다. 내 환경에는 단 하나의 테이블 만 있습니다.
N 모델에 단일 모델을 복제하는 방법이 있습니까?
에서 제대로 렌더링되는지 확인하고 getKml 그것을 읽어보십시오. 숫자 정밀도 및 넘침 문제가 있음을 확인했습니다 (exp 번호를 보여줍니다) 시도 : loc.setLatitude (40.017005); loc.setLongitude (-105.283005); 모두 제대로 작동하는 것 같습니다. 정말 고마워요. –