var mapview; var datasource = "IGT"; var baseURL = "http://"+document.location.host+"/mapviewer"; //var baseURL = "http://gisdev.iec.org.za/mapviewer"; var gc_levelID; var gc_levelDescription; var gc_levelValue; var gc_longitude; var gc_latitude; var gc_VDNumber = "0"; var gc_FOI_Clicked = false; //List of foi themes within the map // index 0 : Position in Layer control // index 1 : Name of foi Theme // index 2 : Caching true or false // index 3 : Query params if any // index 4 : Name of defined theme // index 5 : Visibility of foi // index 6 : Clickable foi var foiSearchThemes = new Array( new Array (1, "VotingDistricts_L2", false, "0", "F_VOTINGDISTRICTS_L2", true, false), new Array (2, "Votingdistricts_L3", false, "0.0,0.0", "F_VOTINGDISTRICTS_L3", true, false), new Array (4, "VotingStations_Active_L2", false, "0", "F_VOTINGSTATIONS_ACTIVE_L2", true, true), new Array (5, "VotingStations_Active_L3", false, "0.0,0.0", "F_VOTINGSTATIONS_ACTIVE_L3", true, true) ); // Zoom levels for theme visibility var minVisibleZoomLevel = 10; var maxWholeImageLevel = 11; var minClickableZoomLevel = 19; var datasourceName = "IGT"; function load(){ var normalmap = new MVMapTileLayer(datasource + ".{G}{8307}{R}{256}"); normalmap.refresh(true); normalmap.setVisibleZoomLevelRange(1, 19); mapview = new MVMapView(document.getElementById("oramap"), baseURL); mapview.attachEventListener(MVEvent.MOUSE_CLICK, mapview_click_event); // Add built-in scalebar scaleBar=new MVMapDecoration(new MVScaleBar(),0, 1, null, null, 4, -50); mapview.addMapDecoration(scaleBar); // Add a built-in navigation bar and a scale bar var nav = new MVNavigationPanel(8,true,true,true); nav.setNavPosition("WEST"); nav.setZoomLevelInfoTips({ 0:"World", 5:"Country", 8:"Town", 14:"Suburb", 18:"Street" }) ; navPan = new MVMapDecoration(nav,0,0,null,null,-4,0) ; mapview.addMapDecoration(navPan) ; // Add a copyright notice mapview.addCopyRightNote("© Copyright, IEC 2011"); // Add FOIs to the map addPOI(); addFoiSearchThemes(); // Add map tile layers mapview.addMapTileLayer(normalmap); // Set general settings mapview.enableLoadingIcon(true); mapview.setLoadingIconVisible(true); mapview.setMouseWheelZoomEnabled(true); mapview.setZoomAnimationEnabled(false); mapview.enableKeyboardPanning(false); mapview.setDoubleClickAction("zoomin"); // Set Default display window style var defaultStyleParameters = { closeButtonImageURL:"/vsfinder/jslib/ext-3.3.1/resources/images/gray/qtip/close.gif", bodyStyle:"border:1px;border-color:#8794A3;background-color:#FFFFFF;opacity:90", titleBarStyle:"vertical-align: middle; color:#838b83; font-weight:bold;font-family: Verdana, Arial; font-size:11px; background: url(/vsfinder/jslib/ext-3.3.1/resources/images/gray/panel/light-hd.gif); background-repeat: repeat-x", coneStyle:"background-color:#838b83;opacity:30", offset:20 }; mapview.setDefaultInfoWindowStyle("MVInfoWindowStyle1", defaultStyleParameters) ; mapview.display(); } // -------------------------------------------------------------------------------- // setMapScope // // -------------------------------------------------------------------------------- function setMapScope (){ var mapCenterLon = 25.30; var mapCenterLat = -28.90; var mapSRID = 8307; var mapZoom = 5; // Set initial map center and zoom level var mpoint = MVSdoGeometry.createPoint(mapCenterLon,mapCenterLat,mapSRID); mapview.setHomeMap(mpoint, mapZoom); if (gc_VDNumber > 0){ var theme = mapview.getThemeBasedFOI('VotingStations_Active_L2'); theme.setQueryParameters(gc_VDNumber); theme = mapview.getThemeBasedFOI('VotingDistricts_L2'); theme.setQueryParameters(gc_VDNumber); theme.refresh(true); }else{ mapview.setCenter(mpoint); mapview.setZoomLevel(mapZoom); } } function addPOI(){ // Add POI var themebasedfoi = new MVThemeBasedFOI('F_POI_L1','IGT.F_POI_L1'); themebasedfoi.setBringToTopOnMouseOver(true); themebasedfoi.enableInfoTip(true); themebasedfoi.enableLabels(false); themebasedfoi.setClickable(false); themebasedfoi.enableImageCaching(true); themebasedfoi.enableAutoWholeImage(true); themebasedfoi.setAutoRefresh(true); themebasedfoi.setMouseCursorStyle("hand"); themebasedfoi.enableMultiFeatureMarker(true); themebasedfoi.setMaxVisibleZoomLevel(19); themebasedfoi.setMinVisibleZoomLevel(16); mapview.addThemeBasedFOI(themebasedfoi); } // -------------------------------------------------------------------------------- // Map events // -------------------------------------------------------------------------------- // // -------------------------------------------------------------------------------- // mapview_click_event() // event occurs when the user clicks mouse left key on the map // -------------------------------------------------------------------------------- var mapview_click_event = function(e) { mapview.removeInfoWindow(); var mouseClick = mapview.getMouseLocation(); gc_longitude = mouseClick.getPointX(); gc_latitude = mouseClick.getPointY(); zoomToTheme('locatevs', null, gc_longitude, gc_latitude); } // -------------------------------------------------------------------------------- // foi_mouse_over_event() // listener is called when the foi has been clicked // -------------------------------------------------------------------------------- function foi_mouse_over_event(point,foi) { var htmlString = "
" htmlString += "" htmlString += ""; htmlString += "
"; htmlString += "
" htmlString += ""; for (i=0; i" +foi.attrnames[i] + ":"; } } htmlString += "
"; htmlString += "
"; //var htmlString = ""; mapview.displayInfoWindow(point, htmlString,400,100,null,"Voting station information"); } // -------------------------------------------------------------------------------- // Map public methods // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- // addFoiSearchThemes() // This sets up the select list of FOI themes as well as the direct links // to the hard-coded locations // -------------------------------------------------------------------------------- function addFoiSearchThemes() { // Setup FOI layers and add to map for (i=0;i