Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
HTAnticollision
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
马乐
HTAnticollision
Commits
2c0c90f1
Commit
2c0c90f1
authored
May 26, 2023
by
马乐
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.解决地图异步加载车辆图片被遮挡问题
parent
7552d1f8
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
716 additions
and
587 deletions
+716
-587
BaseFragment.kt
...rc/main/java/com/waytous/anticollision/ui/BaseFragment.kt
+18
-19
MainViewModel.kt
...c/main/java/com/waytous/anticollision/ui/MainViewModel.kt
+3
-62
MapBoxLayout.kt
...rc/main/java/com/waytous/anticollision/ui/MapBoxLayout.kt
+2
-31
VideoHomeFragment.kt
...a/com/waytous/anticollision/ui/video/VideoHomeFragment.kt
+2
-1
Extensions.kt
...c/main/java/com/waytous/anticollision/utils/Extensions.kt
+0
-474
MapExtensions.kt
...ain/java/com/waytous/anticollision/utils/MapExtensions.kt
+691
-0
No files found.
app/src/main/java/com/waytous/anticollision/ui/BaseFragment.kt
View file @
2c0c90f1
...
@@ -2,8 +2,6 @@ package com.waytous.anticollision.ui
...
@@ -2,8 +2,6 @@ package com.waytous.anticollision.ui
import
android.os.Bundle
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.asynclayoutinflater.view.AsyncLayoutInflater
import
androidx.asynclayoutinflater.view.AsyncLayoutInflater
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.viewModels
import
androidx.fragment.app.viewModels
...
@@ -18,9 +16,9 @@ import com.mapbox.maps.Style
...
@@ -18,9 +16,9 @@ import com.mapbox.maps.Style
import
com.mapbox.maps.ViewAnnotationAnchor
import
com.mapbox.maps.ViewAnnotationAnchor
import
com.mapbox.maps.extension.style.layers.properties.generated.IconAnchor
import
com.mapbox.maps.extension.style.layers.properties.generated.IconAnchor
import
com.mapbox.maps.extension.style.style
import
com.mapbox.maps.extension.style.style
import
com.mapbox.maps.plugin.annotation.AnnotationConfig
import
com.mapbox.maps.plugin.annotation.AnnotationPlugin
import
com.mapbox.maps.plugin.annotation.AnnotationPlugin
import
com.mapbox.maps.plugin.annotation.annotations
import
com.mapbox.maps.plugin.annotation.annotations
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotation
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationManager
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationOptions
import
com.mapbox.maps.plugin.annotation.generated.PointAnnotationOptions
import
com.mapbox.maps.plugin.annotation.generated.createPointAnnotationManager
import
com.mapbox.maps.plugin.annotation.generated.createPointAnnotationManager
...
@@ -35,6 +33,10 @@ import com.waytous.anticollision.databinding.LayoutMapBoxBinding
...
@@ -35,6 +33,10 @@ import com.waytous.anticollision.databinding.LayoutMapBoxBinding
import
com.waytous.anticollision.databinding.OtherVehicleViewAnnotationLayoutBinding
import
com.waytous.anticollision.databinding.OtherVehicleViewAnnotationLayoutBinding
import
com.waytous.anticollision.repository.MainRepository
import
com.waytous.anticollision.repository.MainRepository
import
com.waytous.anticollision.utils.BitmapUtils
import
com.waytous.anticollision.utils.BitmapUtils
import
com.waytous.anticollision.utils.LATITUDE
import
com.waytous.anticollision.utils.LONGITUDE
import
com.waytous.anticollision.utils.MY_MAP_BOX_STYLE
import
com.waytous.anticollision.utils.TRUCK_PATH_LAYER
import
com.waytous.anticollision.utils.addBarricadeLineLayer
import
com.waytous.anticollision.utils.addBarricadeLineLayer
import
com.waytous.anticollision.utils.addBarricadeSource
import
com.waytous.anticollision.utils.addBarricadeSource
import
com.waytous.anticollision.utils.addDiggingWorkAreaFillLayer
import
com.waytous.anticollision.utils.addDiggingWorkAreaFillLayer
...
@@ -70,10 +72,9 @@ import com.waytous.anticollision.utils.addTruckPathSource
...
@@ -70,10 +72,9 @@ import com.waytous.anticollision.utils.addTruckPathSource
import
com.waytous.anticollision.utils.addWetAreaFillLayer
import
com.waytous.anticollision.utils.addWetAreaFillLayer
import
com.waytous.anticollision.utils.addWetAreaSource
import
com.waytous.anticollision.utils.addWetAreaSource
import
com.waytous.anticollision.utils.addWetAreaSymbolLayer
import
com.waytous.anticollision.utils.addWetAreaSymbolLayer
import
com.waytous.anticollision.utils.adjustLayerOrder
import
com.waytous.anticollision.vo.VehicleAnnotation
import
com.waytous.anticollision.vo.VehicleAnnotation
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.flow.last
import
kotlinx.coroutines.flow.last
import
kotlinx.coroutines.flow.single
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
import
java.math.BigDecimal
import
java.math.BigDecimal
...
@@ -99,21 +100,15 @@ open class BaseFragment : Fragment() {
...
@@ -99,21 +100,15 @@ open class BaseFragment : Fragment() {
lateinit
var
mapboxMap
:
MapboxMap
lateinit
var
mapboxMap
:
MapboxMap
private
lateinit
var
viewAnnotation
:
View
private
lateinit
var
annotationPlugin
:
AnnotationPlugin
private
lateinit
var
viewAnnotationManager
:
ViewAnnotationManager
private
lateinit
var
viewAnnotationManager
:
ViewAnnotationManager
private
lateinit
var
pointAnnotationManager
:
PointAnnotationManager
private
lateinit
var
pointAnnotationManager
:
PointAnnotationManager
private
lateinit
var
pointAnnotation
:
PointAnnotation
private
val
cameraOptions
:
CameraOptions
by
lazy
{
private
val
cameraOptions
:
CameraOptions
by
lazy
{
CameraOptions
.
Builder
().
center
(
CameraOptions
.
Builder
().
center
(
Point
.
fromLngLat
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
LONGITUDE
,
MainViewModel
.
LATITUDE
LATITUDE
)
)
).
zoom
(
14.0
).
build
()
).
zoom
(
14.0
).
build
()
}
}
...
@@ -150,6 +145,7 @@ open class BaseFragment : Fragment() {
...
@@ -150,6 +145,7 @@ open class BaseFragment : Fragment() {
}
}
fun
setupMapBox
()
{
fun
setupMapBox
()
{
LogUtils
.
d
(
"setupMapBox"
)
layoutMapBoxBinding
.
mapView
.
run
{
layoutMapBoxBinding
.
mapView
.
run
{
logo
.
enabled
=
false
logo
.
enabled
=
false
compass
.
enabled
=
false
compass
.
enabled
=
false
...
@@ -183,11 +179,9 @@ open class BaseFragment : Fragment() {
...
@@ -183,11 +179,9 @@ open class BaseFragment : Fragment() {
}
}
}
}
mapboxMap
.
loadStyle
(
style
(
M
ainViewModel
.
M
Y_MAP_BOX_STYLE
)
{
mapboxMap
.
loadStyle
(
style
(
MY_MAP_BOX_STYLE
)
{
})
{
})
{
initAnnotationManager
()
setupStyle
(
it
)
setupStyle
(
it
)
addTempAnnotations
()
}
}
}
}
...
@@ -253,6 +247,9 @@ open class BaseFragment : Fragment() {
...
@@ -253,6 +247,9 @@ open class BaseFragment : Fragment() {
}
}
style
.
addTruckPathSource
()
style
.
addTruckPathSource
()
style
.
addTruckPathLineLayer
()
style
.
addTruckPathLineLayer
()
style
.
adjustLayerOrder
()
initAnnotationManager
()
addTempAnnotations
()
}
}
}
}
}
}
...
@@ -260,7 +257,7 @@ open class BaseFragment : Fragment() {
...
@@ -260,7 +257,7 @@ open class BaseFragment : Fragment() {
fun
addTempAnnotations
()
{
fun
addTempAnnotations
()
{
val
otherAnnotation
=
VehicleAnnotation
(
val
otherAnnotation
=
VehicleAnnotation
(
"KK-01"
,
36
,
25
,
"KK-01"
,
36
,
25
,
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
),
true
Point
.
fromLngLat
(
LONGITUDE
,
LATITUDE
),
true
)
)
updateCurrentVehicleAnnotation
(
otherAnnotation
)
updateCurrentVehicleAnnotation
(
otherAnnotation
)
val
otherAnnotation1
=
val
otherAnnotation1
=
...
@@ -272,9 +269,11 @@ open class BaseFragment : Fragment() {
...
@@ -272,9 +269,11 @@ open class BaseFragment : Fragment() {
}
}
private
fun
initAnnotationManager
()
{
private
fun
initAnnotationManager
()
{
annotationPlugin
=
layoutMapBoxBinding
.
mapView
.
annotations
viewAnnotationManager
=
layoutMapBoxBinding
.
mapView
.
viewAnnotationManager
viewAnnotationManager
=
layoutMapBoxBinding
.
mapView
.
viewAnnotationManager
pointAnnotationManager
=
annotationPlugin
.
createPointAnnotationManager
()
pointAnnotationManager
=
layoutMapBoxBinding
.
mapView
.
annotations
.
createPointAnnotationManager
(
AnnotationConfig
(
TRUCK_PATH_LAYER
)
)
}
}
fun
updateCurrentVehicleAnnotation
(
otherAnnotation
:
VehicleAnnotation
)
{
fun
updateCurrentVehicleAnnotation
(
otherAnnotation
:
VehicleAnnotation
)
{
...
...
app/src/main/java/com/waytous/anticollision/ui/MainViewModel.kt
View file @
2c0c90f1
...
@@ -7,6 +7,8 @@ import androidx.lifecycle.viewmodel.CreationExtras
...
@@ -7,6 +7,8 @@ import androidx.lifecycle.viewmodel.CreationExtras
import
com.blankj.utilcode.util.LogUtils
import
com.blankj.utilcode.util.LogUtils
import
com.mapbox.geojson.Point
import
com.mapbox.geojson.Point
import
com.waytous.anticollision.repository.MainRepository
import
com.waytous.anticollision.repository.MainRepository
import
com.waytous.anticollision.utils.LATITUDE
import
com.waytous.anticollision.utils.LONGITUDE
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.flow.*
import
kotlinx.coroutines.flow.*
import
java.math.BigDecimal
import
java.math.BigDecimal
...
@@ -95,10 +97,7 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
...
@@ -95,10 +97,7 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
fun
runnableAreaSource
()
=
flowOf
(
fun
runnableAreaSource
()
=
flowOf
(
mainRepository
.
localRunnableAreaVersion
(),
mainRepository
.
localRunnableAreaVersion
(),
mainRepository
.
remoteRunnableAreaVersion
()
mainRepository
.
remoteRunnableAreaVersion
()
).
onStart
{
).
flattenMerge
()
LogUtils
.
dTag
(
"MainViewModel"
,
"runnableAreaSource start"
)
}
.
flattenMerge
()
.
transformWhile
{
.
transformWhile
{
emit
(
it
.
mapDataSource
)
emit
(
it
.
mapDataSource
)
!
it
.
abort
!
it
.
abort
...
@@ -196,64 +195,6 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
...
@@ -196,64 +195,6 @@ class MainViewModel @Inject constructor(private val mainRepository: MainReposito
emit
(
""
)
emit
(
""
)
}
}
companion
object
{
const
val
MY_MAP_BOX_STYLE
=
"asset://style.json"
const
val
DUMP_AREA_SOURCE
=
"dumpAreaSource"
const
val
DUMP_AREA_LAYER
=
"dumpAreaLayer"
const
val
DUMP_AREA_TEXT_LAYER
=
"dumpAreaTextLayer"
const
val
OBSTACLES_SOURCE
=
"obstaclesSource"
const
val
OBSTACLES_LAYER
=
"obstaclesLayer"
const
val
OBSTACLES_TEXT_LAYER
=
"obstaclesTextLayer"
const
val
ELECTRONIC_FENCE_SOURCE
=
"electronicFenceSource"
const
val
ELECTRONIC_FENCE_LAYER
=
"electronicFenceLayer"
const
val
ELECTRONIC_FENCE_TEXT_LAYER
=
"electronicFenceTextLayer"
const
val
WET_AREA_SOURCE
=
"wetAreaSource"
const
val
WET_AREA_LAYER
=
"wetAreaLayer"
const
val
WET_AREA_TEXT_LAYER
=
"wetAreaTextLayer"
const
val
LANE_NODE_SOURCE
=
"laneNodeSource"
const
val
LANE_NODE_LAYER
=
"laneNodeLayer"
const
val
LANE_NODE_TEXT_LAYER
=
"laneNodeTextLayer"
const
val
LANE_SOURCE
=
"laneSource"
const
val
LANE_LAYER
=
"laneLayer"
const
val
LANE_TEXT_LAYER
=
"laneTextLayer"
const
val
RUNNABLE_AREA_SOURCE
=
"runnableAreaSource"
const
val
RUNNABLE_AREA_LAYER
=
"runnableAreaLayer"
const
val
RUNNABLE_AREA_TEXT_LAYER
=
"runnableAreaTextLayer"
const
val
DIGGING_WORK_AREA_SOURCE
=
"diggingWorkAreaSource"
const
val
DIGGING_WORK_AREA_LAYER
=
"diggingWorkAreaLayer"
const
val
DIGGING_WORK_AREA_TEXT_LAYER
=
"diggingWorkAreaTextLayer"
const
val
BARRICADE_SOURCE
=
"barricadeSource"
const
val
BARRICADE_LAYER
=
"barricadeLayer"
const
val
BARRICADE_TEXT_LAYER
=
"barricadeTextLayer"
const
val
STATION_AREA_SOURCE
=
"stationAreaSource"
const
val
STATION_AREA_LAYER
=
"stationAreaLayer"
const
val
STATION_AREA_TEXT_LAYER
=
"stationAreaTextLayer"
const
val
STATIC_OBJECTS_SOURCE
=
"staticObjectsSource"
const
val
STATIC_OBJECTS_LAYER
=
"staticObjectsLayer"
const
val
STATIC_OBJECTS_TEXT_LAYER
=
"staticObjectsTextLayer"
const
val
PARK_SPOT_SOURCE
=
"parkSpotSource"
const
val
PARK_SPOT_LAYER
=
"parkSpotLayer"
const
val
PARK_SPOT_TEXT_LAYER
=
"parkSpotTextLayer"
const
val
LONGITUDE
=
119.7622539014
const
val
LATITUDE
=
49.3795031825
const
val
ZOOM
=
16.0
}
class
MainViewModelFactory
(
private
val
mainRepository
:
MainRepository
)
:
class
MainViewModelFactory
(
private
val
mainRepository
:
MainRepository
)
:
ViewModelProvider
.
Factory
{
ViewModelProvider
.
Factory
{
override
fun
<
T
:
ViewModel
>
create
(
modelClass
:
Class
<
T
>,
extras
:
CreationExtras
):
T
{
override
fun
<
T
:
ViewModel
>
create
(
modelClass
:
Class
<
T
>,
extras
:
CreationExtras
):
T
{
...
...
app/src/main/java/com/waytous/anticollision/ui/MapBoxLayout.kt
View file @
2c0c90f1
...
@@ -23,6 +23,8 @@ import com.mapbox.maps.viewannotation.viewAnnotationOptions
...
@@ -23,6 +23,8 @@ import com.mapbox.maps.viewannotation.viewAnnotationOptions
import
com.waytous.anticollision.R
import
com.waytous.anticollision.R
import
com.waytous.anticollision.databinding.CurrentVehicleViewAnnotationLayoutBinding
import
com.waytous.anticollision.databinding.CurrentVehicleViewAnnotationLayoutBinding
import
com.waytous.anticollision.utils.BitmapUtils
import
com.waytous.anticollision.utils.BitmapUtils
import
com.waytous.anticollision.utils.LATITUDE
import
com.waytous.anticollision.utils.LONGITUDE
/**
/**
...
@@ -77,34 +79,4 @@ class MapBoxLayout(private val context: Context,private val mapView:MapView){
...
@@ -77,34 +79,4 @@ class MapBoxLayout(private val context: Context,private val mapView:MapView){
}.
toJson
())
}.
toJson
())
}
}
fun
updateRoundTrucks
(
vararg
points
:
Point
){
points
.
forEach
{
}
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
prepareViewAnnotation
()
{
viewAnnotation
=
viewAnnotationManager
.
addViewAnnotation
(
resId
=
R
.
layout
.
current_vehicle_view_annotation_layout
,
options
=
viewAnnotationOptions
{
geometry
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
))
associatedFeatureId
(
pointAnnotation
.
featureIdentifier
)
anchor
(
ViewAnnotationAnchor
.
BOTTOM
)
offsetY
((
pointAnnotation
.
iconImageBitmap
?.
height
!!
).
toInt
())
}
)
CurrentVehicleViewAnnotationLayoutBinding
.
bind
(
viewAnnotation
)
}
private
fun
prepareAnnotationMarker
(
mapView
:
MapView
,
iconBitmap
:
Bitmap
)
{
val
annotationPlugin
=
mapView
.
annotations
val
pointAnnotationOptions
:
PointAnnotationOptions
=
PointAnnotationOptions
()
.
withPoint
(
Point
.
fromLngLat
(
MainViewModel
.
LONGITUDE
,
MainViewModel
.
LATITUDE
))
.
withIconImage
(
iconBitmap
)
.
withIconAnchor
(
IconAnchor
.
BOTTOM
)
pointAnnotationManager
=
annotationPlugin
.
createPointAnnotationManager
()
pointAnnotation
=
pointAnnotationManager
.
create
(
pointAnnotationOptions
)
}
}
}
\ No newline at end of file
app/src/main/java/com/waytous/anticollision/ui/video/VideoHomeFragment.kt
View file @
2c0c90f1
...
@@ -51,6 +51,7 @@ import com.waytous.anticollision.databinding.FragmentVideoHomeBinding
...
@@ -51,6 +51,7 @@ import com.waytous.anticollision.databinding.FragmentVideoHomeBinding
import
com.waytous.anticollision.ui.MainViewModel
import
com.waytous.anticollision.ui.MainViewModel
import
com.waytous.anticollision.ui.view.MoreFeaturesPopup
import
com.waytous.anticollision.ui.view.MoreFeaturesPopup
import
com.waytous.anticollision.ui.view.WorkStatusEditPopup
import
com.waytous.anticollision.ui.view.WorkStatusEditPopup
import
com.waytous.anticollision.utils.MY_MAP_BOX_STYLE
import
com.waytous.anticollision.utils.getBitmapFromVectorDrawable
import
com.waytous.anticollision.utils.getBitmapFromVectorDrawable
import
com.waytous.anticollision.utils.setTextSize
import
com.waytous.anticollision.utils.setTextSize
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.launch
...
@@ -145,7 +146,7 @@ class VideoHomeFragment : Fragment() {
...
@@ -145,7 +146,7 @@ class VideoHomeFragment : Fragment() {
val
mapData
=
ApiService
.
create
().
dumpAreaVersion
(
"-1"
)
val
mapData
=
ApiService
.
create
().
dumpAreaVersion
(
"-1"
)
viewLifecycleOwner
.
repeatOnLifecycle
(
Lifecycle
.
State
.
CREATED
){
viewLifecycleOwner
.
repeatOnLifecycle
(
Lifecycle
.
State
.
CREATED
){
mapView
.
getMapboxMap
().
loadStyle
(
mapView
.
getMapboxMap
().
loadStyle
(
style
(
styleUri
=
M
ainViewModel
.
M
Y_MAP_BOX_STYLE
)
{
style
(
styleUri
=
MY_MAP_BOX_STYLE
)
{
+
geoJsonSource
(
DUMP_AREA_SOURCE
)
{
+
geoJsonSource
(
DUMP_AREA_SOURCE
)
{
data
(
mapData
?.
geojson
!!
)
data
(
mapData
?.
geojson
!!
)
LogUtils
.
d
(
get
(
"name"
).
literalValue
)
LogUtils
.
d
(
get
(
"name"
).
literalValue
)
...
...
app/src/main/java/com/waytous/anticollision/utils/Extensions.kt
View file @
2c0c90f1
...
@@ -3,7 +3,6 @@ package com.waytous.anticollision.utils
...
@@ -3,7 +3,6 @@ package com.waytous.anticollision.utils
import
android.content.Context
import
android.content.Context
import
android.graphics.Bitmap
import
android.graphics.Bitmap
import
android.graphics.Canvas
import
android.graphics.Canvas
import
android.graphics.Color
import
android.graphics.drawable.Drawable
import
android.graphics.drawable.Drawable
import
android.text.Spannable
import
android.text.Spannable
import
android.text.SpannableString
import
android.text.SpannableString
...
@@ -12,27 +11,6 @@ import android.widget.TextView
...
@@ -12,27 +11,6 @@ import android.widget.TextView
import
androidx.appcompat.app.AppCompatActivity
import
androidx.appcompat.app.AppCompatActivity
import
androidx.core.app.ActivityCompat
import
androidx.core.app.ActivityCompat
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
com.blankj.utilcode.util.LogUtils
import
com.mapbox.maps.Style
import
com.mapbox.maps.extension.style.expressions.dsl.generated.get
import
com.mapbox.maps.extension.style.layers.addLayer
import
com.mapbox.maps.extension.style.layers.generated.CircleLayer
import
com.mapbox.maps.extension.style.layers.generated.FillLayer
import
com.mapbox.maps.extension.style.layers.generated.LineLayer
import
com.mapbox.maps.extension.style.layers.generated.SymbolLayer
import
com.mapbox.maps.extension.style.layers.generated.circleLayer
import
com.mapbox.maps.extension.style.layers.generated.fillLayer
import
com.mapbox.maps.extension.style.layers.generated.lineLayer
import
com.mapbox.maps.extension.style.layers.generated.symbolLayer
import
com.mapbox.maps.extension.style.layers.properties.generated.LineCap
import
com.mapbox.maps.extension.style.layers.properties.generated.LineJoin
import
com.mapbox.maps.extension.style.layers.properties.generated.TextAnchor
import
com.mapbox.maps.extension.style.layers.properties.generated.TextRotationAlignment
import
com.mapbox.maps.extension.style.layers.properties.generated.Visibility
import
com.mapbox.maps.extension.style.sources.addSource
import
com.mapbox.maps.extension.style.sources.generated.GeoJsonSource
import
com.mapbox.maps.extension.style.sources.generated.geoJsonSource
import
com.waytous.anticollision.ui.MainViewModel
const
val
databaseName
=
"anti_collision.db"
const
val
databaseName
=
"anti_collision.db"
...
@@ -89,458 +67,6 @@ fun Context.getBitmapFromVectorDrawable(drawableId:Int,scale:Int = 2): Bitmap? {
...
@@ -89,458 +67,6 @@ fun Context.getBitmapFromVectorDrawable(drawableId:Int,scale:Int = 2): Bitmap? {
return
bitmap
return
bitmap
}
}
/**
* runablearea:可行驶区域
* */
fun
Style
.
addRunnableAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addRunnableAreaSource"
)
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addRunnableAreaSource,source = ${source.substring(0..15)}"
)
val
source
=
geoJsonSource
(
MainViewModel
.
RUNNABLE_AREA_SOURCE
){
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addRunnableAreaLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addRunnableAreaLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
RUNNABLE_AREA_LAYER
,
MainViewModel
.
RUNNABLE_AREA_SOURCE
){
fillColor
(
"#98a0a0"
)
fillOpacity
(
0.85
)
fillOutlineColor
(
"#FFFF00"
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
/**
* lanelayer:整个矿山边界路线
* */
fun
Style
.
addLaneSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
LANE_SOURCE
){
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addLaneLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneLayer"
)
val
lineLayer
=
lineLayer
(
MainViewModel
.
LANE_LAYER
,
MainViewModel
.
LANE_SOURCE
){
lineColor
(
"white"
)
lineWidth
(
3.0
)
lineJoin
(
LineJoin
.
ROUND
)
lineCap
(
LineCap
.
ROUND
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
lineLayer
)
}
/**
* staticobjs:静态对象区域
* */
fun
Style
.
addStaticObjectsSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
STATIC_OBJECTS_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addStaticObjectsFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
STATIC_OBJECTS_LAYER
,
MainViewModel
.
STATIC_OBJECTS_SOURCE
){
fillColor
(
"#98a0a0"
)
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addStaticObjectsSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
STATIC_OBJECTS_TEXT_LAYER
,
MainViewModel
.
STATIC_OBJECTS_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
/**
* diggingarea:挖掘区域
* */
fun
Style
.
addDiggingWorkAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDiggingWorkAreaSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
DIGGING_WORK_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addDiggingWorkAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
DIGGING_WORK_AREA_LAYER
,
MainViewModel
.
DIGGING_WORK_AREA_SOURCE
){
fillColor
(
"#886e26"
)
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addDiggingWorkAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDiggingWorkAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
DIGGING_WORK_AREA_TEXT_LAYER
,
MainViewModel
.
DIGGING_WORK_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
/**
* dumparea:排土区域
* */
fun
Style
.
addDumpAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDumpAreaSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
DUMP_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addDumpAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDumpAreaFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
DUMP_AREA_LAYER
,
MainViewModel
.
DUMP_AREA_SOURCE
){
fillColor
(
"#886e26"
)
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addDumpAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDumpAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
DUMP_AREA_TEXT_LAYER
,
MainViewModel
.
DUMP_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
/**
* barricade:挡墙
* */
fun
Style
.
addBarricadeSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addBarricadeSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
BARRICADE_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addBarricadeLineLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneLayer"
)
val
lineLayer
=
lineLayer
(
MainViewModel
.
BARRICADE_LAYER
,
MainViewModel
.
BARRICADE_SOURCE
){
lineColor
(
"blue"
)
lineWidth
(
4.0
)
lineJoin
(
LineJoin
.
ROUND
)
lineCap
(
LineCap
.
ROUND
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
lineLayer
)
}
/**
* obstacles:障碍物
* */
fun
Style
.
addObstaclesSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addObstaclesSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
OBSTACLES_SOURCE
)
{
url
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addObstaclesFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addObstaclesFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
OBSTACLES_LAYER
,
MainViewModel
.
OBSTACLES_SOURCE
){
fillColor
(
"#6f9bdd"
)
fillOpacity
(
0.8
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addObstaclesSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addObstaclesSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
OBSTACLES_TEXT_LAYER
,
MainViewModel
.
OBSTACLES_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
/**
* stationarea:静态物体
* */
fun
Style
.
addStationAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStationAreaSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
STATION_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addStationAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStationAreaFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
STATION_AREA_LAYER
,
MainViewModel
.
STATION_AREA_SOURCE
){
fillColor
(
"lightgreen"
)
fillOpacity
(
0.8
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addStationAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStationAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
STATION_AREA_TEXT_LAYER
,
MainViewModel
.
STATION_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
}
addLayer
(
symbolLayer
)
}
/**
* lanenode:道路节点
* */
fun
Style
.
addLaneNodeSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneNodeSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
LANE_NODE_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addLaneNodeCircleLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneNodeCircleLayer"
)
val
circleLayer
=
circleLayer
(
MainViewModel
.
LANE_NODE_LAYER
,
MainViewModel
.
LANE_NODE_SOURCE
){
circleColor
(
"red"
)
circleRadius
(
6.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
circleLayer
)
}
fun
Style
.
addLaneNodeSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneNodeSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
LANE_NODE_TEXT_LAYER
,
MainViewModel
.
LANE_NODE_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
9.0
)
textMaxWidth
(
10.0
)
}
addLayer
(
symbolLayer
)
}
/**
* parkspot:停车区
* */
fun
Style
.
addParkSpotSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addParkSpotSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
PARK_SPOT_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addParkSpotFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addParkSpotFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
PARK_SPOT_LAYER
,
MainViewModel
.
PARK_SPOT_SOURCE
){
fillColor
(
get
(
"#7e8185"
))
fillOpacity
(
0.8
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addParkSpotSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addParkSpotSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
PARK_SPOT_TEXT_LAYER
,
MainViewModel
.
PARK_SPOT_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
/**
* 电子围栏
* */
fun
Style
.
addElectronicFenceSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addElectronicFenceSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
ELECTRONIC_FENCE_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addElectronicFenceFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addElectronicFenceFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
ELECTRONIC_FENCE_LAYER
,
MainViewModel
.
ELECTRONIC_FENCE_SOURCE
){
fillColor
(
get
(
"color"
))
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addElectronicFenceSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addElectronicFenceSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
ELECTRONIC_FENCE_TEXT_LAYER
,
MainViewModel
.
ELECTRONIC_FENCE_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
fun
Style
.
addWetAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addWetAreaSource"
)
val
source
=
geoJsonSource
(
MainViewModel
.
WET_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
source
)
}
fun
Style
.
addWetAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addWetAreaFillLayer"
)
val
fillLayer
=
fillLayer
(
MainViewModel
.
WET_AREA_LAYER
,
MainViewModel
.
WET_AREA_SOURCE
){
fillColor
(
get
(
"color"
))
fillOpacity
(
0.8
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
fillLayer
)
}
fun
Style
.
addWetAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addWetAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
MainViewModel
.
WET_AREA_TEXT_LAYER
,
MainViewModel
.
WET_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
symbolLayer
)
}
fun
Style
.
addTruckPathSource
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addTruckPathSource"
)
val
source
=
geoJsonSource
(
"truckPathSource"
)
{
data
(
"{ \"type\": \"FeatureCollection\", \"features\":[]}"
)
}
addSource
(
source
)
}
fun
Style
.
addTruckPathLineLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addTruckPathLineLayer"
)
val
lineLayer
=
lineLayer
(
"truckPathLayer"
,
"truckPathSource"
){
lineColor
(
"green"
)
lineWidth
(
8.0
)
lineOpacity
(
0.8
)
lineJoin
(
LineJoin
.
ROUND
)
lineCap
(
LineCap
.
ROUND
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
lineLayer
)
}
fun
AppCompatActivity
.
checkSelfPermissionCompat
(
permission
:
String
)
=
fun
AppCompatActivity
.
checkSelfPermissionCompat
(
permission
:
String
)
=
ActivityCompat
.
checkSelfPermission
(
this
,
permission
)
ActivityCompat
.
checkSelfPermission
(
this
,
permission
)
...
...
app/src/main/java/com/waytous/anticollision/utils/MapExtensions.kt
0 → 100644
View file @
2c0c90f1
package
com.waytous.anticollision.utils
import
android.graphics.Color
import
com.blankj.utilcode.util.LogUtils
import
com.mapbox.maps.LayerPosition
import
com.mapbox.maps.Style
import
com.mapbox.maps.extension.style.expressions.dsl.generated.get
import
com.mapbox.maps.extension.style.layers.addLayer
import
com.mapbox.maps.extension.style.layers.addLayerBelow
import
com.mapbox.maps.extension.style.layers.generated.circleLayer
import
com.mapbox.maps.extension.style.layers.generated.fillLayer
import
com.mapbox.maps.extension.style.layers.generated.lineLayer
import
com.mapbox.maps.extension.style.layers.generated.symbolLayer
import
com.mapbox.maps.extension.style.layers.properties.generated.LineCap
import
com.mapbox.maps.extension.style.layers.properties.generated.LineJoin
import
com.mapbox.maps.extension.style.layers.properties.generated.TextAnchor
import
com.mapbox.maps.extension.style.layers.properties.generated.TextRotationAlignment
import
com.mapbox.maps.extension.style.layers.properties.generated.Visibility
import
com.mapbox.maps.extension.style.sources.addSource
import
com.mapbox.maps.extension.style.sources.generated.geoJsonSource
import
com.waytous.anticollision.ui.MainViewModel
const
val
MY_MAP_BOX_STYLE
=
"asset://style.json"
const
val
DUMP_AREA_SOURCE
=
"dumpAreaSource"
const
val
DUMP_AREA_LAYER
=
"dumpAreaLayer"
const
val
DUMP_AREA_TEXT_LAYER
=
"dumpAreaTextLayer"
const
val
OBSTACLES_SOURCE
=
"obstaclesSource"
const
val
OBSTACLES_LAYER
=
"obstaclesLayer"
const
val
OBSTACLES_TEXT_LAYER
=
"obstaclesTextLayer"
const
val
ELECTRONIC_FENCE_SOURCE
=
"electronicFenceSource"
const
val
ELECTRONIC_FENCE_LAYER
=
"electronicFenceLayer"
const
val
ELECTRONIC_FENCE_TEXT_LAYER
=
"electronicFenceTextLayer"
const
val
WET_AREA_SOURCE
=
"wetAreaSource"
const
val
WET_AREA_LAYER
=
"wetAreaLayer"
const
val
WET_AREA_TEXT_LAYER
=
"wetAreaTextLayer"
const
val
LANE_NODE_SOURCE
=
"laneNodeSource"
const
val
LANE_NODE_LAYER
=
"laneNodeLayer"
const
val
LANE_NODE_TEXT_LAYER
=
"laneNodeTextLayer"
const
val
LANE_SOURCE
=
"laneSource"
const
val
LANE_LAYER
=
"laneLayer"
const
val
LANE_TEXT_LAYER
=
"laneTextLayer"
const
val
RUNNABLE_AREA_SOURCE
=
"runnableAreaSource"
const
val
RUNNABLE_AREA_LAYER
=
"runnableAreaLayer"
const
val
RUNNABLE_AREA_TEXT_LAYER
=
"runnableAreaTextLayer"
const
val
DIGGING_WORK_AREA_SOURCE
=
"diggingWorkAreaSource"
const
val
DIGGING_WORK_AREA_LAYER
=
"diggingWorkAreaLayer"
const
val
DIGGING_WORK_AREA_TEXT_LAYER
=
"diggingWorkAreaTextLayer"
const
val
BARRICADE_SOURCE
=
"barricadeSource"
const
val
BARRICADE_LAYER
=
"barricadeLayer"
const
val
BARRICADE_TEXT_LAYER
=
"barricadeTextLayer"
const
val
STATION_AREA_SOURCE
=
"stationAreaSource"
const
val
STATION_AREA_LAYER
=
"stationAreaLayer"
const
val
STATION_AREA_TEXT_LAYER
=
"stationAreaTextLayer"
const
val
STATIC_OBJECTS_SOURCE
=
"staticObjectsSource"
const
val
STATIC_OBJECTS_LAYER
=
"staticObjectsLayer"
const
val
STATIC_OBJECTS_TEXT_LAYER
=
"staticObjectsTextLayer"
const
val
PARK_SPOT_SOURCE
=
"parkSpotSource"
const
val
PARK_SPOT_LAYER
=
"parkSpotLayer"
const
val
PARK_SPOT_TEXT_LAYER
=
"parkSpotTextLayer"
const
val
TRUCK_PATH_SOURCE
=
"truckPathSource"
const
val
TRUCK_PATH_LAYER
=
"truckPathLayer"
const
val
LONGITUDE
=
119.7622539014
const
val
LATITUDE
=
49.3795031825
const
val
ZOOM
=
16.0
/**
* runablearea:可行驶区域
* 地图图层由下往上依次:
* runablearea->staticobjs->diggingarea->dumparea->
* barricade->electronicFence->wetArea->lane->
* obstacles->stationarea->parkspot->lanenode
* */
fun
Style
.
addRunnableAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addRunnableAreaSource"
)
val
geoJsonSource
=
geoJsonSource
(
RUNNABLE_AREA_SOURCE
){
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addRunnableAreaLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addRunnableAreaLayer"
)
val
fillLayer
=
fillLayer
(
RUNNABLE_AREA_LAYER
,
RUNNABLE_AREA_SOURCE
){
fillColor
(
"#98a0a0"
)
fillOpacity
(
0.85
)
fillOutlineColor
(
"#FFFF00"
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
STATIC_OBJECTS_LAYER
))
{
addLayerBelow
(
fillLayer
,
STATIC_OBJECTS_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
/**
* staticobjs:静态对象区域
* */
fun
Style
.
addStaticObjectsSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsSource"
)
val
geoJsonSource
=
geoJsonSource
(
STATIC_OBJECTS_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addStaticObjectsFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsFillLayer"
)
val
fillLayer
=
fillLayer
(
STATIC_OBJECTS_LAYER
,
STATIC_OBJECTS_SOURCE
){
fillColor
(
"#98a0a0"
)
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
DIGGING_WORK_AREA_LAYER
))
{
addLayerBelow
(
fillLayer
,
DIGGING_WORK_AREA_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addStaticObjectsSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
STATIC_OBJECTS_TEXT_LAYER
,
STATIC_OBJECTS_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
DIGGING_WORK_AREA_LAYER
))
{
addLayerBelow
(
symbolLayer
,
DIGGING_WORK_AREA_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* diggingarea:挖掘区域
* */
fun
Style
.
addDiggingWorkAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDiggingWorkAreaSource"
)
val
geoJsonSource
=
geoJsonSource
(
DIGGING_WORK_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addDiggingWorkAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStaticObjectsFillLayer"
)
val
fillLayer
=
fillLayer
(
DIGGING_WORK_AREA_LAYER
,
DIGGING_WORK_AREA_SOURCE
){
fillColor
(
"#886e26"
)
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
DUMP_AREA_LAYER
))
{
addLayerBelow
(
fillLayer
,
DUMP_AREA_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addDiggingWorkAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDiggingWorkAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
DIGGING_WORK_AREA_TEXT_LAYER
,
DIGGING_WORK_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
DUMP_AREA_LAYER
))
{
addLayerBelow
(
symbolLayer
,
DUMP_AREA_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* dumparea:排土区域
* */
fun
Style
.
addDumpAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDumpAreaSource"
)
val
geoJsonSource
=
geoJsonSource
(
DUMP_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addDumpAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDumpAreaFillLayer"
)
val
fillLayer
=
fillLayer
(
DUMP_AREA_LAYER
,
DUMP_AREA_SOURCE
){
fillColor
(
"#886e26"
)
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
BARRICADE_LAYER
))
{
addLayerBelow
(
fillLayer
,
BARRICADE_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addDumpAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addDumpAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
DUMP_AREA_TEXT_LAYER
,
DUMP_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
BARRICADE_LAYER
))
{
addLayerBelow
(
symbolLayer
,
BARRICADE_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* barricade:挡墙
* */
fun
Style
.
addBarricadeSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addBarricadeSource"
)
val
geoJsonSource
=
geoJsonSource
(
BARRICADE_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addBarricadeLineLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addBarricadeLineLayer"
)
val
lineLayer
=
lineLayer
(
BARRICADE_LAYER
,
BARRICADE_SOURCE
){
lineColor
(
"blue"
)
lineWidth
(
4.0
)
lineJoin
(
LineJoin
.
ROUND
)
lineCap
(
LineCap
.
ROUND
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
ELECTRONIC_FENCE_LAYER
))
{
addLayerBelow
(
lineLayer
,
ELECTRONIC_FENCE_LAYER
)
}
else
{
addLayer
(
lineLayer
)
}
}
/**
* electronicFence:电子围栏
* */
fun
Style
.
addElectronicFenceSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addElectronicFenceSource"
)
val
geoJsonSource
=
geoJsonSource
(
ELECTRONIC_FENCE_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addElectronicFenceFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addElectronicFenceFillLayer"
)
val
fillLayer
=
fillLayer
(
ELECTRONIC_FENCE_LAYER
,
ELECTRONIC_FENCE_SOURCE
){
fillColor
(
get
(
"color"
))
fillOpacity
(
0.85
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
WET_AREA_LAYER
))
{
addLayerBelow
(
fillLayer
,
WET_AREA_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addElectronicFenceSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addElectronicFenceSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
ELECTRONIC_FENCE_TEXT_LAYER
,
ELECTRONIC_FENCE_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
WET_AREA_LAYER
))
{
addLayerBelow
(
symbolLayer
,
WET_AREA_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* wetArea:湿滑区
* */
fun
Style
.
addWetAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addWetAreaSource"
)
val
geoJsonSource
=
geoJsonSource
(
WET_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addWetAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addWetAreaFillLayer"
)
val
fillLayer
=
fillLayer
(
WET_AREA_LAYER
,
WET_AREA_SOURCE
){
fillColor
(
get
(
"color"
))
fillOpacity
(
0.8
)
fillAntialias
(
false
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
LANE_LAYER
))
{
addLayerBelow
(
fillLayer
,
LANE_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addWetAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addWetAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
WET_AREA_TEXT_LAYER
,
WET_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
LANE_LAYER
))
{
addLayerBelow
(
symbolLayer
,
LANE_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* lanelayer:整个矿山边界路线
* */
fun
Style
.
addLaneSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneSource"
)
val
geoJsonSource
=
geoJsonSource
(
LANE_SOURCE
){
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addLaneLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneLayer"
)
val
lineLayer
=
lineLayer
(
LANE_LAYER
,
LANE_SOURCE
){
lineColor
(
"white"
)
lineWidth
(
3.0
)
lineJoin
(
LineJoin
.
ROUND
)
lineCap
(
LineCap
.
ROUND
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
OBSTACLES_LAYER
))
{
addLayerBelow
(
lineLayer
,
OBSTACLES_LAYER
)
}
else
{
addLayer
(
lineLayer
)
}
}
/**
* obstacles:障碍物
* */
fun
Style
.
addObstaclesSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addObstaclesSource"
)
val
geoJsonSource
=
geoJsonSource
(
OBSTACLES_SOURCE
)
{
url
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addObstaclesFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addObstaclesFillLayer"
)
val
fillLayer
=
fillLayer
(
OBSTACLES_LAYER
,
OBSTACLES_SOURCE
){
fillColor
(
"#6f9bdd"
)
fillOpacity
(
0.8
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
STATION_AREA_LAYER
))
{
addLayerBelow
(
fillLayer
,
STATION_AREA_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addObstaclesSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addObstaclesSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
OBSTACLES_TEXT_LAYER
,
OBSTACLES_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
STATION_AREA_LAYER
))
{
addLayerBelow
(
symbolLayer
,
STATION_AREA_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* stationarea:静态物体
* */
fun
Style
.
addStationAreaSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStationAreaSource"
)
val
geoJsonSource
=
geoJsonSource
(
STATION_AREA_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addStationAreaFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStationAreaFillLayer"
)
val
fillLayer
=
fillLayer
(
STATION_AREA_LAYER
,
STATION_AREA_SOURCE
){
fillColor
(
"lightgreen"
)
fillOpacity
(
0.8
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
PARK_SPOT_LAYER
))
{
addLayerBelow
(
fillLayer
,
PARK_SPOT_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addStationAreaSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addStationAreaSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
STATION_AREA_TEXT_LAYER
,
STATION_AREA_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
}
if
(
styleLayerExists
(
PARK_SPOT_LAYER
))
{
addLayerBelow
(
symbolLayer
,
PARK_SPOT_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* parkspot:停车区
* */
fun
Style
.
addParkSpotSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addParkSpotSource"
)
val
geoJsonSource
=
geoJsonSource
(
PARK_SPOT_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addParkSpotFillLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addParkSpotFillLayer"
)
val
fillLayer
=
fillLayer
(
PARK_SPOT_LAYER
,
PARK_SPOT_SOURCE
){
fillColor
(
get
(
"#7e8185"
))
fillOpacity
(
0.8
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
LANE_NODE_LAYER
))
{
addLayerBelow
(
fillLayer
,
LANE_NODE_LAYER
)
}
else
{
addLayer
(
fillLayer
)
}
}
fun
Style
.
addParkSpotSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addParkSpotSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
PARK_SPOT_TEXT_LAYER
,
PARK_SPOT_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
16.0
)
textMaxWidth
(
10.0
)
visibility
(
Visibility
.
VISIBLE
)
}
if
(
styleLayerExists
(
LANE_NODE_LAYER
))
{
addLayerBelow
(
symbolLayer
,
LANE_NODE_LAYER
)
}
else
{
addLayer
(
symbolLayer
)
}
}
/**
* lanenode:道路节点
* */
fun
Style
.
addLaneNodeSource
(
source
:
String
){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneNodeSource"
)
val
geoJsonSource
=
geoJsonSource
(
LANE_NODE_SOURCE
)
{
data
(
source
)
}
addSource
(
geoJsonSource
)
}
fun
Style
.
addLaneNodeCircleLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneNodeCircleLayer"
)
val
circleLayer
=
circleLayer
(
LANE_NODE_LAYER
,
LANE_NODE_SOURCE
){
circleColor
(
"red"
)
circleRadius
(
6.0
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
circleLayer
)
}
fun
Style
.
addLaneNodeSymbolLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addLaneNodeSymbolLayer"
)
val
symbolLayer
=
symbolLayer
(
LANE_NODE_TEXT_LAYER
,
LANE_NODE_SOURCE
){
textColor
(
Color
.
BLACK
)
textField
(
get
(
"name"
))
textFont
(
listOf
(
"DIN Offc Pro Italic"
,
"Arial Unicode MS Regular"
))
textLineHeight
(
1.0
)
textPadding
(
1.0
)
textOffset
(
listOf
(
0.5
,-
0.5
))
textRotationAlignment
(
TextRotationAlignment
.
MAP
)
textAnchor
(
TextAnchor
.
TOP
)
textSize
(
9.0
)
textMaxWidth
(
10.0
)
}
addLayer
(
symbolLayer
)
}
fun
Style
.
addTruckPathSource
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addTruckPathSource"
)
val
source
=
geoJsonSource
(
TRUCK_PATH_SOURCE
)
{
data
(
"{ \"type\": \"FeatureCollection\", \"features\":[]}"
)
}
addSource
(
source
)
}
fun
Style
.
addTruckPathLineLayer
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"addTruckPathLineLayer"
)
val
lineLayer
=
lineLayer
(
TRUCK_PATH_LAYER
,
TRUCK_PATH_SOURCE
){
lineColor
(
"green"
)
lineWidth
(
8.0
)
lineOpacity
(
0.8
)
lineJoin
(
LineJoin
.
ROUND
)
lineCap
(
LineCap
.
ROUND
)
visibility
(
Visibility
.
VISIBLE
)
}
addLayer
(
lineLayer
)
}
fun
Style
.
adjustLayerOrder
(){
LogUtils
.
dTag
(
"MapBoxExtensions"
,
"adjustLayerOrder"
)
moveStyleLayer
(
TRUCK_PATH_LAYER
,
null
)
moveStyleLayer
(
LANE_NODE_LAYER
,
LayerPosition
(
null
,
TRUCK_PATH_LAYER
,
null
))
moveStyleLayer
(
LANE_NODE_TEXT_LAYER
,
LayerPosition
(
null
,
TRUCK_PATH_LAYER
,
null
))
moveStyleLayer
(
PARK_SPOT_LAYER
,
LayerPosition
(
null
,
LANE_NODE_LAYER
,
null
)
)
moveStyleLayer
(
PARK_SPOT_TEXT_LAYER
,
LayerPosition
(
null
,
LANE_NODE_LAYER
,
null
)
)
moveStyleLayer
(
STATION_AREA_LAYER
,
LayerPosition
(
null
,
PARK_SPOT_LAYER
,
null
)
)
moveStyleLayer
(
STATION_AREA_TEXT_LAYER
,
LayerPosition
(
null
,
PARK_SPOT_LAYER
,
null
)
)
moveStyleLayer
(
OBSTACLES_LAYER
,
LayerPosition
(
null
,
STATION_AREA_LAYER
,
null
)
)
moveStyleLayer
(
OBSTACLES_TEXT_LAYER
,
LayerPosition
(
null
,
STATION_AREA_LAYER
,
null
)
)
moveStyleLayer
(
LANE_LAYER
,
LayerPosition
(
null
,
OBSTACLES_LAYER
,
null
)
)
moveStyleLayer
(
WET_AREA_LAYER
,
LayerPosition
(
null
,
LANE_LAYER
,
null
))
moveStyleLayer
(
WET_AREA_TEXT_LAYER
,
LayerPosition
(
null
,
LANE_LAYER
,
null
)
)
moveStyleLayer
(
ELECTRONIC_FENCE_LAYER
,
LayerPosition
(
null
,
WET_AREA_LAYER
,
null
)
)
moveStyleLayer
(
ELECTRONIC_FENCE_TEXT_LAYER
,
LayerPosition
(
null
,
WET_AREA_LAYER
,
null
)
)
moveStyleLayer
(
BARRICADE_LAYER
,
LayerPosition
(
null
,
ELECTRONIC_FENCE_LAYER
,
null
)
)
moveStyleLayer
(
DUMP_AREA_LAYER
,
LayerPosition
(
null
,
BARRICADE_LAYER
,
null
)
)
moveStyleLayer
(
DUMP_AREA_TEXT_LAYER
,
LayerPosition
(
null
,
BARRICADE_LAYER
,
null
)
)
moveStyleLayer
(
DIGGING_WORK_AREA_LAYER
,
LayerPosition
(
null
,
DUMP_AREA_LAYER
,
null
)
)
moveStyleLayer
(
DIGGING_WORK_AREA_TEXT_LAYER
,
LayerPosition
(
null
,
DUMP_AREA_LAYER
,
null
)
)
moveStyleLayer
(
STATIC_OBJECTS_LAYER
,
LayerPosition
(
null
,
DIGGING_WORK_AREA_LAYER
,
null
)
)
moveStyleLayer
(
STATIC_OBJECTS_TEXT_LAYER
,
LayerPosition
(
null
,
DIGGING_WORK_AREA_LAYER
,
null
)
)
moveStyleLayer
(
RUNNABLE_AREA_LAYER
,
LayerPosition
(
null
,
STATIC_OBJECTS_LAYER
,
null
)
)
}
\ No newline at end of file
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