Point.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import VectorType from "../enum/VectorType.js";
  2. import VectorCategory from "../enum/VectorCategory.js";
  3. import Geometry from "./Geometry";
  4. import Settings from "../Settings";
  5. export default class Point extends Geometry {
  6. constructor(position, vectorId) {
  7. super();
  8. this.x = null;
  9. this.y = null;
  10. this.parent = {};
  11. this.linkedBasePointId = null; //关联基准点
  12. this.linkedTestPointId = null; //关联待测点
  13. this.locationMode = null; //如果该点是待测点,采用的定位法是哪种
  14. this.category = Settings.selectPointCategory;
  15. this.geoType = VectorType.Point;
  16. this.setId(vectorId);
  17. this.setPosition(position);
  18. }
  19. setPosition(position) {
  20. this.x = position.x;
  21. this.y = position.y;
  22. }
  23. getCategory() {
  24. return this.category;
  25. }
  26. getLinkedBasePointId() {
  27. return this.linkedBasePointId;
  28. }
  29. setLinkedBasePointId(pointId) {
  30. this.linkedBasePointId = pointId;
  31. }
  32. setLinkedTestPointId(pointId) {
  33. this.linkedTestPointId = pointId;
  34. }
  35. getLinkedTestPointId() {
  36. return this.linkedTestPointId;
  37. }
  38. //基准点:BasePoint
  39. setCategory(value) {
  40. if (!value) {
  41. this.category = Settings.selectPointCategory;
  42. } else {
  43. this.category = value;
  44. }
  45. }
  46. setLocationMode(value) {
  47. this.locationMode = value;
  48. }
  49. getLocationMode() {
  50. return this.locationMode;
  51. }
  52. }