安卓应用开发学习:通过腾讯地图SDK实现定位功能

一、引言

这几天有些忙,耽误了写日志,但我的学习始终没有落下,有空我就会研究《 Android App 开发进阶与项目实战》一书中定位导航方面的内容。在我的手机上先后实现了“获取经纬度及地理位置描述信息”和“获取导航卫星信息”功能后,这两天,我又参照这书中的内容,实现了通过腾讯地图的Android定位SDK实现定位的功能,并有所扩展。书文以记之。

二、腾讯位置服务平台创建应用

要使用腾讯地图的位置服务,首先要到腾讯位置服务平台(https://lbs.qq.com/)注册一个用户,登录后进入控制台,在应用管理下创建自己的应用,然后添加Key。具体步骤见以下截图:

1.登录打开控制台

2.找到应用管理->我的应用,点击“创建应用”按钮。

3.输入应用的名称,并选择应用类型,确认后生成应用。

4.回到我的应用页面,点击“添加Key”。

5.输入Key名称、描述,勾选“SDK"和”导航SDK“,并在下方的文本框中输入你在Android Studio中要创建应用的包名。

6.完成,生成的Key在Android Studio中集成腾旭地图时要用到。

三、集成腾讯地图

完成上面的操作后,在Android Studio中要对需要使用腾讯位置服务的应用进行设置才能使用腾讯地图的SDK。

1.打开已创建好的Module下的build.gradle文件,在文的依赖中添加腾讯地图组件。

// 腾讯定位
implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.2.8'
// 腾讯地图
implementation 'com.tencent.map:tencent-map-vector-sdk:4.3.9.9'
// 地图组件库
implementation 'com.tencent.map:sdk-utilities:1.0.6'

上述组件的版本并不是最新的,我是照着 《 Android App 开发进阶与项目实战》上输入的,组件的最新版本请到官网查询。

2.在Module的AndroidManifest.xml文件中添加权限配置。

我添加的权限是参考了 《 Android App 开发进阶与项目实战》中的内容,官网给的添加权限(见下方)和我添加的有些不同,但我这边能正常定位,说明有些权限应该是可由可无的。

<!-- 通过GPS得到精确位置 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- 通过网络得到粗略位置 -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<!-- 访问网络,某些位置信息需要从网络服务器获取 -->
<uses-permission android:name="android.permission.INTERNET"/>
<!-- 访问WiFi状态,需要WiFi信息用于网络定位 -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<!-- 修改WiFi状态,发起WiFi扫描, 需要WiFi信息用于网络定位 -->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<!-- 访问网络状态, 检测网络的可用性,需要网络运营商相关信息用于网络定位 -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<!-- 访问网络的变化, 需要某些信息用于网络定位 -->
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<!-- 蓝牙扫描权限 -->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<!-- 前台service权限 -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<!-- 后台定位权限 -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
<!-- A-GPS辅助定位权限,方便GPS快速准确定位 -->
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>

3. 在AndroidManifest.xml文件的application节点中添加一行属性配置:

android:usesCleartextTraffic="true"

4.最后,在AndroidManifest.xml文件的application节点末尾添加名为TencentMapSDK的元数据,之前在官网平台上生成的Key就填在这里。

以上就是我的设置步骤,全部是参考《 Android App 开发进阶与项目实战》中的内容,与官网的步骤有所区别(官网设置连接),但我的应用实现腾讯地图定位没有遇到问题。

四、功能实现

我是参照《 Android App 开发进阶与项目实战》书中9.3.2 显示地图面板 的内容,创建的Activity可以在腾讯地图上显示手机所在的位置,并能在普通地图和卫星地图之间切换,还可以显示交通情况。另外,可以通过手势操作移动地图和缩放地图。其功能与微信中共享位置功能差不多。

 

                (普通地图模式)                                        (卫星地图+显示交通情况模式)

对书中的源码研究后,我决定再扩展一下,增加SDK自带的指南针图标,自己自定义的放大按钮、缩小按钮、回到手机所在位置按钮,另外还自定义一个显示地图中心图标且显示中心经纬度的功能。最终效果如下:

1. 普通地图模式

这是照搬的书中的源码,点击“普通”单选按钮,将地图类型设置为TencentMap.MAP_TYPE_NORMAL。进入地图后默认也是这个类型。关键代码:

private TencentMap mTencentMap; // 声明一个腾讯地图对象
private MapView mMapView; // 声明一个地图视图对象

// onCreate方法中初始化
mMapView = findViewById(R.id.mapView);
mTencentMap = mMapView.getMap(); // 获取腾讯地图对象

// 点击“普通地图”单选按钮后,执行以下语句
mTencentMap.setMapType(TencentMap.MAP_TYPE_NORMAL); // 设置普通地图

2.卫星地图模式

通过点击“卫星”单选按钮触发。关键代码:

// 点击“卫星地图”单选按钮后,执行以下语句
mTencentMap.setMapType(TencentMap.MAP_TYPE_SATELLITE); // 设置卫星地图

3. 显示交通情况

通过点击“交通情况”复选按钮触发,关键代码:

// 点击“交通情况”复选按钮触发
mTencentMap.setTrafficEnabled(isChecked); // 是否显示交通拥堵状况

4. 显示/隐藏中心点标记

这是我自己添加的功能,红色十字图标是一个TextView组件,这个组件与腾讯地图组件MapView都放在一个RelativeLayout布局中,MapView充满整个布局,TextView放在RelativeLayout中心位置。在onCreate方法初始化时,将这个TextView组件隐藏,在勾选了复选框后,才显示,另外“中心点”按钮,也与这个TextView联动,在TextView组件显示时“中心点”按钮可用,在TextView组件隐藏时“中心点”按钮不可用。

关键代码:

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <com.tencent.tencentmap.mapsdk.maps.MapView
            android:id="@+id/mapView"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" />

        <TextView
            android:id="@+id/tv_centerPoint"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:layout_centerInParent="true"
            android:textSize="48sp"
            android:textColor="@color/red"
            android:text="+" />
    </RelativeLayout>
private Button btn_getCenter;  // 获取中心点按钮
private TextView tv_centerPoint; // 中心点标记


// 点“中心点”按钮左侧的复选框后,显示
tv_centerPoint.setVisibility(View.VISIBLE);  // 显示
btn_getCenter.setEnabled(true);  // 可用


// 取消“中心点”按钮左侧的复选框后,隐藏
tv_centerPoint.setVisibility(View.INVISIBLE);  // 隐藏
btn_getCenter.setEnabled(false);  // 不可用

5. 获取中心点位置

在“中心点”按钮左侧的复选框勾选的情况下,点击“中心点”按钮,会显示中心点标识,且获取地图中心点经纬度,并显示在界面中。关键代码如下:

CameraPosition cameraPosition = mTencentMap.getCameraPosition();
mCenterLatLng = cameraPosition.target;
Toast.makeText(this, "中心点坐标:" + mCenterLatLng.latitude + ";" + mCenterLatLng.longitude, Toast.LENGTH_LONG).show();

6. 放大/缩小地图

(点击放大按钮效果)                                        (点击缩小按钮效果)

放大和缩小按钮时参考了其它地图软件上的效果,我自己用带圆角样式的LinearLayout布局包裹了两个TextView组件实现的。这个LinearLayout布局也是放在前面说到的RelativeLayout布局中。LinearLayout布局位于地图组件的右下方向。两个TextView组件设置了OnClick监听器,点击后执行放大和缩小地图操作。关键代码:

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <com.tencent.tencentmap.mapsdk.maps.MapView
            android:id="@+id/mapView"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" />

        <LinearLayout
            android:layout_width="55dp"
            android:layout_height="wrap_content"
            android:layout_above="@+id/mapView"
            android:layout_alignEnd="@+id/mapView"
            android:layout_alignBottom="@+id/mapView"
            android:layout_marginEnd="20dp"
            android:layout_marginBottom="110dp"
            android:background="@drawable/radius_border_15"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_enlarge"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="15dp"
                android:layout_marginBottom="15dp"
                android:gravity="center"
                android:text="+"
                android:textColor="@color/black"
                android:textSize="32sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tv_narrow"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="15dp"
                android:layout_marginBottom="15dp"
                android:gravity="center"
                android:text="-"
                android:textColor="@color/black"
                android:textSize="32sp"
                android:textStyle="bold" />

        </LinearLayout>
    </RelativeLayout>
// 点击放大按钮后执行
mTencentMap.moveCamera(CameraUpdateFactory.zoomIn()); // 放大一级
// 点击缩小按钮后执行
mTencentMap.moveCamera(CameraUpdateFactory.zoomOut()); // 缩小一级

7. 回到手机定位处

在地图中通过手指拖动地图,使手机定位脱离地图中心点后,通过点击“回到手机处”按钮就可以将地图的中心点重新设置为手机定位处,从而让地图中心点快速回到定位处。

这个图标是我从手机的百度地图上截图后,通过PS处理后得到的,保存为PNG格式后,放在项目的res/drawable-xhdpi文件夹下。在xml文件中这个图标放在ImageButton组件中,这个组件外套了一个带圆角的LinearLayout布局。LinearLayout布局放在RelativeLayout布局中,设置在mapView组件的左下方。

关键代码:

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <com.tencent.tencentmap.mapsdk.maps.MapView
            android:id="@+id/mapView"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" />
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/mapView"
            android:layout_alignBottom="@+id/mapView"
            android:background="@drawable/radius_border_15"
            android:layout_marginStart="20dp"
            android:layout_marginBottom="50dp"
            android:orientation="horizontal">

            <ImageButton
                android:id="@+id/img_btn_myPlace"
                android:layout_width="54dp"
                android:layout_height="54dp"
                android:backgroundTint="@color/white"
                android:src="@drawable/ic_my_place"
                tools:ignore="ContentDescription" />
        </LinearLayout>
    </RelativeLayout>
// 点击“中心点”按钮后,执行
CameraPosition cameraPosition = mTencentMap.getCameraPosition();
mCenterLatLng = cameraPosition.target;
Toast.makeText(this, "中心点坐标:" + mCenterLatLng.latitude + ";" + mCenterLatLng.longitude, Toast.LENGTH_LONG).show();
        

8.添加指南针

这是腾讯地图自带的组件,只需要在onCreate方法中添加几行代码就可以:

mTencentMap = mMapView.getMap(); // 获取腾讯地图对象

// 在上面的语句获取到地图对象后,添加以下两行代码
UiSettings mysetting = mTencentMap.getUiSettings();
mysetting.setCompassEnabled(true);  // 开启指南针

五、代码展示

最后上完整的代码,希望对大家有用:

MapBasicActivity.Java文件

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;

import com.tencent.map.geolocation.TencentLocation;
import com.tencent.map.geolocation.TencentLocationListener;
import com.tencent.map.geolocation.TencentLocationManager;
import com.tencent.map.geolocation.TencentLocationRequest;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdate;
import com.tencent.tencentmap.mapsdk.maps.CameraUpdateFactory;
import com.tencent.tencentmap.mapsdk.maps.MapView;
import com.tencent.tencentmap.mapsdk.maps.TencentMap;
import com.tencent.tencentmap.mapsdk.maps.UiSettings;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptor;
import com.tencent.tencentmap.mapsdk.maps.model.BitmapDescriptorFactory;
import com.tencent.tencentmap.mapsdk.maps.model.CameraPosition;
import com.tencent.tencentmap.mapsdk.maps.model.LatLng;
import com.tencent.tencentmap.mapsdk.maps.model.MarkerOptions;

public class MapBasicActivity extends AppCompatActivity implements TencentLocationListener, View.OnClickListener {
    private final static String TAG = "MapBasicActivity";
    private TencentLocationManager mLocationManager; // 声明一个腾讯定位管理器对象
    private MapView mMapView; // 声明一个地图视图对象
    private TencentMap mTencentMap; // 声明一个腾讯地图对象
    private boolean isFirstLoc = true; // 是否首次定位
    private Button btn_getCenter;  // 获取中心点按钮
    private TextView tv_centerPoint; // 中心点标记
    private LatLng mMyLatLng, mCenterLatLng;  // 我的位置, 地图中心位置

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_map_basic);
        initLocation(); // 初始化定位服务
        initView(); // 初始化视图
    }

    // 初始化视图
    private void initView() {
        tv_centerPoint = findViewById(R.id.tv_centerPoint);
        tv_centerPoint.setVisibility(View.INVISIBLE);
        btn_getCenter = findViewById(R.id.btn_getCenter);
        btn_getCenter.setEnabled(false);
        RadioGroup rg_type = findViewById(R.id.rg_type);
        rg_type.setOnCheckedChangeListener((group, checkedId) -> {
            if (checkedId == R.id.rb_common) {
                mTencentMap.setMapType(TencentMap.MAP_TYPE_NORMAL); // 设置普通地图
            } else if (checkedId == R.id.rb_satellite) {
                mTencentMap.setMapType(TencentMap.MAP_TYPE_SATELLITE); // 设置卫星地图
            }
        });
        CheckBox ck_traffic = findViewById(R.id.ck_traffic);
        ck_traffic.setOnCheckedChangeListener((buttonView, isChecked) -> {
            mTencentMap.setTrafficEnabled(isChecked); // 是否显示交通拥堵状况
        });
        CheckBox ck_centerPoint = findViewById(R.id.ck_centerPoint);
        ck_centerPoint.setOnCheckedChangeListener((buttonView, isChecked) -> {
            if (isChecked) {
                tv_centerPoint.setVisibility(View.VISIBLE);
                btn_getCenter.setEnabled(true);
            } else {
                tv_centerPoint.setVisibility(View.INVISIBLE);
                btn_getCenter.setEnabled(false);
            }
        });
        // 设置按钮监听器
        findViewById(R.id.tv_enlarge).setOnClickListener(this);  // 放大地图
        findViewById(R.id.tv_narrow).setOnClickListener(this);  // 缩小地图
        findViewById(R.id.img_btn_myPlace).setOnClickListener(this);  // 回到我的位置
        findViewById(R.id.btn_getCenter).setOnClickListener(this);  // 获取中心点
        btn_getCenter.setOnClickListener(this);  // 获取中心点
    }

    // 初始化定位服务
    private void initLocation() {
        mMapView = findViewById(R.id.mapView);
        mTencentMap = mMapView.getMap(); // 获取腾讯地图对象
        UiSettings mysetting = mTencentMap.getUiSettings();
        mysetting.setCompassEnabled(true);  // 开启指南针
        mLocationManager = TencentLocationManager.getInstance(this);
        // 创建腾讯定位请求对象
        TencentLocationRequest request = TencentLocationRequest.create();
        request.setInterval(30000).setAllowGPS(true);
        request.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_ADMIN_AREA);
        mLocationManager.requestLocationUpdates(request, this); // 开始定位监听
    }

    @Override
    public void onLocationChanged(TencentLocation location, int resultCode, String resultDesc) {
        if (resultCode == TencentLocation.ERROR_OK) { // 定位成功
            if (location != null && isFirstLoc) { // 首次定位
                isFirstLoc = false;
                // 创建一个经纬度对象
                mMyLatLng = new LatLng(location.getLatitude(), location.getLongitude());
                CameraUpdate update = CameraUpdateFactory.newLatLngZoom(mMyLatLng, 12);
                mTencentMap.moveCamera(update); // 把相机视角移动到指定地点
                // 从指定图片中获取位图描述
                BitmapDescriptor bitmapDesc = BitmapDescriptorFactory
                        .fromResource(R.drawable.icon_locate);
                MarkerOptions ooMarker = new MarkerOptions(mMyLatLng).draggable(false) // 不可拖动
                        .visible(true).icon(bitmapDesc).snippet("这是您的当前位置");
                mTencentMap.addMarker(ooMarker); // 往地图添加标记
            }
        } else { // 定位失败
            Log.d(TAG, "定位失败,错误代码为"+resultCode+",错误描述为"+resultDesc);
        }
    }

    @Override
    public void onStatusUpdate(String s, int i, String s1) {}
    // 绑定生命周期
    @Override
    protected void onStart() {
        super.onStart();
        mMapView.onStart();
    }

    @Override
    protected void onStop() {
        super.onStop();
        mMapView.onStop();
    }

    @Override
    public void onPause() {
        super.onPause();
        mMapView.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
        mMapView.onResume();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mLocationManager.removeUpdates(this); // 移除定位监听
        mMapView.onDestroy();
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.tv_enlarge) {  // 放大地图
            mTencentMap.moveCamera(CameraUpdateFactory.zoomIn()); // 放大一级
        } else if (v.getId() == R.id.tv_narrow) {  // 缩小地图
            mTencentMap.moveCamera(CameraUpdateFactory.zoomOut()); // 缩小一级
        } else if (v.getId() == R.id.img_btn_myPlace) {  // 回到我的位置
            CameraUpdate update = CameraUpdateFactory.newLatLng(mMyLatLng);
            mTencentMap.moveCamera(update); // 把相机视角移动到指定地点
        } else if (v.getId() == R.id.btn_getCenter) {  // 获取中心点坐标
            CameraPosition cameraPosition = mTencentMap.getCameraPosition();
            mCenterLatLng = cameraPosition.target;
            Toast.makeText(this, "中心点坐标:" + mCenterLatLng.latitude + ";" + mCenterLatLng.longitude, Toast.LENGTH_LONG).show();
        }
    }
}

activity_map_basic.xml文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MapBasicActivity">

    <RadioGroup
        android:id="@+id/rg_type"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <RadioButton
            android:id="@+id/rb_common"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:checked="true"
            android:text="普通"
            android:textColor="@color/black"
            android:textSize="17sp" />

        <RadioButton
            android:id="@+id/rb_satellite"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:checked="false"
            android:text="卫星"
            android:textColor="@color/black"
            android:textSize="17sp" />

        <CheckBox
            android:id="@+id/ck_traffic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:checked="false"
            android:text="交通情况"
            android:textColor="@color/black"
            android:textSize="17sp" />

        <CheckBox
            android:id="@+id/ck_centerPoint"
            android:layout_width="35dp"
            android:layout_height="wrap_content"
            android:layout_marginStart="10dp"
            android:checked="false"
            android:text=""
            android:textColor="@color/black"
            android:textSize="17sp" />

        <Button
            android:id="@+id/btn_getCenter"
            android:layout_width="80dp"
            android:layout_height="wrap_content"
            android:text="中心点"/>
    </RadioGroup>


    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >

        <com.tencent.tencentmap.mapsdk.maps.MapView
            android:id="@+id/mapView"
            android:layout_width="match_parent"
            android:layout_height="fill_parent" />

        <LinearLayout
            android:layout_width="55dp"
            android:layout_height="wrap_content"
            android:layout_above="@+id/mapView"
            android:layout_alignEnd="@+id/mapView"
            android:layout_alignBottom="@+id/mapView"
            android:layout_marginEnd="20dp"
            android:layout_marginBottom="110dp"
            android:background="@drawable/radius_border_15"
            android:orientation="vertical">

            <TextView
                android:id="@+id/tv_enlarge"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="15dp"
                android:layout_marginBottom="15dp"
                android:gravity="center"
                android:text="+"
                android:textColor="@color/black"
                android:textSize="32sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/tv_narrow"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="15dp"
                android:layout_marginBottom="15dp"
                android:gravity="center"
                android:text="-"
                android:textColor="@color/black"
                android:textSize="32sp"
                android:textStyle="bold" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignStart="@+id/mapView"
            android:layout_alignBottom="@+id/mapView"
            android:background="@drawable/radius_border_15"
            android:layout_marginStart="20dp"
            android:layout_marginBottom="50dp"
            android:orientation="horizontal">

            <ImageButton
                android:id="@+id/img_btn_myPlace"
                android:layout_width="54dp"
                android:layout_height="54dp"
                android:backgroundTint="@color/white"
                android:src="@drawable/ic_my_place"
                tools:ignore="ContentDescription" />
        </LinearLayout>

        <TextView
            android:id="@+id/tv_centerPoint"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:layout_centerInParent="true"
            android:textSize="48sp"
            android:textColor="@color/red"
            android:text="+" />

    </RelativeLayout>

</LinearLayout>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/764948.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

java基于ssm+vue 病人跟踪治疗信息管理系统

1病人功能模块 病人登录进入病人跟踪治疗信息管理系统可以查看首页、个人中心、病例采集管理、预约管理、医生管理、上传核酸检测报告管理、上传行动轨迹管理、病人治疗状况管理等内容。 病例采集管理&#xff0c;在病例采集管理页面可以查看账号、姓名、住院号、入院时间、病…

git 禁止dev合并到任何其他分支

创建 pre-merge-commit 钩子 导航到 Git 仓库的钩子目录&#xff1a; cd /path/to/your/repo/.git/hooks创建或编辑 pre-merge-commit 钩子&#xff1a; 也可以通过指令创建 nano pre-merge-commit在钩子文件中添加以下代码&#xff1a; #!/bin/sh# 获取当前分支名称 curr…

成人职场商务英语学习柯桥外语学校|邮件中的“备注”用英语怎么说?

在英语中&#xff0c;"备注"通常可以翻译为"Notes" 或 "Remarks"。 这两个词在邮件中都很常用。例如: 1. Notes Notes: 是最通用和最常见的表达&#xff0c;可以用在各种情况下&#xff0c;例如&#xff1a; 提供有关电子邮件内容的附加信息 列…

hive中cast()函数

CAST函数用于将某种数据类型的表达式显式转换为另一种数据类型。CAST()函数的参数是一个表达式&#xff0c;它包括用AS关键字分隔的源值和目标数据类型。 语法&#xff1a;CAST (expression AS data_type) expression&#xff1a;任何有效的SQServer表达式。 AS&#xff1a;用…

软降工程学系统实现

一、程序编码 程序编码是设计的继续&#xff0c;将软件设计的结果翻译成用某种程序设计语言描述的源代码。 程序编码涉及到方法、工具和过程。 程序设计风格和程序设计语言的特性会深刻地影响软件的质量和可维护性。 要求源程序具有良好的结构性和设计风格。 程序设计风格…

2024.7.2作业

1. 梳理笔记(原创&#xff01;&#xff01;&#xff01;) 2.解析代码&#xff1a;分析每一步变量的取值 #include <stdio.h> int main(int argc, char *argv[]) { int a 10; //a10 int b a--; //b10 int c a b 2; //a9 b10 c21 int d (b--…

VisualRules组件功能介绍-计算表格(二)

本章内容 1、计算表格数据回写数据库 2、计算表格数据更新 3、计算表格数据汇总 4、计算表格数据追加 一、计算表格数据回写数据库 计算表格数据回写数据库表。采用遍历计算表格逐条插入数据库表。在具体操作过程可以采用向导方式操作。 先在数据库表中创建tb_user_new表。…

Java语法系列 小白入门参考资料 方法

方法的概念及使用 方法概念 方法出现的原因 在编程中&#xff0c;某段功能的代码可能频繁使用到&#xff0c;如果在每个位置都重新实现一遍&#xff0c;会&#xff1a; 1. 使程序变得繁琐 2. 开发效率低下&#xff0c;做了大量重复性的工作 3. 不利于维护&#xff0c;需要…

Load Tensor to local Nvidia GPU

0. 安装Nvidia驱动 ubuntu24.04的安装非常简单&#xff0c;在安装界面&#xff0c;选择为"图形化和其他硬件安装驱动"&#xff0c;重启后即有原版Nvidia驱动(如图Nvidia X xxx) 1.确定电脑上是否有NvidiaGPU且安装好Nvidia驱动 import torch print(torch.version…

DSSAT作物模建模实践方法

随着数字农业和智慧农业的发展&#xff0c;基于过程的作物生长模型&#xff08;Process-based Crop Growth Simulation Model&#xff09;在模拟作物对气候变化的响应与适应、农田管理优化、作物品种和株型筛选、农业碳中和、农田固碳减排等领域扮演着越来越重要的作用。Decisi…

BMA580 运动传感器

型号简介 BMA580是博世&#xff08;bosch-sensortec&#xff09;的一款先进的、超小型加速度传感器。具有独特的骨传导语音活动检测功能和先进的功率模式功能&#xff0c;是世界上最小的加速度传感器&#xff08;1.2 x 0.8 x 0.55 mm&#xff09;。它专为紧凑型设备&#xff08…

[C++]——同步异步日志系统(1)

同步异步日志系统 一、项⽬介绍二、开发环境三、核心技术四、环境搭建五、日志系统介绍5.1 为什么需要日志系统5.2 日志系统技术实现5.2.1 同步写日志5.2.2 异步写日志 日志系统&#xff1a; 日志&#xff1a;程序在运行过程中&#xff0c;用来记录程序运行状态信息。 作用&…

OpenSSH远程代码执行漏洞 (CVE-2024-6387)

1. 前言 OpenSSH是一套基于安全外壳&#xff08;SSH&#xff09;协议的安全网络实用程序&#xff0c;它提供强大的加密功能以确保隐私和安全的文件传输&#xff0c;使其成为远程服务器管理和安全数据通信的必备工具。 OpenSSH 自 1995 年问世近 20 年来&#xff0c;首次出现了…

基于STM32的卫星GPS路径记录仪

目录 引言环境准备卫星GPS路径记录仪基础代码实现&#xff1a;实现卫星GPS路径记录仪 4.1 数据采集模块4.2 数据处理与分析4.3 存储系统实现4.4 用户界面与数据可视化应用场景&#xff1a;路径记录与分析问题解决方案与优化收尾与总结 1. 引言 卫星GPS路径记录仪通过使用STM…

【基础算法总结】分治—快排

分治—快排 1.分治2.颜色分类3.排序数组4.数组中的第K个最大元素5.库存管理 III 点赞&#x1f44d;&#x1f44d;收藏&#x1f31f;&#x1f31f;关注&#x1f496;&#x1f496; 你的支持是对我最大的鼓励&#xff0c;我们一起努力吧!&#x1f603;&#x1f603; 1.分治 分治…

怎么在线批量改图片尺寸?快速在线改图片尺寸的4款工具

目前图片是日常经常会使用的一种内容展示&#xff0c;想要快速的分享图片会在很多不同平台上传使用&#xff0c;通过这种方式让其他人能够获取图片内容。在平台上传图片的时候&#xff0c;经常会限制图片尺寸的大小&#xff0c;如果需要将多张图片改成同一尺寸时&#xff0c;有…

实战项目——用Java实现图书管理系统

前言 首先既然是管理系统&#xff0c;那咱们就要实现以下这几个功能了--> 分析 1.首先是用户分为两种&#xff0c;一个是管理员&#xff0c;另一个是普通用户&#xff0c;既如此&#xff0c;可以定义一个用户类&#xff08;user&#xff09;&#xff0c;在定义管理员类&am…

APKDeepLens:一款针对Android应用程序的安全扫描工具

关于APKDeepLens APKDeepLens是一款针对Android应用程序的安全扫描工具&#xff0c;该工具基于Python开发&#xff0c;旨在扫描和识别Android应用程序&#xff08;APK文件&#xff09;中的安全漏洞。 APKDeepLens主要针对的是OWASP Top 10移动端安全漏洞&#xff0c;并为开发人…

从零开始使用 Docsify 搭建文档站点

引言 在当今的技术环境中&#xff0c;拥有一份易于访问和美观的文档是至关重要的。Docsify 是一个非常适合快速搭建文档站点的工具&#xff0c;它简单易用&#xff0c;且不需要生成静态文件。本文将带你一步步从零开始使用 Docsify 搭建一个文档站点。 1. 安装 Node.js 和 np…

竞赛 深度学习 python opencv 火焰检测识别

文章目录 0 前言1 基于YOLO的火焰检测与识别2 课题背景3 卷积神经网络3.1 卷积层3.2 池化层3.3 激活函数&#xff1a;3.4 全连接层3.5 使用tensorflow中keras模块实现卷积神经网络 4 YOLOV54.1 网络架构图4.2 输入端4.3 基准网络4.4 Neck网络4.5 Head输出层 5 数据集准备5.1 数…