Java Code Examples for com.amap.api.maps.model.Marker#setObject()

The following examples show how to use com.amap.api.maps.model.Marker#setObject() . 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: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void setAiLineMarkByHistory(List<X8AiLinePointLatlngInfo> points, int mapTpye) {
    for (X8AiLinePointLatlngInfo point : points) {
        int res;
        MapPointLatLng mp = new MapPointLatLng();
        if (point.getYawMode() == 0) {
            res = R.drawable.x8_ai_line_point_no_angle1;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        BitmapDescriptor mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, this.mMarkerList.size() + 1);
        mp.altitude = (float) point.getAltitude();
        mp.nPos = this.mMarkerList.size() + 1;
        LatLng latLng = new LatLng(point.getLatitude(), point.getLongitude());
        Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
        mp.longitude = latLng.longitude;
        mp.latitude = latLng.latitude;
        mMarker.setObject(mp);
        this.mMarkerList.add(mMarker);
        mp.distance = 0.0f;
        this.mMapPointList.add(mp);
        setRotateAngle(mMarker, point.getYaw() / 100.0f);
    }
    if (points.size() > 0) {
        drawPointLine(this.mGaodeMapLocationManager.getHomeLocation());
    }
}
 
Example 2
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void addInreterstMarker(int x, int y) {
    GaoDeMapCustomMarkerView gdCustemMarkerView = new GaoDeMapCustomMarkerView();
    MapPointLatLng mp = new MapPointLatLng();
    LatLng latLng = this.aMap.getProjection().fromScreenLocation(new Point(x, y));
    mp.isIntertestPoint = true;
    mp.isMapPoint = true;
    mp.nPos = this.interestMarkerList.size() + 1;
    int h = Math.round(StateManager.getInstance().getX8Drone().getHeight());
    if (h <= 5) {
        h = 5;
    }
    mp.altitude = (float) h;
    Marker interestMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(gdCustemMarkerView.createCustomMarkerView(this.context, R.drawable.x8_img_ai_line_inreterst_max1, (float) h, mp.nPos)).anchor(0.5f, 1.0f).draggable(true));
    interestMarker.setObject(mp);
    interestMarker.setDraggable(true);
    this.interestMarkerList.add(interestMarker);
    if (this.lineMarkerSelectListener != null) {
        IX8MarkerListener iX8MarkerListener = this.lineMarkerSelectListener;
        boolean z = this.interestMarkerList.size() != this.mMarkerList.size() && hasPointUnBind();
        iX8MarkerListener.onInterestSizeEnable(z);
    }
    this.isClick = false;
    onMarkerClick(interestMarker);
}
 
Example 3
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void addPointLatLng(LatLng latLng, float distance, LatLng deviceLocation, boolean isMapPoint, float angle) {
    BitmapDescriptor mBitmapDescriptor;
    MapPointLatLng mp = new MapPointLatLng();
    mp.nPos = this.mMarkerList.size() + 1;
    int h = Math.round(StateManager.getInstance().getX8Drone().getHeight());
    if (h <= 5) {
        h = 5;
    }
    if (isMapPoint) {
        mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_follow_point2, (float) h, mp.nPos);
        mp.altitude = (float) h;
        mp.isMapPoint = isMapPoint;
    } else {
        mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle1, this.mMarkerList.size() + 1);
        mp.altitude = (float) h;
        mp.isMapPoint = isMapPoint;
    }
    Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
    mp.longitude = latLng.longitude;
    mp.latitude = latLng.latitude;
    mMarker.setObject(mp);
    this.mMarkerList.add(mMarker);
    mp.distance = distance;
    this.mMapPointList.add(mp);
    drawPointLine(deviceLocation);
    this.lineMarkerSelectListener.onMarkerSizeChange(this.mMarkerList.size());
    if (angle != -1.0f) {
        mp.angle = angle;
        setRotateAngle(mMarker, angle);
    }
    this.isClick = false;
    onMarkerClick(mMarker);
}
 
Example 4
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void setAiLineMarkByDevice(List<AckGetAiLinePoint> points, List<AckGetAiLinePoint> list) {
    for (AckGetAiLinePoint point : points) {
        int res;
        MapPointLatLng mp = new MapPointLatLng();
        mp.yawMode = point.getYawMode();
        if (mp.yawMode == 0) {
            res = R.drawable.x8_ai_line_point_no_angle1;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        BitmapDescriptor mBitmapDescriptor = new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, this.mMarkerList.size() + 1);
        mp.altitude = (float) point.getAltitude();
        mp.nPos = this.mMarkerList.size() + 1;
        FLatLng fLatLng = GpsCorrect.Earth_To_Mars(point.getLatitude(), point.getLongitude());
        LatLng latLng = new LatLng(fLatLng.latitude, fLatLng.longitude);
        Marker mMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(mBitmapDescriptor).anchor(0.5f, 0.5f).draggable(false));
        mp.longitude = latLng.longitude;
        mp.latitude = latLng.latitude;
        mp.angle = point.getAngle();
        mMarker.setObject(mp);
        this.mMarkerList.add(mMarker);
        mp.distance = 0.0f;
        this.mMapPointList.add(mp);
        mMarker.setFlat(true);
        setRotateAngle(mMarker, point.getAngle());
    }
    if (points.size() > 0) {
        drawPointLine(this.mGaodeMapLocationManager.getHomeLocation());
    }
}
 
Example 5
Source File: PoiAroundSearchActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
   * 添加Marker到地图中。
   * @since V2.1.0
   */
  public void addToMap() {
  	if(mPois != null) {
	int size = mPois.size();
	for (int i = 0; i < size; i++) {
		Marker marker = mamap.addMarker(getMarkerOptions(i));
		PoiItem item = mPois.get(i);
		marker.setObject(item);
		mPoiMarks.add(marker);
	}
}
  }
 
Example 6
Source File: ParticleWeatherMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 初始化添加marker
 */
private void initWeather() {
    CameraPosition cameraPosition = aMap.getCameraPosition();
    boolean isNeedShowWeatherMarker = false;
    if (cameraPosition != null) {
        isNeedShowWeatherMarker = cameraPosition.zoom <= MAX_SHOW_WEATHER_MARKER_ZOOM;

        // 查看首次需不需要显示粒子效果
        changeParticleOverlayState(cameraPosition);
    }
    for (int i = 0; i < latLngs.length; i++) {
        LatLng latLng = latLngs[i];
        int index = i % pngPaths.length;

        // 天气状态随机选取,如果要使用到实际场景,这里需要修改成真是数据
        String path = pngPaths[index];

        BitmapDescriptor bitmapDescriptor = bitmapDescriptorHashtable.get(path);
        if (bitmapDescriptor == null) {
            bitmapDescriptor = BitmapDescriptorFactory.fromAsset(path);
            bitmapDescriptorHashtable.put(path, bitmapDescriptor);
        }

        Marker marker = aMap.addMarker(new MarkerOptions().position(latLng).icon(bitmapDescriptor).visible(isNeedShowWeatherMarker));
        if (marker != null) {
            marker.setObject(path);
            markerList.add(marker);
        }

    }

}
 
Example 7
Source File: CloudOverlay.java    From TraceByAmap with MIT License 5 votes vote down vote up
public void addToMap() {
	for (int i = 0; i < mPois.size(); i++) {
		Marker marker = mAMap.addMarker(getMarkerOptions(i));
		marker.setObject(i);
		mPoiMarks.add(marker);
	}
}
 
Example 8
Source File: RoutePOIActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
  * 添加Marker到地图中。
  * @since V2.1.0
  */
 public void addToMap() {
     for (int i = 0; i < mPois.size(); i++) {
         Marker marker = mamap.addMarker(getMarkerOptions(i));
         RoutePOIItem item = mPois.get(i);
marker.setObject(item);
         mPoiMarks.add(marker);
     }
 }
 
Example 9
Source File: PoiOverlay.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 添加Marker到地图中。
 * @since V2.1.0
 */
public void addToMap() {
	try{
		for (int i = 0; i < mPois.size(); i++) {
			Marker marker = mAMap.addMarker(getMarkerOptions(i));
			marker.setObject(i);
			mPoiMarks.add(marker);
		}
	}catch(Throwable e){
		e.printStackTrace();
	}
}
 
Example 10
Source File: PoiOverlay.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 添加Marker到地图中。
 * @since V2.1.0
 */
public void addToMap() {
	try{
		for (int i = 0; i < mPois.size(); i++) {
			Marker marker = mAMap.addMarker(getMarkerOptions(i));
			marker.setObject(i);
			mPoiMarks.add(marker);
		}
	}catch(Throwable e){
		e.printStackTrace();
	}
}
 
Example 11
Source File: PoiOverlay.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
/**
 * 添加Marker到地图中。
 * @since V2.1.0
 */
public void addToMap() {
	try{
		for (int i = 0; i < mPois.size(); i++) {
			Marker marker = mAMap.addMarker(getMarkerOptions(i));
			marker.setObject(i);
			mPoiMarks.add(marker);
		}
	}catch(Throwable e){
		e.printStackTrace();
	}
}
 
Example 12
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 5 votes vote down vote up
/**
 * 将单个聚合元素添加至地图显示
 *
 * @param cluster
 */
private void addSingleClusterToMap(Cluster cluster) {
    LatLng latlng = cluster.getCenterLatLng();
    MarkerOptions markerOptions = new MarkerOptions();
    markerOptions.anchor(0.5f, 0.5f)
            .icon(getBitmapDes(cluster.getClusterCount())).position(latlng);
    Marker marker = mAMap.addMarker(markerOptions);
    marker.setAnimation(mADDAnimation);
    marker.setObject(cluster);

    marker.startAnimation();
    cluster.setMarker(marker);
    mAddMarkers.add(marker);

}