0

У меня проблема с POI. После входа в мир я не вижу никакой точки интереса.Wikitude. Достопримечательности

код в Android:

@Override 
protected void onPostCreate(Bundle savedInstanceState) { 
    super.onPostCreate(savedInstanceState); 
    buildGoogleApiClient(); 
    architectView.onPostCreate(); 
    try { 
     this.architectView.setLocation(mLastLocation.getLatitude(),mLastLocation.getLongitude(),mLastLocation.getAltitude(),mLastLocation.getAccuracy()); 
     this.architectView.load("file:///android_asset/demo2/index.html"); 
    } 
    catch (Exception e){ 
    } 

HTML из моих активов:

<!-- MAIN PAGE CONTENT --> 

    <!-- transparent footer--> 
    <div data-role="footer" class="ui-bar" data-theme="f" data-position="fixed" style="text-align:center;"> 

     <!-- small status-button --> 
     <a style="text-align:right;" id="popupInfoButton" href="#popupInfo" data-rel="popup" data-role="button" class="ui-icon-alt" data-inline="true" data-transition="pop" data-icon="alert" data-theme="e" data-iconpos="notext">Log</a> </p> 

     <!-- popup displayed when button clicked --> 
     <div data-role="popup" id="popupInfo" class="ui-content" data-theme="e" style="max-width:350px;"> 
      <p style="text-align:right;" id="status-message">Trying to find out where you are</p> 
     </div> 

    </div> 

</div> 

А вот Javascript код из примера:

// implementation of AR-Experience (aka "World") 
var World = { 
    // true once data was fetched 
    initiallyLoadedData: false, 

    // POI-Marker asset 
    markerDrawable_idle: null, 

    // called to inject new POI data 
    loadPoisFromJsonData: function loadPoisFromJsonDataFn(poiData) { 

     /* 
     The example Image Recognition already explained how images are loaded and displayed in the augmented reality view. This sample loads an AR.ImageResource when the World variable was defined. It will be reused for each marker that we will create afterwards. 
     */ 
     World.markerDrawable_idle = new AR.ImageResource("assets/marker_idle.png"); 

     /* 
     For creating the marker a new object AR.GeoObject will be created at the specified geolocation. An AR.GeoObject connects one or more AR.GeoLocations with multiple AR.Drawables. The AR.Drawables can be defined for multiple targets. A target can be the camera, the radar or a direction indicator. Both the radar and direction indicators will be covered in more detail in later examples. 
     */ 
     var markerLocation = new AR.GeoLocation(poiData.latitude, poiData.longitude, poiData.altitude); 
     var markerImageDrawable_idle = new AR.ImageDrawable(World.markerDrawable_idle, 2.5, { 
     zOrder: 0, 
     opacity: 1.0 
     }); 

     // create GeoObject 
     var markerObject = new AR.GeoObject(markerLocation, { 
     drawables: { 
      cam: [markerImageDrawable_idle] 
     } 
     }); 

     // Updates status message as a user feedback that everything was loaded properly. 
     World.updateStatusMessage('1 place loaded'); 
    }, 

    // updates status message shon in small "i"-button aligned bottom center 
    updateStatusMessage: function updateStatusMessageFn(message, isWarning) { 

     var themeToUse = isWarning ? "e" : "c"; 
     var iconToUse = isWarning ? "alert" : "info"; 

     $("#status-message").html(message); 
     $("#popupInfoButton").buttonMarkup({ 
     theme: themeToUse 
     }); 
     $("#popupInfoButton").buttonMarkup({ 
     icon: iconToUse 
     }); 
    }, 

    // location updates, fired every time you call architectView.setLocation() in native environment 
    locationChanged: function locationChangedFn(lat, lon, alt, acc) { 

     /* 
     The custom function World.onLocationChanged checks with the flag World.initiallyLoadedData if the function was already called. With the first call of World.onLocationChanged an object that contains geo information will be created which will be later used to create a marker using the World.loadPoisFromJsonData function. 
     */ 
     if (!World.initiallyLoadedData) { 
     // creates a poi object with a random location near the user's location 
     var poiData = { 
      "id": 1, 
      "longitude": (lon + (Math.random()/5 - 0.1)), 
      "latitude": (lat + (Math.random()/5 - 0.1)), 
      "altitude": 100.0 
     }; 

     World.loadPoisFromJsonData(poiData); 
     World.initiallyLoadedData = true; 
     } 
    }, 
}; 

/* 
    Set a custom function where location changes are forwarded to. There is also a possibility to set AR.context.onLocationChanged to null. In this case the function will not be called anymore and no further location updates will be received. 
*/ 
AR.context.onLocationChanged = World.locationChanged; 

Перед установкой местоположения в architectView Я имел меня ssage "Попытка выяснить, где вы находитесь". Спасибо за все отзывы.

+0

Какая платформа вы используете? PhoneGap? –

ответ

0

Вы пытались позвонить по номеру this.architectView.setLocation(mLastLocation.getLatitude(),mLastLocation.getLongitude(),mLastLocation.getAltitude(),mLastLocation.getAccuracy()); после this.architectView.load("file:///android_asset/demo2/index.html");? Вы также можете реализовать класс ArchitectView.ArchitectWorldLoadedListener, чтобы ввести местоположение после завершения загрузки веб-представления .html.

Смежные вопросы