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

The following examples show how to use com.amap.api.maps.model.Marker#getObject() . 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 removeInterestPoint() {
    MapPointLatLng tmp = (MapPointLatLng) this.mSelectMarker.getObject();
    for (MapPointLatLng mpl : this.mMapPointList) {
        if (tmp == mpl.mInrertestPoint) {
            mpl.mInrertestPoint = null;
        }
    }
    this.interestMarkerList.remove(this.mSelectMarker);
    this.mSelectMarker.remove();
    int i = 0;
    for (Marker marker : this.interestMarkerList) {
        i++;
        MapPointLatLng p = (MapPointLatLng) marker.getObject();
        p.nPos = i;
        if (p.isMapPoint) {
            marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_line_inreterst_max1, p.altitude, p.nPos));
            setRotateAngle(marker, p.angle);
        }
    }
    this.mSelectMarker = null;
    if (this.lineMarkerSelectListener != null) {
        IX8MarkerListener iX8MarkerListener = this.lineMarkerSelectListener;
        boolean z = this.interestMarkerList.size() != this.mMarkerList.size() && hasPointUnBind();
        iX8MarkerListener.onInterestSizeEnable(z);
    }
}
 
Example 2
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public synchronized void startAiLineProcess() {
    int i = 0;
    this.nPos = -1;
    for (Marker marker : this.mMarkerList) {
        int res;
        i++;
        MapPointLatLng p = (MapPointLatLng) marker.getObject();
        if (p.yawMode == 0) {
            res = R.drawable.x8_ai_line_point_no_angle1;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle1;
        }
        marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, i));
        marker.setFlat(true);
        setRotateAngle(marker, p.angle);
    }
}
 
Example 3
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public synchronized void setAiLineIndexPoint(int index) {
    if (this.nPos != index) {
        int res;
        Marker currentMarker = (Marker) this.mMarkerList.get(index);
        MapPointLatLng mapPointLatLng = (MapPointLatLng) currentMarker.getObject();
        if (mapPointLatLng.yawMode == 0) {
            res = R.drawable.x8_img_ai_follow_point_device4;
        } else {
            res = R.drawable.x8_ai_line_point_with_angle2;
        }
        currentMarker.setIcon(new GaoDeMapCustomMarkerView().createCurrentPointView(this.context, res, getCurrentPointActionRes(mapPointLatLng.action), index + 1));
        if (this.nPos >= 0) {
            Marker lastMarker = (Marker) this.mMarkerList.get(this.nPos);
            if (((MapPointLatLng) currentMarker.getObject()).yawMode == 0) {
                res = R.drawable.x8_ai_line_point_no_angle1;
            } else {
                res = R.drawable.x8_ai_line_point_with_angle1;
            }
            lastMarker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, res, this.nPos + 1));
        }
        this.nPos = index;
    }
}
 
Example 4
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void removeLinePoint(LatLng homeLocation) {
    MapPointLatLng removeMapPointLatLng = null;
    for (MapPointLatLng mMapPointLatLng : this.mMapPointList) {
        LatLng mLatLng = this.mSelectMarker.getPosition();
        if (mLatLng.longitude == mMapPointLatLng.longitude && mLatLng.latitude == mMapPointLatLng.latitude) {
            removeMapPointLatLng = mMapPointLatLng;
            break;
        }
    }
    if (removeMapPointLatLng != null) {
        this.mMapPointList.remove(removeMapPointLatLng);
    }
    for (Marker marker : this.mMarkerList) {
        if (this.mSelectMarker == marker) {
            break;
        }
    }
    this.mMarkerList.remove(this.mSelectMarker);
    this.mSelectMarker.remove();
    int i = 0;
    for (Marker marker2 : this.mMarkerList) {
        i++;
        MapPointLatLng p = (MapPointLatLng) marker2.getObject();
        p.nPos = i;
        if (p.isMapPoint) {
            marker2.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_follow_point2, p.altitude, p.nPos));
            setRotateAngle(marker2, p.angle);
        } else {
            marker2.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle1, p.nPos));
            setRotateAngle(marker2, p.angle);
        }
    }
    drawPointLine(homeLocation);
    this.mSelectMarker = null;
    this.lineMarkerSelectListener.onMarkerSizeChange(this.mMarkerList.size());
    removeInterestUnBebind();
}
 
Example 5
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void setAiLineMarkActionByDevice(List<AckGetAiLinePointsAction> points) {
    if (this.mMarkerList != null && this.mMarkerList.size() > 0) {
        for (Marker m : this.mMarkerList) {
            MapPointLatLng mpl = (MapPointLatLng) m.getObject();
            for (AckGetAiLinePointsAction pointsAction : points) {
                if (mpl.nPos - 1 == pointsAction.pos) {
                    mpl.action = pointsAction.getAction();
                    break;
                }
            }
        }
    }
}
 
Example 6
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void removeInterestUnBebind() {
    MapPointLatLng p;
    Marker tmp = null;
    for (Marker m : this.interestMarkerList) {
        MapPointLatLng mpl = (MapPointLatLng) m.getObject();
        boolean isFind = false;
        for (MapPointLatLng p2 : this.mMapPointList) {
            if (p2.mInrertestPoint == mpl) {
                isFind = true;
                continue;
                break;
            }
        }
        if (!isFind) {
            tmp = m;
            break;
        }
    }
    if (tmp != null) {
        this.interestMarkerList.remove(tmp);
        tmp.remove();
        int i = 0;
        for (Marker marker : this.interestMarkerList) {
            i++;
            p2 = (MapPointLatLng) marker.getObject();
            p2.nPos = i;
            if (p2.isMapPoint) {
                marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_line_inreterst_max1, p2.altitude, p2.nPos));
                setRotateAngle(marker, p2.angle);
            }
        }
    }
    if (this.lineMarkerSelectListener != null) {
        IX8MarkerListener iX8MarkerListener = this.lineMarkerSelectListener;
        boolean z = this.interestMarkerList.size() != this.mMarkerList.size() && hasPointUnBind();
        iX8MarkerListener.onInterestSizeEnable(z);
    }
}
 
Example 7
Source File: PoiAroundSearchActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker marker) {
	
	if (marker.getObject() != null) {
		whetherToShowDetailInfo(true);
		try {
			PoiItem mCurrentPoi = (PoiItem) marker.getObject();
			if (mlastMarker == null) {
				mlastMarker = marker;
			} else {
				// 将之前被点击的marker置为原来的状态
				resetlastmarker();
				mlastMarker = marker;
			}
			detailMarker = marker;
			detailMarker.setIcon(BitmapDescriptorFactory
								.fromBitmap(BitmapFactory.decodeResource(
										getResources(),
										R.drawable.poi_marker_pressed)));

			setPoiItemDisplayContent(mCurrentPoi);
		} catch (Exception e) {
			// TODO: handle exception
		}
	}else {
		whetherToShowDetailInfo(false);
		resetlastmarker();
	}


	return true;
}
 
Example 8
Source File: ParticleWeatherMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 获取是哪里需要显示天气
 *
 * @param position
 * @return
 */
private String getShowWeatherPositio(CameraPosition position) {
    if(position == null) {
        return null;
    }

    List<Marker> markers = aMap.getMapScreenMarkers();

    // 去除离屏幕最近的marker
    Marker needShowMarker = null;
    float distance = 0;
    for (Marker marker : markers) {
        LatLng markerPos = marker.getPosition();

        float curDistanct = AMapUtils.calculateLineDistance(markerPos, position.target);

        if(distance == 0) {
            distance = curDistanct;
            needShowMarker = marker;
        } else {
            if(curDistanct < distance) {
                needShowMarker = marker;
            }
        }

    }


    if(needShowMarker != null && needShowMarker.getObject() != null) {
        return (String) needShowMarker.getObject();
    }
    return null;
}
 
Example 9
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onMarkerClick(Marker arg0) {
    if (mClusterClickListener == null) {
        return true;
    }
   Cluster cluster= (Cluster) arg0.getObject();
    if(cluster!=null){
        mClusterClickListener.onClick(arg0,cluster.getClusterItems());
        return true;
    }
    return false;
}
 
Example 10
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public boolean onMarkerClick(Marker marker) {
    MapPointLatLng mp = (MapPointLatLng) marker.getObject();
    GaoDeMapCustomMarkerView gdCustemMarkerView;
    int res;
    if (this.mSelectMarker == null) {
        this.mSelectMarker = marker;
        mp.isSelect = true;
        if (mp.isMapPoint) {
            gdCustemMarkerView = new GaoDeMapCustomMarkerView();
            res = R.drawable.x8_img_ai_follow_point;
            if (mp.isIntertestPoint) {
                res = R.drawable.x8_img_ai_line_inreterst_max2;
            }
            marker.setIcon(gdCustemMarkerView.createCustomMarkerView(this.context, res, mp.altitude, mp.nPos));
        } else if (!mp.isMapPoint) {
            marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle2, mp.nPos));
        }
    } else if (this.mSelectMarker.getObject() == marker.getObject()) {
        mp.isSelect = false;
        this.mSelectMarker = null;
        if (mp.isMapPoint) {
            gdCustemMarkerView = new GaoDeMapCustomMarkerView();
            res = R.drawable.x8_img_ai_follow_point2;
            if (mp.isIntertestPoint) {
                res = R.drawable.x8_img_ai_line_inreterst_max1;
            }
            marker.setIcon(gdCustemMarkerView.createCustomMarkerView(this.context, res, mp.altitude, mp.nPos));
        } else if (!mp.isMapPoint) {
            marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle2, mp.nPos));
        }
    } else {
        Marker lastMarker = this.mSelectMarker;
        MapPointLatLng lastMp = (MapPointLatLng) lastMarker.getObject();
        lastMp.isSelect = false;
        if (lastMp.isMapPoint) {
            gdCustemMarkerView = new GaoDeMapCustomMarkerView();
            res = R.drawable.x8_img_ai_follow_point2;
            if (lastMp.isIntertestPoint) {
                res = R.drawable.x8_img_ai_line_inreterst_max1;
            }
            lastMarker.setIcon(gdCustemMarkerView.createCustomMarkerView(this.context, res, lastMp.altitude, lastMp.nPos));
        } else if (!lastMp.isMapPoint) {
            lastMarker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle1, lastMp.nPos));
        }
        this.mSelectMarker = marker;
        mp.isSelect = true;
        if (mp.isMapPoint) {
            gdCustemMarkerView = new GaoDeMapCustomMarkerView();
            res = R.drawable.x8_img_ai_follow_point;
            if (mp.isIntertestPoint) {
                res = R.drawable.x8_img_ai_line_inreterst_max2;
            }
            marker.setIcon(gdCustemMarkerView.createCustomMarkerView(this.context, res, mp.altitude, mp.nPos));
        } else if (!mp.isMapPoint) {
            marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView2(this.context, R.drawable.x8_ai_line_point_with_angle2, mp.nPos));
        }
    }
    this.lineMarkerSelectListener.onMarkerSelect(mp.isSelect, mp.altitude, mp, this.isClick);
    this.isClick = true;
    return true;
}
 
Example 11
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onMarkerDragStart(Marker marker) {
    MapPointLatLng mp = (MapPointLatLng) marker.getObject();
    marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_line_inreterst_max2, mp.altitude, mp.nPos));
}
 
Example 12
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 4 votes vote down vote up
public void onMarkerDragEnd(Marker marker) {
    MapPointLatLng mp = (MapPointLatLng) marker.getObject();
    marker.setIcon(new GaoDeMapCustomMarkerView().createCustomMarkerView(this.context, R.drawable.x8_img_ai_line_inreterst_max1, mp.altitude, mp.nPos));
    ((MapPointLatLng) marker.getObject()).isInrertestPointActive = true;
}