make_clusters( $page['items'], isset($_GET['lap']) ? $_GET['lap'] : 0.01, isset($_GET['lop']) ? $_GET['lop'] : 0.01, isset($_GET['n']) ? $_GET['n'] : rvm_get_config_var('nb_markers',40) ); $cluster_debug .= ' cluster: '. $cm->debug_str. ';'; } function jsgm_position( $position ) { return 'new GLatLng(' . $position['lat'] . ',' . $position['lon'] . ')'; } function jsgm_bounds( $bounds ) { return 'new GLatLngBounds(' . jsgm_position(bounds_sw($bounds)) . ',' . jsgm_position(bounds_ne($bounds)) . ')'; } function jsgm_str( $str ) { return '"'. str_replace(array("\\",'"',"\n","\r","\t"), array("\\\\",'\"',"\\n","\\r","\\t"), $str) .'"'; } $out=''; function rvo($s) { global $out; $out.=$s; } function rvf() { global $out; echo $out; $out=''; ob_flush(); } $start_output = get_moment(); rvo( '{' ); rvo( "\ntitle: ".jsgm_str( strip_tags($page['title']) ) ); rvo( ",\n" ); rvo( "page_url: ".jsgm_str( duplicate_index_url( array('start'=>0) ) ) ); rvo( ",\n" ); rvo( "blowup_url: ".jsgm_str( rvm_duplicate_blowup_url( array('start'=>0) ) ) ); rvo( ",\n" ); rvo( "kml_url: ".jsgm_str( rvm_duplicate_kml_index_url( array('start'=>0, 'flat'=>1) ) ) ); rvo( ",\n" ); rvo( "nb_items: ".count($page['items']) ); rvo( ",\n" ); rvo( "bounds: " ); if ( isset($cm) ) rvo( jsgm_bounds( $cm->bounds ) ); else rvo( "null" ); rvo( ",\n" ); rvo( "\nnb_clusters: ".count($clusters) ); rvo( "," ); rvo( "\nimage_clusters: [\n" ); $i=0; foreach( $clusters as $c ) { if ($i) rvo( ",\n\n" ); rvo( "{" ); rvo( 'position: '. jsgm_position( bounds_center($c['bounds']) ) ); rvo( ",\n" ); rvo( 'bounds: '. jsgm_bounds( $c['bounds'] ) ); rvo( ",\n" ); rvo( 'nb_items: '.count($c['items']) ); rvo( ",\n" ); rvo( 'blowup_url: "'.rvm_duplicate_blowup_url(array('box'=>$c['bounds']), array('start') ). '"' ); rvo( ",\n" ); rvo( 'kml_url: "'.rvm_duplicate_kml_index_url(array('box'=>$c['bounds'], 'flat'=>1), array('start') ). '"' ); rvo( ",\n" ); $max_per_cluster = rvm_get_config_var('nb_images_per_marker',20); if ( count($c['items']) > $max_per_cluster ) { $c['items'] = array_slice($c['items'], 0, $max_per_cluster); } rvo( 'items: [' ); for ($j=0; $j $img['id'], 'image_file' => $img['file'], 'flat' => 1, ); $page_url = duplicate_picture_url($params, array('start') ); if ($j) rvo( "," ); rvo( "{" ); rvo( "tn: ".jsgm_str( get_thumbnail_url( $img ) ) ); rvo( "," ); rvo( "name: ".jsgm_str( $title ) ); rvo( "," ); rvo( "comment: ".jsgm_str( trigger_event('render_element_description', $img['comment']) ) ); rvo( "," ); rvo( "page_url: ".jsgm_str( $page_url ) ); rvo( "}" ); } rvo( ']' ); rvo( "\n" ); rvo( "}" ); rvf(); $i++; } rvo( "] /*clusters*/\n" ); $time = get_elapsed_time($t2, get_moment()); $page['queries_time'] = number_format($page['queries_time'],3,'.',' '); rvo( "\n,debug:'$time; out:".get_elapsed_time($start_output,get_moment()).";$cluster_debug queries:".$page['count_queries']." in ".$page['queries_time']."s'\n" ); rvo( '}' ); rvf(); ?>