Line.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import VectorType from "../enum/VectorType.js";
  2. import VectorCategory from "../enum/VectorCategory.js";
  3. import SelectState from "../enum/SelectState.js";
  4. import Geometry from "./Geometry";
  5. import Constant from "../Constant.js";
  6. import Style from "@/graphic/CanvasStyle/index.js";
  7. import Settings from "../Settings";
  8. export default class Line extends Geometry {
  9. constructor(startId, endId, vectorId) {
  10. super();
  11. this.startId = startId;
  12. this.endId = endId;
  13. this.category = Settings.selectLineCategory;
  14. this.locationMode = null;
  15. this.color = Style.SingleArrowLine.strokeStyle; //箭头类型会用到
  16. this.value = null; //测量线会用到
  17. this.geoType = VectorType.Line;
  18. this.setId(vectorId);
  19. }
  20. //NormalLine,GuideLine,MeasureLine,BaseLine
  21. setCategory(value) {
  22. if (!value) {
  23. this.category = Settings.selectLineCategory;
  24. } else {
  25. }
  26. this.category = value;
  27. }
  28. getDir(pointId) {
  29. if (this.startId == pointId) {
  30. return "start";
  31. } else if (this.endId == pointId) {
  32. return "end";
  33. } else {
  34. return null;
  35. }
  36. }
  37. }