CurveRoadEdge.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //墙的边缘线
  2. import Geometry from "./Geometry.js";
  3. import VectorType from "../enum/VectorType.js";
  4. import { mathUtil } from "../Util/MathUtil.js";
  5. import VectorWight from "../enum/VectorWeight.js";
  6. import VectorStyle from "../enum/VectorStyle.js";
  7. import Constant from '../Constant';
  8. export default class CurveRoadEdge extends Geometry {
  9. constructor(start, end, vectorId, parentId, points) {
  10. super();
  11. this.parent = parentId;
  12. this.start = {};
  13. this.end = {};
  14. this.vectorId = null;
  15. this.style = VectorStyle.SingleSolidLine;
  16. this.weight = VectorWight.Thinning;
  17. this.points = points || [];
  18. this.curves = [];
  19. this.geoType = VectorType.CurveRoadEdge;
  20. this.roadSide = null;
  21. this.setId(vectorId);
  22. this.setPositions(start, end);
  23. }
  24. setPositions(point1, point2) {
  25. this.start.x = point1.x;
  26. this.start.y = point1.y;
  27. this.end.x = point2.x;
  28. this.end.y = point2.y;
  29. }
  30. setPosition(position, dir) {
  31. if (dir == "start") {
  32. mathUtil.clonePoint(this.start, position);
  33. } else if (dir == "end") {
  34. mathUtil.clonePoint(this.end, position);
  35. }
  36. }
  37. getPosition(dir) {
  38. if (dir == "start") {
  39. return this.start;
  40. } else if (dir == "end") {
  41. return this.end;
  42. } else {
  43. return null;
  44. }
  45. }
  46. // setRoadSide() {
  47. // if (!this.roadSide) {
  48. // this.roadSide = {};
  49. // this.roadSide['width'] = Constant.roadSideWidth;
  50. // }
  51. // this.roadSide['start'] = this.start;
  52. // this.roadSide['end'] = this.end;
  53. // }
  54. // removeRoadSide() {
  55. // this.roadSide = null;
  56. // }
  57. }