|
@@ -36,29 +36,10 @@ class Space3DViewModel(private val repo: Space3DRepository) : ViewModel() {
|
|
|
success: (List<BuildingEntity>, ArrayList<ArrayList<FloorEntity>>) -> Unit
|
|
|
) {
|
|
|
viewModelScope.launch {
|
|
|
- val buildingList = ArrayList<BuildingEntity>()
|
|
|
val floorList = ArrayList<ArrayList<FloorEntity>>()
|
|
|
val buildings = repo.getBuilding(projectId)
|
|
|
-// buildingList.addAll(buildings)
|
|
|
for (building in buildings!!) {
|
|
|
- var floors = repo.getFloors(building.id)
|
|
|
- var sortFloors = ArrayList<FloorEntity>()
|
|
|
-// for (floor in floors!!) {
|
|
|
-// val floorSequenceID = (gson.fromJson(
|
|
|
-// floor.infos,
|
|
|
-// InfosforFloor::class.java
|
|
|
-// )).floorSequenceID
|
|
|
-// for (sortFl in sortFloors) {
|
|
|
-// val sortFlSequenceID = (gson.fromJson(
|
|
|
-// sortFl.infos,
|
|
|
-// InfosforFloor::class.java
|
|
|
-// )).floorSequenceID
|
|
|
-// if (floorSequenceID < sortFlSequenceID) {
|
|
|
-//
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
+ val floors = repo.getFloors(building.id)
|
|
|
floors!!.sortedByDescending { floor ->
|
|
|
(gson.fromJson(
|
|
|
floor.infos,
|
|
@@ -66,7 +47,7 @@ class Space3DViewModel(private val repo: Space3DRepository) : ViewModel() {
|
|
|
)).floorSequenceID
|
|
|
}
|
|
|
if (isNull(floors)) {
|
|
|
- floorList.add(ArrayList<FloorEntity>())
|
|
|
+ floorList.add(ArrayList())
|
|
|
} else {
|
|
|
floorList.add(floors!! as ArrayList<FloorEntity>)
|
|
|
}
|
|
@@ -161,15 +142,15 @@ class Space3DViewModel(private val repo: Space3DRepository) : ViewModel() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- fun getProblems(floorId: String, success: (String, String, String) -> Unit) {
|
|
|
+ fun getProblems(floorId: String, floorHeight: Double?, success: (String, String, String) -> Unit) {
|
|
|
viewModelScope.launch {
|
|
|
val problems = repo.getProblemsByFloorId(floorId)
|
|
|
val tipArrayList = ArrayList<TipArray>()
|
|
|
val lineArrayList = ArrayList<LineArray>()
|
|
|
val iDList = ArrayList<String>()
|
|
|
for (problem in problems) {
|
|
|
- val info = gson.fromJson(problem.info, HashMap::class.java) as HashMap<String, Any>
|
|
|
- if (!TextUtils.isEmpty(problem.objId)) {
|
|
|
+ val info = gson.fromJson(problem.info, HashMap::class.java) as HashMap<*, *>
|
|
|
+ if (!TextUtils.isEmpty(problem.objId) && problem.objId.contains("/")) {
|
|
|
iDList.add(problem.objId)
|
|
|
}
|
|
|
if (info["position"] != null && info["position"] is LinkedTreeMap<*, *>) {
|
|
@@ -183,9 +164,14 @@ class Space3DViewModel(private val repo: Space3DRepository) : ViewModel() {
|
|
|
} else if (info["position"] != null && info["position"] is ArrayList<*> && !isNull(info["position"])) {
|
|
|
val lineArray = LineArray()
|
|
|
lineArray.ID = problem.objId
|
|
|
- lineArray.Points = info["position"] as java.util.ArrayList<PointZ>?
|
|
|
+ lineArray.Points = info["position"] as ArrayList<PointZ>?
|
|
|
lineArray.IsLoop = info["isClose"] as Boolean?
|
|
|
lineArray.IsLaQi = info["isClose"] as Boolean?
|
|
|
+ if (problem.typeCode == "CFCSFL_LESS" || problem.typeCode == "CFCSFL_HOLE_LESS" || problem.typeCode == "CFCSFL_ELEVATION_ERROR") {
|
|
|
+ lineArray.LaQiHeight = 0.3
|
|
|
+ } else {
|
|
|
+// lineArray.LaQiHeight = 3.28
|
|
|
+ }
|
|
|
lineArrayList.add(lineArray)
|
|
|
|
|
|
val tipArray = TipArray()
|