2016-04-22 119 views
0

我有POI問題。進入這個世界之後,我看不到任何興趣點。Wikitude。興趣點

代碼在安卓

@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.load("file:///android_asset/demo2/index.html");之後致電this.architectView.setLocation(mLastLocation.getLatitude(),mLastLocation.getLongitude(),mLastLocation.getAltitude(),mLastLocation.getAccuracy());?一旦Web視圖完成加載.html,您還可以實施ArchitectView.ArchitectWorldLoadedListener類來注入位置。