Browse Source

@fun 3D土建精装

lihao1 2 years ago
parent
commit
703831b88a

+ 5 - 2
app/src/main/AndroidManifest.xml

@@ -1,8 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          xmlns:tools="http://schemas.android.com/tools" package="com.ys.bdtp.adm">
+          xmlns:tools="http://schemas.android.com/tools"
+          package="com.ys.bdtp.adm">
 
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:ignore="ScopedStorage"/>
+    <uses-permission
+            android:name="android.permission.WRITE_EXTERNAL_STORAGE"
+            tools:ignore="ScopedStorage"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERNET"/>

+ 1 - 0
app/src/main/java/com/ys/bdtp/adm/mvvm/model/vo/LineArray.java

@@ -11,5 +11,6 @@ public class LineArray {
     public Boolean IsLaQi;
     public Boolean IsFullColor = false;
     public Double LineWidth = 3d;
+    public Double LaQiHeight;
 
 }

+ 6 - 16
app/src/main/java/com/ys/bdtp/adm/mvvm/ui/examine/InfoAdapter.java

@@ -123,28 +123,18 @@ public class InfoAdapter extends BaseRecyclerViewAdapter<ProblemInfoConfigEntity
                 break;
             case "ENUM":
                 TextView enumTv = holder.getView(R.id.tv);
-//                TextView enumUnit = holder.getView(R.id.unit);
                 TextView enumTitle = holder.getView(R.id.title);
                 enumTitle.setText(info.getName());
-//                if (TextUtils.isEmpty(info.getUnit())) {
-//                    enumUnit.setVisibility(View.GONE);
-//                } else {
-//                    enumUnit.setVisibility(View.VISIBLE);
-//                    enumUnit.setText(info.getUnit());
-//                }
                 if (!valueList.contains(info.getCode())) {
                     if (hashMap != null && hashMap.get(info.getCode()) != null) {
-                        ArrayList<String> value = new Gson().fromJson(Objects.requireNonNull(hashMap.get(info.getCode())).toString(), new TypeToken<List<String>>() {
+                        String value = hashMap.get(info.getCode()).toString();
+                        List<Options> models = gson.fromJson(info.getDataSource(), new TypeToken<List<Options>>() {
                         }.getType());
-                        StringBuilder sb = new StringBuilder();
-                        for (int i = 0; i < value.size(); i++) {
-//                            for (int j = 0; j < info.getDataSource().size(); j++) {
-//                                if (info.getDataSource().get(j).getCode().equals(value.get(i))) {
-//                                    sb.append(info.getDataSource().get(j).getName()).append("、");
-//                                }
-//                            }
+                        for (Options option : models) {
+                            if (option.getCode().equals(value)) {
+                                enumTv.setText(option.getName());
+                            }
                         }
-                        enumTv.setText(sb.toString());
                     }
                 }
                 valueList.add(info.getCode());

+ 6 - 3
app/src/main/java/com/ys/bdtp/adm/mvvm/ui/examine/Space3DActivity.kt

@@ -57,6 +57,7 @@ class Space3DActivity : RxAppCompatActivity(), DIAware, View.OnClickListener {
     private lateinit var floorEntity: FloorEntity
     private var info: ProblemInfoConfigEntity? = null
     private var currentPosition: Int? = 0
+    private var floorHeight: Double? = 0.0
     val beans: ArrayList<Photos> = ArrayList()
 
     //选择图片
@@ -437,6 +438,7 @@ class Space3DActivity : RxAppCompatActivity(), DIAware, View.OnClickListener {
 //                if (isLastSpace) {
                 runOnUiThread {
                     val floorInfo = gson.fromJson(floorEntity.infos, InfosforFloor::class.java)
+                    floorHeight = floorInfo.height
                     val model = SetFloorPathModel(
                         projectId, floorInfo.bimIdPre, floorInfo.floorElevation, floorInfo.height
                     )
@@ -458,7 +460,7 @@ class Space3DActivity : RxAppCompatActivity(), DIAware, View.OnClickListener {
             "LoadAllModelWithFloor" -> {
                 runOnUiThread {
                     Thread.sleep(500)
-                    mVm.getProblems(floorEntity.id, success = { s1, s2, lineArrayString ->
+                    mVm.getProblems(floorEntity.id, floorHeight, success = { s1, s2, lineArrayString ->
                         webview.loadUrl("javascript:SetStyleWithMeshID('${s2}')")
                         Thread.sleep(300)
                         webview.loadUrl("javascript:ShowAllLine('${lineArrayString}')")
@@ -898,15 +900,16 @@ class Space3DActivity : RxAppCompatActivity(), DIAware, View.OnClickListener {
                     projectId,
                     success = {
                         refresh3DView()
-                        mVm.getProblems(floorEntity.id, success = { s1, s2, lineArrayString ->
+                        mVm.getProblems(floorEntity.id, floorHeight, success = { s1, s2, lineArrayString ->
                             webview.loadUrl("javascript:SetStyleWithMeshID('${s2}')")
                             Thread.sleep(300)
                             webview.loadUrl("javascript:ShowAllLine('${lineArrayString}')")
                             Thread.sleep(300)
                             webview.loadUrl("javascript:AddTipView('${s1}')")
+                            isClose = false
                         })
                     })
-                isClose = false
+
             }
 
             R.id.detailClose -> {

+ 11 - 25
app/src/main/java/com/ys/bdtp/adm/mvvm/vm/examine/Space3DViewModel.kt

@@ -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()

BIN
app/src/main/res/drawable-xxhdpi/choseicon_green.png