package com.ys.bdtp.cad.items


import android.content.Context
import android.graphics.*
import com.ys.bdtp.cad.R
import com.ys.bdtp.graph.SGraphyItem
import com.ys.bdtp.graph.enums.SGraphyItemFlag
import java.util.*


/**
 * Created by lihao.
 * Date: 2021/6/23
 */
class BaseMapItem(context: Context, parent: SGraphyItem? = null) :
        SGraphyItem(parent) {

    val mPaint = Paint()
    var mBitmap: Bitmap

    init {
        mPaint.alpha = 0X80
        mBitmap = BitmapFactory.decodeResource(context.resources, R.drawable.pipecadcolor)
        flags = EnumSet.of(SGraphyItemFlag.ItemIsMovable)
        val contains = flags.contains(SGraphyItemFlag.ItemIsMovable)
    }

    /**
     * Item绘制操作
     *
     * @param   canvas          画布
     * @param   rect            绘制区域
     */
    override fun onDraw(canvas: Canvas) {
        val matrix = Matrix()
        matrix.postScale(17.0000007f, 17.0000007f)
        matrix.postTranslate(-10200f, -79500f)
        canvas.drawBitmap(mBitmap, matrix, mPaint)
        super.onDraw(canvas)
    } // Function onDraw()

}