当前位置: 首页>>代码示例>>Java>>正文


Java MarkerOptions类代码示例

本文整理汇总了Java中com.amap.api.maps.model.MarkerOptions的典型用法代码示例。如果您正苦于以下问题:Java MarkerOptions类的具体用法?Java MarkerOptions怎么用?Java MarkerOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MarkerOptions类属于com.amap.api.maps.model包,在下文中一共展示了MarkerOptions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initMap

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
/**
 * 地图实例化
 */
private void initMap() {
    if (amap == null) {
        amap = mMapView.getMap();
        amap.setLocationSource(this);//设置了定位的监听,这里要实现LocationSource接口
        amap.getUiSettings().setMyLocationButtonEnabled(true); // 是否显示定位按钮
        amap.setMyLocationEnabled(true);//显示定位层并且可以触发定位,默认是flase
        amap.moveCamera(CameraUpdateFactory.zoomTo(15));//设置地图缩放级别
        MyLocationStyle myLocationStyle = new MyLocationStyle();//初始化定位蓝点样式类
        myLocationStyle.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATE);//连续定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动。(1秒1次定位)如果不设置myLocationType,默认也会执行此种模式。
        myLocationStyle.strokeColor(Color.TRANSPARENT);//设置定位蓝点精度圆圈的边框颜色
        myLocationStyle.radiusFillColor(Color.TRANSPARENT);//设置定位蓝点精度圆圈的填充颜色
        amap.setMyLocationStyle(myLocationStyle);//设置定位蓝点的Style
        lvHolder = new ListViewHoldier();
        //天添加屏幕移动的监听
        amap.setOnCameraChangeListener(this);
        // 初始化Marker添加到地图
        mEndMarker = amap.addMarker(new MarkerOptions().icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory.decodeResource(getResources(), R.mipmap.end))));
        //初始化 geocoderSearch
        geocoderSearch = new GeocodeSearch(this);
        //注册 逆地理编码异步处理回调接口
        geocoderSearch.setOnGeocodeSearchListener(this);

    }
}
 
开发者ID:Vicent9920,项目名称:MyMap,代码行数:28,代码来源:PiclocationActivity.java

示例2: AmapManager

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
public AmapManager(Context conext, MapView mapView) {
    this.mContext = conext;
    dbManager = new MapDatebaseManager(conext);
    if (aMap == null) {
        aMap = mapView.getMap();
    }
    //设置线段属性
    polylineOptions = new PolylineOptions().width(10).color(lineColor);
    //设置锚点属性锚点
    markerOptions = new MarkerOptions();
    // 绑定 Marker 被点击事件
    aMap.setOnMarkerClickListener(markerClickListener);
    //绑定信息窗点击事件
    aMap.setOnInfoWindowClickListener(infoWindowClicklistener);

}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:17,代码来源:AmapManager.java

示例3: onPoiSearched

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
@Override
public void onPoiSearched(PoiResult poiResult, int i) {
    //Toast.makeText(MainActivity.this,"+"+poiResult.getPois().toString()+poiResult.getPageCount(), Toast.LENGTH_SHORT).show();
    if(poiResult.getPageCount()!=0){
        isGetPOI =true;
        if(marker==null){
            marker= aMap.addMarker(new MarkerOptions().position(POILatlng).title(poiResult.getPois().toString().substring(1,poiResult.getPois().toString().length()-1)));
        }

        if( marker.getPosition()!=POILatlng) {
            marker.remove();
            marker= aMap.addMarker(new MarkerOptions().position(POILatlng).title(poiResult.getPois().toString().substring(1,poiResult.getPois().toString().length()-1)));
        }
    }else {
        isGetPOI =false;
    }
    if(!isGetPOI){
        if(top_view.getVisibility() == View.VISIBLE) top_view.setVisibility(View.INVISIBLE); else top_view.setVisibility(View.VISIBLE);
    }else {
        top_view.setVisibility(View.VISIBLE);
    }
}
 
开发者ID:BoldFei,项目名称:Zmap_test,代码行数:23,代码来源:MainActivity.java

示例4: onActivityResult

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    switch (requestCode){
        case 1:
            if(resultCode == RESULT_OK){
                SearchResultItem item = data.getParcelableExtra("poiData");
                if(!item.getItemDetail().equals("NONE")){
                    //TODO zoom map and add mark
                    aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(item.getItemLatLng(), 17f));
                    aMap.addMarker(new MarkerOptions().position(item.getItemLatLng()));
                }
            }
            break;
        default:
            break;
    }
}
 
开发者ID:BoldFei,项目名称:Zmap_test,代码行数:18,代码来源:MainActivity.java

示例5: onCreateView

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_map, container, false);
    initview(savedInstanceState,view);

    //beta版测试数据
    LatLng latLng = new LatLng(39.906901,116.397972);
    final Marker marker = aMap.addMarker(new MarkerOptions().position(latLng).title("苹果痂").snippet("苹果黑星菌"));
    LatLng latLng0 = new LatLng(30.87394024,121.33850098);
    final Marker marker0 = aMap.addMarker(new MarkerOptions().position(latLng0).title("樱桃白粉病").snippet("叉丝单囊壳菌"));
    LatLng latLng1 = new LatLng(22.79643932,113.34594727);
    final Marker marker1 = aMap.addMarker(new MarkerOptions().position(latLng1).title("玉米灰斑病").snippet("尖孢科孢子虫"));
    LatLng latLng2 = new LatLng(22.54300097,114.12322998);
    final Marker marker2 = aMap.addMarker(new MarkerOptions().position(latLng2).title("葡萄黑腐病").snippet("葡萄球座菌"));
    LatLng latLng3 = new LatLng(30.35391637,104.38110352);
    final Marker marker3 = aMap.addMarker(new MarkerOptions().position(latLng3).title("甜椒菌斑").snippet("野油菜黃單孢菌"));
    LatLng latLng4 = new LatLng(25.35391637,109.38110352);
    final Marker marker4 = aMap.addMarker(new MarkerOptions().position(latLng4).title("甜椒菌斑").snippet("野油菜黃單孢菌"));
    return view;
}
 
开发者ID:lupwei,项目名称:Croprotector,代码行数:22,代码来源:Map_fragment.java

示例6: addRailwayMarkers

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
private void addRailwayMarkers(RouteRailwayItem railway) {
    LatLng Departureposition = AMapUtil.convertToLatLng(railway
            .getDeparturestop().getLocation());
    String Departuretitle = railway.getDeparturestop().getName()+"上车";
    String Departuresnippet = railway.getName();

    addStationMarker(new MarkerOptions().position(Departureposition).title(Departuretitle)
            .snippet(Departuresnippet).anchor(0.5f, 0.5f).visible(nodeIconVisible)
            .icon(getBusBitmapDescriptor()));


    LatLng Arrivalposition = AMapUtil.convertToLatLng(railway
            .getArrivalstop().getLocation());
    String Arrivaltitle = railway.getArrivalstop().getName()+"下车";
    String Arrivalsnippet = railway.getName();

    addStationMarker(new MarkerOptions().position(Arrivalposition).title(Arrivaltitle)
            .snippet(Arrivalsnippet).anchor(0.5f, 0.5f).visible(nodeIconVisible)
            .icon(getBusBitmapDescriptor()));
}
 
开发者ID:yimiaoxiehou,项目名称:ZhuHaiBusApplication,代码行数:21,代码来源:BusRouteOverlay.java

示例7: onCreate

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_geofence_new);
	setTitle(R.string.roundGeoFence);
	// 初始化地理围栏
	fenceClient = new GeoFenceClient(getApplicationContext());

	lyOption = findViewById(R.id.ly_option);
	btAddFence = (Button) findViewById(R.id.bt_addFence);
	btOption = (Button) findViewById(R.id.bt_option);
	tvGuide = (TextView) findViewById(R.id.tv_guide);
	tvResult = (TextView) findViewById(R.id.tv_result);
	tvResult.setVisibility(View.GONE);
	etCustomId = (EditText) findViewById(R.id.et_customId);
	etRadius = (EditText) findViewById(R.id.et_radius);

	cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
	cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
	cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);

	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	markerOption = new MarkerOptions().draggable(true);
	init();
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:26,代码来源:GeoFence_Round_Activity.java

示例8: onCreate

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_geofence_new);
	setTitle(R.string.polygonGeoFence);
	// 初始化地理围栏
	fenceClient = new GeoFenceClient(getApplicationContext());

	btAddFence = (Button) findViewById(R.id.bt_addFence);
	tvGuide = (TextView) findViewById(R.id.tv_guide);
	tvResult = (TextView) findViewById(R.id.tv_result);
	tvResult.setVisibility(View.GONE);
	etCustomId = (EditText) findViewById(R.id.et_customId);

	cbAlertIn = (CheckBox) findViewById(R.id.cb_alertIn);
	cbAlertOut = (CheckBox) findViewById(R.id.cb_alertOut);
	cbAldertStated = (CheckBox) findViewById(R.id.cb_alertStated);

	mMapView = (MapView) findViewById(R.id.map);
	mMapView.onCreate(savedInstanceState);
	bitmap = BitmapDescriptorFactory
			.defaultMarker(BitmapDescriptorFactory.HUE_YELLOW);
	markerOption = new MarkerOptions().icon(bitmap).draggable(true);
	init();
}
 
开发者ID:amapapi,项目名称:Android_Location_Demo,代码行数:25,代码来源:GeoFence_Polygon_Activity.java

示例9: addMarkerInBeijing

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
private void addMarkerInBeijing(int number) {
    Random random = new Random();

    //new LatLng(39.90403, 116.407525)
    double tem_lat = 39.9;
    double tem_lon = 116.4;
    BitmapDescriptor descriptor = BitmapDescriptorFactory.defaultMarker();
    if (number == 1) {
        aMap.addMarker(new MarkerOptions().position(new LatLng(tem_lat, tem_lon)).icon
                (descriptor));
        return;
    }

    for (int i = 0; i < number; i++) {
        LatLng latLng = new LatLng(tem_lat + random.nextDouble() * (random.nextBoolean() ? 1
                : -1), tem_lon + random.nextDouble() * (random.nextBoolean() ? 1 : -1));
        aMap.addMarker(new MarkerOptions().position(latLng).icon(descriptor));
    }

}
 
开发者ID:facexxyz,项目名称:SmoothMove,代码行数:21,代码来源:MainActivity.java

示例10: init

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
/**
 * 初始化AMap对象
 */
private void init() {
	if (aMap == null) {
		aMap = ((SupportMapFragment) getSupportFragmentManager()
				.findFragmentById(R.id.map)).getMap();
		setUpMap();
		setSelectType();
		Button locationButton = (Button) findViewById(R.id.locationButton);
		locationButton.setOnClickListener(this);
		Button searchButton = (Button) findViewById(R.id.searchButton);
		searchButton.setOnClickListener(this);
		nextButton = (Button) findViewById(R.id.nextButton);
		nextButton.setOnClickListener(this);
		nextButton.setClickable(false);// 默认下一页按钮不可点
		locationMarker = aMap.addMarker(new MarkerOptions()
				.anchor(0.5f, 1)
				.icon(BitmapDescriptorFactory
						.fromResource(R.drawable.point))
				.position(new LatLng(lp.getLatitude(), lp.getLongitude()))
				.title("西单为中心点,查其周边"));
		locationMarker.showInfoWindow();

	}
}
 
开发者ID:Tsroad,项目名称:Road,代码行数:27,代码来源:PoiAroundSearchActivity.java

示例11: init

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
/**
 * 初始化AMap对象
 */
private void init() {
	if (aMap == null) {
		aMap = mapView.getMap();
		geoMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
		regeoMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
	}
	Button geoButton = (Button) findViewById(R.id.geoButton);
	geoButton.setOnClickListener(this);
	Button regeoButton = (Button) findViewById(R.id.regeoButton);
	regeoButton.setOnClickListener(this);
	geocoderSearch = new GeocodeSearch(this);
	geocoderSearch.setOnGeocodeSearchListener(this);
	progDialog = new ProgressDialog(this);
}
 
开发者ID:Tsroad,项目名称:Road,代码行数:22,代码来源:GeocoderActivity.java

示例12: SetUpMap2

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
private void SetUpMap2()
    {

        ArrayList<BitmapDescriptor> giflist = new ArrayList<BitmapDescriptor>();
        giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point1));
        giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point2));
        giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point3));
        giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point4));
        giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point5));

        //    giflist.add(BitmapDescriptorFactory.fromResource(R.drawable.point6));
        marker = mapView.getMap().addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
                .icons(giflist).period(50));
        // 自定义系统定位小蓝点
        MyLocationStyle myLocationStyle = new MyLocationStyle();
//        myLocationStyle.myLocationIcon(BitmapDescriptorFactory
//                .fromResource(R.drawable.location_marker));// 设置小蓝点的图标
        myLocationStyle.strokeColor(Color.BLACK);// 设置圆形的边框颜色
        myLocationStyle.radiusFillColor(Color.argb(100, 0, 0, 180));// 设置圆形的填充颜色
        // myLocationStyle.anchor(int,int)//设置小蓝点的锚点
        myLocationStyle.strokeWidth(0.1f);// 设置圆形的边框粗细
        aMap.setMyLocationStyle(myLocationStyle);
//        aMap.setMyLocationRotateAngle(180);
        aMap.getUiSettings().setCompassEnabled(true);// 设置默认定位按钮是否显示
    }
 
开发者ID:Tsroad,项目名称:Road,代码行数:26,代码来源:SetFenceActivity.java

示例13: init

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
/**
 * 定位初始化
 */
private void init() {
    if (aMap == null) {
        aMap = mapView.getMap();
        aMap.setOnMapClickListener(this);
        //设置3D地图中心位置
        aMap.moveCamera(CameraUpdateFactory
                .newCameraPosition(new CameraPosition(new LatLng(39.9875,
                        116.48047), 16f, 38.5f, 30000)));
        //设置地理反解析标识
        regeoMarker = aMap.addMarker(new MarkerOptions().anchor(0.5f, 0.5f)
                .icon(BitmapDescriptorFactory
                        .defaultMarker(BitmapDescriptorFactory.HUE_MAGENTA)));
        geocoderSearch = new GeocodeSearch(this);
        geocoderSearch.setOnGeocodeSearchListener(this);
        setUpMap();

    }
    Toast.makeText(MainActivity.this, "请打开GPS", Toast.LENGTH_LONG).show();


}
 
开发者ID:Tsroad,项目名称:Road,代码行数:25,代码来源:MainActivity.java

示例14: onMapClick

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
@Override
public void onMapClick(LatLng latng) {
	if (isClickStart) {
		startMk = aMap.addMarker(new MarkerOptions()
				.anchor(0.5f, 1)
				.icon(BitmapDescriptorFactory
						.fromResource(R.drawable.point)).position(latng)
				.title("点击选择为起点"));
		startMk.showInfoWindow();
	} else if (isClickTarget) {
		targetMk = aMap.addMarker(new MarkerOptions()
				.anchor(0.5f, 1)
				.icon(BitmapDescriptorFactory
						.fromResource(R.drawable.point)).position(latng)
				.title("点击选择为目的地"));
		targetMk.showInfoWindow();
	}
}
 
开发者ID:Tsroad,项目名称:Road,代码行数:19,代码来源:RouteActivity.java

示例15: addOriginTrace

import com.amap.api.maps.model.MarkerOptions; //导入依赖的package包/类
/**
 * 地图上添加原始轨迹线路及起终点、轨迹动画小人
 * 
 * @param startPoint
 * @param endPoint
 * @param originList
 */
private void addOriginTrace(LatLng startPoint, LatLng endPoint,
		List<LatLng> originList) {
	mOriginPolyline = mAMap.addPolyline(new PolylineOptions().color(
			Color.BLUE).addAll(originList));
	mOriginStartMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromResource(R.drawable.start)));
	mOriginEndMarker = mAMap.addMarker(new MarkerOptions().position(
			endPoint).icon(
			BitmapDescriptorFactory.fromResource(R.drawable.end)));

	try {
		mAMap.moveCamera(CameraUpdateFactory.newLatLngBounds(getBounds(),
				50));
	} catch (Exception e) {
		e.printStackTrace();
	}

	mOriginRoleMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromBitmap(BitmapFactory
					.decodeResource(getResources(), R.drawable.walk))));
}
 
开发者ID:amapapi,项目名称:RecordPath3D,代码行数:31,代码来源:RecordShowActivity.java


注:本文中的com.amap.api.maps.model.MarkerOptions类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。