本文整理汇总了Java中com.amap.api.maps2d.model.MarkerOptions类的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions类的具体用法?Java MarkerOptions怎么用?Java MarkerOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MarkerOptions类属于com.amap.api.maps2d.model包,在下文中一共展示了MarkerOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateDroneLocation
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private void updateDroneLocation(){
LatLng pos = new LatLng(droneLocationLat, droneLocationLng);
//Create MarkerOptions object
final MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(pos);
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.aircraft));
runOnUiThread(new Runnable() {
@Override
public void run() {
if (droneMarker != null) {
droneMarker.remove();
}
if (checkGpsCoordination(droneLocationLat, droneLocationLng)) {
droneMarker = aMap.addMarker(markerOptions);
}
}
});
}
示例2: getMarkerOptions
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private MarkerOptions getMarkerOptions(AMapLocation amapLocation) {
//设置图钉选项
MarkerOptions options = new MarkerOptions();
//图标
options.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_location_on_black_48dp));
//位置
options.position(new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude()));
StringBuffer buffer = new StringBuffer();
buffer.append(amapLocation.getCountry() + "" + amapLocation.getProvince() + "" +
amapLocation.getCity() + "" + amapLocation.getDistrict() + "" +
amapLocation.getStreet() + "" + amapLocation.getStreetNum());
//标题
options.title(buffer.toString());
//子标题
// options.snippet("I'am Here!");
//设置多少帧刷新一次图片资源
options.period(60);
return options;
}
示例3: addMarker
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private void addMarker(LatLng latLng, String url) {
AsyncImageView imageView = (AsyncImageView) LayoutInflater.from(this).inflate(R.layout.map_marker_view, null);
// AsyncImageView imageView = (AsyncImageView) view.findViewById(R.id.icon);
imageView.setResource(new Resource(url));
// aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
// .position(new LatLng(30.679879, 104.064855)).title("成都市")
// .snippet("成都市:30.679879, 104.064855").draggable(true));
MarkerOptions markerOption = new MarkerOptions();
markerOption.position(new LatLng(34.341568, 108.940174));
// markerOption.title("西安市").snippet("西安市:34.341568, 108.940174");
// markerOption.draggable(true);
// markerOption.icon(BitmapDescriptorFactory.fromResource(R.drawable.rc_default_portrait));
markerOption.icon(BitmapDescriptorFactory.fromView(imageView));
// markerOption.icon(BitmapDescriptorFactory
// .defaultMarker(BitmapDescriptorFactory.HUE_RED));
Marker marker2 = aMap.addMarker(markerOption);
// marker旋转90度
// marker2.setRotateAngle(90);
}
示例4: setMark
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
/**
* 在地图上设置标记图标
*
* @param type 图标的样式
*/
private void setMark(int type, Post post) {
if (type == OTHER_MARK) {
myMarkOption = new MarkerOptions();
//添加用户覆盖物
LatLng postCurrentLatLng = new LatLng(post.getLatitude(), post.getLongitude());
myMarkOption.anchor(0.5f, 0.5f).
position(postCurrentLatLng).title(post.getUsername()).snippet(post.getTag() + "@@" + post.getAddress() + "@@" + post.getTime()).
draggable(false).icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_ic));
myMark = aMap.addMarker(myMarkOption);
} else {
//暂时还没有设计用户定位图标
}
}
示例5: initMapView
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private void initMapView() {
if (aMap == null) {
aMap = mapView.getMap();
aMap.setOnMapClickListener(this);// add the listener for click for amap object
}
LatLng shenzhen = new LatLng(22.5362, 113.9454);
aMap.addMarker(new MarkerOptions().position(shenzhen).title("Marker in Shenzhen"));
aMap.moveCamera(CameraUpdateFactory.newLatLng(shenzhen));
}
示例6: markWaypoint
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private void markWaypoint(LatLng point){
//Create MarkerOptions object
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(point);
markerOptions.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE));
Marker marker = aMap.addMarker(markerOptions);
mMarkers.put(mMarkers.size(), marker);
}
示例7: addMarkersToMap
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
/**
* 在地图上添加marker
*/
private void addMarkersToMap() {
List<Post> posts = mockPosts();
for(Post post:posts){
MarkerOptions markerOption = new MarkerOptions().icon(BitmapDescriptorFactory
.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
.position(post.getPosition())
.draggable(true);
aMap.addMarker(markerOption).setObject(post);
}
}
示例8: addMarker
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private void addMarker(LatLng latlng) {
if (mLocMarker != null) {
return;
}
MarkerOptions options = new MarkerOptions();
options.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(this.getResources(),
R.mipmap.navi_map_gps_locked)));
options.anchor(0.5f, 0.5f);
options.position(latlng);
mLocMarker = mAMap.addMarker(options);
mLocMarker.setTitle(LOCATION_MARKER_FLAG);
}
示例9: setLocation
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private void setLocation(double latitude,double longitude){
if(aMap == null){
return;
}
aMap.moveCamera(CameraUpdateFactory.changeLatLng(new LatLng(
latitude, longitude)));
MarkerOptions markerOption = new MarkerOptions();
markerOption.position(new LatLng(latitude,
longitude));
markerOption.draggable(true);
Marker marker = aMap.addMarker(markerOption);
marker.setObject("11");//这里可以存储用户数据
}
示例10: addMarkerAtPointWithType
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
@Override
public Marker addMarkerAtPointWithType(LatLng point, MarkerType markerType) {
BitmapDescriptor bitmap = BitmapDescriptorFactory
.fromResource(markerType == MarkerType.UserPoint ? R.drawable.box_black : R.drawable.box_grey);
MarkerOptions options = new MarkerOptions().position(point).icon(bitmap).zIndex(1000).draggable(true).anchor(0.5f, 0.5f);
return mAMap.addMarker(options);
}
示例11: onMapClick
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
@Override
public void onMapClick(LatLng latLng) {
//main_content.setText(latLng.longitude+"\n"+latLng.latitude);
latLngNow=latLng;
if(marker != null){
marker.remove();
}
marker=mAMap.addMarker(new MarkerOptions().position(latLng));
requestWeather(latLng);
}
示例12: lookAt
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
public void lookAt(double latitude, double longitude, String title, String snippet) {
LatLng latLng = new LatLng(latitude, longitude);
AMap map = this.getMap();
map.clear();
MarkerOptions markerOptions = new MarkerOptions().position(latLng).title(title).snippet(snippet)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));
Marker marker = map.addMarker(markerOptions);
if (title != null) {
marker.showInfoWindow();
}
map.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(latLng, 15, 0, 0)));
}
示例13: mark
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
public void mark(double lat, double lng, String title) {
findViewById(R.id.mark_tv).setVisibility(View.VISIBLE);
((TextView) findViewById(R.id.mark_tv)).setText(title);
aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
.position(new LatLng(lat, lng
)).snippet(title));
}
示例14: addMarkersToMap
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
/**
* 在地图上添加marker
*/
private void addMarkersToMap() {
markerOption = new MarkerOptions();
markerOption.position(Constants.BEIJING_TUSHUGUAN);
markerOption.title("北京朝阳区东三环南路88号").snippet("电话:010-67358114");
markerOption.draggable(true);
// markerOption.icon(BitmapDescriptorFactory
// .fromResource(R.drawable.ico_notice_location));//自定义定位图片
marker2 = aMap.addMarker(markerOption);
}
示例15: defaultMarkerOptions
import com.amap.api.maps2d.model.MarkerOptions; //导入依赖的package包/类
private MarkerOptions defaultMarkerOptions() {
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.anchor(0.5f, 0.5f);
markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.pin));
return markerOptions;
}