com.amap.api.maps.model.BitmapDescriptorFactory Java Examples

The following examples show how to use com.amap.api.maps.model.BitmapDescriptorFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GeoFence_Polygon_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
/**
 * 设置一些amap的属性
 */
private void setUpMap() {
	mAMap.setOnMapClickListener(this);
	mAMap.setLocationSource(this);// 设置定位监听
	mAMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
	MyLocationStyle myLocationStyle = new MyLocationStyle();
	// 自定义定位蓝点图标
	myLocationStyle.myLocationIcon(
			BitmapDescriptorFactory.fromResource(R.drawable.gps_point));
	// 自定义精度范围的圆形边框颜色
	myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
	// 自定义精度范围的圆形边框宽度
	myLocationStyle.strokeWidth(0);
	// 设置圆形的填充颜色
	myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
	// 将自定义的 myLocationStyle 对象添加到地图上
	mAMap.setMyLocationStyle(myLocationStyle);
	mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
	// 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
	mAMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
 
Example #2
Source File: MainActivity.java    From Android_UsingCar_Example with Apache License 2.0 6 votes vote down vote up
@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();
}
 
Example #3
Source File: MainActivity.java    From SmoothMove with MIT License 6 votes vote down vote up
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));
    }

}
 
Example #4
Source File: GeoFence_Multiple_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
/**
 * 设置一些amap的属性
 */
private void setUpMap() {
	mAMap.setOnMapClickListener(this);
	mAMap.setLocationSource(this);// 设置定位监听
	mAMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
	// 自定义系统定位蓝点
	MyLocationStyle myLocationStyle = new MyLocationStyle();
	// 自定义定位蓝点图标
	myLocationStyle.myLocationIcon(
			BitmapDescriptorFactory.fromResource(R.drawable.gps_point));
	// 自定义精度范围的圆形边框颜色
	myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
	// 自定义精度范围的圆形边框宽度
	myLocationStyle.strokeWidth(0);
	// 设置圆形的填充颜色
	myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
	// 将自定义的 myLocationStyle 对象添加到地图上
	mAMap.setMyLocationStyle(myLocationStyle);
	mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
	// 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
	mAMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
 
Example #5
Source File: GroundOverlayActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
	 * 往地图上添加一个groundoverlay覆盖物
	 */
	private void addOverlayToMap() {
		amap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.936713,
				116.386475), 18));// 设置当前地图显示为北京市恭王府
		LatLngBounds bounds = new LatLngBounds.Builder()
				.include(new LatLng(39.935029, 116.384377))
				.include(new LatLng(39.939577, 116.388331)).build();

		amap.addGroundOverlay(new GroundOverlayOptions()
				.anchor(0.5f, 0.5f)
				.transparency(0.7f)
//				.zIndex(GlobalConstants.ZindexLine - 1)
				.image(BitmapDescriptorFactory
						.fromResource(R.drawable.groundoverlay))
						
				.positionFromBounds(bounds));
	}
 
Example #6
Source File: GeoFence_Polygon_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
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();
}
 
Example #7
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
public void initAmapSdk() {

        // 定位初始化
        mLocClient = new MyLocationStyle();
        mLocClient.interval(3000);
        mLocClient.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
        mLocClient.radiusFillColor(Color.argb(50, 0, 0, 180));
        mLocClient.strokeColor(Color.argb(50, 0, 0, 255));
        mLocClient.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_location_marker));
        mAmap.setMyLocationStyle(mLocClient);


        try {
            LocationManager locManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
            if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                onMessage(getResources().getString(R.string.gps_enabled_false));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
 
Example #8
Source File: PoiAroundSearchActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 初始化AMap对象
 */
private void init() {
	if (mAMap == null) {
		mAMap = mapview.getMap();
		mAMap.setOnMapClickListener(this);
		mAMap.setOnMarkerClickListener(this);
		mAMap.setOnInfoWindowClickListener(this);
		mAMap.setInfoWindowAdapter(this);
		TextView searchButton = (TextView) findViewById(R.id.btn_search);
		searchButton.setOnClickListener(this);
		locationMarker = mAMap.addMarker(new MarkerOptions()
				.anchor(0.5f, 0.5f)
				.icon(BitmapDescriptorFactory
						.fromBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.point4)))
				.position(new LatLng(lp.getLatitude(), lp.getLongitude())));
		locationMarker.showInfoWindow();

	}
	setup();
	mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lp.getLatitude(), lp.getLongitude()), 14));
}
 
Example #9
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 6 votes vote down vote up
/**
 * 获取每个聚合点的绘制样式
 */
private BitmapDescriptor getBitmapDes(int num) {
    BitmapDescriptor bitmapDescriptor = mLruCache.get(num);
    if (bitmapDescriptor == null) {
        TextView textView = new TextView(mContext);
        if (num > 1) {
            String tile = String.valueOf(num);
            textView.setText(tile);
        }
        textView.setGravity(Gravity.CENTER);
        textView.setTextColor(Color.BLACK);
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
        if (mClusterRender != null && mClusterRender.getDrawAble(num) != null) {
            textView.setBackgroundDrawable(mClusterRender.getDrawAble(num));
        } else {
            textView.setBackgroundResource(R.drawable.defaultcluster);
        }
        bitmapDescriptor = BitmapDescriptorFactory.fromView(textView);
        mLruCache.put(num, bitmapDescriptor);

    }
    return bitmapDescriptor;
}
 
Example #10
Source File: GaodeMapLocationManager.java    From FimiX8-RE with MIT License 6 votes vote down vote up
public void onLocationChanged(AMapLocation amapLocation) {
    if (this.mListener != null && amapLocation != null) {
        if (amapLocation == null || amapLocation.getErrorCode() != 0) {
            Log.e("AmapErr", "定位失败," + amapLocation.getErrorCode() + ": " + amapLocation.getErrorInfo());
            return;
        }
        LatLng latLng = new LatLng(amapLocation.getLatitude(), amapLocation.getLongitude());
        this.mAccuracy = amapLocation.getAccuracy();
        if (this.locationMarker == null) {
            this.locationMarker = this.aMap.addMarker(new MarkerOptions().position(latLng).icon(BitmapDescriptorFactory.fromResource(R.drawable.location_map)).anchor(0.5f, 0.5f));
            this.aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15.5f));
        } else if (this.useMoveToLocationWithMapMode) {
            startMoveLocationAndMap(latLng);
        } else {
            startChangeLocation(latLng);
        }
    }
}
 
Example #11
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
public void initAmapSdk() {

        // 定位初始化
        mLocClient = new MyLocationStyle();
        mLocClient.interval(3000);
        mLocClient.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER);
        mLocClient.radiusFillColor(Color.argb(50, 0, 0, 180));
        mLocClient.strokeColor(Color.argb(50, 0, 0, 255));
        mLocClient.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_location_marker));
        mAmap.setMyLocationStyle(mLocClient);


        try {
            LocationManager locManager = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE);
            if (!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                onMessage(getResources().getString(R.string.gps_enabled_false));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
 
Example #12
Source File: GeoFence_Keyword_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
/**
 * 设置一些amap的属性
 */
private void setUpMap() {
	mAMap.setLocationSource(this);// 设置定位监听
	mAMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
	// 自定义系统定位蓝点
	MyLocationStyle myLocationStyle = new MyLocationStyle();
	// 自定义定位蓝点图标
	myLocationStyle.myLocationIcon(
			BitmapDescriptorFactory.fromResource(R.drawable.gps_point));
	// 自定义精度范围的圆形边框颜色
	myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
	// 自定义精度范围的圆形边框宽度
	myLocationStyle.strokeWidth(0);
	// 设置圆形的填充颜色
	myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
	// 将自定义的 myLocationStyle 对象添加到地图上
	mAMap.setMyLocationStyle(myLocationStyle);
	mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
	// 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
	mAMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
 
Example #13
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
private void makeMarker(MyPoiModel poi, boolean isClear) {
    if (isClear) {
        clearMarker();
    }

    int distance = 0;
    if (null != BApp.MY_LOCATION) {
        distance = (int) AMapUtils.calculateLineDistance(new LatLng(BApp.MY_LOCATION.getLatitude(), BApp.MY_LOCATION.getLongitude()),
                new LatLng(poi.getLatitude(), poi.getLongitude()));
    }
    Marker marker = mAmap.addMarker(new MarkerOptions().position(new LatLng(poi.getLatitude(), poi.getLongitude())).title(poi.getName()).snippet(distance + "").icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_gcoding_2)));
    markerList.add(marker);

    ((MainActivity) getActivity()).showPoiLay(poi, distance);

}
 
Example #14
Source File: GeoFence_District_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
/**
 * 设置一些amap的属性
 */
private void setUpMap() {
	mAMap.setLocationSource(this);// 设置定位监听
	mAMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
	// 自定义系统定位蓝点
	MyLocationStyle myLocationStyle = new MyLocationStyle();
	// 自定义定位蓝点图标
	myLocationStyle.myLocationIcon(
			BitmapDescriptorFactory.fromResource(R.drawable.gps_point));
	// 自定义精度范围的圆形边框颜色
	myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
	// 自定义精度范围的圆形边框宽度
	myLocationStyle.strokeWidth(0);
	// 设置圆形的填充颜色
	myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
	// 将自定义的 myLocationStyle 对象添加到地图上
	mAMap.setMyLocationStyle(myLocationStyle);
	mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
	// 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
	mAMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
 
Example #15
Source File: GeoFence_Polygon_Activity.java    From Android_Location_Demo with Apache License 2.0 6 votes vote down vote up
/**
 * 设置一些amap的属性
 */
private void setUpMap() {
	mAMap.setOnMapClickListener(this);
	mAMap.setLocationSource(this);// 设置定位监听
	mAMap.getUiSettings().setMyLocationButtonEnabled(true);// 设置默认定位按钮是否显示
	MyLocationStyle myLocationStyle = new MyLocationStyle();
	// 自定义定位蓝点图标
	myLocationStyle.myLocationIcon(
			BitmapDescriptorFactory.fromResource(R.drawable.gps_point));
	// 自定义精度范围的圆形边框颜色
	myLocationStyle.strokeColor(Color.argb(0, 0, 0, 0));
	// 自定义精度范围的圆形边框宽度
	myLocationStyle.strokeWidth(0);
	// 设置圆形的填充颜色
	myLocationStyle.radiusFillColor(Color.argb(0, 0, 0, 0));
	// 将自定义的 myLocationStyle 对象添加到地图上
	mAMap.setMyLocationStyle(myLocationStyle);
	mAMap.setMyLocationEnabled(true);// 设置为true表示显示定位层并可触发定位,false表示隐藏定位层并不可触发定位,默认是false
	// 设置定位的类型为定位模式 ,可以由定位、跟随或地图根据面向方向旋转几种
	mAMap.setMyLocationType(AMap.LOCATION_TYPE_LOCATE);
}
 
Example #16
Source File: RecordShowActivity.java    From RecordPath3D with Apache License 2.0 5 votes vote down vote up
/**
 * 地图上添加纠偏后轨迹线路及起终点、轨迹动画小人
 * 
 * @param startPoint
 * @param endPoint
 * @param originList
 */
private void addGraspTrace(List<LatLng> graspList, boolean mGraspChecked) {
	if (graspList == null || graspList.size() < 2) {
		return;
	}
	LatLng startPoint = graspList.get(0);
	LatLng endPoint = graspList.get(graspList.size() - 1);
	mGraspPolyline = mAMap.addPolyline(new PolylineOptions()
			.setCustomTexture(
					BitmapDescriptorFactory
							.fromResource(R.drawable.grasp_trace_line))
			.width(40).addAll(graspList));
	mGraspStartMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromResource(R.drawable.start)));
	mGraspEndMarker = mAMap.addMarker(new MarkerOptions()
			.position(endPoint).icon(
					BitmapDescriptorFactory.fromResource(R.drawable.end)));
	mGraspRoleMarker = mAMap.addMarker(new MarkerOptions().position(
			startPoint).icon(
			BitmapDescriptorFactory.fromBitmap(BitmapFactory
					.decodeResource(getResources(), R.drawable.walk))));
	if (!mGraspChecked) {
		mGraspPolyline.setVisible(false);
		mGraspStartMarker.setVisible(false);
		mGraspEndMarker.setVisible(false);
		mGraspRoleMarker.setVisible(false);
	}
}
 
Example #17
Source File: RoutePOIActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 添加起点和终点标记
 */
private void setfromandtoMarker() {
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mStartPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.start)));
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mEndPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.end)));		
}
 
Example #18
Source File: RideRouteActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void setfromandtoMarker() {
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mStartPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.start)));
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mEndPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.end)));		
}
 
Example #19
Source File: RouteActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void setfromandtoMarker() {
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mStartPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.start)));
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mEndPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.end)));		
}
 
Example #20
Source File: AmapSelectPoiFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    mMapView.onResume();
    mAmap.setMyLocationEnabled(true);
    if (null != mLocClient) {
        mLocClient.radiusFillColor(Color.argb(50, 0, 0, 180));
        mLocClient.strokeColor(Color.argb(50, 0, 0, 255));
        mLocClient.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_location_marker));
        mAmap.setMyLocationStyle(mLocClient);
    }
    configMap();
    super.onResume();
}
 
Example #21
Source File: PlaceMapFragment.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
private void initMyPoint() {
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_marker));
    mMyLocation = aMap.addMarker(markerOption);
    LocationModel.getInstance().registerLocationChange(location -> {
        JUtils.Log("latitude"+location.latitude+"  longitude"+location.longitude);
        mMyLocation.setPosition(new LatLng(location.latitude, location.longitude));
    });
}
 
Example #22
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onMapClick(LatLng latLng) {
    if (mLastMarker != null) mLastMarker.destroy();
    mPoint = latLng;
    MarkerOptions markerOption = new MarkerOptions();
    markerOption.position(latLng);
    markerOption.icon(BitmapDescriptorFactory
            .fromResource(R.drawable.location_point_bigger_red));
    mLastMarker = aMap.addMarker(markerOption);
    mGeocoderSearch.getFromLocationAsyn(new RegeocodeQuery(new LatLonPoint(latLng.latitude,latLng.longitude), 50,GeocodeSearch.AMAP));
}
 
Example #23
Source File: MapActivity.java    From TikTok with Apache License 2.0 5 votes vote down vote up
private void initMarks() {

        MarkerOptions markerOption = new MarkerOptions();
        markerOption.position(latlng);
        markerOption.title("西安市").snippet("西安市:34.341568, 108.940174");

        markerOption.draggable(true);//设置Marker可拖动
        markerOption.icon(BitmapDescriptorFactory.fromBitmap(BitmapFactory
                .decodeResource(getResources(),R.mipmap.ic_launcher)));
        // 将Marker设置为贴地显示,可以双指下拉地图查看效果
        markerOption.setFlat(true);//设置marker平贴地图效果

        mAMap.addMarker(markerOption);

    }
 
Example #24
Source File: DriveRoutePlanActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void setfromandtoMarker() {
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mStartPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.start)));
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mEndPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.end)));		
}
 
Example #25
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
@Override
public void onResume() {
    mMapView.onResume();
    mAmap.setMyLocationEnabled(true);
    if (null != mLocClient) {
        mLocClient.radiusFillColor(Color.argb(50, 0, 0, 180));
        mLocClient.strokeColor(Color.argb(50, 0, 0, 255));
        mLocClient.myLocationIcon(BitmapDescriptorFactory.fromResource(R.drawable.map_location_marker));
        mAmap.setMyLocationStyle(mLocClient);
    }
    configMap();
    super.onResume();
}
 
Example #26
Source File: TruckRouteActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void setfromandtoMarker() {
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mStartPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.start)));
	aMap.addMarker(new MarkerOptions()
	.position(AMapUtil.convertToLatLng(mEndPoint))
	.icon(BitmapDescriptorFactory.fromResource(R.drawable.end)));		
}
 
Example #27
Source File: PolylineActivitybase.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void addPolylinesWithTexture() {
	//四个点
	LatLng A = new LatLng(Lat_A, Lon_A);
	LatLng B = new LatLng(Lat_B, Lon_B);
	LatLng C = new LatLng(Lat_C, Lon_C);
	LatLng D = new LatLng(Lat_D, Lon_D);
	
	//用一个数组来存放纹理
	List<BitmapDescriptor> texTuresList = new ArrayList<BitmapDescriptor>();
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.map_alr));
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.custtexture));
	texTuresList.add(BitmapDescriptorFactory.fromResource(R.drawable.map_alr_night));
	
	//指定某一段用某个纹理,对应texTuresList的index即可, 四个点对应三段颜色
	List<Integer> texIndexList = new ArrayList<Integer>();
	texIndexList.add(0);//对应上面的第0个纹理
	texIndexList.add(2);
	texIndexList.add(1);
	
	
	PolylineOptions options = new PolylineOptions();
	options.width(20);//设置宽度
	
	//加入四个点
	options.add(A,B,C,D);
	
	//加入对应的颜色,使用setCustomTextureList 即表示使用多纹理;
	options.setCustomTextureList(texTuresList);
	
	//设置纹理对应的Index
	options.setCustomTextureIndex(texIndexList);
	
	aMap.addPolyline(options);
}
 
Example #28
Source File: InfoWindowActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 在地图上添加marker
 */
private void addMarkersToMap() {
	markerOption = new MarkerOptions().icon(BitmapDescriptorFactory
			.defaultMarker(BitmapDescriptorFactory.HUE_AZURE))
			.position(latlng)
			.title("标题")
			.snippet("详细信息")
			.draggable(true);
	marker = aMap.addMarker(markerOption);
	marker.showInfoWindow();
}
 
Example #29
Source File: CalculateDistanceActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void setUpMap() {
		aMap.setOnMarkerDragListener(this);
		makerA = aMap.addMarker(new MarkerOptions().position(latlngA)
				.draggable(true)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_ORANGE)));
		makerB = aMap.addMarker(new MarkerOptions().position(latlngB)
				.draggable(true)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_CYAN)));
		aMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(39.925516,
				116.395366), 15));
//		
	}
 
Example #30
Source File: TraceActivity_Simple2222.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 展示纠偏后的点
 * @param rectifications
 */
private void showTracedLocations(List<LatLng> rectifications) {
	if(tracedPolyline == null) {
		tracedPolyline = mAMap.addPolyline(new PolylineOptions()
				.setCustomTexture(BitmapDescriptorFactory.fromResource(R.drawable.custtexture))
				.width(20).zIndex(0));
	}
	if(rectifications == null) {
		return;
	}
	tracedPolyline.setPoints(rectifications);
}