12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- package cn.sagacloud.android.cadengine.items
- import android.graphics.Canvas
- import android.graphics.Color
- import android.graphics.Paint
- import cn.sagacloud.android.cadengine.types.Point
- import com.sybotan.android.graphy.SGraphyItem
- /**
- * Created by lihao.
- * Date: 2021/6/4
- */
- class EquipItem(val data: Point, parent: SGraphyItem? = null, defaultScale: Float) :
- SGraphyItem(parent) {
- /** 新建 画笔 */
- val mPaint_inner = Paint()
- val mPaint_center = Paint()
- val mPaint_outer = Paint()
- /** 按时 画笔 */
- val not_overTime_inner = Paint()
- val not_overTime_outer = Paint()
- /** 逾期 画笔 */
- val overTime_inner = Paint()
- val overTime_outer = Paint()
- /** 承接查验复核中 */
- val checkReviewing_inner = Paint()
- val checkReviewing_outer = Paint()
- var mDefaultScale = 0f
- //var defaultScale = 1.0f
- //var mScale = 1f
- init {
- mDefaultScale = defaultScale;
- /** 按时 */
- not_overTime_inner.color = Color.parseColor("#ffffff")
- not_overTime_inner.isAntiAlias = true
- not_overTime_inner.style = Paint.Style.FILL
- not_overTime_outer.color = Color.parseColor("#04df97")//绿色
- not_overTime_outer.isAntiAlias = true
- not_overTime_outer.style = Paint.Style.FILL
- /** 逾期 */
- overTime_inner.color = Color.parseColor("#ffffff")
- overTime_inner.isAntiAlias = true
- overTime_inner.style = Paint.Style.FILL
- overTime_outer.color = Color.parseColor("#ff3b33")//红色
- overTime_outer.isAntiAlias = true
- overTime_outer.style = Paint.Style.FILL
- /** 承接查验复核中 */
- checkReviewing_inner.color = Color.parseColor("#ffffff")
- checkReviewing_inner.isAntiAlias = true
- checkReviewing_inner.style = Paint.Style.FILL
- checkReviewing_outer.color = Color.parseColor("#F7B500")//黄色
- checkReviewing_outer.isAntiAlias = true
- checkReviewing_outer.style = Paint.Style.FILL
- /** 新建 */
- //内圈
- mPaint_inner.color = Color.parseColor("#66272727")
- mPaint_inner.isAntiAlias = true
- mPaint_inner.style = Paint.Style.FILL
- //中圈
- mPaint_center.color = Color.parseColor("#ffffff")
- mPaint_center.isAntiAlias = true
- mPaint_center.style = Paint.Style.FILL
- //外圈
- mPaint_outer.color = Color.parseColor("#260c90eb")
- mPaint_outer.isAntiAlias = true
- mPaint_outer.style = Paint.Style.FILL
- }
- /**
- * Item绘制操作
- *
- * @param canvas 画布
- * @param rect 绘制区域
- */
- override fun onDraw(canvas: Canvas) {
- data.scalePoint = mDefaultScale / scene!!.view!!.scale
- // canvas.drawCircle(data.mX, data.mY, 2400f * data.scalePoint, mPaint_outer)
- canvas.drawCircle(data.mX, data.mY, 500f * data.scalePoint, mPaint_center)
- canvas.drawCircle(data.mX, data.mY, 1500f * data.scalePoint, mPaint_inner)
- super.onDraw(canvas)
- } // Function onDraw()
- }
|