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
a0061ae5
Commit
a0061ae5
authored
Oct 31, 2025
by
p x
Browse files
优化一些调用
parent
1fced44e
Changes
22
Hide whitespace changes
Inline
Side-by-side
mapapi/src/main/java/com/sd/api/vms/CarRoadVM.kt
View file @
a0061ae5
package
com.sd.api.vms
import
androidx.lifecycle.ViewModel
import
androidx.lifecycle.viewModelScope
import
com.example.car_and_road_3d.CarAndRoadWebViewClient
import
com.example.car_and_road_3d.models.InitRoadRequest
import
com.example.car_and_road_3d.models.MainCar
import
com.example.car_and_road_3d.models.Position
import
com.sd.api.
bean.MyCLoc
import
com.sd.api.
parkroad.RoadPos
import
com.sd.api.parkroad.OnPrAddCar
import
kotlinx.coroutines.launch
//局部图控制类
class
CarRoadVM
:
ViewModel
()
{
...
...
@@ -21,7 +19,7 @@ class CarRoadVM : ViewModel() {
//感知物是否首次添加
private
var
isPtcAdd
=
false
/**主车起点,用于传给路网计算*/
private
var
startLoc
:
MyCLoc
?
=
null
private
var
startLoc
:
RoadPos
?
=
null
private
var
onPrAddCar
:
OnPrAddCar
?=
null
...
...
@@ -30,7 +28,7 @@ class CarRoadVM : ViewModel() {
* @param myloc 当前位置
* @param onPrAddCar 主车是否添加成功回调,其他操作基于此
*/
fun
updateMainCar
(
myloc
:
MyCLoc
,
onPrAddCar
:
OnPrAddCar
?)
{
fun
updateMainCar
(
myloc
:
RoadPos
,
onPrAddCar
:
OnPrAddCar
?)
{
if
(
startLoc
==
null
||
startLoc
?.
lat
==
0.0
)
{
setStarLoc
(
myloc
)
return
...
...
@@ -60,15 +58,15 @@ class CarRoadVM : ViewModel() {
}
}
private
fun
setStarLoc
(
myloc
:
MyCLoc
)
{
private
fun
setStarLoc
(
myloc
:
RoadPos
)
{
if
(
startLoc
==
null
)
{
startLoc
=
MyCLoc
()
startLoc
=
RoadPos
()
}
startLoc
!!
.
run
{
this
.
lat
=
myloc
.
lat
this
.
lng
=
myloc
.
lng
this
.
bearing
=
myloc
.
bearing
this
.
altitude
=
myloc
.
altitude
//
this.altitude = myloc.altitude
}
}
...
...
mapapi/src/main/res/layout/fragment_fore_map.xml
View file @
a0061ae5
...
...
@@ -10,27 +10,26 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
<!-- <LinearLayout-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical">-->
<!-- <LinearLayout-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:orientation="vertical">-->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
<!--定位按钮-->
<ImageView
android:id=
"@+id/ivLocation"
android:layout_width=
"@dimen/dp_45"
android:layout_height=
"@dimen/dp_45"
android:background=
"@drawable/compass_bg"
android:scaleType=
"centerInside"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_alignParentRight=
"true"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"8dp"
android:visibility=
"gone"
android:src=
"@drawable/location_start"
/>
android:background=
"@drawable/compass_bg"
android:scaleType=
"centerInside"
android:src=
"@drawable/location_start"
android:visibility=
"gone"
/>
<!-- 指南针-->
...
...
@@ -54,8 +53,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_10"
android:visibility=
"gone"
/>
android:layout_marginBottom=
"@dimen/dp_10"
/>
</RelativeLayout>
...
...
Prev
1
2
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