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
c0a4d214
Commit
c0a4d214
authored
Dec 30, 2025
by
p x
Browse files
修改类名让人好懂
parent
c6545628
Changes
42
Show whitespace changes
Inline
Side-by-side
app/src/main/java/com/sd/demo/adapter/PoiAdapter.kt
View file @
c0a4d214
...
...
@@ -11,8 +11,8 @@ import android.view.ViewGroup
import
androidx.core.text.set
import
androidx.recyclerview.widget.RecyclerView
import
com.chad.library.adapter4.BaseQuickAdapter
import
com.cusc.map.maps.
MS
CalcuMapUtil
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.CalcuMapUtil
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.maps.cdata.PoiSearchRes
import
com.sd.demo.databinding.PoiSearchListItemBinding
...
...
@@ -60,9 +60,9 @@ class PoiAdapter : BaseQuickAdapter<PoiSearchRes, PoiAdapter.PoiSH>() {
binding
.
poiDes
.
text
=
bean
.
snippet
// binding.tvDistan.text=bean.distance.toString()
// 计算2点距离
var
latLng1
=
MS
LatLng
(
39.787678
,
116.518766
)
var
latLng2
=
MS
LatLng
(
bean
.
lat
,
bean
.
lng
)
var
dis
=
MS
CalcuMapUtil
.
calculateLineDistance
(
latLng1
,
latLng2
)
var
latLng1
=
LatLng
M
(
39.787678
,
116.518766
)
var
latLng2
=
LatLng
M
(
bean
.
lat
,
bean
.
lng
)
var
dis
=
CalcuMapUtil
.
calculateLineDistance
(
latLng1
,
latLng2
)
binding
.
tvDistan
.
text
=
"${dis}米"
}
...
...
app/src/main/java/com/sd/demo/ui/CalculateDistanceActivity.kt
View file @
c0a4d214
...
...
@@ -2,9 +2,9 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.maps.
MS
CalcuMapUtil
import
com.cusc.map.maps.CalcuMapUtil
import
com.cusc.map.ui.MapView.OnMapReadyLis
import
com.sd.demo.utils.ToastHelper
import
com.sd.demo.databinding.ActivityCalculateDistanceBinding
...
...
@@ -29,16 +29,16 @@ class CalculateDistanceActivity : AppCompatActivity() {
//计算2点距离
binding
.
bt1
.
setOnClickListener
{
var
latLng1
=
MS
LatLng
(
var
latLng1
=
LatLng
M
(
binding
.
et1
.
text
.
toString
().
toDouble
(),
binding
.
et2
.
text
.
toString
().
toDouble
()
)
var
latLng2
=
MS
LatLng
(
var
latLng2
=
LatLng
M
(
binding
.
et3
.
text
.
toString
().
toDouble
(),
binding
.
et4
.
text
.
toString
().
toDouble
()
)
// 计算2点距离
var
dis
=
MS
CalcuMapUtil
.
calculateLineDistance
(
latLng1
,
latLng2
)
var
dis
=
CalcuMapUtil
.
calculateLineDistance
(
latLng1
,
latLng2
)
println
(
"----计算2点距离 = ${dis}米"
)
ToastHelper
.
showShort
(
this
@CalculateDistanceActivity
,
"距离= ${dis}米"
)
}
...
...
app/src/main/java/com/sd/demo/ui/OnLineMapActivity.kt
View file @
c0a4d214
...
...
@@ -4,9 +4,9 @@ import android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
androidx.lifecycle.lifecycleScope
import
com.google.gson.Gson
import
com.cusc.map.maps.
MS
CalcuMapUtil
import
com.cusc.map.maps.CalcuMapUtil
import
com.cusc.map.maps.MethodAdv
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.scenario.CucsVehicle
import
com.cusc.map.scenario.bean.VehiclePos
import
com.cusc.map.ui.MapView.OnMapReadyLis
...
...
@@ -77,9 +77,9 @@ class OnLineMapActivity : AppCompatActivity() {
var
p1
=
mRoutes
.
rs
.
get
(
index
-
1
)
var
pc
=
mRoutes
.
rs
.
get
(
index
)
//计算航向角
head
=
MS
CalcuMapUtil
.
calculateBearing
(
MS
LatLng
(
p1
[
1
],
p1
[
0
]),
MS
LatLng
(
pc
[
1
],
pc
[
0
])
head
=
CalcuMapUtil
.
calculateBearing
(
LatLng
M
(
p1
[
1
],
p1
[
0
]),
LatLng
M
(
pc
[
1
],
pc
[
0
])
)
//构造车辆位置数据
VehiclePos
.
instance
.
apply
{
...
...
app/src/main/java/com/sd/demo/ui/PartRoadActivity.kt
View file @
c0a4d214
...
...
@@ -5,13 +5,10 @@ import androidx.appcompat.app.AppCompatActivity
import
androidx.lifecycle.lifecycleScope
import
com.cusc.map.ui.MapReadyView
import
com.google.gson.Gson
import
com.cusc.map.parkroad.RoadPos
import
com.cusc.map.maps.MSCalcuMapUtil
import
com.cusc.map.maps.cdata.MSLatLng
import
com.cusc.map.maps.CalcuMapUtil
import
com.cusc.map.maps.cdata.LatLngM
import
com.cusc.map.parkroad.MsParkRoad
import
com.cusc.map.parkroad.OnPrAddCar
import
com.cusc.map.parkroad.PartType
import
com.cusc.map.parkroad.PtcBean
import
com.cusc.map.scenario.CucsVehicle
import
com.cusc.map.scenario.PerceptionManager
import
com.cusc.map.scenario.V2xWarn
...
...
@@ -141,9 +138,9 @@ class PartRoadActivity : AppCompatActivity() {
if
(
index
>
0
)
{
var
p1
=
mRoutes
.
rs
.
get
(
index
-
1
)
var
pc
=
mRoutes
.
rs
.
get
(
index
)
head
=
MS
CalcuMapUtil
.
calculateBearing
(
MS
LatLng
(
p1
[
1
],
p1
[
0
]),
MS
LatLng
(
pc
[
1
],
pc
[
0
])
head
=
CalcuMapUtil
.
calculateBearing
(
LatLng
M
(
p1
[
1
],
p1
[
0
]),
LatLng
M
(
pc
[
1
],
pc
[
0
])
)
VehiclePos
.
instance
.
apply
{
lat
=
pc
[
1
]
...
...
app/src/main/java/com/sd/demo/ui/ShowCarOnlineActivity.kt
View file @
c0a4d214
...
...
@@ -3,11 +3,9 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.activity.enableEdgeToEdge
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.cdata.MSLatLng
import
com.cusc.map.location.MSLocCb
import
com.cusc.map.maps.cdata.LatLngM
import
com.cusc.map.core.MShowMainCarModel
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.location.OnMsGpsLoc
import
com.cusc.map.ui.MapView.OnMapReadyLis
import
com.sd.demo.databinding.ActivityShowCarOnlineBinding
...
...
@@ -30,7 +28,7 @@ class ShowCarOnlineActivity : AppCompatActivity() {
override
fun
onMapReady
(
mapReadyView
:
MapReadyView
)
{
this
@ShowCarOnlineActivity
.
mapReadView
=
mapReadyView
//地图加载完成后添加小车
var
center
=
MS
LatLng
(
39.787678
,
116.518766
)
var
center
=
LatLng
M
(
39.787678
,
116.518766
)
// MSMethodAdv.setMapCenter(mapReadView,center.lat, center.lng)
MShowMainCarModel
.
addMyLocCarModel
(
mapReadView
,
...
...
app/src/main/java/com/sd/demo/ui/TCircelActivity.kt
View file @
c0a4d214
...
...
@@ -4,10 +4,10 @@ import android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.maps.DelDrawInMap
import
com.cusc.map.maps.cdata.M
S
Overlay
import
com.cusc.map.maps.cdata.M
ap
Overlay
import
com.cusc.map.maps.DrawInMap
import
com.cusc.map.maps.MsCircleOptions
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.ui.MapView.OnMapReadyLis
import
com.sd.demo.databinding.ActivityTcircelBinding
...
...
@@ -19,7 +19,7 @@ class TCircelActivity : AppCompatActivity() {
var
mapReadView
:
MapReadyView
?
=
null
//圆形覆盖物对象
private
var
mSOverlay
:
M
S
Overlay
?
=
null
private
var
mSOverlay
:
M
ap
Overlay
?
=
null
//获取接口功能实例
// var mapCoreApi = MapCoreApi.mapCoreApi
...
...
@@ -34,7 +34,7 @@ class TCircelActivity : AppCompatActivity() {
this
@TCircelActivity
.
mapReadView
=
mapReadyView
//绘制一个圆形 116.3975,39.9079
var
center
=
MS
LatLng
(
39.9079
,
116.3975
)
var
center
=
LatLng
M
(
39.9079
,
116.3975
)
//构造圆形绘制选型
var
msCircleOptions
=
MsCircleOptions
()
mSOverlay
=
DrawInMap
.
drawCircle
(
center
,
msCircleOptions
)
...
...
app/src/main/java/com/sd/demo/ui/TDriveRouteActivity.kt
View file @
c0a4d214
...
...
@@ -14,9 +14,9 @@ import com.minedata.minenavi.util.Tools
import
com.cusc.map.bean.DriverRouteBean
import
com.cusc.map.bean.WayPoi
import
com.cusc.map.intfaces.OnNaviPresenterListener
import
com.cusc.map.maps.
MS
Navi
import
com.cusc.map.maps.
MSRoutePlans
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.Navi
gate
import
com.cusc.map.maps.
PathPlanning
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.maps.inters.OnDriveRoute
import
com.cusc.map.maps.mine.MineNai
import
com.cusc.map.maps.mine.MineRoutePlans
...
...
@@ -48,9 +48,9 @@ class TDriveRouteActivity : AppCompatActivity(), OnNaviPresenterListener {
binding
.
starplan
.
setOnClickListener
{
if
(
mapReadView
==
null
)
return
@setOnClickListener
// 起点坐标
val
startPoint
=
MS
LatLng
(
39.80715003487552
,
116.49872416608724
)
//
val
startPoint
=
LatLng
M
(
39.80715003487552
,
116.49872416608724
)
//
// 终点坐标
val
endPoint
=
MS
LatLng
(
39.80841750846264
,
116.49490649028968
)
val
endPoint
=
LatLng
M
(
39.80841750846264
,
116.49490649028968
)
// 终点名称
// val endName = "沈阳火车站"
val
endName
=
"林肯公园B区"
...
...
@@ -60,12 +60,12 @@ class TDriveRouteActivity : AppCompatActivity(), OnNaviPresenterListener {
//途经点
var
wayPoi
=
WayPoi
(
passName
=
"中国联通软件研究院"
,
passPoint
=
MS
LatLng
(
39.808099975017825
,
116.50229613984811
)
passPoint
=
LatLng
M
(
39.808099975017825
,
116.50229613984811
)
)
var
ways
=
listOf
<
WayPoi
>(
wayPoi
)
//开始路径规划
MSRoutePlans
.
drivingPathPlanning
(
PathPlanning
.
drivingPathPlanning
(
startPoint
,
"当前位置"
,
endPoint
,
...
...
@@ -77,12 +77,12 @@ class TDriveRouteActivity : AppCompatActivity(), OnNaviPresenterListener {
var
mRouteBase
=
driverRouteBean
.
routeBase
var
size
=
mRouteBase
?.
segmentNumber
?:
0
if
(
size
>
2
)
{
var
pos
=
mutableListOf
<
MS
LatLng
>()
var
pos
=
mutableListOf
<
LatLng
M
>()
for
(
i
in
0
until
size
)
{
var
pointArr
=
mRouteBase
!!
.
getSegmentFinePoints
(
i
)
var
points
=
pointArr
.
map
{
var
po
=
Tools
.
pointToLatLng
(
it
)
var
ms
=
MS
LatLng
(
po
.
latitude
,
po
.
longitude
)
var
ms
=
LatLng
M
(
po
.
latitude
,
po
.
longitude
)
return
@map
ms
}
pos
.
addAll
(
points
)
...
...
@@ -101,24 +101,24 @@ class TDriveRouteActivity : AppCompatActivity(), OnNaviPresenterListener {
}
//导航对象初始化
MS
Navi
.
init
()
Navi
gate
.
init
()
//直接开始导航
binding
.
starnai
.
setOnClickListener
{
if
(
mapReadView
==
null
)
return
@setOnClickListener
// 起点坐标 116.3215,39.8919
val
startPoint
=
MS
LatLng
(
39.806898
,
116.490682
)
val
startPoint
=
LatLng
M
(
39.806898
,
116.490682
)
// 终点坐标116.3793,39.8643
val
endPoint
=
MS
LatLng
(
39.864311
,
116.379311
)
val
endPoint
=
LatLng
M
(
39.864311
,
116.379311
)
// 终点名称
val
endName
=
"沈阳火车站"
//途经点
var
wayPoi
=
WayPoi
(
passName
=
"鸟巢"
,
passPoint
=
MS
LatLng
(
39.99300
,
116.39524
)
passName
=
"鸟巢"
,
passPoint
=
LatLng
M
(
39.99300
,
116.39524
)
)
var
ways
=
listOf
<
WayPoi
>(
wayPoi
)
MS
Navi
.
startNavi
(
Navi
gate
.
startNavi
(
mapReadView
,
2
/*1=自己实现回调 2=直接调用导航组件*/
,
startPoint
,
...
...
@@ -132,8 +132,8 @@ class TDriveRouteActivity : AppCompatActivity(), OnNaviPresenterListener {
//模拟导航
binding
.
simnai
.
setOnClickListener
{
// 起点坐标
val
startPoint
=
MS
LatLng
(
39.80715003487552
,
116.49872416608724
)
MS
Navi
.
startSimNavi
(
val
startPoint
=
LatLng
M
(
39.80715003487552
,
116.49872416608724
)
Navi
gate
.
startSimNavi
(
this
@TDriveRouteActivity
.
mapReadView
,
startPoint
,
driverRouteBean
,
...
...
@@ -142,7 +142,7 @@ class TDriveRouteActivity : AppCompatActivity(), OnNaviPresenterListener {
}
//退出导航
binding
.
stopnai
.
setOnClickListener
{
MS
Navi
.
endNavi
()
Navi
gate
.
endNavi
()
}
}
...
...
app/src/main/java/com/sd/demo/ui/TGpsActivity.kt
View file @
c0a4d214
...
...
@@ -7,7 +7,7 @@ import com.cusc.map.location.MSLocation
import
com.cusc.map.location.OnMsGpsLoc
import
com.cusc.map.maps.DrawInMap
import
com.cusc.map.maps.MethodAdv
import
com.cusc.map.maps.cdata.
MS
Marker
import
com.cusc.map.maps.cdata.Marker
M
import
com.cusc.map.ui.MapView.OnMapReadyLis
import
com.cusc.map.ui.MapReadyView
import
com.sd.demo.databinding.ActivityTgpsBinding
...
...
@@ -19,7 +19,7 @@ class TGpsActivity : AppCompatActivity() {
var
mapReadView
:
MapReadyView
?
=
null
var
msMark
:
MS
Marker
?
=
null
var
msMark
:
Marker
M
?
=
null
var
lat
=
0.0
var
lng
=
0.0
...
...
app/src/main/java/com/sd/demo/ui/THighMapActivity.kt
View file @
c0a4d214
...
...
@@ -7,10 +7,8 @@ import com.google.gson.Gson
import
com.cusc.map.highmap.AllLine
import
com.cusc.map.highmap.CarNavPath
import
com.cusc.map.highmap.HighMap
import
com.cusc.map.highmap.UnityPtc
import
com.cusc.map.highmap.WarnPtc
import
com.cusc.map.maps.MSCalcuMapUtil
import
com.cusc.map.maps.cdata.MSLatLng
import
com.cusc.map.maps.CalcuMapUtil
import
com.cusc.map.maps.cdata.LatLngM
import
com.cusc.map.scenario.CucsVehicle
import
com.cusc.map.scenario.PerceptionManager
import
com.cusc.map.scenario.V2xWarn
...
...
@@ -84,9 +82,9 @@ class THighMapActivity : AppCompatActivity() {
if
(
index
>
0
)
{
var
p1
=
mRoutes
.
rs
.
get
(
index
-
1
)
var
pc
=
mRoutes
.
rs
.
get
(
index
)
head
=
MS
CalcuMapUtil
.
calculateBearing
(
MS
LatLng
(
p1
[
1
],
p1
[
0
]),
MS
LatLng
(
pc
[
1
],
pc
[
0
])
head
=
CalcuMapUtil
.
calculateBearing
(
LatLng
M
(
p1
[
1
],
p1
[
0
]),
LatLng
M
(
pc
[
1
],
pc
[
0
])
)
if
((
head
-
oldHead
).
absoluteValue
<
45
)
{
bearing
=
head
...
...
app/src/main/java/com/sd/demo/ui/TLayersActivity.kt
View file @
c0a4d214
...
...
@@ -3,7 +3,7 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.
MS
Layer
import
com.cusc.map.maps.Layer
Opt
import
com.cusc.map.ui.MapView.OnMapReadyLis
import
com.cusc.map.ui.MapReadyView
import
com.sd.demo.R
...
...
@@ -36,11 +36,11 @@ class TLayersActivity : AppCompatActivity() {
binding
.
rg
.
setOnCheckedChangeListener
{
group
,
checkedId
->
when
(
checkedId
)
{
R
.
id
.
rb1
->
{
//普通
MS
Layer
.
toggleLayers
(
1
)
Layer
Opt
.
toggleLayers
(
1
)
}
R
.
id
.
rb2
->
{
//卫星
MS
Layer
.
toggleLayers
(
2
)
Layer
Opt
.
toggleLayers
(
2
)
}
}
}
...
...
app/src/main/java/com/sd/demo/ui/TLineActivity.kt
View file @
c0a4d214
...
...
@@ -2,10 +2,10 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.maps.DelDrawInMap
import
com.cusc.map.maps.cdata.M
S
Overlay
import
com.cusc.map.maps.cdata.M
ap
Overlay
import
com.cusc.map.maps.DrawInMap
import
com.cusc.map.maps.MethodAdv
import
com.cusc.map.maps.MsPolylineOptions
...
...
@@ -20,10 +20,10 @@ class TLineActivity : AppCompatActivity() {
var
mapReadView
:
MapReadyView
?
=
null
//实线对象
private
var
mSOverlay
:
M
S
Overlay
?
=
null
private
var
mSOverlay
:
M
ap
Overlay
?
=
null
//虚线对象
private
var
mSOverlay2
:
M
S
Overlay
?
=
null
private
var
mSOverlay2
:
M
ap
Overlay
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -44,18 +44,18 @@ class TLineActivity : AppCompatActivity() {
binding
.
bt1
.
setOnClickListener
{
//绘制一条线 //画实线
var
msLatLng
=
listOf
<
MS
LatLng
>(
MS
LatLng
(
39.999391
,
116.135972
),
MS
LatLng
(
39.898323
,
116.057694
),
MS
LatLng
(
39.900430
,
116.265061
),
MS
LatLng
(
39.955192
,
116.140092
)
var
msLatLng
=
listOf
<
LatLng
M
>(
LatLng
M
(
39.999391
,
116.135972
),
LatLng
M
(
39.898323
,
116.057694
),
LatLng
M
(
39.900430
,
116.265061
),
LatLng
M
(
39.955192
,
116.140092
)
)
var
msPolylineOptions
=
MsPolylineOptions
()
mSOverlay
=
DrawInMap
.
drawPolyline
(
msLatLng
,
msPolylineOptions
)
}
binding
.
bt2
.
setOnClickListener
{
//画虚线
var
msLatLng
=
listOf
<
MS
LatLng
>(
MS
LatLng
(
39.999591
,
116.135973
),
MS
LatLng
(
39.898123
,
116.057691
),
MS
LatLng
(
39.900230
,
116.265062
),
MS
LatLng
(
39.951192
,
116.140090
)
var
msLatLng
=
listOf
<
LatLng
M
>(
LatLng
M
(
39.999591
,
116.135973
),
LatLng
M
(
39.898123
,
116.057691
),
LatLng
M
(
39.900230
,
116.265062
),
LatLng
M
(
39.951192
,
116.140090
)
)
//绘制线选项
var
msPolylineOptions
=
MsPolylineOptions
().
apply
{
...
...
app/src/main/java/com/sd/demo/ui/TMarkerActivity.kt
View file @
c0a4d214
...
...
@@ -4,7 +4,7 @@ import android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.maps.DelDrawInMap
import
com.cusc.map.maps.cdata.
MS
Marker
import
com.cusc.map.maps.cdata.Marker
M
import
com.cusc.map.maps.DrawInMap
import
com.cusc.map.ui.MapView.OnMapReadyLis
import
com.sd.demo.databinding.ActivityTmarkerBinding
...
...
@@ -17,7 +17,7 @@ class TMarkerActivity : AppCompatActivity() {
var
mapReadView
:
MapReadyView
?
=
null
//marker点实例
var
msMark
:
MS
Marker
?
=
null
var
msMark
:
Marker
M
?
=
null
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
app/src/main/java/com/sd/demo/ui/TPoiSearchActivity.kt
View file @
c0a4d214
...
...
@@ -2,7 +2,7 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.
MS
Poi
import
com.cusc.map.maps.Poi
Search
import
com.cusc.map.maps.cdata.PoiSearchRes
import
com.cusc.map.maps.inters.OnMSPoiSearchLis
import
com.cusc.map.ui.MapView.OnMapReadyLis
...
...
@@ -59,7 +59,7 @@ class TPoiSearchActivity : AppCompatActivity() {
//poi搜索
fun
testPoiSearch
(
keyword
:
String
)
{
//poi搜索
MS
Poi
.
startPoiSearch
(
Poi
Search
.
startPoiSearch
(
keyword
,
//关键字
41.80196
,
123.43326
,
...
...
@@ -77,7 +77,7 @@ class TPoiSearchActivity : AppCompatActivity() {
//poi 范围搜索
fun
testPoiSearchBound
(
keyword
:
String
)
{
//poi 范围搜索
MS
Poi
.
startPoiSearchBound
(
Poi
Search
.
startPoiSearchBound
(
keyword
,
39.977290
,
116.337000
,
...
...
app/src/main/java/com/sd/demo/ui/TPolygonActivity.kt
View file @
c0a4d214
...
...
@@ -2,10 +2,10 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.maps.DelDrawInMap
import
com.cusc.map.maps.cdata.M
S
Overlay
import
com.cusc.map.maps.cdata.M
ap
Overlay
import
com.cusc.map.maps.DrawInMap
import
com.cusc.map.maps.MethodAdv
import
com.cusc.map.maps.MsPolygonOptions
...
...
@@ -20,7 +20,7 @@ class TPolygonActivity : AppCompatActivity() {
var
mapReadView
:
MapReadyView
?
=
null
//覆盖物对象
private
var
mSOverlay
:
M
S
Overlay
?
=
null
private
var
mSOverlay
:
M
ap
Overlay
?
=
null
//获取接口功能实例
// var mapCoreApi = MapCoreApi.mapCoreApi
...
...
@@ -34,9 +34,9 @@ class TPolygonActivity : AppCompatActivity() {
this
@TPolygonActivity
.
mapReadView
=
mapReadyView
// MSMethodAdv.setMapZoom(mapReadView, 9f)
//绘制一个面
var
mspLatLng
=
listOf
<
MS
LatLng
>(
MS
LatLng
(
39.993391
,
116.135272
),
MS
LatLng
(
39.808323
,
116.057604
),
MS
LatLng
(
39.904430
,
116.265061
),
MS
LatLng
(
39.950192
,
116.140002
)
var
mspLatLng
=
listOf
<
LatLng
M
>(
LatLng
M
(
39.993391
,
116.135272
),
LatLng
M
(
39.808323
,
116.057604
),
LatLng
M
(
39.904430
,
116.265061
),
LatLng
M
(
39.950192
,
116.140002
)
)
//构造面参数
var
msPolygonOptions
=
MsPolygonOptions
().
apply
{
...
...
app/src/main/java/com/sd/demo/ui/TReGeocodeActivity.kt
View file @
c0a4d214
...
...
@@ -3,7 +3,7 @@ package com.sd.demo.ui
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
com.cusc.map.maps.cdata.RegeocodeRes
import
com.cusc.map.maps.
MS
Re
g
eo
Code
import
com.cusc.map.maps.Re
G
eo
graphy
import
com.sd.demo.databinding.ActivityTreGeocodeBinding
...
...
@@ -28,7 +28,7 @@ class TReGeocodeActivity : AppCompatActivity() {
var
lat
=
binding
.
et2
.
text
.
toString
().
toDouble
()
var
lng
=
binding
.
et1
.
text
.
toString
().
toDouble
()
//逆地理编码
MS
Re
g
eo
Code
.
geoCoder
(
lat
,
lng
,
object
:
MS
Re
g
eo
Code
.
OnMsRegeo
{
Re
G
eo
graphy
.
geoCoder
(
lat
,
lng
,
object
:
Re
G
eo
graphy
.
OnMsRegeo
{
override
fun
onRegeo
(
regeocodeRes
:
RegeocodeRes
?)
{
var
sb
=
StringBuilder
()
sb
.
append
(
regeocodeRes
?.
province
+
" "
)
...
...
mapapi/src/main/java/com/cusc/map/bean/WayPoi.kt
View file @
c0a4d214
package
com.cusc.map.bean
import
android.os.Parcelable
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
kotlinx.parcelize.Parcelize
/**途经点Poi***/
@Parcelize
data class
WayPoi
(
/**途经点名坐标*/
var
passPoint
:
MS
LatLng
,
var
passPoint
:
LatLng
M
,
/**经点名字*/
var
passName
:
String
)
:
Parcelable
...
...
mapapi/src/main/java/com/cusc/map/core/MShowMainCarModel.kt
View file @
c0a4d214
...
...
@@ -8,7 +8,7 @@ import com.minedata.minenavi.map.Overlay
import
com.minedata.minenavi.mapdal.LatLng
import
com.cusc.map.MAP_TYPE
import
com.cusc.map.MapSdkInit
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.ui.MapReadyView
import
com.cusc.map.utils.SmoothMoveUtils
import
com.cusc.map.utils.FileIoUtils
...
...
@@ -127,8 +127,8 @@ import java.io.IOException
* @param durationMillis 动画时长默认1000L
* **/
fun
upMyLocCarModelSmooth
(
from
:
MS
LatLng
,
to
:
MS
LatLng
,
from
:
LatLng
M
,
to
:
LatLng
M
,
durationMillis
:
Long
=
1000L
)
{
when
(
MapSdkInit
.
getMapType
())
{
...
...
mapapi/src/main/java/com/cusc/map/maps/
MS
CalcuMapUtil.kt
→
mapapi/src/main/java/com/cusc/map/maps/CalcuMapUtil.kt
View file @
c0a4d214
...
...
@@ -5,7 +5,7 @@ import com.amap.api.maps.AMapUtils
import
com.amap.api.maps.model.LatLng
import
com.cusc.map.MAP_TYPE
import
com.cusc.map.MapSdkInit
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.LatLng
M
import
kotlin.math.atan2
import
kotlin.math.cos
import
kotlin.math.sin
...
...
@@ -13,7 +13,7 @@ import kotlin.math.sin
/**
* 地图计算工具
*/
object
MS
CalcuMapUtil
{
object
CalcuMapUtil
{
/**
* 计算两点之间的直线距离
...
...
@@ -22,8 +22,8 @@ object MSCalcuMapUtil {
* @return 返回两点间距离,单位为米
*/
fun
calculateLineDistance
(
latLng1
:
MS
LatLng
,
latLng2
:
MS
LatLng
latLng1
:
LatLng
M
,
latLng2
:
LatLng
M
):
Float
{
// 根据不同的地图类型选择相应的距离计算方法
when
(
MapSdkInit
.
getMapType
())
{
...
...
@@ -58,8 +58,8 @@ object MSCalcuMapUtil {
* @return 矩形面积,单位为平方米
*/
fun
calculateArea
(
latLng1
:
MS
LatLng
,
latLng2
:
MS
LatLng
latLng1
:
LatLng
M
,
latLng2
:
LatLng
M
):
Float
{
// 根据不同地图类型进行面积计算
when
(
MapSdkInit
.
getMapType
())
{
...
...
@@ -84,8 +84,8 @@ object MSCalcuMapUtil {
* @return 航向角(度),范围 0-360
*/
fun
calculateBearing
(
fromPoint
:
MS
LatLng
,
toPoint
:
MS
LatLng
fromPoint
:
LatLng
M
,
toPoint
:
LatLng
M
):
Double
{
return
calculateBearing
(
fromPoint
.
lng
,
fromPoint
.
lat
,
...
...
mapapi/src/main/java/com/cusc/map/maps/DelDrawInMap.kt
View file @
c0a4d214
...
...
@@ -2,8 +2,8 @@ package com.cusc.map.maps
import
com.cusc.map.MAP_TYPE
import
com.cusc.map.MapSdkInit
import
com.cusc.map.maps.cdata.M
S
Overlay
import
com.cusc.map.maps.cdata.
MS
Marker
import
com.cusc.map.maps.cdata.M
ap
Overlay
import
com.cusc.map.maps.cdata.Marker
M
/**
* 删除地图上的绘制
...
...
@@ -219,7 +219,7 @@ object DelDrawInMap : MsOperationParent() {
* @param mapReadView 地图准备就绪的视图对象,可能为null
* @param mSMarker 要删除的标记点对象,可能为null
*/
fun
deleteMarker
(
mSMarker
:
MS
Marker
?)
{
fun
deleteMarker
(
mSMarker
:
Marker
M
?)
{
if
(
mSMarker
==
null
)
return
var
mapReadView
=
getMapReadView
()
...
...
@@ -232,7 +232,7 @@ object DelDrawInMap : MsOperationParent() {
MAP_TYPE
.
AMAP
->
{
//移除指定的标记点
MS
Marker
.
amaker
?.
remove
()
Marker
M
.
amaker
?.
remove
()
// 清空高德地图上所有已经标注的marker
// mapReadView?.aMap?.clear()
}
...
...
@@ -244,7 +244,7 @@ object DelDrawInMap : MsOperationParent() {
* 删除地图上的线
* @param mSOverlay 包含折线信息的覆盖物对象,可能为null
*/
fun
deletePolyline
(
mSOverlay
:
M
S
Overlay
?)
{
fun
deletePolyline
(
mSOverlay
:
M
ap
Overlay
?)
{
if
(
mSOverlay
==
null
)
return
var
mapReadView
=
getMapReadView
()
...
...
@@ -265,7 +265,7 @@ object DelDrawInMap : MsOperationParent() {
* 删除圆形覆盖物
* @param mSOverlay 圆形覆盖物对象,可能为null
*/
fun
deleteCircle
(
mSOverlay
:
M
S
Overlay
?)
{
fun
deleteCircle
(
mSOverlay
:
M
ap
Overlay
?)
{
if
(
mSOverlay
==
null
)
{
return
}
...
...
@@ -286,7 +286,7 @@ object DelDrawInMap : MsOperationParent() {
* 删除地图上的面
* @param mSOverlay 面覆盖物对象,可能为null
*/
fun
deletePolygon
(
mSOverlay
:
M
S
Overlay
?)
{
fun
deletePolygon
(
mSOverlay
:
M
ap
Overlay
?)
{
if
(
mSOverlay
==
null
)
{
return
}
...
...
mapapi/src/main/java/com/cusc/map/maps/DrawInMap.kt
View file @
c0a4d214
...
...
@@ -4,9 +4,9 @@ import androidx.core.graphics.toColorInt
import
com.cusc.map.MAP_TYPE
import
com.cusc.map.MapSdkInit
import
com.cusc.map.maps.amap.AmapDrawInMap
import
com.cusc.map.maps.cdata.
MS
LatLng
import
com.cusc.map.maps.cdata.
MS
Marker
import
com.cusc.map.maps.cdata.M
S
Overlay
import
com.cusc.map.maps.cdata.LatLng
M
import
com.cusc.map.maps.cdata.Marker
M
import
com.cusc.map.maps.cdata.M
ap
Overlay
import
com.cusc.map.maps.mine.MineDrawInMap
/***绘制线选项**/
...
...
@@ -70,7 +70,7 @@ object DrawInMap : MsOperationParent() {
fun
drawMarket
(
lat
:
Double
,
lng
:
Double
):
MS
Marker
{
):
Marker
M
{
val
mapReadView
=
getMapReadView
()
when
(
MapSdkInit
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
...
...
@@ -90,8 +90,8 @@ object DrawInMap : MsOperationParent() {
* @return MSOverlay 覆盖物对象
*/
fun
drawPolyline
(
msLatLng
:
List
<
MS
LatLng
>,
msPolylineOptions
:
MsPolylineOptions
):
M
S
Overlay
{
msLatLng
:
List
<
LatLng
M
>,
msPolylineOptions
:
MsPolylineOptions
):
M
ap
Overlay
{
val
mapReadView
=
getMapReadView
()
when
(
MapSdkInit
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
...
...
@@ -115,9 +115,9 @@ object DrawInMap : MsOperationParent() {
* @return MSOverlay 返回覆盖物对象
*/
fun
drawCircle
(
center
:
MS
LatLng
,
center
:
LatLng
M
,
msCircleOptions
:
MsCircleOptions
?
):
M
S
Overlay
{
):
M
ap
Overlay
{
val
mapReadView
=
getMapReadView
()
when
(
MapSdkInit
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
...
...
@@ -143,9 +143,9 @@ object DrawInMap : MsOperationParent() {
* @param msPolygonOptions 多边形绘制选型
*/
fun
drawPolygon
(
msLatLng
:
List
<
MS
LatLng
>,
msLatLng
:
List
<
LatLng
M
>,
msPolygonOptions
:
MsPolygonOptions
):
M
S
Overlay
{
):
M
ap
Overlay
{
val
mapReadView
=
getMapReadView
()
when
(
MapSdkInit
.
getMapType
())
{
MAP_TYPE
.
MINE
->
{
...
...
Prev
1
2
3
Next
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