Start a new topic

When does wikitude paint POIs (the exact line)?

When does wikitude paint POIs (the exact line)?


Hello!

I need to know the exact line where a POI is painted in screen in order to change the behavior to paint clusters.

This is the function I use to create and show a poi (inside poiatlocation.js):

createMarkerAtLocation: function createMarkerAtLocationFn(latitude, longitude, altitude, nameMarker, pathImageFile, indexPosition, distanceLabel) {

 

if( !markerList.hasItem(indexPosition) ){

      var poiData = {

            "lat" : parseFloat(latitude),

            "lon" : parseFloat(longitude),

            "altitude" : parseFloat(calculateAltitudeFromDistance(distanceLabel)) /*altitudeTmp*/ /*AR.CONST.UNKNOWN_ALTITUDE*/,

            "name" : nameMarker,

            "indexPosition" : parseInt(indexPosition),

            "distance" : distanceLabel

      };

      markerList.setItem(indexPosition, new Marker( poiData, new AR.ImageResource(pathImageFile)) );

}

PoiRadar.show(); 

}

 

And this is the end of the Marker function (inside marker.js):


    this.markerObject = new AR.GeoObject(markerLocation, {

        drawables: {

            cam:        ,

            //indicator:  this.directionIndicatorDrawable,

            radar:      this.radardrawables

        }

    });

 

    return this;

 

(I don't know if the pois are painted in the  bold lines (??)).

So, where do I have to implement the code to paint POIs and clusters? 

 

Thank you very much in advance. This forum works like a charm (thanks!).

The POIs are not painted on either of those lines. They basically just create objects representing the AR content. Our engine than takes care of drawing those each frame at the right position on screen.

new AR.GeoObject creates a new geo object at the supplied location (in this case markerLocation) with a visual represenation (drawables) on the camera (this.backgroundPOI, this.markerDrawable_idle, ...) and on the radar (this.radardrawables). If you want to change how the object looks on screen change the drawables that are passed in this call!

PoiRadar.show() is a function declared in the example you are using that makes the radar visible. Have a look in the .js file where the PoiRadar object is declared.

 

You are great Wolfgang!!

So markers are painted just when I call new AR.GeoObject (...).

I am trying to use clusters in my App, and I have the array of clusters, which are arrays of POIs (if it has more than one element is a cluster and othewise is a simple POI).

I have modified createMarkerAtLocation function and I do markerList.setItem (pos, new Marker(POI)). So I have modified Marker class in order to differenciate between a cluster and a POI (inside Marker). What I do is to read the 'type' attribute and if it is a POI a paint it as I have always done and if it is a cluster I change the background...

However after doing this nothing works! It is like if I had momdified something important and architect view is not working now (alerts are not being executed).

I am going to work more on this, I will tell you... If you know what is happening please...

Thank you Wolfgang!

Please check out console logs to find eventual JS errors.
You may also use ade.js in your desctop browser to check created AR.* Objects.

Kind regards,
Andreas

Thank you Andreas, I got it. 

Now I can paint clusters and POIs, however I also use the distance seekbar, so I have to manage how to remove and add elements from clusters. I have already implemented the code, but I need to know how to remove a element from markerList (type Map). When I do markerList.removeItem (KEY), the key is not removed.

I attach the class Map that I am using to see if anyone can help me to remove a item (key and value).

Thank you in advance!

Hi there!

Your question is no longer related to the AR.* namespace but a general JavaScript question.
I hope you understand that this is now out of scope of this forum.
Please test using your desktop browser with a simple scenario, have a look at different approaches or check out jquery's $.map which provides a powerful toolset out of the box.

Kind regards,
Andreas

Thanks!
Login or Signup to post a comment