Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/ui/activity/map/MainActivity.kt app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt app/src/main/java/com/navinfo/omqs/ui/fragment/evaluationresult/EvaluationResultViewModel.kt
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
|
||||
<service
|
||||
android:name="com.baidu.location.f"
|
||||
android:exported="true"
|
||||
android:enabled="true"
|
||||
android:process=":remote">
|
||||
<intent-filter>
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
<style-text style="bold" fill="#606060" id="ferry" k="name" size="12" stroke="#ffffff"
|
||||
stroke-width="2.0" />
|
||||
<!--speedlimit-->
|
||||
<style-text fill="#ffffff" id="max-speed-limit" k="name" size="15" stroke="#ffffff"
|
||||
<style-text fill="#ffffff" id="max-speed-limit" k="name" size="14" stroke="#ffffff"
|
||||
stroke-width="0.1" />
|
||||
|
||||
|
||||
@@ -1618,18 +1618,18 @@
|
||||
<m v="OMDB_SPEEDLIMIT">
|
||||
<m k="speedFlag">
|
||||
<m v="0">
|
||||
<circle fill="#0000ff" radius="26" scale-radius="true" stroke="#ff0000" stroke-width="2"/>
|
||||
<circle fill="#0000ff" radius="28" scale-radius="true" stroke="#ff0000" stroke-width="2"/>
|
||||
<m select="any">
|
||||
<text k="maxSpeed" use="max-speed-limit"></text>
|
||||
<caption k="minSpeed" dy="-28" fill="#000000" priority="5" size="15" stroke="#ffffff"
|
||||
<caption k="minSpeed" dy="-28" fill="#000000" priority="5" size="14" stroke="#ffffff"
|
||||
stroke-width="1.0"></caption>
|
||||
</m>
|
||||
</m>
|
||||
<m v="1">
|
||||
<circle fill="#0000ff" radius="26" scale-radius="true" stroke="#ff0000" stroke-width="2"/>
|
||||
<circle fill="#0000ff" radius="28" scale-radius="true" stroke="#ff0000" stroke-width="2"/>
|
||||
<m select="any">
|
||||
<text k="maxSpeed" use="max-speed-limit"></text>
|
||||
<caption k="minSpeed" dy="-28" fill="#000000" priority="5" size="15" stroke="#ffffff"
|
||||
<caption k="minSpeed" dy="-28" fill="#000000" priority="5" size="14" stroke="#ffffff"
|
||||
stroke-width="1.0"></caption>
|
||||
</m>
|
||||
</m>
|
||||
@@ -1641,5 +1641,50 @@
|
||||
<!--可变点限速-->
|
||||
<m v="OMDB_SPEEDLIMIT_VAR">
|
||||
</m>
|
||||
<!--车道数-->
|
||||
<m v="OMDB_LANE_NUM">
|
||||
<m k="laneNum">
|
||||
<m v="1">
|
||||
<line stroke="#545D6C" width="3"/>
|
||||
</m>
|
||||
<m v="2">
|
||||
<line stroke="#545D6C" width="6"/>
|
||||
</m>
|
||||
<m v="3">
|
||||
<line stroke="#545D6C" width="9"/>
|
||||
</m>
|
||||
<m v="4">
|
||||
<line stroke="#545D6C" width="12"/>
|
||||
</m>
|
||||
<m v="5">
|
||||
<line stroke="#545D6C" width="15"/>
|
||||
</m>
|
||||
<m v="6">
|
||||
<line stroke="#545D6C" width="18"/>
|
||||
</m>
|
||||
<m v="7">
|
||||
<line stroke="#545D6C" width="21"/>
|
||||
</m>
|
||||
<m v="8">
|
||||
<line stroke="#545D6C" width="24"/>
|
||||
</m>
|
||||
<m v="9">
|
||||
<line stroke="#545D6C" width="27"/>
|
||||
</m>
|
||||
<m v="10">
|
||||
<line stroke="#545D6C" width="30"/>
|
||||
</m>
|
||||
<m v="11">
|
||||
<line stroke="#545D6C" width="33"/>
|
||||
</m>
|
||||
<m v="12">
|
||||
<line stroke="#545D6C" width="36"/>
|
||||
</m>
|
||||
</m>
|
||||
</m>
|
||||
<!--车道中心线-->
|
||||
<m v="OMDB_LANE_LG_LINK">
|
||||
<line stroke="#ecf0f1" width="0.1" dasharray="35,35"/>
|
||||
</m>
|
||||
</m>
|
||||
</rendertheme>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.navinfo.collect.library.data.entity
|
||||
|
||||
import io.realm.RealmObject
|
||||
|
||||
open class HadLinkDvoBean @JvmOverloads constructor(
|
||||
/**
|
||||
* 图幅号
|
||||
*/
|
||||
var mesh: String = "",
|
||||
/**
|
||||
* linkPid
|
||||
*/
|
||||
var linkPid: String = "",
|
||||
/**
|
||||
* (几何)加偏后
|
||||
*/
|
||||
var geometry: String = ""
|
||||
|
||||
) : RealmObject()
|
||||
@@ -16,7 +16,7 @@ import java.util.*
|
||||
/**
|
||||
* 渲染要素对应的实体
|
||||
* */
|
||||
open class RenderEntity(): RealmObject() {
|
||||
open class RenderEntity() : RealmObject() {
|
||||
@PrimaryKey
|
||||
var id: String = UUID.randomUUID().toString() // id
|
||||
lateinit var name: String //要素名
|
||||
@@ -39,14 +39,37 @@ open class RenderEntity(): RealmObject() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
var wkt: Geometry? = null
|
||||
var properties: RealmDictionary<String?> = RealmDictionary()
|
||||
get() {
|
||||
if (field == null || field!!.isEmpty) {
|
||||
try {
|
||||
field = GeometryTools.createGeometry(geometry)
|
||||
} catch (e: Exception) {
|
||||
|
||||
}
|
||||
}
|
||||
return field
|
||||
}
|
||||
var properties: RealmDictionary<String> = RealmDictionary()
|
||||
var tileX: RealmSet<Int> = RealmSet() // x方向的tile编码
|
||||
var tileY: RealmSet<Int> = RealmSet() // y方向的tile编码
|
||||
|
||||
constructor(name: String, properties: RealmDictionary<String?>): this() {
|
||||
constructor(name: String): this() {
|
||||
this.name = name
|
||||
this.properties = properties
|
||||
}
|
||||
|
||||
companion object {
|
||||
object LinkTable {
|
||||
//道路linkId
|
||||
const val linkPid = "linkPid"
|
||||
}
|
||||
object LimitTable {
|
||||
const val linkPid = "linkPid"
|
||||
}
|
||||
object KindCodeTable {
|
||||
const val linkPid = "linkPid"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class GeoPoint(
|
||||
var latitude: Double = 0.0,
|
||||
var longitude: Double = 0.0
|
||||
) : Parcelable {
|
||||
fun toGeometry(): String {
|
||||
return "POINT($longitude $latitude)"
|
||||
}
|
||||
}
|
||||
//package com.navinfo.collect.library.map
|
||||
//
|
||||
//import android.os.Parcelable
|
||||
//import kotlinx.parcelize.Parcelize
|
||||
//
|
||||
//@Parcelize
|
||||
//data class GeoPoint(
|
||||
// var latitude: Double = 0.0,
|
||||
// var longitude: Double = 0.0
|
||||
//) : Parcelable {
|
||||
// fun toGeometry(): String {
|
||||
// return "POINT($longitude $latitude)"
|
||||
// }
|
||||
//}
|
||||
@@ -1,14 +1,20 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.os.Build
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.data.handler.DataNiLocationHandler
|
||||
import com.navinfo.collect.library.map.NIMapView.OnMapClickListener
|
||||
import com.navinfo.collect.library.map.handler.*
|
||||
import com.navinfo.collect.library.map.maphandler.MeasureLayerHandler
|
||||
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
||||
import com.navinfo.collect.library.map.handler.ViewportHandler
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
|
||||
/**
|
||||
* 地图控制器
|
||||
@@ -25,19 +31,35 @@ class NIMapController {
|
||||
lateinit var viewportHandler: ViewportHandler
|
||||
lateinit var measureLayerHandler: MeasureLayerHandler
|
||||
|
||||
fun init(context: AppCompatActivity, mapView: NIMapView, options: NIMapOptions? = null, mapPath: String, tracePath: String) {
|
||||
val onMapClickFlow = MutableSharedFlow<GeoPoint>()
|
||||
|
||||
fun init(
|
||||
context: AppCompatActivity,
|
||||
mapView: NIMapView,
|
||||
options: NIMapOptions? = null,
|
||||
mapPath: String,
|
||||
tracePath: String
|
||||
) {
|
||||
Constant.MAP_PATH = mapPath
|
||||
layerManagerHandler = LayerManagerHandler(context, mapView, tracePath)
|
||||
locationLayerHandler = LocationLayerHandler(context, mapView)
|
||||
animationHandler = AnimationHandler(context, mapView)
|
||||
markerHandle = MarkHandler(context, mapView)
|
||||
lineHandler = LineHandler(context, mapView)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
lineHandler = LineHandler(context, mapView)
|
||||
}
|
||||
polygonHandler = PolygonHandler(context, mapView)
|
||||
viewportHandler = ViewportHandler(context, mapView)
|
||||
measureLayerHandler = MeasureLayerHandler(context, mapView)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
measureLayerHandler = MeasureLayerHandler(context, mapView)
|
||||
}
|
||||
mMapView = mapView
|
||||
mMapView.setOnMapClickListener {
|
||||
context.lifecycleScope.launch {
|
||||
onMapClickFlow.emit(it)
|
||||
}
|
||||
}
|
||||
mapView.setOptions(options)
|
||||
mMapView.vtmMap.viewport().maxZoomLevel = Constant.MAX_ZOOM // 设置地图的最大级别
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.navinfo.collect.library.map
|
||||
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import org.json.JSONObject
|
||||
|
||||
|
||||
@@ -8,6 +9,7 @@ data class NIMapOptions(
|
||||
val showZoomControl: Boolean = true, //是否显示zoom按钮
|
||||
val zoomLevel: Double = 13.0, /// 地图比例尺初始级别
|
||||
val coordinate: NICoordinate = NICoordinate(39.907375, 116.391349),
|
||||
val maxZoom: Int = Constant.MAX_ZOOM
|
||||
) {
|
||||
companion object {
|
||||
fun fromJson(json: String): NIMapOptions {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.navinfo.collect.library.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -121,7 +122,7 @@ public final class NIMapView extends RelativeLayout {
|
||||
*
|
||||
* @param point
|
||||
*/
|
||||
void onMapClick(com.navinfo.collect.library.map.GeoPoint point);
|
||||
void onMapClick(GeoPoint point);
|
||||
|
||||
/**
|
||||
* 地图内 Poi 单击事件回调函数
|
||||
@@ -358,6 +359,7 @@ public final class NIMapView extends RelativeLayout {
|
||||
}
|
||||
MapPosition mapPosition = getVtmMap().getMapPosition();
|
||||
mapPosition.setZoom(options.getZoomLevel());
|
||||
getVtmMap().viewport().setMaxZoomLevel(options.getMaxZoom());
|
||||
mapPosition.setPosition(options.getCoordinate().getLatitude(), options.getCoordinate().getLongitude());
|
||||
getVtmMap().animator().animateTo(100, mapPosition);
|
||||
}
|
||||
@@ -819,7 +821,9 @@ public final class NIMapView extends RelativeLayout {
|
||||
LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
|
||||
if (layoutParams.getRules() != null) {
|
||||
for (int i = 0; i < layoutParams.getRules().length; i++) {
|
||||
layoutParams.removeRule(i);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
|
||||
layoutParams.removeRule(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (position) {
|
||||
@@ -926,7 +930,7 @@ public final class NIMapView extends RelativeLayout {
|
||||
GeoPoint geoPoint = mMap.viewport().fromScreenPoint(e.getX(), e.getY());
|
||||
if (g instanceof Gesture.Tap) { // 单击事件
|
||||
if (mapClickListener != null) {
|
||||
mapClickListener.onMapClick(new com.navinfo.collect.library.map.GeoPoint(geoPoint.getLatitude(), geoPoint.getLongitude()));
|
||||
mapClickListener.onMapClick(geoPoint);
|
||||
}
|
||||
} else if (g instanceof Gesture.DoubleTap) { // 双击
|
||||
if (mapDoubleClickListener != null) {
|
||||
|
||||
@@ -20,11 +20,11 @@ abstract class BaseHandler(context: AppCompatActivity, mapView: NIMapView) {
|
||||
mMapView.vtmMap.layers().remove(layer)
|
||||
}
|
||||
|
||||
fun setOnMapClickListener(listener: NIMapView.OnMapClickListener) {
|
||||
mMapView.setOnMapClickListener(listener)
|
||||
}
|
||||
|
||||
fun removeOnMapClickListener() {
|
||||
mMapView.setOnMapClickListener(null)
|
||||
}
|
||||
// fun setOnMapClickListener(listener: NIMapView.OnMapClickListener) {
|
||||
// mMapView.setOnMapClickListener(listener)
|
||||
// }
|
||||
//
|
||||
// fun removeOnMapClickListener() {
|
||||
// mMapView.setOnMapClickListener(null)
|
||||
// }
|
||||
}
|
||||
@@ -1,60 +1,30 @@
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.util.Log
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerItem
|
||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerRenderer
|
||||
import com.navinfo.collect.library.map.layers.MyItemizedLayer
|
||||
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
|
||||
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
|
||||
import com.navinfo.collect.library.map.source.OMDBTileSource
|
||||
import com.navinfo.collect.library.system.Constant
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import io.realm.Realm
|
||||
import io.realm.kotlin.where
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import okhttp3.Cache
|
||||
import okhttp3.OkHttpClient
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.oscim.android.canvas.AndroidBitmap
|
||||
import org.oscim.backend.CanvasAdapter
|
||||
import org.oscim.backend.canvas.Bitmap
|
||||
import org.oscim.backend.canvas.Paint
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.layers.GroupLayer
|
||||
import org.oscim.layers.marker.MarkerInterface
|
||||
import org.oscim.layers.marker.MarkerItem
|
||||
import org.oscim.layers.marker.MarkerRendererFactory
|
||||
import org.oscim.layers.marker.MarkerSymbol
|
||||
import org.oscim.layers.tile.buildings.BuildingLayer
|
||||
import org.oscim.layers.tile.vector.VectorTileLayer
|
||||
import org.oscim.layers.tile.vector.labeling.LabelLayer
|
||||
import org.oscim.layers.tile.vector.labeling.LabelTileLoaderHook
|
||||
import org.oscim.map.Map
|
||||
import org.oscim.map.Map.UpdateListener
|
||||
import org.oscim.tiling.source.OkHttpEngine.OkHttpFactory
|
||||
import org.oscim.tiling.source.mapfile.MapFileTileSource
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Layer 操作
|
||||
*/
|
||||
open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePath: String) : BaseHandler(context, mapView) {
|
||||
class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePath: String) : BaseHandler(context, mapView) {
|
||||
private var baseGroupLayer // 用于盛放所有基础底图的图层组,便于统一管理
|
||||
: GroupLayer? = null
|
||||
protected val mTracePath:String = tracePath
|
||||
private val mTracePath:String = tracePath
|
||||
|
||||
/**
|
||||
* 轨迹渲染图层
|
||||
@@ -76,10 +46,6 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
|
||||
* */
|
||||
private lateinit var omdbVectorTileLayer: VectorTileLayer
|
||||
private lateinit var omdbLabelLayer: LabelLayer
|
||||
/**
|
||||
* 文字大小
|
||||
*/
|
||||
private val NUM_13 = 13
|
||||
|
||||
init {
|
||||
initMap()
|
||||
@@ -142,6 +108,12 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tr
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化任务Link高亮的图层
|
||||
* */
|
||||
private fun initOMDBTaskVectorLayer() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换基础底图样式
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.layers.OmdbTaskLinkLayer
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.StringUtil
|
||||
import org.locationtech.jts.geom.LineString
|
||||
import org.oscim.android.canvas.AndroidBitmap
|
||||
import org.oscim.backend.canvas.Bitmap
|
||||
import org.oscim.core.GeoPoint
|
||||
@@ -19,11 +22,13 @@ import org.oscim.layers.marker.MarkerInterface
|
||||
import org.oscim.layers.marker.MarkerItem
|
||||
import org.oscim.layers.marker.MarkerSymbol
|
||||
import org.oscim.layers.vector.PathLayer
|
||||
import org.oscim.layers.vector.VectorLayer
|
||||
import org.oscim.layers.vector.geometries.Style
|
||||
import org.oscim.map.Map
|
||||
|
||||
open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
BaseHandler(context, mapView), Map.UpdateListener {
|
||||
@RequiresApi(Build.VERSION_CODES.N)
|
||||
class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(context, mapView),
|
||||
Map.UpdateListener {
|
||||
|
||||
private var editIndex: Int = -1;
|
||||
private val mPathMakers: MutableList<MarkerItem> = mutableListOf()
|
||||
@@ -51,6 +56,22 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
|
||||
private var bDrawLine = false
|
||||
|
||||
|
||||
private val mDefaultPathLayer: PathLayer
|
||||
|
||||
val omdbTaskLinkLayer by lazy {
|
||||
val omdbTaskLinkLayer = OmdbTaskLinkLayer(mMapView.vtmMap,
|
||||
Style.builder()
|
||||
// .stippleColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.fillColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.strokeWidth(4f)
|
||||
.fixed(true).build())
|
||||
addLayer(omdbTaskLinkLayer, NIMapView.LAYER_GROUPS.VECTOR)
|
||||
omdbTaskLinkLayer
|
||||
}
|
||||
|
||||
init {
|
||||
mMapView.vtmMap.events.bind(this)
|
||||
|
||||
@@ -61,29 +82,21 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
.fillColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fixed(true)
|
||||
.build()
|
||||
.fixed(true).build()
|
||||
|
||||
newTempStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30)
|
||||
.stippleWidth(30f)
|
||||
.strokeWidth(4f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fixed(true)
|
||||
.randomOffset(false)
|
||||
.build()
|
||||
|
||||
editTempStyle = Style.builder()
|
||||
.stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30)
|
||||
.stippleWidth(30f)
|
||||
.strokeWidth(8f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.fixed(true)
|
||||
.randomOffset(false)
|
||||
.build()
|
||||
newTempStyle =
|
||||
Style.builder().stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30).stippleWidth(30f).strokeWidth(4f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
|
||||
.fixed(true).randomOffset(false).build()
|
||||
|
||||
editTempStyle =
|
||||
Style.builder().stippleColor(context.resources.getColor(R.color.transparent, null))
|
||||
.stipple(30).stippleWidth(30f).strokeWidth(8f)
|
||||
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
|
||||
.fixed(true).randomOffset(false).build()
|
||||
mDefaultPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||
addLayer(mDefaultPathLayer, NIMapView.LAYER_GROUPS.VECTOR)
|
||||
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
|
||||
// addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
|
||||
|
||||
@@ -92,8 +105,7 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
|
||||
mPathMarkerBitmap = AndroidBitmap(
|
||||
BitmapFactory.decodeResource(
|
||||
mContext.resources,
|
||||
R.mipmap.icon_path_maker
|
||||
mContext.resources, R.mipmap.icon_path_maker
|
||||
)
|
||||
)
|
||||
val markerSymbol = MarkerSymbol(mPathMarkerBitmap, MarkerSymbol.HotspotPlace.CENTER)
|
||||
@@ -110,8 +122,7 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
if (item === item1) {
|
||||
mMapView.vtmMap.animator().animateTo(
|
||||
GeoPoint(
|
||||
item.getPoint().latitude,
|
||||
item.getPoint().longitude
|
||||
item.getPoint().latitude, item.getPoint().longitude
|
||||
)
|
||||
)
|
||||
editIndex = i
|
||||
@@ -139,6 +150,21 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
})
|
||||
}
|
||||
|
||||
fun showLine(geometry: String) {
|
||||
try {
|
||||
mDefaultPathLayer.clearPath()
|
||||
mDefaultPathLayer.setPoints(GeometryTools.getGeoPoints(geometry))
|
||||
mDefaultPathLayer.isEnabled = true
|
||||
} catch (e: Exception) {
|
||||
Toast.makeText(mContext, "高亮路线失败 ${e.message}", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
fun removeLine() {
|
||||
mDefaultPathLayer.clearPath()
|
||||
mDefaultPathLayer.isEnabled = false
|
||||
}
|
||||
|
||||
fun addDrawLinePoint(geoPoint: GeoPoint): List<GeoPoint> {
|
||||
|
||||
if (!bDrawLine) {
|
||||
@@ -210,7 +236,7 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
}
|
||||
}
|
||||
}
|
||||
if (editIndex < mPathLayer.getPoints().size) {
|
||||
if (editIndex < mPathLayer.points.size) {
|
||||
mPathLayer.points.removeAt(editIndex)
|
||||
val list2: MutableList<GeoPoint> = mutableListOf<GeoPoint>()
|
||||
list2.addAll(mPathLayer.points)
|
||||
@@ -268,8 +294,7 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
|
||||
|
||||
override fun onMapEvent(e: Event, mapPosition: MapPosition) {
|
||||
if (!bDrawLine)
|
||||
return
|
||||
if (!bDrawLine) return
|
||||
// if (mMapView.centerPixel[1] > mMapView.vtmMap.height / 2) {
|
||||
// val geoPoint =
|
||||
// mMapView.vtmMap.viewport()
|
||||
@@ -287,16 +312,14 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
list.add(mPathMakers[editIndex].geoPoint)
|
||||
list.add(
|
||||
GeoPoint(
|
||||
mapPosition.latitude,
|
||||
mapPosition.longitude
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
)
|
||||
} else {
|
||||
list.add(mPathMakers[editIndex - 1].geoPoint)
|
||||
list.add(
|
||||
GeoPoint(
|
||||
mapPosition.latitude,
|
||||
mapPosition.longitude
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
)
|
||||
list.add(mPathMakers[editIndex + 1].geoPoint)
|
||||
@@ -308,8 +331,7 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
list.add(mPathLayer.points[mPathLayer.points.size - 1])
|
||||
list.add(
|
||||
GeoPoint(
|
||||
mapPosition.latitude,
|
||||
mapPosition.longitude
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
)
|
||||
mPathLayerTemp.setPoints(list)
|
||||
@@ -317,8 +339,7 @@ open class LineHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
val listDis: MutableList<GeoPoint> = mutableListOf()
|
||||
listDis.add(
|
||||
GeoPoint(
|
||||
mapPosition.latitude,
|
||||
mapPosition.longitude
|
||||
mapPosition.latitude, mapPosition.longitude
|
||||
)
|
||||
)
|
||||
// val distance: Double =
|
||||
|
||||
@@ -1,27 +1,34 @@
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.baidu.location.BDAbstractLocationListener
|
||||
import com.baidu.location.BDLocation
|
||||
import com.baidu.location.LocationClient
|
||||
import com.baidu.location.LocationClientOption
|
||||
import com.baidu.location.LocationClientOption.LocationMode
|
||||
import com.navinfo.collect.library.data.entity.NiLocation
|
||||
import com.navinfo.collect.library.map.GeoPoint
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.layers.LocationLayer
|
||||
|
||||
|
||||
class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(context, mapView) {
|
||||
class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
BaseHandler(context, mapView) {
|
||||
|
||||
private var mCurrentLocation: BDLocation? = null
|
||||
private var bFirst = true
|
||||
private val mLocationLayer: LocationLayer = LocationLayer(mMapView.vtmMap)
|
||||
private lateinit var locationClient: LocationClient
|
||||
private lateinit var niLocationListener: NiLocationListener
|
||||
// private var niLocationListener: NiLocationListener by lazy{
|
||||
//
|
||||
// }
|
||||
|
||||
val niLocationFlow = MutableSharedFlow<NiLocation>(5)
|
||||
|
||||
init {
|
||||
///添加定位图层到地图,[NIMapView.LAYER_GROUPS.NAVIGATION] 是最上层layer组
|
||||
@@ -47,24 +54,34 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) : Bas
|
||||
//更多结果信息获取说明,请参照类参考中BDLocation类中的说明
|
||||
|
||||
//获取纬度信息
|
||||
val latitude = it.latitude
|
||||
// val latitude = it.latitude
|
||||
//获取经度信息
|
||||
val longitude = it.longitude
|
||||
// val longitude = it.longitude
|
||||
//获取定位精度,默认值为0.0f
|
||||
val radius = it.radius
|
||||
// val radius = it.radius
|
||||
//获取经纬度坐标类型,以LocationClientOption中设置过的坐标类型为准
|
||||
val coorType = it.coorType
|
||||
// val coorType = it.coorType
|
||||
//获取定位类型、定位错误返回码,具体信息可参照类参考中BDLocation类中的说明
|
||||
val errorCode = it.locType
|
||||
mCurrentLocation = it
|
||||
mLocationLayer.setPosition(it.latitude, it.longitude, it.radius)
|
||||
Log.e("qj","location==${it.longitude}==errorCode===$errorCode===${it.locTypeDescription}")
|
||||
if(niLocationListener!=null){
|
||||
getCurrentNiLocation()?.let { it1 -> niLocationListener.call(it1) }
|
||||
// Log.e(
|
||||
// "qj",
|
||||
// "location==${it.longitude}==errorCode===$errorCode===${it.locTypeDescription}"
|
||||
// )
|
||||
|
||||
// if (niLocationListener != null) {
|
||||
getCurrentNiLocation()?.let { it1 ->
|
||||
mContext.lifecycleScope.launch {
|
||||
niLocationFlow.emit(it1)
|
||||
}
|
||||
|
||||
// }// niLocationListener.call(it1) }
|
||||
}
|
||||
//第一次定位成功显示当前位置
|
||||
if (this.bFirst) {
|
||||
animateToCurrentPosition(16.0)
|
||||
this.bFirst = false
|
||||
}
|
||||
|
||||
}
|
||||
@@ -106,7 +123,7 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) : Bas
|
||||
locationClient.locOption = locationOption
|
||||
} catch (e: Throwable) {
|
||||
Toast.makeText(mContext, "定位初始化失败 $e", Toast.LENGTH_SHORT)
|
||||
Log.e("qj","定位初始化失败$e")
|
||||
Log.e("qj", "定位初始化失败$e")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,8 +176,8 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) : Bas
|
||||
|
||||
//获取当前定位对象
|
||||
fun getCurrentNiLocation(): NiLocation? {
|
||||
if(mCurrentLocation!=null){
|
||||
val niLocation:NiLocation = NiLocation()
|
||||
if (mCurrentLocation != null) {
|
||||
val niLocation: NiLocation = NiLocation()
|
||||
niLocation.longitude = mCurrentLocation!!.longitude
|
||||
niLocation.latitude = mCurrentLocation!!.latitude
|
||||
niLocation.direction = mCurrentLocation!!.direction.toDouble()
|
||||
@@ -185,10 +202,10 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) : Bas
|
||||
return null
|
||||
}
|
||||
|
||||
//设置定位回调
|
||||
fun setNiLocationListener(listener: NiLocationListener){
|
||||
niLocationListener = listener
|
||||
}
|
||||
// //设置定位回调
|
||||
// fun setNiLocationListener(listener: NiLocationListener) {
|
||||
// niLocationListener = listener
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -204,7 +221,7 @@ private class MyLocationListener(callback: (BDLocation) -> Unit) : BDAbstractLoc
|
||||
/**
|
||||
* 实现定位回调
|
||||
*/
|
||||
public class NiLocationListener(callback: (NiLocation) -> Unit){
|
||||
class NiLocationListener(callback: (NiLocation) -> Unit) {
|
||||
val call = callback;
|
||||
fun onReceiveLocation(location: NiLocation) {
|
||||
call(location)
|
||||
|
||||
@@ -10,7 +10,6 @@ import androidx.core.content.res.ResourcesCompat
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||
import com.navinfo.collect.library.map.GeoPoint
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerItem
|
||||
import com.navinfo.collect.library.map.cluster.ClusterMarkerRenderer
|
||||
@@ -27,6 +26,7 @@ import org.oscim.android.canvas.AndroidBitmap
|
||||
import org.oscim.backend.CanvasAdapter
|
||||
import org.oscim.backend.canvas.Bitmap
|
||||
import org.oscim.backend.canvas.Paint
|
||||
import org.oscim.core.GeoPoint
|
||||
import org.oscim.layers.marker.*
|
||||
import org.oscim.layers.marker.ItemizedLayer.OnItemGestureListener
|
||||
import org.oscim.map.Map
|
||||
@@ -90,9 +90,10 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
|
||||
}
|
||||
)
|
||||
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE);
|
||||
|
||||
//初始化之间数据图层
|
||||
initQsRecordDataLayer()
|
||||
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE);
|
||||
// 设置矢量图层均在12级以上才显示
|
||||
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
|
||||
if (e == Map.SCALE_EVENT) {
|
||||
@@ -127,13 +128,13 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
val marker = MarkerItem(
|
||||
tempTitle,
|
||||
description,
|
||||
org.oscim.core.GeoPoint(geoPoint.latitude, geoPoint.longitude)
|
||||
geoPoint
|
||||
)
|
||||
mDefaultMarkerLayer.addItem(marker);
|
||||
mMapView.vtmMap.updateMap(true)
|
||||
} else {
|
||||
marker.description = description
|
||||
marker.geoPoint = org.oscim.core.GeoPoint(geoPoint.latitude, geoPoint.longitude)
|
||||
marker.geoPoint = geoPoint
|
||||
mDefaultMarkerLayer.removeItem(marker)
|
||||
mDefaultMarkerLayer.addItem(marker)
|
||||
mMapView.vtmMap.updateMap(true)
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
package com.navinfo.collect.library.map.maphandler
|
||||
package com.navinfo.collect.library.map.handler
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.text.TextPaint
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.map.NIMapView
|
||||
import com.navinfo.collect.library.map.handler.BaseHandler
|
||||
import com.navinfo.collect.library.map.layers.NIPolygonLayer
|
||||
import com.navinfo.collect.library.utils.DistanceUtil
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.StringUtil.Companion.createUUID
|
||||
import org.oscim.android.canvas.AndroidBitmap
|
||||
import org.oscim.backend.CanvasAdapter
|
||||
import org.oscim.backend.canvas.Bitmap
|
||||
@@ -30,6 +28,7 @@ import org.oscim.layers.vector.geometries.Style
|
||||
import org.oscim.map.Map
|
||||
import java.math.BigDecimal
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
BaseHandler(context, mapView), Map.UpdateListener {
|
||||
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.navinfo.collect.library.map.layers;
|
||||
|
||||
import com.navinfo.collect.library.utils.GeometryTools;
|
||||
import org.locationtech.jts.geom.Geometry;
|
||||
import org.locationtech.jts.geom.LineString;
|
||||
import org.oscim.core.GeoPoint;
|
||||
import org.oscim.layers.vector.PathLayer;
|
||||
import org.oscim.layers.vector.geometries.LineDrawable;
|
||||
import org.oscim.layers.vector.geometries.PolygonDrawable;
|
||||
import org.oscim.layers.vector.geometries.Style;
|
||||
import org.oscim.map.Map;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by xiaoxiao on 2018/3/26.
|
||||
*/
|
||||
|
||||
public class MultiPathLayer extends PathLayer {
|
||||
private List<LineDrawable> pathDrawableList;
|
||||
|
||||
public MultiPathLayer(Map map, Style style) {
|
||||
super(map, style);
|
||||
mStyle = style;
|
||||
pathDrawableList = new ArrayList<>();
|
||||
}
|
||||
|
||||
public MultiPathLayer(Map map, Style style, String name) {
|
||||
this(map, style);
|
||||
}
|
||||
|
||||
public MultiPathLayer(Map map, int lineColor, float lineWidth, int fillColor, float fillAlpha) {
|
||||
this(map, Style.builder()
|
||||
.stippleColor(lineColor)
|
||||
.stipple(24)
|
||||
.stippleWidth(lineWidth)
|
||||
.strokeWidth(lineWidth)
|
||||
.strokeColor(lineColor).fillColor(fillColor).fillAlpha(fillAlpha)
|
||||
.fixed(true)
|
||||
.randomOffset(false)
|
||||
.build());
|
||||
}
|
||||
|
||||
public MultiPathLayer(Map map, int lineColor, int fillColor, float fillAlpha) {
|
||||
this(map, lineColor, 0.5f, fillColor, fillAlpha);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置polygon的点位
|
||||
*/
|
||||
public void setPathList(List<List<GeoPoint>> pointListList) {
|
||||
if (pointListList == null || pointListList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (List<GeoPoint> pointList : pointListList) {
|
||||
if (pointList == null || pointList.size() < 2) {
|
||||
return;
|
||||
}
|
||||
synchronized (this) {
|
||||
LineDrawable lineDrawable = new LineDrawable(pointList, mStyle);
|
||||
add(lineDrawable);
|
||||
pathDrawableList.add(lineDrawable);
|
||||
}
|
||||
mWorker.submit(0);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除正在绘制的polygon的图形
|
||||
*/
|
||||
public void removePathDrawable(int i) {
|
||||
if (pathDrawableList != null && pathDrawableList.size() > i) {
|
||||
remove(pathDrawableList.get(i));
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
public void removePathDrawable(List<GeoPoint> geoPointList) {
|
||||
LineString path = GeometryTools.getLineStrinGeo(geoPointList);
|
||||
removePolygonDrawable(path);
|
||||
}
|
||||
|
||||
public void removePathDrawable(String pathStr) {
|
||||
LineString path = (LineString) GeometryTools.createGeometry(pathStr);
|
||||
removePolygonDrawable(path);
|
||||
}
|
||||
|
||||
public void removePolygonDrawable(Geometry path) {
|
||||
if (pathDrawableList != null && !pathDrawableList.isEmpty()) {
|
||||
Iterator iterator = pathDrawableList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
LineDrawable lineDrawable = (LineDrawable) iterator.next();
|
||||
if (GeometryTools.createGeometry(lineDrawable.getGeometry().toString()).equals(path)) {
|
||||
remove(lineDrawable);
|
||||
iterator.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
mWorker.submit(0);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
public void addPathDrawable(List<GeoPoint> pointList) {
|
||||
if (pathDrawableList != null) {
|
||||
if (pointList == null || pointList.size() < 2) {
|
||||
return;
|
||||
}
|
||||
synchronized (this) {
|
||||
LineDrawable pathDrawable = new LineDrawable(pointList, mStyle);
|
||||
add(pathDrawable);
|
||||
pathDrawableList.add(pathDrawable);
|
||||
}
|
||||
mWorker.submit(0);
|
||||
}
|
||||
update();
|
||||
}
|
||||
|
||||
public void addPathDrawable(LineString lineString) {
|
||||
List<GeoPoint> geoPointList = GeometryTools.getGeoPoints(lineString.toString());
|
||||
addPathDrawable(geoPointList);
|
||||
}
|
||||
|
||||
public List<LineString> getAllPathList() {
|
||||
if (pathDrawableList != null && !pathDrawableList.isEmpty()) {
|
||||
List<LineString> pathList = new ArrayList<>();
|
||||
for (LineDrawable pathDrawable : pathDrawableList) {
|
||||
pathList.add((LineString) GeometryTools.createGeometry(pathDrawable.getGeometry().toString()));
|
||||
}
|
||||
return pathList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<List<GeoPoint>> getAllPathGeoPointList() {
|
||||
List<LineString> pathList = getAllPathList();
|
||||
if (pathList != null) {
|
||||
List<List<GeoPoint>> geopointList = new ArrayList<>();
|
||||
for (LineString path : pathList) {
|
||||
geopointList.add(GeometryTools.getGeoPoints(path.toString()));
|
||||
}
|
||||
return geopointList;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<LineDrawable> getPolygonDrawableList() {
|
||||
return pathDrawableList;
|
||||
}
|
||||
|
||||
public void setPolygonDrawableList(List<LineDrawable> pathDrawableList) {
|
||||
this.pathDrawableList = pathDrawableList;
|
||||
}
|
||||
|
||||
public void removeAllPathDrawable(){
|
||||
if (pathDrawableList != null && !pathDrawableList.isEmpty()) {
|
||||
Iterator iterator = pathDrawableList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
LineDrawable lineDrawable = (LineDrawable) iterator.next();
|
||||
remove(lineDrawable);
|
||||
iterator.remove();
|
||||
}
|
||||
mWorker.submit(0);
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.navinfo.collect.library.map.layers
|
||||
|
||||
import android.graphics.Color
|
||||
import com.navinfo.collect.library.R
|
||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||
import com.navinfo.collect.library.utils.GeometryTools
|
||||
import org.locationtech.jts.geom.Geometry
|
||||
import org.oscim.layers.vector.VectorLayer
|
||||
import org.oscim.layers.vector.geometries.Drawable
|
||||
import org.oscim.layers.vector.geometries.LineDrawable
|
||||
import org.oscim.layers.vector.geometries.Style
|
||||
import org.oscim.map.Map
|
||||
|
||||
class OmdbTaskLinkLayer(map: Map, private var style: Style) : VectorLayer(map) {
|
||||
private val lineMap = HashMap<String, Drawable>()
|
||||
|
||||
fun addLine(hadLinkDvoBean: HadLinkDvoBean, style: Style = this.style) {
|
||||
hadLinkDvoBean.let {
|
||||
if (!lineMap.containsKey(it.linkPid)) {
|
||||
// 添加geometry到图层上
|
||||
val lineDrawable = LineDrawable(GeometryTools.createGeometry(it.geometry), style)
|
||||
super.add(lineDrawable)
|
||||
lineMap[it.linkPid] = lineDrawable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun addLineList(hadLinkDvoBeanList: List<HadLinkDvoBean>, style: Style = this.style) {
|
||||
hadLinkDvoBeanList.forEach {
|
||||
addLine(it, style)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeLine(linkPid: String):Boolean {
|
||||
if (lineMap.containsKey(linkPid)) {
|
||||
super.remove(lineMap[linkPid])
|
||||
lineMap.remove(linkPid)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
fun removeLine(geometry: Geometry) {
|
||||
super.remove(geometry)
|
||||
}
|
||||
|
||||
fun setLineColor(color: Color) {
|
||||
this.style = Style.builder()
|
||||
.fillColor(color.toArgb())
|
||||
.fillAlpha(0.5f)
|
||||
.strokeColor(color.toArgb())
|
||||
.strokeWidth(4f)
|
||||
.fixed(true).build()
|
||||
}
|
||||
}
|
||||
@@ -418,7 +418,7 @@ public class GeometryTools {
|
||||
Geometry startGeo = createGeometry(startGeoPoint);
|
||||
Geometry endGeo = createGeometry(endGeoPoint);
|
||||
double d = startGeo.distance(endGeo);
|
||||
return d * 100000;
|
||||
return convertDistanceToDegree(d,startGeoPoint.getLatitude());
|
||||
}
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user