|
@@ -1,5 +1,6 @@
|
|
import { ELEMENTS_CLASS } from "../enums/elements-class-enum";
|
|
import { ELEMENTS_CLASS } from "../enums/elements-class-enum";
|
|
import { PointModel } from "../../components/point-component/models/point-model";
|
|
import { PointModel } from "../../components/point-component/models/point-model";
|
|
|
|
+import { MiddlePointModel } from "../../components/middle-point/models/middle-point-model";
|
|
import { CircumferenceModel } from "../../components/circumference-component/models/circumference-model";
|
|
import { CircumferenceModel } from "../../components/circumference-component/models/circumference-model";
|
|
import { LineSegmentModel } from "../../components/line-segment-component/models/line-segment-model";
|
|
import { LineSegmentModel } from "../../components/line-segment-component/models/line-segment-model";
|
|
import { IntersectionModel } from "../../components/intersection-component/models/intersection-model";
|
|
import { IntersectionModel } from "../../components/intersection-component/models/intersection-model";
|
|
@@ -8,17 +9,20 @@ import { label as Label } from '../../component-registry/label';
|
|
import { LineModel } from "../../components/line-component/models/line-model";
|
|
import { LineModel } from "../../components/line-component/models/line-model";
|
|
export class ParserOrchestrator {
|
|
export class ParserOrchestrator {
|
|
|
|
|
|
- constructor(mapArr) {
|
|
|
|
|
|
+ constructor (mapArr) {
|
|
this.mapArr = mapArr;
|
|
this.mapArr = mapArr;
|
|
this.list = new Array();
|
|
this.list = new Array();
|
|
this.drawersMap = new Map();
|
|
this.drawersMap = new Map();
|
|
this.tools = menu.tools;
|
|
this.tools = menu.tools;
|
|
- }
|
|
|
|
- orchestrate() {
|
|
|
|
- for (const i in this.mapArr) this.do(this.mapArr[i]);
|
|
|
|
|
|
+ }
|
|
|
|
+ orchestrate () {
|
|
|
|
+var aux = "";
|
|
|
|
+var ii=0;
|
|
|
|
+ for (const i in this.mapArr) { this.do(this.mapArr[i]); aux += "(" + ii + "," + this.mapArr[i] + "); "; ii++; }
|
|
for (const i in this.list) this.draw(this.list[i]);
|
|
for (const i in this.list) this.draw(this.list[i]);
|
|
- }
|
|
|
|
- do(map) {
|
|
|
|
|
|
+console.log("parser-orchestrator.js: orchestrate(): " + aux);
|
|
|
|
+ }
|
|
|
|
+ do (map) {
|
|
let object;
|
|
let object;
|
|
switch (map.get("type")) {
|
|
switch (map.get("type")) {
|
|
case ELEMENTS_CLASS.CIRCUMFERENCE:
|
|
case ELEMENTS_CLASS.CIRCUMFERENCE:
|
|
@@ -30,6 +34,9 @@ export class ParserOrchestrator {
|
|
case ELEMENTS_CLASS.POINT:
|
|
case ELEMENTS_CLASS.POINT:
|
|
object = PointModel.do(map, this.list);
|
|
object = PointModel.do(map, this.list);
|
|
break;
|
|
break;
|
|
|
|
+ case ELEMENTS_CLASS.MIDDLE_POINT:
|
|
|
|
+ object = MiddlePointModel.do(map, this.list);
|
|
|
|
+ break;
|
|
case ELEMENTS_CLASS.LINE_SEGMENT:
|
|
case ELEMENTS_CLASS.LINE_SEGMENT:
|
|
object = LineSegmentModel.do(map, this.list);
|
|
object = LineSegmentModel.do(map, this.list);
|
|
break;
|
|
break;
|
|
@@ -38,8 +45,7 @@ export class ParserOrchestrator {
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
if (object == undefined) return;
|
|
if (object == undefined) return;
|
|
switch (object.elementClass) {
|
|
switch (object.elementClass) {
|
|
case ELEMENTS_CLASS.CIRCUMFERENCE:
|
|
case ELEMENTS_CLASS.CIRCUMFERENCE:
|
|
@@ -48,11 +54,10 @@ export class ParserOrchestrator {
|
|
Label.pushLower(object.label);
|
|
Label.pushLower(object.label);
|
|
default:
|
|
default:
|
|
Label.pushUpper(object.label);
|
|
Label.pushUpper(object.label);
|
|
- }
|
|
|
|
|
|
+ }
|
|
this.list.push(object);
|
|
this.list.push(object);
|
|
-
|
|
|
|
- }
|
|
|
|
- draw(object) {
|
|
|
|
|
|
+ }
|
|
|
|
+ draw (object) {
|
|
if (object == undefined) return;
|
|
if (object == undefined) return;
|
|
let drawer;
|
|
let drawer;
|
|
|
|
|
|
@@ -74,15 +79,12 @@ export class ParserOrchestrator {
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|
|
- }
|
|
|
|
- drawer.draw({
|
|
|
|
- attrs: {
|
|
|
|
- genericObject: object
|
|
|
|
}
|
|
}
|
|
- });
|
|
|
|
- }
|
|
|
|
|
|
+ drawer.draw ({ attrs: { genericObject: object } });
|
|
|
|
+ }
|
|
|
|
|
|
- getDrawer(elementClass) {
|
|
|
|
|
|
+ getDrawer (elementClass) {
|
|
return this.tools.find(x => x.drawer.elementClass === elementClass).drawer;
|
|
return this.tools.find(x => x.drawer.elementClass === elementClass).drawer;
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|