Facebook
From Botched Eider, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 244
  1. private void deleteOldLines( LatLng oldLatLonPoin) {
  2.         Polyline line1 = null;
  3.         Polyline line2 = null;
  4.         for(Polyline line : lines){
  5.             if((line.getPoints().get(0).longitude == oldLatLonPoin.longitude && line.getPoints().get(0).latitude == oldLatLonPoin.latitude) ||
  6.                     (line.getPoints().get(1).longitude == oldLatLonPoin.longitude && line.getPoints().get(1).latitude == oldLatLonPoin.latitude)){
  7.  
  8.                 if(line1 == null){
  9.                     line1 = line;
  10.                 }
  11.                 else if(line2 == null){
  12.                     line2=line;
  13.                 }
  14.  
  15.             }
  16.         }
  17.         if(line1 !=null) {
  18.             lines.remove(line1);
  19.             line1.remove();
  20.         }
  21.         if(line2 != null){
  22.             lines.remove(line2);
  23.             line2.remove();
  24.         }
  25.  
  26.     }