Модераторы: Sardar, Aliance
  

Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Вопрос про формат Dae в Google Earth API, не получается добавить на свой сайт 3d 
:(
    Опции темы
Yline
Дата 24.8.2011, 20:19 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Новичок



Профиль
Группа: Участник
Сообщений: 17
Регистрация: 3.2.2007
Где: г. Екатеринбург

Репутация: нет
Всего: нет



Недавно начал изучение Google Earth Api.
С сайта code.google.com скопировал пример на котором отображаеться куб.
Вот этот код:
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Earth API Sample</title>
    <script src="http://www.google.com/jsapi?key=ABQIAAAAuPsJpk3MBtDpJ4G8cqBnjRRaGTYH6UMl8mADNa0YKuWNNa8VNxQCzVBXTx2DYyXGsTOxpWhvIG7Djw" type="text/javascript"></script>
    <script type="text/javascript">
      function addSampleButton(caption, clickHandler) {
        var btn = document.createElement('input');
        btn.type = 'button';
        btn.value = caption;
        
        if (btn.attachEvent)
          btn.attachEvent('onclick', clickHandler);
        else
          btn.addEventListener('click', clickHandler, false);

        // add the button to the Sample UI
        document.getElementById('sample-ui').appendChild(btn);
      }
      
      function addSampleUIHtml(html) {
        document.getElementById('sample-ui').innerHTML += html;
      }
    </script>
    <script type="text/javascript">
    var ge;
    
    google.load("earth", "1");
    
    function init() {
      google.earth.createInstance('map3d', initCallback, failureCallback);
    
      addSampleButton('Create a 3D Model!', buttonClick);
    }
    
    function initCallback(instance) {
      ge = instance;
      ge.getWindow().setVisibility(true);
    
      // add a navigation control
      ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
    
      // add some layers
      ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
      ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
    
      var la = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
      la.setRange(100000);
      ge.getView().setAbstractView(la);
    
      create3dModel();
    
      document.getElementById('installed-plugin-version').innerHTML =
        ge.getPluginVersion().toString();
    }
    
    function failureCallback(errorCode) {
    }
    
    function create3dModel() {
      // Create a 3D model, initialize it from a Collada file, and place it
      // in the world.
    
      var placemark = ge.createPlacemark('');
      placemark.setName('model');
      var model = ge.createModel('');
      ge.getFeatures().appendChild(placemark);
      var loc = ge.createLocation('');
      model.setLocation(loc);
      var link = ge.createLink('');
    
      // A textured model created in Sketchup and exported as Collada.
      link.setHref('http://earth-api-samples.googlecode.com/svn/trunk/examples/' +
                   'static/splotchy_box.dae');
      model.setLink(link);
    
      var la = ge.getView().copyAsLookAt(ge.ALTITUDE_RELATIVE_TO_GROUND);
      loc.setLatitude(la.getLatitude());
      loc.setLongitude(la.getLongitude());
    
      placemark.setGeometry(model);
    
      la.setRange(300);
      la.setTilt(45);
      ge.getView().setAbstractView(la);
    }
    
    function buttonClick() {
      create3dModel();
    }
    
    </script>
  </head>
  <body onload="init()" style="font-family: arial, sans-serif; font-size: 13px; border: 0;">
    <div id="sample-ui"></div>
    <div id="map3d" style="width: 500px; height: 380px;"></div>
    <br>
    <div>Installed Plugin Version: <span id="installed-plugin-version" style="font-weight: bold;">Loading...</span></div>
  </body>
</html>

Далее в программе SketchUp создал свою 3-х мерную модель куба и загрузил а свой сайт. В этом коде в строчке
  link.setHref('http://earth-api-samples.googlecode.com/svn/trunk/examples/' +
                   'static/splotchy_box.dae');

меняю на адрес расположения своего куба 
  link.setHref('http://имя_сайта/1.dae');

но моего куба не видно, атолько океан, Подскажите пожалуйста, что я не так делаю
PM MAIL ICQ   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | JavaScript: Применение библиотек | Следующая тема »


 




[ Время генерации скрипта: 0.0840 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.