Oracle Maps example - templated theme based FOI layer


Instructions

This demo shows how to use a templated theme based FOI layer. A templated theme is a MapViewer predefined theme (dynamic_customers in this case) that includes binding variables in its query condition. For instance, the styling rules of the theme dynamic_customers look like this:
	  <?xml version="1.0" standalone="yes"?>
	  <styling_rules>
        <hidden_info>
			<field column="name" name="Name"/>
			<field column="city" name="City"/>
			<field column="sales" name="Sales"/>
	    </hidden_info>
        <rule>
			<features style="M.SMALL CIRCLE"> (county=:1 and sales>:2) </features>
	 		<label column="NAME" style="T.RED STREET"> 1 </label>
	    </rule>
     </styling_rules>
  
In this case, MapViewer issues a query that filters results based on the specified county name and sales range. The actual parameter values must be supplied to MapViewer in each map request for that theme. This demo shows you how to supply such dynamic values through the JavaScript API.

Source code

  var mapview;
  
  function showMap()
  {	
    var baseURL  = "http://"+document.location.host+"/mapviewer";
    var mapCenterLon = -122.45;
    var mapCenterLat =  37.6706;
    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);
    
    temlatedThemeBasedFOI();
    mapview.display();   
  }
  
  function temlatedThemeBasedFOI()
  {	
    var themebasedfoi = new MVThemeBasedFOI('themebasedfoi1','mvdemo.dynamic_customers');
    
    themebasedfoi.setQueryParameters('SAN FRANCISCO','100');      
    
    themebasedfoi.setBringToTopOnMouseOver(true);
    
    mapview.addThemeBasedFOI(themebasedfoi);
    
  }