var map = null; function resize() { var w = document.documentElement.clientWidth; var h = document.documentElement.clientHeight; document.getElementById('myMap').style.width = w + 'px'; document.getElementById('myMap').style.height = h + 'px'; if (map != null) map.Resize(w, h); } function GetMap() { isset(); url_splitter(); map = new VEMap('myMap'); map.SetDashboardSize(VEDashboardSize.Tiny); map.LoadMap(new VELatLong(the_url_lat1[0], the_url_lat1[1]), the_url_lat1[2]); map.AttachEvent("onmouseup", LoadFunc); map.AttachEvent("onendzoom", LoadFunc); LoadFunc(); // AddMyLayer1617(VEDataType.GeoRSS); } function isset() { var first_url = window.location.href; if (first_url == 'http://harta-bucuresti.com.ro/beta/') { window.location.href = 'http://harta-bucuresti.com.ro/beta/#lat=44.4270569&lon=26.1011874&z=17'; } } function url_splitter() { var the_url = window.location.href; if (the_url == 'http://harta-bucuresti.com.ro/beta/') { window.location.href = 'http://harta-bucuresti.com.ro/beta/#lat=44.4270569&lon=26.1011874&z=17'; } the_url_lat1 = the_url.replace('http://harta-bucuresti.com.ro/beta/#lat=',''); the_url_lat1 = the_url_lat1.replace('&lon=',';'); the_url_lat1 = the_url_lat1.replace('&z=',';'); the_url_lat1 = the_url_lat1.split(';'); document.getElementById('app_url').value = the_url_lat1[0] + the_url_lat1[1] + ' test ' + the_url_lat1[2]; } function GetCenterLatLong() { //Check if in Birdseye or Oblique Map Style if (map.GetMapStyle() == VEMapStyle.Birdseye || map.GetMapStyle() == VEMapStyle.BirdseyeHybrid) { //IN Birdseye or Oblique Map Style //Get the BirdseyeScene being displayed var birdseyeScene = map.GetBirdseyeScene(); //Get approximate center coordinate of the map var x = birdseyeScene.GetWidth() / 2; var y = birdseyeScene.GetHeight() / 2; // Get the Lat/Long var center = birdseyeScene.PixelToLatLong(new VEPixel(x,y), map.GetZoomLevel()); // Convert the BirdseyeScene LatLong to a normal LatLong we can use return (new _xy1).Decode(center); } else { // NOT in Birdseye or Oblique Map Style return map.GetCenter(); } } function DisplayCenter() { var center = GetCenterLatLong(); alert("Latitude: " + center.Latitude + "\nLongitude: " + center.Longitude); } function CurrentZoom() { var zl = map.GetZoomLevel(); } ////////////////////////// // Start clustering ///////////////////////// function AddMyLayer1819(type) { var zl = map.GetZoomLevel(); var alt_center = map.GetCenter() + ''; var gxy = alt_center.split(", "); var glat = gxy[0]; var glon = gxy[1]; var l = new VEShapeLayer(); var veLayerSpec = new VEShapeSourceSpecification(type, 'http://harta-bucuresti.com.ro/beta/grss_zl-14-17.php?lat='+glat+'&lon='+glon, l); map.ImportShapeLayerData(veLayerSpec, function() { var numShapes = l.GetShapeCount(); for(var i=0; i< numShapes; ++i) { var s= l.GetShapeByIndex(i); // s.SetCustomIcon(s.IconId); s.SetCustomIcon("
" + s.IconId + "
"); } } , false); } function AddMyLayer1617(type) { var alt_center = GetCenterLatLong(); var glat = alt_center.Latitude; var glon = alt_center.Longitude; var l = new VEShapeLayer(); var veLayerSpec = new VEShapeSourceSpecification(type, 'http://harta-bucuresti.com.ro/beta/grss_zl-14-17.php?lat='+glat+'&lon='+glon, l); map.ImportShapeLayerData(veLayerSpec, function() { var numShapes = l.GetShapeCount(); for(var i=0; i< numShapes; ++i) { var s= l.GetShapeByIndex(i); // s.SetCustomIcon(s.IconId); s.SetCustomIcon("
" + s.IconId + "
"); } } , false); } function AddMyLayer1115(type) { var alt_center = map.GetCenter() + ''; var gxy = alt_center.split(", "); var glat = gxy[0]; var glon = gxy[1]; var l = new VEShapeLayer(); var veLayerSpec = new VEShapeSourceSpecification(type, 'http://harta-bucuresti.com.ro/beta/grss_zl-11-14.php?lat='+glat+'&lon='+glon, l); map.ImportShapeLayerData(veLayerSpec, function() { var numShapes = l.GetShapeCount(); for(var i=0; i< numShapes; ++i) { var s= l.GetShapeByIndex(i); var atitle = s.TitleId; // s.SetCustomIcon(s.IconId); s.SetCustomIcon("
" + s.IconId + "
"); } } , false); } ////////////////////////// // End clustering ///////////////////////// function AddMySearch(type) { var name2 = document.getElementById('addressInput').value; var nr_post2 = document.getElementById('postalInput').value; var l = new VEShapeLayer(); var veLayerSpec = new VEShapeSourceSpecification(type, 'http://harta-bucuresti.com.ro/beta/write-rss.php?name='+name2+'&address='+nr_post2, l); map.ImportShapeLayerData(veLayerSpec); } function LoadFunc() { var url_center = GetCenterLatLong(); var long_url_lat = url_center.Latitude; var long_url_lon = url_center.Longitude; var url_lat = parseFloat(long_url_lat).toFixed(7); var url_lon = parseFloat(long_url_lon).toFixed(7); var zlev = map.GetZoomLevel(); newUrl = 'http://harta-bucuresti.com.ro/beta/#lat=' + url_lat + '&lon=' + url_lon + '&z=' + zlev; window.location.href = newUrl; DeleteAllShape(); // start zoomlevel testing if (zlev >= '11' && zlev <= '15') { AddMyLayer1115(VEDataType.GeoRSS); } else { //start 1st else if (zlev >= '16' && zlev <= '17') { AddMyLayer1617(VEDataType.GeoRSS); } else //start 2nd else { AddMyLayer1819(VEDataType.GeoRSS); } // end 2nd else } // end 1st else // end zoomlevel testing } // end function function DeleteAllShape() { map.DeleteAllShapes(); }