|
@@ -196,13 +196,29 @@ export class LineSegmentModel extends GeometricObject {
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- static do (map, list) {
|
|
|
+
|
|
|
+ // Help: search object in more stable structure
|
|
|
+ static findOD_LS (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!
|
|
|
+ }
|
|
|
+
|
|
|
+ // In reading GEO file, need to transform a Map in GeometricObject
|
|
|
+ // @see app/core/parser/file-parser.js
|
|
|
+ // @see app/core/parser/parser-orchestrator.js
|
|
|
+ static do (map, vecIdObj, list) {
|
|
|
const id = map.get("id");
|
|
|
const pointAId = map.get("param")[0];
|
|
|
const pointBId = map.get("param")[1];
|
|
|
+ // const pointA = list.find(x => x.id === pointAId);
|
|
|
+ // const pointB = list.find(x => x.id === pointBId);
|
|
|
+ const index_pointA = LineSegmentModel.findOD_LS(vecIdObj, pointAId); // get the index of vecIdObj[ii].id == pointAId
|
|
|
+ const index_pointB = LineSegmentModel.findOD_LS(vecIdObj, pointBId); // get the index of vecIdObj[ii].id == pointBId
|
|
|
+ const pointA = list[index_pointA]; // pointA = vecIdObj[index_pointA].obj; aux4 += "5,";
|
|
|
+ const pointB = list[index_pointB]; // pointB = vecIdObj[index_pointB].obj; aux4 += "6,";
|
|
|
|
|
|
- const pointA = list.find(x => x.id === pointAId);
|
|
|
- const pointB = list.find(x => x.id === pointBId);
|
|
|
const label = map.get("label")[0];
|
|
|
return new LineSegmentModel(pointA, pointB, label, id);
|
|
|
}
|