merge code

This commit is contained in:
qiji4215
2023-04-20 13:52:24 +08:00
parent 48e3e7817c
commit 13f835f467
5 changed files with 14 additions and 17 deletions

View File

@@ -31,8 +31,8 @@ android {
} }
} }
compileOptions { compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_11
} }
sourceSets { sourceSets {
main { main {

View File

@@ -3,9 +3,7 @@ package com.navinfo.collect.library.map.handler
import android.content.Context import android.content.Context
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.navinfo.collect.library.map.NIMapView import com.navinfo.collect.library.map.NIMapView
import org.oscim.core.GeoPoint
import org.oscim.layers.Layer import org.oscim.layers.Layer
import org.oscim.layers.marker.MarkerItem
abstract class BaseHandler(context: AppCompatActivity, mapView: NIMapView) { abstract class BaseHandler(context: AppCompatActivity, mapView: NIMapView) {
protected val mContext: AppCompatActivity = context protected val mContext: AppCompatActivity = context
@@ -29,6 +27,4 @@ abstract class BaseHandler(context: AppCompatActivity, mapView: NIMapView) {
fun removeOnMapClickListener() { fun removeOnMapClickListener() {
mMapView.setOnMapClickListener(null) mMapView.setOnMapClickListener(null)
} }
abstract fun <T> mutableListOf(): MutableList<GeoPoint>
} }

View File

@@ -196,7 +196,7 @@ open class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView) :
itemizedLayer = itemizedLayer =
MyItemizedLayer( MyItemizedLayer(
mMapView.vtmMap, mMapView.vtmMap,
mutableListOf<Any>(), mutableListOf(),
markerRendererFactory, markerRendererFactory,
object : MyItemizedLayer.OnItemGestureListener { object : MyItemizedLayer.OnItemGestureListener {
override fun onItemSingleTapUp( override fun onItemSingleTapUp(

View File

@@ -1,5 +1,6 @@
package com.navinfo.collect.library.map.handler package com.navinfo.collect.library.map.handler
import android.content.Context
import android.graphics.BitmapFactory import android.graphics.BitmapFactory
import android.widget.Toast import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity

View File

@@ -180,10 +180,10 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
//编辑点 //编辑点
if (editIndex > -1) { if (editIndex > -1) {
if (mPolygonLayer.points.size > 0) { if (mPolygonLayer.points.size > 0) {
val list: MutableList<GeoPoint> = mutableListOf<Any>() val list: MutableList<GeoPoint> = mutableListOf()
list.addAll(mPolygonLayer.points) list.addAll(mPolygonLayer.points)
if (list.size > 3) { if (list.size > 3) {
val newList: MutableList<GeoPoint> = mutableListOf<Any>() val newList: MutableList<GeoPoint> = mutableListOf()
if (editIndex == 0) { if (editIndex == 0) {
newList.add(list[list.size - 1]) newList.add(list[list.size - 1])
newList.add(geoPoint) newList.add(geoPoint)
@@ -197,7 +197,7 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
newList.add(geoPoint) newList.add(geoPoint)
newList.add(list[editIndex + 1]) newList.add(list[editIndex + 1])
} }
val newList2: MutableList<GeoPoint> = mutableListOf<Any>() val newList2: MutableList<GeoPoint> = mutableListOf()
for (i in editIndex + 1 until list.size) { for (i in editIndex + 1 until list.size) {
newList2.add(list[i]) newList2.add(list[i])
} }
@@ -211,7 +211,7 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
} }
if (editIndex < list.size) { if (editIndex < list.size) {
list.removeAt(editIndex) list.removeAt(editIndex)
val list2: MutableList<GeoPoint> = mutableListOf<Any>() val list2: MutableList<GeoPoint> = mutableListOf()
list2.addAll(list) list2.addAll(list)
list2.add(editIndex, geoPoint) list2.add(editIndex, geoPoint)
mPolygonLayer.setPoints(list2) mPolygonLayer.setPoints(list2)
@@ -224,7 +224,7 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
mEndpointLayer.addItem(markerItem) mEndpointLayer.addItem(markerItem)
mPathMakers.add(editIndex, markerItem) mPathMakers.add(editIndex, markerItem)
mPathLayerTemp.setStyle(newTempStyle) mPathLayerTemp.setStyle(newTempStyle)
val list: MutableList<GeoPoint> = mutableListOf<Any>() val list: MutableList<GeoPoint> = mutableListOf()
if (mPathMakers.size > 1) { if (mPathMakers.size > 1) {
list.add(mPathMakers[0].geoPoint) list.add(mPathMakers[0].geoPoint)
list.add(geoPoint) list.add(geoPoint)
@@ -237,10 +237,10 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
} }
editIndex = -1 editIndex = -1
} else { //新增点 } else { //新增点
val points: MutableList<GeoPoint> = mutableListOf<Any>() val points: MutableList<GeoPoint> = mutableListOf()
points.addAll(mPolygonLayer.points) points.addAll(mPolygonLayer.points)
if (points.size > 2) { if (points.size > 2) {
val list: MutableList<GeoPoint> = mutableListOf<Any>() val list: MutableList<GeoPoint> = mutableListOf()
points.add(points[0]) points.add(points[0])
list.add(points[0]) list.add(points[0])
list.add(geoPoint) list.add(geoPoint)
@@ -280,7 +280,7 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
if (mPolygonLayer.points.size > 0) { if (mPolygonLayer.points.size > 0) {
if (editIndex > -1) { if (editIndex > -1) {
val list: MutableList<GeoPoint> = val list: MutableList<GeoPoint> =
mutableListOf<Any>() mutableListOf()
if (editIndex == 0 || editIndex == mPathMakers.size - 1) { if (editIndex == 0 || editIndex == mPathMakers.size - 1) {
list.add(mPathMakers[editIndex].geoPoint) list.add(mPathMakers[editIndex].geoPoint)
list.add( list.add(
@@ -303,7 +303,7 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
// crossText.setText("") // crossText.setText("")
} else { } else {
val list: MutableList<GeoPoint> = val list: MutableList<GeoPoint> =
mutableListOf<Any>() mutableListOf()
if (mPolygonLayer.points.size > 1) { if (mPolygonLayer.points.size > 1) {
list.add(mPolygonLayer.points[0]) list.add(mPolygonLayer.points[0])
list.add( list.add(
@@ -329,7 +329,7 @@ open class PolygonHandler(context: AppCompatActivity, mapView: NIMapView) :
mPathLayerTemp.setPoints(list) mPathLayerTemp.setPoints(list)
if (mPolygonLayer.points.size > 1) { if (mPolygonLayer.points.size > 1) {
val list1: MutableList<GeoPoint> = val list1: MutableList<GeoPoint> =
mutableListOf<Any>() mutableListOf()
list1.addAll(mPolygonLayer.points) list1.addAll(mPolygonLayer.points)
list1.add( list1.add(
GeoPoint( GeoPoint(