Sign.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import Geometry from './Geometry'
  2. import { mathUtil } from '../MathUtil.js'
  3. import SelectState from '../enum/SelectState.js'
  4. import VectorType from '../enum/VectorType.js'
  5. export default class Sign extends Geometry {
  6. constructor(center, vectorId, type) {
  7. super()
  8. this.center = center
  9. this.geoType = type
  10. this.angle = 0 //逆时针为负,顺时针为正。单位是:°
  11. this.scale = 1 //缩放比例
  12. this.setId(vectorId)
  13. }
  14. isContain(position) {
  15. const dis = mathUtil.getDistance(position, this.center)
  16. let len = this.getLen() * this.scale
  17. if (dis < len / 2) {
  18. return SelectState.Select
  19. } else {
  20. return null
  21. }
  22. }
  23. getLen() {
  24. // switch (this.geoType) {
  25. // case VectorType.Cigaret: //烟头
  26. // return 1.3
  27. // case VectorType.FirePoint: //起火点
  28. // return 3.4
  29. // case VectorType.LeftFootPrint: //脚印
  30. // return 1
  31. // case VectorType.RightFootPrint: //脚印
  32. // return 1
  33. // case VectorType.RightShoePrint: //鞋印
  34. // return 0.8
  35. // case VectorType.ShoePrint: //鞋印
  36. // return 0.8
  37. // case VectorType.FingerPrint: //指纹
  38. // return 2
  39. // case VectorType.DeadBody: //尸体
  40. // return 0.3
  41. // case VectorType.BloodStain: //血迹
  42. // return 2.4
  43. // }
  44. return 0.2;
  45. }
  46. }