12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- //墙的边缘线
- import Geometry from "./Geometry.js";
- import VectorType from "../enum/VectorType.js";
- import { mathUtil } from "../Util/MathUtil.js";
- export default class RoadEdge extends Geometry {
- constructor(start, end, vectorId, parentId) {
- super();
- this.parent = parentId;
- this.start = {};
- this.end = {};
- this.vectorId = null;
- this.geoType = VectorType.RoadEdge;
- this.setId(vectorId);
- this.setPositions(start, end);
- }
- setPositions(point1, point2) {
- this.start.x = point1.x;
- this.start.y = point1.y;
- this.end.x = point2.x;
- this.end.y = point2.y;
- }
- setPosition(position, dir) {
- if (dir == "start") {
- mathUtil.clonePoint(this.start, position);
- } else if (dir == "end") {
- mathUtil.clonePoint(this.end, position);
- }
- }
- getPosition(dir) {
- if (dir == "start") {
- return this.start;
- } else if (dir == "end") {
- return this.end;
- } else {
- return null;
- }
- }
- getLine() {
- let line = mathUtil.createLine1(this.start, this.end);
- return line;
- }
- }
|