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

The following examples show how to use com.amap.api.maps.model.CircleOptions. 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: HoleActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 初始化AMap对象
 */
private void init() {
    if (aMap == null) {
        aMap = mapView.getMap();
    }

    aMap.moveCamera(CameraUpdateFactory.zoomTo(8));
    CircleOptions circleOptions = new CircleOptions().center(Constants.BEIJING)
            .radius(100000).strokeColor(Color.argb(200, 1, 1, 1))
            .fillColor(Color.argb(200, 80, 1, 1)).strokeWidth(10);
    circle = aMap.addCircle(circleOptions);


    PolygonOptions polygonOptions = new PolygonOptions()
            .addAll(createRectangle(Constants.SHANGHAI, 1, 1))
            .fillColor(Color.LTGRAY).strokeColor(Color.RED).strokeWidth(10);

    polygon = aMap.addPolygon(polygonOptions);
}
 
Example #2
Source File: GeoFence_Round_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #3
Source File: GeoFence_Multiple_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #4
Source File: GeoFence_Polygon_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #5
Source File: GeoFence_Nearby_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #6
Source File: GeoFence_Keyword_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #7
Source File: GeoFence_Round_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #8
Source File: GeoFence_District_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #9
Source File: GeoFence_Multiple_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #10
Source File: GeoFence_Polygon_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #11
Source File: GeoFence_Nearby_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #12
Source File: GeoFence_Keyword_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #13
Source File: GaoDeMapAiLineManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void drawAiLimit(double lat, double lng, double radiu) {
    if (this.limitCircle == null) {
        this.limitCircle = this.aMap.addCircle(new CircleOptions().center(new LatLng(lat, lng)).radius(radiu).strokeColor(this.strokeColor).fillColor(this.fillColor).strokeWidth((float) this.strokeWidth));
        return;
    }
    this.limitCircle.setCenter(new LatLng(lat, lng));
}
 
Example #14
Source File: GeoFence_District_Activity.java    From Android_Location_Demo with Apache License 2.0 5 votes vote down vote up
private void drawCircle(GeoFence fence) {
	LatLng center = new LatLng(fence.getCenter().getLatitude(),
			fence.getCenter().getLongitude());
	// 绘制一个圆形
	mAMap.addCircle(new CircleOptions().center(center)
			.radius(fence.getRadius()).strokeColor(Const.STROKE_COLOR)
			.fillColor(Const.FILL_COLOR).strokeWidth(Const.STROKE_WIDTH));
	boundsBuilder.include(center);
}
 
Example #15
Source File: LocationActivity.java    From xmpp with Apache License 2.0 5 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    LatLng l = cameraPosition.target;
    double a = l.latitude;
    double b = l.longitude;
    CircleOptions co = new CircleOptions();
    co.center(l);
    co.radius(2000);
    co.strokeColor(Color.WHITE).fillColor(getResources().getColor(R.color.location_cri_color)).strokeWidth(3);
    aMap.clear();
    aMap.addCircle(co);
    lp = new LatLonPoint(a, b);
    doSearchQuery();
}
 
Example #16
Source File: CircleActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
private void setUpMap() {
    mColorBar.setOnSeekBarChangeListener(this);
    mAlphaBar.setOnSeekBarChangeListener(this);
    mWidthBar.setOnSeekBarChangeListener(this);
    aMap.moveCamera(CameraUpdateFactory
            .newLatLngZoom(Constants.BEIJING, 12));// 设置指定的可视区域地图
    // 绘制一个圆形
    circle = aMap.addCircle(new CircleOptions().center(Constants.BEIJING)
            .radius(4000).strokeColor(Color.argb(50, 1, 1, 1))
            .fillColor(Color.argb(50, 1, 1, 1)).strokeWidth(25));


    //画虚线圆

}
 
Example #17
Source File: GaoDeMapNoFlyZone.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void drawCircleNoFlyZone(LatLng lats, int radius) {
    Circle circleLimitHight = this.aMap.addCircle(new CircleOptions().center(lats).radius((double) (radius + 1000)).strokeColor(this.strokeColor).fillColor(this.fillColorHeightLimit).strokeWidth(0.0f));
    this.circleList.add(circleLimitHight);
    CircleHoleOptions circleHoleOptions = new CircleHoleOptions();
    circleHoleOptions.center(lats).radius((double) radius);
    circleLimitHight.setHoleOptions(null);
    List<BaseHoleOptions> list = new ArrayList();
    list.add(circleHoleOptions);
    circleLimitHight.setHoleOptions(list);
    this.circleList.add(this.aMap.addCircle(new CircleOptions().center(lats).radius((double) radius).strokeColor(this.fillColorHeightLimit).fillColor(this.fillColor)));
}
 
Example #18
Source File: GaoDeMapAiSurroundManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void drawAiLimit(double lat, double lng, double radiu) {
    if (this.limitCircle == null) {
        this.limitCircle = this.aMap.addCircle(new CircleOptions().center(new LatLng(lat, lng)).radius(radiu).strokeColor(this.strokeColor).fillColor(this.fillColor).strokeWidth((float) this.strokeWidth));
        return;
    }
    this.limitCircle.setCenter(new LatLng(lat, lng));
}
 
Example #19
Source File: GaoDeMapAiPoint2PointManager.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void drawAiLimit(double lat, double lng, double radiu) {
    if (this.limitCircle == null) {
        this.limitCircle = this.aMap.addCircle(new CircleOptions().center(new LatLng(lat, lng)).radius(radiu).strokeColor(this.strokeColor).fillColor(this.fillColor).strokeWidth((float) this.strokeWidth));
        return;
    }
    this.limitCircle.setCenter(new LatLng(lat, lng));
}
 
Example #20
Source File: PoiAroundSearchActivity.java    From TraceByAmap with MIT License 4 votes vote down vote up
@Override
public void onPoiSearched(PoiResult result, int rcode) {
	if (rcode == AMapException.CODE_AMAP_SUCCESS) {
		if (result != null && result.getQuery() != null) {// 搜索poi的结果
			if (result.getQuery().equals(query)) {// 是否是同一条
				poiResult = result;
				poiItems = poiResult.getPois();// 取得第一页的poiitem数据,页数从数字0开始
				List<SuggestionCity> suggestionCities = poiResult
						.getSearchSuggestionCitys();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
				if (poiItems != null && poiItems.size() > 0) {
					//清除POI信息显示
					whetherToShowDetailInfo(false);
					//并还原点击marker样式
					if (mlastMarker != null) {
						resetlastmarker();
					}				
					//清理之前搜索结果的marker
					if (poiOverlay !=null) {
						poiOverlay.removeFromMap();
					}
					mAMap.clear();
					poiOverlay = new myPoiOverlay(mAMap, poiItems);
					poiOverlay.addToMap();
					poiOverlay.zoomToSpan();
					
					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())));
					
					mAMap.addCircle(new CircleOptions()
					.center(new LatLng(lp.getLatitude(),
							lp.getLongitude())).radius(5000)
					.strokeColor(Color.BLUE)
					.fillColor(Color.argb(50, 1, 1, 1))
					.strokeWidth(2));

				} else if (suggestionCities != null
						&& suggestionCities.size() > 0) {
					showSuggestCity(suggestionCities);
				} else {
					ToastUtil.show(PoiAroundSearchActivity.this,
							R.string.no_result);
				}
			}
		} else {
			ToastUtil
					.show(PoiAroundSearchActivity.this, R.string.no_result);
		}
	} else  {
		ToastUtil.showerror(this.getApplicationContext(), rcode);
	}
}
 
Example #21
Source File: CloudActivity.java    From TraceByAmap with MIT License votes vote down vote up
/**
	 * 检索结果回调
	 * @param result
	 * @param rCode
     */
	@Override
	public void onCloudSearched(CloudResult result, int rCode) {
		dissmissProgressDialog();

		if (rCode == AMapException.CODE_AMAP_SUCCESS) {
			if (result != null && result.getQuery() != null) {
				if (result.getQuery().equals(mQuery)) {
					mCloudItems = result.getClouds();

					if (mCloudItems != null && mCloudItems.size() > 0) {
						mAMap.clear();
						mPoiCloudOverlay = new CloudOverlay(mAMap, mCloudItems);
						mPoiCloudOverlay.removeFromMap();
						mPoiCloudOverlay.addToMap();
						// mPoiCloudOverlay.zoomToSpan();
						for (CloudItem item : mCloudItems) {
							items.add(item);
							Log.d(TAG, "_id " + item.getID());
							Log.d(TAG, "_location "
									+ item.getLatLonPoint().toString());
							Log.d(TAG, "_name " + item.getTitle());
							Log.d(TAG, "_address " + item.getSnippet());
							Log.d(TAG, "_caretetime " + item.getCreatetime());
							Log.d(TAG, "_updatetime " + item.getUpdatetime());
							Log.d(TAG, "_distance " + item.getDistance());
							Iterator iter = item.getCustomfield().entrySet()
									.iterator();
							while (iter.hasNext()) {
								Map.Entry entry = (Map.Entry) iter.next();
								Object key = entry.getKey();
								Object val = entry.getValue();
								Log.d(TAG, key + "   " + val);
							}
						}
						if (mQuery.getBound().getShape()
								.equals(SearchBound.BOUND_SHAPE)) {// 圆形
							mAMap.addCircle(new CircleOptions()
									.center(new LatLng(mCenterPoint
											.getLatitude(), mCenterPoint
											.getLongitude())).radius(5000)
									.strokeColor(
									// Color.argb(50, 1, 1, 1)
											Color.RED)
									.fillColor(Color.argb(50, 1, 1, 1))
									.strokeWidth(5));

							mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(
									new LatLng(mCenterPoint.getLatitude(),
											mCenterPoint.getLongitude()), 12));

						} else if (mQuery.getBound().getShape()
								.equals(SearchBound.POLYGON_SHAPE)) {
							mAMap.addPolygon(new PolygonOptions()
									.add(AMapUtil.convertToLatLng(mPoint1))
									.add(AMapUtil.convertToLatLng(mPoint2))
									.add(AMapUtil.convertToLatLng(mPoint3))
									.add(AMapUtil.convertToLatLng(mPoint4))
									.fillColor(Color.argb(50, 1, 1, 1))
									.strokeColor(Color.RED).strokeWidth(1));
							LatLngBounds bounds = new LatLngBounds.Builder()
									.include(AMapUtil.convertToLatLng(mPoint1))
									.include(AMapUtil.convertToLatLng(mPoint2))
									.include(AMapUtil.convertToLatLng(mPoint3))
									.build();
							mAMap.moveCamera(CameraUpdateFactory
									.newLatLngBounds(bounds, 50));
						} else if ((mQuery.getBound().getShape()
								.equals(SearchBound.LOCAL_SHAPE))) {
							mPoiCloudOverlay.zoomToSpan();
						}

					} else {
						ToastUtil.show(this, R.string.no_result);
					}
				}
			} else {
				ToastUtil.show(this, R.string.no_result);
			}
		} else {
			ToastUtil.showerror(this, rCode);
		}

	}