com.amap.api.maps.model.Polyline Java Examples

The following examples show how to use com.amap.api.maps.model.Polyline. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RouteOverlay.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 去掉BusRouteOverlay上所有的Marker。
 * @since V2.1.0
 */
public void removeFromMap() {
	if (startMarker != null) {
		startMarker.remove();

	}
	if (endMarker != null) {
		endMarker.remove();
	}
	for (Marker marker : stationMarkers) {
		marker.remove();
	}
	for (Polyline line : allPolyLines) {
		line.remove();
	}
	destroyBit();
}
 
Example #2
Source File: RouteOverlay.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 去掉BusRouteOverlay上所有的Marker。
 * @since V2.1.0
 */
public void removeFromMap() {
	if (startMarker != null) {
		startMarker.remove();

	}
	if (endMarker != null) {
		endMarker.remove();
	}
	for (Marker marker : stationMarkers) {
		marker.remove();
	}
	for (Polyline line : allPolyLines) {
		line.remove();
	}
	destroyBit();
}
 
Example #3
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
public void setRangingPolyLine() {
    if (mPoiList.size() < 2) {
        mTotal = 0;
        ((MainActivity) getActivity()).setRangingDistance(mTotal);
        return;
    }

    MyPoiModel end = mPoiList.get(mPoiList.size() - 1);
    MyPoiModel last = mPoiList.get(mPoiList.size() - 2);

    mTotal += AMapUtils.calculateLineDistance(new LatLng(end.getLatitude(), end.getLongitude()),
            new LatLng(last.getLatitude(), last.getLongitude()));

    List<LatLng> points = new ArrayList<>();
    points.add(new LatLng(end.getLatitude(), end.getLongitude()));
    points.add(new LatLng(last.getLatitude(), last.getLongitude()));

    Polyline ooPolyline = mAmap.addPolyline(new PolylineOptions().addAll(points).width(6).color(Color.BLUE));

    if (null == mLineList) {
        mLineList = new ArrayList<>();
    }
    mLineList.add(ooPolyline);

    ((MainActivity) getActivity()).setRangingDistance(mTotal);
}
 
Example #4
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
public void clearRangingPoi() {
    clearMarker();

    for (Marker marker : mRangingMarkerList) {
        marker.remove();
    }
    mRangingMarkerList.clear();

    for (Polyline polyline : mLineList) {
        polyline.remove();
    }
    mLineList.clear();

    mPoiList.clear();
    mTotal = 0;
}
 
Example #5
Source File: RouteOverlay.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
/**
 * 去掉BusRouteOverlay上所有的Marker。
 * @since V2.1.0
 */
public void removeFromMap() {
	if (startMarker != null) {
		startMarker.remove();

	}
	if (endMarker != null) {
		endMarker.remove();
	}
	for (Marker marker : stationMarkers) {
		marker.remove();
	}
	for (Polyline line : allPolyLines) {
		line.remove();
	}
	destroyBit();
}
 
Example #6
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
public void setRangingPolyLine() {
    if (mPoiList.size() < 2) {
        mTotal = 0;
        ((MainActivity) getActivity()).setRangingDistance(mTotal);
        return;
    }

    MyPoiModel end = mPoiList.get(mPoiList.size() - 1);
    MyPoiModel last = mPoiList.get(mPoiList.size() - 2);

    mTotal += AMapUtils.calculateLineDistance(new LatLng(end.getLatitude(), end.getLongitude()),
            new LatLng(last.getLatitude(), last.getLongitude()));

    List<LatLng> points = new ArrayList<>();
    points.add(new LatLng(end.getLatitude(), end.getLongitude()));
    points.add(new LatLng(last.getLatitude(), last.getLongitude()));

    Polyline ooPolyline = mAmap.addPolyline(new PolylineOptions().addAll(points).width(6).color(Color.BLUE));

    if (null == mLineList) {
        mLineList = new ArrayList<>();
    }
    mLineList.add(ooPolyline);

    ((MainActivity) getActivity()).setRangingDistance(mTotal);
}
 
Example #7
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
public void clearRangingPoi() {
    clearMarker();

    for (Marker marker : mRangingMarkerList) {
        marker.remove();
    }
    mRangingMarkerList.clear();

    for (Polyline polyline : mLineList) {
        polyline.remove();
    }
    mLineList.clear();

    mPoiList.clear();
    mTotal = 0;
}
 
Example #8
Source File: AMapViewManager.java    From react-native-amap with MIT License 6 votes vote down vote up
public void addFeature(MapView parent, View child, int index) {
    AMap map = parent.getMap();
    if (child instanceof AMapMarker) {
        AMapMarker annotation = (AMapMarker) child;
        annotation.addToMap(map);
        features.add(index, annotation);
        Marker marker = (Marker) annotation.getFeature();
        markerMap.put(marker, annotation);
    } else if (child instanceof AMapPolyline) {
        AMapPolyline polylineView = (AMapPolyline) child;
        polylineView.addToMap(map);
        features.add(index, polylineView);
        Polyline polyline = (Polyline) polylineView.getFeature();
        polylineMap.put(polyline, polylineView);
    } else {
        ViewGroup children = (ViewGroup) child;
        for (int i = 0; i < children.getChildCount(); i++) {
          addFeature(parent, children.getChildAt(i), index);
        }
    }
}
 
Example #9
Source File: RouteOverlay.java    From TraceByAmap with MIT License 5 votes vote down vote up
protected void addPolyLine(PolylineOptions options) {
	if(options == null) {
		return;
	}
	Polyline polyline = mAMap.addPolyline(options);
	if(polyline != null) {
		allPolyLines.add(polyline);
	}
}
 
Example #10
Source File: RouteOverlay.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
protected void addPolyLine(PolylineOptions options) {
	if(options == null) {
		return;
	}
	Polyline polyline = mAMap.addPolyline(options);
	if(polyline != null) {
		allPolyLines.add(polyline);
	}
}
 
Example #11
Source File: RouteOverlay.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
protected void addPolyLine(PolylineOptions options) {
	if(options == null) {
		return;
	}
	Polyline polyline = mAMap.addPolyline(options);
	if(polyline != null) {
		allPolyLines.add(polyline);
	}
}