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:

@Override
 
  /** 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();  	
     	mPoi.setIconRes(R.drawable.smiley);
     	mPoi.setLatitude(32.801308);
     	mPoi.setLongitude(34.951158);  
 
     	mPoi.setNotSelectedPoiAlpha(0.3f);
     	mPoi.setSelectedPoiAlpha(1.0f);
 
     	/** Create first POI label property*/
     	POIlabel label = new POIlabel();
        label.setLabelTitle("Smiley");
     	label.setLabelDescription("First POI description");
     	label.setLabelDescriptionFontColor("#b0b0b3");
     	label.setLabelTitleFontColor("#f58025");
     	label.setLabelTitleFontSize(11);
     	label.setLabelLogoResource(R.drawable.smiley);
 
     	/** Add first POI label property*/
     	mPoi.setPoiLabelProperty(label);
 
 
        /** Create POI Actions*/
 
     	// AUDIO //
     	POIaction action = new POIaction();
     	action.setAudioAction("http://www.samisite.com/sound/cropShadesofGrayMonkees.mp3");
     	/** Add action to POI actions list*/
     	mPoi.addPoiActionToList(action);
 
     	// VIDEO //
     	action = new POIaction();
     	action.setVideoAction("http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4");
     	/** Add action to POI actions list*/
     	mPoi.addPoiActionToList(action);
 
 
     	/** Add first POI to render list*/
     	aRbrowserView.addPoiToRenderList(mPoi);
 
  } // end of onCreate method of HelloARlibActivity


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

mPoi = new POI();  	
mPoi.setIconRes(R.drawable.smiley);     	

Directly from an image internet address:

mPoi = new POI();  	 
mPoi.setIconFromUrl("http://www.arlab.com/img/content/ARLogo.png"); 

Or from a Bitmap object:

Bitmap bitmap;
...
mPoi = new POI();  	 
mPoi.setIconBitmap(bitmap); 


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(){
  @Override
  public void dispatchMessage(Message msg) {
    handleMessage(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