Compare commits
47 Commits
vtm-lib
...
23eaaf5aec
| Author | SHA1 | Date | |
|---|---|---|---|
| 23eaaf5aec | |||
| 79659e78fb | |||
| 02a65100c8 | |||
|
|
c6bf940dc4 | ||
|
|
e4f28405dc | ||
|
|
ebc4ddf5a9 | ||
|
|
c643f2e08d | ||
| 3d4b9ce78d | |||
|
|
d68e7bd768 | ||
|
|
5f953aa816 | ||
| c237ccb928 | |||
| 6a77e69ed7 | |||
|
|
6cc0a20aa6 | ||
|
|
02cf95b83d | ||
|
|
b8015a8b20 | ||
|
|
7a7eb61401 | ||
|
|
7fb8af31b5 | ||
|
|
e9735ee4d8 | ||
|
|
8d6bb8c6e8 | ||
|
|
5ff8509c95 | ||
|
|
75a6d56471 | ||
|
|
591b9cd579 | ||
| c2416ab709 | |||
| 61165ff9f0 | |||
| 90897174ac | |||
|
|
d5d251c85e | ||
|
|
dae344afc2 | ||
|
|
64eb25d5d4 | ||
|
|
8988661bed | ||
| f2891d6d2f | |||
|
|
c94eb5654d | ||
|
|
10ec7a1e04 | ||
|
|
f99517b386 | ||
| 549031e8a8 | |||
| 22f52429f4 | |||
|
|
59bc0f544b | ||
|
|
46268b3549 | ||
|
|
d1aab7aabb | ||
|
|
3c0fe6b1b1 | ||
|
|
b6bbcad634 | ||
|
|
e86b0696b6 | ||
|
|
6af2479dbd | ||
|
|
24f58b7872 | ||
|
|
2807b2f689 | ||
|
|
c42045ba45 | ||
|
|
4ec107b359 | ||
|
|
e6c2c3f76d |
4
.gitmodules
vendored
@@ -1,3 +1,5 @@
|
|||||||
[submodule "vtm"]
|
[submodule "vtm"]
|
||||||
path = vtm
|
path = vtm
|
||||||
url = git@github.com:mapsforge/vtm.git
|
url = git@github.com:xiaoyan159/vtm.git
|
||||||
|
branch = master
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,19 @@
|
|||||||
"code": 2010,
|
"code": 2010,
|
||||||
"name": "道路方向"
|
"name": "道路方向"
|
||||||
},
|
},
|
||||||
|
"2013": {
|
||||||
|
"table": "OMDB_LANE_MARK_BOUNDARYTYPE",
|
||||||
|
"code": 2013,
|
||||||
|
"name": "车道边界类型",
|
||||||
|
"transformer": [
|
||||||
|
{
|
||||||
|
"k": "geometry",
|
||||||
|
"v": "~",
|
||||||
|
"klib": "geometry",
|
||||||
|
"vlib": "unpackingLaneBoundary()"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"2019": {
|
"2019": {
|
||||||
"table": "OMDB_LINK_SPEEDLIMIT",
|
"table": "OMDB_LINK_SPEEDLIMIT",
|
||||||
"code": 2019,
|
"code": 2019,
|
||||||
@@ -55,6 +68,11 @@
|
|||||||
"code": 2041,
|
"code": 2041,
|
||||||
"name": "车道数"
|
"name": "车道数"
|
||||||
},
|
},
|
||||||
|
"2083":{
|
||||||
|
"table": "OMDB_RDBOUND_BOUNDARYTYPE",
|
||||||
|
"code": 2083,
|
||||||
|
"name": "道路边界类型"
|
||||||
|
},
|
||||||
"2201":{
|
"2201":{
|
||||||
"table": "OMDB_BRIDGE",
|
"table": "OMDB_BRIDGE",
|
||||||
"code": 2201,
|
"code": 2201,
|
||||||
@@ -131,7 +149,7 @@
|
|||||||
"k": "geometry",
|
"k": "geometry",
|
||||||
"v": "~",
|
"v": "~",
|
||||||
"klib": "geometry",
|
"klib": "geometry",
|
||||||
"vlib": "translateRight()"
|
"vlib": "generateRestrictionRerference()"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -152,6 +170,11 @@
|
|||||||
"table": "OMDB_LANE_LINK_LG",
|
"table": "OMDB_LANE_LINK_LG",
|
||||||
"code": 5001,
|
"code": 5001,
|
||||||
"name": "车道中心线"
|
"name": "车道中心线"
|
||||||
|
},
|
||||||
|
"5002":{
|
||||||
|
"table": "OMDB_AREA",
|
||||||
|
"code": 5002,
|
||||||
|
"name": "面测试"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,7 +12,7 @@ data class EvaluationInfo(
|
|||||||
val linkPid: String = "",//Link号
|
val linkPid: String = "",//Link号
|
||||||
|
|
||||||
@SerializedName("linkStatus")
|
@SerializedName("linkStatus")
|
||||||
val linkStatus: String = "",//Link状态
|
val linkStatus: Int = 0,//Link状态
|
||||||
|
|
||||||
@SerializedName("markId")
|
@SerializedName("markId")
|
||||||
val markId: String = "",//Link状态
|
val markId: String = "",//Link状态
|
||||||
@@ -27,7 +27,7 @@ data class EvaluationInfo(
|
|||||||
val featureName: String = "",//问题类型
|
val featureName: String = "",//问题类型
|
||||||
|
|
||||||
@SerializedName("problemType")
|
@SerializedName("problemType")
|
||||||
val problemType: String = "",//问题现象
|
val problemType: String = "",//问题现象 0错误 1多余 2遗漏 服务字段定义为Integer,使用包装类,对应无值情况为空
|
||||||
|
|
||||||
@SerializedName("problemPhenomenon")
|
@SerializedName("problemPhenomenon")
|
||||||
val problemPhenomenon: String = "",//问题现象
|
val problemPhenomenon: String = "",//问题现象
|
||||||
@@ -48,6 +48,24 @@ data class EvaluationInfo(
|
|||||||
val evaluationDate: String = "",//测评日期(yyyy-mm-dd)
|
val evaluationDate: String = "",//测评日期(yyyy-mm-dd)
|
||||||
|
|
||||||
@SerializedName("evaluationWay")
|
@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
|
) : Parcelable
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.navinfo.omqs.bean
|
package com.navinfo.omqs.bean
|
||||||
|
|
||||||
data class LoginUserBean(
|
data class LoginUserBean(
|
||||||
var username: String = "",
|
var userCode: String = "",
|
||||||
var password: String = ""
|
var passWord: String = ""
|
||||||
)
|
)
|
||||||
@@ -9,7 +9,7 @@ data class SignBean(
|
|||||||
var iconId: Int = 0,
|
var iconId: Int = 0,
|
||||||
//定位点到目标距离
|
//定位点到目标距离
|
||||||
val distance: Int = 0,
|
val distance: Int = 0,
|
||||||
//图表中的问题
|
//左上图标中的文字
|
||||||
val iconText: String = "",
|
val iconText: String = "",
|
||||||
//绑定的要素id
|
//绑定的要素id
|
||||||
val elementId: String = "",
|
val elementId: String = "",
|
||||||
@@ -20,7 +20,11 @@ data class SignBean(
|
|||||||
//名称
|
//名称
|
||||||
val name: String,
|
val name: String,
|
||||||
//底部右侧文字
|
//底部右侧文字
|
||||||
val bottomRightText: String,
|
val bottomRightText: String = "",
|
||||||
//要素code类型
|
//要素code类型
|
||||||
val elementCode: Int
|
val elementCode: Int,
|
||||||
|
//需要展示更多的内容
|
||||||
|
val moreText: String = "",
|
||||||
|
//左上角信息
|
||||||
|
val topRightText: String = ""
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
8
app/src/main/java/com/navinfo/omqs/bean/SysUserBean.kt
Normal 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,
|
||||||
|
)
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
package com.navinfo.omqs.db
|
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.data.entity.RenderEntity
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
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.algorithm.Angle
|
||||||
import org.locationtech.jts.geom.Coordinate
|
import org.locationtech.jts.geom.Coordinate
|
||||||
import org.locationtech.jts.geom.Geometry
|
import org.locationtech.jts.geom.Geometry
|
||||||
|
import org.oscim.core.GeoPoint
|
||||||
|
|
||||||
|
|
||||||
class ImportPreProcess {
|
class ImportPreProcess {
|
||||||
@@ -37,8 +42,8 @@ class ImportPreProcess {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 计算偏移距离
|
// 计算偏移距离
|
||||||
val dx: Double = GeometryTools.convertDistanceToDegree(5.0, geometry?.coordinate?.y!!) * Math.cos(radian)
|
val dx: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.cos(radian)
|
||||||
val dy: Double = GeometryTools.convertDistanceToDegree(5.0, geometry?.coordinate?.y!!) * Math.sin(radian)
|
val dy: Double = GeometryTools.convertDistanceToDegree(3.0, geometry?.coordinate?.y!!) * Math.sin(radian)
|
||||||
|
|
||||||
// 计算偏移后的点
|
// 计算偏移后的点
|
||||||
val coord =
|
val coord =
|
||||||
@@ -50,6 +55,45 @@ class ImportPreProcess {
|
|||||||
return renderEntity
|
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 {
|
fun addAngleFromGeometry(renderEntity: RenderEntity): String {
|
||||||
if (!renderEntity.properties.containsKey("angle")) {
|
if (!renderEntity.properties.containsKey("angle")) {
|
||||||
if (renderEntity.wkt!=null) {
|
if (renderEntity.wkt!=null) {
|
||||||
@@ -70,4 +114,80 @@ class ImportPreProcess {
|
|||||||
}
|
}
|
||||||
return "0"
|
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)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,6 @@ class RealmOperateHelper() {
|
|||||||
sort: Boolean = true
|
sort: Boolean = true
|
||||||
): MutableList<RenderEntity> {
|
): MutableList<RenderEntity> {
|
||||||
val result = mutableListOf<RenderEntity>()
|
val result = mutableListOf<RenderEntity>()
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val polygon = getPolygonFromPoint(
|
val polygon = getPolygonFromPoint(
|
||||||
GeometryTools.createPoint(point.longitude, point.latitude),
|
GeometryTools.createPoint(point.longitude, point.latitude),
|
||||||
buffer,
|
buffer,
|
||||||
@@ -82,8 +81,6 @@ class RealmOperateHelper() {
|
|||||||
result.addAll(it)
|
result.addAll(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +160,6 @@ class RealmOperateHelper() {
|
|||||||
* */
|
* */
|
||||||
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
|
suspend fun queryLinkByLinkPid(linkPid: String): MutableList<RenderEntity> {
|
||||||
val result = mutableListOf<RenderEntity>()
|
val result = mutableListOf<RenderEntity>()
|
||||||
withContext(Dispatchers.IO) {
|
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
val realmList = realm.where(RenderEntity::class.java)
|
val realmList = realm.where(RenderEntity::class.java)
|
||||||
.notEqualTo("table", "OMDB_RD_LINK")
|
.notEqualTo("table", "OMDB_RD_LINK")
|
||||||
@@ -171,7 +167,6 @@ class RealmOperateHelper() {
|
|||||||
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
.equalTo("properties['${LinkTable.linkPid}']", linkPid)
|
||||||
.findAll()
|
.findAll()
|
||||||
result.addAll(realm.copyFromRealm(realmList))
|
result.addAll(realm.copyFromRealm(realmList))
|
||||||
}
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.navinfo.omqs.http
|
||||||
|
|
||||||
|
class DefaultUserResponse<T> {
|
||||||
|
var success: Boolean = false
|
||||||
|
var msg: String = ""
|
||||||
|
var obj: T? = null
|
||||||
|
}
|
||||||
@@ -31,8 +31,8 @@ package com.navinfo.omqs.http
|
|||||||
sealed class NetResult<out R> {
|
sealed class NetResult<out R> {
|
||||||
|
|
||||||
data class Success<out T>(val data: T?) : NetResult<T>()
|
data class Success<out T>(val data: T?) : NetResult<T>()
|
||||||
data class Failure(val code: Int, val msg: String) : NetResult<Nothing>()
|
data class Failure<T>(val code: Int, val msg: String) : NetResult<Nothing>()
|
||||||
data class Error(val exception: Exception) : NetResult<Nothing>()
|
data class Error<T>(val exception: Exception) : NetResult<Nothing>()
|
||||||
object Loading : NetResult<Nothing>()
|
object Loading : NetResult<Nothing>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,8 +42,8 @@ sealed class NetResult<out R> {
|
|||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
is Success<*> -> "网络访问成功,返回正确结果Success[data=$data]"
|
is Success<*> -> "网络访问成功,返回正确结果Success[data=$data]"
|
||||||
is Failure -> "网络访问成功,返回错误结果Failure[$msg]"
|
is Failure<*> -> "网络访问成功,返回错误结果Failure[$msg]"
|
||||||
is Error -> "网络访问出错 Error[exception=$exception]"
|
is Error<*> -> "网络访问出错 Error[exception=$exception]"
|
||||||
is Loading -> "网络访问中 Loading"
|
is Loading -> "网络访问中 Loading"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.navinfo.omqs.http
|
|||||||
|
|
||||||
import com.navinfo.omqs.bean.OfflineMapCityBean
|
import com.navinfo.omqs.bean.OfflineMapCityBean
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
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 getTaskList(evaluatorNo:String): NetResult<DefaultTaskResponse<List<TaskBean>>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录接口
|
||||||
|
*/
|
||||||
|
suspend fun loginUser(loginUserBean: LoginUserBean): NetResult<DefaultUserResponse<SysUserBean>>
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,12 @@ package com.navinfo.omqs.http
|
|||||||
|
|
||||||
import com.navinfo.omqs.bean.OfflineMapCityBean
|
import com.navinfo.omqs.bean.OfflineMapCityBean
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
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.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import retrofit2.Response
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -24,13 +28,13 @@ class NetworkServiceImpl @Inject constructor(
|
|||||||
if (result.code() == 200) {
|
if (result.code() == 200) {
|
||||||
NetResult.Success(result.body())
|
NetResult.Success(result.body())
|
||||||
} else {
|
} else {
|
||||||
NetResult.Failure(result.code(), result.message())
|
NetResult.Failure<Any>(result.code(), result.message())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NetResult.Failure(result.code(), result.message())
|
NetResult.Failure<Any>(result.code(), result.message())
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
NetResult.Error(e)
|
NetResult.Error<Any>(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,13 +47,32 @@ class NetworkServiceImpl @Inject constructor(
|
|||||||
if (result.code() == 200) {
|
if (result.code() == 200) {
|
||||||
NetResult.Success(result.body())
|
NetResult.Success(result.body())
|
||||||
} else {
|
} else {
|
||||||
NetResult.Failure(result.code(), result.message())
|
NetResult.Failure<Any>(result.code(), result.message())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NetResult.Failure(result.code(), result.message())
|
NetResult.Failure<Any>(result.code(), result.message())
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,8 @@ package com.navinfo.omqs.http
|
|||||||
import com.navinfo.omqs.bean.EvaluationInfo
|
import com.navinfo.omqs.bean.EvaluationInfo
|
||||||
import com.navinfo.omqs.bean.OfflineMapCityBean
|
import com.navinfo.omqs.bean.OfflineMapCityBean
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
import com.navinfo.collect.library.data.entity.TaskBean
|
||||||
|
import com.navinfo.omqs.bean.LoginUserBean
|
||||||
|
import com.navinfo.omqs.bean.SysUserBean
|
||||||
import okhttp3.ResponseBody
|
import okhttp3.ResponseBody
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
import retrofit2.http.*
|
import retrofit2.http.*
|
||||||
@@ -40,6 +42,13 @@ interface RetrofitNetworkServiceAPI {
|
|||||||
@GET("/drdc/MapDownload/maplist")
|
@GET("/drdc/MapDownload/maplist")
|
||||||
suspend fun retrofitGetOfflineMapCityList(): Response<List<OfflineMapCityBean>>
|
suspend fun retrofitGetOfflineMapCityList(): Response<List<OfflineMapCityBean>>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录接口
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type: application/json")
|
||||||
|
@POST("/devcp/loginUser")
|
||||||
|
suspend fun retrofitLoginUser(@Body loginUserBean: LoginUserBean): Response<DefaultUserResponse<SysUserBean>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 下载文件
|
* 下载文件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -167,8 +167,12 @@ class TaskDownloadScope(
|
|||||||
|
|
||||||
val fileTemp =
|
val fileTemp =
|
||||||
File("${Constant.DOWNLOAD_PATH}${taskBean.evaluationTaskName}_${taskBean.dataVersion}.zip")
|
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) {
|
if (fileTemp.length() > 0 && taskBean.fileSize > 0 && fileTemp.length() == taskBean.fileSize) {
|
||||||
importData(fileTemp)
|
importData(fileTemp)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -121,26 +121,71 @@ class TaskUploadScope(
|
|||||||
if (objects != null&&objects.size>0) {
|
if (objects != null&&objects.size>0) {
|
||||||
val copyList = realm.copyFromRealm(objects)
|
val copyList = realm.copyFromRealm(objects)
|
||||||
copyList.forEach {
|
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(
|
val evaluationInfo = EvaluationInfo(
|
||||||
evaluationTaskId = taskBean.id.toString(),
|
evaluationTaskId = taskBean.id.toString(),
|
||||||
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
|
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||||
linkStatus = "已测评",
|
linkStatus = 1,
|
||||||
markId = hadLinkDvoBean.mesh,//"20065597"
|
markId = hadLinkDvoBean.mesh,//"20065597"
|
||||||
trackPhotoNumber = "",
|
trackPhotoNumber = "",
|
||||||
markGeometry = it.geometry,
|
markGeometry = it.geometry,
|
||||||
featureName = it.classType,
|
featureName = it.classType,
|
||||||
problemType = it.problemType,
|
problemType = problemType,
|
||||||
problemPhenomenon = it.phenomenon,
|
problemPhenomenon = it.phenomenon,
|
||||||
problemDesc = it.description,
|
problemDesc = it.description,
|
||||||
problemLink = it.problemLink,
|
problemLink = it.problemLink,
|
||||||
problemReason = it.cause,
|
problemReason = it.cause,
|
||||||
evaluatorName = it.checkUserId,
|
evaluatorName = it.checkUserId,
|
||||||
evaluationDate = it.checkTime,
|
evaluationDate = it.checkTime,
|
||||||
evaluationWay = "现场测评"
|
evaluationWay = evaluationWay,
|
||||||
|
roadClassfcation = "",
|
||||||
|
roadFunctionGrade = "",
|
||||||
|
noEvaluationreason = "",
|
||||||
|
linkLength = 0.0,
|
||||||
|
dataLevel = "",
|
||||||
|
linstringLength = 0.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
bodyList.add(evaluationInfo)
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.navinfo.omqs.ui.activity
|
package com.navinfo.omqs.ui.activity
|
||||||
|
|
||||||
import android.app.Dialog
|
|
||||||
import android.content.pm.ActivityInfo
|
import android.content.pm.ActivityInfo
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.PersistableBundle
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.google.android.material.R
|
import com.google.android.material.R
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import androidx.lifecycle.viewModelScope
|
|||||||
import com.blankj.utilcode.util.ResourceUtils
|
import com.blankj.utilcode.util.ResourceUtils
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.bean.LoginUserBean
|
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.db.RoomAppDatabase
|
||||||
|
import com.navinfo.omqs.http.DefaultUserResponse
|
||||||
import com.navinfo.omqs.http.NetResult
|
import com.navinfo.omqs.http.NetResult
|
||||||
import com.navinfo.omqs.http.NetworkService
|
import com.navinfo.omqs.http.NetworkService
|
||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
@@ -19,6 +20,7 @@ import dagger.hilt.android.lifecycle.HiltViewModel
|
|||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import io.realm.RealmConfiguration
|
import io.realm.RealmConfiguration
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import retrofit2.Response
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
@@ -74,7 +76,7 @@ class LoginViewModel @Inject constructor(
|
|||||||
var jobLogin: Job? = null;
|
var jobLogin: Job? = null;
|
||||||
|
|
||||||
init {
|
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) {
|
fun onClick(view: View) {
|
||||||
loginUser.value!!.username = "admin2"
|
loginUser.value!!.userCode = "admin2"
|
||||||
loginUser.value = loginUser.value
|
loginUser.value = loginUser.value
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,12 +113,61 @@ class LoginViewModel @Inject constructor(
|
|||||||
// withContext(Dispatchers.IO) {
|
// withContext(Dispatchers.IO) {
|
||||||
//网络访问
|
//网络访问
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_LOADING)
|
loginStatus.postValue(LoginStatus.LOGIN_STATUS_NET_LOADING)
|
||||||
//假装网络访问,等待2秒
|
var userCode = "99999";
|
||||||
delay(1000)
|
//登录访问
|
||||||
|
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 {
|
try {
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_INIT)
|
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_INIT)
|
||||||
createUserFolder(context, "02911")
|
createUserFolder(context, userCode)
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
|
loginStatus.postValue(LoginStatus.LOGIN_STATUS_FOLDER_FAILURE)
|
||||||
}
|
}
|
||||||
@@ -134,13 +185,13 @@ class LoginViewModel @Inject constructor(
|
|||||||
roomAppDatabase.getOfflineMapDao().insertOrUpdate(result.data)
|
roomAppDatabase.getOfflineMapDao().insertOrUpdate(result.data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is NetResult.Error -> {
|
is NetResult.Error<*> -> {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is NetResult.Failure -> {
|
is NetResult.Failure<*> -> {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
@@ -177,7 +228,7 @@ class LoginViewModel @Inject constructor(
|
|||||||
.name("OMQS.realm")
|
.name("OMQS.realm")
|
||||||
.encryptionKey(password)
|
.encryptionKey(password)
|
||||||
// .modules(Realm.getDefaultModule(), MyRealmModule())
|
// .modules(Realm.getDefaultModule(), MyRealmModule())
|
||||||
.schemaVersion(1)
|
.schemaVersion(2)
|
||||||
.build()
|
.build()
|
||||||
Realm.setDefaultConfiguration(config)
|
Realm.setDefaultConfiguration(config)
|
||||||
// 拷贝配置文件到用户目录下
|
// 拷贝配置文件到用户目录下
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
package com.navinfo.omqs.ui.activity.map
|
package com.navinfo.omqs.ui.activity.map
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.speech.tts.TextToSpeech
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.widget.EditText
|
||||||
|
import android.widget.Toast
|
||||||
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import androidx.navigation.NavController
|
||||||
|
import androidx.navigation.NavDestination
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.blankj.utilcode.util.SPStaticUtils
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.gson.Gson
|
|
||||||
import com.google.gson.reflect.TypeToken
|
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
@@ -24,12 +30,14 @@ import com.navinfo.omqs.databinding.ActivityMainBinding
|
|||||||
import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager
|
import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager
|
||||||
import com.navinfo.omqs.tools.LayerConfigUtils
|
import com.navinfo.omqs.tools.LayerConfigUtils
|
||||||
import com.navinfo.omqs.ui.activity.BaseActivity
|
import com.navinfo.omqs.ui.activity.BaseActivity
|
||||||
import com.navinfo.omqs.ui.widget.RecycleViewDivider
|
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
||||||
import com.navinfo.omqs.util.FlowEventBus
|
import com.navinfo.omqs.util.FlowEventBus
|
||||||
|
import com.navinfo.omqs.util.SpeakMode
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import com.navinfo.omqs.ui.widget.RecyclerViewSpacesItemDecoration
|
|
||||||
import org.videolan.vlc.Util
|
import org.videolan.vlc.Util
|
||||||
|
import java.math.BigDecimal
|
||||||
|
import java.math.RoundingMode
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -43,6 +51,19 @@ class MainActivity : BaseActivity() {
|
|||||||
|
|
||||||
var switchFragment = false
|
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
|
@Inject
|
||||||
lateinit var mapController: NIMapController
|
lateinit var mapController: NIMapController
|
||||||
@@ -58,11 +79,12 @@ class MainActivity : BaseActivity() {
|
|||||||
* 提前显示要素看板
|
* 提前显示要素看板
|
||||||
*/
|
*/
|
||||||
private val signAdapter by lazy {
|
private val signAdapter by lazy {
|
||||||
SignAdapter { position, signBean ->
|
SignAdapter { position, autoSave,signBean ->
|
||||||
rightController.currentDestination?.let {
|
rightController.currentDestination?.let {
|
||||||
if (it.id == R.id.RightEmptyFragment) {
|
if (it.id == R.id.RightEmptyFragment) {
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
bundle.putParcelable("SignBean", signBean)
|
bundle.putParcelable("SignBean", signBean)
|
||||||
|
bundle.putBoolean("AutoSave", autoSave)
|
||||||
rightController.navigate(R.id.EvaluationResultFragment, bundle)
|
rightController.navigate(R.id.EvaluationResultFragment, bundle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,6 +110,13 @@ class MainActivity : BaseActivity() {
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
WindowCompat.setDecorFitsSystemWindows(window, false)
|
WindowCompat.setDecorFitsSystemWindows(window, false)
|
||||||
super.onCreate(savedInstanceState)
|
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)
|
binding = DataBindingUtil.setContentView(this, R.layout.activity_main)
|
||||||
|
|
||||||
//初始化地图
|
//初始化地图
|
||||||
@@ -98,6 +127,7 @@ class MainActivity : BaseActivity() {
|
|||||||
Constant.MAP_PATH,
|
Constant.MAP_PATH,
|
||||||
Constant.USER_DATA_PATH + "/trace.sqlite"
|
Constant.USER_DATA_PATH + "/trace.sqlite"
|
||||||
)
|
)
|
||||||
|
viewModel.speakMode = SpeakMode(this)
|
||||||
// 在mapController初始化前获取当前OMDB图层显隐
|
// 在mapController初始化前获取当前OMDB图层显隐
|
||||||
viewModel.refreshOMDBLayer(LayerConfigUtils.getLayerConfigList())
|
viewModel.refreshOMDBLayer(LayerConfigUtils.getLayerConfigList())
|
||||||
mapController.mMapView.vtmMap.viewport().maxZoomLevel = 25
|
mapController.mMapView.vtmMap.viewport().maxZoomLevel = 25
|
||||||
@@ -111,7 +141,6 @@ class MainActivity : BaseActivity() {
|
|||||||
binding.mainActivityVoice.setOnTouchListener(object : View.OnTouchListener {
|
binding.mainActivityVoice.setOnTouchListener(object : View.OnTouchListener {
|
||||||
@RequiresApi(Build.VERSION_CODES.Q)
|
@RequiresApi(Build.VERSION_CODES.Q)
|
||||||
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
|
override fun onTouch(v: View?, event: MotionEvent?): Boolean {
|
||||||
Log.e("qj", event?.action.toString())
|
|
||||||
when (event?.action) {
|
when (event?.action) {
|
||||||
MotionEvent.ACTION_DOWN -> {
|
MotionEvent.ACTION_DOWN -> {
|
||||||
voiceOnTouchStart()//Do Something
|
voiceOnTouchStart()//Do Something
|
||||||
@@ -122,14 +151,13 @@ class MainActivity : BaseActivity() {
|
|||||||
Log.e("qj", "voiceOnTouchStop")
|
Log.e("qj", "voiceOnTouchStop")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return v?.onTouchEvent(event) ?: true
|
return v?.onTouchEvent(event) ?: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
viewModel.liveDataQsRecordIdList.observe(this) {
|
viewModel.liveDataQsRecordIdList.observe(this) {
|
||||||
//处理页面跳转
|
//处理页面跳转
|
||||||
viewModel.navigation(this, it)
|
viewModel.navigationRightFragment(this, it)
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.liveDataMenuState.observe(this) {
|
viewModel.liveDataMenuState.observe(this) {
|
||||||
@@ -139,13 +167,11 @@ class MainActivity : BaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
binding.mainActivityMenuGroup.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//道路属性面板
|
//道路属性面板
|
||||||
binding.mainActivityTopSignRecyclerview.layoutManager = LinearLayoutManager(
|
binding.mainActivityTopSignRecyclerview.layoutManager = LinearLayoutManager(
|
||||||
this,
|
this, RecyclerView.HORIZONTAL, false
|
||||||
RecyclerView.HORIZONTAL, false
|
|
||||||
)
|
)
|
||||||
// binding.mainActivityTopSignRecyclerview.addItemDecoration(
|
// binding.mainActivityTopSignRecyclerview.addItemDecoration(
|
||||||
// RecycleViewDivider(this, LinearLayoutManager.HORIZONTAL)
|
// RecycleViewDivider(this, LinearLayoutManager.HORIZONTAL)
|
||||||
@@ -164,31 +190,82 @@ class MainActivity : BaseActivity() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
//监听要素面板变化
|
||||||
viewModel.liveDataSignList.observe(this) {
|
viewModel.liveDataSignList.observe(this) {
|
||||||
signAdapter.refreshData(it)
|
signAdapter.refreshData(it)
|
||||||
}
|
}
|
||||||
|
//监听道路信息变化
|
||||||
viewModel.liveDataTopSignList.observe(this) {
|
viewModel.liveDataTopSignList.observe(this) {
|
||||||
topSignAdapter.refreshData(it)
|
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 {
|
lifecycleScope.launch {
|
||||||
// 初始化地图图层控制接收器
|
// 初始化地图图层控制接收器
|
||||||
FlowEventBus.subscribe<List<ImportConfig>>(
|
FlowEventBus.subscribe<List<ImportConfig>>(
|
||||||
lifecycle,
|
lifecycle, Constant.EVENT_LAYER_MANAGER_CHANGE
|
||||||
Constant.EVENT_LAYER_MANAGER_CHANGE
|
|
||||||
) {
|
) {
|
||||||
viewModel.refreshOMDBLayer(it)
|
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() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
|
||||||
//开启定位
|
//开启定位
|
||||||
mapController.locationLayerHandler.startLocation()
|
mapController.locationLayerHandler.startLocation()
|
||||||
|
mapController.mMapView.setLogoVisable(View.GONE)
|
||||||
//启动轨迹存储
|
//启动轨迹存储
|
||||||
// viewModel.startSaveTraceThread(this)
|
// viewModel.startSaveTraceThread(this)
|
||||||
|
|
||||||
@@ -201,6 +278,7 @@ class MainActivity : BaseActivity() {
|
|||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
|
viewModel.speakMode?.shutdown()
|
||||||
mapController.mMapView.onDestroy()
|
mapController.mMapView.onDestroy()
|
||||||
mapController.locationLayerHandler.stopLocation()
|
mapController.locationLayerHandler.stopLocation()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.navinfo.omqs.ui.activity.map
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.graphics.Color
|
|
||||||
import android.graphics.drawable.AnimationDrawable
|
import android.graphics.drawable.AnimationDrawable
|
||||||
import android.graphics.drawable.BitmapDrawable
|
import android.graphics.drawable.BitmapDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -16,6 +15,7 @@ import android.view.ViewGroup
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import android.widget.PopupWindow
|
import android.widget.PopupWindow
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.constraintlayout.widget.Group
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
@@ -23,6 +23,7 @@ import androidx.navigation.findNavController
|
|||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
import com.navinfo.collect.library.data.dao.impl.TraceDataBase
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
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.NIMapController
|
||||||
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
import com.navinfo.collect.library.map.handler.OnQsRecordItemClickListener
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
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.R
|
||||||
import com.navinfo.omqs.bean.ImportConfig
|
import com.navinfo.omqs.bean.ImportConfig
|
||||||
import com.navinfo.omqs.bean.SignBean
|
import com.navinfo.omqs.bean.SignBean
|
||||||
import com.navinfo.collect.library.data.entity.TaskBean
|
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.ui.dialog.CommonDialog
|
import com.navinfo.omqs.ui.dialog.CommonDialog
|
||||||
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
||||||
@@ -45,7 +45,10 @@ import io.realm.RealmSet
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
|
import org.oscim.core.MapPosition
|
||||||
|
import org.oscim.map.Map
|
||||||
import org.videolan.libvlc.LibVlcUtil
|
import org.videolan.libvlc.LibVlcUtil
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@@ -59,7 +62,7 @@ import javax.inject.Inject
|
|||||||
class MainViewModel @Inject constructor(
|
class MainViewModel @Inject constructor(
|
||||||
private val mapController: NIMapController,
|
private val mapController: NIMapController,
|
||||||
private val traceDataBase: TraceDataBase,
|
private val traceDataBase: TraceDataBase,
|
||||||
private val realmOperateHelper: RealmOperateHelper
|
private val realmOperateHelper: RealmOperateHelper,
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
private var mCameraDialog: CommonDialog? = null
|
private var mCameraDialog: CommonDialog? = null
|
||||||
@@ -78,22 +81,35 @@ class MainViewModel @Inject constructor(
|
|||||||
//语音窗体
|
//语音窗体
|
||||||
private var pop: PopupWindow? = null
|
private var pop: PopupWindow? = null
|
||||||
|
|
||||||
private var mSpeakMode: SpeakMode? = null
|
var speakMode: SpeakMode? = null
|
||||||
|
|
||||||
//录音图标
|
//录音图标
|
||||||
var volume: ImageView? = null
|
var volume: ImageView? = null
|
||||||
|
|
||||||
var mSoundMeter: SoundMeter? = null
|
var mSoundMeter: SoundMeter? = null
|
||||||
|
|
||||||
var menuState: Boolean = false
|
var menuState: Boolean = false
|
||||||
|
|
||||||
val liveDataMenuState = MutableLiveData<Boolean>()
|
val liveDataMenuState = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val liveDataCenterPoint = MutableLiveData<MapPosition>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是不是线选择模式
|
* 是不是线选择模式
|
||||||
*/
|
*/
|
||||||
private var bSelectRoad = false
|
private var bSelectRoad = false
|
||||||
|
|
||||||
|
private var linkIdCache = ""
|
||||||
|
|
||||||
init {
|
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 :
|
mapController.markerHandle.setOnQsRecordItemClickListener(object :
|
||||||
OnQsRecordItemClickListener {
|
OnQsRecordItemClickListener {
|
||||||
override fun onQsRecordList(list: MutableList<String>) {
|
override fun onQsRecordList(list: MutableList<String>) {
|
||||||
@@ -101,9 +117,11 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
initLocation()
|
initLocation()
|
||||||
viewModelScope.launch {
|
//处理地图点击操作
|
||||||
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
mapController.onMapClickFlow.collectLatest {
|
mapController.onMapClickFlow.collectLatest {
|
||||||
// testPoint = it
|
// testPoint = it
|
||||||
|
//线选择状态
|
||||||
if (bSelectRoad) {
|
if (bSelectRoad) {
|
||||||
captureLink(it)
|
captureLink(it)
|
||||||
}
|
}
|
||||||
@@ -131,9 +149,9 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||||
for (item in list) {
|
for (item in list) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
|
// mapController.lineHandler.omdbTaskLinkLayer.setLineColor(Color.valueOf(item.color))
|
||||||
}
|
// }
|
||||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
mapController.lineHandler.omdbTaskLinkLayer.addLineList(item.hadLinkDvoList)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,13 +213,19 @@ class MainViewModel @Inject constructor(
|
|||||||
val linkList = realmOperateHelper.queryLink(
|
val linkList = realmOperateHelper.queryLink(
|
||||||
point = point,
|
point = point,
|
||||||
)
|
)
|
||||||
|
if (linkList.isNotEmpty()) {
|
||||||
//看板数据
|
//看板数据
|
||||||
val signList = mutableListOf<SignBean>()
|
val signList = mutableListOf<SignBean>()
|
||||||
val topSignList = mutableListOf<SignBean>()
|
val topSignList = mutableListOf<SignBean>()
|
||||||
|
mapController.lineHandler.linksLayer.clear()
|
||||||
|
|
||||||
if (linkList.isNotEmpty()) {
|
|
||||||
val link = linkList[0]
|
val link = linkList[0]
|
||||||
|
|
||||||
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||||
|
|
||||||
|
if (linkIdCache != linkId) {
|
||||||
|
|
||||||
|
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
|
||||||
mapController.lineHandler.showLine(link.geometry)
|
mapController.lineHandler.showLine(link.geometry)
|
||||||
linkId?.let {
|
linkId?.let {
|
||||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||||
@@ -223,21 +247,55 @@ class MainViewModel @Inject constructor(
|
|||||||
)
|
)
|
||||||
|
|
||||||
when (element.code) {
|
when (element.code) {
|
||||||
2041, 2008, 2010 -> topSignList.add(
|
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||||
signBean
|
signBean
|
||||||
)
|
)
|
||||||
else -> signList.add(
|
4002, 4003, 4004, 4022 -> signList.add(
|
||||||
signBean
|
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 })
|
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
|
||||||
liveDataSignList.postValue(signList.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}条")
|
Log.e("jingo", "自动捕捉数据 共${signList.size}条")
|
||||||
|
} else {
|
||||||
|
mapController.lineHandler.removeLine()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,10 +361,6 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
fun startSoundMetter(context: Context, v: View) {
|
fun startSoundMetter(context: Context, v: View) {
|
||||||
|
|
||||||
if (mSpeakMode == null) {
|
|
||||||
mSpeakMode = SpeakMode(context as Activity?)
|
|
||||||
}
|
|
||||||
|
|
||||||
//语音识别动画
|
//语音识别动画
|
||||||
if (pop == null) {
|
if (pop == null) {
|
||||||
pop = PopupWindow()
|
pop = PopupWindow()
|
||||||
@@ -340,12 +394,12 @@ class MainViewModel @Inject constructor(
|
|||||||
if (!TextUtils.isEmpty(filePath) && File(filePath).exists()) {
|
if (!TextUtils.isEmpty(filePath) && File(filePath).exists()) {
|
||||||
if (File(filePath) == null || File(filePath).length() < 1600) {
|
if (File(filePath) == null || File(filePath).length() < 1600) {
|
||||||
ToastUtils.showLong("语音时间太短,无效!")
|
ToastUtils.showLong("语音时间太短,无效!")
|
||||||
mSpeakMode!!.speakText("语音时间太短,无效")
|
speakMode?.speakText("语音时间太短,无效")
|
||||||
stopSoundMeter()
|
stopSoundMeter()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mSpeakMode!!.speakText("结束录音")
|
speakMode?.speakText("结束录音")
|
||||||
//获取右侧fragment容器
|
//获取右侧fragment容器
|
||||||
val naviController =
|
val naviController =
|
||||||
(context as Activity).findNavController(R.id.main_activity_right_fragment)
|
(context as Activity).findNavController(R.id.main_activity_right_fragment)
|
||||||
@@ -357,14 +411,14 @@ class MainViewModel @Inject constructor(
|
|||||||
@RequiresApi(api = Build.VERSION_CODES.Q)
|
@RequiresApi(api = Build.VERSION_CODES.Q)
|
||||||
override fun onfaild(message: String?) {
|
override fun onfaild(message: String?) {
|
||||||
ToastUtils.showLong("录制失败!")
|
ToastUtils.showLong("录制失败!")
|
||||||
mSpeakMode!!.speakText("录制失败")
|
speakMode?.speakText("录制失败")
|
||||||
stopSoundMeter()
|
stopSoundMeter()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
mSoundMeter!!.start(Constant.USER_DATA_ATTACHEMNT_PATH + name)
|
mSoundMeter!!.start(Constant.USER_DATA_ATTACHEMNT_PATH + name)
|
||||||
ToastUtils.showLong("开始录音")
|
ToastUtils.showLong("开始录音")
|
||||||
mSpeakMode!!.speakText("开始录音")
|
speakMode?.speakText("开始录音")
|
||||||
}
|
}
|
||||||
|
|
||||||
//停止语音录制
|
//停止语音录制
|
||||||
@@ -403,27 +457,11 @@ class MainViewModel @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 处理页面调转
|
* 处理页面调转
|
||||||
*/
|
*/
|
||||||
fun navigation(activity: MainActivity, list: List<String>) {
|
fun navigationRightFragment(activity: MainActivity, list: List<String>) {
|
||||||
//获取右侧fragment容器
|
//获取右侧fragment容器
|
||||||
val naviController = activity.findNavController(R.id.main_activity_right_fragment)
|
val naviController = activity.findNavController(R.id.main_activity_right_fragment)
|
||||||
|
|
||||||
naviController.currentDestination?.let { navDestination ->
|
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) {
|
when (navDestination.id) {
|
||||||
R.id.RightEmptyFragment -> {
|
R.id.RightEmptyFragment -> {
|
||||||
if (list.size == 1) {
|
if (list.size == 1) {
|
||||||
@@ -441,6 +479,8 @@ class MainViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
fun setSelectRoad(select: Boolean) {
|
fun setSelectRoad(select: Boolean) {
|
||||||
bSelectRoad = select
|
bSelectRoad = select
|
||||||
|
//去掉缓存
|
||||||
|
linkIdCache = ""
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||||
mapController.lineHandler.removeLine()
|
mapController.lineHandler.removeLine()
|
||||||
liveDataSignList.value = mutableListOf()
|
liveDataSignList.value = mutableListOf()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import com.navinfo.omqs.databinding.AdapterSignBinding
|
|||||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
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>() {
|
BaseRecyclerViewAdapter<SignBean>() {
|
||||||
override fun getItemViewRes(position: Int): Int {
|
override fun getItemViewRes(position: Int): Int {
|
||||||
return R.layout.adapter_sign
|
return R.layout.adapter_sign
|
||||||
@@ -24,12 +24,15 @@ class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null)
|
|||||||
val bd = holder.viewBinding as AdapterSignBinding
|
val bd = holder.viewBinding as AdapterSignBinding
|
||||||
val item = data[position]
|
val item = data[position]
|
||||||
if (item.iconId != 0)
|
if (item.iconId != 0)
|
||||||
bd.signMainIcon.background = holder.viewBinding.root.context.getDrawable(item.iconId)
|
bd.signMainIconBg.setImageResource(item.iconId)
|
||||||
bd.signMainIcon.text = item.iconText
|
bd.signMainIcon.text = item.iconText
|
||||||
bd.signBottomText.text = item.name
|
bd.signBottomText.text = item.name
|
||||||
|
bd.signMainFastError.setOnClickListener{
|
||||||
|
itemListener?.invoke(position, true,item)
|
||||||
|
}
|
||||||
bd.signBottomRightText.text = item.bottomRightText
|
bd.signBottomRightText.text = item.bottomRightText
|
||||||
bd.root.setOnClickListener {
|
bd.root.setOnClickListener {
|
||||||
itemListener?.invoke(position, item)
|
itemListener?.invoke(position, false,item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ class EmptyFragment : Fragment() {
|
|||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
val currentDestination = findNavController().currentDestination
|
val currentDestination = findNavController().currentDestination
|
||||||
|
//有右侧面板的时候
|
||||||
if (currentDestination?.label == "右侧空页面") {
|
if (currentDestination?.label == "右侧空页面") {
|
||||||
currentDestinationLabel = "右侧空页面"
|
currentDestinationLabel = "右侧空页面"
|
||||||
(activity as MainActivity).setRightSwitchButton(View.GONE)
|
(activity as MainActivity).setRightSwitchButton(View.GONE)
|
||||||
@@ -40,6 +41,7 @@ class EmptyFragment : Fragment() {
|
|||||||
|
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
|
//没有有右侧面板的时候
|
||||||
if (currentDestinationLabel == "右侧空页面") {
|
if (currentDestinationLabel == "右侧空页面") {
|
||||||
(activity as MainActivity).setRightSwitchButton(View.VISIBLE)
|
(activity as MainActivity).setRightSwitchButton(View.VISIBLE)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.evaluationresult
|
package com.navinfo.omqs.ui.fragment.evaluationresult
|
||||||
|
|
||||||
|
import android.app.Dialog
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
@@ -19,6 +20,7 @@ import com.navinfo.omqs.ui.fragment.BaseFragment
|
|||||||
import com.navinfo.omqs.ui.other.shareViewModels
|
import com.navinfo.omqs.ui.other.shareViewModels
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.findNavController
|
||||||
|
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||||
@@ -65,8 +67,18 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
|||||||
}
|
}
|
||||||
//返回按钮点击
|
//返回按钮点击
|
||||||
binding.evaluationBar.setOnClickListener() {
|
binding.evaluationBar.setOnClickListener() {
|
||||||
|
val mDialog = FirstDialog(context)
|
||||||
|
mDialog.setTitle("提示?")
|
||||||
|
mDialog.setMessage("是否退出,请确认!")
|
||||||
|
mDialog.setPositiveButton("确定", object : FirstDialog.OnClickListener {
|
||||||
|
override fun onClick(dialog: Dialog?, which: Int) {
|
||||||
|
mDialog.dismiss()
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
mDialog.setNegativeButton("取消", null)
|
||||||
|
mDialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
//保存事件
|
//保存事件
|
||||||
binding.evaluationBarSave.setOnClickListener() {
|
binding.evaluationBarSave.setOnClickListener() {
|
||||||
@@ -76,7 +88,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
|||||||
//删除事件
|
//删除事件
|
||||||
binding.evaluationBarDelete.setOnClickListener() {
|
binding.evaluationBarDelete.setOnClickListener() {
|
||||||
|
|
||||||
viewModel.deleteData()
|
viewModel.deleteData(requireContext())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,12 +102,18 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
|||||||
voiceOnTouchStart()//Do Something
|
voiceOnTouchStart()//Do Something
|
||||||
Log.e("qj", "voiceOnTouchStart")
|
Log.e("qj", "voiceOnTouchStart")
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionEvent.ACTION_UP -> {
|
MotionEvent.ACTION_UP -> {
|
||||||
voiceOnTouchStop()//Do Something
|
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
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -105,18 +123,26 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
|||||||
// val id = args.qsId
|
// val id = args.qsId
|
||||||
var id = ""
|
var id = ""
|
||||||
var signBean: SignBean? = null
|
var signBean: SignBean? = null
|
||||||
|
var autoSave: Boolean = false
|
||||||
var filePath: String = ""
|
var filePath: String = ""
|
||||||
arguments?.let {
|
arguments?.let {
|
||||||
id = it.getString("QsId", "")
|
id = it.getString("QsId", "")
|
||||||
filePath = it.getString("filePath", "")
|
filePath = it.getString("filePath", "")
|
||||||
try {
|
try {
|
||||||
signBean = it.getParcelable("SignBean")
|
signBean = it.getParcelable("SignBean")
|
||||||
|
autoSave = it.getBoolean("AutoSave")
|
||||||
} catch (e: java.lang.Exception) {
|
} catch (e: java.lang.Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id == null || id.isEmpty()) {
|
if (id == null || id.isEmpty()) {
|
||||||
viewModel.initNewData(signBean, filePath)
|
viewModel.initNewData(signBean, filePath)
|
||||||
|
//增加监听,联动列表自动保存
|
||||||
|
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
||||||
|
if (autoSave) {
|
||||||
|
viewModel.saveData()
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
viewModel.initData(id)
|
viewModel.initData(id)
|
||||||
}
|
}
|
||||||
@@ -276,6 +302,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,6 +314,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
|||||||
|
|
||||||
@RequiresApi(Build.VERSION_CODES.Q)
|
@RequiresApi(Build.VERSION_CODES.Q)
|
||||||
fun voiceOnTouchStop() {
|
fun voiceOnTouchStop() {
|
||||||
|
Log.e("qj", "voiceOnTouchStop====${Constant.IS_VIDEO_SPEED}")
|
||||||
if (Constant.IS_VIDEO_SPEED) {
|
if (Constant.IS_VIDEO_SPEED) {
|
||||||
viewModel.stopSoundMeter()
|
viewModel.stopSoundMeter()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.evaluationresult
|
package com.navinfo.omqs.ui.fragment.evaluationresult
|
||||||
|
|
||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
|
import android.app.Dialog
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.graphics.drawable.AnimationDrawable
|
import android.graphics.drawable.AnimationDrawable
|
||||||
import android.graphics.drawable.BitmapDrawable
|
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.data.entity.RenderEntity.Companion.LinkTable
|
||||||
import com.navinfo.collect.library.map.NIMapController
|
import com.navinfo.collect.library.map.NIMapController
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
import com.navinfo.omqs.bean.SignBean
|
|
||||||
import com.navinfo.omqs.Constant
|
import com.navinfo.omqs.Constant
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.bean.ChatMsgEntity
|
import com.navinfo.omqs.bean.ChatMsgEntity
|
||||||
|
import com.navinfo.omqs.bean.SignBean
|
||||||
import com.navinfo.omqs.db.RealmOperateHelper
|
import com.navinfo.omqs.db.RealmOperateHelper
|
||||||
import com.navinfo.omqs.db.RoomAppDatabase
|
import com.navinfo.omqs.db.RoomAppDatabase
|
||||||
|
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||||
import com.navinfo.omqs.util.DateTimeUtil
|
import com.navinfo.omqs.util.DateTimeUtil
|
||||||
import com.navinfo.omqs.util.SoundMeter
|
import com.navinfo.omqs.util.SoundMeter
|
||||||
import com.navinfo.omqs.util.SpeakMode
|
import com.navinfo.omqs.util.SpeakMode
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
import io.realm.OrderedCollectionChangeSet
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import io.realm.RealmList
|
import io.realm.RealmList
|
||||||
|
import io.realm.RealmModel
|
||||||
|
import io.realm.RealmResults
|
||||||
|
import io.realm.kotlin.addChangeListener
|
||||||
import io.realm.kotlin.where
|
import io.realm.kotlin.where
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -124,7 +130,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
geoPoint?.let {
|
geoPoint?.let {
|
||||||
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
|
||||||
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
mapController.markerHandle.addMarker(geoPoint, markerTitle)
|
||||||
mapController.animationHandler.animationByLonLat(
|
mapController.animationHandler.animationByLatLon(
|
||||||
geoPoint.latitude, geoPoint.longitude
|
geoPoint.latitude, geoPoint.longitude
|
||||||
)
|
)
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
@@ -147,7 +153,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
val point = GeometryTools.createGeoPoint(bean.geometry)
|
val point = GeometryTools.createGeoPoint(bean.geometry)
|
||||||
this.geometry = GeometryTools.createGeometry(point).toText()
|
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)
|
mapController.markerHandle.addMarker(point, markerTitle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -326,23 +332,30 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deleteData() {
|
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) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|
||||||
val realm = Realm.getDefaultInstance()
|
val realm = Realm.getDefaultInstance()
|
||||||
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
|
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
|
||||||
realm.executeTransaction {
|
realm.executeTransaction {
|
||||||
val objects =
|
val objects = it.where(QsRecordBean::class.java)
|
||||||
it.where(QsRecordBean::class.java).equalTo("id", liveDataQsRecordBean.value?.id)
|
.equalTo("id", liveDataQsRecordBean.value?.id).findFirst()
|
||||||
.findFirst()
|
|
||||||
objects?.deleteFromRealm()
|
objects?.deleteFromRealm()
|
||||||
}
|
}
|
||||||
// realm.close()
|
|
||||||
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
|
mapController.markerHandle.removeQsRecordMark(liveDataQsRecordBean.value!!)
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
liveDataFinish.postValue(true)
|
liveDataFinish.postValue(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
mDialog.setNegativeButton("取消", null)
|
||||||
|
mDialog.show()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据数据id,查询数据
|
* 根据数据id,查询数据
|
||||||
@@ -350,32 +363,39 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
|
|
||||||
fun initData(id: String) {
|
fun initData(id: String) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
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()
|
|
||||||
|
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|
||||||
|
Realm.getDefaultInstance().use { realm ->
|
||||||
|
realm.executeTransactionAsync { bgRealm ->
|
||||||
|
// find the item
|
||||||
|
val objects = bgRealm.where(QsRecordBean::class.java).equalTo("id", id).findFirst()
|
||||||
if (objects != null) {
|
if (objects != null) {
|
||||||
oldBean = realm.copyFromRealm(objects)
|
oldBean = bgRealm.copyFromRealm(objects)
|
||||||
oldBean?.let {
|
oldBean?.let {
|
||||||
liveDataQsRecordBean.postValue(it.copy())
|
liveDataQsRecordBean.postValue(it.copy())
|
||||||
val p = GeometryTools.createGeoPoint(it.geometry)
|
val p = GeometryTools.createGeoPoint(it.geometry)
|
||||||
mapController.markerHandle.addMarker(
|
mapController.markerHandle.addMarker(GeoPoint(p.latitude, p.longitude), markerTitle)
|
||||||
GeoPoint(p.latitude, p.longitude), markerTitle
|
|
||||||
)
|
|
||||||
|
|
||||||
|
//获取linkid
|
||||||
if (it.linkId.isNotEmpty()) {
|
if (it.linkId.isNotEmpty()) {
|
||||||
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
val link = realmOperateHelper.queryLink(it.linkId)
|
val link = realmOperateHelper.queryLink(it.linkId)
|
||||||
link?.let { l ->
|
link?.let { l ->
|
||||||
mapController.lineHandler.showLine(l.geometry)
|
mapController.lineHandler.showLine(l.geometry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
liveDataQsRecordBean.value?.attachmentBeanList = it.attachmentBeanList
|
||||||
// 显示语音数据到界面
|
// 显示语音数据到界面
|
||||||
getChatMsgEntityList()
|
getChatMsgEntityList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询问题类型列表
|
* 查询问题类型列表
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
|
|||||||
|
|
||||||
override fun refreshData(newData: List<String>) {
|
override fun refreshData(newData: List<String>) {
|
||||||
data = newData
|
data = newData
|
||||||
selectTitle = newData[0]
|
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class PhenomenonFragment :
|
|||||||
}
|
}
|
||||||
//右侧菜单查询数据监听
|
//右侧菜单查询数据监听
|
||||||
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
||||||
rightAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.classType)
|
rightAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.phenomenon)
|
||||||
rightAdapter.refreshData(it)
|
rightAdapter.refreshData(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,10 +139,6 @@ class PhenomenonFragment :
|
|||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
_binding = null
|
_binding = null
|
||||||
Log.e("jingo", "PhenomenonFragment onDestroyView ${hashCode()}")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,8 +6,10 @@ import android.util.Log
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import androidx.navigation.findNavController
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.databinding.FragmentProblemLinkBinding
|
import com.navinfo.omqs.databinding.FragmentProblemLinkBinding
|
||||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||||
import com.navinfo.omqs.ui.other.shareViewModels
|
import com.navinfo.omqs.ui.other.shareViewModels
|
||||||
@@ -28,7 +30,6 @@ class ProblemLinkFragment : BaseFragment() {
|
|||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
_binding = FragmentProblemLinkBinding.inflate(inflater, container, false)
|
_binding = FragmentProblemLinkBinding.inflate(inflater, container, false)
|
||||||
Log.e("jingo", "linkFragment onCreateView ${hashCode()}")
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +44,9 @@ class ProblemLinkFragment : BaseFragment() {
|
|||||||
binding.linkRightRecyclerview.layoutManager = rightLayoutManager
|
binding.linkRightRecyclerview.layoutManager = rightLayoutManager
|
||||||
val rightAdapter = RightGroupHeaderAdapter { _, bean ->
|
val rightAdapter = RightGroupHeaderAdapter { _, bean ->
|
||||||
viewModel.setProblemLinkMiddleBean(bean)
|
viewModel.setProblemLinkMiddleBean(bean)
|
||||||
|
if (activity != null) {
|
||||||
|
requireActivity().findNavController(R.id.main_activity_middle_fragment).navigateUp()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
binding.linkRightRecyclerview.adapter = rightAdapter
|
binding.linkRightRecyclerview.adapter = rightAdapter
|
||||||
//右侧菜单增加组标题
|
//右侧菜单增加组标题
|
||||||
@@ -55,6 +59,7 @@ class ProblemLinkFragment : BaseFragment() {
|
|||||||
}
|
}
|
||||||
//右侧菜单查询数据监听
|
//右侧菜单查询数据监听
|
||||||
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
|
||||||
|
rightAdapter.setSelectTitle(viewModel.liveDataQsRecordBean.value!!.cause)
|
||||||
rightAdapter.refreshData(it)
|
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()
|
viewModel.getProblemLinkList()
|
||||||
}
|
}
|
||||||
@@ -98,10 +87,5 @@ class ProblemLinkFragment : BaseFragment() {
|
|||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
_binding = null
|
_binding = null
|
||||||
Log.e("jingo", "linkFragment onDestroyView ${hashCode()}")
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,7 +111,7 @@ class PersonalCenterFragment : BaseFragment(), FSAFActivityCallbacks {
|
|||||||
viewModel.readRealmData()
|
viewModel.readRealmData()
|
||||||
// 定位到指定位置
|
// 定位到指定位置
|
||||||
niMapController.mMapView.vtmMap.animator()
|
niMapController.mMapView.vtmMap.animator()
|
||||||
.animateTo(GeoPoint(28.724637921467508 ,115.83412668023867 ))
|
.animateTo(GeoPoint( 40.034842306317486, 116.31735963074652 ))
|
||||||
}
|
}
|
||||||
R.id.personal_center_menu_task_list -> {
|
R.id.personal_center_menu_task_list -> {
|
||||||
findNavController().navigate(R.id.TaskManagerFragment)
|
findNavController().navigate(R.id.TaskManagerFragment)
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.navinfo.omqs.ui.fragment.tasklist
|
|||||||
import android.app.AlertDialog
|
import android.app.AlertDialog
|
||||||
import android.content.DialogInterface
|
import android.content.DialogInterface
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.Editable
|
||||||
|
import android.text.TextWatcher
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -64,12 +66,26 @@ class TaskFragment : BaseFragment() {
|
|||||||
binding.taskRecyclerview.setHasFixedSize(true)
|
binding.taskRecyclerview.setHasFixedSize(true)
|
||||||
binding.taskRecyclerview.layoutManager = layoutManager
|
binding.taskRecyclerview.layoutManager = layoutManager
|
||||||
binding.taskRecyclerview.adapter = adapter
|
binding.taskRecyclerview.adapter = adapter
|
||||||
|
binding.taskSearchClear.setOnClickListener {
|
||||||
|
binding.taskSearch.setText("")
|
||||||
|
}
|
||||||
viewModel.liveDataTaskLinks.observe(viewLifecycleOwner) {
|
viewModel.liveDataTaskLinks.observe(viewLifecycleOwner) {
|
||||||
adapter.resetSelect()
|
adapter.resetSelect()
|
||||||
adapter.refreshData(it)
|
adapter.refreshData(it)
|
||||||
}
|
}
|
||||||
viewModel.getTaskList(requireContext())
|
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() {
|
override fun onDestroyView() {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.tasklist
|
package com.navinfo.omqs.ui.fragment.tasklist
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -85,6 +86,27 @@ class TaskListAdapter(
|
|||||||
downloadManager.observer(taskBean.id, holder, DownloadObserver(taskBean.id, holder))
|
downloadManager.observer(taskBean.id, holder, DownloadObserver(taskBean.id, holder))
|
||||||
uploadManager.addTask(taskBean)
|
uploadManager.addTask(taskBean)
|
||||||
uploadManager.observer(taskBean.id, holder, UploadObserver(taskBean.id, binding))
|
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.tag = position
|
||||||
binding.taskDownloadBtn.setOnClickListener(downloadBtnClick)
|
binding.taskDownloadBtn.setOnClickListener(downloadBtnClick)
|
||||||
binding.taskUploadBtn.tag = position
|
binding.taskUploadBtn.tag = position
|
||||||
@@ -92,7 +114,6 @@ class TaskListAdapter(
|
|||||||
binding.taskName.text = taskBean.evaluationTaskName
|
binding.taskName.text = taskBean.evaluationTaskName
|
||||||
binding.taskCityName.text = taskBean.cityName
|
binding.taskCityName.text = taskBean.cityName
|
||||||
binding.taskDataVersion.text = "版本号:${taskBean.dataVersion}"
|
binding.taskDataVersion.text = "版本号:${taskBean.dataVersion}"
|
||||||
binding.taskColor.setTextColor(taskBean.color)
|
|
||||||
binding.root.isSelected = selectPosition == position
|
binding.root.isSelected = selectPosition == position
|
||||||
binding.root.setOnClickListener {
|
binding.root.setOnClickListener {
|
||||||
val pos = holder.adapterPosition
|
val pos = holder.adapterPosition
|
||||||
@@ -133,87 +154,108 @@ class TaskListAdapter(
|
|||||||
private fun changeUploadTxtViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
|
private fun changeUploadTxtViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
|
||||||
when (taskBean.syncStatus) {
|
when (taskBean.syncStatus) {
|
||||||
FileUploadStatus.DONE -> {
|
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 -> {
|
FileUploadStatus.ERROR -> {
|
||||||
binding.taskUploadBtn.text = "重新同步"
|
binding.taskUploadBtn.stopAnimator()
|
||||||
|
binding.taskUploadBtn.setText("重新同步")
|
||||||
|
binding.taskUploadBtn.setProgress(100)
|
||||||
}
|
}
|
||||||
FileUploadStatus.NONE -> {
|
FileUploadStatus.NONE -> {
|
||||||
binding.taskUploadBtn.text = "同步"
|
binding.taskUploadBtn.setText("未上传")
|
||||||
|
binding.taskUploadBtn.setProgress(0)
|
||||||
}
|
}
|
||||||
FileUploadStatus.WAITING -> {
|
FileUploadStatus.WAITING -> {
|
||||||
binding.taskUploadBtn.text = "等待同步"
|
binding.taskUploadBtn.setText("等待同步")
|
||||||
|
binding.taskUploadBtn.setProgress(100)
|
||||||
}
|
}
|
||||||
FileUploadStatus.UPLOADING -> {
|
FileUploadStatus.UPLOADING -> {
|
||||||
binding.taskUploadBtn.text = "同步中"
|
binding.taskUploadBtn.setText("上传中")
|
||||||
|
binding.taskUploadBtn.setProgress(100)
|
||||||
|
binding.taskUploadBtn.startAnimator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private fun changeViews(binding: AdapterTaskListBinding, taskBean: TaskBean) {
|
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) {
|
if (taskBean.fileSize > 0L) {
|
||||||
binding.taskProgress.progress =
|
val progress = (taskBean.currentSize * 100 / taskBean.fileSize).toInt()
|
||||||
(taskBean.currentSize * 100 / taskBean.fileSize).toInt()
|
binding.taskProgressText.text =
|
||||||
|
"$progress%"
|
||||||
|
binding.taskDownloadBtn.setProgress(progress)
|
||||||
}
|
}
|
||||||
when (taskBean.status) {
|
when (taskBean.status) {
|
||||||
FileDownloadStatus.NONE -> {
|
FileDownloadStatus.NONE -> {
|
||||||
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.INVISIBLE
|
View.INVISIBLE
|
||||||
binding.taskDownloadBtn.text = "下载"
|
binding.taskDownloadBtn.setText("下载")
|
||||||
}
|
}
|
||||||
FileDownloadStatus.WAITING -> {
|
FileDownloadStatus.WAITING -> {
|
||||||
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.text = "等待中"
|
binding.taskDownloadBtn.setText("等待中")
|
||||||
}
|
}
|
||||||
FileDownloadStatus.LOADING -> {
|
FileDownloadStatus.LOADING -> {
|
||||||
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.text = "暂停"
|
binding.taskDownloadBtn.setText("暂停")
|
||||||
}
|
}
|
||||||
FileDownloadStatus.PAUSE -> {
|
FileDownloadStatus.PAUSE -> {
|
||||||
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.text = "继续"
|
binding.taskDownloadBtn.setText("继续")
|
||||||
}
|
}
|
||||||
FileDownloadStatus.ERROR -> {
|
FileDownloadStatus.ERROR -> {
|
||||||
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.text = "重试"
|
binding.taskDownloadBtn.setText("重试")
|
||||||
}
|
}
|
||||||
FileDownloadStatus.DONE -> {
|
FileDownloadStatus.DONE -> {
|
||||||
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.INVISIBLE
|
View.INVISIBLE
|
||||||
binding.taskDownloadBtn.text = "已完成"
|
binding.taskDownloadBtn.setText("已完成")
|
||||||
|
binding.taskDownloadBtn.visibility = View.INVISIBLE
|
||||||
|
binding.taskUploadBtn.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
FileDownloadStatus.UPDATE -> {
|
FileDownloadStatus.UPDATE -> {
|
||||||
if (binding.taskProgress.visibility == View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility == View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.INVISIBLE
|
View.INVISIBLE
|
||||||
binding.taskDownloadBtn.text = "更新"
|
binding.taskDownloadBtn.setText("更新")
|
||||||
}
|
}
|
||||||
FileDownloadStatus.IMPORTING -> {
|
FileDownloadStatus.IMPORTING -> {
|
||||||
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.VISIBLE
|
View.VISIBLE
|
||||||
binding.taskDownloadBtn.text = "安装中"
|
binding.taskDownloadBtn.setText("安装中")
|
||||||
val split = taskBean.message.split("/")
|
val split = taskBean.message.split("/")
|
||||||
if (split.size == 2) {
|
if (split.size == 2) {
|
||||||
try {
|
try {
|
||||||
val index = split[0].toInt()
|
val index = split[0].toInt()
|
||||||
val count = split[1].toInt()
|
val count = split[1].toInt()
|
||||||
binding.taskProgress.progress =
|
binding.taskProgressText.text =
|
||||||
index * 100 / count
|
"${index * 100 / count}%"
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Log.e("jingo", "更新进度条 $e")
|
Log.e("jingo", "更新进度条 $e")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
binding.taskProgress.progress = 0
|
binding.taskProgressText.text = "0%"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FileDownloadStatus.IMPORT -> {
|
FileDownloadStatus.IMPORT -> {
|
||||||
if (binding.taskProgress.visibility != View.VISIBLE) binding.taskProgress.visibility =
|
if (binding.taskProgressText.visibility != View.VISIBLE) binding.taskProgressText.visibility =
|
||||||
View.INVISIBLE
|
View.INVISIBLE
|
||||||
binding.taskDownloadBtn.text = "安装"
|
binding.taskDownloadBtn.setText("安装")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.tasklist
|
package com.navinfo.omqs.ui.fragment.tasklist
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.text.Editable
|
||||||
|
import android.text.TextWatcher
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -60,6 +62,17 @@ class TaskListFragment : BaseFragment() {
|
|||||||
adapter.refreshData(it)
|
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() {
|
override fun onDestroyView() {
|
||||||
|
|||||||
@@ -17,17 +17,13 @@ import com.navinfo.omqs.http.NetworkService
|
|||||||
import com.navinfo.omqs.tools.FileManager
|
import com.navinfo.omqs.tools.FileManager
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import io.realm.Realm
|
import io.realm.Realm
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.util.*
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
||||||
@HiltViewModel
|
@HiltViewModel
|
||||||
class TaskViewModel @Inject constructor(
|
class TaskViewModel @Inject constructor(
|
||||||
private val networkService: NetworkService,
|
private val networkService: NetworkService, private val mapController: NIMapController
|
||||||
private val mapController: NIMapController
|
|
||||||
) : ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -47,6 +43,12 @@ class TaskViewModel @Inject constructor(
|
|||||||
*/
|
*/
|
||||||
private var currentSelectTaskBean: TaskBean? = null
|
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.fileSize = item.fileSize
|
||||||
task.status = item.status
|
task.status = item.status
|
||||||
task.currentSize = item.currentSize
|
task.currentSize = item.currentSize
|
||||||
task.color = item.color
|
// 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)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// 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)
|
realm.copyToRealmOrUpdate(task)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,13 +94,13 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is NetResult.Error -> {
|
is NetResult.Error<*> -> {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is NetResult.Failure -> {
|
is NetResult.Failure<*> -> {
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
||||||
.show()
|
.show()
|
||||||
@@ -162,10 +165,7 @@ class TaskViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapController.animationHandler.animateToBox(
|
mapController.animationHandler.animateToBox(
|
||||||
maxX = maxX,
|
maxX = maxX, maxY = maxY, minX = minX, minY = minY
|
||||||
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.navinfo.omqs.ui.widget
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
|
import com.navinfo.omqs.bean.SignBean
|
||||||
|
|
||||||
class SignUtil {
|
class SignUtil {
|
||||||
companion object {
|
companion object {
|
||||||
@@ -73,6 +74,10 @@ class SignUtil {
|
|||||||
4003 -> "条件点限速"
|
4003 -> "条件点限速"
|
||||||
//可变点限速
|
//可变点限速
|
||||||
4004 -> "可变点限速"
|
4004 -> "可变点限速"
|
||||||
|
//普通交限
|
||||||
|
4006 -> "普通交限"
|
||||||
|
//交通灯
|
||||||
|
4022 -> "交通灯"
|
||||||
else -> ""
|
else -> ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,6 +214,8 @@ class SignUtil {
|
|||||||
4003 -> getConditionalSpeedLimitIcon(data)
|
4003 -> getConditionalSpeedLimitIcon(data)
|
||||||
//可变点限速
|
//可变点限速
|
||||||
4004 -> R.drawable.icon_change_limit
|
4004 -> R.drawable.icon_change_limit
|
||||||
|
//交通灯
|
||||||
|
4022 -> R.drawable.icon_traffic_light
|
||||||
else -> 0
|
else -> 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,5 +292,24 @@ class SignUtil {
|
|||||||
}
|
}
|
||||||
return R.drawable.icon_road_direction
|
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()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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)
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
110
app/src/main/java/com/navinfo/omqs/util/SpeakMode.kt
Normal 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
app/src/main/res/drawable-xhdpi/icon_evaluation.png
Normal file
|
After Width: | Height: | Size: 704 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_evaluation.png
Normal file
|
After Width: | Height: | Size: 988 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_sign_info.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
@@ -92,7 +92,7 @@
|
|||||||
android:hint="@string/input_user_name"
|
android:hint="@string/input_user_name"
|
||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:background="@drawable/shape_login_inputlayout_bg"
|
android:background="@drawable/shape_login_inputlayout_bg"
|
||||||
android:text="@{loginUserModel.loginUser.username}"
|
android:text="@{loginUserModel.loginUser.userCode}"
|
||||||
tools:ignore="TouchTargetSizeCheck" />
|
tools:ignore="TouchTargetSizeCheck" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
@@ -113,10 +113,12 @@
|
|||||||
android:lines="1"
|
android:lines="1"
|
||||||
android:inputType="textPassword"
|
android:inputType="textPassword"
|
||||||
android:background="@drawable/shape_login_inputlayout_bg"
|
android:background="@drawable/shape_login_inputlayout_bg"
|
||||||
android:text="@{loginUserModel.loginUser.password}"
|
android:text="@{loginUserModel.loginUser.passWord}"
|
||||||
tools:ignore="TouchTargetSizeCheck" />
|
tools:ignore="TouchTargetSizeCheck" />
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_login_forget_passwd"
|
android:id="@+id/tv_login_forget_passwd"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
@@ -75,8 +75,9 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/main_activity_sign_recyclerview"
|
android:id="@+id/main_activity_sign_recyclerview"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="350dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
|
android:maxHeight="350dp"
|
||||||
app:layout_constraintLeft_toLeftOf="@id/main_activity_person_center"
|
app:layout_constraintLeft_toLeftOf="@id/main_activity_person_center"
|
||||||
app:layout_constraintTop_toBottomOf="@id/main_activity_person_center" />
|
app:layout_constraintTop_toBottomOf="@id/main_activity_person_center" />
|
||||||
|
|
||||||
@@ -174,6 +175,7 @@
|
|||||||
android:drawableLeft="@drawable/icon_main_geometry"
|
android:drawableLeft="@drawable/icon_main_geometry"
|
||||||
android:elevation="2dp"
|
android:elevation="2dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
|
android:onClick="@{()->mainActivity.jumpPosition()}"
|
||||||
android:paddingLeft="9dp"
|
android:paddingLeft="9dp"
|
||||||
android:text="经纬度:116.99388424,38.8403844"
|
android:text="经纬度:116.99388424,38.8403844"
|
||||||
android:textSize="10sp"
|
android:textSize="10sp"
|
||||||
@@ -231,7 +233,6 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@id/main_activity_add_new"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_add_new"
|
||||||
app:layout_constraintRight_toRightOf="@id/main_activity_add_new" />
|
app:layout_constraintRight_toRightOf="@id/main_activity_add_new" />
|
||||||
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/main_activity_select_line"
|
android:id="@+id/main_activity_select_line"
|
||||||
style="@style/zoom_btns_style"
|
style="@style/zoom_btns_style"
|
||||||
@@ -242,6 +243,12 @@
|
|||||||
app:layout_constraintBottom_toTopOf="@id/main_activity_voice"
|
app:layout_constraintBottom_toTopOf="@id/main_activity_voice"
|
||||||
app:layout_constraintRight_toRightOf="@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
|
<fragment
|
||||||
android:id="@+id/main_activity_middle_fragment"
|
android:id="@+id/main_activity_middle_fragment"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
style="?android:attr/progressBarStyleHorizontal"
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="16dp"
|
android:layout_height="16dp"
|
||||||
android:layout_below="@id/offline_map_download_btn"
|
android:layout_below="@id/offline_map_city_size"
|
||||||
android:paddingTop="10dp"
|
android:paddingTop="10dp"
|
||||||
android:progressDrawable="@drawable/progress_bg"
|
android:progressDrawable="@drawable/progress_bg"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="78dp"
|
||||||
|
tools:context="com.navinfo.omqs.ui.activity.map.SignAdapter">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/sign_main_bg"
|
||||||
android:layout_width="193dp"
|
android:layout_width="193dp"
|
||||||
android:layout_height="78dp"
|
android:layout_height="78dp"
|
||||||
android:background="@drawable/bg_sign"
|
android:background="@drawable/bg_sign" />
|
||||||
tools:context="com.navinfo.omqs.ui.activity.map.SignAdapter">
|
|
||||||
|
<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
|
<TextView
|
||||||
android:id="@+id/sign_main_icon"
|
android:id="@+id/sign_main_icon"
|
||||||
@@ -12,7 +24,6 @@
|
|||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:layout_marginLeft="19dp"
|
android:layout_marginLeft="19dp"
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:background="@drawable/icon_speed_limit"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:text="80"
|
android:text="80"
|
||||||
android:textColor="#2F2F2F"
|
android:textColor="#2F2F2F"
|
||||||
@@ -34,11 +45,32 @@
|
|||||||
android:id="@+id/sign_bottom_right_text"
|
android:id="@+id/sign_bottom_right_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
|
||||||
android:text="其他信息"
|
|
||||||
android:layout_alignTop="@id/sign_bottom_text"
|
android:layout_alignTop="@id/sign_bottom_text"
|
||||||
android:textColor="@color/white"
|
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_marginRight="15dp"
|
android:layout_marginRight="15dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="其他信息"
|
||||||
|
android:textColor="@color/white"
|
||||||
android:textSize="14sp" />
|
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>
|
</RelativeLayout>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
android:paddingLeft="8dp"
|
android:paddingLeft="8dp"
|
||||||
android:paddingTop="6dp"
|
android:paddingTop="6dp"
|
||||||
android:paddingRight="8dp"
|
android:paddingRight="8dp"
|
||||||
android:paddingBottom="4dp"
|
android:paddingBottom="8dp"
|
||||||
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter">
|
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
@@ -30,65 +30,57 @@
|
|||||||
android:textColor="#15141F"
|
android:textColor="#15141F"
|
||||||
android:textSize="14sp" />
|
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
|
<TextView
|
||||||
android:id="@+id/task_data_version"
|
android:id="@+id/task_data_version"
|
||||||
style="@style/map_size_font_style"
|
style="@style/map_size_font_style"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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_alignLeft="@id/task_name"
|
||||||
android:layout_toLeftOf="@id/task_upload_btn"
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
android:text="版本号"
|
android:text="版本号"
|
||||||
android:textColor="@color/gray_121"
|
android:textColor="@color/gray_121"
|
||||||
android:textSize="13sp" />
|
android:textSize="13sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_color"
|
android:id="@+id/task_city_name"
|
||||||
style="@style/map_size_font_style"
|
style="@style/map_size_font_style"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/task_data_version"
|
android:layout_below="@id/task_data_version"
|
||||||
android:layout_alignLeft="@id/task_name"
|
android:layout_alignLeft="@id/task_name"
|
||||||
android:layout_marginTop="5dp"
|
android:text="省市名称"
|
||||||
android:drawableLeft="@drawable/point_blue"
|
android:textColor="@color/gray_121"
|
||||||
android:text="路线颜色"
|
android:textSize="13sp" />
|
||||||
android:textSize="@dimen/card_title_font_3size" />
|
|
||||||
|
|
||||||
|
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
|
||||||
<TextView
|
|
||||||
android:id="@+id/task_download_btn"
|
android:id="@+id/task_download_btn"
|
||||||
style="@style/btn_default_stroke_horizontal_round"
|
android:layout_width="75dp"
|
||||||
android:layout_width="72dp"
|
android:layout_height="22dp"
|
||||||
|
android:layout_alignBottom="@id/task_city_name"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:layout_marginTop="5dp"
|
||||||
android:text="下载"
|
app:backgroundcolor="#888FB3"
|
||||||
android:textSize="@dimen/card_title_font_2size" />
|
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"
|
android:id="@+id/task_upload_btn"
|
||||||
style="@style/btn_default_stroke_horizontal_round"
|
android:layout_width="75dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="22dp"
|
||||||
android:layout_centerVertical="true"
|
android:layout_alignBottom="@id/task_city_name"
|
||||||
android:layout_marginRight="5dp"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_toLeftOf="@id/task_download_btn"
|
android:layout_gravity="center"
|
||||||
android:gravity="center"
|
android:layout_marginTop="5dp"
|
||||||
android:minWidth="60dp"
|
android:visibility="gone"
|
||||||
android:shadowColor="@android:color/transparent"
|
app:backgroundcolor="#888FB3"
|
||||||
android:text="同步"
|
app:text="未上传"
|
||||||
android:textSize="@dimen/card_title_font_2size" />
|
app:textSize="@dimen/card_title_font_2size"
|
||||||
|
app:textcolor="@color/white" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/task_status"
|
android:id="@+id/task_status"
|
||||||
@@ -103,13 +95,14 @@
|
|||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/card_title_font_2size" />
|
android:textSize="@dimen/card_title_font_2size" />
|
||||||
|
|
||||||
<com.navinfo.omqs.ui.widget.MyProgressBar
|
<TextView
|
||||||
android:id="@+id/task_progress"
|
android:id="@+id/task_progress_text"
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="16dp"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/task_color"
|
android:layout_alignTop="@id/task_download_btn"
|
||||||
android:paddingTop="10dp"
|
android:layout_alignBottom="@id/task_download_btn"
|
||||||
android:progressDrawable="@drawable/progress_bg"
|
android:layout_toLeftOf="@id/task_download_btn"
|
||||||
|
android:gravity="center"
|
||||||
android:visibility="invisible" />
|
android:visibility="invisible" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
android:id="@+id/evaluation_bar"
|
android:id="@+id/evaluation_bar"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginTop="14dp"
|
android:layout_marginTop="14dp"
|
||||||
android:text="Mark"
|
android:text="Mark"
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
android:id="@+id/evaluation_bar_cancel"
|
android:id="@+id/evaluation_bar_cancel"
|
||||||
android:layout_width="40dp"
|
android:layout_width="40dp"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginRight="10dp"
|
android:layout_marginRight="10dp"
|
||||||
android:background="@color/transparent"
|
android:background="@color/transparent"
|
||||||
android:src="@drawable/icon_fragment_close"
|
android:src="@drawable/icon_fragment_close"
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
style="@style/left_pannel_title_layout">
|
style="@style/left_pannel_title_layout">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/offline_map_back"
|
android:id="@+id/offline_map_back"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -24,7 +25,9 @@
|
|||||||
android:background="@drawable/selector_bg_round_button"
|
android:background="@drawable/selector_bg_round_button"
|
||||||
android:foreground="@drawable/ripple_btn_press"
|
android:foreground="@drawable/ripple_btn_press"
|
||||||
style="@style/btn_round"
|
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
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
@@ -36,19 +39,24 @@
|
|||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="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.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title_layout"
|
app:layout_constraintTop_toBottomOf="@id/title_layout"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
style="@style/default_card_view">
|
style="@style/default_card_view">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/offline_map_tab_layout"
|
android:id="@+id/offline_map_tab_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -60,22 +68,22 @@
|
|||||||
app:tabPadding="0dp"
|
app:tabPadding="0dp"
|
||||||
app:tabIndicator="@null"
|
app:tabIndicator="@null"
|
||||||
app:tabMode="scrollable"
|
app:tabMode="scrollable"
|
||||||
|
app:tabMinWidth="120dp"
|
||||||
app:tabIndicatorHeight="0dp"
|
app:tabIndicatorHeight="0dp"
|
||||||
app:tabSelectedTextColor="@color/white"
|
app:tabSelectedTextColor="@color/white"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title_layout">
|
app:layout_constraintTop_toBottomOf="@id/title_layout">
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="@dimen/default_widget_padding"
|
|
||||||
android:text="下载管理" />
|
android:text="下载管理" />
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabItem
|
<com.google.android.material.tabs.TabItem
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="@dimen/default_widget_padding"
|
|
||||||
android:text="城市列表" />
|
android:text="城市列表" />
|
||||||
|
|
||||||
</com.google.android.material.tabs.TabLayout>
|
</com.google.android.material.tabs.TabLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,25 +7,6 @@
|
|||||||
android:background="@drawable/shape_middle_fragment_bg"
|
android:background="@drawable/shape_middle_fragment_bg"
|
||||||
tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.PhenomenonFragment">
|
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
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/phenomenon_left_recyclerview"
|
android:id="@+id/phenomenon_left_recyclerview"
|
||||||
android:layout_width="148dp"
|
android:layout_width="148dp"
|
||||||
@@ -42,29 +23,4 @@
|
|||||||
app:layout_constraintLeft_toRightOf="@id/phenomenon_left_recyclerview"
|
app:layout_constraintLeft_toRightOf="@id/phenomenon_left_recyclerview"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="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>-->
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
@@ -1,51 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?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"
|
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:layout_height="match_parent"
|
||||||
android:gravity="right|center_vertical"
|
android:background="@drawable/shape_middle_fragment_bg"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingTop="@dimen/fragment_margin_top"
|
|
||||||
android:paddingLeft="@dimen/fragment_margin_left"
|
|
||||||
tools:context="com.navinfo.omqs.ui.fragment.evaluationresult.ProblemLinkFragment">
|
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"
|
|
||||||
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
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/link_right_recyclerview"
|
android:id="@+id/link_right_recyclerview"
|
||||||
android:layout_width="0dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" />
|
||||||
android:layout_weight="4"
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
android:background="@color/white" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -10,12 +10,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="4dp"
|
android:layout_margin="4dp"
|
||||||
|
android:drawableLeft="@drawable/selector_text_drawable_left_white_blue"
|
||||||
|
android:drawablePadding="10dp"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:padding="4dp"
|
android:padding="4dp"
|
||||||
android:drawablePadding="10dp"
|
|
||||||
android:drawableLeft="@drawable/selector_text_drawable_left_white_blue"
|
|
||||||
android:textColor="@color/selector_black_blue_color"
|
android:textColor="@color/selector_black_blue_color"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<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_btns_wh" comment="地图主页右上角抽屉按钮的大小">54dp</dimen>
|
||||||
<dimen name="top_right_drawer_wh" comment="地图主页右上角抽屉的把手按钮的大小">42dp</dimen>
|
<dimen name="top_right_drawer_wh" comment="地图主页右上角抽屉的把手按钮的大小">42dp</dimen>
|
||||||
<dimen name="top_right_drawer_btns_mr" comment="地图主页右上角抽屉按钮距离右侧间距">44dp</dimen>
|
<dimen name="top_right_drawer_btns_mr" comment="地图主页右上角抽屉按钮距离右侧间距">44dp</dimen>
|
||||||
@@ -9,4 +9,5 @@
|
|||||||
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
|
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
|
||||||
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
|
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
|
||||||
<dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">360dp</dimen>
|
<dimen name="fragment_phenomenon_width" comment="问题现象面板宽度">360dp</dimen>
|
||||||
|
<dimen name="fragment_problem_link_width" comment="问题原因面板宽度">213dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
12
app/src/main/res/values/attrs.xml
Normal 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>
|
||||||
@@ -39,6 +39,6 @@
|
|||||||
<dimen name="right_fragment_w" comment="右侧fragment宽度">213dp</dimen>
|
<dimen name="right_fragment_w" comment="右侧fragment宽度">213dp</dimen>
|
||||||
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
|
<dimen name="main_activity_geometry_w" comment="地图主页坐标框宽度">230dp</dimen>
|
||||||
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
|
<dimen name="main_activity_geometry_h" comment="地图主页坐标框高度">28dp</dimen>
|
||||||
|
<dimen name="fragment_problem_link_width" comment="问题原因面板宽度">213dp</dimen>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@@ -42,6 +42,9 @@
|
|||||||
<item name="android:gravity">center_vertical</item>
|
<item name="android:gravity">center_vertical</item>
|
||||||
<item name="android:paddingRight">6dp</item>
|
<item name="android:paddingRight">6dp</item>
|
||||||
<item name="android:paddingLeft">10dp</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:drawableRight">@drawable/baseline_keyboard_arrow_down_12</item>
|
||||||
<item name="android:background">@drawable/shape_rect_white_2dp_bg</item>
|
<item name="android:background">@drawable/shape_rect_white_2dp_bg</item>
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
|||||||
@@ -94,6 +94,7 @@
|
|||||||
<xs:enumeration value="name"/>
|
<xs:enumeration value="name"/>
|
||||||
<xs:enumeration value="maxSpeed"/><!--最高速度-->
|
<xs:enumeration value="maxSpeed"/><!--最高速度-->
|
||||||
<xs:enumeration value="minSpeed"/><!--最低速度-->
|
<xs:enumeration value="minSpeed"/><!--最低速度-->
|
||||||
|
<xs:enumeration value="angle"/><!--角度-->
|
||||||
<xs:enumeration value="ref"/>
|
<xs:enumeration value="ref"/>
|
||||||
</xs:restriction>
|
</xs:restriction>
|
||||||
</xs:simpleType>
|
</xs:simpleType>
|
||||||
|
|||||||
@@ -173,6 +173,9 @@
|
|||||||
<!-- oneway -->
|
<!-- oneway -->
|
||||||
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
<style-symbol id="oneway" repeat="true" src="assets:symbols/oneway.svg" />
|
||||||
|
|
||||||
|
<!-- omdb -->
|
||||||
|
<style-line id="boundaryType" width="0.1" stipple-width="0.1" />
|
||||||
|
|
||||||
<!--###### ASSIGNMENT ######-->
|
<!--###### ASSIGNMENT ######-->
|
||||||
|
|
||||||
<m e="way" k="natural" v="issea|sea">
|
<m e="way" k="natural" v="issea|sea">
|
||||||
@@ -1600,46 +1603,34 @@
|
|||||||
</m>
|
</m>
|
||||||
<!--道路种别-->
|
<!--道路种别-->
|
||||||
<m v="OMDB_RD_LINK_KIND">
|
<m v="OMDB_RD_LINK_KIND">
|
||||||
<m k="kind">
|
<outline-layer id="kind0" stroke="#44000000" width="0.1" />
|
||||||
<m v="1">
|
<outline-layer id="kind1" stroke="#aa807040" width="0.1" />
|
||||||
<line stroke="#fcacd4" width="1"/>
|
<m k="kind" v="1">
|
||||||
|
<line outline="kind0" blur="0.3" use="highway:z11" />
|
||||||
</m>
|
</m>
|
||||||
<m v="2">
|
<m k="kind" v="2|3">
|
||||||
<line stroke="#dcacfc" width="1"/>
|
<line outline="kind0" use="trunk" />
|
||||||
</m>
|
</m>
|
||||||
<m v="3">
|
<m k="kind" v="4">
|
||||||
<line stroke="#fc9c9c" width="1"/>
|
<line outline="kind0" use="primary:z11" />
|
||||||
</m>
|
</m>
|
||||||
<m v="4">
|
<m k="kind" v="5|6">
|
||||||
<line stroke="#fcd484" width="1"/>
|
<line outline="kind0" use="secondary:z11" />
|
||||||
</m>
|
</m>
|
||||||
<m v="5">
|
<m k="kind" v="7">
|
||||||
<line stroke="#ecfccc" width="1"/>
|
<line outline="kind0" use="tertiary" />
|
||||||
</m>
|
</m>
|
||||||
<m v="6">
|
<m k="kind" v="8">
|
||||||
<line stroke="#acec84" width="1"/>
|
<line outline="kind0" use="residential" />
|
||||||
</m>
|
</m>
|
||||||
<m v="7">
|
<m k="kind" v="9|10">
|
||||||
<line stroke="#806048" width="1"/>
|
<line outline="kind0" use="footway:z17" />
|
||||||
</m>
|
</m>
|
||||||
<m v="8">
|
<m k="kind" v="11|13">
|
||||||
<line stroke="#fcfc7c" width="1"/>
|
<line outline="kind0" use="ferry" />
|
||||||
</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>
|
</m>
|
||||||
|
<m k="kind" v="15">
|
||||||
|
<line outline="kind0" use="highway:cycleway" />
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
|
|
||||||
@@ -1651,163 +1642,13 @@
|
|||||||
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
|
<caption k="maxSpeed" fill="#000000" priority="0" size="16" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
<symbol src="assets:omdb/icon_4002_0.png" symbol-width="46" symbol-height="46"></symbol>
|
<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"
|
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
</m>
|
</m>
|
||||||
<m v="1">
|
<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>
|
stroke-width="1.0"></caption>
|
||||||
<symbol src="assets:omdb/icon_4002_1.png" symbol-width="46" symbol-height="46"></symbol>
|
<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"
|
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
</m>
|
</m>
|
||||||
@@ -1815,36 +1656,34 @@
|
|||||||
</m>
|
</m>
|
||||||
<!--条件点限速-->
|
<!--条件点限速-->
|
||||||
<m v="OMDB_SPEEDLIMIT_COND">
|
<m v="OMDB_SPEEDLIMIT_COND">
|
||||||
<m k="speedFlag">
|
<m k="speedFlag" v="0">
|
||||||
<m v="0">
|
|
||||||
<!-- <symbol src="assets:omdb/round_speedlimit.svg" symbol-width="30" symbol-height="30"></symbol>-->
|
<!-- <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>
|
stroke-width="1.0"></caption>
|
||||||
<symbol src="assets:omdb/icon_4003_0.png" symbol-width="46" symbol-height="46"></symbol>
|
<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"
|
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
</m>
|
</m>
|
||||||
<m v="1">
|
<m k="speedFlag" v="0">
|
||||||
<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>
|
stroke-width="1.0"></caption>
|
||||||
<symbol src="assets:omdb/icon_4003_1.png" symbol-width="46" symbol-height="46"></symbol>
|
<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"
|
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
</m>
|
||||||
</m>
|
|
||||||
<!--可变点限速-->
|
<!--可变点限速-->
|
||||||
<m v="OMDB_SPEEDLIMIT_VAR">
|
<m v="OMDB_SPEEDLIMIT_VAR">
|
||||||
<m v="0">
|
<m v="0">
|
||||||
<!-- <symbol src="assets:omdb/round_speedlimit.svg" symbol-width="30" symbol-height="30"></symbol>-->
|
<!-- <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>
|
stroke-width="1.0"></caption>
|
||||||
<symbol src="assets:omdb/icon_4004_0.png" symbol-width="46" symbol-height="46"></symbol>
|
<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"
|
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
|
||||||
stroke-width="1.0"></caption>
|
stroke-width="1.0"></caption>
|
||||||
</m>
|
</m>
|
||||||
<m v="1">
|
<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>
|
stroke-width="1.0"></caption>
|
||||||
<symbol src="assets:omdb/icon_4004_1.png" symbol-width="46" symbol-height="46"></symbol>
|
<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"
|
<caption k="minSpeed" dy="-28" fill="#000000" priority="0" size="14" stroke="#ffffff"
|
||||||
@@ -1855,12 +1694,76 @@
|
|||||||
<m v="OMDB_LANE_LINK_LG">
|
<m v="OMDB_LANE_LINK_LG">
|
||||||
<line stroke="#ecf0f1" width="0.1" dasharray="35,35"/>
|
<line stroke="#ecf0f1" width="0.1" dasharray="35,35"/>
|
||||||
</m>
|
</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>
|
||||||
|
<!-- <!–铺设路面边缘–>-->
|
||||||
|
<!-- <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 v="OMDB_LINK_DIRECT">
|
||||||
<m k="direct">
|
<m k="direct">
|
||||||
<m v="2">
|
<m v="2">
|
||||||
<!-- <lineSymbol src="assets:omdb/oneway_right.svg"></lineSymbol>-->
|
<!-- <lineSymbol src="assets:omdb/oneway_right.svg"></lineSymbol>-->
|
||||||
<symbol src="assets:omdb/oneway_right.svg" ></symbol>
|
<lineSymbol src="assets:omdb/oneway_right.svg" ></lineSymbol>
|
||||||
</m>
|
</m>
|
||||||
<m v="3">
|
<m v="3">
|
||||||
<!-- <lineSymbol src="assets:omdb/oneway_left.svg"></lineSymbol>-->
|
<!-- <lineSymbol src="assets:omdb/oneway_left.svg"></lineSymbol>-->
|
||||||
@@ -1874,7 +1777,21 @@
|
|||||||
</m>
|
</m>
|
||||||
<!--普通交限-->
|
<!--普通交限-->
|
||||||
<m v="OMDB_RESTRICTION">
|
<m v="OMDB_RESTRICTION">
|
||||||
<symbol src="assets:omdb/icon_4006_0.png" repeat="false" symbol-width="46" symbol-height="46" rotate="false"></symbol>
|
<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>
|
||||||
</m>
|
</m>
|
||||||
</rendertheme>
|
</rendertheme>
|
||||||
BIN
collect-library/src/main/assets/omdb/area_test.jpg
Normal file
|
After Width: | Height: | Size: 37 KiB |
BIN
collect-library/src/main/assets/omdb/icon_arrow_right.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
collect-library/src/main/assets/omdb/icon_close.png
Normal file
|
After Width: | Height: | Size: 279 B |
BIN
collect-library/src/main/assets/omdb/icon_right.png
Normal file
|
After Width: | Height: | Size: 305 B |
@@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ open class RenderEntity() : RealmObject() {
|
|||||||
lateinit var name: String //要素名
|
lateinit var name: String //要素名
|
||||||
lateinit var table: String //要素表名
|
lateinit var table: String //要素表名
|
||||||
var code: Int = 0 // 要素编码
|
var code: Int = 0 // 要素编码
|
||||||
var geometry: String = ""
|
var geometry: String = "" // 要素渲染参考的geometry,该数据可能会在导入预处理环节被修改,原始geometry会保存在properties的geometry字段下
|
||||||
get() {
|
get() {
|
||||||
wkt = GeometryTools.createGeometry(field)
|
wkt = GeometryTools.createGeometry(field)
|
||||||
return field
|
return field
|
||||||
|
|||||||
@@ -800,6 +800,17 @@ public final class NIMapView extends RelativeLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置logo显隐
|
||||||
|
*
|
||||||
|
* @param position 按钮位置
|
||||||
|
*/
|
||||||
|
public void setLogoVisable(int visable) {
|
||||||
|
if (logoImage != null) {
|
||||||
|
logoImage.setVisibility(visable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置缩放按钮位置
|
* 设置缩放按钮位置
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.navinfo.collect.library.map.handler
|
package com.navinfo.collect.library.map.handler
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.navinfo.collect.library.map.NIMapView
|
import com.navinfo.collect.library.map.NIMapView
|
||||||
import org.oscim.core.BoundingBox
|
import org.oscim.core.BoundingBox
|
||||||
@@ -32,7 +31,7 @@ open class AnimationHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
* latitude: ,longitude:经纬度
|
* 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))
|
mMapView.vtmMap.animator().animateTo(time, GeoPoint(latitude, longitude))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import com.navinfo.collect.library.map.NIMapView
|
import com.navinfo.collect.library.map.NIMapView
|
||||||
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
|
import com.navinfo.collect.library.map.source.MapLifeNiLocationTileSource
|
||||||
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
|
import com.navinfo.collect.library.map.source.NavinfoMultiMapFileTileSource
|
||||||
|
import com.navinfo.collect.library.map.source.OMDBReferenceTileSource
|
||||||
import com.navinfo.collect.library.map.source.OMDBTileSource
|
import com.navinfo.collect.library.map.source.OMDBTileSource
|
||||||
import com.navinfo.collect.library.system.Constant
|
import com.navinfo.collect.library.system.Constant
|
||||||
import okhttp3.Cache
|
import okhttp3.Cache
|
||||||
@@ -45,9 +46,12 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa
|
|||||||
* 显示待测评OMDB数据的图层
|
* 显示待测评OMDB数据的图层
|
||||||
* */
|
* */
|
||||||
private lateinit var omdbVectorTileLayer: VectorTileLayer
|
private lateinit var omdbVectorTileLayer: VectorTileLayer
|
||||||
|
private lateinit var omdbReferenceTileLayer: VectorTileLayer
|
||||||
private lateinit var omdbLabelLayer: LabelLayer
|
private lateinit var omdbLabelLayer: LabelLayer
|
||||||
|
private lateinit var omdbReferenceLabelLayer: LabelLayer
|
||||||
|
|
||||||
private val omdbTileSource by lazy { OMDBTileSource() }
|
private val omdbTileSource by lazy { OMDBTileSource() }
|
||||||
|
private val omdbReferenceTileSource by lazy { OMDBReferenceTileSource() }
|
||||||
|
|
||||||
init {
|
init {
|
||||||
initMap()
|
initMap()
|
||||||
@@ -99,6 +103,17 @@ class LayerManagerHandler(context: AppCompatActivity, mapView: NIMapView,tracePa
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initOMDBVectorTileLayer() {
|
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)
|
omdbVectorTileLayer = VectorTileLayer(mMapView.vtmMap, omdbTileSource)
|
||||||
omdbLabelLayer = LabelLayer(mMapView.vtmMap, omdbVectorTileLayer, LabelTileLoaderHook(), Constant.OMDB_MIN_ZOOM)
|
omdbLabelLayer = LabelLayer(mMapView.vtmMap, omdbVectorTileLayer, LabelTileLoaderHook(), Constant.OMDB_MIN_ZOOM)
|
||||||
if(omdbVectorTileLayer!=null){
|
if(omdbVectorTileLayer!=null){
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import androidx.annotation.RequiresApi
|
|||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import com.navinfo.collect.library.R
|
import com.navinfo.collect.library.R
|
||||||
import com.navinfo.collect.library.map.NIMapView
|
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.map.layers.OmdbTaskLinkLayer
|
||||||
import com.navinfo.collect.library.utils.GeometryTools
|
import com.navinfo.collect.library.utils.GeometryTools
|
||||||
import com.navinfo.collect.library.utils.StringUtil
|
import com.navinfo.collect.library.utils.StringUtil
|
||||||
@@ -62,6 +63,12 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
|||||||
|
|
||||||
private val mDefaultPathLayer: PathLayer
|
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 by lazy {
|
||||||
val omdbTaskLinkLayer = OmdbTaskLinkLayer(
|
val omdbTaskLinkLayer = OmdbTaskLinkLayer(
|
||||||
mMapView.vtmMap,
|
mMapView.vtmMap,
|
||||||
@@ -375,7 +382,7 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun clean() {
|
fun clear() {
|
||||||
mPathLayer.clearPath()
|
mPathLayer.clearPath()
|
||||||
mPathLayer.isEnabled = false
|
mPathLayer.isEnabled = false
|
||||||
mPathLayerTemp.clearPath()
|
mPathLayerTemp.clearPath()
|
||||||
@@ -385,5 +392,7 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
|
|||||||
mPathMakers.clear()
|
mPathMakers.clear()
|
||||||
editIndex = -1
|
editIndex = -1
|
||||||
bDrawLine = false
|
bDrawLine = false
|
||||||
|
omdbTaskLinkLayer.removeAll()
|
||||||
|
linksLayer.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
package com.navinfo.collect.library.map.source;
|
||||||
|
|
||||||
|
import static org.oscim.core.MercatorProjection.latitudeToY;
|
||||||
|
import static org.oscim.core.MercatorProjection.longitudeToX;
|
||||||
|
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
|
import androidx.annotation.RequiresApi;
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.data.entity.ReferenceEntity;
|
||||||
|
|
||||||
|
import org.locationtech.jts.geom.Coordinate;
|
||||||
|
import org.locationtech.jts.geom.Geometry;
|
||||||
|
import org.locationtech.jts.geom.GeometryFactory;
|
||||||
|
import org.locationtech.jts.geom.LineString;
|
||||||
|
import org.locationtech.jts.geom.MultiLineString;
|
||||||
|
import org.locationtech.jts.geom.MultiPoint;
|
||||||
|
import org.locationtech.jts.geom.MultiPolygon;
|
||||||
|
import org.locationtech.jts.geom.Point;
|
||||||
|
import org.locationtech.jts.geom.Polygon;
|
||||||
|
import org.oscim.core.MapElement;
|
||||||
|
import org.oscim.core.Tag;
|
||||||
|
import org.oscim.core.Tile;
|
||||||
|
import org.oscim.tiling.ITileDataSink;
|
||||||
|
import org.oscim.tiling.source.mvt.TileDecoder;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class OMDBReferenceDecoder extends TileDecoder {
|
||||||
|
private final String mLocale;
|
||||||
|
|
||||||
|
private static final float REF_TILE_SIZE = 4096.0f;
|
||||||
|
|
||||||
|
private final GeometryFactory mGeomFactory;
|
||||||
|
private final MapElement mMapElement;
|
||||||
|
private ITileDataSink mTileDataSink;
|
||||||
|
private double mTileY, mTileX, mTileScale;
|
||||||
|
|
||||||
|
public OMDBReferenceDecoder() {
|
||||||
|
super();
|
||||||
|
mLocale = "";
|
||||||
|
mGeomFactory = new GeometryFactory();
|
||||||
|
mMapElement = new MapElement();
|
||||||
|
mMapElement.layer = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean decode(Tile tile, ITileDataSink sink, InputStream is) throws IOException {
|
||||||
|
mTileDataSink = sink;
|
||||||
|
mTileScale = 1 << tile.zoomLevel;
|
||||||
|
mTileX = tile.tileX / mTileScale;
|
||||||
|
mTileY = tile.tileY / mTileScale;
|
||||||
|
mTileScale *= Tile.SIZE;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||||
|
public boolean decode(Tile tile, ITileDataSink sink, List<ReferenceEntity> listResult) {
|
||||||
|
mTileDataSink = sink;
|
||||||
|
mTileScale = 1 << tile.zoomLevel;
|
||||||
|
mTileX = tile.tileX / mTileScale;
|
||||||
|
mTileY = tile.tileY / mTileScale;
|
||||||
|
mTileScale *= Tile.SIZE;
|
||||||
|
|
||||||
|
listResult.stream().iterator().forEachRemaining(new Consumer<ReferenceEntity>() {
|
||||||
|
@Override
|
||||||
|
public void accept(ReferenceEntity renderEntity) {
|
||||||
|
// Log.d("RealmDBTileDataSource", renderEntity.getGeometry());
|
||||||
|
Map<String, Object> properties= new HashMap<>(renderEntity.getProperties().size());
|
||||||
|
properties.putAll(renderEntity.getProperties());
|
||||||
|
parseGeometry(renderEntity.getTable(), renderEntity.getWkt(), properties);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void parseGeometry(String layerName, Geometry geometry, Map<String, Object> tags) {
|
||||||
|
mMapElement.clear();
|
||||||
|
mMapElement.tags.clear();
|
||||||
|
|
||||||
|
parseTags(tags, layerName);
|
||||||
|
if (mMapElement.tags.size() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean err = false;
|
||||||
|
if (geometry instanceof Point) {
|
||||||
|
mMapElement.startPoints();
|
||||||
|
processCoordinateArray(geometry.getCoordinates(), false);
|
||||||
|
} else if (geometry instanceof MultiPoint) {
|
||||||
|
MultiPoint multiPoint = (MultiPoint) geometry;
|
||||||
|
for (int i = 0; i < multiPoint.getNumGeometries(); i++) {
|
||||||
|
mMapElement.startPoints();
|
||||||
|
processCoordinateArray(multiPoint.getGeometryN(i).getCoordinates(), false);
|
||||||
|
}
|
||||||
|
} else if (geometry instanceof LineString) {
|
||||||
|
processLineString((LineString) geometry);
|
||||||
|
} else if (geometry instanceof MultiLineString) {
|
||||||
|
MultiLineString multiLineString = (MultiLineString) geometry;
|
||||||
|
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
|
||||||
|
processLineString((LineString) multiLineString.getGeometryN(i));
|
||||||
|
}
|
||||||
|
} else if (geometry instanceof Polygon) {
|
||||||
|
Polygon polygon = (Polygon) geometry;
|
||||||
|
processPolygon(polygon);
|
||||||
|
} else if (geometry instanceof MultiPolygon) {
|
||||||
|
MultiPolygon multiPolygon = (MultiPolygon) geometry;
|
||||||
|
for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
|
||||||
|
processPolygon((Polygon) multiPolygon.getGeometryN(i));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!err) {
|
||||||
|
mTileDataSink.process(mMapElement);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processLineString(LineString lineString) {
|
||||||
|
mMapElement.startLine();
|
||||||
|
processCoordinateArray(lineString.getCoordinates(), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processPolygon(Polygon polygon) {
|
||||||
|
mMapElement.startPolygon();
|
||||||
|
processCoordinateArray(polygon.getExteriorRing().getCoordinates(), true);
|
||||||
|
for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
|
||||||
|
mMapElement.startHole();
|
||||||
|
processCoordinateArray(polygon.getInteriorRingN(i).getCoordinates(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processCoordinateArray(Coordinate[] coordinates, boolean removeLast) {
|
||||||
|
int length = removeLast ? coordinates.length - 1 : coordinates.length;
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
mMapElement.addPoint((float) ((longitudeToX(coordinates[i].x) - mTileX) * mTileScale),
|
||||||
|
(float) ((latitudeToY(coordinates[i].y) - mTileY) * mTileScale));
|
||||||
|
}
|
||||||
|
|
||||||
|
// int length = removeLast ? coordinates.length - 1 : coordinates.length;
|
||||||
|
// // 初始化3D数据类型
|
||||||
|
// float[] point3D = new float[coordinates.length*3];
|
||||||
|
// for (int i = 0; i < length; i++) {
|
||||||
|
// point3D[i*3] = (float) coordinates[i].x;
|
||||||
|
// point3D[(i*3)+1] = (float) coordinates[i].y;
|
||||||
|
// point3D[(i*3)+2] = (float) coordinates[i].z;
|
||||||
|
// }
|
||||||
|
// mMapElement.points = point3D;
|
||||||
|
// mMapElement.pointNextPos = mMapElement.points.length;
|
||||||
|
// mMapElement.type = GeometryBuffer.GeometryType.TRIS;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void parseTags(Map<String, Object> map, String layerName) {
|
||||||
|
mMapElement.tags.add(new Tag("layer", layerName));
|
||||||
|
boolean hasName = false;
|
||||||
|
String fallbackName = null;
|
||||||
|
for (Map.Entry<String, Object> entry : map.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
Object value = entry.getValue();
|
||||||
|
String val = (value instanceof String) ? (String) value : String.valueOf(value);
|
||||||
|
if (key.startsWith(Tag.KEY_NAME)) {
|
||||||
|
int len = key.length();
|
||||||
|
if (len == 4) {
|
||||||
|
fallbackName = val;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (len < 7)
|
||||||
|
continue;
|
||||||
|
if (mLocale.equals(key.substring(5))) {
|
||||||
|
hasName = true;
|
||||||
|
mMapElement.tags.add(new Tag(Tag.KEY_NAME, val, false));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mMapElement.tags.add(new Tag(key, val));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasName && fallbackName != null)
|
||||||
|
mMapElement.tags.add(new Tag(Tag.KEY_NAME, fallbackName, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.navinfo.collect.library.map.source;
|
||||||
|
|
||||||
|
import com.navinfo.collect.library.system.Constant;
|
||||||
|
|
||||||
|
import org.oscim.tiling.ITileDataSource;
|
||||||
|
import org.oscim.tiling.OverzoomTileDataSource;
|
||||||
|
import org.oscim.tiling.TileSource;
|
||||||
|
|
||||||
|
public class OMDBReferenceTileSource extends TileSource {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITileDataSource getDataSource() {
|
||||||
|
return new OverzoomTileDataSource(new OMDBReferenceDataSource(), Constant.OVER_ZOOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OpenResult open() {
|
||||||
|
return OpenResult.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,8 +39,7 @@ public class OMDBTileDataSource implements ITileDataSource {
|
|||||||
int yStart = (int) tile.tileY << m;
|
int yStart = (int) tile.tileY << m;
|
||||||
int yEnd = (int) ((tile.tileY + 1) << m);
|
int yEnd = (int) ((tile.tileY + 1) << m);
|
||||||
|
|
||||||
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class)
|
RealmQuery<RenderEntity> realmQuery = Realm.getDefaultInstance().where(RenderEntity.class).rawPredicate("tileX>=" + xStart + " and tileX<=" + xEnd + " and tileY>=" + yStart + " and tileY<=" + yEnd);
|
||||||
.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) {
|
if (Constant.HAD_LAYER_INVISIABLE_ARRAY != null && Constant.HAD_LAYER_INVISIABLE_ARRAY.length > 0) {
|
||||||
realmQuery.beginGroup();
|
realmQuery.beginGroup();
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<color name="transp">#00000000</color>
|
<color name="transp">#00000000</color>
|
||||||
<color name="teal_200">#FF03DAC5</color>
|
<color name="teal_200">#7F03DAC5</color>
|
||||||
<color name="black">#FF000000</color>
|
<color name="black">#FF000000</color>
|
||||||
<color name="white">#FFFFFFFF</color>
|
<color name="white">#FFFFFFFF</color>
|
||||||
<color name="transparent">#00FFFFFF</color>
|
<color name="transparent">#00FFFFFF</color>
|
||||||
|
|||||||