Sunday, April 27, 2014

How to use createLayer method calling MouseClick Event


The usage of createLayer is like the following example.
var layer2 = new ILayer();

 var hcols = "STRING_1,STRING_2,NUMBER_1,NUMBER_2".split(","); 

 var whereCondition = 'IL_ID=34'

 var labelColumn = 'POINT_ID'

 layer2.createLayer(ILayer.USER_POINT, "lyr_2", whereCondition,
 null, 'M.PIN_1', true, mouseClick, labelColumn, null, hcols);
ILayer.USER_POINT is explained at http://www.locationbox.com.tr/web/api_adduserpoint.jsp

Moreover, the function of mouseClick is detailed below.
function mouseClick(pos, info) {

  var html = '';

   html += '  ';

   for( var i = 0; i < info.data.length; i++ ) {

     var data = info.data[i];

     var color = "#ffffff";

     if( (i & 1) != 0 ) color = "#ffffff";

     html += '  ';

   } // for()

 html += '
ID' + info.id + '
' + data.name + '' + data.value + '
'; mapper.displayInfoWindow(pos.y, pos.x, html, 240, 100, "Bilgi: " + info.id); return; } // mouseClick()

For more detailed information and questions, do not hesitate to contact to us.