nl_tokens: Create a latlon rectangle and split it into the equivalent ProjectionRect using this LatLonProjection . The latlon rect is constructed from 2 lat / lon points . The lon values are considered coords in the latlonProjection and so do not have to be + / - 180 .
pl_tokens: public ProjectionRect [ ] latLonToProjRect ( double lat0 , double lon0 , double lat1 , double lon1 ) { double height = Math . abs ( lat1 - lat0 ) ; lat0 = Math . <mask> ( lat1 , lat0 ) ; double width = lon1 - lon0 ; if ( width < 1.0e-8 ) { width = 360.0 ; // assume its the whole thing
   } lon0 = LatLonPointImpl . lonNormal ( lon0 , centerLon ) ; lon1 = LatLonPointImpl . lonNormal ( lon1 , centerLon ) ; ProjectionRect [ ] rects = new ProjectionRect [ ] { new ProjectionRect ( ) , new ProjectionRect ( ) } ; if ( width >= 360.0 ) { rects [ 0 ] . setRect ( centerLon - 180.0 , lat0 , 360.0 , height ) ; rects [ 1 ] = null ; } else if ( lon0 < lon1 ) { rects [ 0 ] . setRect ( lon0 , lat0 , width , height ) ; rects [ 1 ] = null ; } else { double y = centerLon + 180 - lon0 ; rects [ 0 ] . setRect ( lon0 , lat0 , y , height ) ; rects [ 1 ] . setRect ( lon1 - width + y , lat0 , width - y , height ) ; } return rects ; }