welcome to linkAR technical documentation

next previous

Adding POIS

Adding a POI to the browser requires using the following data classes:

POI: (POI.java ) Represents a single Poi. The object has the POI's GPS coordinates, icon that will be shown in the popups, Label property and actions List.
Each poi can contain only one Label property but many actions

POIlabel: (POIlabel.java ) Represents poi property. The object has the POI's title, description and label logo.

POIAction: (POIAction.java ) This object contains POI's actions. Each POIaction object can contain only one action

Adding single POI procces:

  1. Create POI object.
  2. Set its values: Location, popup image, POIlabel (Optional), POIaction (Optional). You must set a poi near you location (latitude and longitude) if you want see it in the radar. Trick: search in google maps your place, click right button and “what's there” option.
  3. Change the alpha value applied to the POI for Selected/NonSelected states.
  4. Create POIlabel object and set its values: title, description, logo etc.
  5. Add POIlabel to created POI object.
  6. Create POIaction object , set action from available actions list. You can see the POIaction class in API Reference.
  7. Add POIaction to created POI object. (If you want to add more actions, repeat previous proccess)
  8. Add POI object to the AR Browser lib by calling the add api method.

Create POI by using (POI.java) and POIlabel by using (POIlabel.java) and set this poi for rendering

In the onCreate method of HelloARlibActivity that we have been wrote in quick start section you must to code this:

  /** Called when the activity is first created. */
  public void onCreate(Bundle savedInstanceState) {
    /** Code of the "2.4.6.- Create AR Browser View" in the quick start **/
    /** Creation and insertion of the POIs to render list for rendering */
        POI mPoi;
        /** Create first POI */
     	mPoi = new POI();  	
     	/** Create first POI label property*/
     	POIlabel label = new POIlabel();
     	label.setLabelDescription("First POI description");
     	/** Add first POI label property*/
        /** Create POI Actions*/
     	// AUDIO //
     	POIaction action = new POIaction();
     	/** Add action to POI actions list*/
     	// VIDEO //
     	action = new POIaction();
     	/** Add action to POI actions list*/
     	/** Add first POI to render list*/
  } // end of onCreate method of HelloARlibActivity

There are different ways of setting the POI image, from the app resources:

mPoi = new POI();  	

Directly from an image internet address:

mPoi = new POI();  	 

Or from a Bitmap object:

Bitmap bitmap;
mPoi = new POI();  	 

The developers can also write custom handlers to get POI clicked and POI selected CALLBACKS

private Handler userCustomPopupsHadler;
/** Custom picking and selection callback Handler, allow user to implement his own POPUPS. **/
userCustomPopupsHadler = new Handler(){
  public void dispatchMessage(Message msg) {
    int selected = msg.arg1;
    int picked = msg.arg2;
    POI selPOI = new POI();
    if(selected != -1)
      selPOI = aRbrowserView.getPoiById(selected);
      Log.i(TAG,"Label with poi id ["+selected+"] was selected with bearing = " +
         selPOI.getBearing() + " and distance = " + selPOI.getDistanceFromUser());
    if(picked != -1)
      selPOI = aRbrowserView.getPoiById(picked);
      Log.i(TAG,"Label with poi id ["+picked+"] was clicked with bearing = " +
          selPOI.getBearing() + " and distance = " + selPOI.getDistanceFromUser());
/** Set custom handler to AR browser instance and select desired CALLBACKS**/
aRbrowserView.setCustomSelectionHandlerCallback(userCustomPopupsHadler, true, true);

next previous