com.amap.api.maps.AMap Java Examples

The following examples show how to use com.amap.api.maps.AMap. 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_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 #2
Source File: ListViewAdapter.java    From TraceByAmap with MIT License 6 votes vote down vote up
private void addElementOnMap(AMap map, int position, MapEntity mapEntity) {
    try {
        /**
         * 因为listview 中的mapview会复用,所以我们每次清空上一次的element
         */
        map.clear();
        if (position == 3) {
            addMarker(map, mapEntity.point);
        }
        if (position == 5) {
            addPolyline(map, mapEntity.polylinePoints);
        }
        if (position == 17) {
            addPolyline(map, mapEntity.polylinePoints);
        }
        if (position == 9) {
            addPolyline(map, mapEntity.polylinePoints);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #3
Source File: TwoMapActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
/**
 * 地图初始化完成后
 */
private void init() {
    aMap1.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
        @Override
        public void onMapLoaded() {
            setUp(aMap1);
        }
    });

    aMap2.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
        @Override
        public void onMapLoaded() {
            setUp(aMap2);
        }
    });
}
 
Example #4
Source File: BasicMapActivity.java    From TraceByAmap with MIT License 6 votes vote down vote up
@Override
public void onClick(View v) {
	switch (v.getId()) {
		case R.id.basicmap:
			aMap.setMapType(AMap.MAP_TYPE_NORMAL);// 矢量地图模式
			break;
		case R.id.rsmap:
			aMap.setMapType(AMap.MAP_TYPE_SATELLITE);// 卫星地图模式
			break;
		case R.id.nightmap:
			aMap.setMapType(AMap.MAP_TYPE_NIGHT);//夜景地图模式
			break;
		case R.id.navimap:
			aMap.setMapType(AMap.MAP_TYPE_NAVI);//导航地图模式
			break;
	}

	mStyleCheckbox.setChecked(false);

}
 
Example #5
Source File: AMapViewManager.java    From react-native-amap with MIT License 6 votes vote down vote up
@ReactProp(name = "region")
public void setRegion(MapView mapView, @Nullable ReadableMap region) {
    if (region == null) return;
    AMap map = mapView.getMap();
    Double lat = region.getDouble("latitude");
    Double lng = region.getDouble("longitude");
    Double lngDelta = region.getDouble("longitudeDelta");
    Double latDelta = region.getDouble("latitudeDelta");
    LatLngBounds bounds = new LatLngBounds(
        new LatLng(lat - latDelta / 2, lng - lngDelta / 2), // southwest
        new LatLng(lat + latDelta / 2, lng + lngDelta / 2)  // northeast
    );
    if (mapView.getHeight() <= 0 || mapView.getWidth() <= 0) {
        map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 10));
        boundsToMove = bounds;
    } else {
        map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
    }
}
 
Example #6
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 #7
Source File: MapsModule.java    From Maps with GNU General Public License v2.0 6 votes vote down vote up
public MapsModule(MapsFragment fragment ,AMap map) {
    this.mMapsFragment = fragment;
    this.mGaodeMap = map;

    mPref = fragment.getActivity().getApplicationContext().getSharedPreferences(fragment.getActivity().getPackageName()+ "_preferences", Context.MODE_PRIVATE);
    mPref.registerOnSharedPreferenceChangeListener(this);

    mMapsPresenter = new MapsPresenterImpl(this);
    mGaodeMap.setOnMapLoadedListener(this);
    mGaodeMap.setOnMapTouchListener(this);
    // location
    mGaodeMap.setMyLocationEnabled(true);

    mMapsFragment.getMyLocationBtn().setOnClickListener(this);

    mUiSetting = mGaodeMap.getUiSettings();

    setMaps();
}
 
Example #8
Source File: AmapWrapper.java    From RunMap with Apache License 2.0 6 votes vote down vote up
/**
 * 初始化地图显示样式
 * @param map
 */
private void initAmap(AMap map){
    this.mAmap = map;
    //照传入的CameraUpdate参数移动可视区域。
    map.animateCamera(CameraUpdateFactory.zoomTo(19));
    //设置定位源
    map.setLocationSource(mAmapStateListener);
    //显示室内地图
    map.showIndoorMap(true);
    //设置是否打开定位图层
    map.setMyLocationEnabled(true);
    MyLocationStyle style = new MyLocationStyle();
    //去除定位中心圆圈
    style.strokeWidth(0);
    style.radiusFillColor(Color.TRANSPARENT);
    //定位、且将视角移动到地图中心点,定位点依照设备方向旋转,并且会跟随设备移动
    style.myLocationType(MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE);
    map.setMyLocationStyle(style);
    //去除缩放按钮
    UiSettings settings = map.getUiSettings();
    settings.setZoomControlsEnabled(false);
}
 
Example #9
Source File: ClusterOverlay.java    From android-cluster-marker with Apache License 2.0 6 votes vote down vote up
/**
     * 构造函数,批量添加聚合元素时,调用此构造函数
     *
     * @param amap
     * @param clusterItems 聚合元素
     * @param clusterSize
     * @param context
     */
    public ClusterOverlay(AMap amap, List<ClusterItem> clusterItems,
                          int clusterSize, Context context) {
//默认最多会缓存80张图片作为聚合显示元素图片,根据自己显示需求和app使用内存情况,可以修改数量
        mLruCache = new LruCache<Integer, BitmapDescriptor>(80) {
            protected void entryRemoved(boolean evicted, Integer key, BitmapDescriptor oldValue, BitmapDescriptor newValue) {
                oldValue.getBitmap().recycle();
            }
        };
        if (clusterItems != null) {
            mClusterItems = clusterItems;
        } else {
            mClusterItems = new ArrayList<ClusterItem>();
        }
        mContext = context;
        mClusters = new ArrayList<Cluster>();
        this.mAMap = amap;
        mClusterSize = clusterSize;
        mPXInMeters = mAMap.getScalePerPixel();
        mClusterDistance = mPXInMeters * mClusterSize;
        amap.setOnCameraChangeListener(this);
        amap.setOnMarkerClickListener(this);
        initThreadHandler();
        assignClusters();
    }
 
Example #10
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 #11
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 #12
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 #13
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 #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_Round_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: GeoFence_Nearby_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);// 设置定位监听
	// 自定义系统定位蓝点
	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 #17
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 #18
Source File: MapActivity.java    From TestChat with Apache License 2.0 5 votes vote down vote up
@Override
public void initView() {
        LogUtil.e("222123213mapInitView");
        send = (Button) findViewById(R.id.btn_map_send);
        back = (Button) findViewById(R.id.btn_map_back);
        display = (MapView) findViewById(R.id.mv_display);
        type = (Button) findViewById(R.id.btn_map_type);
        if (display != null) {
                display.onCreate(savedInstanceState);
        }
        send.setOnClickListener(this);
        back.setOnClickListener(this);
        type.setOnClickListener(this);
        if (mMap == null) {
                mMap = display.getMap();
        }

        mMap.setOnMapLoadedListener(new AMap.OnMapLoadedListener() {
                @Override
                public void onMapLoaded() {
                        mMap.setOnMapLoadedListener(null);
                        LogUtil.e("视图加载完成1111122111");
                        send.setClickable(true);
                        type.setClickable(true);
                        LogUtil.e("1浏览更新");
                        updateMarkerLocation();
                }
        });
}
 
Example #19
Source File: AmapFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
    mAmap.getUiSettings().setScaleControlsEnabled(configInteracter.isShowScaleControl());
    mAmap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mAmap.getUiSettings().setTiltGesturesEnabled(configInteracter.isOverlookEnable());
    mAmap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mAmap.setTrafficEnabled(configInteracter.isTrafficEnable());
    mAmap.getUiSettings().setZoomControlsEnabled(false);
    mAmap.getUiSettings().setIndoorSwitchEnabled(false);
    mAmap.getUiSettings().setCompassEnabled(false);
    if (configInteracter.getNightMode() == 2) {
        setMapType(AMap.MAP_TYPE_NIGHT);
    } else {
        setMapType(AMap.MAP_TYPE_NORMAL);
    }

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    FrameLayout.LayoutParams params2 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 36), ViewGroup.LayoutParams.WRAP_CONTENT);
    FrameLayout.LayoutParams params3 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 40), AppUtils.dip2Px(getActivity(), 40));

    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
        params2.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params2.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        params2.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params2.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    }
    params3.leftMargin = AppUtils.dip2Px(getActivity(), 10);
    params3.topMargin = AppUtils.dip2Px(getActivity(), 90);
    mCardZoom.setLayoutParams(params);
    mCardFloor.setLayoutParams(params2);
    mImageCompass.setLayoutParams(params3);

}
 
Example #20
Source File: AmapSelectPoiFragment.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());

    mAmap.getUiSettings().setScaleControlsEnabled(configInteracter.isShowScaleControl());
    mAmap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mAmap.getUiSettings().setTiltGesturesEnabled(configInteracter.isOverlookEnable());
    mAmap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mAmap.setTrafficEnabled(configInteracter.isTrafficEnable());
    mAmap.getUiSettings().setZoomControlsEnabled(false);
    mAmap.getUiSettings().setIndoorSwitchEnabled(false);
    if (configInteracter.getNightMode() == 2) {
        mAmap.setMapType(AMap.MAP_TYPE_NIGHT);
    } else {
        mAmap.setMapType(AMap.MAP_TYPE_NORMAL);
    }

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);

    FrameLayout.LayoutParams params3 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 40), AppUtils.dip2Px(getActivity(), 40));
    params3.leftMargin = AppUtils.dip2Px(getActivity(), 10);
    params3.topMargin = AppUtils.dip2Px(getActivity(), 50);
    mImageCompass.setLayoutParams(params3);

}
 
Example #21
Source File: DrivingRouteOverlay.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
/**
 * 根据给定的参数,构造一个导航路线图层类对象。
 *
 * @param amap    地图对象。
 * @param path    导航路线规划方案。
 * @param context 当前的activity对象。
 */
public DrivingRouteOverlay(Context context, AMap amap, DrivePath path,
                           LatLonPoint start, LatLonPoint end, List<LatLonPoint> throughPointList) {
    super(context);
    mContext = context;
    mAMap = amap;
    this.drivePath = path;
    startPoint = AMapUtil.convertToLatLng(start);
    endPoint = AMapUtil.convertToLatLng(end);
    this.throughPointList = throughPointList;
}
 
Example #22
Source File: RouteAmapBusActivity.java    From BmapLite with Apache License 2.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(this);
    mAmap.setTrafficEnabled(configInteracter.isTrafficEnable());
    mAmap.getUiSettings().setScaleControlsEnabled(configInteracter.isShowScaleControl());
    mAmap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mAmap.getUiSettings().setTiltGesturesEnabled(configInteracter.isOverlookEnable());
    mAmap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    if (configInteracter.getNightMode() == 2) {
        mAmap.setMapType(AMap.MAP_TYPE_NIGHT);
    } else {
        mAmap.setMapType(AMap.MAP_TYPE_NORMAL);
    }

    mAmap.getUiSettings().setZoomControlsEnabled(false);
    mAmap.getUiSettings().setIndoorSwitchEnabled(false);
    CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(this, 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(this, 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);
    CoordinatorLayout.LayoutParams params3 = new CoordinatorLayout.LayoutParams(AppUtils.dip2Px(this, 40), AppUtils.dip2Px(this, 40));
    params3.leftMargin = AppUtils.dip2Px(this, 10);
    params3.topMargin = AppUtils.dip2Px(this, 10);
    mImageCompass.setLayoutParams(params3);
}
 
Example #23
Source File: AmapRouteFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());

    mAmap.getUiSettings().setScaleControlsEnabled(configInteracter.isShowScaleControl());
    mAmap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mAmap.getUiSettings().setTiltGesturesEnabled(configInteracter.isOverlookEnable());
    mAmap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mAmap.setTrafficEnabled(configInteracter.isTrafficEnable());
    mAmap.getUiSettings().setZoomControlsEnabled(false);
    mAmap.getUiSettings().setIndoorSwitchEnabled(false);
    if (configInteracter.getNightMode() == 2){
        mAmap.setMapType(AMap.MAP_TYPE_NIGHT);
    }else {
        mAmap.setMapType(AMap.MAP_TYPE_NORMAL);
    }

    CoordinatorLayout.LayoutParams params = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);
    CoordinatorLayout.LayoutParams params3 = new CoordinatorLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 40), AppUtils.dip2Px(getActivity(), 40));
    params3.leftMargin = AppUtils.dip2Px(getActivity(), 10);
    params3.topMargin = AppUtils.dip2Px(getActivity(), 10);
    mImageCompass.setLayoutParams(params3);
}
 
Example #24
Source File: AmapSelectPoiFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());

    mAmap.getUiSettings().setScaleControlsEnabled(configInteracter.isShowScaleControl());
    mAmap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mAmap.getUiSettings().setTiltGesturesEnabled(configInteracter.isOverlookEnable());
    mAmap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mAmap.setTrafficEnabled(configInteracter.isTrafficEnable());
    mAmap.getUiSettings().setZoomControlsEnabled(false);
    mAmap.getUiSettings().setIndoorSwitchEnabled(false);
    if (configInteracter.getNightMode() == 2) {
        mAmap.setMapType(AMap.MAP_TYPE_NIGHT);
    } else {
        mAmap.setMapType(AMap.MAP_TYPE_NORMAL);
    }

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    }
    mCardZoom.setLayoutParams(params);

    FrameLayout.LayoutParams params3 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 40), AppUtils.dip2Px(getActivity(), 40));
    params3.leftMargin = AppUtils.dip2Px(getActivity(), 10);
    params3.topMargin = AppUtils.dip2Px(getActivity(), 50);
    mImageCompass.setLayoutParams(params3);

}
 
Example #25
Source File: DrivingRouteOverlay.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 根据给定的参数,构造一个导航路线图层类对象。
 *
 * @param amap    地图对象。
 * @param path    导航路线规划方案。
 * @param context 当前的activity对象。
 */
public DrivingRouteOverlay(Context context, AMap amap, DrivePath path,
                           LatLonPoint start, LatLonPoint end, List<LatLonPoint> throughPointList) {
    super(context);
    mContext = context;
    mAMap = amap;
    this.drivePath = path;
    startPoint = AMapUtil.convertToLatLng(start);
    endPoint = AMapUtil.convertToLatLng(end);
    this.throughPointList = throughPointList;
}
 
Example #26
Source File: AmapWrapper.java    From RunMap with Apache License 2.0 5 votes vote down vote up
public AmapWrapper(AMap aMap){
    this.mAmap = aMap;
    mAmapStateListener = new AMapStateListenerImpl();
    mGeocodeSearch = new GeocodeSearch(GlobalApplication.getAppContext());
    mMapDrawer = new MapDrawer(mAmap);
    initLocationOptions();
    initLocationClient();
}
 
Example #27
Source File: AmapWrapper.java    From RunMap with Apache License 2.0 5 votes vote down vote up
@Override
public void changeMapType() {
    if (mAmap.getMapType() == AMap.MAP_TYPE_NORMAL) {
        mAmap.setMapType(AMap.MAP_TYPE_SATELLITE);
    } else {
        mAmap.setMapType(AMap.MAP_TYPE_NORMAL);
    }
}
 
Example #28
Source File: MovementTrackActivity.java    From RunMap with Apache License 2.0 5 votes vote down vote up
protected void init() {
    AMap amap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
    AmapWrapper amapWrapper = new AmapWrapper(amap);
    mMoveTrackModel = new MoveTrackModel();
    mTrackPresenter = new TrackPresenterImpl(this, mMoveTrackModel, amapWrapper);
    //初始化地图
    mTrackPresenter.initAmap(this);
    mTrackPresenter.registerWXShareAPI(this);
    mTrackPresenter.startForeInfoService(this);

}
 
Example #29
Source File: DrivingRouteOverlay.java    From TraceByAmap with MIT License 5 votes vote down vote up
/**
 * 根据给定的参数,构造一个导航路线图层类对象。
 *
 * @param amap      地图对象。
 * @param path 导航路线规划方案。
 * @param context   当前的activity对象。
 */
public DrivingRouteOverlay(Context context, AMap amap, DrivePath path,
        LatLonPoint start, LatLonPoint end, List<LatLonPoint> throughPointList) {
	super(context);
	mContext = context; 
    mAMap = amap; 
    this.drivePath = path;
    startPoint = AMapUtil.convertToLatLng(start);
    endPoint = AMapUtil.convertToLatLng(end);
    this.throughPointList = throughPointList;
}
 
Example #30
Source File: AmapFragment.java    From BmapLite with GNU General Public License v3.0 5 votes vote down vote up
private void configMap() {
    ConfigInteracter configInteracter = new ConfigInteracter(getActivity());
    mAmap.getUiSettings().setScaleControlsEnabled(configInteracter.isShowScaleControl());
    mAmap.getUiSettings().setZoomGesturesEnabled(configInteracter.isZoomGesturesEnabled());
    mAmap.getUiSettings().setTiltGesturesEnabled(configInteracter.isOverlookEnable());
    mAmap.getUiSettings().setRotateGesturesEnabled(configInteracter.isRotateEnable());
    mAmap.setTrafficEnabled(configInteracter.isTrafficEnable());
    mAmap.getUiSettings().setZoomControlsEnabled(false);
    mAmap.getUiSettings().setIndoorSwitchEnabled(false);
    mAmap.getUiSettings().setCompassEnabled(false);
    if (configInteracter.getNightMode() == 2) {
        setMapType(AMap.MAP_TYPE_NIGHT);
    } else {
        setMapType(AMap.MAP_TYPE_NORMAL);
    }

    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    FrameLayout.LayoutParams params2 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 36), ViewGroup.LayoutParams.WRAP_CONTENT);
    FrameLayout.LayoutParams params3 = new FrameLayout.LayoutParams(AppUtils.dip2Px(getActivity(), 40), AppUtils.dip2Px(getActivity(), 40));

    if (configInteracter.getZoomControlsPosition()) {
        params.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
        params2.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params2.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
    } else {
        params.leftMargin = AppUtils.dip2Px(getActivity(), 10);
        params.gravity = Gravity.CENTER_VERTICAL | Gravity.LEFT;
        params2.rightMargin = AppUtils.dip2Px(getActivity(), 10);
        params2.gravity = Gravity.CENTER_VERTICAL | Gravity.RIGHT;
    }
    params3.leftMargin = AppUtils.dip2Px(getActivity(), 10);
    params3.topMargin = AppUtils.dip2Px(getActivity(), 90);
    mCardZoom.setLayoutParams(params);
    mCardFloor.setLayoutParams(params2);
    mImageCompass.setLayoutParams(params3);

}