|
@@ -1,44 +1,68 @@
|
|
|
package com.ys.bdtp.adm.mvvm.ui.examine
|
|
|
|
|
|
+import android.Manifest
|
|
|
import android.annotation.SuppressLint
|
|
|
import android.content.Context
|
|
|
import android.content.Intent
|
|
|
+import android.content.pm.PackageManager
|
|
|
+import android.graphics.Color
|
|
|
+import android.os.Build
|
|
|
import android.os.Bundle
|
|
|
+import android.util.Log
|
|
|
import android.view.View
|
|
|
import android.webkit.JavascriptInterface
|
|
|
import android.webkit.WebSettings
|
|
|
import android.webkit.WebView
|
|
|
import android.webkit.WebViewClient
|
|
|
-import android.widget.ImageView
|
|
|
-import android.widget.LinearLayout
|
|
|
-import android.widget.TextView
|
|
|
-import android.widget.Toast
|
|
|
-import androidx.activity.ComponentActivity
|
|
|
+import android.widget.*
|
|
|
+import androidx.annotation.RequiresApi
|
|
|
import androidx.cardview.widget.CardView
|
|
|
+import androidx.core.app.ActivityCompat
|
|
|
+import androidx.recyclerview.widget.LinearLayoutManager
|
|
|
+import androidx.recyclerview.widget.RecyclerView
|
|
|
+import com.bumptech.glide.Glide
|
|
|
import com.google.gson.Gson
|
|
|
import com.google.gson.reflect.TypeToken
|
|
|
+import com.sybotan.android.demo.adapter.ExpandAdapter
|
|
|
+import com.trello.rxlifecycle2.components.support.RxAppCompatActivity
|
|
|
import com.ys.bdtp.adm.R
|
|
|
-import com.ys.bdtp.adm.mvvm.model.vo.Object
|
|
|
+import com.ys.bdtp.adm.mvvm.model.db.entity.config.ProblemInfoConfigEntity
|
|
|
+import com.ys.bdtp.adm.mvvm.model.db.entity.task.FloorEntity
|
|
|
import com.ys.bdtp.adm.mvvm.model.vo.*
|
|
|
-import com.ys.bdtp.adm.mvvm.vm.offline.OfflineViewModel
|
|
|
+import com.ys.bdtp.adm.mvvm.ui.examine.LocalDataOperation.*
|
|
|
+import com.ys.bdtp.adm.mvvm.vm.examine.Space3DViewModel
|
|
|
+import com.yuyh.library.imgsel.ImageLoader
|
|
|
+import com.yuyh.library.imgsel.ImgSelConfig
|
|
|
+import io.reactivex.ObservableEmitter
|
|
|
import org.kodein.di.DI
|
|
|
import org.kodein.di.DIAware
|
|
|
import org.kodein.di.android.closestDI
|
|
|
-import org.kodein.di.instance
|
|
|
+import org.kodein.di.android.x.viewmodel.viewModel
|
|
|
+import java.io.File
|
|
|
+import java.util.HashMap
|
|
|
|
|
|
-class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
+class Space3DActivity : RxAppCompatActivity(), DIAware, View.OnClickListener {
|
|
|
|
|
|
override val di: DI by closestDI()
|
|
|
- val vm by instance<OfflineViewModel>()
|
|
|
+ private val mVm: Space3DViewModel by viewModel()
|
|
|
var isLastSpace = false
|
|
|
var isLockCamera = false
|
|
|
var meshObject: MeshObjectModel? = null
|
|
|
- private lateinit var buildingId: String
|
|
|
- private lateinit var floorId: String
|
|
|
+ var pointZModel: PointZ? = null
|
|
|
+ var lineModel: ArrayList<PointZ?>? = ArrayList()
|
|
|
+ var isClose = false
|
|
|
private lateinit var projectId: String
|
|
|
private var objTypeCode: String = ""
|
|
|
private var problemTypeCode: String = ""
|
|
|
- private lateinit var floorEntity: Object
|
|
|
+ private lateinit var floorEntity: FloorEntity
|
|
|
+ private var info: ProblemInfoConfigEntity? = null
|
|
|
+ private var currentPosition: Int? = 0
|
|
|
+ val beans: ArrayList<Photos> = ArrayList()
|
|
|
+
|
|
|
+ //选择图片
|
|
|
+ private val REQUEST_CODE_PIC = 0X102
|
|
|
+ private lateinit var adapter: InfoAdapter
|
|
|
+
|
|
|
private lateinit var tv2d: TextView
|
|
|
private lateinit var tv3d: TextView
|
|
|
private lateinit var compass: TextView
|
|
@@ -62,6 +86,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
private lateinit var quitTools: LinearLayout
|
|
|
private lateinit var mapTools: LinearLayout
|
|
|
private lateinit var cameraTypeTools: LinearLayout
|
|
|
+ private lateinit var reviseLl: LinearLayout
|
|
|
private lateinit var point: TextView
|
|
|
private lateinit var pline: TextView
|
|
|
private lateinit var close: TextView
|
|
@@ -70,6 +95,8 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
private lateinit var delete: TextView
|
|
|
private lateinit var quit: TextView
|
|
|
private lateinit var problemDone: TextView
|
|
|
+ private lateinit var projectName: TextView
|
|
|
+ private lateinit var signProblemTitle: TextView
|
|
|
|
|
|
private lateinit var less: TextView
|
|
|
private lateinit var more: TextView
|
|
@@ -81,12 +108,25 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
private lateinit var floorslabLess: TextView
|
|
|
private lateinit var plantHoleLess: TextView
|
|
|
private lateinit var floorslabHeightError: TextView
|
|
|
+ private lateinit var saveProblem: TextView
|
|
|
+ private lateinit var detailClose: ImageView
|
|
|
+ private lateinit var detailContent: TextView
|
|
|
private lateinit var signProblem: CardView
|
|
|
private lateinit var closeProblem: ImageView
|
|
|
+ private lateinit var deleteProblem: ImageView
|
|
|
+ private lateinit var back: ImageView
|
|
|
+ private lateinit var infoRv: RecyclerView
|
|
|
+ private lateinit var expandLv: ExpandableListView
|
|
|
+ private lateinit var detailRl: RelativeLayout
|
|
|
|
|
|
companion object {
|
|
|
private lateinit var webview: WebView
|
|
|
|
|
|
+ private var FLOORINFO =
|
|
|
+ "{\"FloorElevation\":-5.5,\"FloorHeight\":5.5,\"FloorID\":\"Pj11010806656c41de285cd811ecbf08c3f8f21bae69B1\",\"PorjectID\":\"Pj1101080665\"}"
|
|
|
+
|
|
|
+ private var FLOORNAME = "京东科技大厦 负一层"
|
|
|
+
|
|
|
/*lateinit var viewModel: Space3DVM*/
|
|
|
val gson = Gson()
|
|
|
|
|
@@ -101,6 +141,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @RequiresApi(Build.VERSION_CODES.R)
|
|
|
@SuppressLint("SetJavaScriptEnabled")
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
super.onCreate(savedInstanceState)
|
|
@@ -109,7 +150,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
buildingId = floor.getString("buildingId", "")
|
|
|
floorId = floor.getString("floorId", "")
|
|
|
projectId = floor.getString("projectId", "")*/
|
|
|
- projectId = intent.getStringExtra("projectId") ?: ""
|
|
|
+ projectId = intent.getStringExtra("projectId") ?: "Pj1101080665"
|
|
|
initView()
|
|
|
webview.clearCache(true)
|
|
|
WebView.setWebContentsDebuggingEnabled(true)
|
|
@@ -123,14 +164,18 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
loadWithOverviewMode = true
|
|
|
domStorageEnabled = true
|
|
|
databaseEnabled = true
|
|
|
+ setSupportZoom(false)
|
|
|
+ setBuiltInZoomControls(false)
|
|
|
+ setUseWideViewPort(false)
|
|
|
mixedContentMode = WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
|
|
}
|
|
|
+ WebView.setWebContentsDebuggingEnabled(true)
|
|
|
webview.addJavascriptInterface(this, "android")
|
|
|
webview.webViewClient = MyWebViewClient()
|
|
|
webview.loadUrl("http://60.205.177.43:8000/APP/")
|
|
|
+// webview.loadUrl("http://60.205.177.43:8000/APP_1/#/")
|
|
|
+// webview.loadUrl("http://172.16.5.17:8080/")
|
|
|
// webview.loadUrl("file:///android_asset/dist/index.html")
|
|
|
-
|
|
|
-
|
|
|
/*viewModel = Space3DVM(this.application, { name, param ->
|
|
|
when (name) {
|
|
|
Space3DVM.FLOOR_SPACE -> {
|
|
@@ -166,6 +211,44 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
}
|
|
|
}
|
|
|
}, this, projectId, buildingId, floorId)*/
|
|
|
+ mVm.getBuildingFloor(projectId, success = { buildingList, floorList ->
|
|
|
+ val exAdapter = ExpandAdapter(this, buildingList, floorList)
|
|
|
+ for (floors in floorList) {
|
|
|
+ floors.sortByDescending { floor ->
|
|
|
+ (gson.fromJson(
|
|
|
+ floor.infos, InfosforFloor::class.java
|
|
|
+ )).floorSequenceID
|
|
|
+ }
|
|
|
+ for (floor in floors) {
|
|
|
+ if (floor.id == "Fl99099900021206b35236df4465845b9dae69ae45bf") {
|
|
|
+ floorEntity = floor
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ expandLv.setAdapter(exAdapter)
|
|
|
+ expandLv.setOnChildClickListener { parent, v, groupPosition, childPosition, id ->
|
|
|
+ floorEntity = floorList[groupPosition][childPosition]
|
|
|
+ projectName.text = "${buildingList[groupPosition].localName} ${floorEntity.localName}"
|
|
|
+ FLOORNAME = "${buildingList[groupPosition].localName} ${floorEntity.localName}"
|
|
|
+ expandLv.visibility = View.GONE
|
|
|
+ runOnUiThread {
|
|
|
+ mVm.getFloorSpace(success = {
|
|
|
+// webview.loadUrl("javascript:SetSpaceData('${""}')")
|
|
|
+ val floorInfo = gson.fromJson(floorEntity.infos, InfosforFloor::class.java)
|
|
|
+ val model = SetFloorPathModel(
|
|
|
+ projectId, floorInfo.bimIdPre, floorInfo.floorElevation, floorInfo.height
|
|
|
+ )
|
|
|
+ val toJson = gson.toJson(model)
|
|
|
+ webview.loadUrl("javascript:SetFloorPath('${toJson}')")
|
|
|
+ FLOORINFO = toJson
|
|
|
+ chooseObject.performClick()
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ true
|
|
|
+ }
|
|
|
+ })
|
|
|
+ checkStoragePermission()
|
|
|
}
|
|
|
|
|
|
private fun initView() {
|
|
@@ -216,7 +299,19 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
floorslabHeightError = findViewById(R.id.floorslabHeightError)
|
|
|
signProblem = findViewById(R.id.signProblem)
|
|
|
closeProblem = findViewById(R.id.closeProblem)
|
|
|
-
|
|
|
+ infoRv = findViewById(R.id.infoRv)
|
|
|
+ expandLv = findViewById(R.id.expandLv)
|
|
|
+ expandLv.setGroupIndicator(null)
|
|
|
+ projectName = findViewById(R.id.projectName)
|
|
|
+ saveProblem = findViewById(R.id.saveProblem)
|
|
|
+ signProblemTitle = findViewById(R.id.signProblemTitle)
|
|
|
+ reviseLl = findViewById(R.id.reviseLl)
|
|
|
+ deleteProblem = findViewById(R.id.deleteProblem)
|
|
|
+ back = findViewById(R.id.back)
|
|
|
+ detailRl = findViewById(R.id.detailRl)
|
|
|
+ detailClose = findViewById(R.id.detailClose)
|
|
|
+ detailContent = findViewById(R.id.detailContent)
|
|
|
+ infoRv.layoutManager = LinearLayoutManager(this)
|
|
|
less.setOnClickListener(this)
|
|
|
more.setOnClickListener(this)
|
|
|
materialError.setOnClickListener(this)
|
|
@@ -250,6 +345,12 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
quit.setOnClickListener(this)
|
|
|
closeProblem.setOnClickListener(this)
|
|
|
save.setOnClickListener(this)
|
|
|
+ delete.setOnClickListener(this)
|
|
|
+ record.setOnClickListener(this)
|
|
|
+ projectName.setOnClickListener(this)
|
|
|
+ back.setOnClickListener(this)
|
|
|
+ saveProblem.setOnClickListener(this)
|
|
|
+ detailClose.setOnClickListener(this)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -259,21 +360,57 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
forwardTools.visibility = View.GONE
|
|
|
reverseTools.visibility = View.GONE
|
|
|
meshObject = gson.fromJson(meshObjectString, MeshObjectModel::class.java)
|
|
|
- Toast.makeText(this, meshObject!!.ID, Toast.LENGTH_LONG).show()
|
|
|
+ if (meshObject?.ID!!.contains("Door")) {
|
|
|
+ detailContent.text = "设备类型:CFCSDR普通门\nBimID:\n数字化交付编码:\n尺寸:900x2000mm\n材质:常规"
|
|
|
+ } else if (meshObject?.ID!!.contains("Window")) {
|
|
|
+ detailContent.text = "设备类型:CFCSWN普通窗\nBimID:\n数字化交付编码:\n尺寸:800x1600mm"
|
|
|
+ } else if (meshObject?.ID!!.contains("Column")) {
|
|
|
+ detailContent.text = "设备类型:CFCSCL柱\nBimID:\n数字化交付编码:\n尺寸:800x800mm"
|
|
|
+ }
|
|
|
+ detailRl.visibility = View.VISIBLE
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @JavascriptInterface
|
|
|
+ fun OutMeshClick(meshObjectString: String) {
|
|
|
+ runOnUiThread {
|
|
|
+ forwardTools.visibility = View.GONE
|
|
|
+ reverseTools.visibility = View.GONE
|
|
|
+ meshObject = null
|
|
|
+ detailRl.visibility = View.GONE
|
|
|
+ signProblem.visibility = View.GONE
|
|
|
+// Toast.makeText(this, meshObject!!.ID, Toast.LENGTH_LONG).show()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
|
fun EndDrawPointModel(pointModel: String) {
|
|
|
runOnUiThread {
|
|
|
- val point = gson.fromJson(pointModel, PointZ::class.java)
|
|
|
+ val fromJson = gson.fromJson(pointModel, PointModel::class.java)
|
|
|
+ pointZModel = fromJson.Position
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@JavascriptInterface
|
|
|
fun EndDrawLineModel(lineObject: String) {
|
|
|
runOnUiThread {
|
|
|
- val line = gson.fromJson<ArrayList<PointZ?>?>(lineObject, object : TypeToken<ArrayList<PointZ?>?>() {}.type)
|
|
|
+ lineModel = gson.fromJson(lineObject, LineObject::class.java).Points
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @JavascriptInterface
|
|
|
+ fun TipViewClick(tipObjectString: String) {
|
|
|
+ runOnUiThread {
|
|
|
+// Toast.makeText(this, tipObjectString, Toast.LENGTH_LONG).show()
|
|
|
+ val tipObject = gson.fromJson(tipObjectString, TipArray.Param()::class.java)
|
|
|
+ mVm.getProblemByObjId(tipObject, success = {
|
|
|
+ signProblem.visibility = View.VISIBLE
|
|
|
+ initShowInfo()
|
|
|
+ objTypeCode = it.objTypeCode
|
|
|
+ problemTypeCode = it.typeCode
|
|
|
+ val hashMap = gson.fromJson(it.info, HashMap::class.java) as HashMap<String, Any>
|
|
|
+ initInfo(hashMap)
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -282,24 +419,35 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
val nameObject = gson.fromJson(name, FunctionEndBlockModel::class.java)
|
|
|
when (nameObject.Name) {
|
|
|
"OpenPage" -> {
|
|
|
+ /* runOnUiThread {
|
|
|
+ webview.loadUrl("javascript:OpenTestData()")
|
|
|
+ }*/
|
|
|
+ /*runOnUiThread {
|
|
|
+ mVm.getFloorSpace(success = {
|
|
|
+ webview.loadUrl("javascript:SetSpaceData('${""}')")
|
|
|
+ })
|
|
|
+ }*/
|
|
|
runOnUiThread {
|
|
|
- webview.loadUrl("javascript:OpenTestData()")
|
|
|
+ webview.loadUrl("javascript:SetFloorPath('${FLOORINFO}')")
|
|
|
+ projectName.text = FLOORNAME
|
|
|
+ chooseObject.performClick()
|
|
|
}
|
|
|
- /*runOnUiThread { viewModel.getFloorSpace() }*/
|
|
|
}
|
|
|
"SetSpaceData" -> {
|
|
|
// if (isLastSpace) {
|
|
|
-// runOnUiThread {
|
|
|
-// val floorInfo = gson.fromJson(floorEntity.infos, InfosforFloor::class.java)
|
|
|
-// val model = SetFloorPathModel(projectId, floorInfo.bimIdPre, floorInfo.floorElevation)
|
|
|
-// webview.loadUrl("javascript:SetFloorPath('${gson.toJson(model)}')")
|
|
|
-// }
|
|
|
+ runOnUiThread {
|
|
|
+ val floorInfo = gson.fromJson(floorEntity.infos, InfosforFloor::class.java)
|
|
|
+ val model = SetFloorPathModel(
|
|
|
+ projectId, floorInfo.bimIdPre, floorInfo.floorElevation, floorInfo.height
|
|
|
+ )
|
|
|
+ webview.loadUrl("javascript:SetFloorPath('${gson.toJson(model)}')")
|
|
|
+ }
|
|
|
// }
|
|
|
}
|
|
|
"SetFloorPath" -> {
|
|
|
-// runOnUiThread {
|
|
|
-// webview.loadUrl("javascript:LoadAllModelWithFloor()")
|
|
|
-// }
|
|
|
+ runOnUiThread {
|
|
|
+ webview.loadUrl("javascript:LoadAllModelWithFloor()")
|
|
|
+ }
|
|
|
}
|
|
|
"OpenTestData" -> {
|
|
|
runOnUiThread {
|
|
@@ -307,6 +455,18 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ "LoadAllModelWithFloor" -> {
|
|
|
+ runOnUiThread {
|
|
|
+ Thread.sleep(500)
|
|
|
+ mVm.getProblems(floorEntity.id, 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}')")
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -353,30 +513,21 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
R.id.overall -> {
|
|
|
webview.loadUrl("javascript:LookAtAllFloorWidth2D()")
|
|
|
overall.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_overall_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_overall_blue), null, null
|
|
|
)
|
|
|
}
|
|
|
R.id.vertical -> {
|
|
|
webview.loadUrl("javascript:UpdateCameraAngle(${0})")
|
|
|
resetState()
|
|
|
vertical.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_vertical_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_vertical_blue), null, null
|
|
|
)
|
|
|
}
|
|
|
R.id.degree -> {
|
|
|
webview.loadUrl("javascript:UpdateCameraAngle(${1})")
|
|
|
resetState()
|
|
|
degree.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_degree_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_degree_blue), null, null
|
|
|
)
|
|
|
}
|
|
|
R.id.lock -> {
|
|
@@ -394,10 +545,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
resetState()
|
|
|
webview.loadUrl("javascript:IsFirstCamera(${true})")
|
|
|
angle.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_angle_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_angle_blue), null, null
|
|
|
)
|
|
|
}
|
|
|
R.id.chooseObject -> {
|
|
@@ -424,10 +572,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
materialError.visibility = View.VISIBLE
|
|
|
pline.visibility = View.VISIBLE
|
|
|
pline.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_pline_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_pline_blue), null, null
|
|
|
)
|
|
|
resetReverseTools()
|
|
|
wall.setTextColor(getColor(R.color.blue_0091FF))
|
|
@@ -440,14 +585,12 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
resetDrawTools()
|
|
|
webview.loadUrl("javascript:InDrawPointModel()")
|
|
|
point.visibility = View.VISIBLE
|
|
|
+ save.visibility = View.GONE
|
|
|
point.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_point_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_point_blue), null, null
|
|
|
)
|
|
|
- door.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
- door.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
|
+// door.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
+// door.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
|
}
|
|
|
R.id.pillar -> {
|
|
|
objTypeCode = "CFCSCL"
|
|
@@ -456,11 +599,9 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
resetDrawTools()
|
|
|
webview.loadUrl("javascript:InDrawPointModel()")
|
|
|
point.visibility = View.VISIBLE
|
|
|
+ save.visibility = View.GONE
|
|
|
point.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_point_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_point_blue), null, null
|
|
|
)
|
|
|
pillar.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
pillar.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
@@ -472,11 +613,9 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
resetDrawTools()
|
|
|
webview.loadUrl("javascript:InDrawPointModel()")
|
|
|
point.visibility = View.VISIBLE
|
|
|
+ save.visibility = View.GONE
|
|
|
point.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_point_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_point_blue), null, null
|
|
|
)
|
|
|
window.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
window.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
@@ -487,11 +626,9 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
resetDrawTools()
|
|
|
webview.loadUrl("javascript:InDrawPointModel()")
|
|
|
point.visibility = View.VISIBLE
|
|
|
+ save.visibility = View.GONE
|
|
|
point.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_point_blue),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_point_blue), null, null
|
|
|
)
|
|
|
parking.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
parking.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
@@ -507,6 +644,8 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
floorslab.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
|
}
|
|
|
R.id.addProblem -> {
|
|
|
+ pointZModel = null
|
|
|
+ lineModel = null
|
|
|
if (reverseTools.visibility == View.VISIBLE || forwardTools.visibility == View.VISIBLE) {
|
|
|
forwardTools.visibility = View.GONE
|
|
|
reverseTools.visibility = View.GONE
|
|
@@ -525,7 +664,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
} else if (meshObject?.ID!!.contains("Door")) {
|
|
|
objTypeCode = "CFBEDR"
|
|
|
more.visibility = View.VISIBLE
|
|
|
- materialError.visibility = View.VISIBLE
|
|
|
+ propertyError.visibility = View.VISIBLE
|
|
|
positionError.visibility = View.VISIBLE
|
|
|
} else if (meshObject?.ID!!.contains("Window")) {
|
|
|
objTypeCode = "CFBEWN"
|
|
@@ -549,10 +688,11 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
drawTools.visibility = View.GONE
|
|
|
quitTools.visibility = View.GONE
|
|
|
problemDone.visibility = View.GONE
|
|
|
- cameraTypeTools.visibility = View.VISIBLE
|
|
|
+// cameraTypeTools.visibility = View.VISIBLE
|
|
|
mapTools.visibility = View.VISIBLE
|
|
|
webview.loadUrl("javascript:UpdateCameraType(${1})")
|
|
|
resetReverseTools()
|
|
|
+ isClose = false
|
|
|
}
|
|
|
R.id.problemDone -> {
|
|
|
//TODO save
|
|
@@ -563,14 +703,19 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
}
|
|
|
R.id.save -> {
|
|
|
if (problemTypeCode == "CFCSWL_MORE" || problemTypeCode == "CFCSWL_MATERIAL_ERROR" || objTypeCode == "CFCSFL") {
|
|
|
-// val lineStyleModel = LineStyleModel("#ff0000", true)
|
|
|
val lineStyleModel = "{'Color':'#ff0000', 'IsLoop':'true'}"
|
|
|
- webview.loadUrl("javascript:SetDrawLineModel(${lineStyleModel})")
|
|
|
+ webview.loadUrl("javascript:SetDrawLineModel(${"{'Color':'#ff0000', 'IsLoop':'true'}"})")
|
|
|
+ isClose = true
|
|
|
+// Thread.sleep(300)
|
|
|
+// webview.loadUrl("javascript:OutDrawLineModel()")
|
|
|
+ Thread.sleep(300)
|
|
|
+ webview.loadUrl("javascript:EndDrawLineModel()")
|
|
|
+ } else if (problemTypeCode == "CFCSWL_LESS") {
|
|
|
+ webview.loadUrl("javascript:EndDrawLineModel()")
|
|
|
+ } else {
|
|
|
+ webview.loadUrl("javascript:OutDrawPointModel()")
|
|
|
+ webview.loadUrl("javascript:EndDrawPointModel()")
|
|
|
}
|
|
|
-// webview.loadUrl("javascript:OutDrawPointModel()")
|
|
|
-// webview.loadUrl("javascript:OutDrawLineModel()")
|
|
|
-// webview.loadUrl("javascript:EndDrawPointModel()")
|
|
|
-// webview.loadUrl("javascript:EndDrawLineModel()")
|
|
|
}
|
|
|
//缺少
|
|
|
R.id.less -> {
|
|
@@ -595,28 +740,32 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
//柱子
|
|
|
"CFCSCL" -> {
|
|
|
problemTypeCode = "CFCSCL_MORE"
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
addProblem.visibility = View.GONE
|
|
|
forwardTools.visibility = View.GONE
|
|
|
}
|
|
|
//门
|
|
|
"CFBEDR" -> {
|
|
|
problemTypeCode = "CFBEDR_MORE"
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
addProblem.visibility = View.GONE
|
|
|
forwardTools.visibility = View.GONE
|
|
|
}
|
|
|
//窗
|
|
|
"CFBEWN" -> {
|
|
|
problemTypeCode = "CFBEWN_MORE"
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
addProblem.visibility = View.GONE
|
|
|
forwardTools.visibility = View.GONE
|
|
|
}
|
|
|
//停车位
|
|
|
"CFPKPS" -> {
|
|
|
problemTypeCode = "CFPKPS_MORE"
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
addProblem.visibility = View.GONE
|
|
|
forwardTools.visibility = View.GONE
|
|
|
}
|
|
@@ -642,14 +791,17 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
+ addProblem.visibility = View.GONE
|
|
|
+ forwardTools.visibility = View.GONE
|
|
|
resetForwardTools()
|
|
|
- propertyError.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
- propertyError.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
|
}
|
|
|
//截面形状错误
|
|
|
R.id.crossSectionError -> {
|
|
|
problemTypeCode = "CFCSCL_SECTION_SHAPE_ERROR"
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
addProblem.visibility = View.GONE
|
|
|
forwardTools.visibility = View.GONE
|
|
|
}
|
|
@@ -660,7 +812,8 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
problemTypeCode = "CFCSCL_SIZE_ERROR"
|
|
|
}
|
|
|
}
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
addProblem.visibility = View.GONE
|
|
|
forwardTools.visibility = View.GONE
|
|
|
}
|
|
@@ -678,6 +831,10 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
|
|
|
}
|
|
|
resetForwardTools()
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
+ addProblem.visibility = View.GONE
|
|
|
+ forwardTools.visibility = View.GONE
|
|
|
positionError.setTextColor(getColor(R.color.blue_0091FF))
|
|
|
positionError.background = getDrawable(R.drawable.bg_blue_e1f2ff_round)
|
|
|
}
|
|
@@ -703,19 +860,29 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
resetForwardTools()
|
|
|
}
|
|
|
R.id.record -> {
|
|
|
- signProblem.visibility = View.VISIBLE
|
|
|
+ webview.loadUrl("javascript:EndDrawPointModel()")
|
|
|
+ initAddProblem()
|
|
|
+ initInfo(null)
|
|
|
}
|
|
|
R.id.closeProblem -> {
|
|
|
- signProblem.visibility = View.GONE
|
|
|
- addProblem.visibility = View.VISIBLE
|
|
|
- drawTools.visibility = View.GONE
|
|
|
- quitTools.visibility = View.GONE
|
|
|
- problemDone.visibility = View.GONE
|
|
|
- cameraTypeTools.visibility = View.VISIBLE
|
|
|
- mapTools.visibility = View.VISIBLE
|
|
|
+ refresh3DView()
|
|
|
+ isClose = false
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ private fun initInfo(hashMap: HashMap<String, Any>?) {
|
|
|
+ mVm.getProblemConfig(problemTypeCode, success = {
|
|
|
+ adapter = InfoAdapter(this, it)
|
|
|
+ infoRv.adapter = adapter
|
|
|
+ if (hashMap != null) {
|
|
|
+ adapter.hashMap = hashMap
|
|
|
+ adapter.isDetail = true
|
|
|
+ }
|
|
|
+ adapter.setOnAddPic { info, currentPosition ->
|
|
|
+ addPic()
|
|
|
+ this@Space3DActivity.info = info
|
|
|
+ this@Space3DActivity.currentPosition = currentPosition
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
private fun resetReverseTools() {
|
|
@@ -744,23 +911,14 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
|
|
|
private fun resetState() {
|
|
|
vertical.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_vertical),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_vertical), null, null
|
|
|
)
|
|
|
degree.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_degree),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_degree), null, null
|
|
|
)
|
|
|
// lock.setCompoundDrawablesWithIntrinsicBounds(null, resources.getDrawable(R.drawable.icon_lock), null, null)
|
|
|
angle.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_angle),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_angle), null, null
|
|
|
)
|
|
|
webview.loadUrl("javascript:IsFirstCamera(${false})")
|
|
|
}
|
|
@@ -772,10 +930,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
lock.visibility = View.VISIBLE
|
|
|
angle.visibility = View.VISIBLE
|
|
|
overall.setCompoundDrawablesWithIntrinsicBounds(
|
|
|
- null,
|
|
|
- resources.getDrawable(R.drawable.icon_overall_white),
|
|
|
- null,
|
|
|
- null
|
|
|
+ null, resources.getDrawable(R.drawable.icon_overall_white), null, null
|
|
|
)
|
|
|
}
|
|
|
|
|
@@ -808,6 +963,7 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
forwardTools.visibility = View.GONE
|
|
|
reverseTools.visibility = View.GONE
|
|
|
point.visibility = View.GONE
|
|
|
+ save.visibility = View.VISIBLE
|
|
|
pline.visibility = View.GONE
|
|
|
close.visibility = View.GONE
|
|
|
cameraTypeTools.visibility = View.GONE
|
|
@@ -816,4 +972,119 @@ class Space3DActivity : ComponentActivity(), DIAware, View.OnClickListener {
|
|
|
quitTools.visibility = View.VISIBLE
|
|
|
problemDone.visibility = View.VISIBLE
|
|
|
}
|
|
|
+
|
|
|
+ // 自定义图片加载器
|
|
|
+ private val loader = ImageLoader { context: Context?, path: String?, imageView: ImageView? ->
|
|
|
+ Glide.with(
|
|
|
+ context
|
|
|
+ ).load(path).into(imageView)
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun addPic() {
|
|
|
+ val config: ImgSelConfig = ImgSelConfig.Builder(this, loader) // 是否多选
|
|
|
+ .multiSelect(true) // 是否记住上次选中记录, 仅当multiSelect为true的时候配置,默认为true
|
|
|
+ .rememberSelected(false) // 确定按钮文字颜色
|
|
|
+ .btnTextColor(Color.WHITE) // 使用沉浸式状态栏
|
|
|
+ .statusBarColor(resources.getColor(R.color.blue_2E3679)) // 返回图标ResId
|
|
|
+ .backResId(R.drawable.icon_back).title("选择图片").titleColor(Color.WHITE).titleBgColor(
|
|
|
+ resources.getColor(R.color.blue_2E3679)
|
|
|
+ ) // .allImagesText("All Images")
|
|
|
+ .needCrop(false).cropSize(1, 1, 200, 200) // 第一个是否显示相机
|
|
|
+ .needCamera(true) // 最大选择图片数量
|
|
|
+ .maxNum(3).build()
|
|
|
+ //选择图片activity
|
|
|
+ //选择图片activity
|
|
|
+ Repair_ImgSelActivity.startActivity(this, config, REQUEST_CODE_PIC)
|
|
|
+ }
|
|
|
+
|
|
|
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
|
|
+ super.onActivityResult(requestCode, resultCode, data)
|
|
|
+ if (resultCode == RESULT_OK && requestCode == REQUEST_CODE_PIC) {
|
|
|
+ if (data != null) {
|
|
|
+ val pathList: List<String>? = data.getStringArrayListExtra(Repair_ImgSelActivity.INTENT_RESULT)
|
|
|
+ doPicDatas(pathList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private fun doPicDatas(pathList: List<String>?) {
|
|
|
+ getInstance().dealLocalData<Photos>(this) { name, params ->
|
|
|
+ when (name) {
|
|
|
+ SHOW_DIALOG_IN_MAIN -> {
|
|
|
+ //ToastUtils.showMyToast("图片上传中")
|
|
|
+ }
|
|
|
+ DEAL_IO_DATA -> {
|
|
|
+ val emitter = params as ObservableEmitter<String>
|
|
|
+ for (s in pathList!!) {
|
|
|
+ Log.e("已选择图片的路径为-----", s!!)
|
|
|
+ val path: String = PictureUtils.compressImage(s, getOfflineImagePath(), 100)
|
|
|
+ val picFile = File(path)
|
|
|
+ if (picFile.exists()) {
|
|
|
+ val key = picFile.name
|
|
|
+
|
|
|
+ val photos = Photos()
|
|
|
+ photos.itemType = 0
|
|
|
+ photos.path = path
|
|
|
+ photos.key = key
|
|
|
+ if (info == null) {
|
|
|
+ beans.add(photos)
|
|
|
+ } else {
|
|
|
+ val photosList = ArrayList<Photos>()
|
|
|
+ if (adapter.hashMap[info!!.code] != null) {
|
|
|
+ val value = Gson().fromJson<ArrayList<Photos>>(
|
|
|
+ Gson().toJson(adapter.hashMap[info!!.code]),
|
|
|
+ object : TypeToken<List<Photos?>?>() {}.type
|
|
|
+ )
|
|
|
+ photosList.addAll(value)
|
|
|
+ }
|
|
|
+ photosList.add(photos)
|
|
|
+ adapter.hashMap.put(info!!.code, photosList)
|
|
|
+ adapter.valueList.remove(info?.code)
|
|
|
+ runOnUiThread { adapter.notifyItemChanged(currentPosition!!) }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ emitter.onNext("")
|
|
|
+ }
|
|
|
+ DEAL_DATA_NEXT -> {
|
|
|
+// ToastUtils.showMyToast("图片上传完毕")
|
|
|
+// if (info != null) {
|
|
|
+// staticInfoAdapter.hashMap.put(info.code, beans)
|
|
|
+// }
|
|
|
+ }
|
|
|
+ DEAL_DATA_ERROR -> {
|
|
|
+// ToastUtils.showMyToast("图片上传失败")
|
|
|
+ }
|
|
|
+ else -> {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取图片路径-离线缓存模块的图片存储
|
|
|
+ */
|
|
|
+ fun getOfflineImagePath(): String? {
|
|
|
+ val saveDir = getInstance().getOfflineImageFilePath(this)
|
|
|
+ // 新建目录
|
|
|
+ val dir = File(saveDir)
|
|
|
+ if (!dir.exists()) dir.mkdirs()
|
|
|
+ return saveDir + File.separator + System.currentTimeMillis() + ".png"
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequiresApi(Build.VERSION_CODES.R)
|
|
|
+ private fun checkStoragePermission() {
|
|
|
+ if (ActivityCompat.checkSelfPermission(
|
|
|
+ this, Manifest.permission.WRITE_EXTERNAL_STORAGE
|
|
|
+ ) != PackageManager.PERMISSION_GRANTED
|
|
|
+ ) {
|
|
|
+ ActivityCompat.requestPermissions(
|
|
|
+ this, arrayOf(
|
|
|
+ Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.MANAGE_EXTERNAL_STORAGE
|
|
|
+ ), 1
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|