fix: 合并代码
This commit is contained in:
commit
5fbeb45e5a
@ -622,7 +622,7 @@
|
|||||||
"table": "OMDB_LANE_LINK_LG",
|
"table": "OMDB_LANE_LINK_LG",
|
||||||
"code": 5001,
|
"code": 5001,
|
||||||
"name": "车道中心线",
|
"name": "车道中心线",
|
||||||
"catch": true,
|
"catch": false,
|
||||||
"isDependOnOtherTable": false,
|
"isDependOnOtherTable": false,
|
||||||
"checkLinkId": false,
|
"checkLinkId": false,
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
|
@ -3,6 +3,7 @@ package com.navinfo.omqs.bean
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.google.gson.annotations.Expose
|
import com.google.gson.annotations.Expose
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.omqs.db.ImportPreProcess
|
import com.navinfo.omqs.db.ImportPreProcess
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import kotlin.reflect.KFunction
|
import kotlin.reflect.KFunction
|
||||||
@ -26,6 +27,10 @@ class ImportConfig {
|
|||||||
if (transformList.isNullOrEmpty()) {
|
if (transformList.isNullOrEmpty()) {
|
||||||
return renderEntity
|
return renderEntity
|
||||||
}
|
}
|
||||||
|
if(renderEntity.code==DataCodeEnum.OMDB_LANEINFO.code){
|
||||||
|
Log.e("车信","====车信")
|
||||||
|
}
|
||||||
|
|
||||||
for (transform in transformList) {
|
for (transform in transformList) {
|
||||||
// 开始执行转换
|
// 开始执行转换
|
||||||
val key: String = transform.k
|
val key: String = transform.k
|
||||||
|
@ -125,8 +125,7 @@ class ImportPreProcess {
|
|||||||
) * Math.sin(radian)
|
) * Math.sin(radian)
|
||||||
|
|
||||||
// 计算偏移后的点
|
// 计算偏移后的点
|
||||||
val coord =
|
val coord = Coordinate(point.getX() + dy, point.getY() - dx)
|
||||||
Coordinate(point.getX() + dy, point.getY() - dx)
|
|
||||||
|
|
||||||
// 记录偏移后的点位或线数据,如果数据为线时,记录的偏移后数据为最后一个点右移后,方向与线的最后两个点平行同向的单位向量
|
// 记录偏移后的点位或线数据,如果数据为线时,记录的偏移后数据为最后一个点右移后,方向与线的最后两个点平行同向的单位向量
|
||||||
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
|
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
|
||||||
@ -193,12 +192,11 @@ class ImportPreProcess {
|
|||||||
) * Math.sin(radian)
|
) * Math.sin(radian)
|
||||||
|
|
||||||
// 计算偏移后的点
|
// 计算偏移后的点
|
||||||
val coord =
|
val coord = Coordinate(point.getX() - dx, point.getY() - dy)
|
||||||
Coordinate(point.getX() - dx, point.getY() - dy)
|
|
||||||
|
|
||||||
// 将这个点记录在数据中
|
// 将这个点记录在数据中
|
||||||
val geometryTranslate: Geometry =
|
val geometryTranslate: Geometry = GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y))
|
||||||
GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y))
|
|
||||||
renderEntity.geometry = geometryTranslate.toString()
|
renderEntity.geometry = geometryTranslate.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,6 +667,15 @@ class ImportPreProcess {
|
|||||||
}
|
}
|
||||||
//insertData(listResult)
|
//insertData(listResult)
|
||||||
}
|
}
|
||||||
|
//将主表线转化为单个点,按点要素实现捕捉
|
||||||
|
if (Geometry.TYPENAME_LINESTRING == renderEntity.wkt?.geometryType) {
|
||||||
|
var coordinates = renderEntity.wkt?.coordinates
|
||||||
|
if(coordinates!=null){
|
||||||
|
val p1: Coordinate = coordinates[0]
|
||||||
|
renderEntity.geometry = GeometryTools.createGeometry(GeoPoint(p1.y,p1.x)).toString()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@ import androidx.activity.viewModels
|
|||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.lifecycle.viewModelScope
|
|
||||||
import androidx.navigation.Navigation
|
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
@ -25,6 +23,7 @@ import com.blankj.utilcode.util.ClipboardUtils
|
|||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
import com.navinfo.collect.library.map.handler.MeasureLayerHandler
|
||||||
import com.navinfo.collect.library.utils.DeflaterUtil
|
import com.navinfo.collect.library.utils.DeflaterUtil
|
||||||
@ -48,17 +47,13 @@ import com.navinfo.omqs.ui.other.BaseToast
|
|||||||
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
||||||
import com.navinfo.omqs.util.FlowEventBus
|
import com.navinfo.omqs.util.FlowEventBus
|
||||||
import com.navinfo.omqs.util.NaviStatus
|
import com.navinfo.omqs.util.NaviStatus
|
||||||
import com.navinfo.omqs.util.SignUtil
|
|
||||||
import com.navinfo.omqs.util.SpeakMode
|
import com.navinfo.omqs.util.SpeakMode
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
import org.oscim.renderer.GLViewport
|
import org.oscim.renderer.GLViewport
|
||||||
import org.videolan.vlc.Util
|
import org.videolan.vlc.Util
|
||||||
import sun.misc.BASE64Decoder
|
|
||||||
import sun.misc.BASE64Encoder
|
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.math.RoundingMode
|
import java.math.RoundingMode
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@ -824,6 +819,25 @@ class MainActivity : BaseActivity() {
|
|||||||
* zoomOut
|
* zoomOut
|
||||||
*/
|
*/
|
||||||
fun zoomOutOnclick(view: View) {
|
fun zoomOutOnclick(view: View) {
|
||||||
|
val result = mutableListOf<RenderEntity>()
|
||||||
|
for (i in 0 until 10) {
|
||||||
|
var renderEntity: RenderEntity = RenderEntity()
|
||||||
|
renderEntity.geometry = "POINT(116.2694${i}13016946 40.0844${i}5791644373 0)"
|
||||||
|
result.add(renderEntity)
|
||||||
|
}
|
||||||
|
//计算后
|
||||||
|
var index = 0
|
||||||
|
Log.e("qj","====计算开始")
|
||||||
|
var lastRender:RenderEntity = RenderEntity()
|
||||||
|
GeometryTools.groupByDistance(DataCodeEnum.OMDB_TRAFFIC_SIGN.code,result, 5.0)?.forEach {
|
||||||
|
if(lastRender!=null&&lastRender.geometry!=null&& lastRender.geometry != ""){
|
||||||
|
if(it.geometry!=lastRender.geometry){
|
||||||
|
Log.e("qj","${index++}====计算后"+it.geometry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lastRender = it
|
||||||
|
}
|
||||||
|
Log.e("qj","====计算结束")
|
||||||
mapController.animationHandler.zoomOut()
|
mapController.animationHandler.zoomOut()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<item
|
<item
|
||||||
android:id="@+id/personal_center_menu_version"
|
android:id="@+id/personal_center_menu_version"
|
||||||
android:icon="@drawable/ic_baseline_layers_24"
|
android:icon="@drawable/ic_baseline_layers_24"
|
||||||
android:title="版本:23QE4_V1.5.7_20231011_A" />
|
android:title="版本:23QE4_V1.5.8_20231103_A" />
|
||||||
</group>
|
</group>
|
||||||
<group android:checkableBehavior="single">
|
<group android:checkableBehavior="single">
|
||||||
<item android:title="小标题">
|
<item android:title="小标题">
|
||||||
|
@ -1565,7 +1565,7 @@
|
|||||||
|
|
||||||
<!-- 交通标牌 -->
|
<!-- 交通标牌 -->
|
||||||
<m v="OMDB_TRAFFIC_SIGN">
|
<m v="OMDB_TRAFFIC_SIGN">
|
||||||
<symbol repeat="false" repeat-gap="2000" repeat-start="0" rotate="true"
|
<symbol repeat="false" repeat-gap="2000" repeat-start="0" rotate="true" gland="true"
|
||||||
src="@src" symbol-height="24" symbol-width="24" degree="-90" dy="-30"></symbol>
|
src="@src" symbol-height="24" symbol-width="24" degree="-90" dy="-30"></symbol>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
@ -1847,12 +1847,12 @@
|
|||||||
<!-- 环岛 -->
|
<!-- 环岛 -->
|
||||||
<m v="OMDB_ROUNDABOUT">
|
<m v="OMDB_ROUNDABOUT">
|
||||||
<line stroke="#fcba5a" width="0.5" />
|
<line stroke="#fcba5a" width="0.5" />
|
||||||
<symbol repeat="false" repeat-start="0" gland="false" repeat-gap="0" src="assets:omdb/icon_2204_0.svg"></symbol>
|
<symbol repeat="false" repeat-start="0" repeat-gap="0" src="assets:omdb/icon_2204_0.svg"></symbol>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 上方障碍物 -->
|
<!-- 上方障碍物 -->
|
||||||
<m v="OMDB_OBJECT_OH_STRUCT">
|
<m v="OMDB_OBJECT_OH_STRUCT">
|
||||||
<symbol repeat="false" repeat-start="0" gland="false" repeat-gap="32" symbol-width="42" symbol-height="42" src="assets:omdb/icon_3001_0.svg"></symbol>
|
<symbol repeat="false" repeat-start="0" repeat-gap="32" symbol-width="42" symbol-height="42" src="assets:omdb/icon_3001_0.svg"></symbol>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 路口内交通岛 -->
|
<!-- 路口内交通岛 -->
|
||||||
@ -2022,7 +2022,7 @@
|
|||||||
|
|
||||||
<!-- 箭头 -->
|
<!-- 箭头 -->
|
||||||
<m v="OMDB_OBJECT_ARROW">
|
<m v="OMDB_OBJECT_ARROW">
|
||||||
<area use="obj-area" stroke="#00000000" repeat="false" src="@src" longEdge="n" hasDirect="true"></area>
|
<area use="obj-area" stroke="#ffffff" repeat="false" src="@src" longEdge="n" hasDirect="true"></area>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
<!-- 道路施工 -->
|
<!-- 道路施工 -->
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.collect.library.data.entity
|
package com.navinfo.collect.library.data.entity
|
||||||
|
|
||||||
|
import android.os.Parcelable
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import com.google.gson.reflect.TypeToken
|
import com.google.gson.reflect.TypeToken
|
||||||
@ -12,26 +13,25 @@ import io.realm.RealmObject
|
|||||||
import io.realm.RealmSet
|
import io.realm.RealmSet
|
||||||
import io.realm.annotations.Ignore
|
import io.realm.annotations.Ignore
|
||||||
import io.realm.annotations.PrimaryKey
|
import io.realm.annotations.PrimaryKey
|
||||||
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.locationtech.jts.geom.Geometry
|
import org.locationtech.jts.geom.Geometry
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染要素对应的实体
|
* 渲染要素对应的实体
|
||||||
* */
|
* */
|
||||||
open class ReferenceEntity() : RealmObject() {
|
@Parcelize
|
||||||
// @PrimaryKey
|
open class ReferenceEntity() : RealmObject(), Parcelable {
|
||||||
// var id: Int = 0 // id
|
@PrimaryKey
|
||||||
// var renderEntityId: Int = 0 // 参考的renderEntity的Id
|
var id: String = UUID.randomUUID().toString() // id
|
||||||
@Ignore
|
@Ignore
|
||||||
lateinit var name: String //要素名
|
lateinit var name: String //要素名
|
||||||
lateinit var table: String //要素表名
|
lateinit var table: String //要素表名
|
||||||
var propertiesDb: String = ""
|
var propertiesDb: String = ""
|
||||||
var code: String = "0" // 要素编码
|
var code: String = "0" // 要素编码
|
||||||
|
|
||||||
@Ignore
|
|
||||||
var zoomMin: Int = 18 //显示最小级别
|
var zoomMin: Int = 18 //显示最小级别
|
||||||
|
|
||||||
@Ignore
|
|
||||||
var zoomMax: Int = 23 //显示最大级别
|
var zoomMax: Int = 23 //显示最大级别
|
||||||
var taskId: Int = 0 //任务ID
|
var taskId: Int = 0 //任务ID
|
||||||
var enable: Int = 0 // 默认0不是显示 1为渲染显示
|
var enable: Int = 0 // 默认0不是显示 1为渲染显示
|
||||||
|
@ -10,20 +10,23 @@ import com.navinfo.collect.library.utils.GeometryTools
|
|||||||
import com.navinfo.collect.library.utils.GeometryToolsKt
|
import com.navinfo.collect.library.utils.GeometryToolsKt
|
||||||
import com.navinfo.collect.library.utils.StrZipUtil
|
import com.navinfo.collect.library.utils.StrZipUtil
|
||||||
import io.realm.RealmDictionary
|
import io.realm.RealmDictionary
|
||||||
|
import io.realm.RealmList
|
||||||
import io.realm.RealmObject
|
import io.realm.RealmObject
|
||||||
import io.realm.RealmSet
|
import io.realm.RealmSet
|
||||||
import io.realm.annotations.Ignore
|
import io.realm.annotations.Ignore
|
||||||
import io.realm.annotations.Index
|
import io.realm.annotations.Index
|
||||||
|
import io.realm.annotations.PrimaryKey
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.locationtech.jts.geom.Geometry
|
import org.locationtech.jts.geom.Geometry
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染要素对应的实体
|
* 渲染要素对应的实体
|
||||||
* */
|
* */
|
||||||
@Parcelize
|
@Parcelize
|
||||||
open class RenderEntity() : RealmObject(), Parcelable {
|
open class RenderEntity() : RealmObject(), Parcelable {
|
||||||
// @PrimaryKey
|
@PrimaryKey
|
||||||
// var id: String = UUID.randomUUID().toString() // id
|
var id: String = UUID.randomUUID().toString() // id
|
||||||
lateinit var name: String //要素名
|
lateinit var name: String //要素名
|
||||||
lateinit var table: String //要素表名
|
lateinit var table: String //要素表名
|
||||||
var code: String = "0" // 要素编码
|
var code: String = "0" // 要素编码
|
||||||
@ -108,7 +111,7 @@ open class RenderEntity() : RealmObject(), Parcelable {
|
|||||||
@Index
|
@Index
|
||||||
var linkPid: String = "" // RenderEntity关联的linkPid集合(可能会关联多个)
|
var linkPid: String = "" // RenderEntity关联的linkPid集合(可能会关联多个)
|
||||||
var linkRelation: LinkRelation? = null
|
var linkRelation: LinkRelation? = null
|
||||||
var referenceEntitys: RealmSet<ReferenceEntity>? = RealmSet()//
|
var referenceEntitys: RealmList<ReferenceEntity> = RealmList()//
|
||||||
|
|
||||||
constructor(name: String) : this() {
|
constructor(name: String) : this() {
|
||||||
this.name = name
|
this.name = name
|
||||||
|
@ -3,7 +3,7 @@ package com.navinfo.collect.library.enums
|
|||||||
/*
|
/*
|
||||||
* 要素枚举定义
|
* 要素枚举定义
|
||||||
* */
|
* */
|
||||||
enum class DataCodeEnum(var tableName: String, var code: String) {
|
public enum class DataCodeEnum(var tableName: String, var code: String) {
|
||||||
OMDB_NODE_FORM("点形态", "1007-6"),
|
OMDB_NODE_FORM("点形态", "1007-6"),
|
||||||
OMDB_NODE_PA("点形态PA", "1007-6"),
|
OMDB_NODE_PA("点形态PA", "1007-6"),
|
||||||
OMDB_CHECKPOINT("检查点", "1012"),
|
OMDB_CHECKPOINT("检查点", "1012"),
|
||||||
@ -33,6 +33,7 @@ enum class DataCodeEnum(var tableName: String, var code: String) {
|
|||||||
OMDB_RAMP_7("高速直连出口匝道高速出入口匝道", "2037-7"),
|
OMDB_RAMP_7("高速直连出口匝道高速出入口匝道", "2037-7"),
|
||||||
OMDB_MULTI_DIGITIZED("上下线分离", "2040"),
|
OMDB_MULTI_DIGITIZED("上下线分离", "2040"),
|
||||||
OMDB_LANE_NUM("车道数", "2041"),
|
OMDB_LANE_NUM("车道数", "2041"),
|
||||||
|
OMDB_LANE_TYPE_ACCESS("车道类型", "2092"),
|
||||||
OMDB_PHY_LANENUM("物理车道数", "2097"),
|
OMDB_PHY_LANENUM("物理车道数", "2097"),
|
||||||
OMDB_VIADUCT("高架", "2043"),
|
OMDB_VIADUCT("高架", "2043"),
|
||||||
OMDB_RDBOUND_BOUNDARYTYPE("道路边界类型", "2083"),
|
OMDB_RDBOUND_BOUNDARYTYPE("道路边界类型", "2083"),
|
||||||
@ -61,6 +62,7 @@ enum class DataCodeEnum(var tableName: String, var code: String) {
|
|||||||
OMDB_LINK_FORM2_11("风景路线", "2206-11"),
|
OMDB_LINK_FORM2_11("风景路线", "2206-11"),
|
||||||
OMDB_LINK_FORM2_12("车辆测试路段", "2206-12"),
|
OMDB_LINK_FORM2_12("车辆测试路段", "2206-12"),
|
||||||
OMDB_LINK_FORM2_13("驾照考试路段", "2206-13"),
|
OMDB_LINK_FORM2_13("驾照考试路段", "2206-13"),
|
||||||
|
OMDB_LANE_ACCESS("通行车辆类型Lane", "2638"),
|
||||||
OMDB_OBJECT_OH_STRUCT("上方障碍物","3001"),
|
OMDB_OBJECT_OH_STRUCT("上方障碍物","3001"),
|
||||||
OMDB_OBJECT_TEXT("文字", "3002"),
|
OMDB_OBJECT_TEXT("文字", "3002"),
|
||||||
OMDB_OBJECT_SYMBOL("符号", "3003"),
|
OMDB_OBJECT_SYMBOL("符号", "3003"),
|
||||||
|
@ -69,7 +69,6 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
mTileX = tile.tileX / mTileScale;
|
mTileX = tile.tileX / mTileScale;
|
||||||
mTileY = tile.tileY / mTileScale;
|
mTileY = tile.tileY / mTileScale;
|
||||||
mTileScale *= Tile.SIZE;
|
mTileScale *= Tile.SIZE;
|
||||||
|
|
||||||
listResult.stream().iterator().forEachRemaining(new Consumer<RenderEntity>() {
|
listResult.stream().iterator().forEachRemaining(new Consumer<RenderEntity>() {
|
||||||
@Override
|
@Override
|
||||||
public void accept(RenderEntity renderEntity) {
|
public void accept(RenderEntity renderEntity) {
|
||||||
@ -106,14 +105,7 @@ public class OMDBDataDecoder extends TileDecoder {
|
|||||||
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
||||||
}
|
}
|
||||||
} else if (geometry instanceof LineString) {
|
} else if (geometry instanceof LineString) {
|
||||||
//将车道中心进行转化面渲染
|
|
||||||
if(layerName!=null&&layerName.equals(DataCodeEnum.OMDB_LANE_LINK_LG.name())){
|
|
||||||
Log.e("qj","车道中心线转化开始");
|
|
||||||
processPolygon((Polygon) GeometryTools.createGeometry(GeometryTools.computeLine(0.000035,0.000035,geometry.toString())));
|
|
||||||
Log.e("qj","车道中心线转化结束");
|
|
||||||
}else{
|
|
||||||
processLineString((LineString) geometry);
|
processLineString((LineString) geometry);
|
||||||
}
|
|
||||||
} else if (geometry instanceof MultiLineString) {
|
} else if (geometry instanceof MultiLineString) {
|
||||||
MultiLineString multiLineString = (MultiLineString) geometry;
|
MultiLineString multiLineString = (MultiLineString) geometry;
|
||||||
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
||||||
|
@ -103,14 +103,7 @@ public class OMDBReferenceDecoder extends TileDecoder {
|
|||||||
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
||||||
}
|
}
|
||||||
} else if (geometry instanceof LineString) {
|
} else if (geometry instanceof LineString) {
|
||||||
//将车道中心进行转化面渲染
|
|
||||||
if(layerName!=null&&layerName.equals(DataCodeEnum.OMDB_LANE_LINK_LG.name())){
|
|
||||||
Log.e("qj","车道中心线转化开始");
|
|
||||||
processPolygon((Polygon)GeometryTools.createGeometry(GeometryTools.computeLine(0.000035,0.000035,geometry.toString())));
|
|
||||||
Log.e("qj","车道中心线转化结束");
|
|
||||||
}else{
|
|
||||||
processLineString((LineString) geometry);
|
processLineString((LineString) geometry);
|
||||||
}
|
|
||||||
} else if (geometry instanceof MultiLineString) {
|
} else if (geometry instanceof MultiLineString) {
|
||||||
MultiLineString multiLineString = (MultiLineString) geometry;
|
MultiLineString multiLineString = (MultiLineString) geometry;
|
||||||
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
||||||
|
@ -137,8 +137,13 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
/*过滤数据,只有最小x(屏幕的最小x或数据的最小x会被渲染,跨Tile的其他数据不再重复渲染)*/
|
/*过滤数据,只有最小x(屏幕的最小x或数据的最小x会被渲染,跨Tile的其他数据不再重复渲染)*/
|
||||||
// .filter((RenderEntity renderEntity) -> MercatorProjection.longitudeToTileX(viewport.fromScreenPoint(0,0).getLongitude(), (byte) Constant.DATA_ZOOM) == currentTileX || renderEntity.getTileX().stream().min(Integer::compare).get() == currentTileX)
|
// .filter((RenderEntity renderEntity) -> MercatorProjection.longitudeToTileX(viewport.fromScreenPoint(0,0).getLongitude(), (byte) Constant.DATA_ZOOM) == currentTileX || renderEntity.getTileX().stream().min(Integer::compare).get() == currentTileX)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
|
||||||
|
List<RenderEntity> list = GeometryTools.groupByDistance("3005", listResult, 5.0);
|
||||||
|
|
||||||
|
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, list);
|
||||||
|
|
||||||
mapDataSink.completed(QueryResult.SUCCESS);
|
mapDataSink.completed(QueryResult.SUCCESS);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.SUCCESS);
|
mapDataSink.completed(QueryResult.SUCCESS);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,8 @@ import android.os.Build;
|
|||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||||
|
|
||||||
import org.locationtech.jts.geom.Coordinate;
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
import org.locationtech.jts.geom.Geometry;
|
import org.locationtech.jts.geom.Geometry;
|
||||||
import org.locationtech.jts.geom.GeometryFactory;
|
import org.locationtech.jts.geom.GeometryFactory;
|
||||||
@ -1452,6 +1454,7 @@ public class GeometryTools {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 距离转米
|
* 距离转米
|
||||||
|
*
|
||||||
* @param distance
|
* @param distance
|
||||||
* @param latitude
|
* @param latitude
|
||||||
* @return
|
* @return
|
||||||
@ -1463,10 +1466,12 @@ public class GeometryTools {
|
|||||||
double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude));
|
double radianDegree = 2 * Math.asin(Math.sin(radianDistance / 2) / Math.cos(radianLatitude));
|
||||||
return Math.toDegrees(radianDegree);
|
return Math.toDegrees(radianDegree);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取指定tile对应的polygon面
|
* 获取指定tile对应的polygon面
|
||||||
|
*
|
||||||
* @param tile vtm中的瓦片
|
* @param tile vtm中的瓦片
|
||||||
* */
|
*/
|
||||||
public static Polygon getTilePolygon(Tile tile) {
|
public static Polygon getTilePolygon(Tile tile) {
|
||||||
// 获取当前tile的起点坐标
|
// 获取当前tile的起点坐标
|
||||||
double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel);
|
double startLongitude = MercatorProjection.tileXToLongitude(tile.tileX, tile.zoomLevel);
|
||||||
@ -1476,6 +1481,7 @@ public class GeometryTools {
|
|||||||
return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLatitude), new Coordinate(endLongitude, startLatitude),
|
return GeometryTools.createPolygonFromCoords(new Coordinate[]{new Coordinate(startLongitude, startLatitude), new Coordinate(endLongitude, startLatitude),
|
||||||
new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLatitude)});
|
new Coordinate(endLongitude, endLatitude), new Coordinate(startLongitude, endLatitude), new Coordinate(startLongitude, startLatitude)});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 经纬度转墨卡托
|
* 经纬度转墨卡托
|
||||||
*/
|
*/
|
||||||
@ -1568,4 +1574,67 @@ public class GeometryTools {
|
|||||||
|
|
||||||
return pointPairDistance;
|
return pointPairDistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按距离分组
|
||||||
|
*
|
||||||
|
* @param list
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static List<RenderEntity> groupByDistance(String code,List<RenderEntity> list, double disance) {
|
||||||
|
|
||||||
|
if (list == null || disance <= 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RenderEntity> listReslut = new ArrayList<>();
|
||||||
|
|
||||||
|
java.util.Map<String, RenderEntity> calcMap = new HashMap<>();
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
//遍历开始
|
||||||
|
for (RenderEntity renderEntity : list) {
|
||||||
|
|
||||||
|
if(!TextUtils.isEmpty(code)&&!renderEntity.getCode().equals(code)){
|
||||||
|
listReslut.add(renderEntity);
|
||||||
|
calcMap.put(renderEntity.getId(),renderEntity);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!calcMap.containsKey(renderEntity.getId())) {
|
||||||
|
|
||||||
|
//跟要素遍历对比,如果统一个点直接标记计算并记录在内,已经计算过不在二次计算
|
||||||
|
for (RenderEntity renderEntityTemp : list) {
|
||||||
|
|
||||||
|
if (!calcMap.containsKey(renderEntity.getId())) {
|
||||||
|
if (renderEntity.getId().equals(renderEntityTemp.getId())) {
|
||||||
|
listReslut.add(renderEntityTemp);
|
||||||
|
count++;
|
||||||
|
Log.e("qj", "====计算间距" + count);
|
||||||
|
calcMap.put(renderEntityTemp.getId(), renderEntityTemp);
|
||||||
|
} else {
|
||||||
|
GeoPoint geoPoint = createGeoPoint(renderEntity.getGeometry());
|
||||||
|
GeoPoint geoPoint1 = createGeoPoint(renderEntityTemp.getGeometry());
|
||||||
|
double dis = getDistance(geoPoint.getLatitude(), geoPoint.getLongitude(), geoPoint1.getLatitude(), geoPoint1.getLongitude());
|
||||||
|
Log.e("qj", "====计算间距" + dis);
|
||||||
|
if (geoPoint != null && geoPoint1 != null && dis <= disance) {
|
||||||
|
//只取第一个坐标
|
||||||
|
renderEntityTemp.setGeometry(renderEntity.getGeometry());
|
||||||
|
//renderEntity.setProperties(renderEntity.getProperties());
|
||||||
|
calcMap.put(renderEntityTemp.getId(), renderEntityTemp);
|
||||||
|
listReslut.add(renderEntityTemp);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.e("qj", listReslut.size()+"==判断后=="+list.size()+"==="+calcMap.size());
|
||||||
|
|
||||||
|
return listReslut;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user