Follow the steps below.
|
var mapview; var circleTool; var hilitedCustomers; function showMap() { var baseURL = "http://"+document.location.host+"/mapviewer"; var mapCenterLon = -122.45; var mapCenterLat = 37.6706; var mapZoom = 3; var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,8307); mapview = new MVMapView(document.getElementById("map"), baseURL); mapview.addMapTileLayer(new MVMapTileLayer("mvdemo.demo_map")); var themebasedfoi = new MVThemeBasedFOI('themebasedfoi1','mvdemo.customers'); themebasedfoi.setBringToTopOnMouseOver(true); mapview.addThemeBasedFOI(themebasedfoi); mapview.setCenter(mpoint); mapview.setZoomLevel(mapZoom); mapview.display(); } function circleInit() { circleTool = new MVCircleTool("black_line"); circleTool.attachEventListener(MVEvent.FINISH, circleDone); mapview.addCircleTool(circleTool); circleTool.init(); } function circleDone() { var geom = circleTool.getCircle(); //this will be our filtering geom highlightCustomers(geom); } //this function hilights only the customer sites that are within the //provided filtering geometry. function highlightCustomers(geom) { hilitedCustomers = new MVThemeBasedFOI('highlightedcst','mvdemo.customers'); hilitedCustomers.setBringToTopOnMouseOver(true); //these 3 lines do the theme high-lighting work hilitedCustomers.setHighlightOnly(true); hilitedCustomers.setFilteringGeom(geom); hilitedCustomers.setRenderingStyle("M.CYAN PIN"); //set the pin symbol as the highlight style mapview.addThemeBasedFOI(hilitedCustomers); } function clearHighlights() { mapview.removeThemeBasedFOI(hilitedCustomers); circleTool.clear(); }