本文整理汇总了Java中com.amap.api.maps.model.MarkerOptions.position方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions.position方法的具体用法?Java MarkerOptions.position怎么用?Java MarkerOptions.position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.maps.model.MarkerOptions
的用法示例。
在下文中一共展示了MarkerOptions.position方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMapLoaded
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onMapLoaded() {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.setFlat(true);
markerOptions.anchor(0.5f, 0.5f);
markerOptions.position(new LatLng(0, 0));
markerOptions
.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory
.decodeResource(getResources(),
R.drawable.icon_loaction_start)));
mPositionMark = mAmap.addMarker(markerOptions);
mPositionMark.setPositionByPixels(mMapView.getWidth() / 2,
mMapView.getHeight() / 2);
mLocationTask.startSingleLocate();
}
示例2: addNodeMarks
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
protected void addNodeMarks() {
aMap.clear();
MarkerOptions markerOptions = new MarkerOptions();
if (!list_p.isEmpty()) {
for (TransNode t : list_p) {
Position p = t.getPosition();
markerOptions.title(t.getNodename());
markerOptions.snippet("电话: " + t.getTelcode() + "\n" + "区域码: "
+ t.getRegioncode());
// 设置Marker的坐标,为我们点击地图的经纬度坐标
markerOptions.position(new LatLng(p.getX(), p.getY()));
// 设置Marker的可见性
markerOptions.visible(true);
// 设置Marker是否可以被拖拽,这里先设置为false,之后会演示Marker的拖拽功能
markerOptions.draggable(false);
// 将Marker添加到地图上去
aMap.addMarker(markerOptions);
}
} else {
Toast.makeText(getActivity(), "查询不到此网点哦~", Toast.LENGTH_SHORT)
.show();
}
}
示例3: drawMarkers
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void drawMarkers() {
AMap map = mapRef.get();
if (map != null && currentClusters != null) {
currentMarkers = new ArrayList<Marker>(currentClusters.size());
currentClusterPointsByMarker = new HashMap<Marker, ClusterPoint>(currentClusters.size());
MarkerOptionsChooser moc = options.getMarkerOptionsChooser();
for (ClusterPoint clusterPoint : currentClusters) {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(clusterPoint.getMapPosition());
if (moc != null) {
moc.choose(markerOptions, clusterPoint);
}
Marker marker = map.addMarker(markerOptions);
currentMarkers.add(marker);
currentClusterPointsByMarker.put(marker, clusterPoint);
}
}
}
示例4: addMarkerOnMap
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void addMarkerOnMap(String message) {
if (mMarker == null) {
LogUtil.e("这里设置图标选项");
mOptions = new MarkerOptions();
mOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE));
mOptions.snippet(message);
mOptions.position(new LatLng(latitude, longitude));
mMarker = mMap.addMarker(mOptions);
}
mMap.reloadMap();
startMarkerAnimation();
}
示例5: createMarkerOptions
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private MarkerOptions createMarkerOptions() {
MarkerOptions options = new MarkerOptions();
if (anchorIsSet) options.anchor(anchorX, anchorY);
//if (calloutAnchorIsSet) options.infoWindowAnchor(calloutAnchorX, calloutAnchorY);
options.position(position);
options.title(title);
options.snippet(snippet);
options.rotateAngle(rotation);
options.setFlat(flat);
options.draggable(draggable);
options.zIndex(zIndex);
options.alpha(opacity);
options.icon(getIcon());
return options;
}
示例6: initPlacePoint
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void initPlacePoint() {
MarkerOptions markerOption = new MarkerOptions();
JUtils.Log("Place" + mPlaceDetail.getLat() + ":" + mPlaceDetail.getLng());
markerOption.position(new LatLng(mPlaceDetail.getLat(), mPlaceDetail.getLng()));
markerOption.title(mPlaceDetail.getName()).snippet(mPlaceDetail.getAddressBrief());
markerOption.icon(BitmapDescriptorFactory
.fromResource(mPlaceDetail.getCostType() == 0 ? R.drawable.location_point_green : R.drawable.location_point_red));
mPlaceLocation = mAMap.addMarker(markerOption);
}
示例7: onMapClick
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void onMapClick(LatLng latLng) {
if (mLastMarker != null) mLastMarker.destroy();
mPoint = latLng;
MarkerOptions markerOption = new MarkerOptions();
markerOption.position(latLng);
markerOption.icon(BitmapDescriptorFactory
.fromResource(R.drawable.location_point_bigger_red));
mLastMarker = aMap.addMarker(markerOption);
mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(latLng.latitude,latLng.longitude), 50,GeocodeSearch.AMAP));
}
示例8: addMarker
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
public void addMarker(PlaceBrief place) {
MarkerOptions markerOption = new MarkerOptions();
markerOption.position(new LatLng(place.getLat(), place.getLng()));
markerOption.title(place.getName()).snippet(place.getAddressBrief());
markerOption.icon(BitmapDescriptorFactory
.fromResource(place.getCostType() == 0 ? R.drawable.location_point_green : R.drawable.location_point_red));
Marker marker = aMap.addMarker(markerOption);
marker.setToTop();
mMarkerMap.put(marker, place);
if (mMarkerMap.size() < MIN_ZOOM_MARKER_COUNT+1) zoomMarkerList.add(place);
if (mMarkerMap.size()== MIN_ZOOM_MARKER_COUNT+1) moveToAdjustPlace(zoomMarkerList);
}
示例9: addMarker
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void addMarker(LatLng lt, String des) {
// TODO Auto-generated method stub
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.title(des);
// 设置Marker的坐标,为我们点击地图的经纬度坐标
markerOptions.position(lt);
// 设置Marker的可见性
markerOptions.visible(true);
// 设置Marker是否可以被拖拽,这里先设置为false,之后会演示Marker的拖拽功能
markerOptions.draggable(false);
// 将Marker添加到地图上去
aMap.addMarker(markerOptions);
}
示例10: addMarker
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private Marker addMarker(AMap map, MarkerOptionsChooser moc, ClusterPoint clusterPoint) {
MarkerOptions mo = new MarkerOptions();
mo.position(clusterPoint.getMapPosition());
if (moc != null) {
moc.choose(mo, clusterPoint);
}
return map.addMarker(mo);
}
示例11: initRoadData
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void initRoadData() {
// 116.504505 39.931057
double centerLatitude = 39.916049;
double centerLontitude = 116.399792;
/*
ArrayList<Points> points = new ArrayList<>();
double a_x = 39.916049;
double a_y = 116.399792;
double b_x = 35.616049;
double b_y = 120.339792;*/
//我想写个循环求的这两个点之间的很多点
PolylineOptions polylineOptions = new PolylineOptions();
/*double deltaAngle = Math.PI / 180 * 5;
double radius = 0.02;
PolylineOptions polylineOptions = new PolylineOptions();
for (double i = 0; i < Math.PI * 2; i = i + deltaAngle) {
float latitude = (float) (-Math.cos(i) * radius + centerLatitude);
float longtitude = (float) (Math.sin(i) * radius + centerLontitude);
polylineOptions.add(new LatLng(latitude, longtitude));
if (i > Math.PI) {
deltaAngle = Math.PI / 180 * 30;
}
Log.e("TAG_POINT", "latitude-->" + latitude + "-----longtitude--》" + longtitude);
}
float latitude = (float) (-Math.cos(0) * radius + centerLatitude);
float longtitude = (float) (Math.sin(0) * radius + centerLontitude);
*/
polylineOptions.add(new LatLng(centerLatitude, centerLontitude));
polylineOptions.add(new LatLng(39.528049, 117.589038));
distance = GetDistance(new LatLng(centerLatitude, centerLontitude),new LatLng(39.528049, 117.589038));
// TIME_INTERVAL = (int)(10/distance) * 10;
// polylineOptions.add(new LatLng(39.92515, 116.510997));
// polylineOptions.add(new LatLng(39.892198, 116.439449));
// polylineOptions.add(new LatLng(39.919324, 116.379367));
// polylineOptions.add(new LatLng(39.951704, 116.356708));
// //
// //
//
// //
// polylineOptions.add(new LatLng(39.970914, 116.408206));
//
// polylineOptions.add(new LatLng(40.005899, 116.467601));
// polylineOptions.add(new LatLng(39.954368, 116.478038));
// polylineOptions.add(new LatLng(40.009368, 116.678038));
polylineOptions.width(10);
polylineOptions.color(Color.RED);
mVirtureRoad = mAmap.addPolyline(polylineOptions);
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.setFlat(true);
markerOptions.anchor(0.5f, 0.5f);
markerOptions.icon(BitmapDescriptorFactory
.fromResource(R.drawable.marker));
markerOptions.position(polylineOptions.getPoints().get(0));
mMoveMarker = mAmap.addMarker(markerOptions);
mMoveMarker.setRotateAngle((float) getAngle(0));
}
示例12: addMarkersToMap
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
private void addMarkersToMap(LatLng latLng) {
MarkerOptions markerOption2 = new MarkerOptions();
markerOption2.position(latlng2);
markerOption2.title("温州市").snippet("温州市:28.0052, 120.6976");
markerOption2.perspective(true);
markerOption2.draggable(true);
markerOption2.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
MarkerOptions markerOption3 = new MarkerOptions();
markerOption3.position(latlng3);
markerOption3.title("温州市").snippet("温州市:28.0062, 120.6996");
markerOption3.perspective(true);
markerOption3.draggable(true);
markerOption3.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
MarkerOptions markerOption4 = new MarkerOptions();
markerOption4.position(latlng4);
markerOption4.title("温州市").snippet("温州市:28.0072, 120.6986");
markerOption4.perspective(true);
markerOption4.draggable(true);
markerOption4.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
ArrayList<BitmapDescriptor> giflist = new ArrayList<BitmapDescriptor>();
giflist.add(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
giflist.add(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_RED));
giflist.add(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW));
MarkerOptions markerOption1 = new MarkerOptions().anchor(0.5f, 0.5f)
.position(latLng).title("温州市")
.snippet("温州市:"+latLng.latitude+","+latLng.longitude)
.perspective(true).draggable(true).period(50).icons(giflist);
ArrayList<MarkerOptions> markerOptionlst = new ArrayList<MarkerOptions>();
markerOptionlst.add(markerOption1);
markerOptionlst.add(markerOption2);
markerOptionlst.add(markerOption3);
markerOptionlst.add(markerOption4);
List<Marker> markerlst = aMap.addMarkers(markerOptionlst, true);
marker2 = markerlst.get(0);
}