1.增加搜索相关功能业务2.解决下载omdb后不及时渲染问题3.增加按任务及link关联渲染业务4.接口中增加按任务查询条件
This commit is contained in:
parent
1765b8801b
commit
57ccf8584b
@ -80,6 +80,7 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(':collect-library')
|
api project(':collect-library')
|
||||||
|
implementation project(path: ':vtm-android')
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||||
|
@ -4,45 +4,45 @@
|
|||||||
"table": "OMDB_CHECKPOINT",
|
"table": "OMDB_CHECKPOINT",
|
||||||
"code": 1012,
|
"code": 1012,
|
||||||
"name": "检查点",
|
"name": "检查点",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19
|
"zoomMax": 19
|
||||||
},
|
},
|
||||||
"2001": {
|
"2001": {
|
||||||
"table": "OMDB_RD_LINK",
|
"table": "OMDB_RD_LINK",
|
||||||
"code": 2001,
|
"code": 2001,
|
||||||
"name": "道路线",
|
"name": "道路线",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 17
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2002": {
|
"2002": {
|
||||||
"table": "OMDB_RD_LINK_FUNCTION_CLASS",
|
"table": "OMDB_RD_LINK_FUNCTION_CLASS",
|
||||||
"code": 2002,
|
"code": 2002,
|
||||||
"name": "道路功能等级",
|
"name": "道路功能等级",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2008": {
|
"2008": {
|
||||||
"table": "OMDB_RD_LINK_KIND",
|
"table": "OMDB_RD_LINK_KIND",
|
||||||
"code": 2008,
|
"code": 2008,
|
||||||
"name": "道路种别",
|
"name": "道路种别",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 20,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
},
|
},
|
||||||
"2010": {
|
"2010": {
|
||||||
"table": "OMDB_LINK_DIRECT",
|
"table": "OMDB_LINK_DIRECT",
|
||||||
"code": 2010,
|
"code": 2010,
|
||||||
"name": "道路方向",
|
"name": "道路方向",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
},
|
},
|
||||||
"2011": {
|
"2011": {
|
||||||
"table": "OMDB_LINK_NAME",
|
"table": "OMDB_LINK_NAME",
|
||||||
"code": 2011,
|
"code": 2011,
|
||||||
"name": "道路名",
|
"name": "道路名",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"checkLinkId": false,
|
"checkLinkId": false,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@
|
|||||||
"code": 2013,
|
"code": 2013,
|
||||||
"name": "车道边界类型",
|
"name": "车道边界类型",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"checkLinkId": false,
|
"checkLinkId": false,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
@ -73,22 +73,22 @@
|
|||||||
"table": "OMDB_LINK_SPEEDLIMIT",
|
"table": "OMDB_LINK_SPEEDLIMIT",
|
||||||
"code": 2019,
|
"code": 2019,
|
||||||
"name": "常规线限速",
|
"name": "常规线限速",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2020": {
|
"2020": {
|
||||||
"table": "OMDB_LINK_SPEEDLIMIT_COND",
|
"table": "OMDB_LINK_SPEEDLIMIT_COND",
|
||||||
"code": 2020,
|
"code": 2020,
|
||||||
"name": "条件线限速",
|
"name": "条件线限速",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2021": {
|
"2021": {
|
||||||
"table": "OMDB_LINK_SPEEDLIMIT_VAR",
|
"table": "OMDB_LINK_SPEEDLIMIT_VAR",
|
||||||
"code": 2021,
|
"code": 2021,
|
||||||
"name": "可变线限速",
|
"name": "可变线限速",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19
|
"zoomMax": 17
|
||||||
},
|
},
|
||||||
"2022": {
|
"2022": {
|
||||||
"table": "OMDB_CON_ACCESS",
|
"table": "OMDB_CON_ACCESS",
|
||||||
@ -115,15 +115,15 @@
|
|||||||
"code": 2083,
|
"code": 2083,
|
||||||
"name": "道路边界类型",
|
"name": "道路边界类型",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"checkLinkId": false
|
"checkLinkId": false
|
||||||
},
|
},
|
||||||
"2201":{
|
"2201":{
|
||||||
"table": "OMDB_BRIDGE",
|
"table": "OMDB_BRIDGE",
|
||||||
"code": 2201,
|
"code": 2201,
|
||||||
"name": "桥",
|
"name": "桥",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -137,8 +137,8 @@
|
|||||||
"table": "OMDB_TUNNEL",
|
"table": "OMDB_TUNNEL",
|
||||||
"code": 2202,
|
"code": 2202,
|
||||||
"name": "隧道",
|
"name": "隧道",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -152,8 +152,8 @@
|
|||||||
"table": "OMDB_INTERSECTION",
|
"table": "OMDB_INTERSECTION",
|
||||||
"code": 4001,
|
"code": 4001,
|
||||||
"name": "路口",
|
"name": "路口",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -167,8 +167,8 @@
|
|||||||
"table": "OMDB_SPEEDLIMIT",
|
"table": "OMDB_SPEEDLIMIT",
|
||||||
"code": 4002,
|
"code": 4002,
|
||||||
"name": "常规点限速",
|
"name": "常规点限速",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "maxSpeed",
|
"k": "maxSpeed",
|
||||||
@ -188,8 +188,8 @@
|
|||||||
"table": "OMDB_SPEEDLIMIT_COND",
|
"table": "OMDB_SPEEDLIMIT_COND",
|
||||||
"code": 4003,
|
"code": 4003,
|
||||||
"name": "条件点限速",
|
"name": "条件点限速",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "maxSpeed",
|
"k": "maxSpeed",
|
||||||
@ -203,8 +203,8 @@
|
|||||||
"table": "OMDB_SPEEDLIMIT_VAR",
|
"table": "OMDB_SPEEDLIMIT_VAR",
|
||||||
"code": 4004,
|
"code": 4004,
|
||||||
"name": "可变点限速",
|
"name": "可变点限速",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "location",
|
"k": "location",
|
||||||
@ -230,8 +230,8 @@
|
|||||||
"table": "OMDB_RESTRICTION",
|
"table": "OMDB_RESTRICTION",
|
||||||
"code": 4006,
|
"code": 4006,
|
||||||
"name": "普通交限",
|
"name": "普通交限",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -269,8 +269,8 @@
|
|||||||
"table": "OMDB_ELECTRONICEYE",
|
"table": "OMDB_ELECTRONICEYE",
|
||||||
"code": 4010,
|
"code": 4010,
|
||||||
"name": "电子眼",
|
"name": "电子眼",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -302,8 +302,8 @@
|
|||||||
"table": "OMDB_TRAFFICLIGHT",
|
"table": "OMDB_TRAFFICLIGHT",
|
||||||
"code": 4022,
|
"code": 4022,
|
||||||
"name": "交通灯",
|
"name": "交通灯",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -311,8 +311,8 @@
|
|||||||
"table": "OMDB_LANEINFO",
|
"table": "OMDB_LANEINFO",
|
||||||
"code": 4601,
|
"code": 4601,
|
||||||
"name": "车信",
|
"name": "车信",
|
||||||
"zoomMin": 16,
|
"zoomMin": 15,
|
||||||
"zoomMax": 19,
|
"zoomMax": 17,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
@ -339,7 +339,7 @@
|
|||||||
"code": 5001,
|
"code": 5001,
|
||||||
"name": "车道中心线",
|
"name": "车道中心线",
|
||||||
"zoomMin": 18,
|
"zoomMin": 18,
|
||||||
"zoomMax": 21,
|
"zoomMax": 20,
|
||||||
"transformer": [
|
"transformer": [
|
||||||
{
|
{
|
||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
|
@ -65,9 +65,9 @@ class Constant {
|
|||||||
const val DEBUG = true
|
const val DEBUG = true
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地图最多缩放级别23
|
* 地图最多缩放级别20
|
||||||
*/
|
*/
|
||||||
const val MAX_ZOOM = 22
|
const val MAX_ZOOM = 20
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否自动定位
|
* 是否自动定位
|
||||||
|
@ -14,6 +14,7 @@ import com.navinfo.collect.library.data.entity.RenderEntity
|
|||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
|
import com.navinfo.omqs.db.deep.ListList
|
||||||
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
import com.navinfo.omqs.hilt.OMDBDataBaseHiltFactory
|
||||||
import dagger.assisted.Assisted
|
import dagger.assisted.Assisted
|
||||||
import dagger.assisted.AssistedInject
|
import dagger.assisted.AssistedInject
|
||||||
@ -102,13 +103,10 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
FIELD_TYPE_NULL -> rowMap[columnName] = ""
|
FIELD_TYPE_NULL -> rowMap[columnName] = ""
|
||||||
FIELD_TYPE_INTEGER -> rowMap[columnName] =
|
FIELD_TYPE_INTEGER -> rowMap[columnName] =
|
||||||
getInt(columnIndex)
|
getInt(columnIndex)
|
||||||
|
|
||||||
FIELD_TYPE_FLOAT -> rowMap[columnName] =
|
FIELD_TYPE_FLOAT -> rowMap[columnName] =
|
||||||
getFloat(columnIndex)
|
getFloat(columnIndex)
|
||||||
|
|
||||||
FIELD_TYPE_BLOB -> rowMap[columnName] =
|
FIELD_TYPE_BLOB -> rowMap[columnName] =
|
||||||
String(getBlob(columnIndex), Charsets.UTF_8)
|
String(getBlob(columnIndex), Charsets.UTF_8)
|
||||||
|
|
||||||
else -> rowMap[columnName] = getString(columnIndex)
|
else -> rowMap[columnName] = getString(columnIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -127,8 +125,7 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
* @param omdbZipFile omdb数据抽取生成的Zip文件
|
* @param omdbZipFile omdb数据抽取生成的Zip文件
|
||||||
* @param configFile 对应的配置文件
|
* @param configFile 对应的配置文件
|
||||||
* */
|
* */
|
||||||
suspend fun importOmdbZipFile(omdbZipFile: File, task: TaskBean): Flow<String> =
|
suspend fun importOmdbZipFile(omdbZipFile: File, task: TaskBean): Flow<String> = withContext(Dispatchers.IO) {
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val unZipFolder = File(omdbZipFile.parentFile, "result")
|
val unZipFolder = File(omdbZipFile.parentFile, "result")
|
||||||
flow {
|
flow {
|
||||||
if (unZipFolder.exists()) {
|
if (unZipFolder.exists()) {
|
||||||
@ -158,18 +155,14 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
if (line == null || line.trim() == "") {
|
if (line == null || line.trim() == "") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
Log.d("ImportOMDBHelper", "解析第:${index + 1}行")
|
Log.d("ImportOMDBHelper", "解析第:${index+1}行")
|
||||||
val map = gson.fromJson<Map<String, Any>>(
|
val map = gson.fromJson<Map<String, Any>>(line, object:TypeToken<Map<String, Any>>(){}.getType())
|
||||||
line,
|
|
||||||
object : TypeToken<Map<String, Any>>() {}.getType()
|
|
||||||
)
|
|
||||||
.toMutableMap()
|
.toMutableMap()
|
||||||
map["qi_table"] = currentConfig.table
|
map["qi_table"] = currentConfig.table
|
||||||
map["qi_name"] = currentConfig.name
|
map["qi_name"] = currentConfig.name
|
||||||
map["qi_code"] =
|
map["qi_code"] =
|
||||||
if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
||||||
map["qi_code"] =
|
map["qi_code"] = if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
||||||
if (currentConfig.code == 0) currentConfig.code else currentEntry.key
|
|
||||||
map["qi_zoomMin"] = currentConfig.zoomMin
|
map["qi_zoomMin"] = currentConfig.zoomMin
|
||||||
map["qi_zoomMax"] = currentConfig.zoomMax
|
map["qi_zoomMax"] = currentConfig.zoomMax
|
||||||
|
|
||||||
@ -185,54 +178,82 @@ class ImportOMDBHelper @AssistedInject constructor(
|
|||||||
|
|
||||||
// 其他数据插入到Properties中
|
// 其他数据插入到Properties中
|
||||||
renderEntity.geometry = map["geometry"].toString()
|
renderEntity.geometry = map["geometry"].toString()
|
||||||
|
|
||||||
for ((key, value) in map) {
|
for ((key, value) in map) {
|
||||||
when (value) {
|
when (value) {
|
||||||
|
is String -> renderEntity.properties.put(key, value)
|
||||||
is String -> renderEntity.properties[key] = value
|
is Int -> renderEntity.properties.put(
|
||||||
|
key,
|
||||||
is Int -> renderEntity.properties[key] = value.toInt().toString()
|
value.toInt().toString()
|
||||||
|
)
|
||||||
is Double -> renderEntity.properties[key] = value.toDouble().toString()
|
is Double -> renderEntity.properties.put(
|
||||||
|
key,
|
||||||
else -> renderEntity.properties[key] = value.toString()
|
value.toDouble().toString()
|
||||||
|
)
|
||||||
|
else -> renderEntity.properties.put(key, value.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//如果要素不包括linkPid,需要从其他字段获得
|
|
||||||
if(!renderEntity.properties.containsKey("linkPid")){
|
|
||||||
//交限从进入线获取
|
|
||||||
if(renderEntity.properties.containsKey("linkIn")){
|
|
||||||
renderEntity.properties["linkPid"]= renderEntity.properties["linkIn"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//遍历判断只显示与任务Link相关的任务数据
|
//遍历判断只显示与任务Link相关的任务数据
|
||||||
if (currentConfig.checkLinkId && renderEntity.properties.containsKey("linkPid")) {
|
if(currentConfig.checkLinkId){
|
||||||
|
if(renderEntity.properties.containsKey("linkPid")&&renderEntity.properties["linkPid"]!=null){
|
||||||
var currentLinkPid = renderEntity.properties["linkPid"]
|
task.hadLinkDvoList.forEach{
|
||||||
|
if(it.linkPid==renderEntity.properties["linkPid"]){
|
||||||
task.hadLinkDvoList.forEach {
|
|
||||||
if (it.linkPid == currentLinkPid) {
|
|
||||||
renderEntity.enable = 1
|
renderEntity.enable = 1
|
||||||
Log.e("qj", "${renderEntity.name}==包括任务link")
|
Log.e("qj","${renderEntity.name}==包括任务link")
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}else if(renderEntity.table == "OMDB_RESTRICTION" && renderEntity.properties.containsKey("linkIn")){
|
||||||
renderEntity.enable = 2
|
if (renderEntity.properties["linkIn"] != null) {
|
||||||
Log.e("qj", "${renderEntity.name}==不包括任务linkPid")
|
|
||||||
|
var currentLinkPid = renderEntity.properties["linkIn"]
|
||||||
|
|
||||||
|
task.hadLinkDvoList.forEach{
|
||||||
|
if(it.linkPid==renderEntity.properties["linkPid"]){
|
||||||
|
renderEntity.enable = 1
|
||||||
|
Log.e("qj","${renderEntity.name}==包括任务link")
|
||||||
|
return@forEach
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else if(renderEntity.table == "OMDB_INTERSECTION" &&renderEntity.properties.containsKey("type")&& renderEntity.properties.containsKey("linkList")){
|
||||||
|
if (renderEntity.properties["type"]!=null&&renderEntity.properties["linkList"] != null) {
|
||||||
|
|
||||||
|
val type = renderEntity.properties["type"]
|
||||||
|
|
||||||
|
if(type=="1"){
|
||||||
|
|
||||||
|
if (renderEntity.properties["linkList"] != null) {
|
||||||
|
|
||||||
|
val list: List<ListList> = gson.fromJson(renderEntity.properties["linkList"], object : TypeToken<List<ListList>>() {}.type)
|
||||||
|
|
||||||
|
if (list != null) {
|
||||||
|
m@for (link in list){
|
||||||
|
for(hadLink in task.hadLinkDvoList){
|
||||||
|
if (link.featureType == 1 && hadLink.linkPid == link.linkPid) {
|
||||||
|
renderEntity.enable = 1
|
||||||
|
Log.e("qj", "${renderEntity.name}==包括任务link")
|
||||||
|
break@m
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
renderEntity.enable = 2
|
||||||
|
Log.e("qj","${renderEntity.name}==不包括任务linkPid")
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
renderEntity.enable = 2
|
||||||
|
Log.e("qj","${renderEntity.name}==不包括任务linkPid")
|
||||||
|
}
|
||||||
listResult.add(renderEntity)
|
listResult.add(renderEntity)
|
||||||
|
|
||||||
// 对renderEntity做预处理后再保存
|
// 对renderEntity做预处理后再保存
|
||||||
val resultEntity = importConfig.transformProperties(renderEntity)
|
val resultEntity = importConfig.transformProperties(renderEntity)
|
||||||
|
|
||||||
if (resultEntity != null) {
|
if (resultEntity != null) {
|
||||||
realm.insert(renderEntity)
|
realm.insert(renderEntity)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,6 +433,8 @@ class ImportPreProcess {
|
|||||||
referenceEntity.renderEntityId = renderEntity.id
|
referenceEntity.renderEntityId = renderEntity.id
|
||||||
referenceEntity.name = "${renderEntity.name}参考方向"
|
referenceEntity.name = "${renderEntity.name}参考方向"
|
||||||
referenceEntity.table = renderEntity.table
|
referenceEntity.table = renderEntity.table
|
||||||
|
referenceEntity.enable = renderEntity.enable
|
||||||
|
referenceEntity.taskId = renderEntity.taskId
|
||||||
// 与原数据使用相同的geometry
|
// 与原数据使用相同的geometry
|
||||||
referenceEntity.geometry = renderEntity.geometry.toString()
|
referenceEntity.geometry = renderEntity.geometry.toString()
|
||||||
referenceEntity.properties["qi_table"] = renderEntity.table
|
referenceEntity.properties["qi_table"] = renderEntity.table
|
||||||
|
@ -4,11 +4,14 @@ import android.os.Build
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
|
||||||
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity.Companion.LinkTable
|
import com.navinfo.collect.library.data.entity.RenderEntity.Companion.LinkTable
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
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.RealmDBParamUtils
|
||||||
|
import com.navinfo.omqs.bean.QRCodeBean
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
@ -60,7 +63,7 @@ class RealmOperateHelper() {
|
|||||||
val realmList = realm.where(RenderEntity::class.java)
|
val realmList = realm.where(RenderEntity::class.java)
|
||||||
.equalTo("table", "OMDB_RD_LINK")
|
.equalTo("table", "OMDB_RD_LINK")
|
||||||
.and()
|
.and()
|
||||||
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
|
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd").and().equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
.findAll()
|
.findAll()
|
||||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||||
val dataList = realm.copyFromRealm(realmList)
|
val dataList = realm.copyFromRealm(realmList)
|
||||||
@ -85,9 +88,7 @@ class RealmOperateHelper() {
|
|||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
suspend fun captureTaskLink(
|
suspend fun captureTaskLink(
|
||||||
taskId: Int,
|
|
||||||
point: GeoPoint,
|
point: GeoPoint,
|
||||||
buffer: Double = DEFAULT_BUFFER,
|
buffer: Double = DEFAULT_BUFFER,
|
||||||
bufferType: BUFFER_TYPE = DEFAULT_BUFFER_TYPE,
|
bufferType: BUFFER_TYPE = DEFAULT_BUFFER_TYPE,
|
||||||
@ -101,7 +102,7 @@ class RealmOperateHelper() {
|
|||||||
|
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
val realmList = realm.where(HadLinkDvoBean::class.java)
|
val realmList = realm.where(HadLinkDvoBean::class.java)
|
||||||
.equalTo("taskId", taskId)
|
.equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
.findAll()
|
.findAll()
|
||||||
var linkBean: HadLinkDvoBean? = null
|
var linkBean: HadLinkDvoBean? = null
|
||||||
var nearLast: Double = 99999.99
|
var nearLast: Double = 99999.99
|
||||||
@ -125,7 +126,7 @@ class RealmOperateHelper() {
|
|||||||
val realmR = realm.where(RenderEntity::class.java)
|
val realmR = realm.where(RenderEntity::class.java)
|
||||||
.equalTo("table", "OMDB_RD_LINK")
|
.equalTo("table", "OMDB_RD_LINK")
|
||||||
.and()
|
.and()
|
||||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid).and().equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
.findFirst()
|
.findFirst()
|
||||||
if (realmR != null) {
|
if (realmR != null) {
|
||||||
link = realm.copyFromRealm(realmR)
|
link = realm.copyFromRealm(realmR)
|
||||||
@ -133,13 +134,31 @@ class RealmOperateHelper() {
|
|||||||
return link
|
return link
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据markid查询获取对应数据
|
||||||
|
* @param markId
|
||||||
|
* */
|
||||||
|
suspend fun queryQcRecordBean(markId: String): QsRecordBean? {
|
||||||
|
var qsRecordBean: QsRecordBean? = null
|
||||||
|
val realm = Realm.getDefaultInstance()
|
||||||
|
val realmR = realm.where(QsRecordBean::class.java)
|
||||||
|
.equalTo("table", "QsRecordBean")
|
||||||
|
.and()
|
||||||
|
.equalTo("id", markId).and().equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
|
.findFirst()
|
||||||
|
if (realmR != null) {
|
||||||
|
qsRecordBean = realm.copyFromRealm(realmR)
|
||||||
|
}
|
||||||
|
return qsRecordBean
|
||||||
|
}
|
||||||
|
|
||||||
suspend fun queryLinkToMutableRenderEntityList(linkPid: String): MutableList<RenderEntity>? {
|
suspend fun queryLinkToMutableRenderEntityList(linkPid: String): MutableList<RenderEntity>? {
|
||||||
val resultList = mutableListOf<RenderEntity>()
|
val resultList = mutableListOf<RenderEntity>()
|
||||||
|
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
|
|
||||||
val realmR = realm.where(RenderEntity::class.java)
|
val realmR = realm.where(RenderEntity::class.java)
|
||||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid).and().equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
.findAll()
|
.findAll()
|
||||||
|
|
||||||
val dataList = realm.copyFromRealm(realmR)
|
val dataList = realm.copyFromRealm(realmR)
|
||||||
@ -184,7 +203,7 @@ class RealmOperateHelper() {
|
|||||||
val realmList = realm.where(RenderEntity::class.java)
|
val realmList = realm.where(RenderEntity::class.java)
|
||||||
.notEqualTo("table", "OMDB_RD_LINK")
|
.notEqualTo("table", "OMDB_RD_LINK")
|
||||||
.and()
|
.and()
|
||||||
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
|
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd").and().equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
.findAll()
|
.findAll()
|
||||||
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
// 将获取到的数据和查询的polygon做相交,只返回相交的数据
|
||||||
val queryResult = realmList?.stream()?.filter {
|
val queryResult = realmList?.stream()?.filter {
|
||||||
@ -214,7 +233,7 @@ class RealmOperateHelper() {
|
|||||||
val realmList = realm.where(RenderEntity::class.java)
|
val realmList = realm.where(RenderEntity::class.java)
|
||||||
.notEqualTo("table", "OMDB_RD_LINK")
|
.notEqualTo("table", "OMDB_RD_LINK")
|
||||||
.and()
|
.and()
|
||||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid).and().equalTo("taskId",RealmDBParamUtils.getTaskId())
|
||||||
.findAll()
|
.findAll()
|
||||||
result.addAll(realm.copyFromRealm(realmList))
|
result.addAll(realm.copyFromRealm(realmList))
|
||||||
return result
|
return result
|
||||||
|
6
app/src/main/java/com/navinfo/omqs/db/deep/LinkList.kt
Normal file
6
app/src/main/java/com/navinfo/omqs/db/deep/LinkList.kt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package com.navinfo.omqs.db.deep
|
||||||
|
|
||||||
|
data class ListList(
|
||||||
|
var featureType: Int = -1,
|
||||||
|
var linkPid: String = ""
|
||||||
|
)
|
@ -1,7 +1,6 @@
|
|||||||
package com.navinfo.omqs.http.taskdownload
|
package com.navinfo.omqs.http.taskdownload
|
||||||
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.lifecycle.Lifecycle
|
|
||||||
import androidx.lifecycle.LifecycleOwner
|
import androidx.lifecycle.LifecycleOwner
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
@ -10,10 +9,10 @@ import com.navinfo.omqs.Constant
|
|||||||
import com.navinfo.omqs.db.ImportOMDBHelper
|
import com.navinfo.omqs.db.ImportOMDBHelper
|
||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
import com.navinfo.omqs.tools.FileManager.Companion.FileDownloadStatus
|
||||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
|
||||||
import com.navinfo.omqs.util.DateTimeUtil
|
import com.navinfo.omqs.util.DateTimeUtil
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import org.oscim.android.theme.AssetsRenderTheme
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
@ -144,7 +143,7 @@ class TaskDownloadScope(
|
|||||||
if (it == "finish") {
|
if (it == "finish") {
|
||||||
change(FileDownloadStatus.DONE)
|
change(FileDownloadStatus.DONE)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
downloadManager.mapController.mMapView.updateMap(true)
|
downloadManager.mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
change(FileDownloadStatus.IMPORTING, it)
|
change(FileDownloadStatus.IMPORTING, it)
|
||||||
|
@ -19,8 +19,8 @@ import androidx.navigation.findNavController
|
|||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.map.NIMapOptions
|
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
@ -41,6 +41,7 @@ import com.navinfo.omqs.util.FlowEventBus
|
|||||||
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.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import org.oscim.android.theme.AssetsRenderTheme
|
||||||
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
|
||||||
@ -406,31 +407,49 @@ class MainActivity : BaseActivity() {
|
|||||||
this
|
this
|
||||||
).setTitle("坐标定位").setView(view)
|
).setTitle("坐标定位").setView(view)
|
||||||
val editText = view.findViewById<EditText>(R.id.dialog_edittext)
|
val editText = view.findViewById<EditText>(R.id.dialog_edittext)
|
||||||
editText.hint = "请输入经纬度例如:116.1234567,39.1234567"
|
val tabItemLayout = view.findViewById<TabLayout>(R.id.search_tab_layout)
|
||||||
|
editText.hint = "请输入LinkPid例如:12345678"
|
||||||
|
var index:Int = 0
|
||||||
|
tabItemLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
|
||||||
|
override fun onTabReselected(p0: TabLayout.Tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabUnselected(p0: TabLayout.Tab) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onTabSelected(p0: TabLayout.Tab) {
|
||||||
|
index = p0.position
|
||||||
|
editText.text = null
|
||||||
|
//清理已绘制线
|
||||||
|
mapController.lineHandler.removeLine()
|
||||||
|
when (p0.position) {
|
||||||
|
0 -> editText.hint = "请输入LinkPid例如:12345678"
|
||||||
|
1 -> editText.hint = "请输入MarkId例如:123456789"
|
||||||
|
2 -> editText.hint = "请输入经纬度例如:116.1234567,39.1234567"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
inputDialog.setNegativeButton("取消") { dialog, _ ->
|
inputDialog.setNegativeButton("取消") { dialog, _ ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
}
|
}
|
||||||
inputDialog.setPositiveButton("确定") { dialog, _ ->
|
inputDialog.setPositiveButton("确定") { dialog, _ ->
|
||||||
if (editText.text.isNotEmpty()) {
|
if (editText.text.isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
val parts = editText.text.toString().split("[,,\\s]".toRegex())
|
when (index) {
|
||||||
if (parts.size == 2) {
|
0 -> viewModel.search(SearchEnum.LINK,editText.text.toString(),dialog)
|
||||||
val x = parts[0].toDouble()
|
1 -> viewModel.search(SearchEnum.MARK,editText.text.toString(),dialog)
|
||||||
val y = parts[1].toDouble()
|
2 -> viewModel.search(SearchEnum.LOCATION,editText.text.toString(),dialog)
|
||||||
mapController.animationHandler.animationByLatLon(y, x)
|
|
||||||
} else {
|
|
||||||
Toast.makeText(this, "输入格式不正确", Toast.LENGTH_SHORT).show()
|
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Toast.makeText(this, "输入格式不正确", Toast.LENGTH_SHORT).show()
|
Toast.makeText(this, "输入格式不正确", Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dialog.dismiss()
|
|
||||||
}
|
}
|
||||||
inputDialog.show()
|
inputDialog.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
|
||||||
@ -512,7 +531,7 @@ class MainActivity : BaseActivity() {
|
|||||||
* 点击2\3D
|
* 点击2\3D
|
||||||
*/
|
*/
|
||||||
fun onClick2DOr3D() {
|
fun onClick2DOr3D() {
|
||||||
|
viewModel.click2Dor3D()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -627,7 +646,7 @@ class MainActivity : BaseActivity() {
|
|||||||
* 点击结束轨迹操作
|
* 点击结束轨迹操作
|
||||||
*/
|
*/
|
||||||
fun mediaFlagOnclick() {
|
fun mediaFlagOnclick() {
|
||||||
/* viewModel.setMediaFlag(!viewModel.isMediaFlag())
|
/* viewModel.setMediaFlag(!viewModel.isMediaFlag())
|
||||||
binding.mainActivitySnapshotMediaFlag.isSelected = viewModel.isMediaFlag()*/
|
binding.mainActivitySnapshotMediaFlag.isSelected = viewModel.isMediaFlag()*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,7 +844,7 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showMainActivityBottomSheetGroup(){
|
private fun showMainActivityBottomSheetGroup() {
|
||||||
binding.mainActivityBottomSheetGroup.visibility = View.VISIBLE
|
binding.mainActivityBottomSheetGroup.visibility = View.VISIBLE
|
||||||
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 65)
|
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 65)
|
||||||
mapController.mMapView.vtmMap.animator().animateTo(
|
mapController.mMapView.vtmMap.animator().animateTo(
|
||||||
@ -836,7 +855,7 @@ class MainActivity : BaseActivity() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun hideMainActivityBottomSheetGroup(){
|
private fun hideMainActivityBottomSheetGroup() {
|
||||||
binding.mainActivityBottomSheetGroup.visibility = View.GONE
|
binding.mainActivityBottomSheetGroup.visibility = View.GONE
|
||||||
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 5)
|
mapController.mMapView.setScaleBarLayer(GLViewport.Position.BOTTOM_CENTER, 128, 5)
|
||||||
mapController.mMapView.vtmMap.animator().animateTo(
|
mapController.mMapView.vtmMap.animator().animateTo(
|
||||||
|
@ -34,6 +34,7 @@ import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
|||||||
import com.navinfo.collect.library.map.handler.OnTaskLinkItemClickListener
|
import com.navinfo.collect.library.map.handler.OnTaskLinkItemClickListener
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
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.RealmDBParamUtils
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
@ -280,8 +281,7 @@ class MainViewModel @Inject constructor(
|
|||||||
initNILocationData()
|
initNILocationData()
|
||||||
}
|
}
|
||||||
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
sharedPreferences.registerOnSharedPreferenceChangeListener(this)
|
||||||
com.navinfo.collect.library.system.Constant.TASK_ID =
|
RealmDBParamUtils.setTaskId(sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1))
|
||||||
sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
|
||||||
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
socketServer = SocketServer(mapController, traceDataBase, sharedPreferences)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,5 +1053,73 @@ class MainViewModel @Inject constructor(
|
|||||||
fun cancelTrace() {
|
fun cancelTrace() {
|
||||||
timer?.cancel()
|
timer?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun click2Dor3D(){
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
Log.e(
|
||||||
|
"qj",
|
||||||
|
"${
|
||||||
|
Realm.getDefaultInstance().where(RenderEntity::class.java).findAll().size
|
||||||
|
}==安装数量"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 搜索接口
|
||||||
|
* @param searchEnum 枚举类
|
||||||
|
* @param msg 搜索内容
|
||||||
|
*/
|
||||||
|
fun search(searchEnum: SearchEnum,msg:String,dialog:DialogInterface){
|
||||||
|
if(searchEnum!=null&&msg.isNotEmpty()&&dialog!=null){
|
||||||
|
when (searchEnum) {
|
||||||
|
SearchEnum.LINK -> {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val link = realmOperateHelper.queryLink(linkPid = msg)
|
||||||
|
if(link!=null){
|
||||||
|
link?.let { l ->
|
||||||
|
mapController.lineHandler.showLine(l.geometry)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
withContext(Dispatchers.Main){
|
||||||
|
Toast.makeText(mapController.mMapView.context, "未查询到数据", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SearchEnum.MARK -> {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val qsRecordBean = realmOperateHelper.queryQcRecordBean(markId = msg)
|
||||||
|
if(qsRecordBean!=null){
|
||||||
|
qsRecordBean?.let { l ->
|
||||||
|
val naviController = (mapController.mMapView.context as Activity).findNavController(R.id.main_activity_right_fragment)
|
||||||
|
val bundle = Bundle()
|
||||||
|
bundle.putString("QsId", l.id)
|
||||||
|
naviController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||||
|
ToastUtils.showLong(l.classType)
|
||||||
|
dialog.dismiss()
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
withContext(Dispatchers.Main){
|
||||||
|
Toast.makeText(mapController.mMapView.context, "未查询到数据", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SearchEnum.LOCATION -> {
|
||||||
|
val parts = msg.split("[,,\\s]".toRegex())
|
||||||
|
if (parts.size == 2) {
|
||||||
|
val x = parts[0].toDouble()
|
||||||
|
val y = parts[1].toDouble()
|
||||||
|
mapController.animationHandler.animationByLatLon(y, x)
|
||||||
|
dialog.dismiss()
|
||||||
|
} else {
|
||||||
|
Toast.makeText(mapController.mMapView.context, "输入格式不正确", Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.navinfo.omqs.ui.activity.map
|
||||||
|
|
||||||
|
enum class SearchEnum {
|
||||||
|
LINK,LOCATION,MARK
|
||||||
|
}
|
@ -220,7 +220,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
liveDataQsRecordBean.value?.let {
|
liveDataQsRecordBean.value?.let {
|
||||||
|
|
||||||
val taskLink =
|
val taskLink =
|
||||||
realmOperateHelper.captureTaskLink(liveDataTaskBean.value!!.id, point)
|
realmOperateHelper.captureTaskLink(point)
|
||||||
if (taskLink != null) {
|
if (taskLink != null) {
|
||||||
it.linkId = taskLink.linkPid
|
it.linkId = taskLink.linkPid
|
||||||
mapController.lineHandler.showLine(taskLink.geometry)
|
mapController.lineHandler.showLine(taskLink.geometry)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.qsrecordlist
|
package com.navinfo.omqs.ui.fragment.qsrecordlist
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.content.SharedPreferences
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
@ -9,6 +10,7 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
import com.navinfo.collect.library.data.entity.QsRecordBean
|
import com.navinfo.collect.library.data.entity.QsRecordBean
|
||||||
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.ui.activity.map.MainActivity
|
import com.navinfo.omqs.ui.activity.map.MainActivity
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
@ -19,14 +21,16 @@ import javax.inject.Inject
|
|||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class QsRecordListViewModel @Inject constructor(
|
class QsRecordListViewModel @Inject constructor(
|
||||||
|
private val sharedPreferences: SharedPreferences
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
val liveDataQSList = MutableLiveData<List<QsRecordBean>>()
|
val liveDataQSList = MutableLiveData<List<QsRecordBean>>()
|
||||||
|
|
||||||
fun getList(context: Context) {
|
fun getList(context: Context) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
val taskId = sharedPreferences.getInt(Constant.SELECT_TASK_ID, -1)
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
val objects = realm.where(QsRecordBean::class.java).findAll()
|
val objects = realm.where(QsRecordBean::class.java).equalTo("taskId",taskId).findAll()
|
||||||
liveDataQSList.postValue(realm.copyFromRealm(objects))
|
liveDataQSList.postValue(realm.copyFromRealm(objects))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import com.navinfo.collect.library.data.entity.TaskBean
|
|||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
import com.navinfo.collect.library.map.OnGeoPointClickListener
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
|
import com.navinfo.collect.library.utils.RealmDBParamUtils
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.http.NetworkService
|
import com.navinfo.omqs.http.NetworkService
|
||||||
@ -141,8 +142,8 @@ class TaskViewModel @Inject constructor(
|
|||||||
|
|
||||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||||
showTaskLinks(taskBean)
|
showTaskLinks(taskBean)
|
||||||
com.navinfo.collect.library.system.Constant.TASK_ID = taskBean.id
|
RealmDBParamUtils.setTaskId(taskBean.id)
|
||||||
mapController.layerManagerHandler.omdbLayersClear()
|
mapController.layerManagerHandler.updateOMDBVectorTileLayer()
|
||||||
mapController.mMapView.updateMap(true)
|
mapController.mMapView.updateMap(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,54 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="12dp">
|
android:padding="12dp">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/search_tab_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/fragment_tabLayout_height"
|
||||||
|
android:layout_marginLeft="8dp"
|
||||||
|
android:layout_marginTop="11dp"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:background="@color/transparent"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:tabBackground="@drawable/selector_bg_gradient_checkbox"
|
||||||
|
app:tabGravity="center"
|
||||||
|
app:tabIndicator="@null"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
|
app:tabMaxWidth="110dp"
|
||||||
|
app:tabMinWidth="110dp"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
app:tabPaddingEnd="6dp"
|
||||||
|
app:tabPaddingStart="6dp"
|
||||||
|
app:tabSelectedTextColor="@color/white"
|
||||||
|
app:tabTextAppearance="@style/TabLayoutTextStyle"
|
||||||
|
app:tabTextColor="@color/black"
|
||||||
|
tools:ignore="MissingConstraints">
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="link" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Mark" />
|
||||||
|
|
||||||
|
<com.google.android.material.tabs.TabItem
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="经纬度" />
|
||||||
|
|
||||||
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/search_tab_layout"
|
||||||
android:id="@+id/dialog_edittext"
|
android:id="@+id/dialog_edittext"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -55,6 +55,10 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
realm {
|
||||||
|
syncEnabled = true
|
||||||
|
}
|
||||||
|
|
||||||
//configurations.all {
|
//configurations.all {
|
||||||
// resolutionStrategy {
|
// resolutionStrategy {
|
||||||
// force 'com.intellij:annotations:13.0'
|
// force 'com.intellij:annotations:13.0'
|
||||||
|
@ -1813,5 +1813,4 @@
|
|||||||
</m>
|
</m>
|
||||||
|
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
</rendertheme>
|
</rendertheme>
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.navinfo.collect.library.map.handler
|
package com.navinfo.collect.library.map.handler
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.map.NIMapView
|
import com.navinfo.collect.library.map.NIMapView
|
||||||
|
import io.realm.Realm
|
||||||
import org.oscim.core.BoundingBox
|
import org.oscim.core.BoundingBox
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
import org.oscim.core.MapPosition
|
import org.oscim.core.MapPosition
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
package com.navinfo.collect.library.map.handler
|
package com.navinfo.collect.library.map.handler
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.map.NIMapView
|
import com.navinfo.collect.library.map.NIMapView
|
||||||
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
|
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
|
||||||
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
|
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
|
||||||
import com.navinfo.collect.library.map.source.OMDBReferenceTileSource
|
import com.navinfo.collect.library.map.source.OMDBReferenceTileSource
|
||||||
import com.navinfo.collect.library.map.source.OMDBTileSource
|
import com.navinfo.collect.library.map.source.OMDBTileSource
|
||||||
import com.navinfo.collect.library.system.Constant
|
import com.navinfo.collect.library.system.Constant
|
||||||
|
import io.realm.Realm
|
||||||
import okhttp3.Cache
|
import okhttp3.Cache
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import org.oscim.android.theme.AssetsRenderTheme
|
||||||
import org.oscim.layers.GroupLayer
|
import org.oscim.layers.GroupLayer
|
||||||
import org.oscim.layers.tile.buildings.BuildingLayer
|
import org.oscim.layers.tile.buildings.BuildingLayer
|
||||||
import org.oscim.layers.tile.vector.VectorTileLayer
|
import org.oscim.layers.tile.vector.VectorTileLayer
|
||||||
@ -131,6 +135,39 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
|||||||
if (omdbLabelLayer != null) {
|
if (omdbLabelLayer != null) {
|
||||||
addLayer(omdbLabelLayer, NIMapView.LAYER_GROUPS.LABEL)
|
addLayer(omdbLabelLayer, NIMapView.LAYER_GROUPS.LABEL)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun resetOMDBVectorTileLayer() {
|
||||||
|
|
||||||
|
if (omdbReferenceTileLayer != null) {
|
||||||
|
removeLayer(omdbReferenceTileLayer)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (omdbReferenceLabelLayer != null) {
|
||||||
|
removeLayer(omdbReferenceLabelLayer)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (omdbVectorTileLayer != null) {
|
||||||
|
removeLayer(omdbVectorTileLayer)
|
||||||
|
}
|
||||||
|
if (omdbLabelLayer != null) {
|
||||||
|
removeLayer(omdbLabelLayer)
|
||||||
|
}
|
||||||
|
|
||||||
|
mMapView.vtmMap.updateMap(true)
|
||||||
|
|
||||||
|
Log.e("qj", "重新加载")
|
||||||
|
}
|
||||||
|
|
||||||
|
public fun updateOMDBVectorTileLayer(){
|
||||||
|
|
||||||
|
omdbTileSource.update()
|
||||||
|
|
||||||
|
omdbReferenceTileSource.update()
|
||||||
|
|
||||||
|
mMapView.vtmMap.setTheme(AssetsRenderTheme(mMapView.context.assets, "", "editormarker.xml"), true)
|
||||||
|
|
||||||
|
mMapView.vtmMap.updateMap(true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,13 +252,6 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView, traceP
|
|||||||
vectorNiLocationTileLayer.isEnabled = false
|
vectorNiLocationTileLayer.isEnabled = false
|
||||||
labelNiLocationLayer.isEnabled = false
|
labelNiLocationLayer.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun omdbLayersClear(){
|
|
||||||
// omdbVectorTileLayer.
|
|
||||||
// omdbReferenceTileLayer.
|
|
||||||
omdbLabelLayer.clearLabels()
|
|
||||||
omdbReferenceLabelLayer.clearLabels()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import androidx.annotation.RequiresApi;
|
|||||||
|
|
||||||
import com.navinfo.collect.library.data.entity.ReferenceEntity;
|
import com.navinfo.collect.library.data.entity.ReferenceEntity;
|
||||||
import com.navinfo.collect.library.system.Constant;
|
import com.navinfo.collect.library.system.Constant;
|
||||||
|
import com.navinfo.collect.library.utils.RealmDBParamUtils;
|
||||||
|
|
||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
import org.oscim.tiling.ITileDataSink;
|
import org.oscim.tiling.ITileDataSink;
|
||||||
@ -19,6 +20,8 @@ import io.realm.Realm;
|
|||||||
import io.realm.RealmQuery;
|
import io.realm.RealmQuery;
|
||||||
|
|
||||||
public class OMDBReferenceDataSource implements ITileDataSource {
|
public class OMDBReferenceDataSource implements ITileDataSource {
|
||||||
|
private boolean isUpdate;
|
||||||
|
|
||||||
private final ThreadLocal<OMDBReferenceDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBReferenceDecoder>() {
|
private final ThreadLocal<OMDBReferenceDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBReferenceDecoder>() {
|
||||||
@Override
|
@Override
|
||||||
protected OMDBReferenceDecoder initialValue() {
|
protected OMDBReferenceDecoder initialValue() {
|
||||||
@ -36,9 +39,12 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
|||||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||||
int yStart = (int) tile.tileY << m;
|
int yStart = (int) tile.tileY << m;
|
||||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||||
Log.e("jingo", Constant.TASK_ID + " " + xStart + " " + xEnd + " " + yStart + " " + yEnd);
|
if(isUpdate){
|
||||||
|
Realm.getDefaultInstance().refresh();
|
||||||
|
isUpdate = false;
|
||||||
|
}
|
||||||
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
|
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
|
||||||
.rawPredicate("taskId=" + Constant.TASK_ID + " and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1");
|
.rawPredicate("taskId="+RealmDBParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1" );
|
||||||
// 筛选不显示的数据
|
// 筛选不显示的数据
|
||||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||||
realmQuery.beginGroup();
|
realmQuery.beginGroup();
|
||||||
@ -70,4 +76,9 @@ public class OMDBReferenceDataSource implements ITileDataSource {
|
|||||||
Realm.getDefaultInstance().cancelTransaction();
|
Realm.getDefaultInstance().cancelTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void update(){
|
||||||
|
isUpdate = true;
|
||||||
|
Log.e("qj",Thread.currentThread().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,23 @@
|
|||||||
package com.navinfo.collect.library.map.source;
|
package com.navinfo.collect.library.map.source;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||||
import com.navinfo.collect.library.system.Constant;
|
import com.navinfo.collect.library.system.Constant;
|
||||||
|
|
||||||
import org.oscim.tiling.ITileDataSource;
|
import org.oscim.tiling.ITileDataSource;
|
||||||
import org.oscim.tiling.OverzoomTileDataSource;
|
import org.oscim.tiling.OverzoomTileDataSource;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
|
||||||
public class OMDBReferenceTileSource extends TileSource {
|
import io.realm.Realm;
|
||||||
|
|
||||||
|
public class OMDBReferenceTileSource extends RealmDBTileSource {
|
||||||
|
private OMDBReferenceDataSource omdbReferenceTileSource = new OMDBReferenceDataSource();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITileDataSource getDataSource() {
|
public ITileDataSource getDataSource() {
|
||||||
//return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM);
|
//return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM);
|
||||||
return new OMDBReferenceDataSource();
|
return omdbReferenceTileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -23,4 +29,10 @@ public class OMDBReferenceTileSource extends TileSource {
|
|||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
super.update();
|
||||||
|
omdbReferenceTileSource.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import com.navinfo.collect.library.data.RealmUtils;
|
|||||||
import com.navinfo.collect.library.data.entity.GeometryFeatureEntity;
|
import com.navinfo.collect.library.data.entity.GeometryFeatureEntity;
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity;
|
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||||
import com.navinfo.collect.library.system.Constant;
|
import com.navinfo.collect.library.system.Constant;
|
||||||
|
import com.navinfo.collect.library.utils.RealmDBParamUtils;
|
||||||
|
|
||||||
import org.oscim.layers.tile.MapTile;
|
import org.oscim.layers.tile.MapTile;
|
||||||
import org.oscim.tiling.ITileDataSink;
|
import org.oscim.tiling.ITileDataSink;
|
||||||
@ -21,6 +22,7 @@ import io.realm.Realm;
|
|||||||
import io.realm.RealmQuery;
|
import io.realm.RealmQuery;
|
||||||
|
|
||||||
public class OMDBTileDataSource implements ITileDataSource {
|
public class OMDBTileDataSource implements ITileDataSource {
|
||||||
|
private boolean isUpdate;
|
||||||
private final ThreadLocal<OMDBDataDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBDataDecoder>() {
|
private final ThreadLocal<OMDBDataDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBDataDecoder>() {
|
||||||
@Override
|
@Override
|
||||||
protected OMDBDataDecoder initialValue() {
|
protected OMDBDataDecoder initialValue() {
|
||||||
@ -38,8 +40,11 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
int xEnd = (int) ((tile.tileX + 1) << m);
|
int xEnd = (int) ((tile.tileX + 1) << m);
|
||||||
int yStart = (int) tile.tileY << m;
|
int yStart = (int) tile.tileY << m;
|
||||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||||
Log.e("jingo", Constant.TASK_ID + " " + xStart + " " + xEnd + " " + yStart + " " + yEnd);
|
if(isUpdate){
|
||||||
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1");
|
Realm.getDefaultInstance().refresh();
|
||||||
|
isUpdate = false;
|
||||||
|
}
|
||||||
|
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("taskId ="+RealmDBParamUtils.getTaskId() +" and tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd + " and enable>=1");
|
||||||
// 筛选不显示的数据
|
// 筛选不显示的数据
|
||||||
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||||
realmQuery.beginGroup();
|
realmQuery.beginGroup();
|
||||||
@ -53,9 +58,8 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
Log.e("qj", "查询数据==" + listResult.size() + "==地图级别" + tile.zoomLevel);
|
Log.e("qj", "查询数据==" + listResult.size() + "==地图级别" + tile.zoomLevel);
|
||||||
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
mThreadLocalDecoders.get().decode(tile.zoomLevel, tile, mapDataSink, listResult);
|
||||||
}
|
}
|
||||||
Log.e("jingo",listResult.size() + "条数据 主");
|
Log.e("jingo", listResult.size() + "条数据 主");
|
||||||
mapDataSink.completed(QueryResult.SUCCESS);
|
mapDataSink.completed(QueryResult.SUCCESS);
|
||||||
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
|
|
||||||
} else {
|
} else {
|
||||||
mapDataSink.completed(QueryResult.SUCCESS);
|
mapDataSink.completed(QueryResult.SUCCESS);
|
||||||
}
|
}
|
||||||
@ -72,4 +76,9 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
Realm.getDefaultInstance().cancelTransaction();
|
Realm.getDefaultInstance().cancelTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void update(){
|
||||||
|
isUpdate = true;
|
||||||
|
Log.e("qj",Thread.currentThread().getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
package com.navinfo.collect.library.map.source;
|
package com.navinfo.collect.library.map.source;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.data.entity.RenderEntity;
|
||||||
import com.navinfo.collect.library.system.Constant;
|
import com.navinfo.collect.library.system.Constant;
|
||||||
|
|
||||||
import org.oscim.tiling.ITileDataSource;
|
import org.oscim.tiling.ITileDataSource;
|
||||||
import org.oscim.tiling.OverzoomTileDataSource;
|
import org.oscim.tiling.OverzoomTileDataSource;
|
||||||
import org.oscim.tiling.TileSource;
|
import org.oscim.tiling.TileSource;
|
||||||
|
|
||||||
public class OMDBTileSource extends TileSource {
|
import io.realm.Realm;
|
||||||
|
|
||||||
|
public class OMDBTileSource extends RealmDBTileSource {
|
||||||
|
private OMDBTileDataSource omdbTileSource = new OMDBTileDataSource();
|
||||||
@Override
|
@Override
|
||||||
public ITileDataSource getDataSource() {
|
public ITileDataSource getDataSource() {
|
||||||
// return new OverzoomTileDataSource(new OMDBTileDataSource(), Constant.OVER_ZOOM);
|
// return new OverzoomTileDataSource(new OMDBTileDataSource(), Constant.OVER_ZOOM);
|
||||||
return new OMDBTileDataSource();
|
return omdbTileSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpenResult open() {
|
public OpenResult open() {
|
||||||
|
Log.d("qj", Realm.getDefaultInstance().where(RenderEntity.class).findAll().size()+"open安装数量");
|
||||||
return OpenResult.SUCCESS;
|
return OpenResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,4 +29,10 @@ public class OMDBTileSource extends TileSource {
|
|||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
super.update();
|
||||||
|
omdbTileSource.update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,7 @@ public class RealmDBTileSource extends TileSource {
|
|||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void update(){
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,11 +30,10 @@ public class Constant {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
public static String[] HAD_LAYER_INVISIABLE_ARRAY;
|
||||||
public static final int OVER_ZOOM = 22;
|
public static final int OVER_ZOOM = 20;
|
||||||
public static final int MAX_ZOOM = 22;
|
public static final int MAX_ZOOM = 20;
|
||||||
public static final int OMDB_MIN_ZOOM = 16;
|
public static final int OMDB_MIN_ZOOM = 15;
|
||||||
|
|
||||||
public static int TASK_ID = -1;
|
|
||||||
/**
|
/**
|
||||||
* 服务器地址
|
* 服务器地址
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.navinfo.collect.library.utils;
|
||||||
|
|
||||||
|
public class RealmDBParamUtils {
|
||||||
|
private static int mtaskId = -1;
|
||||||
|
|
||||||
|
public static int getTaskId() {
|
||||||
|
return mtaskId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setTaskId(int taskId) {
|
||||||
|
mtaskId = taskId;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user