Point.js 773 B

123456789101112131415161718192021222324252627282930313233343536
  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.category = Settings.pointCategory;
  12. this.geoType = VectorType.Point;
  13. this.setId(vectorId);
  14. this.setPosition(position);
  15. }
  16. setPosition(position) {
  17. this.x = position.x;
  18. this.y = position.y;
  19. }
  20. getCategory() {
  21. return this.category;
  22. }
  23. //基准点:BasePoint
  24. setCategory(value) {
  25. if (!value) {
  26. this.category = Settings.pointCategory;
  27. } else {
  28. this.category = value;
  29. }
  30. }
  31. }