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

The following examples show how to use com.amap.api.maps.model.CameraPosition. 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: MapsModule.java    From Maps with GNU General Public License v2.0 6 votes vote down vote up
public void onOrientationChanged(float ori) {


        if (mLocation != null && marker != null) {
            CameraPosition currentCP = mGaodeMap.getCameraPosition();

            int mode = readMyLocationMode();
            if (mode == AMap.LOCATION_TYPE_MAP_ROTATE) {
                marker.setRotateAngle(0);
                CameraPosition newCP = new CameraPosition(new LatLng(mLocation.getLatitude(), mLocation.getLongitude()), currentCP.zoom, currentCP.bearing, ori);
                mGaodeMap.animateCamera(CameraUpdateFactory.newCameraPosition(newCP), null);
            } else {
                marker.setRotateAngle(ori);
            }
        }

    }
 
Example #2
Source File: ReviewPresenterImpl.java    From RunMap with Apache License 2.0 6 votes vote down vote up
private void prepareAnimation(final List<List<LatLng>> drawSource){
    mapInstance.clear();
    this.mDrawSource = drawSource;
    mSegmentIndex = 0;
    if(isFirstAnimation) {
        isFirstAnimation = false;
        TaskHanler.getInstance().sendTaskDelayed(new Runnable() {
            @Override
            public void run() {
                mapInstance.moveToSpecficCamera(CameraUpdateFactory.newCameraPosition(
                        new CameraPosition(drawSource.get(mSegmentIndex).get(0), 16, 0, 0)));
            }
        }, 1000);
    }
    else {
        mapInstance.moveToSpecficCamera(CameraUpdateFactory.newCameraPosition(
                new CameraPosition(drawSource.get(mSegmentIndex).get(0), 16, 0, 0)));
    }

    mapInstance.drawTrackAnimation(drawSource.get(mSegmentIndex), mSegmentIndex, new TrackLineMoveListener());
}
 
Example #3
Source File: RouteAmapBusActivity.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #4
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #5
Source File: AmapRouteFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #6
Source File: AmapSelectPoiFragment.java    From BmapLite with Apache License 2.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }

    mSearchInteracter.searchLatLng(cameraPosition.target.latitude, cameraPosition.target.longitude, 1, this);
}
 
Example #7
Source File: RouteAmapBusActivity.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #8
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #9
Source File: AmapRouteFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }
}
 
Example #10
Source File: AmapSelectPoiFragment.java    From BmapLite with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
    if (0 == cameraPosition.bearing) {
        mImageCompass.setVisibility(View.GONE);
    } else {
        if (mImageCompass.getVisibility() == View.GONE) {
            mImageCompass.setVisibility(View.VISIBLE);
        }
        mImageCompass.setRotation(360 - cameraPosition.bearing);
    }
    if (mAmap.getMaxZoomLevel() <= cameraPosition.zoom) {
        mBtnZoomIn.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomIn.setEnabled(false);
    } else if (mAmap.getMinZoomLevel() >= cameraPosition.zoom) {
        mBtnZoomOut.setTextColor(Color.parseColor("#bbbbbb"));
        mBtnZoomOut.setEnabled(false);
    } else {
        mBtnZoomOut.setTextColor(Color.parseColor("#757575"));
        mBtnZoomOut.setEnabled(true);
        mBtnZoomIn.setTextColor(Color.parseColor("#757575"));
        mBtnZoomIn.setEnabled(true);
    }

    mSearchInteracter.searchLatLng(cameraPosition.target.latitude, cameraPosition.target.longitude, 1, this);
}
 
Example #11
Source File: MainActivity.java    From Android_UsingCar_Example with Apache License 2.0 5 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
	showView();
	mStartPosition = cameraPosition.target;
	mRegeocodeTask.setOnLocationGetListener(this);
	mRegeocodeTask
			.search(mStartPosition.latitude, mStartPosition.longitude);
	if (mIsFirst) {
		Utils.addEmulateData(mAmap, mStartPosition);
		if (mPositionMark != null) {
			mPositionMark.setToTop();
		}
		mIsFirst = false;
	}
}
 
Example #12
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 #13
Source File: TrackPresenterImpl.java    From RunMap with Apache License 2.0 5 votes vote down vote up
@Override
public void scaleCurrentCamera() {
    CameraPosition position = mapObject.getController().getCameraPosition();
    List<TrackPoint> trackPoints = mMoveModel.getHistoryCoordiates();
    LatLng start = new LatLng(trackPoints.get(0).getLatitude(), trackPoints.get(0).getLongitude());
    LatLng end = new LatLng(trackPoints.get(trackPoints.size() - 1).getLatitude(), trackPoints.get(trackPoints.size() - 1).getLongitude());
    CameraUpdate update = CameraUpdateFactory.newLatLngBounds(new LatLngBounds(start, end), (int) (position.zoom - 6));
    mapObject.moveToSpecficCamera(update);
}
 
Example #14
Source File: NavigateArrowOverlayActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 初始化AMap对象
 */
private void init() {
	if (aMap == null) {
		aMap = mapView.getMap();
		// 加一个箭头对象(NavigateArrow)对象在地图上
		aMap.addNavigateArrow(new NavigateArrowOptions().add(latlng1,
				latlng2, latlng3, latlng4).width(20));
		aMap.moveCamera(CameraUpdateFactory
				.newCameraPosition(new CameraPosition(new LatLng(39.9875,
						116.48047), 16f, 38.5f, 300)));

	}
}
 
Example #15
Source File: EventsActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 对移动地图结束事件回调
 */
@Override
public void onCameraChangeFinish(CameraPosition cameraPosition) {
	mCameraTextView.setText("onCameraChangeFinish:"
			+ cameraPosition.toString());
	VisibleRegion visibleRegion = aMap.getProjection().getVisibleRegion(); // 获取可视区域、

	LatLngBounds latLngBounds = visibleRegion.latLngBounds;// 获取可视区域的Bounds
	boolean isContain = latLngBounds.contains(Constants.SHANGHAI);// 判断上海经纬度是否包括在当前地图可见区域
	if (isContain) {
		ToastUtil.show(EventsActivity.this, "上海市在地图当前可见区域内");
	} else {
		ToastUtil.show(EventsActivity.this, "上海市超出地图当前可见区域");
	}
}
 
Example #16
Source File: CameraActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
@Override
public void onClick(View v) {
	switch (v.getId()) {
	/**
	 * 点击“去中关村”按钮响应事件
	 */
	case R.id.Zhongguancun:
		changeCamera(
				CameraUpdateFactory.newCameraPosition(new CameraPosition(
						Constants.ZHONGGUANCUN, 18, 30, 30)));
		aMap.clear();
		aMap.addMarker(new MarkerOptions().position(Constants.ZHONGGUANCUN)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
		break;

	/**
	 * 点击“去陆家嘴”按钮响应事件
	 */
	case R.id.Lujiazui:
		changeCamera(
				CameraUpdateFactory.newCameraPosition(new CameraPosition(
						Constants.SHANGHAI, 18, 30, 0)));
		aMap.clear();
		aMap.addMarker(new MarkerOptions().position(Constants.SHANGHAI)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
		break;
	
	default:
		break;
	}
}
 
Example #17
Source File: ParticleWeatherMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 修改粒子系统的效果
 *
 * @param position
 */
private void changeParticleOverlayState(CameraPosition position) {
    //在8-20级的级别下,展示省份/城市级别的天气图层
    if (position != null) {
        float zoom = position.zoom;

        String key = getShowWeatherPositio(position);
        if(key == null) {
            return;
        }

        if (zoom > MAX_SHOW_WEATHER_MARKER_ZOOM) {
            // 如果没有显示了进行显示操作
            if (!isParticleOverlayShown) {
                synchronized (particleMaps) {
                    showParticle(key);
                }
                isParticleOverlayShown = true;
            }
        } else {
            // 如果显示了进行隐藏操作
            if (isParticleOverlayShown) {
                hideCurrentParticleOverlay();
                isParticleOverlayShown = false;
            }
        }
    }


}
 
Example #18
Source File: ParticleWeatherMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 获取是哪里需要显示天气
 *
 * @param position
 * @return
 */
private String getShowWeatherPositio(CameraPosition position) {
    if(position == null) {
        return null;
    }

    List<Marker> markers = aMap.getMapScreenMarkers();

    // 去除离屏幕最近的marker
    Marker needShowMarker = null;
    float distance = 0;
    for (Marker marker : markers) {
        LatLng markerPos = marker.getPosition();

        float curDistanct = AMapUtils.calculateLineDistance(markerPos, position.target);

        if(distance == 0) {
            distance = curDistanct;
            needShowMarker = marker;
        } else {
            if(curDistanct < distance) {
                needShowMarker = marker;
            }
        }

    }


    if(needShowMarker != null && needShowMarker.getObject() != null) {
        return (String) needShowMarker.getObject();
    }
    return null;
}
 
Example #19
Source File: ParticleWeatherMapActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 初始化添加marker
 */
private void initWeather() {
    CameraPosition cameraPosition = aMap.getCameraPosition();
    boolean isNeedShowWeatherMarker = false;
    if (cameraPosition != null) {
        isNeedShowWeatherMarker = cameraPosition.zoom <= MAX_SHOW_WEATHER_MARKER_ZOOM;

        // 查看首次需不需要显示粒子效果
        changeParticleOverlayState(cameraPosition);
    }
    for (int i = 0; i < latLngs.length; i++) {
        LatLng latLng = latLngs[i];
        int index = i % pngPaths.length;

        // 天气状态随机选取,如果要使用到实际场景,这里需要修改成真是数据
        String path = pngPaths[index];

        BitmapDescriptor bitmapDescriptor = bitmapDescriptorHashtable.get(path);
        if (bitmapDescriptor == null) {
            bitmapDescriptor = BitmapDescriptorFactory.fromAsset(path);
            bitmapDescriptorHashtable.put(path, bitmapDescriptor);
        }

        Marker marker = aMap.addMarker(new MarkerOptions().position(latLng).icon(bitmapDescriptor).visible(isNeedShowWeatherMarker));
        if (marker != null) {
            marker.setObject(path);
            markerList.add(marker);
        }

    }

}
 
Example #20
Source File: MarkerAnimationActivity.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 初始化AMap对象
 */
private void init() {
	Button growMarkerBt = (Button) findViewById(R.id.growMarker);
	growMarkerBt.setOnClickListener(this);
	Button jumpMarkerBt = (Button) findViewById(R.id.jumpMarker);
	jumpMarkerBt.setOnClickListener(this);
	Button breatheMarkerBt = (Button) findViewById(R.id.breatheMarker);
	breatheMarkerBt.setOnClickListener(this);



	if (aMap == null) {
		aMap = mapView.getMap();
	}
	aMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
		@Override
		public void onMapLoaded() {
			addMarkersToMap();
		}
	});

	// 设置可视范围变化时的回调的接口方法
	aMap.setOnCameraChangeListener(new AMap.OnCameraChangeListener() {
		@Override
		public void onCameraChange(CameraPosition position) {

		}

		@Override
		public void onCameraChangeFinish(CameraPosition postion) {
			//屏幕中心的Marker跳动
               startJumpAnimation();
		}
	});
}
 
Example #21
Source File: Coordinate.java    From flutter_amap_plugin with MIT License 4 votes vote down vote up
CameraPosition toCameraPosition() {
    return new CameraPosition(new LatLng(latitude,longitude), 10, 0, 0);
}
 
Example #22
Source File: MainActivity.java    From Android_UsingCar_Example with Apache License 2.0 4 votes vote down vote up
@Override
public void onCameraChange(CameraPosition arg0) {
	hideView();
}
 
Example #23
Source File: PlaceMapFragment.java    From Fishing with GNU General Public License v3.0 4 votes vote down vote up
private void moveTo(double lat, double lng) {
    aMap.animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(
            new LatLng(lat, lng), aMap.getCameraPosition().zoom, 0, 0
    )));
}
 
Example #24
Source File: PlaceMapFragment.java    From Fishing with GNU General Public License v3.0 4 votes vote down vote up
private void moveTo(double lat, double lng, float zoom) {
    aMap.animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(
            new LatLng(lat, lng), zoom, 0, 0
    )));
}
 
Example #25
Source File: PlaceLocationSelectActivity.java    From Fishing with GNU General Public License v3.0 4 votes vote down vote up
private void moveTo(double lat, double lng, float zoom) {
    aMap.animateCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(
            new LatLng(lat, lng), zoom, 0, 0
    )));
}
 
Example #26
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 4 votes vote down vote up
@Override
public void onCameraChangeFinish(CameraPosition arg0) {
    mPXInMeters = mAMap.getScalePerPixel();
    mClusterDistance = mPXInMeters * mClusterSize;
    assignClusters();
}
 
Example #27
Source File: MapDrawer.java    From RunMap with Apache License 2.0 4 votes vote down vote up
public void drawTrackAnimation(List<LatLng> drawSource, int currentIndex, SmoothMoveMarker.MoveListener moveListener) {
    //寻找与起点距离最远的点
    SmoothMoveMarker pre = mMarkerLists.peek();
    if(pre != null){
        pre.setMoveListener(null);
        mMarkerLists.poll();
    }
    float maxDistance = 0;
    LatLng endPoint = null;
    for (int i = 1; i < drawSource.size(); i++) {
        float distance = AMapUtils.calculateLineDistance(drawSource.get(0), drawSource.get(i));
        if (distance > maxDistance) {
            endPoint = drawSource.get(i);
            maxDistance = distance;
        }
    }
    CFLog.e("TAG", "max distance = " + maxDistance);

    //代表构成的一个矩形区域,由两点决定
    LatLngBounds bounds = new LatLngBounds(drawSource.get(0), endPoint);

    float pad = GlobalApplication.getAppContext().getResources().getDisplayMetrics().scaledDensity * RMConfiguration.MAP_PADDING;
    mAmap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition(drawSource.get(0), 17, 0, 0)));
    mAmap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, (int) pad));

    drawSingleMaker(drawSource.get(0), GlobalApplication.getAppContext().getString(R.string.string_start_point), -1);
    drawSingleMaker(drawSource.get(drawSource.size() - 1), GlobalApplication.getAppContext().getString(R.string.string_end_point), -1);
    if (currentIndex == 0) {
        drawPolyLineWithTexture(drawSource, R.mipmap.track_line_texture);
    } else {
        Random random = new Random(SystemClock.currentThreadTimeMillis());

        drawPolyLine(drawSource, Color.rgb(random.nextInt(255), random.nextInt(255), random.nextInt(255)));
    }


    //按照指定的经纬度数据和时间,平滑移动
    SmoothMoveMarker smoothMarker = new SmoothMoveMarker(mAmap);
    // 设置滑动的图标
    smoothMarker.setDescriptor(BitmapDescriptorFactory.fromResource(R.mipmap.track_line_icon));
    // 设置滑动的轨迹点
    smoothMarker.setPoints(drawSource);
    // 设置滑动的总时间
    smoothMarker.setTotalDuration(20);
    //设置监听
    smoothMarker.setMoveListener(moveListener);
    // 开始滑动
    smoothMarker.startSmoothMove();
    mMarkerLists.add(smoothMarker);
}
 
Example #28
Source File: Animate_CameraActivity.java    From TraceByAmap with MIT License 4 votes vote down vote up
@Override
public void onClick(View v) {
	switch (v.getId()) {
	/**
	 * 点击停止动画按钮响应事件
	 */
	case R.id.stop_animation:
		aMap.stopAnimation();
		break;
	/**
	 * 点击“去中关村”按钮响应事件
	 */
	case R.id.Zhongguancun:
		changeCamera(
				CameraUpdateFactory.newCameraPosition(new CameraPosition(
						Constants.ZHONGGUANCUN, 18, 0, 30)), null);
		aMap.clear();
		aMap.addMarker(new MarkerOptions().position(Constants.ZHONGGUANCUN)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
		break;

	/**
	 * 点击“去陆家嘴”按钮响应事件
	 */
	case R.id.Lujiazui:
		changeCamera(
				CameraUpdateFactory.newCameraPosition(new CameraPosition(
						Constants.SHANGHAI, 18, 30, 0)), this);
		aMap.clear();
		aMap.addMarker(new MarkerOptions().position(Constants.SHANGHAI)
				.icon(BitmapDescriptorFactory
						.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
		break;
	/**
	 * 点击向左移动按钮响应事件,camera将向左边移动
	 */
	case R.id.scroll_left:
		changeCamera(CameraUpdateFactory.scrollBy(-SCROLL_BY_PX, 0), null);
		break;
	/**
	 * 点击向右移动按钮响应事件,camera将向右边移动
	 */
	case R.id.scroll_right:
		changeCamera(CameraUpdateFactory.scrollBy(SCROLL_BY_PX, 0), null);
		break;
	/**
	 * 点击向上移动按钮响应事件,camera将向上边移动
	 */
	case R.id.scroll_up:
		changeCamera(CameraUpdateFactory.scrollBy(0, -SCROLL_BY_PX), null);
		break;
	/**
	 * 点击向下移动按钮响应事件,camera将向下边移动
	 */
	case R.id.scroll_down:
		changeCamera(CameraUpdateFactory.scrollBy(0, SCROLL_BY_PX), null);
		break;

	default:
		break;
	}
}
 
Example #29
Source File: EventsActivity.java    From TraceByAmap with MIT License 4 votes vote down vote up
/**
 * 对正在移动地图事件回调
 */
@Override
public void onCameraChange(CameraPosition cameraPosition) {
	mCameraTextView.setText("onCameraChange:" + cameraPosition.toString());
}
 
Example #30
Source File: RouteAmapBusActivity.java    From BmapLite with Apache License 2.0 2 votes vote down vote up
@Override
public void onCameraChange(CameraPosition cameraPosition) {

}