|
@@ -43,7 +43,6 @@ import cn.sagacloud.android.cadengine.types.Space
|
|
|
import cn.sagacloud.android.cadengine.types.TunableSpace
|
|
|
import cn.sagacloud.cadengine.HttpDownloadMap
|
|
|
import com.google.gson.Gson
|
|
|
-import com.google.gson.reflect.TypeToken
|
|
|
import com.sybotan.android.demo.R
|
|
|
import com.sybotan.android.demo.activities.poc.DeviceActivity
|
|
|
import com.sybotan.android.demo.activities.poc.RelationActivity
|
|
@@ -62,28 +61,29 @@ import org.jetbrains.anko.textColor
|
|
|
import org.jetbrains.anko.uiThread
|
|
|
|
|
|
|
|
|
+@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
|
|
|
class GraphyActivity : BaseActivity() {
|
|
|
companion object {
|
|
|
private val TAG = GraphyActivity::class.java.name
|
|
|
|
|
|
/** 扫描二维码 */
|
|
|
- private val REQUEST_CODE_SCAN = 0x0000
|
|
|
+ private const val REQUEST_CODE_SCAN = 0x0000
|
|
|
|
|
|
/** 添加设备成功 */
|
|
|
- private val REQUEST_CODE_EQUIP = 0x0001
|
|
|
+ private const val REQUEST_CODE_EQUIP = 0x0001
|
|
|
}
|
|
|
|
|
|
/** viewModel */
|
|
|
lateinit var graphyVM: GraphyVM
|
|
|
|
|
|
/** 建筑Id */
|
|
|
- lateinit var buildingId: String
|
|
|
+ private lateinit var buildingId: String
|
|
|
|
|
|
/** 楼层Id */
|
|
|
- lateinit var floorId: String
|
|
|
+ private lateinit var floorId: String
|
|
|
|
|
|
/** 楼层地图 */
|
|
|
- lateinit var floorMap: String
|
|
|
+ private lateinit var floorMap: String
|
|
|
|
|
|
/**
|
|
|
* space 结构核查
|
|
@@ -98,10 +98,10 @@ class GraphyActivity : BaseActivity() {
|
|
|
var realDistance = 0f
|
|
|
|
|
|
/** 管道类型数据 */
|
|
|
- lateinit var pipeTypeList: ArrayList<PipeListModel>
|
|
|
+ private lateinit var pipeTypeList: ArrayList<PipeListModel>
|
|
|
|
|
|
val scene = FloorScene()
|
|
|
- val gson = Gson()
|
|
|
+ private val gson = Gson()
|
|
|
|
|
|
@Subscribe
|
|
|
fun test(msg: SGraphyViewMoveEvent) {
|
|
@@ -127,9 +127,7 @@ class GraphyActivity : BaseActivity() {
|
|
|
/** 开启异步 */
|
|
|
doAsync {
|
|
|
val downloadGZIPMap = HttpDownloadMap.downloadGZIPMap(floorMap)
|
|
|
- if (downloadGZIPMap != null) {
|
|
|
- scene.loadData(downloadGZIPMap!!)
|
|
|
- }
|
|
|
+ downloadGZIPMap?.let { scene.loadData(it) }
|
|
|
/** 主线程处理ui */
|
|
|
uiThread {
|
|
|
/** 适应屏幕大小 */
|
|
@@ -139,6 +137,10 @@ class GraphyActivity : BaseActivity() {
|
|
|
// graphyView.moveRange()
|
|
|
graphyView.post {
|
|
|
Log.e("viewW", graphyView.width.toString())
|
|
|
+ val mapItem = BaseMapItem(this@GraphyActivity, null)
|
|
|
+ mapItem.zOrder = 1000000f
|
|
|
+ mapItem.isVisible = true
|
|
|
+ scene.addItem(mapItem)
|
|
|
}
|
|
|
|
|
|
Log.e("viewH", graphyView.measuredHeight.toString())
|
|
@@ -159,12 +161,11 @@ class GraphyActivity : BaseActivity() {
|
|
|
* 初始化数据
|
|
|
*/
|
|
|
private fun initData() {
|
|
|
- var floor = intent.getBundleExtra("floor")
|
|
|
+ val floor = intent.getBundleExtra("floor")
|
|
|
buildingId = floor.getString("buildingId")
|
|
|
floorId = floor.getString("floorId")
|
|
|
floorMap = floor.getString("floorMap")
|
|
|
from = floor.getString("from")
|
|
|
-// from = "12345"
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -463,11 +464,13 @@ class GraphyActivity : BaseActivity() {
|
|
|
scene.addItem(nameItem)
|
|
|
|
|
|
val tunableSpace = TunableSpace()
|
|
|
- tunableSpace.outLine = model.outline.get(0)
|
|
|
- tunableSpace.name = model.name
|
|
|
- tunableSpace.jobStatus = model.job
|
|
|
- tunableSpace.id = model.id
|
|
|
- tunableSpace.localName = model.localName
|
|
|
+ tunableSpace.apply {
|
|
|
+ outLine = model.outline.get(0)
|
|
|
+ this.name = model.name
|
|
|
+ jobStatus = model.job
|
|
|
+ id = model.id
|
|
|
+ localName = model.localName
|
|
|
+ }
|
|
|
val item = TunableSpaceItem(tunableSpace, null)
|
|
|
scene.choseSpace?.let {
|
|
|
if (tunableSpace.id.equals(scene.choseSpace!!.data.id)) {
|
|
@@ -574,30 +577,32 @@ class GraphyActivity : BaseActivity() {
|
|
|
equipWwv.removeAllViews()
|
|
|
for (model in list) {
|
|
|
val textview = TextView(this)
|
|
|
- textview.setText(model.type + "(${model.children.size})")
|
|
|
- textview.setSingleLine()
|
|
|
- textview.gravity = Gravity.CENTER
|
|
|
- textview.textSize = 12f
|
|
|
- textview.height = DensityUtils.dp2px(this, 30f)
|
|
|
- if (model.isCheck) {
|
|
|
- textview.background = resources.getDrawable(R.drawable.shape_filter_normal)
|
|
|
- textview.textColor = resources.getColor(R.color.grey_900)
|
|
|
- } else {
|
|
|
- textview.background = resources.getDrawable(R.drawable.shape_filter_selected)
|
|
|
- textview.textColor = resources.getColor(R.color.white)
|
|
|
- }
|
|
|
- textview.setOnClickListener {
|
|
|
- model.isCheck = !model.isCheck
|
|
|
+ textview.apply {
|
|
|
+ setText(model.type + "(${model.children.size})")
|
|
|
+ setSingleLine()
|
|
|
+ gravity = Gravity.CENTER
|
|
|
+ textSize = 12f
|
|
|
+ height = DensityUtils.dp2px(this@GraphyActivity, 30f)
|
|
|
if (model.isCheck) {
|
|
|
- textview.background = resources.getDrawable(R.drawable.shape_filter_normal)
|
|
|
- textview.textColor = resources.getColor(R.color.grey_900)
|
|
|
+ background = resources.getDrawable(R.drawable.shape_filter_normal)
|
|
|
+ textColor = resources.getColor(R.color.grey_900)
|
|
|
} else {
|
|
|
- textview.background = resources.getDrawable(R.drawable.shape_filter_selected)
|
|
|
- textview.textColor = resources.getColor(R.color.white)
|
|
|
+ background = resources.getDrawable(R.drawable.shape_filter_selected)
|
|
|
+ textColor = resources.getColor(R.color.white)
|
|
|
+ }
|
|
|
+ setOnClickListener {
|
|
|
+ model.isCheck = !model.isCheck
|
|
|
+ if (model.isCheck) {
|
|
|
+ textview.background = resources.getDrawable(R.drawable.shape_filter_normal)
|
|
|
+ textview.textColor = resources.getColor(R.color.grey_900)
|
|
|
+ } else {
|
|
|
+ textview.background = resources.getDrawable(R.drawable.shape_filter_selected)
|
|
|
+ textview.textColor = resources.getColor(R.color.white)
|
|
|
+ }
|
|
|
+ refreshEquip(list)
|
|
|
}
|
|
|
- refreshEquip(list)
|
|
|
+ equipWwv.addView(this)
|
|
|
}
|
|
|
- equipWwv.addView(textview)
|
|
|
|
|
|
}
|
|
|
refreshEquip(list)
|