Compare commits

..

58 Commits

Author SHA1 Message Date
23eaaf5aec fix: 修改测试按钮跳转位置 2023-06-15 10:23:11 +08:00
79659e78fb fix: 面渲染测试 2023-06-13 17:48:48 +08:00
02a65100c8 fix: 修改车道边线数据导入时的选取原则 2023-06-05 15:59:56 +08:00
squallzhjch
c6bf940dc4 Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
 Conflicts:
	vtm
2023-06-02 14:20:18 +08:00
squallzhjch
e4f28405dc 解决冲突 2023-06-02 14:18:49 +08:00
squallzhjch
ebc4ddf5a9 Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS
 Conflicts:
	app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt
	app/src/main/res/layout/adapter_sign.xml
2023-06-02 14:17:05 +08:00
肖岩
c643f2e08d Merge branch 'master' into 'master'
增加车道边线渲染

See merge request CollectVehicle/OneMapQS!2
2023-06-02 14:16:45 +08:00
3d4b9ce78d fix: 合并代码 2023-06-02 14:16:30 +08:00
squallzhjch
d68e7bd768 调整UI 2023-06-02 14:12:25 +08:00
qiji4215
5f953aa816 1.解决新增问题后点击获取数据无效2.预警面板增加快速问题记录 2023-06-02 13:57:50 +08:00
c237ccb928 Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS 2023-06-02 10:06:30 +08:00
6a77e69ed7 feat: 增加车道边线渲染 2023-06-02 10:05:53 +08:00
qiji4215
6cc0a20aa6 Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-06-01 10:18:19 +08:00
qiji4215
02cf95b83d merge code 2023-06-01 10:18:00 +08:00
squallzhjch
b8015a8b20 调整任务列表的UI,
增加任务列表和道路link的筛选功能
调整问题原因面板的UI
增加经纬度定位功能
2023-05-31 15:47:38 +08:00
qiji4215
7a7eb61401 merge code 2023-05-30 14:00:32 +08:00
qiji4215
7fb8af31b5 Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-05-26 17:51:13 +08:00
squallzhjch
e9735ee4d8 Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS 2023-05-26 17:45:56 +08:00
squallzhjch
8d6bb8c6e8 修改普通交限的道路渲染 2023-05-26 17:45:36 +08:00
qiji4215
5ff8509c95 merge code 2023-05-26 17:35:15 +08:00
squallzhjch
75a6d56471 调整看板 2023-05-26 17:23:47 +08:00
qiji4215
591b9cd579 merge code 2023-05-26 15:32:47 +08:00
c2416ab709 fix: 修改submodule配置 2023-05-26 15:24:03 +08:00
61165ff9f0 fix: 合并代码 2023-05-26 15:22:33 +08:00
90897174ac fix: 修改渲染样式 2023-05-26 15:18:23 +08:00
squallzhjch
d5d251c85e Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS 2023-05-26 15:16:19 +08:00
squallzhjch
dae344afc2 调整看板 2023-05-26 15:16:09 +08:00
qiji4215
64eb25d5d4 mergecode 2023-05-26 15:08:09 +08:00
qiji4215
8988661bed Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-05-26 14:54:05 +08:00
f2891d6d2f fix: 修改submodule的仓库地址 2023-05-26 14:53:27 +08:00
squallzhjch
c94eb5654d Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS 2023-05-26 14:01:49 +08:00
squallzhjch
10ec7a1e04 增加经纬度定位功能 2023-05-26 14:01:36 +08:00
qiji4215
f99517b386 Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-05-26 13:56:32 +08:00
549031e8a8 Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS 2023-05-26 13:47:39 +08:00
22f52429f4 fix: 修改普通交限的显示 2023-05-26 13:46:32 +08:00
squallzhjch
59bc0f544b 调整UI
调整道路属性面板
2023-05-26 10:51:36 +08:00
qiji4215
46268b3549 增加点击事件返回联动 2023-05-26 10:51:24 +08:00
qiji4215
d1aab7aabb Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-05-26 10:24:12 +08:00
qiji4215
3c0fe6b1b1 merge code 2023-05-26 10:24:00 +08:00
squallzhjch
b6bbcad634 调整UI
调整道路属性面板
2023-05-26 10:06:58 +08:00
qiji4215
e86b0696b6 Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
 Conflicts:
	app/src/main/res/layout/text_item_select.xml
2023-05-26 09:59:24 +08:00
12e9fd1a2a feat: 增加交限和交通灯的渲染图标 2023-05-25 15:10:40 +08:00
80b8b60556 fix: 修改数据导入 2023-05-24 17:12:34 +08:00
squallzhjch
4e997b8632 调整UI
调整道路属性面板
2023-05-24 15:57:52 +08:00
4d579d87c4 fix: 增加右偏功能,增加角度计算功能 2023-05-24 14:04:11 +08:00
f160f1dd00 fix: 修改git忽略文件 2023-05-23 15:44:41 +08:00
e606d83bcb Merge branch 'master' into vtm-lib 2023-05-23 15:43:57 +08:00
47495bd6ef fix: 增加vtm子模块 2023-05-23 15:42:45 +08:00
squallzhjch
d89ad95a17 调整UI
增加道路属性面板
2023-05-23 14:03:36 +08:00
squallzhjch
6d0f36068d Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS 2023-05-23 09:48:21 +08:00
squallzhjch
dc6b4b91e5 调整UI
增加道路属性面板
2023-05-23 09:48:07 +08:00
71dab4d22b feat: 以submodule方式引入vtm源码,方便后续修改 2023-05-22 17:48:20 +08:00
qiji4215
6af2479dbd Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-05-19 17:25:10 +08:00
qiji4215
24f58b7872 Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS 2023-05-19 17:14:12 +08:00
qiji4215
2807b2f689 增加登录接口和问题回传接口变更 2023-05-19 17:12:19 +08:00
qiji4215
c42045ba45 Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
 Conflicts:
	app/src/main/res/layout/fragment_evaluation_result.xml
2023-05-19 09:28:50 +08:00
qiji4215
4ec107b359 merge code 2023-05-19 09:27:11 +08:00
qiji4215
e6c2c3f76d 增加删除确认窗体2增加返回箭头 2023-05-11 16:36:35 +08:00
107 changed files with 2704 additions and 1169 deletions

4
.gitignore vendored
View File

@@ -12,6 +12,4 @@
/build
/captures
.externalNativeBuild
.cxx
local.properties
/vtm/
.cxx

5
.gitmodules vendored Normal file
View File

@@ -0,0 +1,5 @@
[submodule "vtm"]
path = vtm
url = git@github.com:xiaoyan159/vtm.git
branch = master

View File

@@ -5,6 +5,11 @@
"code": 2001,
"name": "道路线"
},
"2002": {
"table": "OMDB_RD_LINK_FUNCTION_CLASS",
"code": 2002,
"name": "道路功能等级"
},
"2008": {
"table": "OMDB_RD_LINK_KIND",
"code": 2008,
@@ -15,6 +20,69 @@
"code": 2010,
"name": "道路方向"
},
"2013": {
"table": "OMDB_LANE_MARK_BOUNDARYTYPE",
"code": 2013,
"name": "车道边界类型",
"transformer": [
{
"k": "geometry",
"v": "~",
"klib": "geometry",
"vlib": "unpackingLaneBoundary()"
}
]
},
"2019": {
"table": "OMDB_LINK_SPEEDLIMIT",
"code": 2019,
"name": "常规线限速"
},
"2020": {
"table": "OMDB_LINK_SPEEDLIMIT_COND",
"code": 2020,
"name": "条件线限速"
},
"2021": {
"table": "OMDB_LINK_SPEEDLIMIT_VAR",
"code": 2021,
"name": "可变线限速"
},
"2022": {
"table": "OMDB_CON_ACCESS",
"code": 2022,
"name": "全封闭"
},
"2037": {
"table": "OMDB_FORM_OF_WAY",
"code": 2037,
"name": "匝道"
},
"2040": {
"table": "OMDB_MULTI_DIGITIZED",
"code": 2040,
"name": "上下线分离"
},
"2041":{
"table": "OMDB_LANE_NUM",
"code": 2041,
"name": "车道数"
},
"2083":{
"table": "OMDB_RDBOUND_BOUNDARYTYPE",
"code": 2083,
"name": "道路边界类型"
},
"2201":{
"table": "OMDB_BRIDGE",
"code": 2201,
"name": "桥"
},
"2202":{
"table": "OMDB_TUNNEL",
"code": 2202,
"name": "隧道"
},
"4002": {
"table": "OMDB_SPEEDLIMIT",
"code": 4002,
@@ -25,6 +93,12 @@
"v": "0",
"klib": "maxSpeed",
"vlib": "限"
},
{
"k": "geometry",
"v": "~",
"klib": "geometry",
"vlib": "translateRight()"
}
]
},
@@ -66,23 +140,41 @@
}
]
},
"4006":{
"table": "OMDB_RESTRICTION",
"code": 4006,
"name": "普通交限",
"transformer": [
{
"k": "geometry",
"v": "~",
"klib": "geometry",
"vlib": "generateRestrictionRerference()"
}
]
},
"4022": {
"table": "OMDB_TRAFFICLIGHT",
"code": 4022,
"name": "交通灯",
"transformer": [
{
"k": "angle",
"v": "~",
"klib": "angle",
"vlib": "0"
}
]
},
"5001":{
"table": "OMDB_LANE_LINK_LG",
"code": 5001,
"name": "车道中心线"
},
"2041":{
"table": "OMDB_LANE_NUM",
"code": 2041,
"name": "车道数",
"transformer": [
{
"k": "laneS2e",
"v": "~",
"klib": "left_00",
"vlib": "laneNumLeft00()"
}
]
}
"5002":{
"table": "OMDB_AREA",
"code": 5002,
"name": "面测试"
}
}
}

View File

@@ -75,7 +75,7 @@ class Constant {
const val SELECT_TAKEPHOTO_OR_RECORD = "select_takephoto_or_record"
const val OMDB_CONFIG = "omdb_config.json"
const val OTHER_CONFIG = "other.config"
const val OTHER_CONFIG = "other_config.json"
val OMDB_LAYER_VISIBLE_LIST: MutableList<String> = mutableListOf() // 记录OMDB数据显示的图层名称列表

View File

@@ -12,7 +12,7 @@ data class EvaluationInfo(
val linkPid: String = "",//Link号
@SerializedName("linkStatus")
val linkStatus: String = "",//Link状态
val linkStatus: Int = 0,//Link状态
@SerializedName("markId")
val markId: String = "",//Link状态
@@ -27,7 +27,7 @@ data class EvaluationInfo(
val featureName: String = "",//问题类型
@SerializedName("problemType")
val problemType: String = "",//问题现象
val problemType: String = "",//问题现象 0错误 1多余 2遗漏 服务字段定义为Integer使用包装类对应无值情况为空
@SerializedName("problemPhenomenon")
val problemPhenomenon: String = "",//问题现象
@@ -48,6 +48,24 @@ data class EvaluationInfo(
val evaluationDate: String = "",//测评日期(yyyy-mm-dd)
@SerializedName("evaluationWay")
val evaluationWay: String = "现场测评"//测评方式
val evaluationWay: String = "2",//测评方式 1生产测评 2现场测评 服务字段定义为Integer使用包装类对应无值情况为空
@SerializedName("roadClassfcation")
val roadClassfcation: String = "",//道路种别
@SerializedName("roadFunctionGrade")
val roadFunctionGrade: String = "",//道路功能等级
@SerializedName("noEvaluationreason")
val noEvaluationreason: String = "",//未测评原因
@SerializedName("linkLength")
val linkLength: Double = 0.0,//link长度(m 保留3位小数)
@SerializedName("dataLevel")
val dataLevel: String = "",//数据级别
@SerializedName("linstringLength")
val linstringLength: Double = 0.0,//错误要素长度m
) : Parcelable

View File

@@ -32,23 +32,25 @@ class ImportConfig {
}
// 开始解析key和value并对数据进行匹配
m@ for (k in processKeyOrValue(key)) {
for (v in processKeyOrValue(value)) {
if ("~" == v &&renderEntity.properties.containsKey(k)) { // ~符可以匹配任意元素
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
if (renderEntity.properties.containsKey(k)) { // json配置的key可以匹配到数据
for (v in processKeyOrValue(value)) {
if ("~" == v ) { // ~符可以匹配任意元素
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
}
break@m
} else if (renderEntity.properties[k] == v) { // 完全匹配
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
}
break@m
}
break@m
} else if (renderEntity.properties[k] == v) {
if (valuelib.endsWith("()")) { // 以()结尾说明该value配置是一个function需要通过反射调用指定方法
val method = preProcess::class.declaredMemberFunctions.first { it.name == valuelib.replace("()", "") }
method.call(preProcess, renderEntity)
} else {
renderEntity.properties[keylib] = valuelib
}
break@m
}
}
}

View File

@@ -1,6 +1,6 @@
package com.navinfo.omqs.bean
data class LoginUserBean(
var username: String = "",
var password: String = ""
var userCode: String = "",
var passWord: String = ""
)

View File

@@ -6,10 +6,10 @@ import kotlinx.parcelize.Parcelize
@Parcelize
data class SignBean(
//图标ID
val iconId: Int,
var iconId: Int = 0,
//定位点到目标距离
val distance: Int = 0,
//图表中的问题
//左上图标中的文字
val iconText: String = "",
//绑定的要素id
val elementId: String = "",
@@ -17,10 +17,14 @@ data class SignBean(
val linkId: String,
//坐标
val geometry: String,
//底部文字
val bottomText: String,
//名称
val name: String,
//底部右侧文字
val bottomRightText: String,
val bottomRightText: String = "",
//要素code类型
val elementCode: Int
val elementCode: Int,
//需要展示更多的内容
val moreText: String = "",
//左上角信息
val topRightText: String = ""
) : Parcelable

View File

@@ -0,0 +1,8 @@
package com.navinfo.omqs.bean
data class SysUserBean(
var userName: String = "",
var passWord: String = "",
var userCode: String = "",
var roleId: Int = 0,
)

View File

@@ -1,10 +1,15 @@
package com.navinfo.omqs.db
import com.navinfo.collect.library.data.entity.ReferenceEntity
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.collect.library.utils.GeometryTools
import io.realm.Realm
import org.json.JSONArray
import org.json.JSONObject
import org.locationtech.jts.algorithm.Angle
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.Geometry
import org.oscim.core.GeoPoint
class ImportPreProcess {
@@ -23,31 +28,166 @@ class ImportPreProcess {
fun translateRight(renderEntity: RenderEntity): RenderEntity {
// 获取当前renderEntity的geometry
val geometry = renderEntity.wkt
var angle = 0.0 // geometry的角度如果是点获取angle如果是线获取最后两个点的方向
var radian = 0.0 // geometry的角度如果是点获取angle如果是线获取最后两个点的方向
var point = Coordinate(geometry?.coordinate)
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
val angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
val p1: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 2)
val p2: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 1)
// 计算线段的方向
angle = Angle.angle(p1, p2)
radian = Angle.angle(p1, p2)
point = p2
}
// 将角度转换为弧度
val radian = Math.toRadians(angle)
// 计算偏移距离
val dx: Double = GeometryTools.convertDistanceToDegree(5.0, geometry?.coordinate?.y!!) * Math.cos(radian)
val dy: Double = GeometryTools.convertDistanceToDegree(5.0, geometry?.coordinate?.y!!) * Math.sin(radian)
val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian)
val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian)
// 计算偏移后的点
val coord =
Coordinate(point.getX() + dy, point.getY() - dx)
// 将这个点记录在数据中
renderEntity.properties["geometry"] = GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y)).toString()
val geometryTranslate: Geometry = GeometryTools.createGeometry(doubleArrayOf(coord.x, coord.y))
renderEntity.geometry = geometryTranslate.toString()
return renderEntity
}
/**
* 将要素按照点位角度的垂直方向右移5米并生成一个按照垂直角度指向方向的线段用以显示有方向的图标
* */
fun translateRightWithAngle(renderEntity: RenderEntity): RenderEntity {
// 获取当前renderEntity的geometry
val geometry = renderEntity.wkt
var radian = 0.0 // geometry的角度如果是点获取angle如果是线获取最后两个点的方向
var point = Coordinate(geometry?.coordinate)
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
// angle为正北方向夹角需要将其转换为与正东方向夹角
var angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
angle-=90
radian = Math.toRadians(angle)
} else if (Geometry.TYPENAME_LINESTRING == geometry?.geometryType) {
val p1: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 2)
val p2: Coordinate = geometry.coordinates.get(geometry.coordinates.size - 1)
// 计算线段的方向
radian = Angle.angle(p1, p2)
point = p2
}
// 根据角度计算偏移距离
val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian)
val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian)
// 计算偏移后的点
// val coordMid =
// Coordinate(point.getX() + dy, point.getY() - dx)
// 计算指定距离外与当前位置成90度夹角的点位
val pointStart = GeoPoint(point.getY() - dx, point.getX() + dy)
// val pointStart = GeoPoint(pointMid.latitude-dy, pointMid.longitude-dx)
val pointEnd = GeoPoint(pointStart.latitude- dx, pointStart.longitude+ dy)
// 将这个线记录在数据中
val geometryTranslate: Geometry = GeometryTools.createLineString(listOf(pointStart, pointEnd))
renderEntity.geometry = geometryTranslate.toString()
return renderEntity
}
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
if (!renderEntity.properties.containsKey("angle")) {
if (renderEntity.wkt!=null) {
val geometry = renderEntity.wkt
var angle: String = "90"
if (geometry?.numPoints!!>=2) {
val p1: Coordinate = geometry?.coordinates?.get(geometry.coordinates.size - 2)!!
val p2: Coordinate = geometry?.coordinates?.get(geometry.coordinates.size - 1)!!
// 弧度转角度
angle = Math.toDegrees(Angle.angle(p1, p2)).toString()
} else {
angle = "90"
}
// 计算线段的方向
renderEntity.properties["angle"] = angle
return angle
}
}
return "0"
}
/**
* 解析车道边线数据二级属性
* */
fun unpackingLaneBoundary(renderEntity: RenderEntity) {
var shape:JSONObject = JSONObject(mapOf(
"lateralOffset" to 0,
"markType" to 1,
"markColor" to 0,
"markMaterial" to 1,
"markSeqNum" to 1,
"markWidth" to 10,
"markingCount" to 1
))
if (renderEntity.code == 2013&&!renderEntity.properties["shapeList"].isNullOrEmpty()&&renderEntity.properties["shapeList"]!="null") {
// 解析shapeList将数组中的属性放会properties
val shapeList = JSONArray(renderEntity.properties["shapeList"])
for (i in 0 until shapeList.length()) {
shape = shapeList.getJSONObject(i)
if (shape.optInt("lateralOffset", 0) == 0) {
break
}
}
}
for (key in shape.keys()) {
renderEntity.properties[key] = shape[key].toString()
}
}
/**
* 自动生成普通交限的参考数据
* */
fun generateRestrictionRerference(renderEntity: RenderEntity) {
// 获取当前renderEntity的geometry
val geometry = renderEntity.wkt
var radian = 0.0 // geometry的角度如果是点获取angle如果是线获取最后两个点的方向
var point = Coordinate(geometry?.coordinate)
if (Geometry.TYPENAME_POINT == geometry?.geometryType) {
var angle = if(renderEntity?.properties?.get("angle") == null) 0.0 else renderEntity?.properties?.get("angle")?.toDouble()!!
radian = Math.toRadians(angle)
}
// 计算偏移距离
val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian)
val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian)
// 计算偏移后的点
val pointTranS =
GeoPoint(point.getY() - dx, point.getX() + dy) // 向右偏移的点
// 计算与原有方向平行的终点坐标
val pointTranE = GeoPoint(pointTranS.latitude + dy, pointTranS.longitude + dx)
renderEntity.geometry = GeometryTools.createGeometry(pointTranS).toString()
// 将这个点记录在数据中
val startEndReference = ReferenceEntity()
startEndReference.renderEntityId = renderEntity.id
startEndReference.name = "普通交限参考线"
startEndReference.table = renderEntity.table
// 起终点坐标组成的线
startEndReference.geometry = GeometryTools.createLineString(listOf(GeoPoint(point.y, point.x), pointTranS)).toString()
startEndReference.properties["qi_table"] = renderEntity.table
startEndReference.properties["type"] = "s_2_e"
Realm.getDefaultInstance().insert(startEndReference)
val angleReference = ReferenceEntity()
angleReference.renderEntityId = renderEntity.id
angleReference.name = "普通交限参考方向"
angleReference.table = renderEntity.table
// 与原有方向指向平行的线
angleReference.geometry = GeometryTools.createLineString(listOf(pointTranS, pointTranE)).toString()
angleReference.properties["qi_table"] = renderEntity.table
angleReference.properties["type"] = "angle"
Realm.getDefaultInstance().insert(angleReference)
}
}

View File

@@ -37,52 +37,49 @@ class RealmOperateHelper() {
sort: Boolean = true
): MutableList<RenderEntity> {
val result = mutableListOf<RenderEntity>()
withContext(Dispatchers.IO) {
val polygon = getPolygonFromPoint(
GeometryTools.createPoint(point.longitude, point.latitude),
buffer,
bufferType
)
// 根据polygon查询相交的tile号
val tileXSet = mutableSetOf<Int>()
tileXSet.toString()
GeometryToolsKt.getTileXByGeometry(polygon.toString(), tileXSet)
val tileYSet = mutableSetOf<Int>()
GeometryToolsKt.getTileYByGeometry(polygon.toString(), tileYSet)
val polygon = getPolygonFromPoint(
GeometryTools.createPoint(point.longitude, point.latitude),
buffer,
bufferType
)
// 根据polygon查询相交的tile号
val tileXSet = mutableSetOf<Int>()
tileXSet.toString()
GeometryToolsKt.getTileXByGeometry(polygon.toString(), tileXSet)
val tileYSet = mutableSetOf<Int>()
GeometryToolsKt.getTileYByGeometry(polygon.toString(), tileYSet)
// 对tileXSet和tileYSet查询最大最小值
val xStart = tileXSet.stream().min(Comparator.naturalOrder()).orElse(null)
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
// 查询realm中对应tile号的数据
val realm = Realm.getDefaultInstance()
val realmList = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK")
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList)
val queryResult = dataList?.stream()?.filter {
polygon.intersects(it.wkt)
}?.toList()
// 对tileXSet和tileYSet查询最大最小值
val xStart = tileXSet.stream().min(Comparator.naturalOrder()).orElse(null)
val xEnd = tileXSet.stream().max(Comparator.naturalOrder()).orElse(null)
val yStart = tileYSet.stream().min(Comparator.naturalOrder()).orElse(null)
val yEnd = tileYSet.stream().max(Comparator.naturalOrder()).orElse(null)
// 查询realm中对应tile号的数据
val realm = Realm.getDefaultInstance()
val realmList = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK")
.and()
.rawPredicate("tileX>=$xStart and tileX<=$xEnd and tileY>=$yStart and tileY<=$yEnd")
.findAll()
// 将获取到的数据和查询的polygon做相交只返回相交的数据
val dataList = realm.copyFromRealm(realmList)
val queryResult = dataList?.stream()?.filter {
polygon.intersects(it.wkt)
}?.toList()
queryResult?.let {
if (sort) {
result.addAll(
sortRenderEntity(
GeometryTools.createPoint(
point.longitude,
point.latitude
) , it
)
queryResult?.let {
if (sort) {
result.addAll(
sortRenderEntity(
GeometryTools.createPoint(
point.longitude,
point.latitude
), it
)
} else {
result.addAll(it)
}
)
} else {
result.addAll(it)
}
}
return result
}
@@ -163,15 +160,13 @@ class RealmOperateHelper() {
* */
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
val result = mutableListOf<RenderEntity>()
withContext(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
val realmList = realm.where(RenderEntity::class.java)
.notEqualTo("table", "OMDB_RD_LINK")
.and()
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
.findAll()
result.addAll(realm.copyFromRealm(realmList))
}
val realm = Realm.getDefaultInstance()
val realmList = realm.where(RenderEntity::class.java)
.notEqualTo("table", "OMDB_RD_LINK")
.and()
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
.findAll()
result.addAll(realm.copyFromRealm(realmList))
return result
}

View File

@@ -0,0 +1,7 @@
package com.navinfo.omqs.http
class DefaultUserResponse<T> {
var success: Boolean = false
var msg: String = ""
var obj: T? = null
}

View File

@@ -31,8 +31,8 @@ package com.navinfo.omqs.http
sealed class NetResult<out R> {
data class Success<out T>(val data: T?) : NetResult<T>()
data class Failure(val code: Int, val msg: String) : NetResult<Nothing>()
data class Error(val exception: Exception) : NetResult<Nothing>()
data class Failure<T>(val code: Int, val msg: String) : NetResult<Nothing>()
data class Error<T>(val exception: Exception) : NetResult<Nothing>()
object Loading : NetResult<Nothing>()
/**
@@ -42,8 +42,8 @@ sealed class NetResult<out R> {
override fun toString(): String {
return when (this) {
is Success<*> -> "网络访问成功返回正确结果Success[data=$data]"
is Failure -> "网络访问成功返回错误结果Failure[$msg]"
is Error -> "网络访问出错 Error[exception=$exception]"
is Failure<*> -> "网络访问成功返回错误结果Failure[$msg]"
is Error<*> -> "网络访问出错 Error[exception=$exception]"
is Loading -> "网络访问中 Loading"
}
}

View File

@@ -2,6 +2,10 @@ package com.navinfo.omqs.http
import com.navinfo.omqs.bean.OfflineMapCityBean
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.bean.SysUserBean
import okhttp3.ResponseBody
import retrofit2.Response
/**
@@ -16,4 +20,9 @@ interface NetworkService {
* 获取任务列表
*/
suspend fun getTaskList(evaluatorNo:String): NetResult<DefaultTaskResponse<List<TaskBean>>>
/**
* 登录接口
*/
suspend fun loginUser(loginUserBean: LoginUserBean): NetResult<DefaultUserResponse<SysUserBean>>
}

View File

@@ -2,8 +2,12 @@ package com.navinfo.omqs.http
import com.navinfo.omqs.bean.OfflineMapCityBean
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.bean.SysUserBean
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import okhttp3.ResponseBody
import retrofit2.Response
import javax.inject.Inject
/**
@@ -24,13 +28,13 @@ class NetworkServiceImpl @Inject constructor(
if (result.code() == 200) {
NetResult.Success(result.body())
} else {
NetResult.Failure(result.code(), result.message())
NetResult.Failure<Any>(result.code(), result.message())
}
} else {
NetResult.Failure(result.code(), result.message())
NetResult.Failure<Any>(result.code(), result.message())
}
} catch (e: Exception) {
NetResult.Error(e)
NetResult.Error<Any>(e)
}
}
@@ -43,13 +47,32 @@ class NetworkServiceImpl @Inject constructor(
if (result.code() == 200) {
NetResult.Success(result.body())
} else {
NetResult.Failure(result.code(), result.message())
NetResult.Failure<Any>(result.code(), result.message())
}
} else {
NetResult.Failure(result.code(), result.message())
NetResult.Failure<Any>(result.code(), result.message())
}
} catch (e: Exception) {
NetResult.Error(e)
NetResult.Error<Any>(e)
}
}
override suspend fun loginUser(loginUserBean: LoginUserBean): NetResult<DefaultUserResponse<SysUserBean>> =
//在IO线程中运行
withContext(Dispatchers.IO) {
return@withContext try {
val result = netApi.retrofitLoginUser(loginUserBean)
if (result.isSuccessful) {
if (result.code() == 200) {
NetResult.Success(result.body())
} else {
NetResult.Failure<Any>(result.code(), result.message())
}
} else {
NetResult.Failure<Any>(result.code(), result.message())
}
} catch (e: Exception) {
NetResult.Error<Any>(e)
}
}
}

View File

@@ -3,6 +3,8 @@ package com.navinfo.omqs.http
import com.navinfo.omqs.bean.EvaluationInfo
import com.navinfo.omqs.bean.OfflineMapCityBean
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.bean.SysUserBean
import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.*
@@ -40,6 +42,13 @@ interface RetrofitNetworkServiceAPI {
@GET("/drdc/MapDownload/maplist")
suspend fun retrofitGetOfflineMapCityList(): Response<List<OfflineMapCityBean>>
/**
* 登录接口
*/
@Headers("Content-Type: application/json")
@POST("/devcp/loginUser")
suspend fun retrofitLoginUser(@Body loginUserBean: LoginUserBean): Response<DefaultUserResponse<SysUserBean>>
/**
* 下载文件
*/

View File

@@ -44,7 +44,7 @@ class TaskDownloadScope(
//改进的代码
fun start() {
launch{
launch {
change(FileDownloadStatus.WAITING)
}
downloadManager.launchScope(this@TaskDownloadScope)
@@ -56,7 +56,7 @@ class TaskDownloadScope(
*/
fun pause() {
downloadJob?.cancel("pause")
launch{
launch {
change(FileDownloadStatus.PAUSE)
}
@@ -141,7 +141,7 @@ class TaskDownloadScope(
} catch (e: Exception) {
Log.e("jingo", "数据安装失败 ${e.toString()}")
change(FileDownloadStatus.ERROR)
}finally {
} finally {
}
@@ -167,8 +167,12 @@ class TaskDownloadScope(
val fileTemp =
File("${Constant.DOWNLOAD_PATH}${taskBean.evaluationTaskName}_${taskBean.dataVersion}.zip")
val startPosition = taskBean.currentSize
var startPosition = taskBean.currentSize
if (fileTemp.length() > taskBean.fileSize && taskBean.fileSize > 0) {
fileTemp.delete()
fileTemp.createNewFile()
startPosition = 0
}
if (fileTemp.length() > 0 && taskBean.fileSize > 0 && fileTemp.length() == taskBean.fileSize) {
importData(fileTemp)
return

View File

@@ -121,26 +121,71 @@ class TaskUploadScope(
if (objects != null&&objects.size>0) {
val copyList = realm.copyFromRealm(objects)
copyList.forEach {
var problemType = "0"
if(it.problemType=="错误"){
problemType = "0"
}else if(it.problemType=="多余"){
problemType = "1"
}else if(it.problemType=="遗漏"){
problemType = "2"
}
var evaluationWay = "2";
/* if(it.evaluationWay=="生产测评"){
evaluationWay = "1"
}else if(it.evaluationWay=="现场测评"){
evaluationWay = "2"
}*/
val evaluationInfo = EvaluationInfo(
evaluationTaskId = taskBean.id.toString(),
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
linkStatus = "已测评",
linkStatus = 1,
markId = hadLinkDvoBean.mesh,//"20065597"
trackPhotoNumber = "",
markGeometry = it.geometry,
featureName = it.classType,
problemType = it.problemType,
problemType = problemType,
problemPhenomenon = it.phenomenon,
problemDesc = it.description,
problemLink = it.problemLink,
problemReason = it.cause,
evaluatorName = it.checkUserId,
evaluationDate = it.checkTime,
evaluationWay = "现场测评"
evaluationWay = evaluationWay,
roadClassfcation = "",
roadFunctionGrade = "",
noEvaluationreason = "",
linkLength = 0.0,
dataLevel = "",
linstringLength = 0.0,
)
bodyList.add(evaluationInfo)
}
}else{
val evaluationInfo = EvaluationInfo(
evaluationTaskId = taskBean.id.toString(),
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
linkStatus = 0,
markId = hadLinkDvoBean.mesh,//"20065597"
trackPhotoNumber = "",
markGeometry = "",
featureName = "",
problemType = "",
problemPhenomenon = "",
problemDesc = "",
problemLink = "",
problemReason = "",
evaluatorName = "",
evaluationDate = "",
evaluationWay = "",
roadClassfcation = "",
roadFunctionGrade = "",
noEvaluationreason = "",
linkLength = 0.0,
dataLevel = "",
linstringLength = 0.0,
)
bodyList.add(evaluationInfo)
}
}

View File

@@ -1,5 +0,0 @@
package com.navinfo.omqs.rule
class LeftPanel {
}

View File

@@ -1,9 +1,7 @@
package com.navinfo.omqs.ui.activity
import android.app.Dialog
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.os.PersistableBundle
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.R

View File

@@ -10,8 +10,9 @@ import androidx.lifecycle.viewModelScope
import com.blankj.utilcode.util.ResourceUtils
import com.navinfo.omqs.Constant
import com.navinfo.omqs.bean.LoginUserBean
import com.navinfo.omqs.db.MyRealmModule
import com.navinfo.omqs.bean.SysUserBean
import com.navinfo.omqs.db.RoomAppDatabase
import com.navinfo.omqs.http.DefaultUserResponse
import com.navinfo.omqs.http.NetResult
import com.navinfo.omqs.http.NetworkService
import com.navinfo.omqs.tools.FileManager
@@ -19,6 +20,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm
import io.realm.RealmConfiguration
import kotlinx.coroutines.*
import retrofit2.Response
import java.io.File
import java.io.IOException
import javax.inject.Inject
@@ -74,7 +76,7 @@ class LoginViewModel @Inject constructor(
var jobLogin: Job? = null;
init {
loginUser.value = LoginUserBean(username = "admin", password = "123456")
loginUser.value = LoginUserBean(userCode = "haofuyue00213", passWord = "123456")
}
@@ -82,7 +84,7 @@ class LoginViewModel @Inject constructor(
* 处理注册按钮
*/
fun onClick(view: View) {
loginUser.value!!.username = "admin2"
loginUser.value!!.userCode = "admin2"
loginUser.value = loginUser.value
}
@@ -111,12 +113,61 @@ class LoginViewModel @Inject constructor(
// withContext(Dispatchers.IO) {
//网络访问
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_LOADING)
//假装网络访问等待2秒
delay(1000)
var userCode = "99999";
//登录访问
when (val result = networkService.loginUser(LoginUserBean(userName,password))) {
is NetResult.Success<*> ->{
if (result.data!=null) {
try {
val defaultUserResponse = result.data as DefaultUserResponse<SysUserBean>
if(defaultUserResponse.success){
if(defaultUserResponse.obj==null|| defaultUserResponse.obj!!.userCode==null){
withContext(Dispatchers.Main) {
Toast.makeText(context, "服务返回用户Code信息错误", Toast.LENGTH_SHORT)
.show()
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_CANCEL)
return
}else{
userCode = defaultUserResponse.obj?.userCode.toString()
}
}else{
withContext(Dispatchers.Main) {
Toast.makeText(context, "${defaultUserResponse.msg}", Toast.LENGTH_SHORT)
.show()
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_CANCEL)
return
}
} catch (e: IOException) {
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
}
}
}
is NetResult.Error<*> ->{
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
.show()
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_CANCEL)
return
}
is NetResult.Failure<*> ->{
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
.show()
}
loginStatus.postValue(LoginStatus.LOGIN_STATUS_CANCEL)
return
}
else -> {}
}
//文件夹初始化
try {
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_INIT)
createUserFolder(context, "02911")
createUserFolder(context, userCode)
} catch (e: IOException) {
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
}
@@ -134,13 +185,13 @@ class LoginViewModel @Inject constructor(
roomAppDatabase.getOfflineMapDao().insertOrUpdate(result.data)
}
}
is NetResult.Error -> {
is NetResult.Error<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
.show()
}
}
is NetResult.Failure -> {
is NetResult.Failure<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
.show()
@@ -177,14 +228,14 @@ class LoginViewModel @Inject constructor(
.name("OMQS.realm")
.encryptionKey(password)
// .modules(Realm.getDefaultModule(), MyRealmModule())
.schemaVersion(1)
.schemaVersion(2)
.build()
Realm.setDefaultConfiguration(config)
// 拷贝配置文件到用户目录下
val omdbConfigFile = File(userFolder.absolutePath, Constant.OMDB_CONFIG);
if (!omdbConfigFile.exists()) {
// if (!omdbConfigFile.exists()) {
ResourceUtils.copyFileFromAssets(Constant.OMDB_CONFIG, omdbConfigFile.absolutePath)
}
// }
}
/**

View File

@@ -1,20 +1,27 @@
package com.navinfo.omqs.ui.activity.map
import android.app.Activity
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.speech.tts.TextToSpeech
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.widget.EditText
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import androidx.core.view.WindowCompat
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.lifecycleScope
import androidx.navigation.NavController
import androidx.navigation.NavDestination
import androidx.navigation.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import com.blankj.utilcode.util.SPStaticUtils
import com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
@@ -23,11 +30,14 @@ import com.navinfo.omqs.databinding.ActivityMainBinding
import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager
import com.navinfo.omqs.tools.LayerConfigUtils
import com.navinfo.omqs.ui.activity.BaseActivity
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
import com.navinfo.omqs.util.FlowEventBus
import com.navinfo.omqs.util.SpeakMode
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
import org.videolan.vlc.Util
import java.math.BigDecimal
import java.math.RoundingMode
import javax.inject.Inject
/**
@@ -41,6 +51,19 @@ class MainActivity : BaseActivity() {
var switchFragment = false
/**
* 检测是否含有tts插件
*/
private val someActivityResultLauncher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val data: Intent? = result.data
Log.e("jingo", "MainActivity someActivityResultLauncher RESULT_OK")
} else {
Log.e("jingo", "MainActivity someActivityResultLauncher ${result.resultCode}")
}
}
//注入地图控制器
@Inject
lateinit var mapController: NIMapController
@@ -52,14 +75,29 @@ class MainActivity : BaseActivity() {
findNavController(R.id.main_activity_right_fragment)
}
/**
* 提前显示要素看板
*/
private val signAdapter by lazy {
SignAdapter { position, signBean ->
// val directions =
// EmptyFragmentDirections.emptyFragmentToEvaluationResultFragment(
// )
// rightController.navigate(directions)
SignAdapter { position, autoSave,signBean ->
rightController.currentDestination?.let {
if (it.id == R.id.EmptyFragment) {
if (it.id == R.id.RightEmptyFragment) {
val bundle = Bundle()
bundle.putParcelable("SignBean", signBean)
bundle.putBoolean("AutoSave", autoSave)
rightController.navigate(R.id.EvaluationResultFragment, bundle)
}
}
}
}
/**
* 道路信息看板
*/
private val topSignAdapter by lazy {
TopSignAdapter { position, signBean ->
rightController.currentDestination?.let {
if (it.id == R.id.RightEmptyFragment) {
val bundle = Bundle()
bundle.putParcelable("SignBean", signBean)
rightController.navigate(R.id.EvaluationResultFragment, bundle)
@@ -68,9 +106,17 @@ class MainActivity : BaseActivity() {
}
}
override fun onCreate(savedInstanceState: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(savedInstanceState)
val checkIntent = Intent()
checkIntent.action = TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
someActivityResultLauncher.launch(checkIntent)
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
//初始化地图
@@ -81,6 +127,7 @@ class MainActivity : BaseActivity() {
Constant.MAP_PATH,
Constant.USER_DATA_PATH + "/trace.sqlite"
)
viewModel.speakMode = SpeakMode(this)
// 在mapController初始化前获取当前OMDB图层显隐
viewModel.refreshOMDBLayer(LayerConfigUtils.getLayerConfigList())
mapController.mMapView.vtmMap.viewport().maxZoomLevel = 25
@@ -94,7 +141,6 @@ class MainActivity : BaseActivity() {
binding.mainActivityVoice.setOnTouchListener(object : View.OnTouchListener {
@RequiresApi(Build.VERSION_CODES.Q)
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
Log.e("qj", event?.action.toString())
when (event?.action) {
MotionEvent.ACTION_DOWN -> {
voiceOnTouchStart()//Do Something
@@ -105,14 +151,13 @@ class MainActivity : BaseActivity() {
Log.e("qj", "voiceOnTouchStop")
}
}
return v?.onTouchEvent(event) ?: true
}
})
viewModel.liveDataQsRecordIdList.observe(this) {
//处理页面跳转
viewModel.navigation(this, it)
viewModel.navigationRightFragment(this, it)
}
viewModel.liveDataMenuState.observe(this) {
@@ -122,9 +167,19 @@ class MainActivity : BaseActivity() {
} else {
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
}
}
//道路属性面板
binding.mainActivityTopSignRecyclerview.layoutManager = LinearLayoutManager(
this, RecyclerView.HORIZONTAL, false
)
// binding.mainActivityTopSignRecyclerview.addItemDecoration(
// RecycleViewDivider(this, LinearLayoutManager.HORIZONTAL)
// )
binding.mainActivityTopSignRecyclerview.adapter = topSignAdapter
//提前显示面板
binding.mainActivitySignRecyclerview.layoutManager = LinearLayoutManager(this)
binding.mainActivitySignRecyclerview.adapter = signAdapter
//增加4dp的间隔
@@ -135,27 +190,82 @@ class MainActivity : BaseActivity() {
)
)
)
//监听要素面板变化
viewModel.liveDataSignList.observe(this) {
signAdapter.refreshData(it)
}
//监听道路信息变化
viewModel.liveDataTopSignList.observe(this) {
topSignAdapter.refreshData(it)
}
//监听地图中点变化
viewModel.liveDataCenterPoint.observe(this) {
binding.mainActivityGeometry.text = "经纬度:${
BigDecimal(it.longitude).setScale(
7,
RoundingMode.HALF_UP
)
},${BigDecimal(it.latitude).setScale(7, RoundingMode.HALF_UP)}"
}
lifecycleScope.launch {
// 初始化地图图层控制接收器
FlowEventBus.subscribe<List<ImportConfig>>(
lifecycle,
Constant.EVENT_LAYER_MANAGER_CHANGE
lifecycle, Constant.EVENT_LAYER_MANAGER_CHANGE
) {
viewModel.refreshOMDBLayer(it)
}
}
findNavController(R.id.main_activity_right_fragment).addOnDestinationChangedListener { controller, destination, arguments ->
if (destination.id == R.id.RightEmptyFragment) {
binding.mainActivityRightVisibilityButtonsGroup.visibility = View.VISIBLE
} else {
binding.mainActivityRightVisibilityButtonsGroup.visibility = View.GONE
viewModel.setSelectRoad(false)
binding.mainActivitySelectLine.isSelected = false
}
}
}
//根据输入的经纬度跳转坐标
fun jumpPosition() {
val view = this.layoutInflater.inflate(R.layout.dialog_view_edittext, null)
val inputDialog = MaterialAlertDialogBuilder(
this
).setTitle("标记原因").setView(view)
var editText = view.findViewById<EditText>(R.id.dialog_edittext)
editText.hint = "请输入经纬度例如:\n116.1234567,39.1234567\n116.1234567 39.1234567"
inputDialog.setNegativeButton("取消") { dialog, _ ->
dialog.dismiss()
}
inputDialog.setPositiveButton("确定") { dialog, _ ->
if (editText.text.isNotEmpty()) {
try {
val parts = editText.text.toString().split("[,\\s]".toRegex())
if (parts.size == 2) {
val x = parts[0].toDouble()
val y = parts[0].toDouble()
mapController.animationHandler.animationByLatLon(y, x)
} else {
Toast.makeText(this, "输入格式不正确", Toast.LENGTH_SHORT).show()
}
} catch (e: Exception) {
Toast.makeText(this, "输入格式不正确", Toast.LENGTH_SHORT).show()
}
}
dialog.dismiss()
}
inputDialog.show()
}
override fun onStart() {
super.onStart()
//开启定位
mapController.locationLayerHandler.startLocation()
mapController.mMapView.setLogoVisable(View.GONE)
//启动轨迹存储
// viewModel.startSaveTraceThread(this)
@@ -168,6 +278,7 @@ class MainActivity : BaseActivity() {
override fun onDestroy() {
super.onDestroy()
viewModel.speakMode?.shutdown()
mapController.mMapView.onDestroy()
mapController.locationLayerHandler.stopLocation()
}
@@ -243,7 +354,7 @@ class MainActivity : BaseActivity() {
}
/**
*
*展开或收起右侧面板
*/
fun onSwitchFragment() {
switchFragment = !switchFragment
@@ -255,6 +366,13 @@ class MainActivity : BaseActivity() {
}
}
/**
* 隐藏或显示右侧展开按钮
*/
fun setRightSwitchButton(visibility: Int) {
binding.mainActivityFragmentSwitch.visibility = visibility
}
/**
* 点击录音按钮
*/

View File

@@ -3,7 +3,6 @@ package com.navinfo.omqs.ui.activity.map
import android.app.Activity
import android.content.Context
import android.content.DialogInterface
import android.graphics.Color
import android.graphics.drawable.AnimationDrawable
import android.graphics.drawable.BitmapDrawable
import android.os.Build
@@ -16,6 +15,7 @@ import android.view.ViewGroup
import android.widget.ImageView
import android.widget.PopupWindow
import androidx.annotation.RequiresApi
import androidx.constraintlayout.widget.Group
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
@@ -23,6 +23,7 @@ import androidx.navigation.findNavController
import com.blankj.utilcode.util.ToastUtils
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
import com.navinfo.collect.library.utils.GeometryTools
@@ -31,7 +32,6 @@ import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.ImportConfig
import com.navinfo.omqs.bean.SignBean
import com.navinfo.collect.library.data.entity.TaskBean
import com.navinfo.omqs.db.RealmOperateHelper
import com.navinfo.omqs.ui.dialog.CommonDialog
import com.navinfo.omqs.ui.manager.TakePhotoManager
@@ -45,7 +45,10 @@ import io.realm.RealmSet
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.oscim.core.GeoPoint
import org.oscim.core.MapPosition
import org.oscim.map.Map
import org.videolan.libvlc.LibVlcUtil
import java.io.File
import java.util.*
@@ -59,7 +62,7 @@ import javax.inject.Inject
class MainViewModel @Inject constructor(
private val mapController: NIMapController,
private val traceDataBase: TraceDataBase,
private val realmOperateHelper: RealmOperateHelper
private val realmOperateHelper: RealmOperateHelper,
) : ViewModel() {
private var mCameraDialog: CommonDialog? = null
@@ -67,30 +70,46 @@ class MainViewModel @Inject constructor(
//地图点击捕捉到的质检数据ID列表
val liveDataQsRecordIdList = MutableLiveData<List<String>>()
//看板数据
//左侧看板数据
val liveDataSignList = MutableLiveData<List<SignBean>>()
//顶部看板数据
val liveDataTopSignList = MutableLiveData<List<SignBean>>()
// var testPoint = GeoPoint(0, 0)
//语音窗体
private var pop: PopupWindow? = null
private var mSpeakMode: SpeakMode? = null
var speakMode: SpeakMode? = null
//录音图标
var volume: ImageView? = null
var mSoundMeter: SoundMeter? = null
var menuState: Boolean = false
val liveDataMenuState = MutableLiveData<Boolean>()
val liveDataCenterPoint = MutableLiveData<MapPosition>()
/**
* 是不是线选择模式
*/
private var bSelectRoad = false
private var linkIdCache = ""
init {
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
when (e) {
Map.SCALE_EVENT, Map.MOVE_EVENT, Map.ROTATE_EVENT ->
liveDataCenterPoint.value = mapPosition
}
})
//处理质检数据点击事件
mapController.markerHandle.setOnQsRecordItemClickListener(object :
OnQsRecordItemClickListener {
override fun onQsRecordList(list: MutableList<String>) {
@@ -98,9 +117,11 @@ class MainViewModel @Inject constructor(
}
})
initLocation()
viewModelScope.launch {
//处理地图点击操作
viewModelScope.launch(Dispatchers.Default) {
mapController.onMapClickFlow.collectLatest {
// testPoint = it
//线选择状态
if (bSelectRoad) {
captureLink(it)
}
@@ -128,9 +149,9 @@ class MainViewModel @Inject constructor(
}
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
for (item in list) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
}
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
// }
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
}
}
@@ -150,8 +171,7 @@ class MainViewModel @Inject constructor(
// location.latitude = testPoint.latitude
val geometry = GeometryTools.createGeometry(
GeoPoint(
location.latitude,
location.longitude
location.latitude, location.longitude
)
)
val tileX = RealmSet<Int>()
@@ -176,8 +196,7 @@ class MainViewModel @Inject constructor(
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
// location.longitude = testPoint.longitude
// location.latitude = testPoint.latitude
if (!isSelectRoad())
captureLink(GeoPoint(location.latitude, location.longitude))
if (!isSelectRoad()) captureLink(GeoPoint(location.latitude, location.longitude))
}
}
@@ -194,38 +213,89 @@ class MainViewModel @Inject constructor(
val linkList = realmOperateHelper.queryLink(
point = point,
)
//看板数据
val signList = mutableListOf<SignBean>()
if (linkList.isNotEmpty()) {
//看板数据
val signList = mutableListOf<SignBean>()
val topSignList = mutableListOf<SignBean>()
mapController.lineHandler.linksLayer.clear()
val link = linkList[0]
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
mapController.lineHandler.showLine(link.geometry)
linkId?.let {
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
for (element in elementList) {
val distance = GeometryTools.distanceToDouble(
point,
GeometryTools.createGeoPoint(element.geometry)
)
signList.add(
SignBean(
if (linkIdCache != linkId) {
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
mapController.lineHandler.showLine(link.geometry)
linkId?.let {
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
for (element in elementList) {
val distance = GeometryTools.distanceToDouble(
point, GeometryTools.createGeoPoint(element.geometry)
)
val signBean = SignBean(
iconId = SignUtil.getSignIcon(element),
iconText = SignUtil.getSignIconText(element),
distance = distance.toInt(),
elementId = element.id,
linkId = linkId,
geometry = element.geometry,
bottomText = SignUtil.getSignBottomText(element),
name = SignUtil.getSignNameText(element),
bottomRightText = SignUtil.getSignBottomRightText(element),
elementCode = element.code
)
)
when (element.code) {
2002, 2008, 2010, 2041 -> topSignList.add(
signBean
)
4002, 4003, 4004, 4022 -> signList.add(
signBean
)
}
}
val realm = Realm.getDefaultInstance()
val entity = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RESTRICTION")
.and()
.equalTo(
"properties['linkIn']",
it
).findFirst()
if (entity != null) {
val outLink = entity.properties["linkOut"]
val linkOutEntity = realm.where(RenderEntity::class.java)
.equalTo("table", "OMDB_RD_LINK")
.and()
.equalTo(
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
outLink
).findFirst()
if (linkOutEntity != null) {
mapController.lineHandler.linksLayer.addLine(
linkOutEntity.geometry,
0x7DFF0000
)
Log.e("jingo", "捕捉到的linkid $outLink ${linkOutEntity.geometry}")
}
}
}
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
liveDataSignList.postValue(signList.distinctBy { it.elementCode })
val speechText = SignUtil.getRoadSpeechText(topSignList)
withContext(Dispatchers.Main) {
speakMode?.speakText(speechText)
}
linkIdCache = linkId ?: ""
Log.e("jingo", "自动捕捉数据 共${signList.size}")
} else {
mapController.lineHandler.removeLine()
}
}
liveDataSignList.postValue(signList)
Log.e("jingo", "自动捕捉数据 共${signList.size}")
}
}
@@ -291,10 +361,6 @@ class MainViewModel @Inject constructor(
fun startSoundMetter(context: Context, v: View) {
if (mSpeakMode == null) {
mSpeakMode = SpeakMode(context as Activity?)
}
//语音识别动画
if (pop == null) {
pop = PopupWindow()
@@ -328,12 +394,12 @@ class MainViewModel @Inject constructor(
if (!TextUtils.isEmpty(filePath) && File(filePath).exists()) {
if (File(filePath) == null || File(filePath).length() < 1600) {
ToastUtils.showLong("语音时间太短,无效!")
mSpeakMode!!.speakText("语音时间太短,无效")
speakMode?.speakText("语音时间太短,无效")
stopSoundMeter()
return
}
}
mSpeakMode!!.speakText("结束录音")
speakMode?.speakText("结束录音")
//获取右侧fragment容器
val naviController =
(context as Activity).findNavController(R.id.main_activity_right_fragment)
@@ -345,14 +411,14 @@ class MainViewModel @Inject constructor(
@RequiresApi(api = Build.VERSION_CODES.Q)
override fun onfaild(message: String?) {
ToastUtils.showLong("录制失败!")
mSpeakMode!!.speakText("录制失败")
speakMode?.speakText("录制失败")
stopSoundMeter()
}
})
mSoundMeter!!.start(Constant.USER_DATA_ATTACHEMNT_PATH + name)
ToastUtils.showLong("开始录音")
mSpeakMode!!.speakText("开始录音")
speakMode?.speakText("开始录音")
}
//停止语音录制
@@ -374,8 +440,7 @@ class MainViewModel @Inject constructor(
if (layerConfigList != null && !layerConfigList.isEmpty()) {
val omdbVisibleList = layerConfigList.filter { importConfig ->
importConfig.tableGroupName == "OMDB数据"
}.first().tableMap.filter {
entry ->
}.first().tableMap.filter { entry ->
val tableInfo = entry.value
!tableInfo.checked
}.map { entry ->
@@ -392,29 +457,13 @@ class MainViewModel @Inject constructor(
/**
* 处理页面调转
*/
fun navigation(activity: MainActivity, list: List<String>) {
fun navigationRightFragment(activity: MainActivity, list: List<String>) {
//获取右侧fragment容器
val naviController = activity.findNavController(R.id.main_activity_right_fragment)
naviController.currentDestination?.let { navDestination ->
// when (val fragment =
// activity.supportFragmentManager.findFragmentById(navDestination.id)) {
// //判断右侧的fragment是不是质检数据
//// is EvaluationResultFragment -> {
//// val viewModelFragment =
//// ViewModelProvider(fragment)[EvaluationResultViewModel::class.java]
//// viewModelFragment.notifyData(list)
//// }
// is EmptyFragment -> {
// if (list.size == 1) {
// val bundle = Bundle()
// bundle.putString("QsId", list[0])
// naviController.navigate(R.id.EvaluationResultFragment, bundle)
// }
// }
// }
when (navDestination.id) {
R.id.EmptyFragment -> {
R.id.RightEmptyFragment -> {
if (list.size == 1) {
val bundle = Bundle()
bundle.putString("QsId", list[0])
@@ -430,6 +479,8 @@ class MainViewModel @Inject constructor(
*/
fun setSelectRoad(select: Boolean) {
bSelectRoad = select
//去掉缓存
linkIdCache = ""
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mapController.lineHandler.removeLine()
liveDataSignList.value = mutableListOf()

View File

@@ -8,7 +8,7 @@ import com.navinfo.omqs.databinding.AdapterSignBinding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null) :
class SignAdapter(private var itemListener: ((Int, Boolean, SignBean) -> Unit?)? = null) :
BaseRecyclerViewAdapter<SignBean>() {
override fun getItemViewRes(position: Int): Int {
return R.layout.adapter_sign
@@ -23,12 +23,16 @@ class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null)
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val bd = holder.viewBinding as AdapterSignBinding
val item = data[position]
bd.signMainIcon.background = holder.viewBinding.root.context.getDrawable(item.iconId)
if (item.iconId != 0)
bd.signMainIconBg.setImageResource(item.iconId)
bd.signMainIcon.text = item.iconText
bd.signBottomText.text = item.bottomText
bd.signBottomText.text = item.name
bd.signMainFastError.setOnClickListener{
itemListener?.invoke(position, true,item)
}
bd.signBottomRightText.text = item.bottomRightText
bd.root.setOnClickListener {
itemListener?.invoke(position, item)
itemListener?.invoke(position, false,item)
}
}
}

View File

@@ -0,0 +1,65 @@
package com.navinfo.omqs.ui.activity.map
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.databinding.AdapterTopSignBinding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
class TopSignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null) :
BaseRecyclerViewAdapter<SignBean>() {
override fun getItemViewRes(position: Int): Int {
return R.layout.adapter_top_sign
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
val viewBinding =
AdapterTopSignBinding.inflate(LayoutInflater.from(parent.context), parent, false)
return BaseViewHolder(viewBinding)
}
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val bd = holder.viewBinding as AdapterTopSignBinding
val item = data[position]
if (item.iconId != 0)
bd.topSignText.background = holder.viewBinding.root.context.getDrawable(item.iconId)
bd.topSignName.text = item.name
bd.topSignText.text = item.iconText
if (data.size == 1) {
bd.topSignLeftLine.visibility = View.GONE
bd.topSignRightLine.visibility = View.GONE
bd.topSignName.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_top_bg)
bd.topSignText.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_bottom_bg)
} else if (position == 0) {
bd.topSignLeftLine.visibility = View.GONE
bd.topSignRightLine.visibility = View.VISIBLE
bd.topSignName.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_left_top_bg)
bd.topSignText.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_left_bottom_bg)
} else if (position == data.size - 1) {
bd.topSignLeftLine.visibility = View.VISIBLE
bd.topSignRightLine.visibility = View.GONE
bd.topSignName.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_right_top_bg)
bd.topSignText.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_right_bottom_bg)
} else {
bd.topSignLeftLine.visibility = View.VISIBLE
bd.topSignRightLine.visibility = View.VISIBLE
bd.topSignName.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_middle_top_bg)
bd.topSignText.background =
holder.viewBinding.root.context.getDrawable(R.drawable.shape_road_info_middle_bottom_bg)
}
bd.root.setOnClickListener {
itemListener?.invoke(position, item)
}
}
}

View File

@@ -5,13 +5,17 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.FragmentEmptyBinding
import com.navinfo.omqs.ui.activity.map.MainActivity
class EmptyFragment :Fragment(){
class EmptyFragment : Fragment() {
private var _binding: FragmentEmptyBinding? = null
private var currentDestinationLabel = ""
private val binding get() = _binding!!
// private val viewModel by lazy { viewModels<EvaluationResultViewModel>().value}
// private val viewModel by lazy { viewModels<EvaluationResultViewModel>().value}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
@@ -25,6 +29,24 @@ class EmptyFragment :Fragment(){
super.onViewCreated(view, savedInstanceState)
}
override fun onStart() {
super.onStart()
val currentDestination = findNavController().currentDestination
//有右侧面板的时候
if (currentDestination?.label == "右侧空页面") {
currentDestinationLabel = "右侧空页面"
(activity as MainActivity).setRightSwitchButton(View.GONE)
}
}
override fun onStop() {
super.onStop()
//没有有右侧面板的时候
if (currentDestinationLabel == "右侧空页面") {
(activity as MainActivity).setRightSwitchButton(View.VISIBLE)
}
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null

View File

@@ -1,5 +1,6 @@
package com.navinfo.omqs.ui.fragment.evaluationresult
import android.app.Dialog
import android.os.Build
import android.os.Bundle
import android.util.Log
@@ -19,6 +20,7 @@ import com.navinfo.omqs.ui.fragment.BaseFragment
import com.navinfo.omqs.ui.other.shareViewModels
import dagger.hilt.android.AndroidEntryPoint
import androidx.navigation.findNavController
import com.navinfo.omqs.ui.dialog.FirstDialog
@AndroidEntryPoint
class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
@@ -65,7 +67,17 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
}
//返回按钮点击
binding.evaluationBar.setOnClickListener() {
onBackPressed()
val mDialog = FirstDialog(context)
mDialog.setTitle("提示?")
mDialog.setMessage("是否退出,请确认!")
mDialog.setPositiveButton("确定", object : FirstDialog.OnClickListener {
override fun onClick(dialog: Dialog?, which: Int) {
mDialog.dismiss()
onBackPressed()
}
})
mDialog.setNegativeButton("取消", null)
mDialog.show()
}
//保存事件
@@ -76,7 +88,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
//删除事件
binding.evaluationBarDelete.setOnClickListener() {
viewModel.deleteData()
viewModel.deleteData(requireContext())
}
@@ -90,12 +102,18 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
voiceOnTouchStart()//Do Something
Log.e("qj", "voiceOnTouchStart")
}
MotionEvent.ACTION_UP -> {
voiceOnTouchStop()//Do Something
Log.e("qj", "voiceOnTouchStop")
Log.e("qj", "ACTION_UP")
}
MotionEvent.ACTION_CANCEL -> {
voiceOnTouchStop()//Do Something
Log.e("qj", "ACTION_CANCEL")
}
}
return v?.onTouchEvent(event) ?: true
return true
}
})
@@ -103,20 +121,28 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
* 读取元数据
*/
// val id = args.qsId
var id: String = ""
var id = ""
var signBean: SignBean? = null
var autoSave: Boolean = false
var filePath: String = ""
arguments?.let {
id = it.getString("QsId", "")
filePath = it.getString("filePath", "")
try {
signBean = it.getParcelable("SignBean")
autoSave = it.getBoolean("AutoSave")
} catch (e: java.lang.Exception) {
}
}
if (id == null || id.isEmpty()) {
viewModel.initNewData(signBean, filePath)
//增加监听,联动列表自动保存
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
if (autoSave) {
viewModel.saveData()
}
}
} else {
viewModel.initData(id)
}
@@ -235,7 +261,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
val controller = findNavController(R.id.main_activity_middle_fragment)
controller.currentDestination?.let {
//如果之前页面是空fragment直接打开面板
if (it.id == R.id.EmptyFragment) {
if (it.id == R.id.MiddleEmptyFragment) {
findNavController(
R.id.main_activity_middle_fragment
).navigate(R.id.PhenomenonFragment)
@@ -258,7 +284,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
val controller = findNavController(R.id.main_activity_middle_fragment)
controller.currentDestination?.let {
//如果之前页面是空fragment直接打开面板
if (it.id == R.id.EmptyFragment) {
if (it.id == R.id.MiddleEmptyFragment) {
findNavController(
R.id.main_activity_middle_fragment
).navigate(R.id.ProblemLinkFragment)
@@ -276,19 +302,21 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
}
}
else -> {}
}
}
}
fun voiceOnTouchStart() {
viewModel!!.startSoundMetter(requireActivity(), binding.evaluationVoice)
viewModel.startSoundMetter(requireActivity(), binding.evaluationVoice)
}
@RequiresApi(Build.VERSION_CODES.Q)
fun voiceOnTouchStop() {
Log.e("qj", "voiceOnTouchStop====${Constant.IS_VIDEO_SPEED}")
if (Constant.IS_VIDEO_SPEED) {
viewModel!!.stopSoundMeter()
viewModel.stopSoundMeter()
}
}

View File

@@ -1,6 +1,7 @@
package com.navinfo.omqs.ui.fragment.evaluationresult
import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.graphics.drawable.AnimationDrawable
import android.graphics.drawable.BitmapDrawable
@@ -22,18 +23,23 @@ import com.navinfo.collect.library.data.entity.QsRecordBean
import com.navinfo.collect.library.data.entity.RenderEntity.Companion.LinkTable
import com.navinfo.collect.library.map.NIMapController
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.ChatMsgEntity
import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.db.RealmOperateHelper
import com.navinfo.omqs.db.RoomAppDatabase
import com.navinfo.omqs.ui.dialog.FirstDialog
import com.navinfo.omqs.util.DateTimeUtil
import com.navinfo.omqs.util.SoundMeter
import com.navinfo.omqs.util.SpeakMode
import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.OrderedCollectionChangeSet
import io.realm.Realm
import io.realm.RealmList
import io.realm.RealmModel
import io.realm.RealmResults
import io.realm.kotlin.addChangeListener
import io.realm.kotlin.where
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -64,7 +70,7 @@ class EvaluationResultViewModel @Inject constructor(
/**
* 问题类型 liveData 给[MiddleAdapter]展示的数据
*/
val liveDataMiddleTypeList = MutableLiveData<List<String>>()
// val liveDataMiddleTypeList = MutableLiveData<List<String>>()
/**
* 问题现象 liveData 给[RightGroupHeaderAdapter]展示的数据
@@ -124,7 +130,7 @@ class EvaluationResultViewModel @Inject constructor(
geoPoint?.let {
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
mapController.markerHandle.addMarker(geoPoint, markerTitle)
mapController.animationHandler.animationByLonLat(
mapController.animationHandler.animationByLatLon(
geoPoint.latitude, geoPoint.longitude
)
viewModelScope.launch {
@@ -147,7 +153,7 @@ class EvaluationResultViewModel @Inject constructor(
}
val point = GeometryTools.createGeoPoint(bean.geometry)
this.geometry = GeometryTools.createGeometry(point).toText()
mapController.animationHandler.animationByLonLat(point.latitude, point.longitude)
mapController.animationHandler.animationByLatLon(point.latitude, point.longitude)
mapController.markerHandle.addMarker(point, markerTitle)
}
}
@@ -190,19 +196,22 @@ class EvaluationResultViewModel @Inject constructor(
list?.let {
if (list.isNotEmpty()) {
//通知页面更新
var classType = list[0]
liveDataLeftTypeList.postValue(it)
var classType = it[0]
if (bean != null) {
val classType2 = roomAppDatabase.getScProblemTypeDao()
.findClassTypeByCode(bean.elementCode)
if (classType2 != null)
if (classType2 != null) {
classType = classType2
}
}
//如果右侧栏没数据,给个默认值
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
liveDataQsRecordBean.value!!.classType = classType
classTypeTemp = classType
} else {
classType = liveDataQsRecordBean.value!!.classType
}
getProblemList(classType)
}
@@ -240,7 +249,7 @@ class EvaluationResultViewModel @Inject constructor(
Log.e("jingo", "getProblemLinkList ${rightList[0].text}")
}
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
liveDataMiddleTypeList.postValue(middleList)
// liveDataMiddleTypeList.postValue(middleList)
liveDataRightTypeList.postValue(rightList)
}
}
@@ -272,7 +281,7 @@ class EvaluationResultViewModel @Inject constructor(
liveDataQsRecordBean.value!!.problemType = typeTitleList[0]
Log.e("jingo", "getProblemList ${typeTitleList[0]}")
}
liveDataMiddleTypeList.postValue(typeTitleList)
// liveDataMiddleTypeList.postValue(typeTitleList)
if (liveDataQsRecordBean.value!!.phenomenon.isEmpty()) {
liveDataQsRecordBean.value!!.phenomenon = phenomenonRightList[0].text
Log.e("jingo", "getProblemList ${phenomenonRightList[0].text}")
@@ -313,7 +322,7 @@ class EvaluationResultViewModel @Inject constructor(
fun saveData() {
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
realm.executeTransaction {
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
}
@@ -323,22 +332,29 @@ class EvaluationResultViewModel @Inject constructor(
}
}
fun deleteData() {
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
realm.executeTransaction {
val objects =
it.where(QsRecordBean::class.java).equalTo("id", liveDataQsRecordBean.value?.id)
.findFirst()
objects?.deleteFromRealm()
fun deleteData(context: Context) {
val mDialog = FirstDialog(context)
mDialog.setTitle("提示?")
mDialog.setMessage("是否删除Mark请确认")
mDialog.setPositiveButton("确定", object : FirstDialog.OnClickListener {
override fun onClick(dialog: Dialog?, which: Int) {
mDialog.dismiss()
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
realm.executeTransaction {
val objects = it.where(QsRecordBean::class.java)
.equalTo("id", liveDataQsRecordBean.value?.id).findFirst()
objects?.deleteFromRealm()
}
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
mapController.mMapView.vtmMap.updateMap(true)
liveDataFinish.postValue(true)
}
}
// realm.close()
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
mapController.mMapView.vtmMap.updateMap(true)
liveDataFinish.postValue(true)
}
})
mDialog.setNegativeButton("取消", null)
mDialog.show()
}
/**
@@ -347,28 +363,35 @@ class EvaluationResultViewModel @Inject constructor(
fun initData(id: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
val objects = realm.where<QsRecordBean>().equalTo("id", id).findFirst()
if (objects != null) {
oldBean = realm.copyFromRealm(objects)
oldBean?.let {
liveDataQsRecordBean.postValue(it.copy())
val p = GeometryTools.createGeoPoint(it.geometry)
mapController.markerHandle.addMarker(
GeoPoint(p.latitude, p.longitude), markerTitle
)
Realm.getDefaultInstance().use { realm ->
realm.executeTransactionAsync { bgRealm ->
// find the item
val objects = bgRealm.where(QsRecordBean::class.java).equalTo("id", id).findFirst()
if (objects != null) {
oldBean = bgRealm.copyFromRealm(objects)
oldBean?.let {
liveDataQsRecordBean.postValue(it.copy())
val p = GeometryTools.createGeoPoint(it.geometry)
mapController.markerHandle.addMarker(GeoPoint(p.latitude, p.longitude), markerTitle)
if (it.linkId.isNotEmpty()) {
val link = realmOperateHelper.queryLink(it.linkId)
link?.let { l ->
mapController.lineHandler.showLine(l.geometry)
//获取linkid
if (it.linkId.isNotEmpty()) {
viewModelScope.launch(Dispatchers.IO) {
val link = realmOperateHelper.queryLink(it.linkId)
link?.let { l ->
mapController.lineHandler.showLine(l.geometry)
}
}
}
liveDataQsRecordBean.value?.attachmentBeanList = it.attachmentBeanList
// 显示语音数据到界面
getChatMsgEntityList()
}
}
}
// 显示语音数据到界面
getChatMsgEntityList()
}
}
}
@@ -444,7 +467,6 @@ class EvaluationResultViewModel @Inject constructor(
Constant.IS_VIDEO_SPEED = true
//录音动画
//录音动画
if (pop != null) {
pop!!.showAtLocation(v, Gravity.CENTER, 0, 0)
}

View File

@@ -28,13 +28,7 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
val bd = holder.viewBinding as TextItemSelectBinding
val title = data[position]
bd.itemId.text = title
if (selectTitle == title) {
bd.itemId.setBackgroundResource(R.drawable.shape_rect_white_2dp_bg)
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.highFontColor))
} else {
bd.itemId.setBackgroundResource(R.drawable.shape_rect_white_2dp_bg)
bd.itemId.setTextColor(holder.viewBinding.root.context.getColor(R.color.black))
}
holder.viewBinding.root.isSelected = selectTitle == title
bd.root.setOnClickListener {
if (selectTitle != title) {
selectTitle = title
@@ -46,14 +40,12 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
override fun refreshData(newData: List<String>) {
data = newData
selectTitle = newData[0]
notifyDataSetChanged()
}
fun setRightTitle(title: String) {
fun setSelectTitle(title: String) {
if (title != selectTitle) {
selectTitle = title
notifyDataSetChanged()
}
}
}

View File

@@ -6,9 +6,12 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.findNavController
import androidx.navigation.fragment.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.FragmentPhenomenonBinding
import com.navinfo.omqs.ui.fragment.BaseFragment
import com.navinfo.omqs.ui.other.shareViewModels
@@ -19,6 +22,7 @@ class PhenomenonFragment :
BaseFragment() {
private var _binding: FragmentPhenomenonBinding? = null
private val binding get() = _binding!!
/**
* 和[PhenomenonFragment],[ProblemLinkFragment],[EvaluationResultFragment]共用同一个viewModel
*/
@@ -50,6 +54,7 @@ class PhenomenonFragment :
binding.phenomenonLeftRecyclerview.adapter = leftAdapter
//左侧菜单查询结果监听
viewModel.liveDataLeftTypeList.observe(viewLifecycleOwner) {
leftAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.classType)
leftAdapter.refreshData(it)
}
@@ -63,6 +68,9 @@ class PhenomenonFragment :
*/
val rightAdapter = RightGroupHeaderAdapter { _, bean ->
viewModel.setPhenomenonMiddleBean(bean)
if (activity != null) {
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
}
}
binding.phenomenonRightRecyclerview.adapter = rightAdapter
//右侧菜单增加组标题
@@ -75,6 +83,7 @@ class PhenomenonFragment :
}
//右侧菜单查询数据监听
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
rightAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.phenomenon)
rightAdapter.refreshData(it)
}
@@ -106,15 +115,15 @@ class PhenomenonFragment :
})
//中间菜单
binding.phenomenonMiddleRecyclerview.setHasFixedSize(true)
binding.phenomenonMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
binding.phenomenonMiddleRecyclerview.adapter = middleAdapter
// //中间菜单
// binding.phenomenonMiddleRecyclerview.setHasFixedSize(true)
// binding.phenomenonMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
//
// binding.phenomenonMiddleRecyclerview.adapter = middleAdapter
//中间侧菜单查询结果监听
viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
middleAdapter.refreshData(it)
}
// viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
// middleAdapter.refreshData(it)
// }
// binding.phenomenonDrawer.setOnClickListener {
// when (binding.group.visibility) {
// View.INVISIBLE, View.GONE ->
@@ -130,10 +139,6 @@ class PhenomenonFragment :
override fun onDestroyView() {
super.onDestroyView()
_binding = null
Log.e("jingo", "PhenomenonFragment onDestroyView ${hashCode()}")
}
override fun onResume() {
super.onResume()
}
}

View File

@@ -6,8 +6,10 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.navigation.findNavController
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.FragmentProblemLinkBinding
import com.navinfo.omqs.ui.fragment.BaseFragment
import com.navinfo.omqs.ui.other.shareViewModels
@@ -28,7 +30,6 @@ class ProblemLinkFragment : BaseFragment() {
savedInstanceState: Bundle?
): View {
_binding = FragmentProblemLinkBinding.inflate(inflater, container, false)
Log.e("jingo", "linkFragment onCreateView ${hashCode()}")
return binding.root
}
@@ -43,6 +44,9 @@ class ProblemLinkFragment : BaseFragment() {
binding.linkRightRecyclerview.layoutManager = rightLayoutManager
val rightAdapter = RightGroupHeaderAdapter { _, bean ->
viewModel.setProblemLinkMiddleBean(bean)
if (activity != null) {
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
}
}
binding.linkRightRecyclerview.adapter = rightAdapter
//右侧菜单增加组标题
@@ -55,6 +59,7 @@ class ProblemLinkFragment : BaseFragment() {
}
//右侧菜单查询数据监听
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
rightAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.cause)
rightAdapter.refreshData(it)
}
@@ -75,22 +80,6 @@ class ProblemLinkFragment : BaseFragment() {
}
})
//中间菜单
binding.linkMiddleRecyclerview.setHasFixedSize(true)
binding.linkMiddleRecyclerview.layoutManager = LinearLayoutManager(requireContext())
binding.linkMiddleRecyclerview.adapter = middleAdapter
//中间侧菜单查询结果监听
viewModel.liveDataMiddleTypeList.observe(viewLifecycleOwner) {
middleAdapter.refreshData(it)
}
binding.linkDrawer.setOnClickListener {
when (binding.group.visibility) {
View.INVISIBLE, View.GONE ->
binding.group.visibility = View.VISIBLE
else ->
binding.group.visibility = View.GONE
}
}
viewModel.getProblemLinkList()
}
@@ -98,10 +87,5 @@ class ProblemLinkFragment : BaseFragment() {
override fun onDestroyView() {
super.onDestroyView()
_binding = null
Log.e("jingo", "linkFragment onDestroyView ${hashCode()}")
}
override fun onResume() {
super.onResume()
}
}

View File

@@ -3,27 +3,35 @@ package com.navinfo.omqs.ui.fragment.evaluationresult
import android.view.LayoutInflater
import android.view.ViewGroup
import com.navinfo.omqs.R
import com.navinfo.omqs.databinding.TextItemSelectBinding
import com.navinfo.omqs.databinding.TextItemSelect2Binding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Unit?)? = null) :
BaseRecyclerViewAdapter<RightBean>() {
private var selectTitle = ""
private var groupTitleList = mutableListOf<String>()
override fun getItemViewRes(position: Int): Int {
return R.layout.text_item_select
return R.layout.text_item_select2
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
val viewBinding =
TextItemSelectBinding.inflate(LayoutInflater.from(parent.context), parent, false)
TextItemSelect2Binding.inflate(LayoutInflater.from(parent.context), parent, false)
return BaseViewHolder(viewBinding)
}
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val bd = holder.viewBinding as TextItemSelectBinding
bd.itemId.text = data[position].text
val bd = holder.viewBinding as TextItemSelect2Binding
val title = data[position].text
bd.itemId.text = title
holder.viewBinding.root.isSelected = selectTitle == title
bd.root.setOnClickListener {
if (selectTitle != title) {
selectTitle = title
notifyDataSetChanged()
}
itemListener?.invoke(position, data[position])
}
}
@@ -86,7 +94,6 @@ class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Uni
}
override fun refreshData(newData: List<RightBean>) {
super.refreshData(newData)
groupTitleList.clear()
for (item in newData) {
if (groupTitleList.size > 0) {
@@ -97,7 +104,15 @@ class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Uni
groupTitleList.add(item.title)
}
}
super.refreshData(newData)
}
/**
* 设置当前选中的哪条数据
*/
fun setSelectTitle(title: String) {
if (title != selectTitle) {
selectTitle = title
}
}
}

View File

@@ -40,7 +40,7 @@ class RightGroupHeaderDecoration(context: Context) : ItemDecoration() {
mTextPaint.textSize = 46f
mTextPaint.color = Color.WHITE
mLinePaint = Paint(Paint.ANTI_ALIAS_FLAG)
mLinePaint.color = Color.GRAY
mLinePaint.color = Color.WHITE
}
/**

View File

@@ -111,7 +111,7 @@ class PersonalCenterFragment : BaseFragment(), FSAFActivityCallbacks {
viewModel.readRealmData()
// 定位到指定位置
niMapController.mMapView.vtmMap.animator()
.animateTo(GeoPoint(40.1012346774074730, 116.25571303257621))
.animateTo(GeoPoint( 40.034842306317486, 116.31735963074652 ))
}
R.id.personal_center_menu_task_list -> {
findNavController().navigate(R.id.TaskManagerFragment)

View File

@@ -3,6 +3,8 @@ package com.navinfo.omqs.ui.fragment.tasklist
import android.app.AlertDialog
import android.content.DialogInterface
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -64,12 +66,26 @@ class TaskFragment : BaseFragment() {
binding.taskRecyclerview.setHasFixedSize(true)
binding.taskRecyclerview.layoutManager = layoutManager
binding.taskRecyclerview.adapter = adapter
binding.taskSearchClear.setOnClickListener {
binding.taskSearch.setText("")
}
viewModel.liveDataTaskLinks.observe(viewLifecycleOwner) {
adapter.resetSelect()
adapter.refreshData(it)
}
viewModel.getTaskList(requireContext())
binding.taskSearch.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
viewModel.filterTask(s.toString())
}
})
}
override fun onDestroyView() {

View File

@@ -1,5 +1,6 @@
package com.navinfo.omqs.ui.fragment.tasklist
import android.graphics.Color
import android.util.Log
import android.view.LayoutInflater
import android.view.View
@@ -85,6 +86,27 @@ class TaskListAdapter(
downloadManager.observer(taskBean.id, holder, DownloadObserver(taskBean.id, holder))
uploadManager.addTask(taskBean)
uploadManager.observer(taskBean.id, holder, UploadObserver(taskBean.id, binding))
if (taskBean.status == FileDownloadStatus.NONE) {
binding.taskDownloadBtn.setBackgroundColor(Color.WHITE)
binding.taskDownloadBtn.setTextColor(Color.parseColor("#888FB3"))
} else {
binding.taskDownloadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
binding.taskDownloadBtn.setTextColor(Color.WHITE)
}
if (taskBean.status == FileDownloadStatus.DONE) {
binding.taskDownloadBtn.visibility = View.INVISIBLE
binding.taskUploadBtn.visibility = View.VISIBLE
} else {
binding.taskDownloadBtn.visibility = View.VISIBLE
binding.taskUploadBtn.visibility = View.INVISIBLE
}
if (taskBean.syncStatus == FileUploadStatus.DONE) {
binding.taskUploadBtn.setProgress(0)
binding.taskUploadBtn.setBackgroundColor(binding.root.resources.getColor(R.color.ripple_end_color))
} else {
binding.taskUploadBtn.setProgress(100)
binding.taskUploadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
}
binding.taskDownloadBtn.tag = position
binding.taskDownloadBtn.setOnClickListener(downloadBtnClick)
binding.taskUploadBtn.tag = position
@@ -92,7 +114,6 @@ class TaskListAdapter(
binding.taskName.text = taskBean.evaluationTaskName
binding.taskCityName.text = taskBean.cityName
binding.taskDataVersion.text = "版本号:${taskBean.dataVersion}"
binding.taskColor.setTextColor(taskBean.color)
binding.root.isSelected = selectPosition == position
binding.root.setOnClickListener {
val pos = holder.adapterPosition
@@ -133,87 +154,108 @@ class TaskListAdapter(
private fun changeUploadTxtViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
when (taskBean.syncStatus) {
FileUploadStatus.DONE -> {
binding.taskUploadBtn.text = "已上传"
binding.taskUploadBtn.stopAnimator()
binding.taskUploadBtn.setText("已上传")
binding.taskUploadBtn.setProgress(0)
binding.taskUploadBtn.setBackgroundColor(binding.root.resources.getColor(R.color.ripple_end_color))
}
FileUploadStatus.ERROR -> {
binding.taskUploadBtn.text = "重新同步"
binding.taskUploadBtn.stopAnimator()
binding.taskUploadBtn.setText("重新同步")
binding.taskUploadBtn.setProgress(100)
}
FileUploadStatus.NONE -> {
binding.taskUploadBtn.text = "同步"
binding.taskUploadBtn.setText("未上传")
binding.taskUploadBtn.setProgress(0)
}
FileUploadStatus.WAITING -> {
binding.taskUploadBtn.text = "等待同步"
binding.taskUploadBtn.setText("等待同步")
binding.taskUploadBtn.setProgress(100)
}
FileUploadStatus.UPLOADING -> {
binding.taskUploadBtn.text = "同步"
binding.taskUploadBtn.setText("上传")
binding.taskUploadBtn.setProgress(100)
binding.taskUploadBtn.startAnimator()
}
}
}
private fun changeViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
if (taskBean.status == FileDownloadStatus.NONE) {
binding.taskDownloadBtn.setBackgroundColor(Color.WHITE)
binding.taskDownloadBtn.setTextColor(Color.parseColor("#888FB3"))
} else {
binding.taskDownloadBtn.setBackgroundColor(Color.parseColor("#888FB3"))
binding.taskDownloadBtn.setTextColor(Color.WHITE)
}
if (taskBean.fileSize > 0L) {
binding.taskProgress.progress =
(taskBean.currentSize * 100 / taskBean.fileSize).toInt()
val progress = (taskBean.currentSize * 100 / taskBean.fileSize).toInt()
binding.taskProgressText.text =
"$progress%"
binding.taskDownloadBtn.setProgress(progress)
}
when (taskBean.status) {
FileDownloadStatus.NONE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE
binding.taskDownloadBtn.text = "下载"
binding.taskDownloadBtn.setText("下载")
}
FileDownloadStatus.WAITING -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE
binding.taskDownloadBtn.text = "等待中"
binding.taskDownloadBtn.setText("等待中")
}
FileDownloadStatus.LOADING -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE
binding.taskDownloadBtn.text = "暂停"
binding.taskDownloadBtn.setText("暂停")
}
FileDownloadStatus.PAUSE -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE
binding.taskDownloadBtn.text = "继续"
binding.taskDownloadBtn.setText("继续")
}
FileDownloadStatus.ERROR -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE
binding.taskDownloadBtn.text = "重试"
binding.taskDownloadBtn.setText("重试")
}
FileDownloadStatus.DONE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE
binding.taskDownloadBtn.text = "已完成"
binding.taskDownloadBtn.setText("已完成")
binding.taskDownloadBtn.visibility = View.INVISIBLE
binding.taskUploadBtn.visibility = View.VISIBLE
}
FileDownloadStatus.UPDATE -> {
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE
binding.taskDownloadBtn.text = "更新"
binding.taskDownloadBtn.setText("更新")
}
FileDownloadStatus.IMPORTING -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.VISIBLE
binding.taskDownloadBtn.text = "安装中"
binding.taskDownloadBtn.setText("安装中")
val split = taskBean.message.split("/")
if (split.size == 2) {
try {
val index = split[0].toInt()
val count = split[1].toInt()
binding.taskProgress.progress =
index * 100 / count
binding.taskProgressText.text =
"${index * 100 / count}%"
} catch (e: Exception) {
Log.e("jingo", "更新进度条 $e")
}
} else {
binding.taskProgress.progress = 0
binding.taskProgressText.text = "0%"
}
}
FileDownloadStatus.IMPORT -> {
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
View.INVISIBLE
binding.taskDownloadBtn.text = "安装"
binding.taskDownloadBtn.setText("安装")
}
}
}

View File

@@ -1,6 +1,8 @@
package com.navinfo.omqs.ui.fragment.tasklist
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -60,6 +62,17 @@ class TaskListFragment : BaseFragment() {
adapter.refreshData(it)
}
binding.taskListSearch.addTextChangedListener(object : TextWatcher {
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
}
override fun afterTextChanged(s: Editable?) {
viewModel.filterTaskList(s.toString())
}
})
}
override fun onDestroyView() {

View File

@@ -17,17 +17,13 @@ import com.navinfo.omqs.http.NetworkService
import com.navinfo.omqs.tools.FileManager
import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.Realm
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.*
import kotlinx.coroutines.*
import javax.inject.Inject
@HiltViewModel
class TaskViewModel @Inject constructor(
private val networkService: NetworkService,
private val mapController: NIMapController
private val networkService: NetworkService, private val mapController: NIMapController
) : ViewModel() {
/**
@@ -47,6 +43,12 @@ class TaskViewModel @Inject constructor(
*/
private var currentSelectTaskBean: TaskBean? = null
/**
* 任务列表查询协程
*/
private var filterTaskListJob: Job? = null
private var filterTaskJob: Job? = null
/**
* 下载任务列表
@@ -70,20 +72,21 @@ class TaskViewModel @Inject constructor(
task.fileSize = item.fileSize
task.status = item.status
task.currentSize = item.currentSize
task.color = item.color
} else {
if (index < 6)
task.color = colors[index]
else {
val random = Random()
task.color = Color.argb(
255,
random.nextInt(256),
random.nextInt(256),
random.nextInt(256)
)
}
// task.color = item.color
}
// else {
// if (index < 6)
// task.color = colors[index]
// else {
// val random = Random()
// task.color = Color.argb(
// 255,
// random.nextInt(256),
// random.nextInt(256),
// random.nextInt(256)
// )
// }
// }
realm.copyToRealmOrUpdate(task)
}
}
@@ -91,13 +94,13 @@ class TaskViewModel @Inject constructor(
}
}
}
is NetResult.Error -> {
is NetResult.Error<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
.show()
}
}
is NetResult.Failure -> {
is NetResult.Failure<*> -> {
withContext(Dispatchers.Main) {
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
.show()
@@ -162,10 +165,7 @@ class TaskViewModel @Inject constructor(
}
}
mapController.animationHandler.animateToBox(
maxX = maxX,
maxY = maxY,
minX = minX,
minY = minY
maxX = maxX, maxY = maxY, minX = minX, minY = minY
)
}
}
@@ -210,4 +210,41 @@ class TaskViewModel @Inject constructor(
}
}
}
/**
* 筛选任务列表
*/
fun filterTaskList(key: String) {
if (filterTaskListJob != null)
filterTaskListJob!!.cancel()
filterTaskListJob = viewModelScope.launch(Dispatchers.IO) {
delay(500)
val realm = Realm.getDefaultInstance()
val list = realm.where(TaskBean::class.java)
.contains("evaluationTaskName", key)
.or()
.contains("dataVersion", key)
.or()
.contains("cityName", key)
.findAll()
liveDataTaskList.postValue(realm.copyFromRealm(list))
}
}
fun filterTask(pidKey: String) {
if (currentSelectTaskBean == null)
return
if (filterTaskJob != null)
filterTaskJob!!.cancel()
filterTaskJob = viewModelScope.launch(Dispatchers.Default) {
delay(500)
val list = mutableListOf<HadLinkDvoBean>()
for (item in currentSelectTaskBean!!.hadLinkDvoList) {
if (item.linkPid.contains(pidKey))
list.add(item)
}
liveDataTaskLinks.postValue(list)
}
}
}

View File

@@ -3,6 +3,7 @@ package com.navinfo.omqs.ui.widget
import android.util.Log
import com.navinfo.collect.library.data.entity.RenderEntity
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.SignBean
class SignUtil {
companion object {
@@ -12,32 +13,71 @@ class SignUtil {
*/
fun getSignIconText(data: RenderEntity): String {
return when (data.code) {
//道路功能等级
2002 -> getLinkFunctionClassText(data)
//道路种别
2008 -> getKindText(data)
//道路方向
2010 -> getRoadDirectionText(data)
//车道数
2041 -> getLaneNumText(data)
//常规点限速,条件点限速
4002, 4003 -> getSpeedLimitText(data)
// //道路种别
// 2008 -> getKindCodeIcon(data)
// //道路方向
// 2010 -> getRoadDirection(data)
// //车道数
// 2041 -> getLaneNumIcon(data)
else -> ""
}
}
fun getSignBottomText(data: RenderEntity): String {
/**
*获取道路功能等级文字
*/
private fun getLinkFunctionClassText(data: RenderEntity): String {
return "等级${data.properties["functionClass"]}"
}
/**
* 获取道路方向文字
*/
private fun getRoadDirectionText(data: RenderEntity): String {
val direct = data.properties["direct"]
when (direct?.toInt()) {
0 -> return "不应用"
1 -> return "双方向"
2 -> return "顺方向"
3 -> return "逆方向"
}
return ""
}
/**
* 获取车道数展示文字
*/
private fun getLaneNumText(data: RenderEntity): String {
return "${data.properties["laneNum"]}|${data.properties["laneS2e"]}|${data.properties["laneE2s"]}"
}
/**
* 获取要素名称
*/
fun getSignNameText(data: RenderEntity): String {
return when (data.code) {
//可变点限速
4004 -> "可变点限速"
//道路功能等级
2002 -> "功能等级"
//道路种别
2008 -> "种别"
//道路方向
2010 -> "方向"
//车道数
2041 -> "车道数"
//常规点限速
4002 -> "常规点限速"
//常点限速
4003 -> "条件点限速"
//道路种别
2008 -> "道路种别"
//道路方向
2010 -> "道路方向"
//车道数
2041 -> "车道数"
//可变点限速
4004 -> "可变点限速"
//普通交限
4006 -> "普通交限"
//交通灯
4022 -> "交通灯"
else -> ""
}
}
@@ -56,8 +96,7 @@ class SignUtil {
/**
* 条件点限速文字
*/
fun getConditionLimitText(data: RenderEntity): String {
private fun getConditionLimitText(data: RenderEntity): String {
var stringBuffer = StringBuffer()
try {
val dependent = data.properties["speedDependent"]
@@ -118,10 +157,17 @@ class SignUtil {
return ""
}
/**
* 获取种别名称
*/
private fun getKindText(data: RenderEntity): String {
return data.properties["kind"].toString()
}
/**
* 限速图标
*/
fun getSpeedLimitIcon(data: RenderEntity): Int {
private fun getSpeedLimitIcon(data: RenderEntity): Int {
try {
//限速标志 0 限速开始 1 限速解除
return when (data.properties["speed_flag"]) {
@@ -131,7 +177,23 @@ class SignUtil {
} catch (e: Exception) {
Log.e("jingo", "获取限速面板ICON出错2 $e")
}
return R.drawable.icon_speed_limit
return 0
}
/**
* 条件限速图标
*/
private fun getConditionalSpeedLimitIcon(data: RenderEntity): Int {
try {
//限速标志 0 限速开始 1 限速解除
return when (data.properties["speed_flag"]) {
"1" -> return R.drawable.icon_conditional_speed_limit_off
else -> return R.drawable.icon_conditional_speed_limit
}
} catch (e: Exception) {
Log.e("jingo", "获取限速面板ICON出错2 $e")
}
return 0
}
/**
@@ -140,17 +202,21 @@ class SignUtil {
fun getSignIcon(data: RenderEntity): Int {
return when (data.code) {
//道路种别
2008 -> getKindCodeIcon(data)
//道路方向
2010 -> getRoadDirection(data)
//车道数
2041 -> getLaneNumIcon(data)
//限速
4002, 4003 -> getSpeedLimitIcon(data)
// //道路种别
// 2008 -> getKindCodeIcon(data)
// //道路方向
// 2010 -> getRoadDirection(data)
// //车道数
// 2041 -> getLaneNumIcon(data)
//普通点限速
4002 -> getSpeedLimitIcon(data)
//条件点限速
4003 -> getConditionalSpeedLimitIcon(data)
//可变点限速
4004 -> R.drawable.icon_change_limit
else -> R.drawable.icon_speed_limit
//交通灯
4022 -> R.drawable.icon_traffic_light
else -> 0
}
}
@@ -159,7 +225,7 @@ class SignUtil {
/**
* 获取种别图标
*/
fun getKindCodeIcon(data: RenderEntity): Int {
private fun getKindCodeIcon(data: RenderEntity): Int {
try {
val kind = data.properties["kind"]
return when (kind!!.toInt()) {
@@ -186,7 +252,7 @@ class SignUtil {
/**
* 获取到路线
*/
fun getLaneNumIcon(data: RenderEntity): Int {
private fun getLaneNumIcon(data: RenderEntity): Int {
try {
val lineNum = data.properties["laneNum"]
return when (lineNum!!.toInt()) {
@@ -210,7 +276,7 @@ class SignUtil {
return R.drawable.icon_road_direction
}
fun getRoadDirection(data: RenderEntity): Int {
private fun getRoadDirection(data: RenderEntity): Int {
try {
val direct = data.properties["direct"]
return when (direct!!.toInt()) {
@@ -226,5 +292,24 @@ class SignUtil {
}
return R.drawable.icon_road_direction
}
/**
* 获取道路播报语音文字
*/
fun getRoadSpeechText(topSignList: MutableList<SignBean>): String {
if (topSignList.size == 0)
return ""
val stringBuffer = StringBuffer()
stringBuffer.append("当前道路")
for (item in topSignList) {
when (item.elementCode) {
2002 -> stringBuffer.append("功能等级${item.iconText.substring(2)}级,")
2008 -> stringBuffer.append("种别${item.iconText},")
2010 -> stringBuffer.append("${item.iconText},")
2041 -> stringBuffer.append("${item.iconText.substringBefore("|")}车道")
}
}
return stringBuffer.toString()
}
}
}

View File

@@ -0,0 +1,270 @@
package com.navinfo.omqs.ui.widget
import android.animation.ArgbEvaluator
import android.animation.ValueAnimator
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.*
import android.os.Build
import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import com.navinfo.omqs.R
class TextProgressButtonBar : View {
constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
init(context!!, attrs!!)
}
constructor(context: Context?, attrs: AttributeSet?, defStyle: Int) : super(context, attrs) {
init(context!!, attrs!!)
}
private lateinit var fm: Paint.FontMetrics
private var progress = 0
private var textColor: Int = Color.WHITE
private var paint: Paint? = null
private var textSize: Float = 10f
private var foreground = 0
private var backgroundcolor = 0
private var text: String? = null
private var max = 100
private val corner = 30 // 圆角的弧度
private val mStartColor = resources.getColor(R.color.default_button_blue_color)
private val mEndColor = resources.getColor(R.color.ripple_end_color)
private val mValueAnimator = ValueAnimator.ofInt(
mEndColor,
mStartColor
)
private var mCurrentColor = mEndColor
// private var buttonClickListener: OnProgressButtonClickListener? = null
fun init(
context: Context, attrs: AttributeSet
) {
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.ProgressButton)
backgroundcolor = typedArray.getInteger(
R.styleable.ProgressButton_backgroundcolor, Color.parseColor("#C6C6C6")
)
foreground = typedArray.getInteger(
R.styleable.ProgressButton_foreground, Color.rgb(20, 131, 214)
)
textColor = typedArray.getInteger(
R.styleable.ProgressButton_textcolor, Color.WHITE
)
max = typedArray.getInteger(R.styleable.ProgressButton_max, 100)
progress = typedArray.getInteger(R.styleable.ProgressButton_progress, 0)
text = typedArray.getString(R.styleable.ProgressButton_text)
textSize = typedArray.getDimension(R.styleable.ProgressButton_textSize, 20f)
typedArray.recycle()
mValueAnimator.duration = 1000
mValueAnimator.repeatCount = ValueAnimator.INFINITE
mValueAnimator.repeatMode = ValueAnimator.REVERSE
// 为 ValueAnimator 对象添加 ArgbEvaluator
mValueAnimator.setEvaluator(ArgbEvaluator());
// 添加动画监听器,在动画值改变时更新当前颜色值并重绘 View
mValueAnimator.addUpdateListener { animation ->
mCurrentColor = animation.animatedValue as Int
invalidate();
};
}
fun startAnimator() {
if (!mValueAnimator.isStarted) {
progress = max
mValueAnimator.start()
}
}
fun stopAnimator() {
if (mValueAnimator.isRunning || mValueAnimator.isStarted) {
mValueAnimator.cancel()
mCurrentColor = mEndColor
}
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
// 在 View 从窗口中移除时停止动画
mValueAnimator.cancel()
}
@SuppressLint("DrawAllocation")
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
paint = Paint()
paint?.let {
it.isAntiAlias = true
it.strokeWidth = 5f
it.style = Paint.Style.STROKE
it.color = textColor
/**
* 绘制背景
*/
var oval = RectF(0F, 0F, width.toFloat(), height.toFloat())
canvas.drawRoundRect(oval, corner.toFloat(), corner.toFloat(), it)
it.style = Paint.Style.FILL
it.color = this.backgroundcolor
canvas.drawRoundRect(oval, corner.toFloat(), corner.toFloat(), it)
if (progress <= corner) {
oval = RectF(
0F,
(corner - progress).toFloat(),
(width * progress / max).toFloat(),
(height - corner + progress).toFloat()
)
/***
* 绘制进度值
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val shader = LinearGradient(
oval.left,
oval.top,
oval.right,
oval.bottom,
mStartColor,
mCurrentColor,
Shader.TileMode.MIRROR
)
it.shader = shader
}
canvas.drawRoundRect(oval, progress.toFloat(), progress.toFloat(), it)
} else {
oval = RectF(
0F, 0F, (width * progress / max).toFloat(), height.toFloat()
)
/***
* 绘制进度值
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val shader = LinearGradient(
oval.left,
oval.top,
oval.right,
oval.bottom,
mStartColor,
mCurrentColor,
Shader.TileMode.CLAMP
)
it.shader = shader
}
canvas.drawRoundRect(oval, corner.toFloat(), corner.toFloat(), it)
}
/***
* 绘制文本
*/
it.shader = null
if ("" == text || text == null) {
return
}
it.textSize = textSize
fm = it.fontMetrics
it.color = textColor
val textCenterVerticalBaselineY = height / 2 - fm.descent + (fm.descent - fm.ascent) / 2
canvas.drawText(
text!!, (measuredWidth - it.measureText(text)) / 2, textCenterVerticalBaselineY, it
)
}
}
/**
* 设置最大值
*
* @param max
*/
fun setMax(max: Int) {
this.max = max
}
/**
* 设置文本提示信息
*
* @param text
*/
fun setText(text: String?) {
this.text = text
postInvalidate()
}
/**
* 设置进度条的颜色值
*
* @param color
*/
fun setForeground(color: Int) {
foreground = color
}
/**
* 设置进度条的背景色
*/
override fun setBackgroundColor(color: Int) {
this.backgroundcolor = color
}
/***
* 设置文本的大小
*/
fun setTextSize(size: Int) {
textSize = size.toFloat()
}
/**
* 设置文本的颜色值
*
* @param color
*/
fun setTextColor(color: Int) {
textColor = color
}
/**
* 设置进度值
*
* @param progress
*/
fun setProgress(progress: Int) {
if (progress > max) {
return
}
this.progress = progress
//设置进度之后要求UI强制进行重绘
postInvalidate()
}
fun getMax(): Int {
return max
}
fun getProgress(): Int {
return progress
}
// @SuppressLint("ClickableViewAccessibility")
// override fun onTouchEvent(event: MotionEvent): Boolean {
// when (event.action) {
// MotionEvent.ACTION_UP -> buttonClickListener?.onClickListener(this)
// else -> {
// }
// }
// return true
// }
//
// fun setOnProgressButtonClickListener(clickListener: OnProgressButtonClickListener) {
// buttonClickListener = clickListener
// }
//
//
// interface OnProgressButtonClickListener {
// fun onClickListener(view: View)
// }
}

View File

@@ -1,149 +0,0 @@
package com.navinfo.omqs.util;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import com.navinfo.omqs.ui.dialog.FirstDialog;
import java.util.HashMap;
import java.util.Locale;
//语音类
public class SpeakMode extends Activity implements TextToSpeech.OnInitListener{
private Activity mActivity;
private TextToSpeech mTextToSpeech;//TTS对象
private int status;
private int MY_DATA_CHECK_CODE = 0;
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 0x11:
try {
HashMap<String, String> params = new HashMap<String, String>();
params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, "STREAM_NOTIFICATION");//设置播放类型(音频流类型)
mTextToSpeech.speak(msg.obj + "", TextToSpeech.QUEUE_ADD, params);//将这个发音任务添加当前任务之后
//BaseToast.makeText(mActivity,msg.obj+"",Toast.LENGTH_LONG).show();
mTextToSpeech.playSilence(100, TextToSpeech.QUEUE_ADD, params);//间隔多长时间
} catch (Exception e) {
}
break;
}
}
};
public SpeakMode(Activity activity) {
mActivity = activity;
if (mActivity != null && !mActivity.isFinishing())
this.mTextToSpeech = new TextToSpeech(this.mActivity, this);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent checkIntent = new Intent();
checkIntent.setAction(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA);
startActivityForResult(checkIntent, MY_DATA_CHECK_CODE);
}
public void setData(String json) {
}
@Override
public void onInit(int status) {
this.status = status;
if (this.mTextToSpeech != null) {
int result = this.mTextToSpeech.setLanguage(Locale.CHINESE);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
if (mActivity != null && !mActivity.isFinishing()) {
FirstDialog firstDialog = new FirstDialog(mActivity);
firstDialog.setTitle("提示");
firstDialog.setMessage("设备不支持语音播报,请先下载语音助手。");
firstDialog.setConfirmListener(new FirstDialog.OnClickListener() {
@Override
public void onClick(Dialog dialog, int which) {
dialog.dismiss();
}
});
firstDialog.setNegativeView(View.GONE);
firstDialog.show();
}
}
}
Log.i("TextToSpeechDemo", String.valueOf(status));
}
//读语音处理
public void speakText(final String message) {
new Thread(new Runnable() {
@Override
public void run() {
if (mTextToSpeech != null) {
int result = mTextToSpeech.setLanguage(Locale.CHINESE);
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED) {
} else {
if (mTextToSpeech != null && mTextToSpeech.isSpeaking()) {
while (mTextToSpeech.isSpeaking()) {
try {
//增加播报停止,解决不能播报最新内容问题
mTextToSpeech.stop();
Thread.sleep(100);
} catch (Exception e) {
}
}
}
Message msg = new Message();
msg.what = 0x11;
msg.obj = message;
mHandler.sendMessage(msg);
}
}
}
}).start();
}
public void stopSpeek() {
try {
if (this.mTextToSpeech != null && this.mTextToSpeech.isSpeaking()) {
this.mTextToSpeech.stop();
}
} catch (Exception e) {
}
}
}

View File

@@ -0,0 +1,110 @@
package com.navinfo.omqs.util
import android.content.Context
import android.os.Handler
import android.os.Message
import android.speech.tts.TextToSpeech
import android.util.Log
import android.view.View
import com.navinfo.omqs.ui.dialog.FirstDialog
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import java.util.*
import javax.inject.Inject
//语音类
class SpeakMode(private val context: Context) : TextToSpeech.OnInitListener {
private var mTextToSpeech: TextToSpeech = TextToSpeech(context, this)
private var status = 0
private val MY_DATA_CHECK_CODE = 0
private val mHandler: Handler = object : Handler() {
override fun handleMessage(msg: Message) {
when (msg.what) {
0x11 -> try {
val params = HashMap<String, String>()
params[TextToSpeech.Engine.KEY_PARAM_STREAM] =
"STREAM_NOTIFICATION" //设置播放类型(音频流类型)
mTextToSpeech.speak(
msg.obj.toString() + "",
TextToSpeech.QUEUE_ADD,
params
) //将这个发音任务添加当前任务之后
//BaseToast.makeText(mActivity,msg.obj+"",Toast.LENGTH_LONG).show();
mTextToSpeech.playSilence(100, TextToSpeech.QUEUE_ADD, params) //间隔多长时间
} catch (e: Exception) {
}
}
}
}
init {
// if (mActivity != null && !mActivity.isFinishing) mTextToSpeech = TextToSpeech(
// mActivity, this
// )
}
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// val checkIntent = Intent()
// checkIntent.action = TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
// startActivityForResult(checkIntent, MY_DATA_CHECK_CODE)
// }
fun setData(json: String?) {}
override fun onInit(status: Int) {
this.status = status
val result = mTextToSpeech.setLanguage(Locale.CHINESE)
if (result == TextToSpeech.LANG_MISSING_DATA
|| result == TextToSpeech.LANG_NOT_SUPPORTED
) {
if (context != null) {
val firstDialog = FirstDialog(context)
firstDialog.setTitle("提示")
firstDialog.setMessage("设备不支持语音播报,请先下载语音助手。")
firstDialog.setConfirmListener { dialog, _ -> dialog.dismiss() }
firstDialog.setNegativeView(View.GONE)
firstDialog.show()
}
}
Log.i("TextToSpeechDemo", status.toString())
}
//读语音处理
fun speakText(message: String) {
mTextToSpeech.speak(message, TextToSpeech.QUEUE_FLUSH, null, "")
// val result = mTextToSpeech.setLanguage(Locale.CHINESE)
// if (result == TextToSpeech.LANG_MISSING_DATA
// || result == TextToSpeech.LANG_NOT_SUPPORTED
// ) {
// } else {
// while (mTextToSpeech.isSpeaking) {
// try {
// //增加播报停止,解决不能播报最新内容问题
// mTextToSpeech.stop()
// } catch (e: Exception) {
//
// }
// }
// val msg = Message()
// msg.what = 0x11
// msg.obj = message
// mHandler.sendMessage(msg)
// }
}
fun stopSpeech() {
try {
if (mTextToSpeech.isSpeaking) {
mTextToSpeech.stop()
}
} catch (e: Exception) {
}
}
fun shutdown() {
stopSpeech()
mTextToSpeech.shutdown()
}
}

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/default_blue_text_color" />
<item android:color="@color/black" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/default_blue_text_color" android:state_selected="true"></item>
<item android:drawable="@color/black" />
</selector>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true">
<shape android:shape="oval">
<size android:width="10dp" android:height="10dp" />
<solid android:color="@color/default_button_blue_color" />
</shape>
</item>
<item>
<shape android:shape="oval">
<size android:width="10dp" android:height="10dp" />
<solid android:color="@color/white" />
</shape>
</item>
</selector>

View File

@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- <padding-->
<!-- android:bottom="2dp"-->
<!-- android:left="2dp"-->
<!-- android:right="0dp"-->
<!-- android:top="2dp" />-->
<padding
android:bottom="2dp"
android:left="2dp"
android:right="2dp"
android:top="2dp" />
<solid android:color="#FFFFFF" />
<stroke
android:width="1dp"
android:color="#3756DF" />
<corners
android:bottomLeftRadius="4dp"
android:bottomLeftRadius="5dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="4dp"
android:topLeftRadius="5dp"
android:topRightRadius="0dp" />
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#BA0C122B" />
<corners
android:topLeftRadius="0dp"
android:topRightRadius="0dp"
android:bottomLeftRadius="6dp"
android:bottomRightRadius="6dp"/>
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#BA0C122B" />
<corners
android:bottomLeftRadius="6dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#990C122B" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="6dp"
android:topRightRadius="0dp" />
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#BA0C122B" />
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#990C122B" />
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#BA0C122B" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="6dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#990C122B" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="6dp" />
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#990C122B" />
<corners
android:bottomLeftRadius="0dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="6dp"
android:topRightRadius="6dp" />
</shape>

View File

@@ -92,7 +92,7 @@
android:hint="@string/input_user_name"
android:lines="1"
android:background="@drawable/shape_login_inputlayout_bg"
android:text="@{loginUserModel.loginUser.username}"
android:text="@{loginUserModel.loginUser.userCode}"
tools:ignore="TouchTargetSizeCheck" />
</com.google.android.material.textfield.TextInputLayout>
@@ -113,10 +113,12 @@
android:lines="1"
android:inputType="textPassword"
android:background="@drawable/shape_login_inputlayout_bg"
android:text="@{loginUserModel.loginUser.password}"
android:text="@{loginUserModel.loginUser.passWord}"
tools:ignore="TouchTargetSizeCheck" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/tv_login_forget_passwd"
android:layout_width="match_parent"

View File

@@ -51,6 +51,14 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/main_activity_top_sign_recyclerview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/main_activity_person_center"
@@ -67,8 +75,9 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/main_activity_sign_recyclerview"
android:layout_width="wrap_content"
android:layout_height="350dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:maxHeight="350dp"
app:layout_constraintLeft_toLeftOf="@id/main_activity_person_center"
app:layout_constraintTop_toBottomOf="@id/main_activity_person_center" />
@@ -136,9 +145,8 @@
<ImageButton
android:id="@+id/main_activity_fragment_switch"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginRight="-10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/selector_fragment_switch"
android:elevation="2dp"
android:onClick="@{()->mainActivity.onSwitchFragment()}"
@@ -167,6 +175,7 @@
android:drawableLeft="@drawable/icon_main_geometry"
android:elevation="2dp"
android:gravity="center"
android:onClick="@{()->mainActivity.jumpPosition()}"
android:paddingLeft="9dp"
android:text="经纬度:116.99388424,38.8403844"
android:textSize="10sp"
@@ -224,7 +233,6 @@
app:layout_constraintBottom_toTopOf="@id/main_activity_add_new"
app:layout_constraintRight_toRightOf="@id/main_activity_add_new" />
<ImageButton
android:id="@+id/main_activity_select_line"
style="@style/zoom_btns_style"
@@ -235,6 +243,12 @@
app:layout_constraintBottom_toTopOf="@id/main_activity_voice"
app:layout_constraintRight_toRightOf="@id/main_activity_voice" />
<androidx.constraintlayout.widget.Group
android:id="@+id/main_activity_right_visibility_buttons_group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="main_activity_select_line,main_activity_voice,main_activity_add_new" />
<fragment
android:id="@+id/main_activity_middle_fragment"
android:name="androidx.navigation.fragment.NavHostFragment"
@@ -259,8 +273,8 @@
android:name="androidx.navigation.fragment.NavHostFragment"
android:layout_width="323dp"
android:layout_height="match_parent"
android:layout_marginTop="30dp"
android:layout_gravity="left"
android:layout_marginTop="30dp"
app:navGraph="@navigation/left_drawer_nav_graph" />
</androidx.drawerlayout.widget.DrawerLayout>

View File

@@ -58,7 +58,7 @@
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_below="@id/offline_map_download_btn"
android:layout_below="@id/offline_map_city_size"
android:paddingTop="10dp"
android:progressDrawable="@drawable/progress_bg"
android:visibility="invisible" />

View File

@@ -1,18 +1,29 @@
<RelativeLayout 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"
android:layout_width="193dp"
android:layout_width="wrap_content"
android:layout_height="78dp"
android:background="@drawable/bg_sign"
tools:context="com.navinfo.omqs.ui.activity.map.SignAdapter">
<ImageView
android:id="@+id/sign_main_bg"
android:layout_width="193dp"
android:layout_height="78dp"
android:background="@drawable/bg_sign" />
<ImageView
android:id="@+id/sign_main_icon_bg"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="19dp"
android:layout_marginTop="4dp" />
<TextView
android:id="@+id/sign_main_icon"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="19dp"
android:layout_marginTop="4dp"
android:background="@drawable/icon_speed_limit"
android:gravity="center"
android:text="80"
android:textColor="#2F2F2F"
@@ -34,11 +45,32 @@
android:id="@+id/sign_bottom_right_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="其他信息"
android:layout_alignTop="@id/sign_bottom_text"
android:textColor="@color/white"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:textSize="14sp"/>
android:gravity="center"
android:text="其他信息"
android:textColor="@color/white"
android:textSize="14sp" />
<ImageView
android:id="@+id/sign_main_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/sign_main_bg"
android:layout_marginLeft="2dp"
android:layout_toRightOf="@id/sign_main_bg"
android:background="@drawable/icon_sign_info"
android:visibility="gone" />
<ImageView
android:id="@+id/sign_main_fast_error"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/icon_evaluation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>

View File

@@ -8,7 +8,7 @@
android:paddingLeft="8dp"
android:paddingTop="6dp"
android:paddingRight="8dp"
android:paddingBottom="4dp"
android:paddingBottom="8dp"
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter">
<ImageView
@@ -30,65 +30,57 @@
android:textColor="#15141F"
android:textSize="14sp" />
<TextView
android:id="@+id/task_city_name"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_name"
android:layout_alignLeft="@id/task_name"
android:layout_marginTop="5dp"
android:text="省市名称"
android:textColor="@color/gray_121"
android:textSize="13sp" />
<TextView
android:id="@+id/task_data_version"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_city_name"
android:layout_below="@id/task_name"
android:layout_alignLeft="@id/task_name"
android:layout_toLeftOf="@id/task_upload_btn"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:text="版本号"
android:textColor="@color/gray_121"
android:textSize="13sp" />
<TextView
android:id="@+id/task_color"
android:id="@+id/task_city_name"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_data_version"
android:layout_alignLeft="@id/task_name"
android:layout_marginTop="5dp"
android:drawableLeft="@drawable/point_blue"
android:text="路线颜色"
android:textSize="@dimen/card_title_font_3size" />
android:text="省市名称"
android:textColor="@color/gray_121"
android:textSize="13sp" />
<TextView
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
android:id="@+id/task_download_btn"
style="@style/btn_default_stroke_horizontal_round"
android:layout_width="72dp"
android:layout_width="75dp"
android:layout_height="22dp"
android:layout_alignBottom="@id/task_city_name"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:gravity="center"
android:text="下载"
android:textSize="@dimen/card_title_font_2size" />
android:layout_gravity="center"
android:layout_marginTop="5dp"
app:backgroundcolor="#888FB3"
app:text="下载"
app:textSize="@dimen/card_title_font_2size"
app:textcolor="@color/white" />
<TextView
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
android:id="@+id/task_upload_btn"
style="@style/btn_default_stroke_horizontal_round"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_toLeftOf="@id/task_download_btn"
android:gravity="center"
android:minWidth="60dp"
android:shadowColor="@android:color/transparent"
android:text="同步"
android:textSize="@dimen/card_title_font_2size" />
android:layout_width="75dp"
android:layout_height="22dp"
android:layout_alignBottom="@id/task_city_name"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:visibility="gone"
app:backgroundcolor="#888FB3"
app:text="未上传"
app:textSize="@dimen/card_title_font_2size"
app:textcolor="@color/white" />
<TextView
android:id="@+id/task_status"
@@ -103,13 +95,14 @@
android:textColor="@color/white"
android:textSize="@dimen/card_title_font_2size" />
<com.navinfo.omqs.ui.widget.MyProgressBar
android:id="@+id/task_progress"
<TextView
android:id="@+id/task_progress_text"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_below="@id/task_color"
android:paddingTop="10dp"
android:progressDrawable="@drawable/progress_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/task_download_btn"
android:layout_alignBottom="@id/task_download_btn"
android:layout_toLeftOf="@id/task_download_btn"
android:gravity="center"
android:visibility="invisible" />
</RelativeLayout>

View File

@@ -0,0 +1,54 @@
<RelativeLayout 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"
android:layout_width="70dp"
android:layout_height="match_parent"
tools:context="com.navinfo.omqs.ui.activity.map.TopSignAdapter">
<TextView
android:id="@+id/top_sign_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="0.5dp"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="名称"
android:textColor="@color/white"
android:textSize="14sp" />
<TextView
android:id="@+id/top_sign_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/top_sign_name"
android:layout_alignLeft="@id/top_sign_name"
android:layout_alignRight="@id/top_sign_name"
android:layout_centerHorizontal="true"
android:gravity="center"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="道路名"
android:textColor="@color/white"
android:textSize="18sp" />
<View
android:id="@+id/top_sign_left_line"
android:layout_width="0.5dp"
android:layout_height="wrap_content"
android:layout_alignTop="@id/top_sign_text"
android:layout_alignBottom="@id/top_sign_text"
android:background="#0C122B"
android:visibility="gone" />
<View
android:id="@+id/top_sign_right_line"
android:layout_width="0.5dp"
android:layout_height="wrap_content"
android:layout_alignTop="@id/top_sign_text"
android:layout_alignBottom="@id/top_sign_text"
android:layout_alignParentRight="true"
android:background="#0C122B"
android:visibility="gone" />
</RelativeLayout>

View File

@@ -24,6 +24,7 @@
android:id="@+id/evaluation_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/selector_btn_back_xml"
android:layout_marginLeft="12dp"
android:layout_marginTop="14dp"
android:text="Mark"
@@ -48,6 +49,7 @@
android:id="@+id/evaluation_bar_cancel"
android:layout_width="40dp"
android:layout_height="40dp"
android:visibility="gone"
android:layout_marginRight="10dp"
android:background="@color/transparent"
android:src="@drawable/icon_fragment_close"

View File

@@ -13,6 +13,7 @@
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
style="@style/left_pannel_title_layout">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/offline_map_back"
android:layout_width="wrap_content"
@@ -24,7 +25,9 @@
android:background="@drawable/selector_bg_round_button"
android:foreground="@drawable/ripple_btn_press"
style="@style/btn_round"
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"></androidx.appcompat.widget.AppCompatImageView>
android:src="@drawable/ic_baseline_keyboard_arrow_left_24">
</androidx.appcompat.widget.AppCompatImageView>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_title"
@@ -36,19 +39,24 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"></androidx.appcompat.widget.AppCompatTextView>
app:layout_constraintBottom_toBottomOf="parent">
</androidx.appcompat.widget.AppCompatTextView>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/title_layout"
app:layout_constraintBottom_toBottomOf="parent"
style="@style/default_card_view">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/offline_map_tab_layout"
android:layout_width="match_parent"
@@ -60,22 +68,22 @@
app:tabPadding="0dp"
app:tabIndicator="@null"
app:tabMode="scrollable"
app:tabMinWidth="120dp"
app:tabIndicatorHeight="0dp"
app:tabSelectedTextColor="@color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_layout">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/default_widget_padding"
android:text="下载管理" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/default_widget_padding"
android:text="城市列表" />
</com.google.android.material.tabs.TabLayout>

View File

@@ -7,65 +7,20 @@
android:background="@drawable/shape_middle_fragment_bg"
tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.PhenomenonFragment">
<!-- <ImageView-->
<!-- android:id="@+id/phenomenon_drawer"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:background="@drawable/progress_bg"-->
<!-- android:paddingLeft="10dp"-->
<!-- android:paddingTop="30dp"-->
<!-- android:paddingRight="10dp"-->
<!-- android:paddingBottom="30dp"-->
<!-- android:src="@drawable/btn_back_xml" />-->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/phenomenon_middle_recyclerview"
android:layout_width="0dp"
android:layout_height="35dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/phenomenon_right_recyclerview"
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/phenomenon_left_recyclerview"
android:layout_width="0dp"
android:layout_width="148dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toLeftOf="@id/phenomenon_right_recyclerview"
app:layout_constraintTop_toBottomOf="@id/phenomenon_middle_recyclerview" />
app:layout_constraintTop_toTopOf="parent" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/phenomenon_right_recyclerview"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/phenomenon_left_recyclerview"
app:layout_constraintRight_toRightOf="parent" />
<!-- <LinearLayout-->
<!-- android:id="@+id/group"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="vertical">-->
<!-- <LinearLayout-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:orientation="horizontal">-->
<!-- <RelativeLayout-->
<!-- android:layout_width="0dp"-->
<!-- android:layout_height="match_parent"-->
<!-- android:layout_weight="2">-->
<!-- -->
<!-- </RelativeLayout>-->
<!-- -->
<!-- </LinearLayout>-->
<!-- </LinearLayout>-->
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,51 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:layout_width="match_parent"
android:layout_width="@dimen/fragment_problem_link_width"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:orientation="horizontal"
android:paddingTop="@dimen/fragment_margin_top"
android:paddingLeft="@dimen/fragment_margin_left"
android:background="@drawable/shape_middle_fragment_bg"
tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.ProblemLinkFragment">
<ImageView
android:visibility="gone"
android:id="@+id/link_drawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/progress_bg"
android:paddingLeft="10dp"
android:paddingTop="30dp"
android:paddingRight="10dp"
android:paddingBottom="30dp"
android:src="@drawable/selector_btn_back_xml" />
<LinearLayout
android:id="@+id/group"
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/link_right_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/link_middle_recyclerview"
android:layout_width="0dp"
android:visibility="invisible"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@color/white" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/link_right_recyclerview"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="4"
android:background="@color/white" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_layout"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:background="@drawable/selector_adapter_item_select_bg">
<TextView
android:id="@+id/item_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="3dp"
android:padding = "3dp"
android:layout_margin="4dp"
android:drawableLeft="@drawable/selector_text_drawable_left_white_blue"
android:drawablePadding="10dp"
android:gravity="center"
android:textColor="@color/black"
android:textSize="18sp">
android:padding="4dp"
android:textColor="@color/selector_black_blue_color"
android:textSize="14sp" />
</TextView>
</RelativeLayout>
</RelativeLayout>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/selector_adapter_item_select_bg">
<TextView
android:id="@+id/item_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:gravity="center_vertical"
android:padding="4dp"
android:textColor="@color/selector_black_blue_color"
android:textSize="14sp"/>
</RelativeLayout>

View File

@@ -2,12 +2,12 @@
<navigation 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"
app:startDestination="@id/EmptyFragment">
app:startDestination="@id/MiddleEmptyFragment">
<fragment
android:id="@+id/EmptyFragment"
android:id="@+id/MiddleEmptyFragment"
android:name="com.navinfo.omqs.ui.fragment.empty.EmptyFragment"
android:label="空页面"
android:label="中间空页面"
tools:layout="@layout/fragment_empty"></fragment>
<fragment

View File

@@ -3,24 +3,24 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/right_fragment_nav_graph"
app:startDestination="@id/EmptyFragment">
app:startDestination="@id/RightEmptyFragment">
<fragment
android:id="@+id/EmptyFragment"
android:id="@+id/RightEmptyFragment"
android:name="com.navinfo.omqs.ui.fragment.empty.EmptyFragment"
android:label="空页面"
android:label="右侧空页面"
tools:layout="@layout/fragment_empty">
<!-- <action-->
<!-- android:id="@+id/EmptyFragment_to_EvaluationResultFragment"-->
<!-- app:destination="@id/EvaluationResultFragment" />-->
<!-- <argument-->
<!-- android:name="QsId"-->
<!-- app:argType="string"-->
<!-- app:nullable="true" />-->
<!-- <argument-->
<!-- android:name="SignBean"-->
<!-- app:argType="com.navinfo.omqs.ui.activity.map.SignBean"-->
<!-- />-->
<!-- <action-->
<!-- android:id="@+id/EmptyFragment_to_EvaluationResultFragment"-->
<!-- app:destination="@id/EvaluationResultFragment" />-->
<!-- <argument-->
<!-- android:name="QsId"-->
<!-- app:argType="string"-->
<!-- app:nullable="true" />-->
<!-- <argument-->
<!-- android:name="SignBean"-->
<!-- app:argType="com.navinfo.omqs.ui.activity.map.SignBean"-->
<!-- />-->
</fragment>
<fragment

View File

@@ -1,5 +1,5 @@
<resources>
<dimen name="fab_margin">200dp</dimen>
<dimen name="fab_margin">48dp</dimen>
<dimen name="top_right_drawer_btns_wh" comment="地图主页右上角抽屉按钮的大小">54dp</dimen>
<dimen name="top_right_drawer_wh" comment="地图主页右上角抽屉的把手按钮的大小">42dp</dimen>
<dimen name="top_right_drawer_btns_mr" comment="地图主页右上角抽屉按钮距离右侧间距">44dp</dimen>
@@ -8,5 +8,6 @@
<dimen name="right_fragment_w" comment="右侧fragment宽度">256dp</dimen>
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
<dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">360dp</dimen>
<dimen name="fragment_problem_link_width" comment="问题原因面板宽度">213dp</dimen>
</resources>

View File

@@ -1,4 +1,4 @@
<resources>
<dimen name="fab_margin">48dp</dimen>
<dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">310dp</dimen>
<dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">360dp</dimen>
</resources>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ProgressButton">
<attr name="backgroundcolor" format="color" />
<attr name="foreground" format="reference|color|integer"/>
<attr name="textcolor" format="color" />
<attr name="max" format="integer"/>
<attr name="progress" format="integer"/>
<attr name="textSize" format="dimension" />
<attr name="text" format="string" />
</declare-styleable>
</resources>

View File

@@ -39,6 +39,6 @@
<dimen name="right_fragment_w" comment="右侧fragment宽度">213dp</dimen>
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
<dimen name="fragment_problem_link_width" comment="问题原因面板宽度">213dp</dimen>
</resources>

View File

@@ -42,6 +42,9 @@
<item name="android:gravity">center_vertical</item>
<item name="android:paddingRight">6dp</item>
<item name="android:paddingLeft">10dp</item>
<item name="autoSizeMaxTextSize">14sp</item>
<item name="autoSizeMinTextSize">8sp</item>
<item name="autoSizeTextType">uniform</item>
<item name="android:drawableRight">@drawable/baseline_keyboard_arrow_down_12</item>
<item name="android:background">@drawable/shape_rect_white_2dp_bg</item>
<item name="android:layout_width">match_parent</item>

View File

@@ -8,9 +8,14 @@ buildscript {
}
}
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'com.android.application' version '7.4.2' apply false
id 'com.android.library' version '7.4.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
id 'com.google.dagger.hilt.android' version '2.44' apply false
}
static def androidCompileSdk() { return 33 }
allprojects {
ext.gdxVersion = "1.11.0"
ext.gwtVersion = "2.8.2"
ext.slf4jVersion = "1.7.28"
}

View File

@@ -45,6 +45,12 @@ android {
sourceSets {
main {
jniLibs.srcDirs = ['libs']
file("../vtm/vtm-android/natives").eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
}
file("../vtm/vtm-android-gdx/natives").eachDir() { dir ->
jniLibs.srcDirs += "${dir.path}/lib"
}
}
}
}
@@ -72,25 +78,34 @@ dependencies {
// VTM依赖
implementation "net.sf.kxml:kxml2:2.3.0"
implementation 'org.slf4j:slf4j-api:2.0.7'
api "org.mapsforge:vtm:$vtmVersion"
implementation "org.mapsforge:vtm-themes:$vtmVersion"
implementation "org.mapsforge:vtm-android:$vtmVersion"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-armeabi-v7a"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-arm64-v8a"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86"
runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86_64"
implementation "org.mapsforge:vtm-http:$vtmVersion"
implementation project(":vtm-themes")
implementation project(":vtm-android")
implementation project(':vtm-extras')
implementation project(":vtm-http")
// implementation "org.mapsforge:vtm-themes:$vtmVersion"
// implementation "org.mapsforge:vtm-android:$vtmVersion"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-armeabi-v7a"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-arm64-v8a"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86"
// runtimeOnly "org.mapsforge:vtm-android:$vtmVersion:natives-x86_64"
// implementation "org.mapsforge:vtm-http:$vtmVersion"
implementation "org.mapsforge:vtm-json:$vtmVersion"
implementation "org.mapsforge:vtm-gdx:$vtmVersion"
implementation "org.mapsforge:vtm-android-mvt:$vtmVersion"
implementation "org.mapsforge:vtm-mvt:$vtmVersion"
implementation project(":vtm-json")
// implementation project(":vtm-gdx")
// implementation project(":vtm-gdx-poi3d")
implementation project(":vtm-android-mvt")
implementation project(":vtm-mvt")
// implementation "org.mapsforge:vtm-json:$vtmVersion"
// implementation "org.mapsforge:vtm-gdx:$vtmVersion"
// implementation "org.mapsforge:vtm-android-mvt:$vtmVersion"
// implementation "org.mapsforge:vtm-mvt:$vtmVersion"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-armeabi-v7a"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-arm64-v8a"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86"
runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86_64"
implementation "org.mapsforge:vtm-android-gdx:$vtmVersion"
// implementation project(":vtm-android-gdx")
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-armeabi-v7a"
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-arm64-v8a"
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86"
// runtimeOnly "org.mapsforge:vtm-android-gdx:$vtmVersion:natives-x86_64"
// implementation "org.mapsforge:vtm-android-gdx:$vtmVersion"
implementation "com.google.protobuf:protobuf-java:3.6.1"
implementation "com.wdtinc:mapbox-vector-tile:3.1.0"
@@ -98,7 +113,8 @@ dependencies {
implementation "com.badlogicgames.gdx:gdx:1.11.0"
implementation "com.badlogicgames.gdx:gdx-backend-android:1.11.0"
implementation "com.caverock:androidsvg:1.4"
api "org.mapsforge:vtm-jts:$vtmVersion"
// api "org.mapsforge:vtm-jts:$vtmVersion"
api project(":vtm-jts")
api 'org.locationtech.jts:jts-core:1.19.0'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.11'
implementation 'com.squareup.okio:okio:3.3.0'

View File

@@ -94,6 +94,7 @@
<xs:enumeration value="name"/>
<xs:enumeration value="maxSpeed"/><!--最高速度-->
<xs:enumeration value="minSpeed"/><!--最低速度-->
<xs:enumeration value="angle"/><!--角度-->
<xs:enumeration value="ref"/>
</xs:restriction>
</xs:simpleType>

View File

@@ -173,6 +173,9 @@
<!-- oneway -->
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
<!-- omdb -->
<style-line id="boundaryType" width="0.1" stipple-width="0.1" />
<!--###### ASSIGNMENT ######-->
<m e="way" k="natural" v="issea|sea">
@@ -1600,46 +1603,34 @@
</m>
<!--道路种别-->
<m v="OMDB_RD_LINK_KIND">
<m k="kind">
<m v="1">
<line stroke="#fcacd4" width="1"/>
</m>
<m v="2">
<line stroke="#dcacfc" width="1"/>
</m>
<m v="3">
<line stroke="#fc9c9c" width="1"/>
</m>
<m v="4">
<line stroke="#fcd484" width="1"/>
</m>
<m v="5">
<line stroke="#ecfccc" width="1"/>
</m>
<m v="6">
<line stroke="#acec84" width="1"/>
</m>
<m v="7">
<line stroke="#806048" width="1"/>
</m>
<m v="8">
<line stroke="#fcfc7c" width="1"/>
</m>
<m v="9">
<line stroke="#acc4fc" width="1"/>
</m>
<m v="10">
<line stroke="#8cc8e0" width="1"/>
</m>
<m v="11">
<line stroke="#64ecdc" width="1"/>
</m>
<m v="13">
<line stroke="#585080" width="1"/>
</m>
<m v="15">
<line stroke="#647430" width="1"/>
</m>
<outline-layer id="kind0" stroke="#44000000" width="0.1" />
<outline-layer id="kind1" stroke="#aa807040" width="0.1" />
<m k="kind" v="1">
<line outline="kind0" blur="0.3" use="highway:z11" />
</m>
<m k="kind" v="2|3">
<line outline="kind0" use="trunk" />
</m>
<m k="kind" v="4">
<line outline="kind0" use="primary:z11" />
</m>
<m k="kind" v="5|6">
<line outline="kind0" use="secondary:z11" />
</m>
<m k="kind" v="7">
<line outline="kind0" use="tertiary" />
</m>
<m k="kind" v="8">
<line outline="kind0" use="residential" />
</m>
<m k="kind" v="9|10">
<line outline="kind0" use="footway:z17" />
</m>
<m k="kind" v="11|13">
<line outline="kind0" use="ferry" />
</m>
<m k="kind" v="15">
<line outline="kind0" use="highway:cycleway" />
</m>
</m>
@@ -1651,163 +1642,13 @@
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4002_0.png" symbol-width="46" symbol-height="46"></symbol>
<!-- <circle fill="#ffffff" radius="28" scale-radius="true" stroke="#ff0000" stroke-width="6"/>-->
<!-- <m k="maxSpeed">-->
<!-- <m v="5">-->
<!-- <symbol src="assets:omdb/1101/1101_5_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="10">-->
<!-- <symbol src="assets:omdb/1101/1101_10_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="15">-->
<!-- <symbol src="assets:omdb/1101/1101_15_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="20">-->
<!-- <symbol src="assets:omdb/1101/1101_20_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="25">-->
<!-- <symbol src="assets:omdb/1101/1101_25_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="30">-->
<!-- <symbol src="assets:omdb/1101/1101_30_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="35">-->
<!-- <symbol src="assets:omdb/1101/1101_35_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="40">-->
<!-- <symbol src="assets:omdb/1101/1101_40_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="45">-->
<!-- <symbol src="assets:omdb/1101/1101_45_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="50">-->
<!-- <symbol src="assets:omdb/1101/1101_50_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="55">-->
<!-- <symbol src="assets:omdb/1101/1101_55_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="60">-->
<!-- <symbol src="assets:omdb/1101/1101_60_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="65">-->
<!-- <symbol src="assets:omdb/1101/1101_65_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="70">-->
<!-- <symbol src="assets:omdb/1101/1101_70_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="75">-->
<!-- <symbol src="assets:omdb/1101/1101_75_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="80">-->
<!-- <symbol src="assets:omdb/1101/1101_80_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="85">-->
<!-- <symbol src="assets:omdb/1101/1101_85_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="90">-->
<!-- <symbol src="assets:omdb/1101/1101_90_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="95">-->
<!-- <symbol src="assets:omdb/1101/1101_95_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="100">-->
<!-- <symbol src="assets:omdb/1101/1101_100_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="105">-->
<!-- <symbol src="assets:omdb/1101/1101_105_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="110">-->
<!-- <symbol src="assets:omdb/1101/1101_110_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="115">-->
<!-- <symbol src="assets:omdb/1101/1101_115_0.png"></symbol>-->
<!-- </m>-->
<!-- <m v="120">-->
<!-- <symbol src="assets:omdb/1101/1101_120_0.png"></symbol>-->
<!-- </m>-->
<!-- </m>-->
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
<m v="1">
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4002_1.png" symbol-width="46" symbol-height="46"></symbol>
<!-- <circle fill="#ffffff" radius="28" scale-radius="true" stroke="#00ff00" stroke-width="6"/>-->
<!-- <m k="maxSpeed">-->
<!-- <m v="5">-->
<!-- <symbol src="assets:omdb/1101/1101_5_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="10">-->
<!-- <symbol src="assets:omdb/1101/1101_10_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="15">-->
<!-- <symbol src="assets:omdb/1101/1101_15_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="20">-->
<!-- <symbol src="assets:omdb/1101/1101_20_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="25">-->
<!-- <symbol src="assets:omdb/1101/1101_25_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="30">-->
<!-- <symbol src="assets:omdb/1101/1101_30_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="35">-->
<!-- <symbol src="assets:omdb/1101/1101_35_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="40">-->
<!-- <symbol src="assets:omdb/1101/1101_40_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="45">-->
<!-- <symbol src="assets:omdb/1101/1101_45_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="50">-->
<!-- <symbol src="assets:omdb/1101/1101_50_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="55">-->
<!-- <symbol src="assets:omdb/1101/1101_55_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="60">-->
<!-- <symbol src="assets:omdb/1101/1101_60_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="65">-->
<!-- <symbol src="assets:omdb/1101/1101_65_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="70">-->
<!-- <symbol src="assets:omdb/1101/1101_70_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="75">-->
<!-- <symbol src="assets:omdb/1101/1101_75_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="80">-->
<!-- <symbol src="assets:omdb/1101/1101_80_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="85">-->
<!-- <symbol src="assets:omdb/1101/1101_85_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="90">-->
<!-- <symbol src="assets:omdb/1101/1101_90_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="95">-->
<!-- <symbol src="assets:omdb/1101/1101_95_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="100">-->
<!-- <symbol src="assets:omdb/1101/1101_100_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="105">-->
<!-- <symbol src="assets:omdb/1101/1101_105_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="110">-->
<!-- <symbol src="assets:omdb/1101/1101_110_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="115">-->
<!-- <symbol src="assets:omdb/1101/1101_115_1.png"></symbol>-->
<!-- </m>-->
<!-- <m v="120">-->
<!-- <symbol src="assets:omdb/1101/1101_120_1.png"></symbol>-->
<!-- </m>-->
<!-- </m>-->
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
@@ -1815,36 +1656,34 @@
</m>
<!--条件点限速-->
<m v="OMDB_SPEEDLIMIT_COND">
<m k="speedFlag">
<m v="0">
<m k="speedFlag" v="0">
<!-- <symbol src="assets:omdb/round_speedlimit.svg" symbol-width="30" symbol-height="30"></symbol>-->
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4003_0.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
<m v="1">
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4003_1.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
</m>
<m k="speedFlag" v="0">
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4003_1.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
</m>
<!--可变点限速-->
<m v="OMDB_SPEEDLIMIT_VAR">
<m v="0">
<!-- <symbol src="assets:omdb/round_speedlimit.svg" symbol-width="30" symbol-height="30"></symbol>-->
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4004_0.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
</m>
<m v="1">
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
<caption k="maxSpeed" fill="#000000" priority="0" size="14" stroke="#ffffff"
stroke-width="1.0"></caption>
<symbol src="assets:omdb/icon_4004_1.png" symbol-width="46" symbol-height="46"></symbol>
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
@@ -1855,12 +1694,76 @@
<m v="OMDB_LANE_LINK_LG">
<line stroke="#ecf0f1" width="0.1" dasharray="35,35"/>
</m>
<!-- 道路边界类型 -->
<m v="OMDB_RDBOUND_BOUNDARYTYPE">
<line stroke="#ffffff" width="0.1"/>
</m>
<!-- 车道边界类型 -->
<m v="OMDB_LANE_MARK_BOUNDARYTYPE">
<outline-layer id="boundary" stroke="#ffffff" width="0.2" />
<m k="boundaryType">
<!--标线-->
<m v="2">
<m k="markType">
<!--其他|实线-->
<m v="0|1">
<m k="markColor">
<m v="0|1">
<line stroke="#ffffff" use="boundaryType"/>
</m>
<m v="2">
<line stroke="#eccc68" use="boundaryType"/>
</m>
<m v="6">
<line stroke="#0000ff" use="boundaryType"/>
</m>
<m v="7">
<line stroke="#00ff00" use="boundaryType"/>
</m>
<m v="9">
<line stroke="#8e44ad" use="boundaryType"/>
</m>
</m>
</m>
<!--虚线-->
<m v="2">
<m k="markColor">
<m v="0|1">
<line stroke="#ffffff" stipple-stroke="#000000" stipple="5" use="boundaryType" dasharray="13,135"/>
</m>
<m v="2">
<line stroke="#eccc68" stipple-stroke="#ffffff" stipple="5" use="boundaryType" dasharray="13,135"/>
</m>
<m v="6">
<line stroke="#0000ff" stipple-stroke="#ffffff" stipple="5" use="boundaryType" dasharray="13,135"/>
</m>
<m v="7">
<line stroke="#00ff00" stipple-stroke="#ffffff" stipple="5" use="boundaryType" dasharray="13,135"/>
</m>
<m v="9">
<line stroke="#8e44ad" stipple-stroke="#ffffff" stipple="5" use="boundaryType" dasharray="13,135"/>
</m>
</m>
</m>
<!--导流区边线-->
<m v="4">
<line outline="boundary" stroke="#545D6C"></line>
<lineSymbol src="assets:omdb/icon_right.png" repeat-start="0" repeat-gap="0.5"/>
</m>
<!-- &lt;!&ndash;铺设路面边缘&ndash;&gt;-->
<!-- <m v="5">-->
<!-- <line outline="#ffffff" fix="true" src="assets:omdb/icon_close.png" stroke="#ffffffff" use="boundaryType"/>-->
<!-- </m>-->
</m>
</m>
</m>
</m>
<!--道路方向-->
<m v="OMDB_LINK_DIRECT">
<m k="direct">
<m v="2">
<!-- <lineSymbol src="assets:omdb/oneway_right.svg"></lineSymbol>-->
<symbol src="assets:omdb/oneway_right.svg" repeat-start="99.9" repeat="false" ></symbol>
<lineSymbol src="assets:omdb/oneway_right.svg" ></lineSymbol>
</m>
<m v="3">
<!-- <lineSymbol src="assets:omdb/oneway_left.svg"></lineSymbol>-->
@@ -1868,5 +1771,27 @@
</m>
</m>
</m>
<!--交通灯-->
<m v="OMDB_TRAFFICLIGHT">
<symbol src="assets:omdb/icon_4022_0.png" repeat="false" symbol-width="14" symbol-height="40" rotate="false"></symbol>
</m>
<!--普通交限-->
<m v="OMDB_RESTRICTION">
<m k="angle">
<symbol src="assets:omdb/icon_4006_0.png" repeat="false" symbol-width="35" symbol-height="35" rotate="false" repeat-start="0" ></symbol>
<symbol src="assets:omdb/icon_4004_0.png" repeat="false" symbol-width="35" symbol-height="35" rotate="false" repeat-start="0" ></symbol>
<symbol src="assets:omdb/icon_4004_1.png" repeat="false" symbol-width="35" symbol-height="35" rotate="false" repeat-start="0" ></symbol>
</m>
<!-- <m k="type" v="angle">-->
<!-- <symbol src="assets:omdb/icon_arrow_right.png" repeat-start="0" repeat-gap="2000" symbol-percent="45" repeat="false" rotate="true"></symbol>-->
<!-- </m>-->
<!-- <m k="type" v="s_2_e">-->
<!-- <line stroke="#14582c" width="0.1" dasharray="1,1" repeat-gap="3" repeat-start="0"/>-->
<!-- </m>-->
</m>
<!--交通灯-->
<m v="OMDB_AREA">
<area stroke="#ff0000" stroke-width="2" src="assets:omdb/area_test.jpg"></area>
</m>
</m>
</rendertheme>

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

View File

@@ -0,0 +1,64 @@
package com.navinfo.collect.library.data.entity
import com.navinfo.collect.library.system.Constant
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.GeometryToolsKt
import io.realm.RealmDictionary
import io.realm.RealmObject
import io.realm.RealmSet
import io.realm.annotations.Ignore
import io.realm.annotations.PrimaryKey
import org.locationtech.jts.geom.Coordinate
import org.locationtech.jts.geom.Geometry
import org.oscim.core.MercatorProjection
import java.util.*
/**
* 渲染要素对应的实体
* */
open class ReferenceEntity() : RealmObject() {
@PrimaryKey
var id: String = UUID.randomUUID().toString() // id
var renderEntityId: String = "" // 参考的renderEntity的Id
lateinit var name: String //要素名
lateinit var table: String //要素表名
var code: Int = 0 // 要素编码
var geometry: String = "" // 要素渲染参考的geometry该数据可能会在导入预处理环节被修改原始geometry会保存在properties的geometry字段下
get() {
wkt = GeometryTools.createGeometry(field)
return field
}
set(value) {
field = value
// 根据geometry自动计算当前要素的x-tile和y-tile
GeometryToolsKt.getTileXByGeometry(value, tileX)
GeometryToolsKt.getTileYByGeometry(value, tileY)
// 根据传入的geometry文本自动转换为Geometry对象
try {
wkt = GeometryTools.createGeometry(value)
} catch (e: Exception) {
}
}
@Ignore
var wkt: Geometry? = null
get() {
if (field == null || field!!.isEmpty) {
try {
field = GeometryTools.createGeometry(geometry)
} catch (e: Exception) {
}
}
return field
}
var properties: RealmDictionary<String> = RealmDictionary()
var tileX: RealmSet<Int> = RealmSet() // x方向的tile编码
var tileY: RealmSet<Int> = RealmSet() // y方向的tile编码
constructor(name: String): this() {
this.name = name
}
}

View File

@@ -22,7 +22,7 @@ open class RenderEntity() : RealmObject() {
lateinit var name: String //要素名
lateinit var table: String //要素表名
var code: Int = 0 // 要素编码
var geometry: String = ""
var geometry: String = "" // 要素渲染参考的geometry该数据可能会在导入预处理环节被修改原始geometry会保存在properties的geometry字段下
get() {
wkt = GeometryTools.createGeometry(field)
return field

View File

@@ -800,6 +800,17 @@ public final class NIMapView extends RelativeLayout {
}
}
/**
* 设置logo显隐
*
* @param position 按钮位置
*/
public void setLogoVisable(int visable) {
if (logoImage != null) {
logoImage.setVisibility(visable);
}
}
/**
* 设置缩放按钮位置
*

View File

@@ -1,6 +1,5 @@
package com.navinfo.collect.library.map.handler
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import com.navinfo.collect.library.map.NIMapView
import org.oscim.core.BoundingBox
@@ -32,7 +31,7 @@ open class AnimationHandler(context: AppCompatActivity, mapView: NIMapView) :
* latitude longitude经纬度
**
*/
fun animationByLonLat(latitude: Double, longitude: Double, time: Long = 200) {
fun animationByLatLon(latitude: Double, longitude: Double, time: Long = 200) {
mMapView.vtmMap.animator().animateTo(time, GeoPoint(latitude, longitude))
}

View File

@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity
import com.navinfo.collect.library.map.NIMapView
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
import com.navinfo.collect.library.map.source.OMDBReferenceTileSource
import com.navinfo.collect.library.map.source.OMDBTileSource
import com.navinfo.collect.library.system.Constant
import okhttp3.Cache
@@ -45,9 +46,12 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa
* 显示待测评OMDB数据的图层
* */
private lateinit var omdbVectorTileLayer: VectorTileLayer
private lateinit var omdbReferenceTileLayer: VectorTileLayer
private lateinit var omdbLabelLayer: LabelLayer
private lateinit var omdbReferenceLabelLayer: LabelLayer
private val omdbTileSource by lazy { OMDBTileSource() }
private val omdbReferenceTileSource by lazy { OMDBReferenceTileSource() }
init {
initMap()
@@ -99,6 +103,17 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa
}
private fun initOMDBVectorTileLayer() {
// 初始化OMDB参考相关图层
omdbReferenceTileLayer = VectorTileLayer(mMapView.vtmMap, omdbReferenceTileSource)
omdbReferenceLabelLayer = LabelLayer(mMapView.vtmMap, omdbReferenceTileLayer, LabelTileLoaderHook(), Constant.OMDB_MIN_ZOOM)
if(omdbReferenceTileLayer!=null){
addLayer(omdbReferenceTileLayer,NIMapView.LAYER_GROUPS.VECTOR_TILE)
}
if(omdbReferenceLabelLayer!=null){
addLayer(omdbReferenceLabelLayer, NIMapView.LAYER_GROUPS.VECTOR_TILE)
}
// 初始化OMDB相关图层
omdbVectorTileLayer = VectorTileLayer(mMapView.vtmMap, omdbTileSource)
omdbLabelLayer = LabelLayer(mMapView.vtmMap, omdbVectorTileLayer, LabelTileLoaderHook(), Constant.OMDB_MIN_ZOOM)
if(omdbVectorTileLayer!=null){

View File

@@ -7,6 +7,7 @@ import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import com.navinfo.collect.library.R
import com.navinfo.collect.library.map.NIMapView
import com.navinfo.collect.library.map.layers.MultiLinesLayer
import com.navinfo.collect.library.map.layers.OmdbTaskLinkLayer
import com.navinfo.collect.library.utils.GeometryTools
import com.navinfo.collect.library.utils.StringUtil
@@ -62,6 +63,12 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
private val mDefaultPathLayer: PathLayer
val linksLayer by lazy {
val layer = MultiLinesLayer(mapView.vtmMap)
addLayer(layer, NIMapView.LAYER_GROUPS.VECTOR)
layer
}
val omdbTaskLinkLayer by lazy {
val omdbTaskLinkLayer = OmdbTaskLinkLayer(
mMapView.vtmMap,
@@ -375,7 +382,7 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
}
}
fun clean() {
fun clear() {
mPathLayer.clearPath()
mPathLayer.isEnabled = false
mPathLayerTemp.clearPath()
@@ -385,5 +392,7 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
mPathMakers.clear()
editIndex = -1
bDrawLine = false
omdbTaskLinkLayer.removeAll()
linksLayer.clear()
}
}

View File

@@ -0,0 +1,45 @@
package com.navinfo.collect.library.map.layers
import android.graphics.Color
import com.navinfo.collect.library.data.entity.HadLinkDvoBean
import com.navinfo.collect.library.utils.GeometryTools
import org.locationtech.jts.geom.Geometry
import org.locationtech.jts.geom.LineString
import org.oscim.core.GeoPoint
import org.oscim.layers.vector.VectorLayer
import org.oscim.layers.vector.geometries.LineDrawable
import org.oscim.layers.vector.geometries.Style
import org.oscim.map.Map
/**
* Created by xiaoxiao on 2018/3/26.
*/
class MultiLinesLayer(map: Map) : VectorLayer(map) {
private val linkList = mutableListOf<LineDrawable>()
@Synchronized
fun addLine(geometry: String, color: Int = Color.BLUE) {
try {
val style =
Style.builder().fillColor(color).fillAlpha(0.5f).strokeColor(color)
.strokeWidth(6f).fixed(true).build()
val lineDrawable =
LineDrawable(GeometryTools.createGeometry(geometry), style)
super.add(lineDrawable)
linkList.add(lineDrawable)
update()
} catch (e: Exception) {
}
}
@Synchronized
fun clear() {
for (item in linkList) {
super.remove(item)
}
linkList.clear()
update()
}
}

View File

@@ -1,170 +0,0 @@
package com.navinfo.collect.library.map.layers;
import com.navinfo.collect.library.utils.GeometryTools;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.LineString;
import org.oscim.core.GeoPoint;
import org.oscim.layers.vector.PathLayer;
import org.oscim.layers.vector.geometries.LineDrawable;
import org.oscim.layers.vector.geometries.PolygonDrawable;
import org.oscim.layers.vector.geometries.Style;
import org.oscim.map.Map;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Created by xiaoxiao on 2018/3/26.
*/
public class MultiPathLayer extends PathLayer {
private List<LineDrawable> pathDrawableList;
public MultiPathLayer(Map map, Style style) {
super(map, style);
mStyle = style;
pathDrawableList = new ArrayList<>();
}
public MultiPathLayer(Map map, Style style, String name) {
this(map, style);
}
public MultiPathLayer(Map map, int lineColor, float lineWidth, int fillColor, float fillAlpha) {
this(map, Style.builder()
.stippleColor(lineColor)
.stipple(24)
.stippleWidth(lineWidth)
.strokeWidth(lineWidth)
.strokeColor(lineColor).fillColor(fillColor).fillAlpha(fillAlpha)
.fixed(true)
.randomOffset(false)
.build());
}
public MultiPathLayer(Map map, int lineColor, int fillColor, float fillAlpha) {
this(map, lineColor, 0.5f, fillColor, fillAlpha);
}
/**
* 设置polygon的点位
*/
public void setPathList(List<List<GeoPoint>> pointListList) {
if (pointListList == null || pointListList.isEmpty()) {
return;
}
for (List<GeoPoint> pointList : pointListList) {
if (pointList == null || pointList.size() < 2) {
return;
}
synchronized (this) {
LineDrawable lineDrawable = new LineDrawable(pointList, mStyle);
add(lineDrawable);
pathDrawableList.add(lineDrawable);
}
mWorker.submit(0);
update();
}
}
/**
* 移除正在绘制的polygon的图形
*/
public void removePathDrawable(int i) {
if (pathDrawableList != null && pathDrawableList.size() > i) {
remove(pathDrawableList.get(i));
update();
}
}
public void removePathDrawable(List<GeoPoint> geoPointList) {
LineString path = GeometryTools.getLineStrinGeo(geoPointList);
removePolygonDrawable(path);
}
public void removePathDrawable(String pathStr) {
LineString path = (LineString) GeometryTools.createGeometry(pathStr);
removePolygonDrawable(path);
}
public void removePolygonDrawable(Geometry path) {
if (pathDrawableList != null && !pathDrawableList.isEmpty()) {
Iterator iterator = pathDrawableList.iterator();
while (iterator.hasNext()) {
LineDrawable lineDrawable = (LineDrawable) iterator.next();
if (GeometryTools.createGeometry(lineDrawable.getGeometry().toString()).equals(path)) {
remove(lineDrawable);
iterator.remove();
break;
}
}
mWorker.submit(0);
update();
}
}
public void addPathDrawable(List<GeoPoint> pointList) {
if (pathDrawableList != null) {
if (pointList == null || pointList.size() < 2) {
return;
}
synchronized (this) {
LineDrawable pathDrawable = new LineDrawable(pointList, mStyle);
add(pathDrawable);
pathDrawableList.add(pathDrawable);
}
mWorker.submit(0);
}
update();
}
public void addPathDrawable(LineString lineString) {
List<GeoPoint> geoPointList = GeometryTools.getGeoPoints(lineString.toString());
addPathDrawable(geoPointList);
}
public List<LineString> getAllPathList() {
if (pathDrawableList != null && !pathDrawableList.isEmpty()) {
List<LineString> pathList = new ArrayList<>();
for (LineDrawable pathDrawable : pathDrawableList) {
pathList.add((LineString) GeometryTools.createGeometry(pathDrawable.getGeometry().toString()));
}
return pathList;
}
return null;
}
public List<List<GeoPoint>> getAllPathGeoPointList() {
List<LineString> pathList = getAllPathList();
if (pathList != null) {
List<List<GeoPoint>> geopointList = new ArrayList<>();
for (LineString path : pathList) {
geopointList.add(GeometryTools.getGeoPoints(path.toString()));
}
return geopointList;
}
return null;
}
public List<LineDrawable> getPolygonDrawableList() {
return pathDrawableList;
}
public void setPolygonDrawableList(List<LineDrawable> pathDrawableList) {
this.pathDrawableList = pathDrawableList;
}
public void removeAllPathDrawable(){
if (pathDrawableList != null && !pathDrawableList.isEmpty()) {
Iterator iterator = pathDrawableList.iterator();
while (iterator.hasNext()) {
LineDrawable lineDrawable = (LineDrawable) iterator.next();
remove(lineDrawable);
iterator.remove();
}
mWorker.submit(0);
update();
}
}
}

View File

@@ -0,0 +1,71 @@
package com.navinfo.collect.library.map.source;
import android.os.Build;
import androidx.annotation.RequiresApi;
import com.navinfo.collect.library.data.entity.ReferenceEntity;
import com.navinfo.collect.library.system.Constant;
import org.oscim.layers.tile.MapTile;
import org.oscim.tiling.ITileDataSink;
import org.oscim.tiling.ITileDataSource;
import org.oscim.tiling.QueryResult;
import java.util.List;
import io.realm.Realm;
import io.realm.RealmQuery;
public class OMDBReferenceDataSource implements ITileDataSource {
private final ThreadLocal<OMDBReferenceDecoder> mThreadLocalDecoders = new ThreadLocal<OMDBReferenceDecoder>() {
@Override
protected OMDBReferenceDecoder initialValue() {
return new OMDBReferenceDecoder();
}
};
@RequiresApi(api = Build.VERSION_CODES.N)
@Override
public void query(MapTile tile, ITileDataSink mapDataSink) {
// 获取tile对应的坐标范围
if (tile.zoomLevel>=Constant.OMDB_MIN_ZOOM&&tile.zoomLevel<=Constant.OVER_ZOOM) {
int m = Constant.OVER_ZOOM-tile.zoomLevel;
int xStart = (int)tile.tileX<<m;
int xEnd = (int)((tile.tileX+1)<<m);
int yStart = (int)tile.tileY<<m;
int yEnd = (int)((tile.tileY+1)<<m);
RealmQuery<ReferenceEntity> realmQuery = Realm.getDefaultInstance().where(ReferenceEntity.class)
.rawPredicate("tileX>="+xStart+" and tileX<="+xEnd+" and tileY>="+yStart+" and tileY<="+yEnd);
// 筛选不显示的数据
if (Constant.HAD_LAYER_INVISIABLE_ARRAY!=null&&Constant.HAD_LAYER_INVISIABLE_ARRAY.length>0) {
realmQuery.beginGroup();
for (String type: Constant.HAD_LAYER_INVISIABLE_ARRAY) {
realmQuery.notEqualTo("table", type);
}
realmQuery.endGroup();
}
List<ReferenceEntity> listResult = realmQuery/*.distinct("id")*/.findAll();
if (!listResult.isEmpty()) {
mThreadLocalDecoders.get().decode(tile, mapDataSink, listResult);
}
mapDataSink.completed(QueryResult.SUCCESS);
// Log.d("RealmDBTileDataSource", "tile:"+tile.getBoundingBox().toString());
} else {
mapDataSink.completed(QueryResult.SUCCESS);
}
}
@Override
public void dispose() {
}
@Override
public void cancel() {
if (Realm.getDefaultInstance().isInTransaction()) {
Realm.getDefaultInstance().cancelTransaction();
}
}
}

Some files were not shown because too many files have changed in this diff Show More