當前位置: 首頁>>代碼示例>>Java>>正文


Java MarkerOptions類代碼示例

本文整理匯總了Java中com.baidu.mapapi.map.MarkerOptions的典型用法代碼示例。如果您正苦於以下問題:Java MarkerOptions類的具體用法?Java MarkerOptions怎麽用?Java MarkerOptions使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MarkerOptions類屬於com.baidu.mapapi.map包,在下文中一共展示了MarkerOptions類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: locationReceiveAddress

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
/**
 * 定位接收到的地址
 **/
private void locationReceiveAddress() {
    if (receiveAddress == null) {
        return;
    }
    LatLng p = new LatLng(receiveAddress.getLatitude(), receiveAddress.getLongitude());
    MarkerOptions markerOptions = new MarkerOptions();
    /* 設置覆蓋物圖標 */
    markerOptions.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_openmap_focuse_mark))
            .position(p)
            .visible(true);
    baiduMap.setOnMarkerClickListener(new BaiduMap.OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(Marker marker) {
            setSinglePoiDetail();
            return true;
        }
    });
    if (NetUtil.getInstance(SetFavoriteMapActivity.this).getCurrentNetType().equals(NetUtil.NetType.NETWORK_TYPE_NONE)) {
        // Snackbar.make(mAmosfPoiList,mAppConfig.getResources().getString(R.string.no_network), Snackbar.LENGTH_SHORT).show();
        return;
    }
    /* 添加覆蓋圖層 */
    baiduMap.addOverlay(markerOptions);
    baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLngZoom(p, 17F));
}
 
開發者ID:LingjuAI,項目名稱:AssistantBySDK,代碼行數:29,代碼來源:SetFavoriteMapActivity.java

示例2: getOverlayOptions

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mIndoorPoiResult == null || mIndoorPoiResult.getmArrayPoiInfo() == null) {
        return null;
    }
    List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
    int markerSize = 0;
    for (int i = 0; i < mIndoorPoiResult.getmArrayPoiInfo().size()
            && markerSize < MAX_POI_SIZE; i++) {
        if (mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng == null) {
            continue;
        }
        markerSize++;
        Bundle bundle = new Bundle();
        bundle.putInt("index", i);
        markerList.add(new MarkerOptions()
                .icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
                        + markerSize + ".png")).extraInfo(bundle)
                .position(mIndoorPoiResult.getmArrayPoiInfo().get(i).latLng));

    }
    return markerList;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:IndoorPoiOverlay.java

示例3: getOverlayOptions

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
@Override
public final List<OverlayOptions> getOverlayOptions() {
    if (mPoiResult == null || mPoiResult.getAllPoi() == null) {
        return null;
    }
    List<OverlayOptions> markerList = new ArrayList<OverlayOptions>();
    int markerSize = 0;
    for (int i = 0; i < mPoiResult.getAllPoi().size()
            && markerSize < MAX_POI_SIZE; i++) {
        if (mPoiResult.getAllPoi().get(i).location == null) {
            continue;
        }
        markerSize++;
        Bundle bundle = new Bundle();
        bundle.putInt("index", i);
        markerList.add(new MarkerOptions()
                .icon(BitmapDescriptorFactory.fromAssetWithDpi("Icon_mark"
                        + markerSize + ".png")).extraInfo(bundle)
                .position(mPoiResult.getAllPoi().get(i).location));
        
    }
    return markerList;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:24,代碼來源:PoiOverlay.java

示例4: addOverLayout

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
private void addOverLayout(double _latitude, double _longitude) {
    //先清除圖層
    mBaiduMap.clear();
    mlocationClient.requestLocation();
    // 定義Maker坐標點
    LatLng point = new LatLng(_latitude, _longitude);
    // 構建MarkerOption,用於在地圖上添加Marker
    MarkerOptions options = new MarkerOptions().position(point)
            .icon(dragLocationIcon);
    // 在地圖上添加Marker,並顯示
    mBaiduMap.addOverlay(options);
    infos.clear();
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_mobai, "001",
            "100米", "1分鍾"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_youbai, "002",
            "200米", "2分鍾"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_ofo, "003",
            "300米", "3分鍾"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_xiaolan, "004",
            "400米", "4分鍾"));
    BikeInfo bikeInfo = new BikeInfo(_latitude - 0.0005, _longitude - 0.0005, R.mipmap.bike_xiaolan, "005",
            "50米", "0.5分鍾");
    infos.add(bikeInfo);
    addInfosOverlay(infos);
    initNearestBike(bikeInfo, new LatLng(_latitude - 0.0005, _longitude - 0.0005));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:27,代碼來源:MainActivity.java

示例5: handleMessage

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
@Override
public void handleMessage(Message msg) {
    final SeeLocationActivity activity = activityWeakReference.get();
    switch (msg.what) {
        case 0:
            final String response = (String) msg.obj;

            Scanner scanner = new Scanner(response);
            double latitude = Double.parseDouble(scanner.next());
            double longitude = Double.parseDouble(scanner.next());
            LatLng point = new LatLng(latitude, longitude);
            if (activity.centP == null) {
                activity.centP = point;
                activity.baiduMap.setMapStatus(MapStatusUpdateFactory.newLatLng(activity.centP));
            }
            activity.initHeadBitmap();
            OverlayOptions options = new MarkerOptions().position(point).icon(activity.bitmapDescriptor);
            activity.baiduMap.clear();
            activity.baiduMap.addOverlay(options);
            break;
    }
}
 
開發者ID:838030195,項目名稱:DaiGo,代碼行數:23,代碼來源:SeeLocationActivity.java

示例6: initBaiduMap

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
/**
 * 初始化百度地圖
 */
private void initBaiduMap() {
    // 設置是否顯示縮放控件
    mMapView.showZoomControls(false);
    mBaiduMap = mMapView.getMap();
    // 設定地圖中心點坐標:寧波天翔貨櫃有限公司(雲台山路)
    LatLng point = new LatLng(29.882673, 121.894326);
    // 以動畫方式更新地圖狀態,動畫耗時默認 300 ms ,地圖支持的最大最小級別分別為[3-21]
    mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newLatLngZoom(point, 18));
    // 定義Maker坐標點:寧波天翔貨櫃有限公司(雲台山路)
    ArrayList<BitmapDescriptor> giflist = new ArrayList<>();
    giflist.add(BitmapDescriptorFactory.fromResource(R.mipmap.ic_marker));
    giflist.add(BitmapDescriptorFactory.fromResource(R.mipmap.ic_marker_light));
    // 通過marker的icons設置一組圖片,再通過period設置多少幀刷新一次圖片資源
    MarkerOptions mo = new MarkerOptions().position(point).icons(giflist).zIndex(0).period(20);
    // 設置生長動畫/掉下動畫
    // mo.animateType(MarkerOptions.MarkerAnimateType.drop);
    // 在地圖上添加Marker,並顯示
    mBaiduMap.addOverlay(mo);
}
 
開發者ID:jpaijh,項目名稱:TYT,代碼行數:23,代碼來源:CB_BaiduMapActivity.java

示例7: onCreate

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_routeplan);
        mTvtitle = (TextView) findViewById(R.id.tv_topbar_title);
        mTvtitle.setText("財神穀地址");
        ImageView img = (ImageView) findViewById(R.id.img_topbar_back);
        img.setImageResource(R.mipmap.icon_back);
        img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                RoutePlanDemo.this.finish();
            }
        });
//        mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//獲取傳感器管理服務
        // 初始化地圖
        mMapView = (MapView) findViewById(R.id.map);
        mBaidumap = mMapView.getMap();
        MapStatus.Builder builder = new MapStatus.Builder();
        builder.zoom(18.0f);
        builder.target(new LatLng(29.184662, 121.305024));
        mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build());
        mBaidumap.setMapStatus(mMapStatusUpdate);
        MarkerOptions ooA = new MarkerOptions().position(GEO_NINGBO).icon(bdA)
                .zIndex(9).draggable(true);
        mBaidumap.addOverlay(ooA);
        mBaidumap.setTrafficEnabled(true);
        findViewById(R.id.lin_action_route).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                go2ThirdMap();
            }
        });
    }
 
開發者ID:mangestudio,項目名稱:GCSApp,代碼行數:34,代碼來源:RoutePlanDemo.java

示例8: addOverLayout

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
private void addOverLayout(double _latitude, double _longitude) {
    //先清除圖層
    baiduMap.clear();
    mlocationClient.requestLocation();
    // 定義Maker坐標點
    LatLng point = new LatLng(_latitude, _longitude);
    // 構建MarkerOption,用於在地圖上添加Marker
    MarkerOptions options = new MarkerOptions().position(point)
            .icon(dragLocationIcon);
    // 在地圖上添加Marker,並顯示
    baiduMap.addOverlay(options);
    infos.clear();
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_mobai, "001",
            "100米", "1分鍾"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_youbai, "002",
            "200米", "2分鍾"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_ofo, "003",
            "300米", "3分鍾"));
    infos.add(new BikeInfo(_latitude - new Random().nextInt(5) * 0.0005, _longitude - new Random().nextInt(5) * 0.0005, R.mipmap.bike_xiaolan, "004",
            "400米", "4分鍾"));
    BikeInfo bikeInfo = new BikeInfo(_latitude - 0.0005, _longitude - 0.0005, R.mipmap.bike_xiaolan, "005",
            "50米", "0.5分鍾");
    infos.add(bikeInfo);
    addInfosOverlay(infos);
    initNearestBike(bikeInfo, new LatLng(_latitude - 0.0005, _longitude - 0.0005));
}
 
開發者ID:yiwent,項目名稱:Mobike,代碼行數:27,代碼來源:MainActivity.java

示例9: drawRealtimePoint

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
/**
 * 畫出實時線路點
 *
 * @param point
 */
private void drawRealtimePoint(LatLng point) {
    Log.i("TGA", "繪製成功");
    mBaiduMap.clear();
    MapStatus mapStatus = new MapStatus.Builder().target(point).zoom(18).build();
    msUpdate = MapStatusUpdateFactory.newMapStatus(mapStatus);
    realtimeBitmap = BitmapDescriptorFactory.fromResource(R.drawable.ct_map_location);
    overlay = new MarkerOptions().position(point)
            .icon(realtimeBitmap).zIndex(9).draggable(true);


    if (pointList.size() >= 2 && pointList.size() <= 6000) {
        polyline = new PolylineOptions().width(10).color(Color.GREEN).points(pointList);
    }

    addMarker();
}
 
開發者ID:InnoFang,項目名稱:ChangTu,代碼行數:22,代碼來源:TrackActivity.java

示例10: addMarker

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
private void addMarker() {
    if (stLatLng != null) {
        BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.ct_map_location_32);
        OverlayOptions option = new MarkerOptions().position(stLatLng).icon(bitmap);
        mBaiduMap.addOverlay(option);
    }

    if (msUpdate != null) {
        mBaiduMap.setMapStatus(msUpdate);
    }

    if (polyline != null) {
        mBaiduMap.addOverlay(polyline);
    }

    if (overlay != null) {
        mBaiduMap.addOverlay(overlay);
    }


}
 
開發者ID:InnoFang,項目名稱:ChangTu,代碼行數:22,代碼來源:TrackActivity.java

示例11: fromMarkerInfo

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
private MarkerOptions fromMarkerInfo(MarkerInfo markerInfo, boolean isDraggable) {
    final LatLong coord = markerInfo.getPosition();
    if (coord == null) {
        return null;
    }

    final MarkerOptions markerOptions = new MarkerOptions()
        .position(MapUtils.coordToBaiduLatLng(coord))
        .draggable(isDraggable)
        .alpha(markerInfo.getAlpha())
        .anchor(markerInfo.getAnchorU(), markerInfo.getAnchorV())
        .rotate(markerInfo.getRotation())
        .title(markerInfo.getTitle())
        .flat(markerInfo.isFlat())
        .visible(markerInfo.isVisible());

    final Bitmap markerIcon = markerInfo.getIcon(getResources());
    if (markerIcon != null) {
        markerOptions.icon(BitmapDescriptorFactory.fromBitmap(markerIcon));
    }

    return markerOptions;
}
 
開發者ID:mxiao6,項目名稱:Tower-develop,代碼行數:24,代碼來源:BaiduMapFragment.java

示例12: initMapView

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
/**
 * 初始化地圖
 */
private void initMapView() {
    //設定中心點坐標

    myLatLng = new LatLng(Const.LATITUDE_OF_MY_LOCATION,Const.LONGITUDE_OF_MY_LOCATION);
    //定義地圖狀態
    MapStatus mMapStatus = new MapStatus.Builder()
            .target(myLatLng)
            .zoom(18)
            .build();
    //定義MapStatusUpdate對象,以便描述地圖狀態將要發生的變化
    bd = BitmapDescriptorFactory
            .fromResource(R.drawable.icon_gcoding);
    MarkerOptions markerOptions = new MarkerOptions().position(myLatLng).icon(bd);
    mBaiduMap.addOverlay(markerOptions);
    MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
    //改變地圖狀態
    mBaiduMap.setMapStatus(mMapStatusUpdate);
}
 
開發者ID:CrazyRunning,項目名稱:MyStudyHelper,代碼行數:22,代碼來源:MapActivity.java

示例13: generateMarker

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
private void generateMarker(MarkerInfo markerInfo, LatLng position, boolean isDraggable) {

        Log.v("123","SSSSSSSSSSSSSSSSSSSSSSSSSSSSS");
        final MarkerOptions markerOptions = new MarkerOptions()
                .position(position)
                .draggable(isDraggable)
                .anchor(markerInfo.getAnchorU(), markerInfo.getAnchorV())
                .title(markerInfo.getSnippet()).title(markerInfo.getTitle());

        final Bitmap markerIcon = markerInfo.getIcon(getResources());
        if (markerIcon != null) {
            markerOptions.icon(BitmapDescriptorFactory.fromBitmap(markerIcon));
        }
        else
        {
            markerOptions.icon(BitmapDescriptorFactory
                    .fromResource(R.drawable.ic_marker_white));
        }

        Marker marker = (Marker)getBaiduMap().addOverlay(markerOptions);
        mBiMarkersMap.put(markerInfo, marker);
    }
 
開發者ID:jiaminghan,項目名稱:droidplanner-master,代碼行數:23,代碼來源:BaiduMapFragment.java

示例14: initMaker

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
private void initMaker() {

		for (FootInfo info : mFootList) {
			if (info.geo != null) {

				Double lat = Double.valueOf(info.geo.latitude);
				Double lon = Double.valueOf(info.geo.longitude);

				// 定義Maker坐標點
				LatLng point = new LatLng(lat,lon);
				// 構建Marker圖標
				BitmapDescriptor bitmap = BitmapDescriptorFactory
						.fromResource(R.drawable.icon_gcoding);
				// 構建MarkerOption,用於在地圖上添加Marker
				OverlayOptions option = new MarkerOptions().position(point)
						.icon(bitmap).zIndex(19);
				marker = (Marker)baiduMap.addOverlay(option);
				
			}
		}
		
		
		mMapView.invalidate();

	}
 
開發者ID:leerduo,項目名稱:travelinfo,代碼行數:26,代碼來源:FootMapActivity.java

示例15: setMarker

import com.baidu.mapapi.map.MarkerOptions; //導入依賴的package包/類
/**
 * 顯示地理標記
 *
 * @param mapView
 * @param array
 */
@ReactProp(name="marker")
public void setMarker(MapView mapView, ReadableArray array) {
    Log.d(TAG, "marker:" + array);
    if (array != null) {
        for (int i = 0; i < array.size(); i++) {
            ReadableArray sub = array.getArray(i);
            //定義Maker坐標點
            LatLng point = new LatLng(sub.getDouble(0), sub.getDouble(1));
            //構建Marker圖標
            BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding);
            //構建MarkerOption,用於在地圖上添加Marker
            OverlayOptions option = new MarkerOptions()
                    .position(point)
                    .icon(bitmap)
                    .draggable(true);
            //在地圖上添加Marker,並顯示
            mapView.getMap().addOverlay(option);
        }
    }
}
 
開發者ID:hufeng,項目名稱:BaiduMapKit,代碼行數:27,代碼來源:BaiduMapViewManager.java


注:本文中的com.baidu.mapapi.map.MarkerOptions類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。