|
@@ -1,32 +1,57 @@
|
|
|
import { DynamicObject } from "./dynamic-object";
|
|
|
|
|
|
export class GeometricObject extends DynamicObject {
|
|
|
- /**
|
|
|
- * @param {number} id Id of object
|
|
|
- */
|
|
|
- constructor(id) {
|
|
|
+
|
|
|
+ //DEBUG: get String from map to check associated geometric object
|
|
|
+ static printMap_go (map, version) {
|
|
|
+ var str = ""; // if I use "let [key, value] of map" => TypeError: Invalid attempt to destructure non-iterable instance.
|
|
|
+ //for (let {key, value} of map) { str += "[" + key + "=" + value + "] "; }
|
|
|
+ let entries = Object.entries(map);
|
|
|
+ if (version == "map") for (let [index, [key, value]] of entries.entries()) { str += "[" + key + "=" + value + "] "; }
|
|
|
+ if (version == "list") for (let {key, value} of entries.entries()) { str += "[" + key + "=" + value + "] "; }
|
|
|
+ return str;
|
|
|
+ }
|
|
|
+ // let index = 0; // https://stackoverflow.com/questions/45251605/iterate-over-javascript-object-with-index
|
|
|
+ // for (let value of object) {
|
|
|
+ // //do something with rest
|
|
|
+ // if (index >= 1) { } // do something with the third and following items
|
|
|
+ // index++; }
|
|
|
+
|
|
|
+ // @param {number} id Id of object
|
|
|
+ constructor (id) {
|
|
|
super(id);
|
|
|
this.borderColor;
|
|
|
this.backgroundColor;
|
|
|
this.edgeThinckness;
|
|
|
this.draggable = true;
|
|
|
- }
|
|
|
- setBorderColor(color) {
|
|
|
+ }
|
|
|
+
|
|
|
+ setBorderColor (color) {
|
|
|
this.borderColor = color;
|
|
|
- }
|
|
|
- setBackgroundColor(color) {
|
|
|
+ }
|
|
|
+
|
|
|
+ setBackgroundColor (color) {
|
|
|
this.backgroundColor = color;
|
|
|
- }
|
|
|
- setEdgeThinckness(edgeThinckness) {
|
|
|
+ }
|
|
|
+
|
|
|
+ setEdgeThinckness (edgeThinckness) {
|
|
|
this.edgeThinckness = edgeThinckness;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * Update properties of this Intersection
|
|
|
- * @param {DrawerAggregator} aggregator Drawer Aggregator
|
|
|
- * @param {event} event
|
|
|
- */
|
|
|
- update(konvaObject, event) {
|
|
|
- throw "not implemented exception";
|
|
|
- }
|
|
|
-}
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // Help each geometric object in GEO construction: search object in more stable structure
|
|
|
+ static findOD (vecIdObj, id) {
|
|
|
+ var tam = vecIdObj.length, ii;
|
|
|
+ for (ii=0; ii<tam; ii++)
|
|
|
+ if (vecIdObj[ii].id === id) return ii;
|
|
|
+ return -1; // Error! Not found!
|
|
|
+ }
|
|
|
+
|
|
|
+ // Update properties of this Intersection
|
|
|
+ // @param {DrawerAggregator} aggregator Drawer Aggregator
|
|
|
+ // @param {event} event
|
|
|
+ update (konvaObject, event) {
|
|
|
+ throw "not implemented exception";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|