setRecentZhan(zz.getId() + ""); // Intent intent = new Intent(getActivity(), // ZhanDetailsNew.class); //// Bundle bundle=new Bundle(); //// bundle.putSerializable("zhan",zz); //// // intent.putExtra("zhan", zz); // startActivity(intent); // } // }); final ClaimZhan finalMarkerInfo = markerInfo; paoAlter.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // setRecentZhan(cz.getId() + ""); // Intent intent = new Intent(getApplication(), ClaimListActivity.class); // intent.putExtra("zhan", cz); Intent intent = new Intent(getApplication(), ClaimDataActivity.class); intent.putExtra("zhan_name", finalMarkerInfo.getZhan_name()); intent.putExtra("zhan_address", finalMarkerInfo.getZhan_address()); intent.putExtra("zhan_id", finalMarkerInfo.getUser_id()); intent.putExtra("poi_jing", finalMarkerInfo.getPoi_jing()); intent.putExtra("poi_wei", finalMarkerInfo.getPoi_wei()); intent.putExtra("zhan_id", finalMarkerInfo.getZhan_id()); startActivity(intent); // finish(); //user_id就是zhan_id // Log.e("-----",cz.getZhan_name()+"---"+cz.getZhan_address()+"---"+cz.getUser_id()); } }); paoRl.setVisibility(View.VISIBLE); // break; //// } return false; } public void initOverlay(List<ClaimZhan> l) { // Log.e("e","3"); for (int i = 0; i < l.size(); i++) { if (!l.get(i).getPoi_wei().equals("") && !l.get(i).getPoi_jing().equals("")) { double dwei = Double.parseDouble(l.get(i).getPoi_wei()); double djing = Double.parseDouble(l.get(i).getPoi_jing()); getGaode(djing, dwei); LatLng ll = new LatLng(Double.parseDouble(gd_wei), Double.parseDouble(gd_jing)); // Log.e("t","5"); if (l.get(i).getIsIinvestigate().equals("0") && !l.get(i).getStatus().equals("1") && !l.get(i).getStatus().equals("4")) { // Log.e("q","1"); Bundle bundle = new Bundle(); bundle.putSerializable("info", l.get(i)); ooclaim = new MarkerOptions().position(ll).icon(BitmapDescriptorFactory.fromBitmap(getMarkerBmpYes(1))) .anchor(0.5f, 1.0f).zIndex(6); mMarker = aMap.addMarker(ooclaim); mMarker.setObject(bundle); } else if (l.get(i).getIsIinvestigate().equals("1") && !l.get(i).getStatus().equals("4")) { // Log.e("w","2"); Bundle bundle = new Bundle(); bundle.putSerializable("info", l.get(i)); ooclaimed = new MarkerOptions().position(ll).icon(BitmapDescriptorFactory.fromBitmap(getMarkerBmpYes(3))) .anchor(0.5f, 1.0f).zIndex(6); mMarker1 = aMap.addMarker(ooclaimed); mMarker1.setObject(bundle); } } } if (center != null) { MarkerOptions oo = null; BitmapDescriptor point = BitmapDescriptorFactory .fromResource(R.drawable.point_icon); oo = new MarkerOptions().position(center).icon(point) .anchor(0.5f, 0.5f).zIndex(7).draggable(false); aMap.addMarker(oo); // Log.e("r","4"); } } //.. // public void startNavi(LatLng pt1, LatLng pt2) { // NaviPara para = new NaviPara(); // para.startPoint = pt1; // para.startName = "从这里开始"; // para.endPoint = pt2; // para.endName = "到这里结束"; // // try { // BaiduMapNavigation.openBaiduMapNavi(para, getApplication()); // // } catch (BaiduMapAppNotSupportNaviException e) { // e.printStackTrace(); // BaiduMapNavigation.openWebBaiduMapNavi(para, getApplication()); // } // } // private void setlogin() { // if (TextUtils // .isEmpty(ProfileManager.getInstance().getId(getApplication()))) { // userLogin.setText(Util.handlePhone("")); // tvLogin.setVisibility(View.GONE); // } else { // userLogin.setText(Util.handlePhone(ProfileManager.getInstance() // .getUsername(getApplication()))); // tvLogin.setVisibility(View.VISIBLE); // } // } private void getGaode(Double jing, Double wei) { Log.e("jing", jing + ""); Log.e("wei", wei + ""); double x_pi = 3.14159265358979324 * 3000.0 / 180.0; double gg_lon; double gg_lat; double x = jing - 0.0065, y = wei - 0.006; double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi); double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi); gg_lon = z * Math.cos(theta); gd_jing = String.valueOf(gg_lon); Log.e("gg_lon", gg_lon + ""); gg_lat = z * Math.sin(theta); gd_wei = String.valueOf(gg_lat); Log.e("gg_lat", gg_lat + ""); } public void ete(final String params) { new Thread(new Runnable() { @Override public void run() { try { // 创建Socket // socket = new Socket("192.168.1.110",54321); socket = new Socket("cdz.d1ev.com", 9503); // IP:10.14.114.127,端口54321 // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); String msg = br.readLine(); // token = msg; // int time = (int) (System.currentTimeMillis() / 1000); // cha = time - Integer.parseInt(msg); // MainFragment.cha = cha; Token = getMD5(String.valueOf((System.currentTimeMillis() / 1000 - MainMapActivity.cha) / 10) + "qwerty"); Point p1 = new Point(0, 0); LatLng locLeftTop = mapView.getMap().getProjection().fromScreenLocation(p1); Point p2 = new Point(MainApplication.mScreenWidth, mapView .getHeight()); LatLng llRightBottom = mapView.getMap().getProjection() .fromScreenLocation(p2); // String url = "{\"fun\":\"zhangetlist\",\"poi_lux\":" + "\"" + locLeftTop.longitude + "\"" + ",\"poi_luy\":" + "\"" + locLeftTop.latitude + "\"" + ",\"poi_rdx\":" + "\"" + llRightBottom.longitude + "\"" + ",\"poi_rdy\":" + "\"" + llRightBottom.latitude + "\"" + ",\"suit_car2\":" + "\"\"" + ",\"status\":" + "\""+3+"\"" + ",\"charge_cost_way\":" + "\"\"" + ",\"belong_attribute\":" + "\"\"" + ",\"speed\":" + "\"\"" + ",\"timer\":" + "\"" + Token + "\"" + "}"; // Log.d("wwwww", url); // System.out.print("qazwsx:"+url); // if (MainApplication.userTpye == "") { // MainApplication.userTpye = "1"; // } getBaidu(locLeftTop.longitude, locLeftTop.latitude); getBaidu1(llRightBottom.longitude, llRightBottom.latitude); ete1("{\"fun\":\"zhangetlist\",\"poi_lux\":" + "\"" + bd_lon + "\"" + ",\"poi_luy\":" + "\"" + bd_lat + "\"" + ",\"poi_rdx\":" + "\"" + bd_jing + "\"" + ",\"poi_rdy\":" + "\"" + bd_wei + "\"" + ",\"suit_car2\":" + "\"\"" + ",\"status\":" + "\"3\"" + ",\"charge_cost_way\":" + "\"\"" + ",\"belong_attribute\":" + "\"\"" + ",\"speed\":" + "\"\"" + ",\"timer\":" + "\"" + Token + "\"" + "}"); } catch (Exception e) { } } }).start(); } public void ete1(final String params) { new Thread(new Runnable() { @Override public void run() { try { // 创建Socket // socket = new Socket("192.168.1.110",54321); // if (mapView.getMap().getMapStatus().zoom < 9.5f) { // socket.close(); // stringTid.clear(); // } else { socket = new Socket("cdz.d1ev.com", 9503); // IP:10.14.114.127,端口54321 // 向服务器发送消息 PrintWriter out = new PrintWriter(new BufferedWriter( new OutputStreamWriter(socket.getOutputStream())), true); out.println(params); // out.println("{\"fun\":\"getcity\"}"); // 接收来自服务器的消息 BufferedReader br = new BufferedReader(new InputStreamReader( socket.getInputStream())); String msg = br.readLine(); Log.d("dddddmsg", msg); if (msg != null) { Message mes = new Message(); mes.obj = msg; mes.what = 1; handler.sendMessage(mes); } // if (msg != null) { // // mTextView.setText(msg); // } else { // // mTextView.setText("数据错误!"); // } // System.err.println("msg:"+msg); // String t1 = String.valueOf(new Date().getTime()/1000); // System.err.println(t1); // 关闭流 out.close(); br.close(); // 关闭Socket socket.close(); } } catch (Exception e) { } } }).start(); } private void getBaidu(Double jing, Double wei) { double x_pi = 3.14159265358979324 * 3000.0 / 180.0; double x = jing; double y = wei; double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi); double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi); bd_lon = z * Math.cos(theta) + 0.0065; bd_lat = z * Math.sin(theta) + 0.006; } private void getBaidu1(Double jing, Double wei) { double x_pi = 3.14159265358979324 * 3000.0 / 180.0; double x = jing; double y = wei; double z = Math.sqrt(x * x + y * y) + 0.00002 * Math.sin(y * x_pi); double theta = Math.atan2(y, x) + 0.000003 * Math.cos(x * x_pi); bd_jing = z * Math.cos(theta) + 0.0065; bd_wei = z * Math.sin(theta) + 0.006; } public static String getMD5(String content) { try { MessageDigest digest = MessageDigest.getInstance("MD5"); digest.update(content.getBytes()); return getHashString(digest); } catch (Exception e) { e.printStackTrace(); } return null; } private static String getHashString(MessageDigest digest) { StringBuilder builder = new StringBuilder(); for (byte b : digest.digest()) { builder.append(Integer.toHexString((b >> 4) & 0xf)); builder.append(Integer.toHexString(b & 0xf)); } return builder.toString().toLowerCase(); } private Bitmap getMarkerBmpYes(int i) { if (i == 1) { mIvMarkerBg.setImageResource(R.drawable.icon_sorange); } else if (i == 2) { mIvMarkerBg.setImageResource(R.drawable.icon_borange); } else if (i == 3) { mIvMarkerBg.setImageResource(R.drawable.icon_sblue); } else if (i == 4) { mIvMarkerBg.setImageResource(R.drawable.icon_bblue); } Bitmap bmp = getBitmapFromView(mMarkerView); return bmp; } public static Bitmap getBitmapFromView(View view) { view.destroyDrawingCache(); view.measure(View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec .makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight()); view.setDrawingCacheEnabled(true); Bitmap tmp = view.getDrawingCache(); Bitmap bitmap = tmp.copy(Bitmap.Config.ARGB_8888, false); tmp.recycle(); return bitmap; } } Everett Carlos - Gogs: Go Git Service