Page 454 - 2
P. 454

Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVI
            DER);


                              if(Lines.get(i).getLinePoint().size() - 1 >= j+1) {
                                 double cur_nex_dis = distance(location.getLatitude(), location.getLongitude(), Lines.g
            et(i).getLinePoint().get(j+1).getLatitude(), Lines.get(i).getLinePoint().get(j+1).getLongitude(), "meter");
                                 double cur_pre_dis = distance(location.getLatitude(), location.getLongitude(), Lines.g
            et(i).getLinePoint().get(j-1).getLatitude(), Lines.get(i).getLinePoint().get(j-1).getLongitude(), "meter");
                                 double tot_dis = distance(Lines.get(i).getLinePoint().get(j+1).getLatitude(),Lines.get(i).g
            etLinePoint().get(j+1).getLongitude(),Lines.get(i).getLinePoint().get(j-1).getLatitude(),Lines.get(i).getLinePoint().get
            (j-1).getLongitude(),"meter");
                                 if (cur_nex_dis < 15) {
                                     j++;
                                     Log.d("dd", " 통과됨");
                                 }
                                 if (tot_dis + 100< cur_nex_dis + cur_pre_dis) {
                                     Log.d("dd", " 경로를 벗어남");
                                     JsonParser parser = new JsonParser();
                                     parser.endx = String.valueOf(Points.get(Points.size()-1).getLon());
                                     parser.endy = String.valueOf(Points.get(Points.size()-1).getLat());
                                     parser.startx = String.valueOf(location.getLongitude());
                                     parser.starty = String.valueOf(location.getLatitude());
                                     parser.angle = String.valueOf(location.getBearing());


                                     isdrive = false;
                                     mTTS.speak(" 경로를 벗어났습니다 경로를 재탐색합니다.            .",TextToSpeech.QUEUE_FLU
            SH,null);
                                     start_drive = new Start_Drive(parser.getJson());
                                     start_drive.start();
                                 }
                              }else
                                 j = 1;


                              if (distance(location.getLatitude(), location.getLongitude(), Points.get(i + 1).getLat(), Point
            s.get(i + 1).getLon(), "meter") < 200 && flag_voice) {
                                 mTTS.speak("200 미터앞" + Points.get(i+1).getRoad_description() + " 하십시오",TextToSpe
            ech.QUEUE_FLUSH,null);
                                 flag_voice = false;
                              }


                              if (distance(location.getLatitude(), location.getLongitude(), Points.get(i + 1).getLat(), Point
            s.get(i + 1).getLon(), "meter") < 15) {
                                 i++;
                                 flag_voice = true;
                              }
                              if (Points.get(i).getRoad_turnType().equals("201"))
                                 break;


                              Log.d("BluetoothManager", " 현재위치 :" + location.getLatitude() + location.getLongitude());




                                                         - 454 -
   449   450   451   452   453   454   455   456   457   458   459