Oracle Maps example - handling theme based FOI layer events

Instructions

This demo shows how to write event listeners that handle certain events associated with a Theme based FOI layer. The types of events being handled are:

Source code

  var mapview;
    
  function showMap() 
  {	
    var baseURL  = "http://"+document.location.host+"/mapviewer";
    var mapCenterLon = -122.45;
    var mapCenterLat =  37.7706;
    var mapZoom      =  4;       
    var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307);
    mapview = new MVMapView(document.getElementById("map"), baseURL);
    mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map"));   
    mapview.setCenter(mpoint);   
    mapview.setZoomLevel(mapZoom);    
    
    var themebasedfoi = new MVThemeBasedFOI('themebasedfoi1','mvdemo.customers') ;
    
    themebasedfoi.setBringToTopOnMouseOver(true);
    
    themebasedfoi.attachEventListener(MVEvent.MOUSE_CLICK, foiClick);
    themebasedfoi.attachEventListener(MVEvent.BEFORE_REFRESH, beforeRefresh);
    themebasedfoi.attachEventListener(MVEvent.AFTER_REFRESH, afterRefresh);	
    themebasedfoi.attachEventListener(MVEvent.MOUSE_OVER, foiOver);
    themebasedfoi.attachEventListener(MVEvent.MOUSE_OUT, foiOut);
    
    mapview.addThemeBasedFOI(themebasedfoi);
                      
    mapview.display();
  }    	
  
  function foiClick(point,foi)
  {
    var htmlString = "<UL><LI>name="+foi.name+"<LI>attrs="+foi.attrs+"<LI>attrsName="+ foi.attrnames+"</UL>";
    mapview.displayInfoWindow(point, htmlString,400,100);
    //window.open('http://www.oracle.com','mywindow');
  }
  function foiOver(point,foi)
  {
    defaultStatus="foi name:"+foi.name;
  }
  function foiOut(point,foi)
  {
    defaultStatus="";
  }
  function beforeRefresh()
  {
    alert("before refresh");
  }
  
  function afterRefresh()
  {
    alert("after refresh");
  }