import Geometry from './Geometry'
import { mathUtil } from '../MathUtil.js'
import SelectState from '../enum/SelectState.js'
import VectorType from '../enum/VectorType.js'

export default class Sign extends Geometry {
    constructor(center, vectorId, type) {
        super()
        this.center = center
        this.geoType = type
        this.angle = 0 //逆时针为负，顺时针为正。单位是：°
        this.scale = 1 //缩放比例
        this.setId(vectorId)
    }

    isContain(position) {
        const dis = mathUtil.getDistance(position, this.center)
        let len = this.getLen() * this.scale
        if (dis < len / 2) {
            return SelectState.Select
        } else {
            return null
        }
    }

    getLen() {
        // switch (this.geoType) {
        //     case VectorType.Cigaret: //烟头
        //         return 1.3
        //     case VectorType.FirePoint: //起火点
        //         return 3.4
        //     case VectorType.LeftFootPrint: //脚印
        //         return 1
        //     case VectorType.RightFootPrint: //脚印
        //         return 1
        //     case VectorType.RightShoePrint: //鞋印
        //         return 0.8
        //     case VectorType.ShoePrint: //鞋印
        //         return 0.8
        //     case VectorType.FingerPrint: //指纹
        //         return 2
        //     case VectorType.DeadBody: //尸体
        //         return 0.3
        //     case VectorType.BloodStain: //血迹
        //         return 2.4
        // }
        return 0.2;
    }

    setAngle(angle){
        this.angle = angle;
    }

    setScale(scale){
        this.scale = scale;
    }
}
