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


Java Marker类代码示例

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


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

示例1: locationReceiveAddress

import com.baidu.mapapi.map.Marker; //导入依赖的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: zoomToSpan

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 * <p>
 * 注: 该方法只对Marker类型的overlay有效
 * </p>
 * 
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的点可能太多,只按marker 缩放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:OverlayManager.java

示例3: zoomToSpan

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 * <p>
 * 注: 该方法只对Marker类型的overlay有效
 * </p>
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的点可能太多,只按marker 缩放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:23,代码来源:OverlayManager.java

示例4: toggleInfoWindow

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
private void toggleInfoWindow(Marker marker) {
    if (marker == null || mapView == null || mapView.getMap() == null) return;
    if (isInfoWindowShown) {
        mapView.getMap().hideInfoWindow();
        isInfoWindowShown = false;
    } else {
        // sdk示例代码是用application context来创建infoWindow上的View的
        // 如果该view直接放在activity上,重复执行show/hide/show会出错
        View view = LayoutInflater.from(getApplicationContext())
                .inflate(R.layout.locatino_map_point, null);
        TextView textView = (TextView) view.findViewById(R.id.textView);
        textView.setText(marker.getTitle());
        int yOffset = (int) (0.5f + TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40, getResources().getDisplayMetrics()));
        mapView.getMap().showInfoWindow(new InfoWindow(
                BitmapDescriptorFactory.fromView(textView),
                new LatLng(latitude, longitude), -yOffset, null));
        isInfoWindowShown = true;
    }
}
 
开发者ID:huang303513,项目名称:Coding-Android,代码行数:20,代码来源:LocationMapActivity.java

示例5: initMarkerClickEvent

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
private void initMarkerClickEvent() {
         
          mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener()
          {
                  @Override
                  public boolean onMarkerClick(final Marker marker)
                  {
               
               LatLng markerLat = marker.getPosition();
               Point p = mBaiduMap.getProjection().toScreenLocation(markerLat);
       			//mMarkerInfoLy.setVisibility(View.VISIBLE);
               View location = getPopCameraView();
               p.y = -83;
               mInfoWindow = new InfoWindow(location, markerLat,p.y);
 mBaiduMap.showInfoWindow(mInfoWindow);
// Log.d("wang","setOnMarkerClickListener location.latitude is " + markerLat.latitude + " location.longitude is " + markerLat.longitude);
               judgeClickCamera(markerLat);
       			flag = true;
               return true;
                  }
          });
  }
 
开发者ID:liningwang,项目名称:camera,代码行数:23,代码来源:MainActivity.java

示例6: zoomToSpan

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
/**
 * ���ŵ�ͼ��ʹ����Overlay���ں��ʵ���Ұ��
 * <p>
 * ע�� �÷���ֻ��Marker���͵�overlay��Ч
 * </p>
 * 
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
        	 // polyline �еĵ����̫�ֻ࣬��marker ����
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:ContentCoderJian,项目名称:SmartTransXA,代码行数:24,代码来源:OverlayManager.java

示例7: onMarkerClick

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
@Override
public boolean onMarkerClick(Marker marker) {
    Log.d("lml", "MapFragment:覆盖物被点击");
    baiduMap.hideInfoWindow();
    if (marker != null) {
        latLngshow = marker.getPosition();
        reverseGeoCodeOption.location(latLngshow);
        geoCoder.reverseGeoCode(reverseGeoCodeOption);
        tvAddOverlayGeoCoder.setText("正在获取详细位置");
        bundle = marker.getExtraInfo();

        generalIsMale = bundle.getString("general").equals("m");
        layoutAddOverlayRadarNearbyItem.setBackgroundColor(getResources().getColor(generalIsMale ? R.color.blue : R.color.pink));
        imageViewAddOverlayItem.setImageResource(generalIsMale ? R.mipmap.map_portrait_man : R.mipmap.map_portrait_woman);
        tvAddOverlayItemUserID.setText(bundle.getString("userID"));
        tvAddOverlayItemDistance.setText("距离" + bundle.getInt("distance") + "米        ");
        tvAddOverlayItemLatlng.setText("坐标:   " + latLngshow.latitude + "  ,  " + latLngshow.longitude + "           ");
        Log.d("lml", "MapFragment显示的信息:" + bundle.getString("userID"));
        Log.d("lml", bundle.getString("general") + ";" + generalIsMale);
        baiduMap.showInfoWindow(new InfoWindow(viewOverlayItem, marker.getPosition(), -70));
        MapStatusUpdate update = MapStatusUpdateFactory.newLatLng(marker.getPosition());
        baiduMap.animateMapStatus(update);
        return true;
    } else
        return false;
}
 
开发者ID:bitkylin,项目名称:MapForTour,代码行数:27,代码来源:MapFragment.java

示例8: zoomToSpan

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
/**
 * 缩放地图,使所有Overlay都在合适的视野内
 * <p>
 * 注: 该方法只对Marker类型的overlay有效
 * </p>
 *
 */
public void zoomToSpan() {
    if (mBaiduMap == null) {
        return;
    }
    if (mOverlayList.size() > 0) {
        LatLngBounds.Builder builder = new LatLngBounds.Builder();
        for (Overlay overlay : mOverlayList) {
            // polyline 中的点可能太多,只按marker 缩放
            if (overlay instanceof Marker) {
                builder.include(((Marker) overlay).getPosition());
            }
        }
        mBaiduMap.setMapStatus(MapStatusUpdateFactory
                .newLatLngBounds(builder.build()));
    }
}
 
开发者ID:CrazyRunning,项目名称:MyStudyHelper,代码行数:24,代码来源:OverlayManager.java

示例9: updateMarker

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
@Override
public void updateMarker(MarkerInfo markerInfo, boolean isDraggable) {
    // if the drone hasn't received a gps signal yet
    final LatLong coord = markerInfo.getPosition();
    if (coord == null) {
        return;
    }
    final LatLng position = DroneHelper.CoordToBaiduLatLang(coord);
    Marker marker = mBiMarkersMap.getValue(markerInfo);
    if (marker == null) {
        // Generate the marker
        generateMarker(markerInfo, position, isDraggable);
    } else {
        // Update the marker
        updateMarker(marker, markerInfo, position, isDraggable);
    }
}
 
开发者ID:jiaminghan,项目名称:droidplanner-master,代码行数:18,代码来源:BaiduMapFragment.java

示例10: generateMarker

import com.baidu.mapapi.map.Marker; //导入依赖的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

示例11: initMaker

import com.baidu.mapapi.map.Marker; //导入依赖的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

示例12: initMarkerClickEvent

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
private void initMarkerClickEvent() {
	// 对Marker的点击
	mBaiduMap.setOnMarkerClickListener(new OnMarkerClickListener() {
		@Override
		public boolean onMarkerClick(final Marker marker) {
			// 将marker所在的经纬度的信息转化成屏幕上的坐标
			System.out.println("点击marker:" + marker.getPosition() + marker.toString());
			final LatLng ll = marker.getPosition();
			int index = marker.getZIndex();
			if (index == 2) {
				float tempZoom = 18;
				if (curZoom != 17)
					tempZoom = curZoom + 1.0f;
				showCurrtenStroeOnMap(ll, tempZoom);
			} else {
				// 获得marker中的数据
				StoreData info = (StoreData) marker.getExtraInfo().get("info");

				Bundle pBundle = new Bundle();
				pBundle.putSerializable("data", info);
				openActivity(StoreInformationActivity.class, pBundle);
			}
			return true;
		}
	});
}
 
开发者ID:poomoo,项目名称:eDao,代码行数:27,代码来源:MapActivity.java

示例13: onMarkerClick

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
@Override
public boolean onMarkerClick(final Marker marker) {
	final LatLng ll = marker.getPosition();
	Point p = mBaiduMap.getProjection().toScreenLocation(ll);
	p.y -= 47;
	LatLng llInfo = mBaiduMap.getProjection().fromScreenLocation(p);

	Button button = new Button(getApplicationContext());

	if (marker == mMarker) {
		button.setText(marker.getPosition().latitude + " // "
				+ marker.getPosition().longitude);

	}
	InfoWindow mInfoWindow = new InfoWindow(button, llInfo,
			mOnInfoWindowClickListener);
	mBaiduMap.showInfoWindow(mInfoWindow);
	return true;
}
 
开发者ID:JohnNiuNiu,项目名称:HaHaMap,代码行数:20,代码来源:MainActivity.java

示例14: onMarkerClick

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
@Override
public boolean onMarkerClick(final Marker marker) {
	final LatLng ll = marker.getPosition();
	Point p = mBaiduMap.getProjection().toScreenLocation(ll);
	p.y -= 47;
	LatLng llInfo = mBaiduMap.getProjection().fromScreenLocation(p);

	Button button = new Button(getApplicationContext());

	if (marker == mMarkerA) {
		button.setText(marker.getPosition().latitude + " // "
				+ marker.getPosition().longitude);

	} else if (marker == mMarkerB) {
		button.setText(getDistanceMsg(mCenterLatLng, ll));
	} else if (marker == mMarkerC) {
		button.setText(getDistanceMsg(mCenterLatLng, ll));
	}
	InfoWindow mInfoWindow = new InfoWindow(button, llInfo,
			mOnInfoWindowClickListener);
	mBaiduMap.showInfoWindow(mInfoWindow);
	return true;
}
 
开发者ID:JohnNiuNiu,项目名称:HaHaMap,代码行数:24,代码来源:GeoCoderActivity.java

示例15: onMarkerClick

import com.baidu.mapapi.map.Marker; //导入依赖的package包/类
@Override
public final boolean onMarkerClick(Marker marker) {
    if (!mOverlayList.contains(marker)) {
        return false;
    }
    if (marker.getExtraInfo() != null) {
        return onPoiClick(marker.getExtraInfo().getInt("index"));
    }
    return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:IndoorPoiOverlay.java


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