本文整理汇总了Java中com.amap.api.maps.model.MarkerOptions.anchor方法的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions.anchor方法的具体用法?Java MarkerOptions.anchor怎么用?Java MarkerOptions.anchor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amap.api.maps.model.MarkerOptions
的用法示例。
在下文中一共展示了MarkerOptions.anchor方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: choose
import com.amap.api.maps.model.MarkerOptions; //导入方法依赖的package包/类
@Override
public void choose(MarkerOptions markerOptions, ClusterPoint clusterPoint) {
Context context = contextRef.get();
if (context != null) {
Resources res = context.getResources();
boolean isCluster = clusterPoint.size() > 1;
boolean hasTwoToasters = clusterPoint.containsInputPoint(twoToasters);
BitmapDescriptor icon;
String title;
if (isCluster) {
title = res.getQuantityString(R.plurals.count_points, clusterPoint.size(), clusterPoint.size());
int clusterSize = clusterPoint.size();
if (hasTwoToasters) {
icon = BitmapDescriptorFactory.fromBitmap(getClusterBitmap(res, R.drawable.ic_map_pin_cluster_toaster, clusterSize));
title = res.getString(R.string.including_two_toasters, title);
} else {
icon = BitmapDescriptorFactory.fromBitmap(getClusterBitmap(res, R.drawable.ic_map_pin_cluster, clusterSize));
title = res.getQuantityString(R.plurals.count_points, clusterSize, clusterSize);
}
} else {
MarkerData data = (MarkerData)clusterPoint.getPointAtOffset(0).getTag();
if (hasTwoToasters) {
icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_pin_toaster);
title = data.getLabel();
} else {
icon = BitmapDescriptorFactory.fromResource(R.drawable.ic_map_pin);
title = res.getString(R.string.point_number_x, data.getLabel());
}
}
markerOptions.icon(icon);
markerOptions.title(title);
markerOptions.anchor(0.5f, 1.0f);
}
}
示例4: 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));
}