Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
p x
MapMultiEngine
Commits
ec6a5728
Commit
ec6a5728
authored
Oct 24, 2025
by
p x
Browse files
录像完整流程
parent
a2c6291e
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
app/src/main/assets/mock/
PerTarget_15
.txt
→
app/src/main/assets/mock/
AvpPre
.txt
View file @
ec6a5728
This source diff could not be displayed because it is too large. You can
view the blob
instead.
app/src/main/assets/mock/Car_fangzhen1.txt
0 → 100644
View file @
ec6a5728
This diff is collapsed.
Click to expand it.
app/src/main/java/com/sd/demo/MainActivity.kt
View file @
ec6a5728
...
...
@@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity
import
com.sd.api.MAP_TYPE
import
com.sd.api.MSDKInitializer
import
com.sd.api.OnSdkInitCb
import
com.sd.api.location.MSLocation
import
com.sd.demo.adapter.DemoListAdapter
import
com.sd.demo.databinding.ActivityMainBinding
import
com.sd.demo.ui.CalculateDistanceActivity
...
...
@@ -54,7 +55,7 @@ class MainActivity : AppCompatActivity() {
private
var
demos
=
listOf
(
DemoDetails
(
"展示地图"
,
DisplayMapActivity
::
class
.
java
),
DemoDetails
(
"切换地图图层"
,
TLayersActivity
::
class
.
java
),
DemoDetails
(
"显示定位蓝点"
,
ShowMyLocLandian
::
class
.
java
),
//
DemoDetails("显示定位蓝点", ShowMyLocLandian::class.java),
DemoDetails
(
"手势控制"
,
GestureDemo
::
class
.
java
),
DemoDetails
(
"改变地图中心点,缩放级别"
,
ChangeMapCenterAct
::
class
.
java
),
DemoDetails
(
"绘制Marker点"
,
TMarkerActivity
::
class
.
java
),
...
...
app/src/main/java/com/sd/demo/ui/PartRoadActivity.kt
View file @
ec6a5728
...
...
@@ -169,7 +169,7 @@ class PartRoadActivity : AppCompatActivity() {
try
{
var
gson
=
Gson
()
val
dst
=
mutableListOf
<
String
>()
FileIoUtils
.
getAssetMock
(
this
@PartRoadActivity
,
"mock/PerTarget
_15
.txt"
,
dst
)
FileIoUtils
.
getAssetMock
(
this
@PartRoadActivity
,
"mock/PerTarget.txt"
,
dst
)
dst
.
forEachIndexed
{
index
,
str
->
val
perceptionBean
=
...
...
app/src/main/java/com/sd/demo/ui/TGpsActivity.kt
View file @
ec6a5728
...
...
@@ -6,6 +6,7 @@ import com.sd.api.location.MSLocCb
import
com.sd.api.location.MSLocation
import
com.sd.api.location.OnMsGpsLoc
import
com.sd.api.maps.DrawInMap
import
com.sd.api.maps.MethodAdv
import
com.sd.api.maps.cdata.MSMarker
import
com.sd.api.ui.MapMultiView.OnMapReadyLis
import
com.sd.api.ui.MapReadyView
...
...
@@ -62,7 +63,7 @@ class TGpsActivity : AppCompatActivity() {
//我的位置
binding
.
bt1
.
setOnClickListener
{
msMark
=
DrawInMap
.
drawMarket
(
mapReadView
,
lat
,
lng
)
//
MS
MethodAdv.setMapCenter(mapReadView, lat, lng)
MethodAdv
.
setMapCenter
(
mapReadView
,
lat
,
lng
)
}
}
...
...
app/src/main/java/com/sd/demo/ui/THighMapActivity.kt
View file @
ec6a5728
...
...
@@ -3,6 +3,7 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
androidx.lifecycle.lifecycleScope
import
androidx.lifecycle.viewModelScope
import
com.google.gson.Gson
import
com.minedata.minenavi.mapdal.LatLng
import
com.minedata.minenavi.util.Tools
...
...
@@ -10,6 +11,7 @@ import com.sd.api.highmap.AllLine
import
com.sd.api.highmap.HighMapApi
import
com.sd.api.highmap.TileJsonBean
import
com.sd.api.highmap.UnityPtc
import
com.sd.api.highmap.WarnPtc
import
com.sd.api.parkroad.PtcBean
import
com.sd.api.ui.MapMultiView.OnMapReadyLis
import
com.sd.api.ui.MapReadyView
...
...
@@ -71,6 +73,8 @@ class THighMapActivity : AppCompatActivity() {
private
fun
setListener
()
{
binding
.
bt1
.
setOnClickListener
{
mockCarMove
()
}
binding
.
bt2
.
setOnClickListener
{
mockPreTarget
()
}
binding
.
bt3
.
setOnClickListener
{
mWarnCar
()
}
binding
.
bt4
.
setOnClickListener
{
mWarnPeo
()
}
}
...
...
@@ -112,7 +116,7 @@ class THighMapActivity : AppCompatActivity() {
lifecycleScope
.
launch
{
var
gson
=
Gson
()
val
dst
=
mutableListOf
<
String
>()
FileIoUtils
.
getAssetMock
(
this
@THighMapActivity
,
"mock/
PerTarget_15
.txt"
,
dst
)
FileIoUtils
.
getAssetMock
(
this
@THighMapActivity
,
"mock/
AvpPre
.txt"
,
dst
)
dst
.
forEachIndexed
{
index
,
str
->
val
perceptionBean
=
gson
.
fromJson
<
PerceptionBean
>(
str
,
PerceptionBean
::
class
.
java
)
...
...
@@ -132,9 +136,54 @@ class THighMapActivity : AppCompatActivity() {
}
}
HighMapApi
.
setPtcData
(
pres
)
delay
(
1000
)
}
}
}
//预警车
fun
mWarnCar
()
{
//气泡消息
startWarning
(
"f117fdfa-feff-0100-85dc-35850000acb0"
)
}
//预警人
fun
mWarnPeo
()
{
startWarning
(
"50332456-3030-3030-3530-303334533955"
)
}
//开启预警特效
fun
startWarning
(
ptcId
:
String
)
{
lifecycleScope
.
launch
{
var
warnPtc
=
WarnPtc
().
apply
{
ptcid
=
ptcId
isRed
=
true
}
var
warns
=
listOf
(
warnPtc
)
HighMapApi
.
setWarnPtc
(
warns
)
delay
(
5000
)
warnPtc
.
isRed
=
false
HighMapApi
.
setWarnPtc
(
warns
)
}
toggleCircleRadar
(
2
)
}
/**开启预警(光圈和雷达)
* @param dirent 0=关闭 1=左前 2=正前 3=右前 4=右后 5=正后 6=左后
* */
fun
toggleCircleRadar
(
dirent
:
Int
)
{
HighMapApi
.
setCarBottomCircle
(
true
)
HighMapApi
.
setCarRadarDirection
(
dirent
)
lifecycleScope
.
launch
{
delay
(
5000
)
HighMapApi
.
setCarBottomCircle
(
false
)
HighMapApi
.
setCarRadarDirection
(
0
)
}
}
}
\ No newline at end of file
app/src/main/java/com/sd/demo/ui/TPoiSearchActivity.kt
View file @
ec6a5728
...
...
@@ -63,6 +63,7 @@ class TPoiSearchActivity : AppCompatActivity() {
keyword
,
//关键字
41.80196
,
123.43326
,
"110115"
,
object
:
OnMSPoiSearchLis
{
override
fun
onPoiLis
(
poiList
:
List
<
PoiSearchRes
>
...
...
app/src/main/java/com/sd/demo/ui/TPolygonActivity.kt
View file @
ec6a5728
...
...
@@ -7,6 +7,7 @@ import com.sd.api.ui.MapReadyView
import
com.sd.api.maps.DelDrawInMap
import
com.sd.api.maps.cdata.MSOverlay
import
com.sd.api.maps.DrawInMap
import
com.sd.api.maps.MethodAdv
import
com.sd.api.ui.MapMultiView.OnMapReadyLis
import
com.sd.demo.databinding.ActivityTpolygonBinding
...
...
@@ -29,15 +30,15 @@ class TPolygonActivity : AppCompatActivity() {
binding
.
mapMultiView
.
addMapRenderCallback
(
object
:
OnMapReadyLis
{
override
fun
onMapReady
(
mapReadyView
:
MapReadyView
)
{
this
@TPolygonActivity
.
mapReadView
=
mapReadyView
// MSMethodAdv.setMapZoom(mapReadView, 9f)
//绘制一个面
var
mspLatLng
=
listOf
<
MSLatLng
>(
MSLatLng
(
39.993391
,
116.135272
),
MSLatLng
(
39.808323
,
116.057604
),
MSLatLng
(
39.904430
,
116.265061
),
MSLatLng
(
39.950192
,
116.140002
)
)
mSOverlay
=
DrawInMap
.
drawPolygon
(
mapReadView
,
mspLatLng
,
true
)
MethodAdv
.
setMapCenter
(
mapReadView
,
39.993391
,
116.135272
)
}
})
...
...
app/src/main/res/layout/activity_display_map.xml
View file @
ec6a5728
...
...
@@ -6,17 +6,17 @@
<com.sd.api.ui.MapMultiView
android:id=
"@+id/mapMultiView"
android:layout_width=
"
300dp
"
android:layout_height=
"
300dp
"
/>
android:layout_width=
"
match_parent
"
android:layout_height=
"
match_parent
"
/>
<!-- <ImageView-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="10dp"-->
<!-- android:src="#784125"/>-->
<com.sd.api.ui.MapMultiView
android:id=
"@+id/mapMultiView2"
android:layout_width=
"200dp"
android:layout_height=
"300dp"
/>
<!--
<com.sd.api.ui.MapMultiView
-->
<!--
android:id="@+id/mapMultiView2"
-->
<!--
android:layout_width="200dp"
-->
<!--
android:layout_height="300dp" />
-->
<!-- <com.sd.api.ui.MapMultiView-->
<!-- android:id="@+id/mapMultiView3"-->
<!-- android:layout_width="match_parent"-->
...
...
app/src/main/res/layout/activity_high_map.xml
View file @
ec6a5728
...
...
@@ -13,7 +13,8 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
>
<Button
android:id=
"@+id/bt1"
...
...
@@ -27,6 +28,18 @@
android:layout_height=
"wrap_content"
android:text=
"感知物"
/>
<Button
android:id=
"@+id/bt3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"预警车"
/>
<Button
android:id=
"@+id/bt4"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"预警人"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
mapapi/build.gradle.kts
View file @
ec6a5728
...
...
@@ -4,8 +4,8 @@ plugins {
id
(
"kotlin-kapt"
)
// kotlin("jvm") version "2.1.10"
id
(
"kotlin-parcelize"
)
id
(
"maven-publish"
)
signing
//
id("maven-publish")
//
signing
// id ("org.jreleaser") version "1.20.0"//JReleaser now has support for publishing via the Central Publisher Portal and can be used via their Gradle plugin integration.
id
(
"org.jetbrains.dokka"
)
version
"2.0.0"
}
...
...
@@ -46,7 +46,7 @@ android {
dependencies
{
api
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
,
"*.aar"
))))
implementation
(
fileTree
(
mapOf
(
"dir"
to
"libs"
,
"include"
to
listOf
(
"*.jar"
,
"*.aar"
))))
implementation
(
libs
.
androidx
.
core
.
ktx
)
implementation
(
libs
.
androidx
.
appcompat
)
implementation
(
libs
.
material
)
...
...
@@ -81,35 +81,35 @@ dependencies {
//version = "1.0"
publishing
{
publications
{
create
<
MavenPublication
>(
"maplib"
)
{
groupId
=
"io.github.killcow"
artifactId
=
"ms-map"
version
=
"1.0.0"
// 如果是Android库模块
artifact
(
layout
.
buildDirectory
.
dir
(
"outputs/aar/maplibrary-release.aar"
))
// 如果是Java库模块
// artifact("$buildDir/libs/your-library.jar")
//发布到本地仓库
repositories
{
maven
{
name
=
"MyRepo"
url
=
uri
(
layout
.
buildDirectory
.
dir
(
"repo"
))
}
}
}
}
}
signing
{
// val signingKey: String=findProperty("signing.keyId")
val
signingPassword
:
String
?
by
project
useInMemoryPgpKeys
(
findProperty
(
"signing.keyId"
).
toString
(),
findProperty
(
"signing.password"
).
toString
())
//publishing {
// publications {
// create<MavenPublication>("maplib") {
// groupId = "io.github.killcow"
// artifactId = "ms-map"
// version = "1.0.0"
//
sign
(
publishing
.
publications
[
"maplib"
])
}
// // 如果是Android库模块
// artifact(layout.buildDirectory.dir("outputs/aar/maplibrary-release.aar"))
// // 如果是Java库模块
// // artifact("$buildDir/libs/your-library.jar")
// //发布到本地仓库
// repositories {
// maven {
// name = "MyRepo"
// url = uri(layout.buildDirectory.dir("repo"))
// }
//
// }
// }
// }
//}
//signing {
//// val signingKey: String=findProperty("signing.keyId")
// val signingPassword: String? by project
// useInMemoryPgpKeys(findProperty("signing.keyId").toString(), findProperty("signing.password").toString())
////
// sign(publishing.publications["maplib"])
//}
mapapi/src/main/java/com/sd/api/MSDKInitializer.kt
View file @
ec6a5728
...
...
@@ -10,6 +10,7 @@ import com.minedata.minenavi.SDKInitializer.InitListener
import
com.minedata.minenavi.mapdal.CoordType
import
com.minedata.minenavi.poiquery.SearchUrlType
import
com.permissionx.guolindev.PermissionX
import
com.sd.api.location.MSLocation
/**
...
...
@@ -88,11 +89,15 @@ object MSDKInitializer {
}
MAP_TYPE
.
MINE
->
{
MSLocation
.
initLoc
()
// 隐私合规接口
SDKInitializer
.
setAgreePrivacy
(
true
)
SDKInitializer
.
debug
(
false
)
SDKInitializer
.
enableEtaLog
(
false
)
SDKInitializer
.
outputLog
(
false
)
//设置地图坐标系
SDKInitializer
.
setCoordType
(
CoordType
.
GCJ02
)
SDKInitializer
.
setSearchUrlType
(
SearchUrlType
.
v1
)
//
SDKInitializer.setCoordType(CoordType.GCJ02)
//
SDKInitializer.setSearchUrlType(SearchUrlType.v1)
// 执行SDK初始化
SDKInitializer
.
initialize
(
ctx
,
object
:
InitListener
{
override
fun
onInitSuccess
()
{
...
...
mapapi/src/main/java/com/sd/api/highmap/HighMapApi.kt
View file @
ec6a5728
...
...
@@ -86,9 +86,7 @@ object HighMapApi {
/**
* 设置告警线
* @param alertLins 路径点
* @param alertType 告警类型 2=红色;3=绿色(绿波);
* 4=(感知车前的红色);5= (拥堵红色、施工红色、
* 人行道红色)alertType=-1 时清空所有警戒线。
* @param alertType 告警类型 2=红色;3=绿色(绿波);4=(感知车前的红色);5= (拥堵红色、施工红色、人行道红色)alertType=-1 时清空所有警戒线。
*/
fun
setAlertPath
(
alertLine
:
List
<
AlertLine
>,
alertType
:
Int
)
{
var
alertPath
=
AlertPath
(
alertLine
,
alertType
)
...
...
mapapi/src/main/java/com/sd/api/location/MSLocation.kt
View file @
ec6a5728
...
...
@@ -9,6 +9,18 @@ import com.sd.api.maps.amap.AmapGpsLocation
*/
object
MSLocation
{
fun
initLoc
(){
when
(
MSDKInitializer
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
MineGpsLocation
.
initLoc
()
}
MAP_TYPE
.
AMAP
->
{
}
}
}
/**
* 开启定位
* 设置GPS定位回调监听器
...
...
mapapi/src/main/java/com/sd/api/location/MineGpsLocation.kt
View file @
ec6a5728
...
...
@@ -27,7 +27,7 @@ object MineGpsLocation {
private
var
onMsGpsLoc
:
OnMsGpsLoc
?
=
null
/**初始化定位*/
private
fun
initLoc
()
{
fun
initLoc
()
{
var
context
=
UserCtx
.
Companion
.
instance
.
mContext
MineLocationManager
.
getInstance
()
.
init
(
context
,
MineLocationManager
.
LocationSource
.
gpsAndNetwork
)
...
...
@@ -38,7 +38,6 @@ object MineGpsLocation {
/**开启定位*/
fun
starLoc
(
onMsGpsLoc
:
OnMsGpsLoc
)
{
initLoc
()
this
.
onMsGpsLoc
=
onMsGpsLoc
MineLocationManager
.
getInstance
().
start
(
options
)
}
...
...
mapapi/src/main/java/com/sd/api/maps/MSPoi.kt
View file @
ec6a5728
...
...
@@ -15,17 +15,19 @@ object MSPoi {
* @param keyWord 关键字
* @param lat 当期维度
* @param lng 当期经度
* @param adCode 行政区编码
* @param onMSPoiSearchLis 搜索回调
*/
fun
startPoiSearch
(
keyWord
:
String
,
lat
:
Double
,
lng
:
Double
,
adCode
:
String
,
onMSPoiSearchLis
:
OnMSPoiSearchLis
){
when
(
MSDKInitializer
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
MinePoiSearch
.
startPoiSearch
(
keyWord
,
lat
,
lng
,
onMSPoiSearchLis
)
MinePoiSearch
.
startPoiSearch
(
keyWord
,
lat
,
lng
,
adCode
,
onMSPoiSearchLis
)
}
MAP_TYPE
.
AMAP
->
{
...
...
@@ -51,7 +53,7 @@ object MSPoi {
){
when
(
MSDKInitializer
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
MinePoiSearch
.
startPoiSearchBound
(
keyWord
,
lat
,
lng
,
radios
,
onMSPoiSearchLis
)
MinePoiSearch
.
startPoiSearchBound
(
keyWord
,
lat
,
lng
,
radios
,
onMSPoiSearchLis
)
}
MAP_TYPE
.
AMAP
->
{
...
...
mapapi/src/main/java/com/sd/api/maps/mine/MineDrawInMap.kt
View file @
ec6a5728
...
...
@@ -37,7 +37,6 @@ object MineDrawInMap {
val
icon
=
BitmapFactory
.
decodeResource
(
context
?.
resources
,
R
.
drawable
.
market_loc
)
val
latLng
=
LatLng
(
lat
,
lng
)
var
options
=
MarkerOptions
()
.
zLevel
(
7
)
.
bitmap
(
icon
)
// 位置坐标
.
position
(
latLng
)
...
...
mapapi/src/main/java/com/sd/api/maps/mine/MinePoiSearch.kt
View file @
ec6a5728
...
...
@@ -29,19 +29,20 @@ object MinePoiSearch : PoiSearch.OnPoiSearchListener {
keyWord
:
String
,
lat
:
Double
=
41.80196
,
lng
:
Double
=
123.43326
,
adCode
:
String
,
onMSPoiSearchLis
:
OnMSPoiSearchLis
)
{
this
.
onMSPoiSearchLis
=
onMSPoiSearchLis
var
context
=
UserCtx
.
Companion
.
instance
.
mContext
val
poiSearch
=
PoiSearch
(
context
)
poiSearch
.
setOnPoiSearchListener
(
this
)
val
query
=
PoiSearch
.
Query
(
keyWord
,
""
,
""
).
apply
{
val
query
=
PoiSearch
.
Query
(
keyWord
,
"
中国
"
,
adCode
).
apply
{
// 设置查询位置点
location
=
LatLonPoint
(
lat
,
lng
)
// 限制严格按照设置城市搜索
setCityLimit
(
false
)
// 设置排序方式为热度排序
setSortType
(
SortType
.
SORT_TYPE_
HIT
)
setSortType
(
SortType
.
SORT_TYPE_
RECOMMEND
)
// 返回父子关系
requireSubPois
(
true
)
pageNum
=
0
...
...
@@ -81,11 +82,11 @@ object MinePoiSearch : PoiSearch.OnPoiSearchListener {
// 设置查询位置点
location
=
LatLonPoint
(
lat
,
lng
)
// 限制严格按照设置城市搜索
setCityLimit
(
tru
e
)
setCityLimit
(
fals
e
)
// 设置排序方式为热度排序
setSortType
(
SortType
.
SORT_TYPE_
HIT
)
setSortType
(
SortType
.
SORT_TYPE_
RECOMMEND
)
// 返回父子关系
requireSubPois
(
tru
e
)
requireSubPois
(
fals
e
)
pageNum
=
0
setPageSize
(
20
)
// 设置每页最多返回多少条poiitem
}
...
...
map
api
/libs/AMap3DMap_10.1.201_AMapNavi_10.1.201_AMapSearch_9.7.4_AMapLocation_6.4.9_20250326.jar
→
map
libs
/libs/AMap3DMap_10.1.201_AMapNavi_10.1.201_AMapSearch_9.7.4_AMapLocation_6.4.9_20250326.jar
View file @
ec6a5728
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment