Follow the steps below.
|
var mapview; var redline; 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 redlineInit() { redline = new MVRedlineTool("black_line", "black_line"); mapview.addRedLineTool(redline); redline.init(); } function redlineDone() { redline.generateArea(); var geom = redline.getPolygon(); //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); redline.clear(); }