private void addPoints ( final List < GeoPoint > pPoints , final double pBeginLat , final double pBeginLon , final double pEndLat , final double pEndLon ) { final double increment = 10 ; // in degrees pPoints . add ( new GeoPoint ( pBeginLat , pBeginLon ) ) ; double lat = pBeginLat ; double lon = pBeginLon ; double incLat = pBeginLat == pEndLat ? 0 : pBeginLat < pEndLat ? increment : - increment ; double incLon = pBeginLon == pEndLon ? 0 : pBeginLon < pEndLon ? increment : - increment ; while ( true ) { if ( incLat != 0 ) { lat += incLat ; if ( incLat < 0 ) { if ( lat < pEndLat ) { break ; } } else { if ( lat > pEndLat ) { break ; } } } if ( incLon != 0 ) { lon += incLon ; if ( incLon < 0 ) { if ( lon < pEndLon ) { break ; } } else { if ( lon > pEndLon ) { break ; } } } pPoints . add ( new GeoPoint ( lat , lon ) ) ; } pPoints . add ( new GeoPoint ( pEndLat , pEndLon ) ) ; }
Add a succession of GeoPoint s separated by an increment taken from the segment between two GeoPoint s