[driver passenger ] 1、bus乘客屏小地图起终点显示bug;路线过长显示问题 2、解决bus司机屏站点过长显示问题
This commit is contained in:
@@ -14,7 +14,6 @@ import androidx.annotation.Nullable;
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdate;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.UiSettings;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
@@ -26,7 +25,6 @@ import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
@@ -265,6 +263,10 @@ public class BusPassengerMapDirectionView
|
||||
}
|
||||
}
|
||||
|
||||
public void clearCoordinatesLatLng(){
|
||||
mCoordinatesLatLng.clear();
|
||||
}
|
||||
|
||||
public void onCreateView(Bundle savedInstanceState) {
|
||||
if (mAMapNaviView != null) {
|
||||
mAMapNaviView.onCreate(savedInstanceState);
|
||||
@@ -296,26 +298,34 @@ public class BusPassengerMapDirectionView
|
||||
mCoordinatesLatLng.addAll(latLngs);
|
||||
}
|
||||
|
||||
public void setLinePointMarkerAndDraw(List<LatLng> routeLineLatLngs, int currentIndex) {
|
||||
mLinePointsLatLng.clear();
|
||||
public void clearLineMarkers(){
|
||||
for (int i =0; i< mLineMarkers.size();i++){
|
||||
mLineMarkers.get(i).setVisible(false);
|
||||
}
|
||||
mLineMarkers.clear();
|
||||
mLinePointsLatLng.addAll(routeLineLatLngs);
|
||||
for (int i = 0; i < mLinePointsLatLng.size(); i++) {
|
||||
}
|
||||
|
||||
public void setLineMarkersAndDraw(List<LatLng> lineineLatLngs){
|
||||
clearLineMarkers();
|
||||
for (int i = 0; i < lineineLatLngs.size(); i++) {
|
||||
Marker mWayPointMarker = mAMap.addMarker(new MarkerOptions()
|
||||
.icon(BitmapDescriptorFactory.fromResource(R.drawable.bus_p_map_view_dir_way_point)));
|
||||
mLineMarkers.add(mWayPointMarker);
|
||||
}
|
||||
|
||||
if (mCoordinatesLatLng.size() == 0) {
|
||||
for (int i = 0; i < mLineMarkers.size(); i++) {
|
||||
mLineMarkers.get(i).setPosition(mLinePointsLatLng.get(i));
|
||||
mLineMarkers.get(i).setPosition(lineineLatLngs.get(i));
|
||||
mLineMarkers.get(i).setVisible(true);
|
||||
}
|
||||
mCurrentIndex = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mCurrentIndex != currentIndex) {
|
||||
public void setLinePointMarkerAndDraw(List<LatLng> routeLineLatLngs, int currentIndex) {
|
||||
mLinePointsLatLng.clear();
|
||||
mLinePointsLatLng.addAll(routeLineLatLngs);
|
||||
|
||||
if (mCoordinatesLatLng.size() > 0 && mCurrentIndex != currentIndex) {
|
||||
if (mAMap != null && mLineMarkers.size() > 0) {
|
||||
mCurrentIndex = currentIndex;
|
||||
for (int i = 0; i < mLineMarkers.size(); i++) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BusPassengerRouteFragment extends
|
||||
|
||||
private BusPassengerTrafficLightView mTrafficLightView;
|
||||
private List<BusPassengerStation> mStationsList = new ArrayList<>();
|
||||
private List<LatLng> mRoutePointsList = new ArrayList<>();
|
||||
private List<LatLng> mLinePointsList = new ArrayList<>();
|
||||
|
||||
private TextView mSpeedTv;
|
||||
private ConstraintLayout mNoLineInfoView;
|
||||
@@ -176,6 +176,18 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
public void setLineMarkers(List<LatLng> list) {
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.setLineMarkersAndDraw(list);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void changeOperationStatus(boolean status) {
|
||||
if (status) {
|
||||
mNoLineInfoView.setVisibility(View.GONE);
|
||||
@@ -207,19 +219,34 @@ public class BusPassengerRouteFragment extends
|
||||
mStationsList.clear();
|
||||
mStationsList.addAll(stations);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
|
||||
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
|
||||
clearPolyline();
|
||||
if (mMapDirectionView != null) mMapDirectionView.clearCoordinatesLatLng();
|
||||
}
|
||||
|
||||
if (stations.size() > 0){
|
||||
updateWayPointList(stations,currentStationIndex);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWayPointList(List<BusPassengerStation> stations,int currentStationIndex) {
|
||||
mRoutePointsList.clear();
|
||||
mLinePointsList.clear();
|
||||
for (int i = 0; i< stations.size(); i++) {//站点集合
|
||||
LatLng latLng = BPCoordinateCalculateRouteUtil.coordinateConverterWgsToGcj(getContext()
|
||||
,stations.get(i).getLon(),stations.get(i).getLat());// lat,lon
|
||||
mRoutePointsList.add(latLng);
|
||||
mLinePointsList.add(latLng);
|
||||
}
|
||||
setLineMarkers(mLinePointsList);
|
||||
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.setLinePointMarkerAndDraw(mLinePointsList,currentStationIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
mMapDirectionView.setLinePointMarkerAndDraw(mRoutePointsList,currentStationIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bus_p_line_name_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
@@ -118,6 +118,7 @@
|
||||
android:textSize="@dimen/bus_p_driver_number_plate_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/bus_p_driver_num_plate_tv"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/bus_p_driver_num_plate_tv"
|
||||
app:layout_goneMarginLeft="0px" />
|
||||
|
||||
|
||||
@@ -75,13 +75,16 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6px"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_start_station_tag"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor"
|
||||
tools:text="后路站" />
|
||||
@@ -114,12 +117,15 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_order_end_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="--"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_name_text_size"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintRight_toLeftOf="@+id/module_och_bus_end_station_tag"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
|
||||
tools:text="后路站1" />
|
||||
|
||||
Reference in New Issue
Block a user