Page 448 - 2
P. 448

}
               };

               void PrintMap(String m){
                   this.M_Data = m;
                   new Thread(new Runnable() {
                       String lon_s;
                       String lat_s;


                       ArrayList<TMapPoint> t_array = new ArrayList<TMapPoint>();
                       TMapPolyLine tMapPolyLine = new TMapPolyLine();
                       @Override
                       public void run() {
                          if(M_Data != null) {
                              try {
                                 tMapPolyLine.setLineColor(Color.RED);
                                 tMapPolyLine.setLineWidth(30);

                                 JSONObject jsonObject = new JSONObject(M_Data);
                                 JSONArray features = jsonObject.getJSONArray("features");
                                 for (int i = 0; i < features.length(); i++) {
                                     JSONObject features_object = features.getJSONObject(i);

                                     JSONObject geometry = features_object.getJSONObject("geometry");
                                     if(geometry.getString("type").equals("Point")) {
                                        JSONArray coordinates = geometry.getJSONArray("coordinates");

                                        Log.d("BluetoothManager", " 경도 : " + (lon_s = coordinates.getString(0)));
                                        Log.d("BluetoothManager", " 위도 : " + (lat_s = coordinates.getString(1)));


                                        double lon = Double.parseDouble(lon_s);
                                        double lat = Double.parseDouble(lat_s);

                                        TMapPoint point = new TMapPoint(lat,lon);
                                        TMapMarkerItem tMapMarkerItem = new TMapMarkerItem();
                                        tMapMarkerItem.setTMapPoint(point);
                                        tMapMarkerItem.setName(" 분기점" + i);
                                        tMapMarkerItem.setVisible(TMapMarkerItem.VISIBLE);


                                        tmap.addMarkerItem("Point"+String.valueOf(i),tMapMarkerItem);
                                        Log.d("BluetoothManager", " 포인트 입력됨");
                                        tmap.setCenterPoint(lon,lat);
                                     }else if(geometry.getString("type").equals("LineString")){
                                        JSONArray coordinates = geometry.getJSONArray("coordinates");
                                        for(int j=0;j<coordinates.length();j++){
                                            JSONArray jsonArray = coordinates.getJSONArray(j);

                                            Log.d("BluetoothManager", " 경도 : " + (lon_s = jsonArray.getString(0)));
                                            Log.d("BluetoothManager", " 위도 : " + (lat_s = jsonArray.getString(1)));




                                                         - 448 -
   443   444   445   446   447   448   449   450   451   452   453