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
1fced44e
Commit
1fced44e
authored
Oct 30, 2025
by
p x
Browse files
不让用户传入mapreadyView
parent
aeb35fb4
Changes
134
Show whitespace changes
Inline
Side-by-side
mapapi/src/main/java/com/sd/api/ui/MineNaiDirActivity.kt
View file @
1fced44e
...
...
@@ -28,6 +28,10 @@ import com.sd.api.maps.mine.MineNaiParams
import
com.sd.api.maps.mine.MineRoutePlans
import
com.sd.api.intfaces.OnComCan
import
com.sd.api.intfaces.OnNaviPresenterListener
import
com.sd.api.location.MSLocCb
import
com.sd.api.location.MSLocation
import
com.sd.api.location.OnMsGpsLoc
import
com.sd.api.maps.MSNavi
import
com.sd.api.maps.MSRoutePlans
import
com.sd.api.ui.MapMultiView.OnMapReadyLis
import
com.sd.api.ui.dialog.ExitNaiDialog
...
...
@@ -44,9 +48,6 @@ class MineNaiDirActivity : AppCompatActivity(), OnNaviPresenterListener {
private
var
mineNaiParams
:
MineNaiParams
?
=
null
//获取接口功能实例
// private var mapCoreApi = MapCoreApi.mapCoreApi
//四维导航地图工具
private
lateinit
var
mUtils
:
Utils
...
...
@@ -66,11 +67,22 @@ class MineNaiDirActivity : AppCompatActivity(), OnNaviPresenterListener {
mUtils
.
init
(
this
)
mineNaiParams
=
intent
.
getParcelableExtra
<
MineNaiParams
>(
"mineNaiParams"
)
MineNai
.
onNaviPresenterListener
=
this
//开启定位
MSLocation
.
startLoc
(
object
:
OnMsGpsLoc
{
override
fun
onMsGpsLoc
(
mSLocBean
:
MSLocCb
)
{
println
(
"---------mSLocBean = ${mSLocBean.lng}"
)
}
})
// MineNai.onNaviPresenterListener = this
MSNavi
.
init
()
MSNavi
.
addNaviListener
(
this
)
binding
.
mapMultiView
.
addMapRenderCallback
(
object
:
OnMapReadyLis
{
override
fun
onMapReady
(
mapReadyView
:
MapReadyView
)
{
this
@MineNaiDirActivity
.
mapReadView
=
mapReadyView
//切换为2D平面图
// mapReadyView.mMineMap?.elevation=0f
//算路成功以后启动导航
...
...
@@ -91,7 +103,7 @@ class MineNaiDirActivity : AppCompatActivity(), OnNaviPresenterListener {
//开始路径规划
MSRoutePlans
.
drivingPathPlanning
(
startPoint
,
startName
,
endPoint
,
endName
,
ways
,
mapReadView
,
object
:
OnDriveRoute
{
startPoint
,
startName
,
endPoint
,
endName
,
ways
,
object
:
OnDriveRoute
{
override
fun
onDriverRoute
(
driverRouteBean
:
DriverRouteBean
)
{
var
routeBase
=
driverRouteBean
.
routeBase
MineNai
.
startNaviFormRouteBase
(
routeBase
,
startPoint
,
mapReadView
)
...
...
@@ -143,14 +155,14 @@ class MineNaiDirActivity : AppCompatActivity(), OnNaviPresenterListener {
showNavingCarPosition
(
data
.
carPos
,
carHeading
)
mineMap
?.
setHeading
(
mapHeading
)
mineMap
?.
setElevation
(
50.0f
)
mineMap
?.
setFovy
(
35f
)
mineMap
?.
setViewShiftXY
(
0f
,
0.55f
)
//
mineMap?.setElevation(50.0f)
//
mineMap?.setFovy(35f)
//
mineMap?.setViewShiftXY(0f, 0.55f)
mineMap
?.
setNdsPointToCenter
(
data
.
carPos
.
x
,
data
.
carPos
.
y
)
val
zoomLevel
=
mineMap
!!
.
getAutomaticZoomLevelForMineMap
(
0.2f
)
if
(
zoomLevel
!=
-
1f
)
{
mineMap
!!
.
setZoomLevel
(
zoomLevel
)
}
//
val zoomLevel = mineMap!!.getAutomaticZoomLevelForMineMap(0.2f)
//
if (zoomLevel != -1f) {
//
mineMap!!.setZoomLevel(zoomLevel)
//
}
}
...
...
mapapi/src/main/java/com/sd/api/ui/widget/MyLaneView.java
View file @
1fced44e
...
...
@@ -12,8 +12,6 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
androidx.core.content.ContextCompat
;
import
com.minedata.minenavi.mapdal.NativeEnv
;
import
com.minedata.minenavi.navi.LaneDetector
;
import
com.sd.api.R
;
...
...
@@ -190,14 +188,15 @@ public class MyLaneView extends LinearLayout implements LaneDetector.OnLaneDetec
/**
* 分割线
**/
* @param height 箭头的高度
*/
private
ImageView
createSepView
(
int
height
)
{
ImageView
view
=
new
ImageView
(
context
);
ColorDrawable
colorDrawable
=
new
ColorDrawable
(
Color
.
parseColor
(
"#99FFFFFF"
));
view
.
setBackground
(
colorDrawable
);
LayoutParams
params
=
new
LayoutParams
(-
2
,
-
1
);
params
.
width
=
NativeEnv
.
dp2px
(
1.0
F
);
params
.
height
=
height
-
NativeEnv
.
dp2px
(
2
.0
F
);
params
.
height
=
height
-
NativeEnv
.
dp2px
(
8
.0
F
);
params
.
setMargins
(
this
.
mIconMargin
,
0
,
this
.
mIconMargin
,
0
);
view
.
setLayoutParams
(
params
);
return
view
;
...
...
mapapi/src/main/java/com/sd/api/ui/widget/TmcBar.java
View file @
1fced44e
...
...
@@ -416,20 +416,23 @@ public class TmcBar extends RelativeLayout {
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#43CA63"
));
//绿色
break
;
case
TmcSections
.
State
.
medium
:
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#
F9B000"
));
//黄色
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#
4ECDC4"
));
break
;
case
TmcSections
.
State
.
heavy
:
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#F
45956
"
));
//红
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#F
9B000
"
));
break
;
case
TmcSections
.
State
.
blocked
:
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#
701200
"
));
//
黑
色
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#
F45956
"
));
//
红
色
break
;
case
TmcSections
.
State
.
unknown
:
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#5AC8FA"
));
break
;
case
TmcSections
.
State
.
none
:
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#
3385FE"
));
//蓝色
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#
007AFF"
));
break
;
default
:
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#C3C0C0"
));
// mDrawContentPaint.setColor(Color.parseColor("#8E8E93"));
mDrawContentPaint
.
setColor
(
Color
.
parseColor
(
"#C9C9C9"
));
break
;
}
return
mDrawContentPaint
;
...
...
mapapi/src/main/res/drawable-anydpi/location_start.xml
0 → 100644
View file @
1fced44e
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<!-- 0 没有定位 -->
<item
android:state_pressed=
"true"
android:drawable=
"@drawable/myloc_blue"
/>
<!-- 1 锁定 -->
<item
android:state_pressed=
"false"
android:drawable=
"@drawable/myloc_grey"
/>
</selector>
<!--<level-list xmlns:android="http://schemas.android.com/apk/res/android">-->
<!-- <!– 0 没有定位 –>-->
<!-- <item android:maxLevel="0" android:drawable="@drawable/myloc_blue"/>-->
<!-- <!– 1 锁定 –>-->
<!-- <item android:maxLevel="1" android:drawable="@drawable/myloc_grey" />-->
<!--</level-list>-->
\ No newline at end of file
mapapi/src/main/res/drawable-xhdpi/compass.png
0 → 100644
View file @
1fced44e
1.35 KB
mapapi/src/main/res/drawable-xhdpi/compass_bg.png
0 → 100644
View file @
1fced44e
3.18 KB
mapapi/src/main/res/drawable-xhdpi/myloc_blue.png
0 → 100644
View file @
1fced44e
1.17 KB
mapapi/src/main/res/drawable-xhdpi/myloc_grey.png
0 → 100644
View file @
1fced44e
863 Bytes
mapapi/src/main/res/drawable/circle_white.xml
0 → 100644
View file @
1fced44e
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"50dp"
/>
<solid
android:color=
"@color/white"
/>
</shape>
\ No newline at end of file
mapapi/src/main/res/drawable/nai_rect_10.xml
0 → 100644
View file @
1fced44e
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"10dp"
/>
<solid
android:color=
"#E6FFFFFF"
/>
</shape>
\ No newline at end of file
mapapi/src/main/res/layout/fragment_a_map.xml
View file @
1fced44e
<?xml version="1.0" encoding="utf-8"?>
<com.amap.api.maps.MapView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<RelativeLayout
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"
>
<com.amap.api.maps.MapView
android:id=
"@+id/mMapView"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
/>
<!--定位按钮-->
<ImageView
android:id=
"@+id/ivLocation"
android:layout_width=
"@dimen/dp_45"
android:layout_height=
"@dimen/dp_45"
android:layout_alignParentRight=
"true"
android:layout_marginTop=
"@dimen/dp_10"
android:layout_marginRight=
"@dimen/dp_10"
android:background=
"@drawable/compass_bg"
android:visibility=
"gone"
android:scaleType=
"centerInside"
android:src=
"@drawable/location_start"
/>
</RelativeLayout>
mapapi/src/main/res/layout/fragment_fore_map.xml
View file @
1fced44e
<?xml version="1.0" encoding="utf-8"?>
<
com.minedata.minenavi.map.MapView
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/mapView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
".fragments.ForeMapFragment"
/>
tools:context=
".fragments.ForeMapFragment"
>
<com.minedata.minenavi.map.MapView
android:id=
"@+id/mapView"
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>-->
<!--定位按钮-->
<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_marginRight=
"8dp"
android:visibility=
"gone"
android:src=
"@drawable/location_start"
/>
<!-- 指南针-->
<com.minedata.minenavi.map.CompassView
android:id=
"@+id/compassView"
android:layout_width=
"@dimen/map_right_bot_widget"
android:layout_height=
"@dimen/map_right_bot_widget"
android:layout_alignParentRight=
"true"
android:layout_alignParentBottom=
"true"
android:layout_marginRight=
"@dimen/dp_10"
android:layout_marginBottom=
"@dimen/dp_10"
android:background=
"@drawable/compass_bg"
android:scaleType=
"centerInside"
android:src=
"@drawable/compass"
android:visibility=
"gone"
/>
<!-- 比例尺-->
<com.minedata.minenavi.map.ScaleView
android:id=
"@+id/scaleView"
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"
/>
</RelativeLayout>
<!-- smallView="true"-->
...
...
mapapi/src/main/res/layout/my_navi_view.xml
View file @
1fced44e
...
...
@@ -20,9 +20,7 @@
android:id=
"@+id/my_navi_info"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/rect_white_10"
android:orientation=
"vertical"
>
android:background=
"@drawable/nai_rect_10"
>
<RelativeLayout
android:id=
"@+id/RL_1"
...
...
@@ -42,12 +40,13 @@
android:id=
"@+id/turnIconView"
android:layout_width=
"@dimen/dp_55"
android:layout_height=
"@dimen/dp_55"
android:scaleType=
"centerInside"
/>
android:scaleType=
"centerInside"
android:paddingBottom=
"4dp"
/>
<RelativeLayout
android:layout_width=
"wrap_content"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
@dimen/dp_55
"
android:layout_alignTop=
"@+id/turnIconView"
android:layout_marginLeft=
"8dp"
android:layout_toRightOf=
"@+id/turnIconView"
>
...
...
@@ -56,11 +55,11 @@
android:id=
"@+id/tv_turnDistance"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"-
3
dp"
android:layout_marginTop=
"-
5
dp"
android:textColor=
"@color/text_black"
android:textStyle=
"bold"
tools:text=
"2.5公里"
tools:textSize=
"2
2
sp"
/>
tools:textSize=
"2
8
sp"
/>
<TextView
android:id=
"@+id/tv_turnAction"
...
...
@@ -79,9 +78,8 @@
android:id=
"@+id/tv_turnRoadName"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@+id/tv_turnDistance"
android:layout_alignLeft=
"@+id/tv_turnDistance"
android:layout_
marginTop=
"2dp
"
android:layout_
alignParentBottom=
"true
"
android:textColor=
"#80000000"
tools:text=
"北清路"
/>
...
...
@@ -111,7 +109,8 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"•"
android:textColor=
"@color/text_black"
/>
android:textColor=
"@color/text_black"
android:textSize=
"11sp"
/>
<!-- 剩余时间-->
<TextView
...
...
@@ -125,8 +124,8 @@
<ImageView
android:id=
"@+id/iv_bottomTrafficLight"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
11dp
"
android:layout_height=
"
11dp
"
android:layout_marginLeft=
"3dp"
android:src=
"@drawable/traffic"
/>
...
...
@@ -158,7 +157,7 @@
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_15"
android:layout_below=
"@+id/RL_1"
android:layout_marginTop=
"
2
dp"
>
android:layout_marginTop=
"
5
dp"
>
<com.sd.api.ui.widget.TmcBar
android:id=
"@+id/tmcBar_view"
...
...
@@ -166,7 +165,7 @@
android:layout_height=
"@dimen/dp_5"
android:layout_centerVertical=
"true"
android:layout_marginTop=
"4dp"
android:background=
"#
00000000
"
android:background=
"#
C9C9C9
"
tools:ignore=
"RtlSymmetry"
/>
<View
...
...
@@ -209,6 +208,7 @@
</RelativeLayout>
<!-- <ImageView-->
<!-- android:layout_width="@dimen/dp_15"-->
<!-- android:layout_height="@dimen/dp_15"-->
...
...
mapapi/src/main/res/values/dimens.xml
View file @
1fced44e
...
...
@@ -439,6 +439,6 @@
<dimen
name=
"nz_px_400"
>
192.00dp
</dimen>
<dimen
name=
"map_left_top_widget"
>
260dp
</dimen>
<dimen
name=
"fab_margin"
>
16dp
</dimen>
<dimen
name=
"map_right_bot_widget"
>
40dp
</dimen>
</resources>
\ No newline at end of file
Prev
1
…
3
4
5
6
7
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