/*
 * ********************************************************************************************************************
 *                     :*$@@%$*:                         ;:                ;;    ;;
 *                   :@@%!  :!@@%:                       %!             ;%%@@%$ =@@@@@@@%;     @%@@@%%%%@@@@@
 *                  :@%;       :$=                       %%$$$%$$         ;$$  ;$@=   !@$
 *                  =@!                                  %!              @ $=;%   !@@@%:      !$$$$$$$$$$$$$$=
 *                  =@*                                  %!              @ $= % %@=   =%@!      %=
 *             *$%%! @@=        ;=$%%%$*:                %!              @ $= % =%%%%%%@$      *%:         =%
 *           %@@!:    !@@@%=$@@@@%!  :*@@$:              %!              @ $= % $*     ;@      @*          :%*
 *         ;@@!          ;!!!;:         ;@%:      =======@%========*     @ $$ % $%*****$@     :@$=*********=@$
 *         $@*   ;@@@%=!:                *@*
 *         =@$    ;;;!=%@@@@=!           =@!
 *          %@$:      =@%: :*@@@*       %@=                    Copyright (c) 2016-2018.  北京上格云技术有限公司
 *           ;%@@$=$@@%*       *@@@$=%@@%;
 *              ::;::             ::;::                                              All rights reservad.
 * ********************************************************************************************************************
 */

package cn.sagacloud.android.cadengine.items

import android.graphics.*
import android.view.MotionEvent
import com.sybotan.android.graphy.SGraphyItem
import com.sybotan.android.graphy.SMotionEvent


/**
 *   空间中心点
 * @author  Andy
 */
class SpatialCenterItem(name :String,parent: SGraphyItem? = null) : SGraphyItem(parent) {
        // 画笔
    private var pen = Paint()
    private var pain = Paint()
    private var panText = Paint()
    private var panT = Paint()
     var flag:Boolean = false
    private var codename:String

    /**
     * 默认构造函数
     */
    init {
        this.hide()
        pen.color = Color.BLACK
        pen.strokeWidth = 5f
        pen.isAntiAlias = true
        pen.style = Paint.Style.FILL

        pain.color = Color.BLUE
        pain.strokeWidth = 5f
        pain.isAntiAlias = false

        panText.color = Color.BLACK
        panText.strokeWidth = 5f
        panText.isAntiAlias = true
        panText.textSize=800f

        panT.color = Color.BLUE
        panT.strokeWidth = 5f
        panT.isAntiAlias = false
        panT.textSize=40f
        this.codename=name
        /** item获取焦点ItemIsFocusable,移动ItemIsMovable */
//        flags= EnumSet.of(SGraphyItemFlag.ItemIsFocusable)
//        flags = EnumSet.of(SGraphyItemFlag.ItemIsMovable)
    } // init


    /**
     * Item对象边界区域
     */
    override fun boundingRect(): RectF {
        return RectF(-10f, -10f,
                50f, 50f)
    } // Function boundingRect()

    /**
     * @param   canvas      画布对象
     */
    override fun onDraw(canvas: Canvas) {
        canvas.drawText(codename.trim(),-10f,0f,panText)
        return
    } // Function paint()

    /**
     *  点击
     */
    override fun onSingleTapUp(e: SMotionEvent): Boolean {
        return false
    }

    override fun onScroll(e1: SMotionEvent, e2: SMotionEvent, distanceX: Float, distanceY: Float): Boolean {
        flag=false
        return super.onScroll(e1, e2, distanceX, distanceY)
    }

} // Class GraphyWallItem