Skip to content

Commit

Permalink
wip commit
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Wicenec committed Jul 5, 2024
1 parent 77263e3 commit a84a702
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/Edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import { Field } from './Field';
import { Utils } from './Utils';
import { Errors } from './Errors';
import * as ko from "knockout";
import { CategoryData } from './CategoryData';

export class Edge {
private _id : string
Expand All @@ -43,7 +42,7 @@ export class Edge {
private closesLoop : boolean; // indicates that this is a special type of edge that can be drawn in eagle to specify the start/end of groups.
private selectionRelative : boolean // indicates if the edge is either selected or attached to a selected node
private isShortEdge : ko.Observable<boolean>;
private errors : {issue:Errors.Issue, validity:Errors.Validity}[]
private errorsArray : {issue:Errors.Issue, validity:Errors.Validity}[]

constructor(srcNodeKey : number, srcPortId : string, destNodeKey : number, destPortId : string, loopAware: boolean, closesLoop: boolean, selectionRelative : boolean){
this._id = Utils.uuidv4();
Expand All @@ -57,7 +56,7 @@ export class Edge {
this.closesLoop = closesLoop;
this.selectionRelative = selectionRelative;
this.isShortEdge = ko.observable(false)
this.errors = [];
this.errorsArray = [];
}

getId = () : string => {
Expand Down Expand Up @@ -178,6 +177,10 @@ export class Edge {
return result;
}

getErrorsArray = () : {issue:Errors.Issue, validity:Errors.Validity}[] => {
return this.errorsArray;
}

static toOJSJson(edge : Edge) : object {
return {
from: edge.srcNodeKey,
Expand Down Expand Up @@ -525,6 +528,6 @@ export class Edge {
if (type === "warning" && errorsWarnings !== null){
errorsWarnings.warnings.push(issue);
}
Eagle.getInstance().logicalGraph().findEdgeById(edgeId)?.errors.push({issue:issue, validity:linkValid})
Eagle.getInstance().logicalGraph().findEdgeById(edgeId)?.errorsArray.push({issue:issue, validity:linkValid})
}
}
4 changes: 4 additions & 0 deletions src/LogicalGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -784,4 +784,8 @@ export class LogicalGraph {

return radius;
}

static isValid () : void {
//here should be the higher level graph wide checks for graph validity
}
}
3 changes: 2 additions & 1 deletion src/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,7 @@ export class Utils {

static checkGraph(eagle: Eagle): Errors.ErrorsWarnings {
const errorsWarnings: Errors.ErrorsWarnings = {warnings: [], errors: []};


const graph: LogicalGraph = eagle.logicalGraph();

Expand Down Expand Up @@ -1446,7 +1447,7 @@ export class Utils {

// check all edges are valid
for (const edge of graph.getEdges()){
Edge.isValid(eagle,false, edge.getId(), edge.getSrcNodeKey(), edge.getSrcPortId(), edge.getDestNodeKey(), edge.getDestPortId(), edge.isLoopAware(), edge.isClosesLoop(), false, false, errorsWarnings);
Edge.isValid(eagle,false, edge.getId(), edge.getSrcNodeKey(), edge.getSrcPortId(), edge.getDestNodeKey(), edge.getDestPortId(), edge.isLoopAware(), edge.isClosesLoop(), false, false, {warnings: [], errors: []});
}

// check that all node, edge, field ids are unique
Expand Down

0 comments on commit a84a702

Please sign in to comment.