public void drawCircleOnDyn(Point2D point2D, float azimuth, double q) { if (point2D.getX() == 0 || point2D.getY() == 0) { MyApplication.getInstance().showInfo("定位点为空"); return; } m_locateDynamicView.removeElement(m_LocationID); m_locateDynamicView.removeElement(m_LocationPolygonID); // 构造精度范围 if (q == 0) { q = 60; } GeoCircle geoCircle = new GeoCircle(point2D, q); GeoRegion geoRegion = geoCircle.convertToRegion(50 * 4); // 绘制精度范围 DynamicPolygon dynPolygon = new DynamicPolygon(); dynPolygon.fromGeometry(geoRegion); DynamicStyle style = new DynamicStyle(); style.setBackColor(android.graphics.Color.rgb(128, 128, 255)); style.setLineColor(android.graphics.Color.rgb(128, 255, 255)); // 224, 224, 224 style.setAlpha(65); // 95 // style.setSize(3.0f);//6.0f dynPolygon.setStyle(style); m_locateDynamicView.addElement(dynPolygon); m_LocationPolygonID = dynPolygon.getID(); drawPoint(point2D, azimuth); }
@Override public void SynchronousLocationReceived(Point2D location, String clientID) { // 查询现有的动态层对象 List<DynamicElement> m_locateDynamicPoints = m_locateDynamicView.query(mapShow.getBounds()); boolean bExist = false; DynamicPoint pnt; for (int i = 0; i < m_locateDynamicPoints.size(); i++) { if (m_locateDynamicPoints.get(i).getID() == m_LocationID || m_locateDynamicPoints.get(i).getID() == m_LocationPolygonID) { // 不与本设备定位点进行对比 continue; } pnt = (DynamicPoint) m_locateDynamicPoints.get(i); if (pnt.getUserData().equals(clientID)) { m_locateDynamicView.removeElement(pnt); pnt.updatePoint(0, mapShow.getPoint(location)); m_locateDynamicView.addElement(pnt); bExist = true; break; } } if (bExist == false) { DynamicPoint dynPoint = new DynamicPoint(); dynPoint.addPoint(mapShow.getPoint(location)); DynamicStyle dynStyle = new DynamicStyle(); dynStyle.setBackground( BitmapFactory.decodeResource(mapShow.getResources(), R.drawable.navi_end)); dynStyle.setAngle(0); dynPoint.setStyle(dynStyle); dynPoint.setUserData(clientID); m_locateDynamicView.addElement(dynPoint); } m_locateDynamicView.refresh(); }
public void drawPoint(Point2D point2D, float azimuth) { DynamicPoint dynPoint = new DynamicPoint(); dynPoint.addPoint(point2D); DynamicStyle dynStyle = new DynamicStyle(); dynStyle.setBackground( BitmapFactory.decodeResource(mapShow.getResources(), R.drawable.location)); dynStyle.setAngle(azimuth); dynPoint.setStyle(dynStyle); m_locateDynamicView.addElement(dynPoint); m_LocationID = dynPoint.getID(); m_locateDynamicView.refresh(); }