|
@@ -85,6 +85,7 @@ import com.sybotan.android.graphy.SGraphyView
|
|
|
import com.sybotan.android.graphy.events.SGraphyViewMoveEvent
|
|
|
import com.yuyh.library.imgsel.ImageLoader
|
|
|
import com.yuyh.library.imgsel.ImgSelConfig
|
|
|
+import com.yuyh.library.imgsel.utils.LogUtils
|
|
|
import com.zbar.lib.CaptureActivity
|
|
|
import io.reactivex.ObservableEmitter
|
|
|
import org.greenrobot.eventbus.EventBus
|
|
@@ -629,6 +630,7 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
return
|
|
|
}
|
|
|
var hasChooseEquip = false
|
|
|
+ var equipList = ArrayList<EquipItem>()
|
|
|
for (point in scene.equipList) {
|
|
|
val sqrt = Math.sqrt(
|
|
|
Math.pow(
|
|
@@ -636,84 +638,22 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
2.0
|
|
|
) + Math.pow(Math.abs(y - point.data.mY).toDouble(), 2.0)
|
|
|
).toInt()
|
|
|
- if (!hasChooseEquip && sqrt < realDistance) {
|
|
|
+ if (sqrt < realDistance) {
|
|
|
+ equipList.add(point)
|
|
|
hasChooseEquip = true
|
|
|
- equipDetail.alpha = 1f
|
|
|
- equipDelete.alpha = 1f
|
|
|
- equipDetail.isEnabled = true
|
|
|
- equipDelete.isEnabled = true
|
|
|
- graphyVM.getContainer(point.data.deviceId!!)
|
|
|
- point.data.equipState = 4
|
|
|
- equipDetail.setOnClickListener {
|
|
|
- val intent =
|
|
|
- Intent(this@GraphyActivity, EquipDetailActivity::class.java)
|
|
|
- val bundle = Bundle()
|
|
|
- val positon = Position()
|
|
|
- positon.x = point.data.mX.toString()
|
|
|
- positon.y = point.data.mY.toString()
|
|
|
- val z = Z()
|
|
|
- val position = gson.fromJson(point.data.position, Z::class.java)
|
|
|
- z.offset = position.offset
|
|
|
- z.region = position.region
|
|
|
- positon.z = z
|
|
|
- bundle.putString("spaceId", scene.choseSpace!!.data.id)
|
|
|
- bundle.putSerializable("position", positon)
|
|
|
- bundle.putString("buildingId", buildingId)
|
|
|
- bundle.putString("floorId", floorId)
|
|
|
- bundle.putString("deviceId", point.data.deviceId)
|
|
|
- bundle.putString("projectId", projectId)
|
|
|
- bundle.putString("floorMap", floorMap)
|
|
|
- bundle.putFloat("scale", scene.view!!.scale)
|
|
|
- bundle.putParcelable(
|
|
|
- "centerPoint",
|
|
|
- graphyView.mapToScene(
|
|
|
- PointF(
|
|
|
- graphyView.width / 2f,
|
|
|
- graphyView.height / 2f
|
|
|
- )
|
|
|
- )
|
|
|
- )
|
|
|
- intent.putExtra("equip", bundle)
|
|
|
- startActivityForResult(intent, REQUEST_CODE_EQUIP)
|
|
|
- }
|
|
|
- equipContainer.setOnClickListener {
|
|
|
- val intent =
|
|
|
- Intent(this@GraphyActivity, EquipContainerActivity::class.java)
|
|
|
- val bundle = Bundle()
|
|
|
- bundle.putString("buildingId", buildingId)
|
|
|
- bundle.putString("floorId", floorId)
|
|
|
- bundle.putString("projectId", projectId)
|
|
|
- bundle.putString("deviceId", point.data.deviceId)
|
|
|
- val position =
|
|
|
- gson.fromJson(point.data.position, Position::class.java)
|
|
|
- bundle.putSerializable("position", position)
|
|
|
- bundle.putString("spaceId", scene.choseSpace!!.data.id)
|
|
|
- intent.putExtra("params", bundle)
|
|
|
- startActivity(intent)
|
|
|
- }
|
|
|
- equipDelete.setOnClickListener {
|
|
|
- val builder: AlertDialog.Builder =
|
|
|
- AlertDialog.Builder(this@GraphyActivity)
|
|
|
- .setTitle("确认标记/删除设备吗")
|
|
|
- .setPositiveButton(
|
|
|
- "确定"
|
|
|
- ) { _, _ ->
|
|
|
- graphyVM.insProblemEquip(
|
|
|
- scene.choseSpace!!,
|
|
|
- point.data.deviceId!!
|
|
|
- )
|
|
|
- }.setNegativeButton(
|
|
|
- "取消"
|
|
|
- ) { dialogInterface, _ ->
|
|
|
- dialogInterface.dismiss()
|
|
|
- }
|
|
|
- builder.create().show()
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ point.data.equipState = point.data.equipType
|
|
|
+ }
|
|
|
+ if (!CommonUtils.IsNull(equipList)) {
|
|
|
+ if (equipList.size == 1) {
|
|
|
+ val point = equipList[0]
|
|
|
+ initEquipDetail(point)
|
|
|
} else {
|
|
|
- point.data.equipState = point.data.equipType
|
|
|
+ val pop = SelectListSinglePopupWindow(this@GraphyActivity)
|
|
|
+ pop.setGenList(equipList, Constant.TYPE4)
|
|
|
+ pop.setBtn(false, "")
|
|
|
+ pop.showAtLocation(root, Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL, 0, 0)
|
|
|
+ pop.setOnItemClickListener { initEquipDetail(equipList[it]) }
|
|
|
}
|
|
|
}
|
|
|
if (!hasChooseEquip) {
|
|
@@ -980,6 +920,82 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+ private fun initEquipDetail(point: EquipItem) {
|
|
|
+ equipDetail.alpha = 1f
|
|
|
+ equipDelete.alpha = 1f
|
|
|
+ equipDetail.isEnabled = true
|
|
|
+ equipDelete.isEnabled = true
|
|
|
+ graphyVM.getContainer(point.data.deviceId!!)
|
|
|
+ point.data.equipState = 4
|
|
|
+ equipDetail.setOnClickListener {
|
|
|
+ val intent =
|
|
|
+ Intent(this@GraphyActivity, EquipDetailActivity::class.java)
|
|
|
+ val bundle = Bundle()
|
|
|
+ val positon = Position()
|
|
|
+ positon.x = point.data.mX.toString()
|
|
|
+ positon.y = point.data.mY.toString()
|
|
|
+ val z = Z()
|
|
|
+ val position = gson.fromJson(point.data.position, Z::class.java)
|
|
|
+ z.offset = position.offset
|
|
|
+ z.region = position.region
|
|
|
+ positon.z = z
|
|
|
+ bundle.putString("spaceId", scene.choseSpace!!.data.id)
|
|
|
+ bundle.putSerializable("position", positon)
|
|
|
+ bundle.putString("buildingId", buildingId)
|
|
|
+ bundle.putString("floorId", floorId)
|
|
|
+ bundle.putString("deviceId", point.data.deviceId)
|
|
|
+ bundle.putString("projectId", projectId)
|
|
|
+ bundle.putString("floorMap", floorMap)
|
|
|
+ bundle.putFloat("scale", scene.view!!.scale)
|
|
|
+ bundle.putParcelable(
|
|
|
+ "centerPoint",
|
|
|
+ graphyView.mapToScene(
|
|
|
+ PointF(
|
|
|
+ graphyView.width / 2f,
|
|
|
+ graphyView.height / 2f
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ intent.putExtra("equip", bundle)
|
|
|
+ startActivityForResult(intent, REQUEST_CODE_EQUIP)
|
|
|
+ }
|
|
|
+ equipContainer.setOnClickListener {
|
|
|
+ val intent =
|
|
|
+ Intent(this@GraphyActivity, EquipContainerActivity::class.java)
|
|
|
+ val bundle = Bundle()
|
|
|
+ bundle.putString("buildingId", buildingId)
|
|
|
+ bundle.putString("floorId", floorId)
|
|
|
+ bundle.putString("projectId", projectId)
|
|
|
+ bundle.putString("deviceId", point.data.deviceId)
|
|
|
+ val position =
|
|
|
+ gson.fromJson(point.data.position, Position::class.java)
|
|
|
+ bundle.putSerializable("position", position)
|
|
|
+ bundle.putString("spaceId", scene.choseSpace!!.data.id)
|
|
|
+ intent.putExtra("params", bundle)
|
|
|
+ startActivity(intent)
|
|
|
+ }
|
|
|
+ equipDelete.setOnClickListener {
|
|
|
+ val builder: AlertDialog.Builder =
|
|
|
+ AlertDialog.Builder(this@GraphyActivity)
|
|
|
+ .setTitle("确认标记/删除设备吗")
|
|
|
+ .setPositiveButton(
|
|
|
+ "确定"
|
|
|
+ ) { _, _ ->
|
|
|
+ graphyVM.insProblemEquip(
|
|
|
+ scene.choseSpace!!,
|
|
|
+ point.data.deviceId!!
|
|
|
+ )
|
|
|
+ }.setNegativeButton(
|
|
|
+ "取消"
|
|
|
+ ) { dialogInterface, _ ->
|
|
|
+ dialogInterface.dismiss()
|
|
|
+ }
|
|
|
+ builder.create().show()
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private fun checkSdCardEnabled(): Boolean {
|
|
|
if (!InstaCameraManager.getInstance().isSdCardEnabled()) {
|
|
|
Toast.makeText(this, "No SD card inserted or Not enough free space", Toast.LENGTH_SHORT)
|
|
@@ -1294,8 +1310,12 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
refreshEquip(spaceEqList)
|
|
|
}
|
|
|
onlySpace.setOnCheckedChangeListener { buttonView, isChecked ->
|
|
|
- initEquipChoose(spaceEqList)
|
|
|
- refreshEquip(spaceEqList)
|
|
|
+ if (isChecked) {
|
|
|
+ initEquipChoose(spaceEqList)
|
|
|
+ refreshEquip(spaceEqList)
|
|
|
+ } else {
|
|
|
+ graphyVM.getSpaceEq(scene.choseSpace)
|
|
|
+ }
|
|
|
}
|
|
|
sift.setOnClickListener {
|
|
|
graphyVM.getMajor()
|
|
@@ -1458,6 +1478,7 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ equipList.sortBy { it.type }
|
|
|
for (model in equipList) {
|
|
|
val textview = TextView(this)
|
|
|
textview.apply {
|
|
@@ -1571,30 +1592,6 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- @Throws(Exception::class)
|
|
|
- fun deepClone(data: PipeLine): Any? {
|
|
|
- // 序列化
|
|
|
- val bos = ByteArrayOutputStream()
|
|
|
- val oos = ObjectOutputStream(bos)
|
|
|
- oos.writeObject(data)
|
|
|
- // 反序列化
|
|
|
- val bis = ByteArrayInputStream(bos.toByteArray())
|
|
|
- val ois = ObjectInputStream(bis)
|
|
|
- return ois.readObject()
|
|
|
- }
|
|
|
-
|
|
|
- @Throws(Exception::class)
|
|
|
- fun deepClone(data: ArrayList<SpaceEqModel>): Any? {
|
|
|
- // 序列化
|
|
|
- val bos = ByteArrayOutputStream()
|
|
|
- val oos = ObjectOutputStream(bos)
|
|
|
- oos.writeObject(data)
|
|
|
- // 反序列化
|
|
|
- val bis = ByteArrayInputStream(bos.toByteArray())
|
|
|
- val ois = ObjectInputStream(bis)
|
|
|
- return ois.readObject()
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 刷新地图上设备
|
|
|
*/
|
|
@@ -1611,6 +1608,7 @@ class GraphyActivity : BaseActivity(), ICaptureStatusListener, ICameraChangedCal
|
|
|
point.remark = child.remark
|
|
|
point.type = model.type
|
|
|
point.equipState = child.type
|
|
|
+ point.name = child.name
|
|
|
point.equipType = child.type
|
|
|
point.position = child.position
|
|
|
point.deviceId = child.deviceId
|