|
@@ -1,48 +1,54 @@
|
|
|
-import { GeometricObject } from "../../../core/models/objects/geometric-object";
|
|
|
-import { ELEMENTS_CLASS } from "../../../core/enums/elements-class-enum";
|
|
|
+/*
|
|
|
+ * iGeom by LInE
|
|
|
+ * Geometric Object: Point
|
|
|
+ * Model to Point
|
|
|
+ * www.matematica.br/igeom
|
|
|
+ * ./app/components/point-component/models/point-model.js
|
|
|
+ * @version 2020/11/02: Implemented Line instersection
|
|
|
+ */
|
|
|
+
|
|
|
+import { GeometricObject } from "../../../core/models/objects/geometric-object";
|
|
|
+import { ELEMENTS_CLASS } from "../../../core/enums/elements-class-enum";
|
|
|
+
|
|
|
export class PointModel extends GeometricObject {
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param {number} posX X Position ex: (38.5) float precision
|
|
|
- * @param {number} posY Y Position ex: (-38.5) float precision
|
|
|
- * @param {string} label Label ex: (P)
|
|
|
- */
|
|
|
- constructor(posX, posY, label, id) {
|
|
|
+
|
|
|
+ // @param {number } posX X Position ex: (38.5) float precision
|
|
|
+ // @param {number } posY Y Position ex: (-38.5) float precision
|
|
|
+ // @param {string } label Label ex: (P)
|
|
|
+ constructor (posX, posY, label, id) {
|
|
|
super(id);
|
|
|
this.posX = posX;
|
|
|
this.posY = posY;
|
|
|
this.setLabel(label);
|
|
|
super.setClass(ELEMENTS_CLASS.POINT);
|
|
|
- this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
|
|
|
+ this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
|
|
|
this.color = -16711936;
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param {konvaObject} Object of Konva Library
|
|
|
- * @param {*} event
|
|
|
- */
|
|
|
- update(konvaObject, event) {
|
|
|
+ // @param {konvaObject } Object of Konva Library
|
|
|
+ // @param {* } event
|
|
|
+ update (konvaObject, event) {
|
|
|
this.posX = konvaObject.attrs.startPosX + event.target._lastPos.x;
|
|
|
this.posY = konvaObject.attrs.startPosY + event.target._lastPos.y;
|
|
|
- this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
|
|
|
- }
|
|
|
- bind(posX, posY, label) {
|
|
|
+ this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
|
|
|
+ }
|
|
|
+
|
|
|
+ bind (posX, posY, label) {
|
|
|
this.posX = posX;
|
|
|
this.posY = posY;
|
|
|
this.setLabel(label);
|
|
|
- this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
|
|
|
- }
|
|
|
- /**
|
|
|
- * Create new Intersection By Line of Script .geo
|
|
|
- * @param {Map} map JavaScript Map
|
|
|
- * @param {List} list List of Generic Objects
|
|
|
- */
|
|
|
- static do(map, list) {
|
|
|
+ this.definitions = [{ id: this.posX + 5 }, { id: -this.posY - 5 }];
|
|
|
+ }
|
|
|
+
|
|
|
+ // Create new Intersection By Line of Script .geo
|
|
|
+ // @param {Map } map JavaScript Map
|
|
|
+ // @param {List } list List of Generic Objects
|
|
|
+ static do (map, list) {
|
|
|
const id = map.get("id");
|
|
|
const x = map.get("param")[0] - 5;
|
|
|
const y = -map.get("param")[1] + 5;
|
|
|
const label = map.get("label")[0];
|
|
|
return new PointModel(x, y, label, id);
|
|
|
- }
|
|
|
-}
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|