private static double [ ] getStartEndPointsWE ( double west , double east , int zoom ) { double incrementor = getIncrementor ( zoom ) ; //brute force when zoom is less than 10 if ( zoom < 10 ) { double we_startpoint = Math . floor ( west ) ; double x = 180 ; while ( x > we_startpoint ) x = x - incrementor ; we_startpoint = x ; //System.out.println("WS " + we_startpoint); double ws_stoppoint = Math . ceil ( east ) ; x = - 180 ; while ( x < ws_stoppoint ) x = x + incrementor ; if ( we_startpoint < - 180 ) { we_startpoint = - 180 ; } if ( ws_stoppoint > 180 ) { ws_stoppoint = 180 ; } return new double [ ] { ws_stoppoint , we_startpoint } ; } else { //hmm start at origin, add inc until we go too far, then back off, go to the next zoom level double west_start_point = - 180 ; if ( west > 0 ) { west_start_point = 0 ; } double easter_stop_point = 180 ; if ( east < 0 ) { easter_stop_point = 0 ; } for ( int xx = 2 ; xx <= zoom ; xx ++ ) { double inc = getIncrementor ( xx ) ; while ( easter_stop_point > east + inc ) { easter_stop_point -= inc ; //System.out.println("east " + easter_stop_point); } while ( west_start_point < west - inc ) { west_start_point += inc ; if ( DEBUG ) { System . out . println ( "west " + west_start_point ) ; } } } if ( DEBUG ) { System . out . println ( "return EW set as " + west_start_point + " " + easter_stop_point ) ; } return new double [ ] { easter_stop_point , west_start_point } ; } }
gets the start and stop point for a longitude line