EquipItem.kt 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. package cn.sagacloud.android.cadengine.items
  2. import android.graphics.Canvas
  3. import android.graphics.Color
  4. import android.graphics.Paint
  5. import android.graphics.drawable.BitmapDrawable
  6. import cn.sagacloud.android.cadengine.types.Point
  7. import com.sybotan.android.graphy.SGraphyItem
  8. /**
  9. * Created by lihao.
  10. * Date: 2021/6/4
  11. */
  12. class EquipItem(val data: Point, parent: SGraphyItem? = null, defaultScale: Float) :
  13. SGraphyItem(parent) {
  14. /** 新建 画笔 */
  15. val mPaint_inner = Paint()
  16. val mPaint_center = Paint()
  17. val mPaint_outer = Paint()
  18. /** 按时 画笔 */
  19. val not_overTime_inner = Paint()
  20. val not_overTime_outer = Paint()
  21. /** 逾期 画笔 */
  22. val overTime_inner = Paint()
  23. val overTime_outer = Paint()
  24. /** 承接查验复核中 */
  25. val checkReviewing_inner = Paint()
  26. val checkReviewing_outer = Paint()
  27. var mDefaultScale = 0f
  28. //var defaultScale = 1.0f
  29. //var mScale = 1f
  30. init {
  31. mDefaultScale = defaultScale;
  32. /** 按时 */
  33. not_overTime_inner.color = Color.parseColor("#ffffff")
  34. not_overTime_inner.isAntiAlias = true
  35. not_overTime_inner.style = Paint.Style.FILL
  36. not_overTime_outer.color = Color.parseColor("#04df97")//绿色
  37. not_overTime_outer.isAntiAlias = true
  38. not_overTime_outer.style = Paint.Style.FILL
  39. /** 逾期 */
  40. overTime_inner.color = Color.parseColor("#ffffff")
  41. overTime_inner.isAntiAlias = true
  42. overTime_inner.style = Paint.Style.FILL
  43. overTime_outer.color = Color.parseColor("#ff3b33")//红色
  44. overTime_outer.isAntiAlias = true
  45. overTime_outer.style = Paint.Style.FILL
  46. /** 承接查验复核中 */
  47. checkReviewing_inner.color = Color.parseColor("#ffffff")
  48. checkReviewing_inner.isAntiAlias = true
  49. checkReviewing_inner.style = Paint.Style.FILL
  50. checkReviewing_outer.color = Color.parseColor("#F7B500")//黄色
  51. checkReviewing_outer.isAntiAlias = true
  52. checkReviewing_outer.style = Paint.Style.FILL
  53. /** 新建 */
  54. //内圈
  55. mPaint_inner.color = Color.parseColor("#66272727")
  56. mPaint_inner.isAntiAlias = true
  57. mPaint_inner.style = Paint.Style.FILL
  58. //中圈
  59. mPaint_center.color = Color.parseColor("#ffffff")
  60. mPaint_center.isAntiAlias = true
  61. mPaint_center.style = Paint.Style.FILL
  62. //外圈
  63. mPaint_outer.color = Color.parseColor("#260c90eb")
  64. mPaint_outer.isAntiAlias = true
  65. mPaint_outer.style = Paint.Style.FILL
  66. }
  67. /**
  68. * Item绘制操作
  69. *
  70. * @param canvas 画布
  71. * @param rect 绘制区域
  72. */
  73. override fun onDraw(canvas: Canvas) {
  74. data.scalePoint = mDefaultScale / scene!!.view!!.scale
  75. // canvas.drawCircle(data.mX, data.mY, 2400f * data.scalePoint, mPaint_outer)
  76. canvas.drawCircle(data.mX, data.mY, 500f * data.scalePoint, mPaint_center)
  77. canvas.drawCircle(data.mX, data.mY, 1500f * data.scalePoint, mPaint_inner)
  78. super.onDraw(canvas)
  79. } // Function onDraw()
  80. }