CurveRoadEdge.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. //墙的边缘线
  2. import Geometry from "./Geometry.js";
  3. import VectorType from "../enum/VectorType.js";
  4. import { mathUtil } from "../Util/MathUtil.js";
  5. export default class CurveRoadEdge extends Geometry {
  6. constructor(start, end, vectorId, parentId, points) {
  7. super();
  8. this.parent = parentId;
  9. this.start = {};
  10. this.end = {};
  11. this.vectorId = null;
  12. this.style = null;
  13. this.points = points || [];
  14. this.curves = [];
  15. this.geoType = VectorType.CurveRoadEdge;
  16. this.setId(vectorId);
  17. this.setPositions(start, end);
  18. }
  19. setPositions(point1, point2) {
  20. this.start.x = point1.x;
  21. this.start.y = point1.y;
  22. this.end.x = point2.x;
  23. this.end.y = point2.y;
  24. }
  25. setPosition(position, dir) {
  26. if (dir == "start") {
  27. mathUtil.clonePoint(this.start, position);
  28. } else if (dir == "end") {
  29. mathUtil.clonePoint(this.end, position);
  30. }
  31. }
  32. getPosition(dir) {
  33. if (dir == "start") {
  34. return this.start;
  35. } else if (dir == "end") {
  36. return this.end;
  37. } else {
  38. return null;
  39. }
  40. }
  41. }