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(); }
@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(); }