|
@@ -20,7 +20,7 @@ export class IntersectionModel extends PointModel {
|
|
|
// @param {boolean} visible Visiblity of Object
|
|
|
// @param {number} index Index position of Object ex (1)
|
|
|
// @param {id} id indentity of intersection ex: 0
|
|
|
- constructor(posX, posY, label, og1, og2, visible, index, id) {
|
|
|
+ constructor (posX, posY, label, og1, og2, visible, index, id) {
|
|
|
try { //D //leo
|
|
|
super(posX, posY, label, id);
|
|
|
this.og1 = og1;
|
|
@@ -28,15 +28,17 @@ export class IntersectionModel extends PointModel {
|
|
|
super.setClass(ELEMENTS_CLASS.INTERSECTION_POINT);
|
|
|
this.visible = visible;
|
|
|
this.index = index;
|
|
|
- this.color = -65536;
|
|
|
+ this.color = -65536; // rgba(255,0,0,1)
|
|
|
this.definitions = this.getDefinitions();
|
|
|
+ this.backgroundColor = "#aa0000"; // setBackgroundColor(color)
|
|
|
+console.log("intersection-model.js: og1=" + og1.label +", og2=" + og2.label + ", this.color=" + this.color); // console.trace(); //leo
|
|
|
} catch (e) { console.log("app/components/intersection-component/models/intersection-model.js: constructor(.): erro!\n" + e.stack); }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
// Update properties of this Intersection
|
|
|
// @param {DrawerAggregator} aggregator Drawer Aggregator
|
|
|
// @param {event} event
|
|
|
- update(aggregator, event) {
|
|
|
+ update (aggregator, event) {
|
|
|
try { //D //leo
|
|
|
const intersections = this.og1.getIntersection(this.og2);
|
|
|
if (intersections.length == 1) {
|
|
@@ -51,16 +53,16 @@ export class IntersectionModel extends PointModel {
|
|
|
this.visible = false;
|
|
|
this.definitions = this.getDefinitions();
|
|
|
return;
|
|
|
- }
|
|
|
+ }
|
|
|
if (!this.og2.insideSegment(this.posX, this.posY)) {
|
|
|
this.posX = Number.MAX_SAFE_INTEGER;
|
|
|
this.posY = Number.MAX_SAFE_INTEGER;
|
|
|
this.visible = false;
|
|
|
this.definitions = this.getDefinitions();
|
|
|
return;
|
|
|
- }
|
|
|
+ }
|
|
|
return;
|
|
|
- }
|
|
|
+ }
|
|
|
if (intersections.length > 1) {
|
|
|
for (let index = 0; index < intersections.length; index++) {
|
|
|
const intersection = intersections[index];
|
|
@@ -68,36 +70,36 @@ export class IntersectionModel extends PointModel {
|
|
|
this.posX = parseFloat(intersection.posX.toFixed(2));
|
|
|
this.posY = parseFloat(intersection.posY.toFixed(2));
|
|
|
this.visible = intersection.visible;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
this.definitions = this.getDefinitions();
|
|
|
} catch (e) { console.log("app/components/intersection-component/models/intersection-model.js: update(aggregator, event): erro!"); }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- getDefinitions() {
|
|
|
+ getDefinitions () {
|
|
|
try { //D //leo
|
|
|
return [{ id: this.og1.id }, { id: this.og2.id }, { id: this.index + 1 }, { id: this.visible ? 1 : 0 }];
|
|
|
} catch (e) { console.log("app/components/intersection-component/models/intersection-model.js: getDefinitions(): erro!"); }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- bind(posX, posY, label, og1, og2, visible, index) {
|
|
|
+ bind (posX, posY, label, og1, og2, visible, index) {
|
|
|
try { //D //leo
|
|
|
super.bind(posX, posY, label);
|
|
|
this.og1 = og1;
|
|
|
this.og2 = og2;
|
|
|
this.visible = visible;
|
|
|
this.index = index;
|
|
|
- this.color = -65536;
|
|
|
+ this.color = -65536; // rgba(255,0,0,1)
|
|
|
this.definitions = this.getDefinitions();
|
|
|
super.setClass(ELEMENTS_CLASS.INTERSECTION_POINT);
|
|
|
} catch (e) { console.log("app/components/intersection-component/models/intersection-model.js: bind(.): erro!\n" + e.stack); }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- // Create new Intersection By Line of Script .geo
|
|
|
+ // Create new Intersection of lines (by script ".geo")
|
|
|
// @param {Map} map JavaScript Map
|
|
|
// @param {[]} list List of Generic Objects
|
|
|
- static do(map, list) {
|
|
|
+ static do (map, list) {
|
|
|
try { //D //leo
|
|
|
const id = map.get("id");
|
|
|
const og1_Id = map.get("param")[0];
|
|
@@ -118,8 +120,8 @@ export class IntersectionModel extends PointModel {
|
|
|
const i = intersections.find(x => x.index == index);
|
|
|
i.bind(i.posX, i.posY, label, og1, og2, true, index);
|
|
|
return i;
|
|
|
- }
|
|
|
+ }
|
|
|
} catch (e) { console.log("app/components/intersection-component/models/intersection-model.js: do(.): erro!"); }
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
-}
|
|
|
+ } // export class IntersectionModel extends PointModel
|